gitopo 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +110 -0
- package/bin/gitopo.js +20 -0
- package/dist/renderer/assets/index-B-xnAFkZ.css +1 -0
- package/dist/renderer/assets/index-B4NR76vm.css +1 -0
- package/dist/renderer/assets/index-B8-bMEZL.js +3 -0
- package/dist/renderer/assets/index-BSM6CD5c.js +3 -0
- package/dist/renderer/assets/index-Biwf0g5L.js +3 -0
- package/dist/renderer/assets/index-BkSteF7v.js +3 -0
- package/dist/renderer/assets/index-Bu2Is4Gi.js +3 -0
- package/dist/renderer/assets/index-BuunUFeT.js +3 -0
- package/dist/renderer/assets/index-BztqQcTT.js +3 -0
- package/dist/renderer/assets/index-C5GvfFhL.js +3 -0
- package/dist/renderer/assets/index-C5pqhkpE.css +1 -0
- package/dist/renderer/assets/index-CAjBcm7_.js +3 -0
- package/dist/renderer/assets/index-CPhqr81-.css +1 -0
- package/dist/renderer/assets/index-CRBk_3U9.js +4 -0
- package/dist/renderer/assets/index-CV77y4NX.js +3 -0
- package/dist/renderer/assets/index-CX4EqujF.js +3 -0
- package/dist/renderer/assets/index-Caevx9so.js +3 -0
- package/dist/renderer/assets/index-CbVNESqC.js +3 -0
- package/dist/renderer/assets/index-CgV3hEXF.js +3 -0
- package/dist/renderer/assets/index-Cgxb7yXH.js +3 -0
- package/dist/renderer/assets/index-Cu7Bdfdp.js +3 -0
- package/dist/renderer/assets/index-D-4eDZ-q.css +1 -0
- package/dist/renderer/assets/index-D3WoIbyB.js +3 -0
- package/dist/renderer/assets/index-DATWWeXq.js +3 -0
- package/dist/renderer/assets/index-DGVlk6ue.css +1 -0
- package/dist/renderer/assets/index-DKxk7KCa.js +3 -0
- package/dist/renderer/assets/index-DPD27o55.js +3 -0
- package/dist/renderer/assets/index-DaP2KGsB.js +3 -0
- package/dist/renderer/assets/index-DeuGEmKM.js +3 -0
- package/dist/renderer/assets/index-Dg_WVb0M.js +3 -0
- package/dist/renderer/assets/index-Dhbf0Fci.js +3 -0
- package/dist/renderer/assets/index-DnUHDinm.css +1 -0
- package/dist/renderer/assets/index-DuNCgxuJ.js +3 -0
- package/dist/renderer/assets/index-HYzjpgUI.js +3 -0
- package/dist/renderer/assets/index-Mn_-m7Tt.js +3 -0
- package/dist/renderer/assets/index-N_FqOAes.js +3 -0
- package/dist/renderer/assets/index-TVFDuiMT.js +3 -0
- package/dist/renderer/assets/index-UF9gobFY.css +1 -0
- package/dist/renderer/assets/index-V7JII7CO.js +3 -0
- package/dist/renderer/assets/index-jDaMuPPI.css +1 -0
- package/dist/renderer/assets/index-kUku5Va6.js +3 -0
- package/dist/renderer/index.html +38 -0
- package/docs/screenshot.png +0 -0
- package/package.json +57 -0
- package/src/main/index.js +85 -0
- package/src/main/preload.js +16 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asial Corporation
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# gitopo
|
|
2
|
+
|
|
3
|
+
Topology-preserving Git commit graph visualizer that highlights key branches.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
gitopo visualizes Git commit history with special treatment for mainline branches following Git Flow, GitHub Flow, and GitLab Flow conventions. It displays commits in columns based on their branch lineage, making it easy to understand the relationship between branches.
|
|
8
|
+
|
|
9
|
+
Built with Electron, Vite, and D3.js.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Key Branch Columns**: Up to 3 main branches displayed in dedicated columns with distinct colors
|
|
16
|
+
- **Sub-branch Detection**: Automatically detects and groups commits that belong to feature branches
|
|
17
|
+
- **Pull Request Display**: Shows open PRs from GitHub (requires `gh` CLI)
|
|
18
|
+
- **Time Axis Zoom**: Ctrl/Cmd + scroll to zoom in/out on the time axis
|
|
19
|
+
- **Pan Navigation**: Scroll or drag to navigate the graph
|
|
20
|
+
- **Configurable Commit Limit**: Adjust the number of commits to display (1 to 100,000,000)
|
|
21
|
+
- **Loading Screen**: Shows progress during initialization
|
|
22
|
+
- **Responsive UI**: Controls adapt to window width
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx gitopo
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or install globally:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g gitopo
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Run in any Git repository:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cd your-project
|
|
42
|
+
npx gitopo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The application launches in the background. Close the window to exit.
|
|
46
|
+
|
|
47
|
+
### Controls
|
|
48
|
+
|
|
49
|
+
| Action | Description |
|
|
50
|
+
|--------|-------------|
|
|
51
|
+
| Scroll | Pan the graph |
|
|
52
|
+
| Drag | Pan the graph |
|
|
53
|
+
| Ctrl/Cmd + Scroll | Zoom time axis |
|
|
54
|
+
| Hover on commit | Show commit details tooltip |
|
|
55
|
+
| Hover on Other commit | Highlight connecting edges to key branches |
|
|
56
|
+
|
|
57
|
+
### UI Elements
|
|
58
|
+
|
|
59
|
+
- **Branch Selectors (1-3)**: Choose which branches to display as key columns
|
|
60
|
+
- **Commits Input**: Set the maximum number of commits to load
|
|
61
|
+
- **Column Headers**: Branch names displayed at the top (follows horizontal scroll)
|
|
62
|
+
|
|
63
|
+
## Configuration
|
|
64
|
+
|
|
65
|
+
Add a `gitopo` key to your project's `package.json`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"gitopo": {
|
|
70
|
+
"keyBranches": ["origin/main", "origin/staging", "origin/production"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Options
|
|
76
|
+
|
|
77
|
+
| Option | Type | Description |
|
|
78
|
+
|--------|------|-------------|
|
|
79
|
+
| `keyBranches` | `string[]` | Default branches for the 3 branch selectors (in order) |
|
|
80
|
+
|
|
81
|
+
If `keyBranches` is not specified, the first selector defaults to `main` or `master`.
|
|
82
|
+
|
|
83
|
+
## Requirements
|
|
84
|
+
|
|
85
|
+
- Node.js
|
|
86
|
+
- Git
|
|
87
|
+
- GitHub CLI (`gh`) - optional, for PR display
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Install dependencies
|
|
93
|
+
npm install
|
|
94
|
+
|
|
95
|
+
# Start Vite dev server
|
|
96
|
+
npm run dev
|
|
97
|
+
|
|
98
|
+
# In another terminal, start Electron in dev mode
|
|
99
|
+
npm run electron:dev
|
|
100
|
+
|
|
101
|
+
# Build for production
|
|
102
|
+
npm run build
|
|
103
|
+
|
|
104
|
+
# Run production build
|
|
105
|
+
npx gitopo
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
package/bin/gitopo.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const electron = require('electron');
|
|
7
|
+
const mainPath = path.join(__dirname, '../src/main/index.js');
|
|
8
|
+
|
|
9
|
+
// Spawn Electron in detached mode so it runs independently
|
|
10
|
+
const child = spawn(electron, [mainPath], {
|
|
11
|
+
stdio: 'ignore',
|
|
12
|
+
cwd: process.cwd(),
|
|
13
|
+
detached: true,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Allow the parent process to exit independently
|
|
17
|
+
child.unref();
|
|
18
|
+
|
|
19
|
+
// Exit immediately - Electron will continue running in background
|
|
20
|
+
process.exit(0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*{margin:0;padding:0;box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:#1a1a2e;color:#eee;overflow:hidden}#app{width:100vw;height:100vh;position:relative;display:flex;flex-direction:column}#controls{display:flex;align-items:center;gap:20px;padding:12px 20px;background:#16213e;border-bottom:1px solid #333;flex-shrink:0}#repo-name{font-size:16px;font-weight:700;color:#fff;margin-right:20px;padding-right:20px;border-right:1px solid #444}.branch-selector{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.branch-selector label{font-size:13px;color:#888;flex-shrink:0}.branch-selector select{padding:6px 12px;font-size:13px;background:#1a1a2e;color:#eee;border:1px solid #444;border-radius:4px;flex:1;min-width:80px;cursor:pointer}.branch-selector select:hover{border-color:#4fc3f7}.branch-selector select:focus{outline:none;border-color:#4fc3f7}#graph{flex:1;width:100%}.tooltip{position:absolute;background:#1e1e32f2;border:1px solid #4fc3f7;border-radius:6px;padding:10px 14px;font-size:13px;line-height:1.5;max-width:400px;pointer-events:none;z-index:1000;box-shadow:0 4px 12px #0006;transition:opacity .15s ease}.tooltip strong{color:#4fc3f7;font-family:SF Mono,Monaco,Courier New,monospace}.tooltip .date{color:#888;font-size:11px}.tooltip .pr-info{color:#81c784;font-weight:700}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*{margin:0;padding:0;box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:#1a1a2e;color:#eee;overflow:hidden}#app{width:100vw;height:100vh;position:relative;display:flex;flex-direction:column}#controls{display:flex;gap:20px;padding:12px 20px;background:#16213e;border-bottom:1px solid #333;flex-shrink:0}.branch-selector{display:flex;align-items:center;gap:8px}.branch-selector label{font-size:13px;color:#888}.branch-selector select{padding:6px 12px;font-size:13px;background:#1a1a2e;color:#eee;border:1px solid #444;border-radius:4px;min-width:150px;cursor:pointer}.branch-selector select:hover{border-color:#4fc3f7}.branch-selector select:focus{outline:none;border-color:#4fc3f7}#graph{flex:1;width:100%}.tooltip{position:absolute;background:#1e1e32f2;border:1px solid #4fc3f7;border-radius:6px;padding:10px 14px;font-size:13px;line-height:1.5;max-width:400px;pointer-events:none;z-index:1000;box-shadow:0 4px 12px #0006;transition:opacity .15s ease}.tooltip strong{color:#4fc3f7;font-family:SF Mono,Monaco,Courier New,monospace}.tooltip .date{color:#888;font-size:11px}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var un={value:()=>{}};function Re(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new vt(n)}function vt(t){this._=t}function fn(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}vt.prototype=Re.prototype={constructor:vt,on:function(t,e){var n=this._,r=fn(t+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(t=r[o]).type)&&(i=hn(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<s;)if(i=(t=r[o]).type)n[i]=ge(n[i],t.name,e);else if(e==null)for(i in n)n[i]=ge(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new vt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function hn(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function ge(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=un,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Vt="http://www.w3.org/1999/xhtml";const me={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Rt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),me.hasOwnProperty(e)?{space:me[e],local:t}:t}function pn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(n,t)}}function dn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Me(t){var e=Rt(t);return(e.local?dn:pn)(e)}function gn(){}function jt(t){return t==null?gn:function(){return this.querySelector(t)}}function mn(t){typeof t!="function"&&(t=jt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=t.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new R(r,this._parents)}function yn(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function wn(){return[]}function Ie(t){return t==null?wn:function(){return this.querySelectorAll(t)}}function _n(t){return function(){return yn(t.apply(this,arguments))}}function xn(t){typeof t=="function"?t=_n(t):t=Ie(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var s=e[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(t.call(c,c.__data__,l,s)),i.push(c));return new R(r,i)}function Te(t){return function(){return this.matches(t)}}function Oe(t){return function(e){return e.matches(t)}}var vn=Array.prototype.find;function bn(t){return function(){return vn.call(this.children,t)}}function $n(){return this.firstElementChild}function En(t){return this.select(t==null?$n:bn(typeof t=="function"?t:Oe(t)))}var Sn=Array.prototype.filter;function Nn(){return Array.from(this.children)}function Cn(t){return function(){return Sn.call(this.children,t)}}function An(t){return this.selectAll(t==null?Nn:Cn(typeof t=="function"?t:Oe(t)))}function kn(t){typeof t!="function"&&(t=Te(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&t.call(c,c.__data__,l,o)&&a.push(c);return new R(r,this._parents)}function Pe(t){return new Array(t.length)}function Bn(){return new R(this._enter||this._groups.map(Pe),this._parents)}function Et(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Et.prototype={constructor:Et,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Rn(t){return function(){return t}}function Mn(t,e,n,r,i,o){for(var s=0,a,c=e.length,l=o.length;s<l;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new Et(t,o[s]);for(;s<c;++s)(a=e[s])&&(i[s]=a)}function In(t,e,n,r,i,o,s){var a,c,l=new Map,u=e.length,p=o.length,d=new Array(u),g;for(a=0;a<u;++a)(c=e[a])&&(d[a]=g=s.call(c,c.__data__,a,e)+"",l.has(g)?i[a]=c:l.set(g,c));for(a=0;a<p;++a)g=s.call(t,o[a],a,o)+"",(c=l.get(g))?(r[a]=c,c.__data__=o[a],l.delete(g)):n[a]=new Et(t,o[a]);for(a=0;a<u;++a)(c=e[a])&&l.get(d[a])===c&&(i[a]=c)}function Tn(t){return t.__data__}function On(t,e){if(!arguments.length)return Array.from(this,Tn);var n=e?In:Mn,r=this._parents,i=this._groups;typeof t!="function"&&(t=Rn(t));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],p=i[l],d=p.length,g=Pn(t.call(u,u&&u.__data__,l,r)),m=g.length,E=a[l]=new Array(m),k=s[l]=new Array(m),Tt=c[l]=new Array(d);n(u,p,E,k,Tt,g,e);for(var T=0,q=0,N,ht;T<m;++T)if(N=E[T]){for(T>=q&&(q=T+1);!(ht=k[q])&&++q<m;);N._next=ht||null}}return s=new R(s,r),s._enter=a,s._exit=c,s}function Pn(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Fn(){return new R(this._exit||this._groups.map(Pe),this._parents)}function Xn(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function Ln(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],p=l.length,d=a[c]=new Array(p),g,m=0;m<p;++m)(g=l[m]||u[m])&&(d[m]=g);for(;c<i;++c)a[c]=n[c];return new R(a,this._parents)}function Yn(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Hn(t){t||(t=Dn);function e(p,d){return p&&d?t(p.__data__,d.__data__):!p-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(e)}return new R(i,this._parents).order()}function Dn(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function qn(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Vn(){return Array.from(this)}function zn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function Un(){let t=0;for(const e of this)++t;return t}function Zn(){return!this.node()}function Kn(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&t.call(a,a.__data__,o,i);return this}function Gn(t){return function(){this.removeAttribute(t)}}function Wn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Jn(t,e){return function(){this.setAttribute(t,e)}}function Qn(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function jn(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function tr(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function er(t,e){var n=Rt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Wn:Gn:typeof e=="function"?n.local?tr:jn:n.local?Qn:Jn)(n,e))}function Fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function nr(t){return function(){this.style.removeProperty(t)}}function rr(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ir(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function or(t,e,n){return arguments.length>1?this.each((e==null?nr:typeof e=="function"?ir:rr)(t,e,n??"")):W(this.node(),t)}function W(t,e){return t.style.getPropertyValue(e)||Fe(t).getComputedStyle(t,null).getPropertyValue(e)}function sr(t){return function(){delete this[t]}}function ar(t,e){return function(){this[t]=e}}function cr(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function lr(t,e){return arguments.length>1?this.each((e==null?sr:typeof e=="function"?cr:ar)(t,e)):this.node()[t]}function Xe(t){return t.trim().split(/^|\s+/)}function te(t){return t.classList||new Le(t)}function Le(t){this._node=t,this._names=Xe(t.getAttribute("class")||"")}Le.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Ye(t,e){for(var n=te(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function He(t,e){for(var n=te(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function ur(t){return function(){Ye(this,t)}}function fr(t){return function(){He(this,t)}}function hr(t,e){return function(){(e.apply(this,arguments)?Ye:He)(this,t)}}function pr(t,e){var n=Xe(t+"");if(arguments.length<2){for(var r=te(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?hr:e?ur:fr)(n,e))}function dr(){this.textContent=""}function gr(t){return function(){this.textContent=t}}function mr(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function yr(t){return arguments.length?this.each(t==null?dr:(typeof t=="function"?mr:gr)(t)):this.node().textContent}function wr(){this.innerHTML=""}function _r(t){return function(){this.innerHTML=t}}function xr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function vr(t){return arguments.length?this.each(t==null?wr:(typeof t=="function"?xr:_r)(t)):this.node().innerHTML}function br(){this.nextSibling&&this.parentNode.appendChild(this)}function $r(){return this.each(br)}function Er(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Sr(){return this.each(Er)}function Nr(t){var e=typeof t=="function"?t:Me(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Cr(){return null}function Ar(t,e){var n=typeof t=="function"?t:Me(t),r=e==null?Cr:typeof e=="function"?e:jt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kr(){var t=this.parentNode;t&&t.removeChild(this)}function Br(){return this.each(kr)}function Rr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Mr(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ir(t){return this.select(t?Mr:Rr)}function Tr(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Or(t){return function(e){t.call(this,e,this.__data__)}}function Pr(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Fr(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function Xr(t,e,n){return function(){var r=this.__on,i,o=Or(e);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Lr(t,e,n){var r=Pr(t+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=e?Xr:Fr,i=0;i<o;++i)this.each(a(r[i],e,n));return this}function De(t,e,n){var r=Fe(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Yr(t,e){return function(){return De(this,t,e)}}function Hr(t,e){return function(){return De(this,t,e.apply(this,arguments))}}function Dr(t,e){return this.each((typeof e=="function"?Hr:Yr)(t,e))}function*qr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var qe=[null];function R(t,e){this._groups=t,this._parents=e}function ut(){return new R([[document.documentElement]],qe)}function Vr(){return this}R.prototype=ut.prototype={constructor:R,select:mn,selectAll:xn,selectChild:En,selectChildren:An,filter:kn,data:On,enter:Bn,exit:Fn,join:Xn,merge:Ln,selection:Vr,order:Yn,sort:Hn,call:qn,nodes:Vn,node:zn,size:Un,empty:Zn,each:Kn,attr:er,style:or,property:lr,classed:pr,text:yr,html:vr,raise:$r,lower:Sr,append:Nr,insert:Ar,remove:Br,clone:Ir,datum:Tr,on:Lr,dispatch:Dr,[Symbol.iterator]:qr};function Yt(t){return typeof t=="string"?new R([[document.querySelector(t)]],[document.documentElement]):new R([[t]],qe)}function ee(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ve(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ft(){}var st=.7,St=1/st,G="\\s*([+-]?\\d+)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",O="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zr=/^#([0-9a-f]{3,8})$/,Ur=new RegExp(`^rgb\\(${G},${G},${G}\\)$`),Zr=new RegExp(`^rgb\\(${O},${O},${O}\\)$`),Kr=new RegExp(`^rgba\\(${G},${G},${G},${at}\\)$`),Gr=new RegExp(`^rgba\\(${O},${O},${O},${at}\\)$`),Wr=new RegExp(`^hsl\\(${at},${O},${O}\\)$`),Jr=new RegExp(`^hsla\\(${at},${O},${O},${at}\\)$`),ye={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ee(ft,ct,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:we,formatHex:we,formatHex8:Qr,formatHsl:jr,formatRgb:_e,toString:_e});function we(){return this.rgb().formatHex()}function Qr(){return this.rgb().formatHex8()}function jr(){return ze(this).formatHsl()}function _e(){return this.rgb().formatRgb()}function ct(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=zr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xe(e):n===3?new B(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?wt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?wt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ur.exec(t))?new B(e[1],e[2],e[3],1):(e=Zr.exec(t))?new B(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Kr.exec(t))?wt(e[1],e[2],e[3],e[4]):(e=Gr.exec(t))?wt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Wr.exec(t))?$e(e[1],e[2]/100,e[3]/100,1):(e=Jr.exec(t))?$e(e[1],e[2]/100,e[3]/100,e[4]):ye.hasOwnProperty(t)?xe(ye[t]):t==="transparent"?new B(NaN,NaN,NaN,0):null}function xe(t){return new B(t>>16&255,t>>8&255,t&255,1)}function wt(t,e,n,r){return r<=0&&(t=e=n=NaN),new B(t,e,n,r)}function ti(t){return t instanceof ft||(t=ct(t)),t?(t=t.rgb(),new B(t.r,t.g,t.b,t.opacity)):new B}function zt(t,e,n,r){return arguments.length===1?ti(t):new B(t,e,n,r??1)}function B(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}ee(B,zt,Ve(ft,{brighter(t){return t=t==null?St:Math.pow(St,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?st:Math.pow(st,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new B(Z(this.r),Z(this.g),Z(this.b),Nt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ve,formatHex:ve,formatHex8:ei,formatRgb:be,toString:be}));function ve(){return`#${U(this.r)}${U(this.g)}${U(this.b)}`}function ei(){return`#${U(this.r)}${U(this.g)}${U(this.b)}${U((isNaN(this.opacity)?1:this.opacity)*255)}`}function be(){const t=Nt(this.opacity);return`${t===1?"rgb(":"rgba("}${Z(this.r)}, ${Z(this.g)}, ${Z(this.b)}${t===1?")":`, ${t})`}`}function Nt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Z(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function U(t){return t=Z(t),(t<16?"0":"")+t.toString(16)}function $e(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new M(t,e,n,r)}function ze(t){if(t instanceof M)return new M(t.h,t.s,t.l,t.opacity);if(t instanceof ft||(t=ct(t)),!t)return new M;if(t instanceof M)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(e===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new M(s,a,c,t.opacity)}function ni(t,e,n,r){return arguments.length===1?ze(t):new M(t,e,n,r??1)}function M(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ee(M,ni,Ve(ft,{brighter(t){return t=t==null?St:Math.pow(St,t),new M(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?st:Math.pow(st,t),new M(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new B(Ht(t>=240?t-240:t+120,i,r),Ht(t,i,r),Ht(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new M(Ee(this.h),_t(this.s),_t(this.l),Nt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Nt(this.opacity);return`${t===1?"hsl(":"hsla("}${Ee(this.h)}, ${_t(this.s)*100}%, ${_t(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Ee(t){return t=(t||0)%360,t<0?t+360:t}function _t(t){return Math.max(0,Math.min(1,t||0))}function Ht(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ue=t=>()=>t;function ri(t,e){return function(n){return t+n*e}}function ii(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function oi(t){return(t=+t)==1?Ze:function(e,n){return n-e?ii(e,n,t):Ue(isNaN(e)?n:e)}}function Ze(t,e){var n=e-t;return n?ri(t,n):Ue(isNaN(t)?e:t)}const Se=(function t(e){var n=oi(e);function r(i,o){var s=n((i=zt(i)).r,(o=zt(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Ze(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=t,r})(1);function D(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Ut=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Dt=new RegExp(Ut.source,"g");function si(t){return function(){return t}}function ai(t){return function(e){return t(e)+""}}function ci(t,e){var n=Ut.lastIndex=Dt.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=Ut.exec(t))&&(i=Dt.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:D(r,i)})),n=Dt.lastIndex;return n<e.length&&(o=e.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?ai(c[0].x):si(e):(e=c.length,function(l){for(var u=0,p;u<e;++u)a[(p=c[u]).i]=p.x(l);return a.join("")})}var Ne=180/Math.PI,Zt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ke(t,e,n,r,i,o){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Ne,skewX:Math.atan(c)*Ne,scaleX:s,scaleY:a}}var xt;function li(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Zt:Ke(e.a,e.b,e.c,e.d,e.e,e.f)}function ui(t){return t==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",t),!(t=xt.transform.baseVal.consolidate()))?Zt:(t=t.matrix,Ke(t.a,t.b,t.c,t.d,t.e,t.f))}function Ge(t,e,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,p,d,g,m){if(l!==p||u!==d){var E=g.push("translate(",null,e,null,n);m.push({i:E-4,x:D(l,p)},{i:E-2,x:D(u,d)})}else(p||d)&&g.push("translate("+p+e+d+n)}function s(l,u,p,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:p.push(i(p)+"rotate(",null,r)-2,x:D(l,u)})):u&&p.push(i(p)+"rotate("+u+r)}function a(l,u,p,d){l!==u?d.push({i:p.push(i(p)+"skewX(",null,r)-2,x:D(l,u)}):u&&p.push(i(p)+"skewX("+u+r)}function c(l,u,p,d,g,m){if(l!==p||u!==d){var E=g.push(i(g)+"scale(",null,",",null,")");m.push({i:E-4,x:D(l,p)},{i:E-2,x:D(u,d)})}else(p!==1||d!==1)&&g.push(i(g)+"scale("+p+","+d+")")}return function(l,u){var p=[],d=[];return l=t(l),u=t(u),o(l.translateX,l.translateY,u.translateX,u.translateY,p,d),s(l.rotate,u.rotate,p,d),a(l.skewX,u.skewX,p,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,p,d),l=u=null,function(g){for(var m=-1,E=d.length,k;++m<E;)p[(k=d[m]).i]=k.x(g);return p.join("")}}}var fi=Ge(li,"px, ","px)","deg)"),hi=Ge(ui,", ",")",")"),J=0,nt=0,et=0,We=1e3,Ct,rt,At=0,K=0,Mt=0,lt=typeof performance=="object"&&performance.now?performance:Date,Je=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ne(){return K||(Je(pi),K=lt.now()+Mt)}function pi(){K=0}function kt(){this._call=this._time=this._next=null}kt.prototype=Qe.prototype={constructor:kt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ne():+n)+(e==null?0:+e),!this._next&&rt!==this&&(rt?rt._next=this:Ct=this,rt=this),this._call=t,this._time=n,Kt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kt())}};function Qe(t,e,n){var r=new kt;return r.restart(t,e,n),r}function di(){ne(),++J;for(var t=Ct,e;t;)(e=K-t._time)>=0&&t._call.call(void 0,e),t=t._next;--J}function Ce(){K=(At=lt.now())+Mt,J=nt=0;try{di()}finally{J=0,mi(),K=0}}function gi(){var t=lt.now(),e=t-At;e>We&&(Mt-=e,At=t)}function mi(){for(var t,e=Ct,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ct=n);rt=t,Kt(r)}function Kt(t){if(!J){nt&&(nt=clearTimeout(nt));var e=t-K;e>24?(t<1/0&&(nt=setTimeout(Ce,t-lt.now()-Mt)),et&&(et=clearInterval(et))):(et||(At=lt.now(),et=setInterval(gi,We)),J=1,Je(Ce))}}function Ae(t,e,n){var r=new kt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var yi=Re("start","end","cancel","interrupt"),wi=[],je=0,ke=1,Gt=2,bt=3,Be=4,Wt=5,$t=6;function It(t,e,n,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;_i(t,n,{name:e,index:r,group:i,on:yi,tween:wi,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:je})}function re(t,e){var n=I(t,e);if(n.state>je)throw new Error("too late; already scheduled");return n}function F(t,e){var n=I(t,e);if(n.state>bt)throw new Error("too late; already running");return n}function I(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function _i(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Qe(o,0,n.time);function o(l){n.state=ke,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,p,d,g;if(n.state!==ke)return c();for(u in r)if(g=r[u],g.name===n.name){if(g.state===bt)return Ae(s);g.state===Be?(g.state=$t,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=$t,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(Ae(function(){n.state===bt&&(n.state=Be,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Gt,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Gt){for(n.state=bt,i=new Array(d=n.tween.length),u=0,p=-1;u<d;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++p]=g);i.length=p+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Wt,1),p=-1,d=i.length;++p<d;)i[p].call(t,u);n.state===Wt&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=$t,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function xi(t,e){var n=t.__transition,r,i,o=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){o=!1;continue}i=r.state>Gt&&r.state<Wt,r.state=$t,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}o&&delete t.__transition}}function vi(t){return this.each(function(){xi(this,t)})}function bi(t,e){var n,r;return function(){var i=F(this,t),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function $i(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=F(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:e,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===e){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function Ei(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=I(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((e==null?bi:$i)(n,t,e))}function ie(t,e,n){var r=t._id;return t.each(function(){var i=F(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return I(i,r).value[e]}}function tn(t,e){var n;return(typeof e=="number"?D:e instanceof ct?Se:(n=ct(e))?(e=n,Se):ci)(t,e)}function Si(t){return function(){this.removeAttribute(t)}}function Ni(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ci(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttribute(t);return s===i?null:s===r?o:o=e(r=s,n)}}function Ai(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?o:o=e(r=s,n)}}function ki(t,e,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a)))}}function Bi(t,e,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a)))}}function Ri(t,e){var n=Rt(t),r=n==="transform"?hi:tn;return this.attrTween(t,typeof e=="function"?(n.local?Bi:ki)(n,r,ie(this,"attr."+t,e)):e==null?(n.local?Ni:Si)(n):(n.local?Ai:Ci)(n,r,e))}function Mi(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ii(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Ti(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Ii(t,o)),n}return i._value=e,i}function Oi(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Mi(t,o)),n}return i._value=e,i}function Pi(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Rt(t);return this.tween(n,(r.local?Ti:Oi)(r,e))}function Fi(t,e){return function(){re(this,t).delay=+e.apply(this,arguments)}}function Xi(t,e){return e=+e,function(){re(this,t).delay=e}}function Li(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Fi:Xi)(e,t)):I(this.node(),e).delay}function Yi(t,e){return function(){F(this,t).duration=+e.apply(this,arguments)}}function Hi(t,e){return e=+e,function(){F(this,t).duration=e}}function Di(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Yi:Hi)(e,t)):I(this.node(),e).duration}function qi(t,e){if(typeof e!="function")throw new Error;return function(){F(this,t).ease=e}}function Vi(t){var e=this._id;return arguments.length?this.each(qi(e,t)):I(this.node(),e).ease}function zi(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;F(this,t).ease=n}}function Ui(t){if(typeof t!="function")throw new Error;return this.each(zi(this._id,t))}function Zi(t){typeof t!="function"&&(t=Te(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&t.call(c,c.__data__,l,o)&&a.push(c);return new Y(r,this._parents,this._name,this._id)}function Ki(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=e[a],l=n[a],u=c.length,p=s[a]=new Array(u),d,g=0;g<u;++g)(d=c[g]||l[g])&&(p[g]=d);for(;a<r;++a)s[a]=e[a];return new Y(s,this._parents,this._name,this._id)}function Gi(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Wi(t,e,n){var r,i,o=Gi(e)?re:F;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(e,n),s.on=i}}function Ji(t,e){var n=this._id;return arguments.length<2?I(this.node(),n).on.on(t):this.each(Wi(n,t,e))}function Qi(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function ji(){return this.on("end.remove",Qi(this._id))}function to(t){var e=this._name,n=this._id;typeof t!="function"&&(t=jt(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,p,d=0;d<c;++d)(u=a[d])&&(p=t.call(u,u.__data__,d,a))&&("__data__"in u&&(p.__data__=u.__data__),l[d]=p,It(l[d],e,n,d,l,I(u,n)));return new Y(o,this._parents,e,n)}function eo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ie(t));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,p=0;p<l;++p)if(u=c[p]){for(var d=t.call(u,u.__data__,p,c),g,m=I(u,n),E=0,k=d.length;E<k;++E)(g=d[E])&&It(g,e,n,E,d,m);o.push(d),s.push(u)}return new Y(o,s,e,n)}var no=ut.prototype.constructor;function ro(){return new no(this._groups,this._parents)}function io(t,e){var n,r,i;return function(){var o=W(this,t),s=(this.style.removeProperty(t),W(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}function en(t){return function(){this.style.removeProperty(t)}}function oo(t,e,n){var r,i=n+"",o;return function(){var s=W(this,t);return s===i?null:s===r?o:o=e(r=s,n)}}function so(t,e,n){var r,i,o;return function(){var s=W(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),W(this,t))),s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a))}}function ao(t,e){var n,r,i,o="style."+e,s="end."+o,a;return function(){var c=F(this,t),l=c.on,u=c.value[o]==null?a||(a=en(e)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function co(t,e,n){var r=(t+="")=="transform"?fi:tn;return e==null?this.styleTween(t,io(t,r)).on("end.style."+t,en(t)):typeof e=="function"?this.styleTween(t,so(t,r,ie(this,"style."+t,e))).each(ao(this._id,t)):this.styleTween(t,oo(t,r,e),n).on("end.style."+t,null)}function lo(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function uo(t,e,n){var r,i;function o(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&lo(t,s,n)),r}return o._value=e,o}function fo(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,uo(t,e,n??""))}function ho(t){return function(){this.textContent=t}}function po(t){return function(){var e=t(this);this.textContent=e??""}}function go(t){return this.tween("text",typeof t=="function"?po(ie(this,"text",t)):ho(t==null?"":t+""))}function mo(t){return function(e){this.textContent=t.call(this,e)}}function yo(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&mo(i)),e}return r._value=t,r}function wo(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,yo(t))}function _o(){for(var t=this._name,e=this._id,n=nn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=I(c,e);It(c,t,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Y(r,this._parents,t,n)}function xo(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=F(this,r),u=l.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),i===0&&o()})}var vo=0;function Y(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function nn(){return++vo}var L=ut.prototype;Y.prototype={constructor:Y,select:to,selectAll:eo,selectChild:L.selectChild,selectChildren:L.selectChildren,filter:Zi,merge:Ki,selection:ro,transition:_o,call:L.call,nodes:L.nodes,node:L.node,size:L.size,empty:L.empty,each:L.each,on:Ji,attr:Ri,attrTween:Pi,style:co,styleTween:fo,text:go,textTween:wo,remove:ji,tween:Ei,delay:Li,duration:Di,ease:Vi,easeVarying:Ui,end:xo,[Symbol.iterator]:L[Symbol.iterator]};function bo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var $o={time:null,delay:0,duration:250,ease:bo};function Eo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function So(t){var e,n;t instanceof Y?(e=t._id,t=t._name):(e=nn(),(n=$o).time=ne(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&It(c,t,e,l,s,n||Eo(c,e));return new Y(r,this._parents,t,e)}ut.prototype.interrupt=vi;ut.prototype.transition=So;function it(t,e,n){this.k=t,this.x=e,this.y=n}it.prototype={constructor:it,scale:function(t){return t===1?this:new it(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new it(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};it.prototype;let A=[],ot=[],Jt=[],P=new Map,qt="",z=1,Qt={};async function No(){const t=await window.gitopo.git.exec("rev-parse --show-toplevel");if(t.success){const e=t.output.trim();return e.split("/").pop()||e}return"Unknown Repository"}async function Co(){const t=await window.gitopo.config.get();return t.success?t.config:(console.error("Failed to fetch config:",t.error),{})}async function Ao(){const t=await window.gitopo.gh.exec("pr list --state open --json number,title,headRefName,headRefOid");if(!t.success)return console.error("Failed to fetch pull requests:",t.error),[];try{return JSON.parse(t.output).map(n=>({number:n.number,title:n.title,branch:n.headRefName,headCommit:n.headRefOid}))}catch(e){return console.error("Failed to parse PR data:",e),[]}}function rn(){const t=document.getElementById("commit-limit"),e=parseInt(t.value,10);return isNaN(e)||e<1||e>1e8?1e3:e}async function on(t=1e3){const e=await window.gitopo.git.exec(`log --all --format="%H|%P|%ct|%s" --date-order -${t}`);if(!e.success)return console.error("Failed to fetch commits:",e.error),[];const n=[],r=e.output.trim().split(`
|
|
2
|
+
`);for(const i of r){const o=i.split("|");if(o.length>=4){const s=o[0],a=o[1],c=parseInt(o[2],10),l=o.slice(3).join("|"),u=a.trim()?a.trim().split(" "):[];n.push({hash:s,parents:u,timestamp:c,message:l})}}return n.sort((i,o)=>o.timestamp-i.timestamp),n}async function ko(){const t=await window.gitopo.git.exec('branch -a --format="%(refname:short) %(objectname)"');if(!t.success)return console.error("Failed to fetch branches:",t.error),[];const e=[],n=t.output.trim().split(`
|
|
3
|
+
`);for(const r of n){const i=r.trim().split(" ");if(i.length>=2){const o=i[0],s=i[1];e.push({name:o,hash:s})}}return e}function Bo(t){const e=["branch1","branch2","branch3"],n=Qt.keyBranches||[],r=t.find(i=>i.name==="main"||i.name==="master");e.forEach((i,o)=>{const s=document.getElementById(i);s.innerHTML="";const a=document.createElement("option");if(a.value="",a.textContent="----",s.appendChild(a),t.forEach(c=>{const l=document.createElement("option");l.value=c.name,l.textContent=c.name,s.appendChild(l)}),n[o]){const c=t.find(l=>l.name===n[o]);c&&(s.value=c.name)}else o===0&&r&&(s.value=r.name);s.addEventListener("change",()=>Bt())})}function Ro(t){const e=ot.find(i=>i.name===t);if(!e)return new Set;const n=new Set;let r=e.hash;for(;r;){n.add(r);const i=P.get(r);if(i&&i.parents.length>0)r=i.parents[0];else break}return n}function Mo(t,e=new Set){const n=[],r=new Set,i=new Map;for(const c of A)for(const l of c.parents)i.has(l)||i.set(l,[]),i.get(l).push(c.hash);function o(c){const l=new Set,u=[c];for(;u.length>0;){const p=u.pop();if(l.has(p)||t.has(p)||e.has(p)||r.has(p))continue;const d=P.get(p);if(!d)continue;l.add(p);for(const m of d.parents)!t.has(m)&&!e.has(m)&&!l.has(m)&&u.push(m);const g=i.get(p)||[];for(const m of g)!t.has(m)&&!e.has(m)&&!l.has(m)&&u.push(m)}return l}function s(c){for(const l of c){const u=P.get(l);if(u){for(const p of u.parents)if(!t.has(p)&&!c.has(p))return!1}}return!0}function a(c){for(const l of t){const u=P.get(l);if(!(!u||u.parents.length<2)){for(let p=1;p<u.parents.length;p++)if(c.has(u.parents[p]))return l}}return null}for(const c of A){if(t.has(c.hash)||e.has(c.hash)||r.has(c.hash))continue;const l=o(c.hash);l.size>0&&s(l)&&(l.forEach(u=>r.add(u)),n.push({mergeCommit:a(l),commits:l}))}return n}function Io(){const t=[];return["branch1","branch2","branch3"].forEach(e=>{const n=document.getElementById(e);n&&n.value&&t.push(n.value)}),t}function Bt(){const t=Yt("#graph");t.selectAll("*").remove();const e=Yt("#app");e.selectAll(".tooltip").remove();const n=document.getElementById("controls").offsetHeight,r=window.innerWidth,i=window.innerHeight-n;t.attr("width",r).attr("height",i);const o=6,s=30,a=150,c=30,l=50,u=50,d=Io().map(f=>({name:f,lineage:Ro(f)})),g=new Set;d.forEach(({lineage:f})=>{f.forEach(h=>g.add(h))});const m=d.map(({name:f,lineage:h})=>{const y=new Set;d.forEach(w=>{w.name!==f&&w.lineage.forEach(_=>y.add(_))});const v=Mo(h,y);return{name:f,lineage:h,subBranches:v}}),E=new Map;ot.forEach(f=>{E.has(f.hash)||E.set(f.hash,[]),E.get(f.hash).push(f.name)});const k=new Map;A.forEach(f=>{k.set(f.hash,{mainCol:m.length,subOffset:0,isSubBranch:!1})}),m.forEach((f,h)=>{for(const y of f.lineage)k.set(y,{mainCol:h,subOffset:0,isSubBranch:!1})});let Tt=0;m.forEach((f,h)=>{const y=new Map;[...f.subBranches].sort((w,_)=>{const $=x=>{let b=1/0;return x.commits.forEach(S=>{const C=P.get(S);C&&C.timestamp<b&&(b=C.timestamp)}),b};return $(w)-$(_)}).forEach(w=>{const _=`sb-${Tt++}`,$=[];w.commits.forEach(S=>{const C=A.findIndex(j=>j.hash===S);C>=0&&$.push(C)});let x=1,b=!0;for(;b;){b=!1;for(const S of $)if((y.get(S)||new Set).has(x)){b=!0,x++;break}}for(const S of $)y.has(S)||y.set(S,new Set),y.get(S).add(x);w.commits.forEach(S=>{k.set(S,{mainCol:h,subOffset:x,isSubBranch:!0,subBranchId:_})})})});const T=new Map;let q=u;for(let f=0;f<=m.length;f++)if(T.set(f,q),f<m.length){let h=0;A.forEach(y=>{const v=k.get(y.hash);v.mainCol===f&&v.subOffset>h&&(h=v.subOffset)}),q+=a+h*c}const N=new Map;A.forEach((f,h)=>{const y=k.get(f.hash),w=T.get(y.mainCol)+y.subOffset*c;N.set(f.hash,{col:y.mainCol,subOffset:y.subOffset,row:h,x:w,y:l+h*s,isSubBranch:y.isSubBranch,subBranchId:y.subBranchId||null})});const ht=Array.from(k.values()).some(f=>f.mainCol===m.length),X=t.append("g").attr("class","main-group"),Ot=t.append("g").attr("class","header-group"),Pt=e.append("div").attr("class","tooltip").style("opacity",0),pt=["#4CAF50","#2196F3","#FF9800"],oe=20;m.forEach((f,h)=>{Ot.append("text").attr("x",T.get(h)).attr("y",oe).attr("text-anchor","middle").attr("fill",pt[h]||"#888").attr("font-size","14px").attr("font-weight","bold").text(f.name)}),ht&&Ot.append("text").attr("x",T.get(m.length)).attr("y",oe).attr("text-anchor","middle").attr("fill","#888").attr("font-size","14px").text("Other");const dt=new Map;A.forEach(f=>{f.parents.forEach(h=>{dt.has(h)||dt.set(h,[]),dt.get(h).push(f.hash)})});const sn=new Set;m.forEach(f=>{f.lineage.forEach(h=>sn.add(h))});function se(f){const h=[],y=new Set;function v(_){if(y.has(_))return;y.add(_);const $=P.get(_);$&&$.parents.forEach(x=>{h.push({source:_,target:x});const b=N.get(x);b&&b.col===m.length&&!b.isSubBranch&&v(x)})}function w(_){if(y.has(_))return;y.add(_),(dt.get(_)||[]).forEach(x=>{h.push({source:x,target:_});const b=N.get(x);b&&b.col===m.length&&!b.isSubBranch&&w(x)})}return v(f),y.delete(f),w(f),h}A.forEach(f=>{const h=N.get(f.hash);h&&f.parents.forEach(y=>{const v=N.get(y);if(v){const w=h.col===m.length||v.col===m.length,_=h.x,$=h.y*z,x=v.x,b=v.y*z;let S;if(_===x)S=`M ${_} ${$} L ${x} ${b}`;else{const yt=($+b)/2;S=`M ${_} ${$} C ${_} ${yt}, ${x} ${yt}, ${x} ${b}`}const C=h.subBranchId||v.subBranchId||null,j=h.isSubBranch||v.isSubBranch,cn=!j&&!w&&h.col<m.length;let Lt="#666";w?Lt="#444":h.col<m.length&&(Lt=pt[h.col]||"#666");let tt=1.5;w?tt=1:cn?tt=3:j&&(tt=1.5);const ln=X.append("path").attr("d",S).attr("fill","none").attr("stroke",Lt).attr("stroke-width",tt).attr("stroke-opacity",w?.4:j?.5:.8).attr("stroke-dasharray",w?"4,4":"none").attr("class",C?`edge edge-${C}`:"edge").attr("data-source",f.hash).attr("data-target",y);if(C){const yt=tt;ln.style("cursor","pointer").on("mouseenter",()=>{X.selectAll(`.edge-${C}`).attr("stroke-width",3).attr("stroke-opacity",.9)}).on("mouseleave",()=>{X.selectAll(`.edge-${C}`).attr("stroke-width",yt).attr("stroke-opacity",.5)})}}})});const Q=new Map;Jt.forEach(f=>{Q.set(f.headCommit,f)});const Ft=X.selectAll("g.node").data(A).enter().append("g").attr("class","node").attr("transform",f=>{const h=N.get(f.hash);return h?`translate(${h.x}, ${h.y*z})`:"translate(-100, -100)"});Ft.filter(f=>Q.has(f.hash)).append("circle").attr("r",o+6).attr("fill","none").attr("stroke","#888").attr("stroke-width",2).attr("stroke-dasharray","3,2"),Ft.append("circle").attr("r",f=>{const h=N.get(f.hash);return h.isSubBranch?o*.6:h.col<m.length?o:o*.7}).attr("fill",f=>{const h=N.get(f.hash);return h.col<m.length?pt[h.col]||"#fff":h.isSubBranch?"#a0a0a0":"#888"}).attr("stroke",f=>{const h=N.get(f.hash);return h.col<m.length&&pt[h.col]||"#333"}).attr("stroke-width",f=>{const h=N.get(f.hash);return h.isSubBranch?1:h.col<m.length?2:1}).style("cursor","pointer").on("mouseenter",(f,h)=>{const y=E.get(h.hash),v=y?`[${y.join(", ")}]<br/>`:"",w=Q.get(h.hash),_=w?`<span class="pr-info">PR #${w.number}: ${w.title}</span><br/>`:"",$=new Date(h.timestamp*1e3).toLocaleString();Pt.html(`<strong>${h.hash.substring(0,7)}</strong><br/>${_}${v}${h.message}<br/><span class="date">${$}</span>`).style("left",f.pageX+15+"px").style("top",f.pageY-10+"px").style("opacity",1);const x=N.get(h.hash);x&&x.col===m.length&&!x.isSubBranch&&se(h.hash).forEach(({source:S,target:C})=>{X.selectAll(`path.edge[data-source="${S}"][data-target="${C}"]`).attr("stroke-width",3).attr("stroke-opacity",.9)})}).on("mousemove",f=>{Pt.style("left",f.pageX+15+"px").style("top",f.pageY-10+"px")}).on("mouseleave",(f,h)=>{Pt.style("opacity",0);const y=N.get(h.hash);y&&y.col===m.length&&!y.isSubBranch&&se(h.hash).forEach(({source:w,target:_})=>{X.selectAll(`path.edge[data-source="${w}"][data-target="${_}"]`).attr("stroke-width",1).attr("stroke-opacity",.4)})}),Ft.filter(f=>Q.has(f.hash)).append("text").attr("x",o+10).attr("y",4).attr("fill","#ccc").attr("font-size","11px").text(f=>{const h=Q.get(f.hash);return`PR #${h.number}: ${h.title.substring(0,30)}${h.title.length>30?"...":""}`});let V=0,H=0,gt=!1,ae=0,ce=0,le=0,ue=0;function Xt(f){return f*z}function mt(){X.attr("transform",`translate(${V}, ${H})`),Ot.attr("transform",`translate(${V}, 0)`)}function an(){X.selectAll("g.node").attr("transform",f=>{const h=N.get(f.hash);return h?`translate(${h.x}, ${Xt(h.y)})`:"translate(-100, -100)"}),X.selectAll("path.edge").attr("d",function(){const f=Yt(this),h=f.attr("data-source"),y=f.attr("data-target"),v=N.get(h),w=N.get(y);if(!v||!w)return"";const _=v.x,$=Xt(v.y),x=w.x,b=Xt(w.y);if(_===x)return`M ${_} ${$} L ${x} ${b}`;{const S=($+b)/2;return`M ${_} ${$} C ${_} ${S}, ${x} ${S}, ${x} ${b}`}})}t.on("wheel",f=>{if(f.preventDefault(),f.ctrlKey||f.metaKey){const h=f.deltaY>0?.9:1.1,w=Math.max(.1,Math.min(5,z*h)),_=t.node().getBoundingClientRect(),$=f.clientY-_.top,x=$-H;H=$-x*(w/z),z=w,an(),mt()}else V-=f.deltaX,H-=f.deltaY,mt()}),t.on("mousedown",f=>{f.button===0&&(gt=!0,ae=f.clientX,ce=f.clientY,le=V,ue=H,f.preventDefault())}),t.on("mousemove",f=>{gt&&(V=le+(f.clientX-ae),H=ue+(f.clientY-ce),mt())}),t.on("mouseup",f=>{f.button===0&&(gt=!1)}),t.on("mouseleave",()=>{gt=!1});let fe=0,he=0,pe=0,de=0;t.on("touchstart",f=>{if(f.touches.length===1){const h=f.touches[0];fe=h.clientX,he=h.clientY,pe=V,de=H}}),t.on("touchmove",f=>{if(f.touches.length===1){f.preventDefault();const h=f.touches[0];V=pe+(h.clientX-fe),H=de+(h.clientY-he),mt()}}),t.on("contextmenu",f=>{f.preventDefault()})}async function To(){const t=rn();A=await on(t),P.clear(),A.forEach(e=>P.set(e.hash,e)),console.log("Commits reloaded:",A.length),Bt()}async function Oo(){const t=rn();[A,ot,qt,Jt,Qt]=await Promise.all([on(t),ko(),No(),Ao(),Co()]),document.getElementById("repo-name").textContent=qt,P.clear(),A.forEach(n=>P.set(n.hash,n)),console.log("Repository:",qt),console.log("Commits:",A.length),console.log("Branches:",ot.length),console.log("Open PRs:",Jt.length),console.log("Config:",Qt),Bo(ot),Bt(),window.addEventListener("resize",()=>{Bt()});const e=document.getElementById("commit-limit");e.addEventListener("change",()=>{const n=parseInt(e.value,10);(isNaN(n)||n<1||n>1e8)&&(e.value=1e3),To()})}Oo();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function e(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=e(i);fetch(i.href,o)}})();var Kn={value:()=>{}};function vn(){for(var t=0,n=arguments.length,e={},r;t<n;++t){if(!(r=arguments[t]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new mt(e)}function mt(t){this._=t}function Jn(t,n){return t.trim().split(/^|\s+/).map(function(e){var r="",i=e.indexOf(".");if(i>=0&&(r=e.slice(i+1),e=e.slice(0,i)),e&&!n.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}mt.prototype=vn.prototype={constructor:mt,on:function(t,n){var e=this._,r=Jn(t+"",e),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(t=r[o]).type)&&(i=Qn(e[i],t.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++o<s;)if(i=(t=r[o]).type)e[i]=rn(e[i],t.name,n);else if(n==null)for(i in e)e[i]=rn(e[i],t.name,null);return this},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new mt(t)},call:function(t,n){if((i=arguments.length-2)>0)for(var e=new Array(i),r=0,i,o;r<i;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(n,e)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};function Qn(t,n){for(var e=0,r=t.length,i;e<r;++e)if((i=t[e]).name===n)return i.value}function rn(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=Kn,t=t.slice(0,r).concat(t.slice(r+1));break}return e!=null&&t.push({name:n,value:e}),t}var Rt="http://www.w3.org/1999/xhtml";const on={svg:"http://www.w3.org/2000/svg",xhtml:Rt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Et(t){var n=t+="",e=n.indexOf(":");return e>=0&&(n=t.slice(0,e))!=="xmlns"&&(t=t.slice(e+1)),on.hasOwnProperty(n)?{space:on[n],local:t}:t}function Zn(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Rt&&n.documentElement.namespaceURI===Rt?n.createElement(t):n.createElementNS(e,t)}}function jn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function bn(t){var n=Et(t);return(n.local?jn:Zn)(n)}function te(){}function qt(t){return t==null?te:function(){return this.querySelector(t)}}function ne(t){typeof t!="function"&&(t=qt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o=n[i],s=o.length,a=r[i]=new Array(s),c,u,l=0;l<s;++l)(c=o[l])&&(u=t.call(c,c.__data__,l,o))&&("__data__"in c&&(u.__data__=c.__data__),a[l]=u);return new S(r,this._parents)}function ee(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function re(){return[]}function $n(t){return t==null?re:function(){return this.querySelectorAll(t)}}function ie(t){return function(){return ee(t.apply(this,arguments))}}function oe(t){typeof t=="function"?t=ie(t):t=$n(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var s=n[o],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(t.call(c,c.__data__,u,s)),i.push(c));return new S(r,i)}function Sn(t){return function(){return this.matches(t)}}function En(t){return function(n){return n.matches(t)}}var se=Array.prototype.find;function ae(t){return function(){return se.call(this.children,t)}}function ce(){return this.firstElementChild}function ue(t){return this.select(t==null?ce:ae(typeof t=="function"?t:En(t)))}var le=Array.prototype.filter;function fe(){return Array.from(this.children)}function he(t){return function(){return le.call(this.children,t)}}function pe(t){return this.selectAll(t==null?fe:he(typeof t=="function"?t:En(t)))}function de(t){typeof t!="function"&&(t=Sn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o=n[i],s=o.length,a=r[i]=[],c,u=0;u<s;++u)(c=o[u])&&t.call(c,c.__data__,u,o)&&a.push(c);return new S(r,this._parents)}function Nn(t){return new Array(t.length)}function ge(){return new S(this._enter||this._groups.map(Nn),this._parents)}function yt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}yt.prototype={constructor:yt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function me(t){return function(){return t}}function _e(t,n,e,r,i,o){for(var s=0,a,c=n.length,u=o.length;s<u;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new yt(t,o[s]);for(;s<c;++s)(a=n[s])&&(i[s]=a)}function we(t,n,e,r,i,o,s){var a,c,u=new Map,l=n.length,f=o.length,p=new Array(l),g;for(a=0;a<l;++a)(c=n[a])&&(p[a]=g=s.call(c,c.__data__,a,n)+"",u.has(g)?i[a]=c:u.set(g,c));for(a=0;a<f;++a)g=s.call(t,o[a],a,o)+"",(c=u.get(g))?(r[a]=c,c.__data__=o[a],u.delete(g)):e[a]=new yt(t,o[a]);for(a=0;a<l;++a)(c=n[a])&&u.get(p[a])===c&&(i[a]=c)}function ye(t){return t.__data__}function xe(t,n){if(!arguments.length)return Array.from(this,ye);var e=n?we:_e,r=this._parents,i=this._groups;typeof t!="function"&&(t=me(t));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),u=0;u<o;++u){var l=r[u],f=i[u],p=f.length,g=ve(t.call(l,l&&l.__data__,u,r)),m=g.length,w=a[u]=new Array(m),x=s[u]=new Array(m),Ct=c[u]=new Array(p);e(l,f,w,x,Ct,g,n);for(var k=0,F=0,E,ut;k<m;++k)if(E=w[k]){for(k>=F&&(F=k+1);!(ut=x[F])&&++F<m;);E._next=ut||null}}return s=new S(s,r),s._enter=a,s._exit=c,s}function ve(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function be(){return new S(this._exit||this._groups.map(Nn),this._parents)}function $e(t,n,e){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),n!=null&&(i=n(i),i&&(i=i.selection())),e==null?o.remove():e(o),r&&i?r.merge(i).order():i}function Se(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var u=e[c],l=r[c],f=u.length,p=a[c]=new Array(f),g,m=0;m<f;++m)(g=u[m]||l[m])&&(p[m]=g);for(;c<i;++c)a[c]=e[c];return new S(a,this._parents)}function Ee(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r=t[n],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Ne(t){t||(t=Ae);function n(f,p){return f&&p?t(f.__data__,p.__data__):!f-!p}for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var s=e[o],a=s.length,c=i[o]=new Array(a),u,l=0;l<a;++l)(u=s[l])&&(c[l]=u);c.sort(n)}return new S(i,this._parents).order()}function Ae(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function Ce(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ke(){return Array.from(this)}function Me(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function Be(){let t=0;for(const n of this)++t;return t}function Te(){return!this.node()}function Ie(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i=n[e],o=0,s=i.length,a;o<s;++o)(a=i[o])&&t.call(a,a.__data__,o,i);return this}function Oe(t){return function(){this.removeAttribute(t)}}function Re(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Xe(t,n){return function(){this.setAttribute(t,n)}}function He(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function Fe(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttribute(t):this.setAttribute(t,e)}}function Le(t,n){return function(){var e=n.apply(this,arguments);e==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function Pe(t,n){var e=Et(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((n==null?e.local?Re:Oe:typeof n=="function"?e.local?Le:Fe:e.local?He:Xe)(e,n))}function An(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function De(t){return function(){this.style.removeProperty(t)}}function Ye(t,n,e){return function(){this.style.setProperty(t,n,e)}}function qe(t,n,e){return function(){var r=n.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function Ve(t,n,e){return arguments.length>1?this.each((n==null?De:typeof n=="function"?qe:Ye)(t,n,e??"")):K(this.node(),t)}function K(t,n){return t.style.getPropertyValue(n)||An(t).getComputedStyle(t,null).getPropertyValue(n)}function ze(t){return function(){delete this[t]}}function Ue(t,n){return function(){this[t]=n}}function We(t,n){return function(){var e=n.apply(this,arguments);e==null?delete this[t]:this[t]=e}}function Ge(t,n){return arguments.length>1?this.each((n==null?ze:typeof n=="function"?We:Ue)(t,n)):this.node()[t]}function Cn(t){return t.trim().split(/^|\s+/)}function Vt(t){return t.classList||new kn(t)}function kn(t){this._node=t,this._names=Cn(t.getAttribute("class")||"")}kn.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Mn(t,n){for(var e=Vt(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function Bn(t,n){for(var e=Vt(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Ke(t){return function(){Mn(this,t)}}function Je(t){return function(){Bn(this,t)}}function Qe(t,n){return function(){(n.apply(this,arguments)?Mn:Bn)(this,t)}}function Ze(t,n){var e=Cn(t+"");if(arguments.length<2){for(var r=Vt(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each((typeof n=="function"?Qe:n?Ke:Je)(e,n))}function je(){this.textContent=""}function tr(t){return function(){this.textContent=t}}function nr(t){return function(){var n=t.apply(this,arguments);this.textContent=n??""}}function er(t){return arguments.length?this.each(t==null?je:(typeof t=="function"?nr:tr)(t)):this.node().textContent}function rr(){this.innerHTML=""}function ir(t){return function(){this.innerHTML=t}}function or(t){return function(){var n=t.apply(this,arguments);this.innerHTML=n??""}}function sr(t){return arguments.length?this.each(t==null?rr:(typeof t=="function"?or:ir)(t)):this.node().innerHTML}function ar(){this.nextSibling&&this.parentNode.appendChild(this)}function cr(){return this.each(ar)}function ur(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function lr(){return this.each(ur)}function fr(t){var n=typeof t=="function"?t:bn(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function hr(){return null}function pr(t,n){var e=typeof t=="function"?t:bn(t),r=n==null?hr:typeof n=="function"?n:qt(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})}function dr(){var t=this.parentNode;t&&t.removeChild(this)}function gr(){return this.each(dr)}function mr(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function _r(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function wr(t){return this.select(t?_r:mr)}function yr(t){return arguments.length?this.property("__data__",t):this.node().__data__}function xr(t){return function(n){t.call(this,n,this.__data__)}}function vr(t){return t.trim().split(/^|\s+/).map(function(n){var e="",r=n.indexOf(".");return r>=0&&(e=n.slice(r+1),n=n.slice(0,r)),{type:n,name:e}})}function br(t){return function(){var n=this.__on;if(n){for(var e=0,r=-1,i=n.length,o;e<i;++e)o=n[e],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):n[++r]=o;++r?n.length=r:delete this.__on}}}function $r(t,n,e){return function(){var r=this.__on,i,o=xr(n);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=e),i.value=n;return}}this.addEventListener(t.type,o,e),i={type:t.type,name:t.name,value:n,listener:o,options:e},r?r.push(i):this.__on=[i]}}function Sr(t,n,e){var r=vr(t+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,l;c<u;++c)for(i=0,l=a[c];i<o;++i)if((s=r[i]).type===l.type&&s.name===l.name)return l.value}return}for(a=n?$r:br,i=0;i<o;++i)this.each(a(r[i],n,e));return this}function Tn(t,n,e){var r=An(t),i=r.CustomEvent;typeof i=="function"?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Er(t,n){return function(){return Tn(this,t,n)}}function Nr(t,n){return function(){return Tn(this,t,n.apply(this,arguments))}}function Ar(t,n){return this.each((typeof n=="function"?Nr:Er)(t,n))}function*Cr(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var In=[null];function S(t,n){this._groups=t,this._parents=n}function at(){return new S([[document.documentElement]],In)}function kr(){return this}S.prototype=at.prototype={constructor:S,select:ne,selectAll:oe,selectChild:ue,selectChildren:pe,filter:de,data:xe,enter:ge,exit:be,join:$e,merge:Se,selection:kr,order:Ee,sort:Ne,call:Ce,nodes:ke,node:Me,size:Be,empty:Te,each:Ie,attr:Pe,style:Ve,property:Ge,classed:Ze,text:er,html:sr,raise:cr,lower:lr,append:fr,insert:pr,remove:gr,clone:wr,datum:yr,on:Sr,dispatch:Ar,[Symbol.iterator]:Cr};function sn(t){return typeof t=="string"?new S([[document.querySelector(t)]],[document.documentElement]):new S([[t]],In)}function zt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function On(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ct(){}var rt=.7,xt=1/rt,W="\\s*([+-]?\\d+)\\s*",it="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",B="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mr=/^#([0-9a-f]{3,8})$/,Br=new RegExp(`^rgb\\(${W},${W},${W}\\)$`),Tr=new RegExp(`^rgb\\(${B},${B},${B}\\)$`),Ir=new RegExp(`^rgba\\(${W},${W},${W},${it}\\)$`),Or=new RegExp(`^rgba\\(${B},${B},${B},${it}\\)$`),Rr=new RegExp(`^hsl\\(${it},${B},${B}\\)$`),Xr=new RegExp(`^hsla\\(${it},${B},${B},${it}\\)$`),an={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};zt(ct,ot,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:cn,formatHex:cn,formatHex8:Hr,formatHsl:Fr,formatRgb:un,toString:un});function cn(){return this.rgb().formatHex()}function Hr(){return this.rgb().formatHex8()}function Fr(){return Rn(this).formatHsl()}function un(){return this.rgb().formatRgb()}function ot(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Mr.exec(t))?(e=n[1].length,n=parseInt(n[1],16),e===6?ln(n):e===3?new b(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):e===8?pt(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):e===4?pt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Br.exec(t))?new b(n[1],n[2],n[3],1):(n=Tr.exec(t))?new b(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Ir.exec(t))?pt(n[1],n[2],n[3],n[4]):(n=Or.exec(t))?pt(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Rr.exec(t))?pn(n[1],n[2]/100,n[3]/100,1):(n=Xr.exec(t))?pn(n[1],n[2]/100,n[3]/100,n[4]):an.hasOwnProperty(t)?ln(an[t]):t==="transparent"?new b(NaN,NaN,NaN,0):null}function ln(t){return new b(t>>16&255,t>>8&255,t&255,1)}function pt(t,n,e,r){return r<=0&&(t=n=e=NaN),new b(t,n,e,r)}function Lr(t){return t instanceof ct||(t=ot(t)),t?(t=t.rgb(),new b(t.r,t.g,t.b,t.opacity)):new b}function Xt(t,n,e,r){return arguments.length===1?Lr(t):new b(t,n,e,r??1)}function b(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}zt(b,Xt,On(ct,{brighter(t){return t=t==null?xt:Math.pow(xt,t),new b(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?rt:Math.pow(rt,t),new b(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new b(q(this.r),q(this.g),q(this.b),vt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:fn,formatHex:fn,formatHex8:Pr,formatRgb:hn,toString:hn}));function fn(){return`#${Y(this.r)}${Y(this.g)}${Y(this.b)}`}function Pr(){return`#${Y(this.r)}${Y(this.g)}${Y(this.b)}${Y((isNaN(this.opacity)?1:this.opacity)*255)}`}function hn(){const t=vt(this.opacity);return`${t===1?"rgb(":"rgba("}${q(this.r)}, ${q(this.g)}, ${q(this.b)}${t===1?")":`, ${t})`}`}function vt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function q(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Y(t){return t=q(t),(t<16?"0":"")+t.toString(16)}function pn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new A(t,n,e,r)}function Rn(t){if(t instanceof A)return new A(t.h,t.s,t.l,t.opacity);if(t instanceof ct||(t=ot(t)),!t)return new A;if(t instanceof A)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),s=NaN,a=o-i,c=(o+i)/2;return a?(n===o?s=(e-r)/a+(e<r)*6:e===o?s=(r-n)/a+2:s=(n-e)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new A(s,a,c,t.opacity)}function Dr(t,n,e,r){return arguments.length===1?Rn(t):new A(t,n,e,r??1)}function A(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}zt(A,Dr,On(ct,{brighter(t){return t=t==null?xt:Math.pow(xt,t),new A(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?rt:Math.pow(rt,t),new A(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new b(It(t>=240?t-240:t+120,i,r),It(t,i,r),It(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new A(dn(this.h),dt(this.s),dt(this.l),vt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=vt(this.opacity);return`${t===1?"hsl(":"hsla("}${dn(this.h)}, ${dt(this.s)*100}%, ${dt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function dn(t){return t=(t||0)%360,t<0?t+360:t}function dt(t){return Math.max(0,Math.min(1,t||0))}function It(t,n,e){return(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)*255}const Xn=t=>()=>t;function Yr(t,n){return function(e){return t+e*n}}function qr(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Vr(t){return(t=+t)==1?Hn:function(n,e){return e-n?qr(n,e,t):Xn(isNaN(n)?e:n)}}function Hn(t,n){var e=n-t;return e?Yr(t,e):Xn(isNaN(t)?n:t)}const gn=(function t(n){var e=Vr(n);function r(i,o){var s=e((i=Xt(i)).r,(o=Xt(o)).r),a=e(i.g,o.g),c=e(i.b,o.b),u=Hn(i.opacity,o.opacity);return function(l){return i.r=s(l),i.g=a(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=t,r})(1);function H(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var Ht=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ot=new RegExp(Ht.source,"g");function zr(t){return function(){return t}}function Ur(t){return function(n){return t(n)+""}}function Wr(t,n){var e=Ht.lastIndex=Ot.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(t=t+"",n=n+"";(r=Ht.exec(t))&&(i=Ot.exec(n));)(o=i.index)>e&&(o=n.slice(e,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:H(r,i)})),e=Ot.lastIndex;return e<n.length&&(o=n.slice(e),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?Ur(c[0].x):zr(n):(n=c.length,function(u){for(var l=0,f;l<n;++l)a[(f=c[l]).i]=f.x(u);return a.join("")})}var mn=180/Math.PI,Ft={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fn(t,n,e,r,i,o){var s,a,c;return(s=Math.sqrt(t*t+n*n))&&(t/=s,n/=s),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,c/=a),t*r<n*e&&(t=-t,n=-n,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*mn,skewX:Math.atan(c)*mn,scaleX:s,scaleY:a}}var gt;function Gr(t){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Ft:Fn(n.a,n.b,n.c,n.d,n.e,n.f)}function Kr(t){return t==null||(gt||(gt=document.createElementNS("http://www.w3.org/2000/svg","g")),gt.setAttribute("transform",t),!(t=gt.transform.baseVal.consolidate()))?Ft:(t=t.matrix,Fn(t.a,t.b,t.c,t.d,t.e,t.f))}function Ln(t,n,e,r){function i(u){return u.length?u.pop()+" ":""}function o(u,l,f,p,g,m){if(u!==f||l!==p){var w=g.push("translate(",null,n,null,e);m.push({i:w-4,x:H(u,f)},{i:w-2,x:H(l,p)})}else(f||p)&&g.push("translate("+f+n+p+e)}function s(u,l,f,p){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),p.push({i:f.push(i(f)+"rotate(",null,r)-2,x:H(u,l)})):l&&f.push(i(f)+"rotate("+l+r)}function a(u,l,f,p){u!==l?p.push({i:f.push(i(f)+"skewX(",null,r)-2,x:H(u,l)}):l&&f.push(i(f)+"skewX("+l+r)}function c(u,l,f,p,g,m){if(u!==f||l!==p){var w=g.push(i(g)+"scale(",null,",",null,")");m.push({i:w-4,x:H(u,f)},{i:w-2,x:H(l,p)})}else(f!==1||p!==1)&&g.push(i(g)+"scale("+f+","+p+")")}return function(u,l){var f=[],p=[];return u=t(u),l=t(l),o(u.translateX,u.translateY,l.translateX,l.translateY,f,p),s(u.rotate,l.rotate,f,p),a(u.skewX,l.skewX,f,p),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,p),u=l=null,function(g){for(var m=-1,w=p.length,x;++m<w;)f[(x=p[m]).i]=x.x(g);return f.join("")}}}var Jr=Ln(Gr,"px, ","px)","deg)"),Qr=Ln(Kr,", ",")",")"),J=0,j=0,Z=0,Pn=1e3,bt,tt,$t=0,V=0,Nt=0,st=typeof performance=="object"&&performance.now?performance:Date,Dn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ut(){return V||(Dn(Zr),V=st.now()+Nt)}function Zr(){V=0}function St(){this._call=this._time=this._next=null}St.prototype=Yn.prototype={constructor:St,restart:function(t,n,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?Ut():+e)+(n==null?0:+n),!this._next&&tt!==this&&(tt?tt._next=this:bt=this,tt=this),this._call=t,this._time=e,Lt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lt())}};function Yn(t,n,e){var r=new St;return r.restart(t,n,e),r}function jr(){Ut(),++J;for(var t=bt,n;t;)(n=V-t._time)>=0&&t._call.call(void 0,n),t=t._next;--J}function _n(){V=($t=st.now())+Nt,J=j=0;try{jr()}finally{J=0,ni(),V=0}}function ti(){var t=st.now(),n=t-$t;n>Pn&&(Nt-=n,$t=t)}function ni(){for(var t,n=bt,e,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:bt=e);tt=t,Lt(r)}function Lt(t){if(!J){j&&(j=clearTimeout(j));var n=t-V;n>24?(t<1/0&&(j=setTimeout(_n,t-st.now()-Nt)),Z&&(Z=clearInterval(Z))):(Z||($t=st.now(),Z=setInterval(ti,Pn)),J=1,Dn(_n))}}function wn(t,n,e){var r=new St;return n=n==null?0:+n,r.restart(i=>{r.stop(),t(i+n)},n,e),r}var ei=vn("start","end","cancel","interrupt"),ri=[],qn=0,yn=1,Pt=2,_t=3,xn=4,Dt=5,wt=6;function At(t,n,e,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(e in s)return;ii(t,e,{name:n,index:r,group:i,on:ei,tween:ri,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:qn})}function Wt(t,n){var e=C(t,n);if(e.state>qn)throw new Error("too late; already scheduled");return e}function T(t,n){var e=C(t,n);if(e.state>_t)throw new Error("too late; already running");return e}function C(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function ii(t,n,e){var r=t.__transition,i;r[n]=e,e.timer=Yn(o,0,e.time);function o(u){e.state=yn,e.timer.restart(s,e.delay,e.time),e.delay<=u&&s(u-e.delay)}function s(u){var l,f,p,g;if(e.state!==yn)return c();for(l in r)if(g=r[l],g.name===e.name){if(g.state===_t)return wn(s);g.state===xn?(g.state=wt,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[l]):+l<n&&(g.state=wt,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[l])}if(wn(function(){e.state===_t&&(e.state=xn,e.timer.restart(a,e.delay,e.time),a(u))}),e.state=Pt,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Pt){for(e.state=_t,i=new Array(p=e.tween.length),l=0,f=-1;l<p;++l)(g=e.tween[l].value.call(t,t.__data__,e.index,e.group))&&(i[++f]=g);i.length=f+1}}function a(u){for(var l=u<e.duration?e.ease.call(null,u/e.duration):(e.timer.restart(c),e.state=Dt,1),f=-1,p=i.length;++f<p;)i[f].call(t,l);e.state===Dt&&(e.on.call("end",t,t.__data__,e.index,e.group),c())}function c(){e.state=wt,e.timer.stop(),delete r[n];for(var u in r)return;delete t.__transition}}function oi(t,n){var e=t.__transition,r,i,o=!0,s;if(e){n=n==null?null:n+"";for(s in e){if((r=e[s]).name!==n){o=!1;continue}i=r.state>Pt&&r.state<Dt,r.state=wt,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete e[s]}o&&delete t.__transition}}function si(t){return this.each(function(){oi(this,t)})}function ai(t,n){var e,r;return function(){var i=T(this,t),o=i.tween;if(o!==e){r=e=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===n){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function ci(t,n,e){var r,i;if(typeof e!="function")throw new Error;return function(){var o=T(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:n,value:e},c=0,u=i.length;c<u;++c)if(i[c].name===n){i[c]=a;break}c===u&&i.push(a)}o.tween=i}}function ui(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r=C(this.node(),e).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((n==null?ai:ci)(e,t,n))}function Gt(t,n,e){var r=t._id;return t.each(function(){var i=T(this,r);(i.value||(i.value={}))[n]=e.apply(this,arguments)}),function(i){return C(i,r).value[n]}}function Vn(t,n){var e;return(typeof n=="number"?H:n instanceof ot?gn:(e=ot(n))?(n=e,gn):Wr)(t,n)}function li(t){return function(){this.removeAttribute(t)}}function fi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function hi(t,n,e){var r,i=e+"",o;return function(){var s=this.getAttribute(t);return s===i?null:s===r?o:o=n(r=s,e)}}function pi(t,n,e){var r,i=e+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?o:o=n(r=s,e)}}function di(t,n,e){var r,i,o;return function(){var s,a=e(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=n(r=s,a)))}}function gi(t,n,e){var r,i,o;return function(){var s,a=e(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=n(r=s,a)))}}function mi(t,n){var e=Et(t),r=e==="transform"?Qr:Vn;return this.attrTween(t,typeof n=="function"?(e.local?gi:di)(e,r,Gt(this,"attr."+t,n)):n==null?(e.local?fi:li)(e):(e.local?pi:hi)(e,r,n))}function _i(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}function wi(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}function yi(t,n){var e,r;function i(){var o=n.apply(this,arguments);return o!==r&&(e=(r=o)&&wi(t,o)),e}return i._value=n,i}function xi(t,n){var e,r;function i(){var o=n.apply(this,arguments);return o!==r&&(e=(r=o)&&_i(t,o)),e}return i._value=n,i}function vi(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(n==null)return this.tween(e,null);if(typeof n!="function")throw new Error;var r=Et(t);return this.tween(e,(r.local?yi:xi)(r,n))}function bi(t,n){return function(){Wt(this,t).delay=+n.apply(this,arguments)}}function $i(t,n){return n=+n,function(){Wt(this,t).delay=n}}function Si(t){var n=this._id;return arguments.length?this.each((typeof t=="function"?bi:$i)(n,t)):C(this.node(),n).delay}function Ei(t,n){return function(){T(this,t).duration=+n.apply(this,arguments)}}function Ni(t,n){return n=+n,function(){T(this,t).duration=n}}function Ai(t){var n=this._id;return arguments.length?this.each((typeof t=="function"?Ei:Ni)(n,t)):C(this.node(),n).duration}function Ci(t,n){if(typeof n!="function")throw new Error;return function(){T(this,t).ease=n}}function ki(t){var n=this._id;return arguments.length?this.each(Ci(n,t)):C(this.node(),n).ease}function Mi(t,n){return function(){var e=n.apply(this,arguments);if(typeof e!="function")throw new Error;T(this,t).ease=e}}function Bi(t){if(typeof t!="function")throw new Error;return this.each(Mi(this._id,t))}function Ti(t){typeof t!="function"&&(t=Sn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o=n[i],s=o.length,a=r[i]=[],c,u=0;u<s;++u)(c=o[u])&&t.call(c,c.__data__,u,o)&&a.push(c);return new O(r,this._parents,this._name,this._id)}function Ii(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=n[a],u=e[a],l=c.length,f=s[a]=new Array(l),p,g=0;g<l;++g)(p=c[g]||u[g])&&(f[g]=p);for(;a<r;++a)s[a]=n[a];return new O(s,this._parents,this._name,this._id)}function Oi(t){return(t+"").trim().split(/^|\s+/).every(function(n){var e=n.indexOf(".");return e>=0&&(n=n.slice(0,e)),!n||n==="start"})}function Ri(t,n,e){var r,i,o=Oi(n)?Wt:T;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(n,e),s.on=i}}function Xi(t,n){var e=this._id;return arguments.length<2?C(this.node(),e).on.on(t):this.each(Ri(e,t,n))}function Hi(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function Fi(){return this.on("end.remove",Hi(this._id))}function Li(t){var n=this._name,e=this._id;typeof t!="function"&&(t=qt(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,u=o[s]=new Array(c),l,f,p=0;p<c;++p)(l=a[p])&&(f=t.call(l,l.__data__,p,a))&&("__data__"in l&&(f.__data__=l.__data__),u[p]=f,At(u[p],n,e,p,u,C(l,e)));return new O(o,this._parents,n,e)}function Pi(t){var n=this._name,e=this._id;typeof t!="function"&&(t=$n(t));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],u=c.length,l,f=0;f<u;++f)if(l=c[f]){for(var p=t.call(l,l.__data__,f,c),g,m=C(l,e),w=0,x=p.length;w<x;++w)(g=p[w])&&At(g,n,e,w,p,m);o.push(p),s.push(l)}return new O(o,s,n,e)}var Di=at.prototype.constructor;function Yi(){return new Di(this._groups,this._parents)}function qi(t,n){var e,r,i;return function(){var o=K(this,t),s=(this.style.removeProperty(t),K(this,t));return o===s?null:o===e&&s===r?i:i=n(e=o,r=s)}}function zn(t){return function(){this.style.removeProperty(t)}}function Vi(t,n,e){var r,i=e+"",o;return function(){var s=K(this,t);return s===i?null:s===r?o:o=n(r=s,e)}}function zi(t,n,e){var r,i,o;return function(){var s=K(this,t),a=e(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),K(this,t))),s===c?null:s===r&&c===i?o:(i=c,o=n(r=s,a))}}function Ui(t,n){var e,r,i,o="style."+n,s="end."+o,a;return function(){var c=T(this,t),u=c.on,l=c.value[o]==null?a||(a=zn(n)):void 0;(u!==e||i!==l)&&(r=(e=u).copy()).on(s,i=l),c.on=r}}function Wi(t,n,e){var r=(t+="")=="transform"?Jr:Vn;return n==null?this.styleTween(t,qi(t,r)).on("end.style."+t,zn(t)):typeof n=="function"?this.styleTween(t,zi(t,r,Gt(this,"style."+t,n))).each(Ui(this._id,t)):this.styleTween(t,Vi(t,r,n),e).on("end.style."+t,null)}function Gi(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function Ki(t,n,e){var r,i;function o(){var s=n.apply(this,arguments);return s!==i&&(r=(i=s)&&Gi(t,s,e)),r}return o._value=n,o}function Ji(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,Ki(t,n,e??""))}function Qi(t){return function(){this.textContent=t}}function Zi(t){return function(){var n=t(this);this.textContent=n??""}}function ji(t){return this.tween("text",typeof t=="function"?Zi(Gt(this,"text",t)):Qi(t==null?"":t+""))}function to(t){return function(n){this.textContent=t.call(this,n)}}function no(t){var n,e;function r(){var i=t.apply(this,arguments);return i!==e&&(n=(e=i)&&to(i)),n}return r._value=t,r}function eo(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,no(t))}function ro(){for(var t=this._name,n=this._id,e=Un(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var l=C(c,n);At(c,t,e,u,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new O(r,this._parents,t,e)}function io(){var t,n,e=this,r=e._id,i=e.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};e.each(function(){var u=T(this,r),l=u.on;l!==t&&(n=(t=l).copy(),n._.cancel.push(a),n._.interrupt.push(a),n._.end.push(c)),u.on=n}),i===0&&o()})}var oo=0;function O(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Un(){return++oo}var I=at.prototype;O.prototype={constructor:O,select:Li,selectAll:Pi,selectChild:I.selectChild,selectChildren:I.selectChildren,filter:Ti,merge:Ii,selection:Yi,transition:ro,call:I.call,nodes:I.nodes,node:I.node,size:I.size,empty:I.empty,each:I.each,on:Xi,attr:mi,attrTween:vi,style:Wi,styleTween:Ji,text:ji,textTween:eo,remove:Fi,tween:ui,delay:Si,duration:Ai,ease:ki,easeVarying:Bi,end:io,[Symbol.iterator]:I[Symbol.iterator]};function so(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var ao={time:null,delay:0,duration:250,ease:so};function co(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}function uo(t){var n,e;t instanceof O?(n=t._id,t=t._name):(n=Un(),(e=ao).time=Ut(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,u=0;u<a;++u)(c=s[u])&&At(c,t,n,u,s,e||co(c,n));return new O(r,this._parents,t,n)}at.prototype.interrupt=si;at.prototype.transition=uo;function nt(t,n,e){this.k=t,this.x=n,this.y=e}nt.prototype={constructor:nt,scale:function(t){return t===1?this:new nt(this.k*t,this.x,this.y)},translate:function(t,n){return t===0&n===0?this:new nt(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};nt.prototype;let N=[],et=[],G=new Map;async function lo(){const t=await window.gitopo.git.exec('log --all --format="%H|%P|%ct|%s" --date-order -1000');if(!t.success)return console.error("Failed to fetch commits:",t.error),[];const n=[],e=t.output.trim().split(`
|
|
2
|
+
`);for(const r of e){const i=r.split("|");if(i.length>=4){const o=i[0],s=i[1],a=parseInt(i[2],10),c=i.slice(3).join("|"),u=s.trim()?s.trim().split(" "):[];n.push({hash:o,parents:u,timestamp:a,message:c})}}return n.sort((r,i)=>i.timestamp-r.timestamp),n}async function fo(){const t=await window.gitopo.git.exec('branch -a --format="%(refname:short) %(objectname)"');if(!t.success)return console.error("Failed to fetch branches:",t.error),[];const n=[],e=t.output.trim().split(`
|
|
3
|
+
`);for(const r of e){const i=r.trim().split(" ");if(i.length>=2){const o=i[0],s=i[1];n.push({name:o,hash:s})}}return n}function ho(t){const n=["branch1","branch2","branch3"],e=t.find(r=>r.name==="main"||r.name==="master");n.forEach((r,i)=>{const o=document.getElementById(r);o.innerHTML="";const s=document.createElement("option");s.value="",s.textContent="----",o.appendChild(s),t.forEach(a=>{const c=document.createElement("option");c.value=a.name,c.textContent=a.name,o.appendChild(c)}),i===0&&e&&(o.value=e.name),o.addEventListener("change",()=>Yt())})}function po(t){const n=et.find(i=>i.name===t);if(!n)return new Set;const e=new Set;let r=n.hash;for(;r;){e.add(r);const i=G.get(r);if(i&&i.parents.length>0)r=i.parents[0];else break}return e}function go(t,n=new Set){const e=[],r=new Set,i=new Map;for(const c of N)for(const u of c.parents)i.has(u)||i.set(u,[]),i.get(u).push(c.hash);function o(c){const u=new Set,l=[c];for(;l.length>0;){const f=l.pop();if(u.has(f)||t.has(f)||n.has(f)||r.has(f))continue;const p=G.get(f);if(!p)continue;u.add(f);for(const m of p.parents)!t.has(m)&&!n.has(m)&&!u.has(m)&&l.push(m);const g=i.get(f)||[];for(const m of g)!t.has(m)&&!n.has(m)&&!u.has(m)&&l.push(m)}return u}function s(c){for(const u of c){const l=G.get(u);if(l){for(const f of l.parents)if(!t.has(f)&&!c.has(f))return!1}}return!0}function a(c){for(const u of t){const l=G.get(u);if(!(!l||l.parents.length<2)){for(let f=1;f<l.parents.length;f++)if(c.has(l.parents[f]))return u}}return null}for(const c of N){if(t.has(c.hash)||n.has(c.hash)||r.has(c.hash))continue;const u=o(c.hash);u.size>0&&s(u)&&(u.forEach(l=>r.add(l)),e.push({mergeCommit:a(u),commits:u}))}return e}function mo(){const t=[];return["branch1","branch2","branch3"].forEach(n=>{const e=document.getElementById(n);e&&e.value&&t.push(e.value)}),t}function Yt(){const t=sn("#graph");t.selectAll("*").remove();const n=sn("#app");n.selectAll(".tooltip").remove();const e=document.getElementById("controls").offsetHeight,r=window.innerWidth,i=window.innerHeight-e;t.attr("width",r).attr("height",i);const o=6,s=30,a=150,c=30,u=50,l=50,p=mo().map(h=>({name:h,lineage:po(h)})),g=new Set;p.forEach(({lineage:h})=>{h.forEach(d=>g.add(d))});const m=p.map(({name:h,lineage:d})=>{const _=new Set;p.forEach(v=>{v.name!==h&&v.lineage.forEach(M=>_.add(M))});const y=go(d,_);return{name:h,lineage:d,subBranches:y}}),w=new Map;et.forEach(h=>{w.has(h.hash)||w.set(h.hash,[]),w.get(h.hash).push(h.name)});const x=new Map;N.forEach(h=>{x.set(h.hash,{mainCol:m.length,subOffset:0,isSubBranch:!1})}),m.forEach((h,d)=>{for(const _ of h.lineage)x.set(_,{mainCol:d,subOffset:0,isSubBranch:!1})});let Ct=0;m.forEach((h,d)=>{const _=new Map;h.subBranches.forEach(y=>{const v=`sb-${Ct++}`,M=[];y.commits.forEach($=>{const P=N.findIndex(D=>D.hash===$);P>=0&&M.push(P)});let R=1,X=!0;for(;X;){X=!1;for(const $ of M)if((_.get($)||new Set).has(R)){X=!0,R++;break}}for(const $ of M)_.has($)||_.set($,new Set),_.get($).add(R);y.commits.forEach($=>{x.set($,{mainCol:d,subOffset:R,isSubBranch:!0,subBranchId:v})})})});const k=new Map;let F=l;for(let h=0;h<=m.length;h++)if(k.set(h,F),h<m.length){let d=0;N.forEach(_=>{const y=x.get(_.hash);y.mainCol===h&&y.subOffset>d&&(d=y.subOffset)}),F+=a+d*c}const E=new Map;N.forEach((h,d)=>{const _=x.get(h.hash),v=k.get(_.mainCol)+_.subOffset*c;E.set(h.hash,{col:_.mainCol,subOffset:_.subOffset,row:d,x:v,y:u+d*s,isSubBranch:_.isSubBranch,subBranchId:_.subBranchId||null})});const ut=Array.from(x.values()).some(h=>h.mainCol===m.length),L=t.append("g").attr("class","main-group"),kt=n.append("div").attr("class","tooltip").style("opacity",0),lt=["#4CAF50","#2196F3","#FF9800"];m.forEach((h,d)=>{L.append("text").attr("x",k.get(d)).attr("y",25).attr("fill",lt[d]||"#888").attr("font-size","14px").attr("font-weight","bold").text(h.name)}),ut&&L.append("text").attr("x",k.get(m.length)).attr("y",25).attr("fill","#888").attr("font-size","14px").text("Other"),N.forEach(h=>{const d=E.get(h.hash);d&&h.parents.forEach(_=>{const y=E.get(_);if(y){const v=d.col===m.length||y.col===m.length,M=d.x,R=d.y,X=y.x,$=y.y;let P;if(M===X)P=`M ${M} ${R} L ${X} ${$}`;else{const ht=(R+$)/2;P=`M ${M} ${R} C ${M} ${ht}, ${X} ${ht}, ${X} ${$}`}const D=d.subBranchId||y.subBranchId||null,Bt=d.isSubBranch||y.isSubBranch,Wn=!Bt&&!v&&d.col<m.length;let Tt="#666";v?Tt="#444":d.col<m.length&&(Tt=lt[d.col]||"#666");let Q=1.5;v?Q=1:Wn?Q=3:Bt&&(Q=1.5);const Gn=L.append("path").attr("d",P).attr("fill","none").attr("stroke",Tt).attr("stroke-width",Q).attr("stroke-opacity",v?.4:Bt?.5:.8).attr("stroke-dasharray",v?"4,4":"none").attr("class",D?`edge edge-${D}`:"edge");if(D){const ht=Q;Gn.style("cursor","pointer").on("mouseenter",()=>{L.selectAll(`.edge-${D}`).attr("stroke-width",3).attr("stroke-opacity",.9)}).on("mouseleave",()=>{L.selectAll(`.edge-${D}`).attr("stroke-width",ht).attr("stroke-opacity",.5)})}}})}),L.selectAll("g.node").data(N).enter().append("g").attr("class","node").attr("transform",h=>{const d=E.get(h.hash);return d?`translate(${d.x}, ${d.y})`:"translate(-100, -100)"}).append("circle").attr("r",h=>{const d=E.get(h.hash);return d.isSubBranch?o*.6:d.col<m.length?o:o*.7}).attr("fill",h=>{const d=E.get(h.hash);return d.col<m.length?lt[d.col]||"#fff":d.isSubBranch?"#a0a0a0":"#888"}).attr("stroke",h=>{const d=E.get(h.hash);return d.col<m.length&<[d.col]||"#333"}).attr("stroke-width",h=>{const d=E.get(h.hash);return d.isSubBranch?1:d.col<m.length?2:1}).style("cursor","pointer").on("mouseenter",(h,d)=>{const _=w.get(d.hash),y=_?`[${_.join(", ")}]<br/>`:"",v=new Date(d.timestamp*1e3).toLocaleString();kt.html(`<strong>${d.hash.substring(0,7)}</strong><br/>${y}${d.message}<br/><span class="date">${v}</span>`).style("left",h.pageX+15+"px").style("top",h.pageY-10+"px").style("opacity",1)}).on("mousemove",h=>{kt.style("left",h.pageX+15+"px").style("top",h.pageY-10+"px")}).on("mouseleave",()=>{kt.style("opacity",0)});let z=0,U=0,ft=!1,Kt=0,Jt=0,Qt=0,Zt=0;function Mt(){L.attr("transform",`translate(${z}, ${U})`)}t.on("wheel",h=>{h.preventDefault(),z-=h.deltaX,U-=h.deltaY,Mt()}),t.on("mousedown",h=>{h.button===0&&(ft=!0,Kt=h.clientX,Jt=h.clientY,Qt=z,Zt=U,h.preventDefault())}),t.on("mousemove",h=>{ft&&(z=Qt+(h.clientX-Kt),U=Zt+(h.clientY-Jt),Mt())}),t.on("mouseup",h=>{h.button===0&&(ft=!1)}),t.on("mouseleave",()=>{ft=!1});let jt=0,tn=0,nn=0,en=0;t.on("touchstart",h=>{if(h.touches.length===1){const d=h.touches[0];jt=d.clientX,tn=d.clientY,nn=z,en=U}}),t.on("touchmove",h=>{if(h.touches.length===1){h.preventDefault();const d=h.touches[0];z=nn+(d.clientX-jt),U=en+(d.clientY-tn),Mt()}}),t.on("contextmenu",h=>{h.preventDefault()})}async function _o(){[N,et]=await Promise.all([lo(),fo()]),G.clear(),N.forEach(t=>G.set(t.hash,t)),console.log("Commits:",N.length),console.log("Branches:",et.length),ho(et),Yt(),window.addEventListener("resize",()=>{Yt()})}_o();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var cn={value:()=>{}};function Re(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new vt(n)}function vt(t){this._=t}function ln(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}vt.prototype=Re.prototype={constructor:vt,on:function(t,e){var n=this._,r=ln(t+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(t=r[o]).type)&&(i=un(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<s;)if(i=(t=r[o]).type)n[i]=ge(n[i],t.name,e);else if(e==null)for(i in n)n[i]=ge(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new vt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function un(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function ge(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=cn,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var qt="http://www.w3.org/1999/xhtml";const me={svg:"http://www.w3.org/2000/svg",xhtml:qt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),me.hasOwnProperty(e)?{space:me[e],local:t}:t}function fn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===qt&&e.documentElement.namespaceURI===qt?e.createElement(t):e.createElementNS(n,t)}}function hn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Me(t){var e=Bt(t);return(e.local?hn:fn)(e)}function pn(){}function jt(t){return t==null?pn:function(){return this.querySelector(t)}}function dn(t){typeof t!="function"&&(t=jt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=t.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new B(r,this._parents)}function gn(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function mn(){return[]}function Te(t){return t==null?mn:function(){return this.querySelectorAll(t)}}function wn(t){return function(){return gn(t.apply(this,arguments))}}function yn(t){typeof t=="function"?t=wn(t):t=Te(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var s=e[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(t.call(c,c.__data__,l,s)),i.push(c));return new B(r,i)}function Ie(t){return function(){return this.matches(t)}}function Oe(t){return function(e){return e.matches(t)}}var _n=Array.prototype.find;function xn(t){return function(){return _n.call(this.children,t)}}function vn(){return this.firstElementChild}function bn(t){return this.select(t==null?vn:xn(typeof t=="function"?t:Oe(t)))}var $n=Array.prototype.filter;function En(){return Array.from(this.children)}function Sn(t){return function(){return $n.call(this.children,t)}}function Nn(t){return this.selectAll(t==null?En:Sn(typeof t=="function"?t:Oe(t)))}function Cn(t){typeof t!="function"&&(t=Ie(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&t.call(c,c.__data__,l,o)&&a.push(c);return new B(r,this._parents)}function Pe(t){return new Array(t.length)}function An(){return new B(this._enter||this._groups.map(Pe),this._parents)}function Et(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Et.prototype={constructor:Et,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function kn(t){return function(){return t}}function Bn(t,e,n,r,i,o){for(var s=0,a,c=e.length,l=o.length;s<l;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new Et(t,o[s]);for(;s<c;++s)(a=e[s])&&(i[s]=a)}function Rn(t,e,n,r,i,o,s){var a,c,l=new Map,u=e.length,p=o.length,d=new Array(u),g;for(a=0;a<u;++a)(c=e[a])&&(d[a]=g=s.call(c,c.__data__,a,e)+"",l.has(g)?i[a]=c:l.set(g,c));for(a=0;a<p;++a)g=s.call(t,o[a],a,o)+"",(c=l.get(g))?(r[a]=c,c.__data__=o[a],l.delete(g)):n[a]=new Et(t,o[a]);for(a=0;a<u;++a)(c=e[a])&&l.get(d[a])===c&&(i[a]=c)}function Mn(t){return t.__data__}function Tn(t,e){if(!arguments.length)return Array.from(this,Mn);var n=e?Rn:Bn,r=this._parents,i=this._groups;typeof t!="function"&&(t=kn(t));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],p=i[l],d=p.length,g=In(t.call(u,u&&u.__data__,l,r)),m=g.length,E=a[l]=new Array(m),A=s[l]=new Array(m),Tt=c[l]=new Array(d);n(u,p,E,A,Tt,g,e);for(var I=0,q=0,N,ht;I<m;++I)if(N=E[I]){for(I>=q&&(q=I+1);!(ht=A[q])&&++q<m;);N._next=ht||null}}return s=new B(s,r),s._enter=a,s._exit=c,s}function In(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function On(){return new B(this._exit||this._groups.map(Pe),this._parents)}function Pn(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function Fn(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],p=l.length,d=a[c]=new Array(p),g,m=0;m<p;++m)(g=l[m]||u[m])&&(d[m]=g);for(;c<i;++c)a[c]=n[c];return new B(a,this._parents)}function Xn(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Ln(t){t||(t=Yn);function e(p,d){return p&&d?t(p.__data__,d.__data__):!p-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(e)}return new B(i,this._parents).order()}function Yn(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Hn(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Dn(){return Array.from(this)}function qn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function Vn(){let t=0;for(const e of this)++t;return t}function zn(){return!this.node()}function Un(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&t.call(a,a.__data__,o,i);return this}function Zn(t){return function(){this.removeAttribute(t)}}function Kn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Gn(t,e){return function(){this.setAttribute(t,e)}}function Wn(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Jn(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Qn(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function jn(t,e){var n=Bt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Kn:Zn:typeof e=="function"?n.local?Qn:Jn:n.local?Wn:Gn)(n,e))}function Fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function tr(t){return function(){this.style.removeProperty(t)}}function er(t,e,n){return function(){this.style.setProperty(t,e,n)}}function nr(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function rr(t,e,n){return arguments.length>1?this.each((e==null?tr:typeof e=="function"?nr:er)(t,e,n??"")):W(this.node(),t)}function W(t,e){return t.style.getPropertyValue(e)||Fe(t).getComputedStyle(t,null).getPropertyValue(e)}function ir(t){return function(){delete this[t]}}function or(t,e){return function(){this[t]=e}}function sr(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function ar(t,e){return arguments.length>1?this.each((e==null?ir:typeof e=="function"?sr:or)(t,e)):this.node()[t]}function Xe(t){return t.trim().split(/^|\s+/)}function te(t){return t.classList||new Le(t)}function Le(t){this._node=t,this._names=Xe(t.getAttribute("class")||"")}Le.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Ye(t,e){for(var n=te(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function He(t,e){for(var n=te(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function cr(t){return function(){Ye(this,t)}}function lr(t){return function(){He(this,t)}}function ur(t,e){return function(){(e.apply(this,arguments)?Ye:He)(this,t)}}function fr(t,e){var n=Xe(t+"");if(arguments.length<2){for(var r=te(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?ur:e?cr:lr)(n,e))}function hr(){this.textContent=""}function pr(t){return function(){this.textContent=t}}function dr(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function gr(t){return arguments.length?this.each(t==null?hr:(typeof t=="function"?dr:pr)(t)):this.node().textContent}function mr(){this.innerHTML=""}function wr(t){return function(){this.innerHTML=t}}function yr(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function _r(t){return arguments.length?this.each(t==null?mr:(typeof t=="function"?yr:wr)(t)):this.node().innerHTML}function xr(){this.nextSibling&&this.parentNode.appendChild(this)}function vr(){return this.each(xr)}function br(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $r(){return this.each(br)}function Er(t){var e=typeof t=="function"?t:Me(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Sr(){return null}function Nr(t,e){var n=typeof t=="function"?t:Me(t),r=e==null?Sr:typeof e=="function"?e:jt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Cr(){var t=this.parentNode;t&&t.removeChild(this)}function Ar(){return this.each(Cr)}function kr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Br(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Rr(t){return this.select(t?Br:kr)}function Mr(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Tr(t){return function(e){t.call(this,e,this.__data__)}}function Ir(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Or(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function Pr(t,e,n){return function(){var r=this.__on,i,o=Tr(e);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Fr(t,e,n){var r=Ir(t+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=e?Pr:Or,i=0;i<o;++i)this.each(a(r[i],e,n));return this}function De(t,e,n){var r=Fe(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Xr(t,e){return function(){return De(this,t,e)}}function Lr(t,e){return function(){return De(this,t,e.apply(this,arguments))}}function Yr(t,e){return this.each((typeof e=="function"?Lr:Xr)(t,e))}function*Hr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var qe=[null];function B(t,e){this._groups=t,this._parents=e}function ut(){return new B([[document.documentElement]],qe)}function Dr(){return this}B.prototype=ut.prototype={constructor:B,select:dn,selectAll:yn,selectChild:bn,selectChildren:Nn,filter:Cn,data:Tn,enter:An,exit:On,join:Pn,merge:Fn,selection:Dr,order:Xn,sort:Ln,call:Hn,nodes:Dn,node:qn,size:Vn,empty:zn,each:Un,attr:jn,style:rr,property:ar,classed:fr,text:gr,html:_r,raise:vr,lower:$r,append:Er,insert:Nr,remove:Ar,clone:Rr,datum:Mr,on:Fr,dispatch:Yr,[Symbol.iterator]:Hr};function Lt(t){return typeof t=="string"?new B([[document.querySelector(t)]],[document.documentElement]):new B([[t]],qe)}function ee(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ve(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ft(){}var st=.7,St=1/st,G="\\s*([+-]?\\d+)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",O="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qr=/^#([0-9a-f]{3,8})$/,Vr=new RegExp(`^rgb\\(${G},${G},${G}\\)$`),zr=new RegExp(`^rgb\\(${O},${O},${O}\\)$`),Ur=new RegExp(`^rgba\\(${G},${G},${G},${at}\\)$`),Zr=new RegExp(`^rgba\\(${O},${O},${O},${at}\\)$`),Kr=new RegExp(`^hsl\\(${at},${O},${O}\\)$`),Gr=new RegExp(`^hsla\\(${at},${O},${O},${at}\\)$`),we={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ee(ft,ct,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ye,formatHex:ye,formatHex8:Wr,formatHsl:Jr,formatRgb:_e,toString:_e});function ye(){return this.rgb().formatHex()}function Wr(){return this.rgb().formatHex8()}function Jr(){return ze(this).formatHsl()}function _e(){return this.rgb().formatRgb()}function ct(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=qr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xe(e):n===3?new k(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?yt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?yt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Vr.exec(t))?new k(e[1],e[2],e[3],1):(e=zr.exec(t))?new k(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Ur.exec(t))?yt(e[1],e[2],e[3],e[4]):(e=Zr.exec(t))?yt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Kr.exec(t))?$e(e[1],e[2]/100,e[3]/100,1):(e=Gr.exec(t))?$e(e[1],e[2]/100,e[3]/100,e[4]):we.hasOwnProperty(t)?xe(we[t]):t==="transparent"?new k(NaN,NaN,NaN,0):null}function xe(t){return new k(t>>16&255,t>>8&255,t&255,1)}function yt(t,e,n,r){return r<=0&&(t=e=n=NaN),new k(t,e,n,r)}function Qr(t){return t instanceof ft||(t=ct(t)),t?(t=t.rgb(),new k(t.r,t.g,t.b,t.opacity)):new k}function Vt(t,e,n,r){return arguments.length===1?Qr(t):new k(t,e,n,r??1)}function k(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}ee(k,Vt,Ve(ft,{brighter(t){return t=t==null?St:Math.pow(St,t),new k(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?st:Math.pow(st,t),new k(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new k(Z(this.r),Z(this.g),Z(this.b),Nt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ve,formatHex:ve,formatHex8:jr,formatRgb:be,toString:be}));function ve(){return`#${U(this.r)}${U(this.g)}${U(this.b)}`}function jr(){return`#${U(this.r)}${U(this.g)}${U(this.b)}${U((isNaN(this.opacity)?1:this.opacity)*255)}`}function be(){const t=Nt(this.opacity);return`${t===1?"rgb(":"rgba("}${Z(this.r)}, ${Z(this.g)}, ${Z(this.b)}${t===1?")":`, ${t})`}`}function Nt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Z(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function U(t){return t=Z(t),(t<16?"0":"")+t.toString(16)}function $e(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new M(t,e,n,r)}function ze(t){if(t instanceof M)return new M(t.h,t.s,t.l,t.opacity);if(t instanceof ft||(t=ct(t)),!t)return new M;if(t instanceof M)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(e===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new M(s,a,c,t.opacity)}function ti(t,e,n,r){return arguments.length===1?ze(t):new M(t,e,n,r??1)}function M(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ee(M,ti,Ve(ft,{brighter(t){return t=t==null?St:Math.pow(St,t),new M(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?st:Math.pow(st,t),new M(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new k(Yt(t>=240?t-240:t+120,i,r),Yt(t,i,r),Yt(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new M(Ee(this.h),_t(this.s),_t(this.l),Nt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Nt(this.opacity);return`${t===1?"hsl(":"hsla("}${Ee(this.h)}, ${_t(this.s)*100}%, ${_t(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Ee(t){return t=(t||0)%360,t<0?t+360:t}function _t(t){return Math.max(0,Math.min(1,t||0))}function Yt(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ue=t=>()=>t;function ei(t,e){return function(n){return t+n*e}}function ni(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function ri(t){return(t=+t)==1?Ze:function(e,n){return n-e?ni(e,n,t):Ue(isNaN(e)?n:e)}}function Ze(t,e){var n=e-t;return n?ei(t,n):Ue(isNaN(t)?e:t)}const Se=(function t(e){var n=ri(e);function r(i,o){var s=n((i=Vt(i)).r,(o=Vt(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Ze(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=t,r})(1);function H(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var zt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ht=new RegExp(zt.source,"g");function ii(t){return function(){return t}}function oi(t){return function(e){return t(e)+""}}function si(t,e){var n=zt.lastIndex=Ht.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=zt.exec(t))&&(i=Ht.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:H(r,i)})),n=Ht.lastIndex;return n<e.length&&(o=e.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?oi(c[0].x):ii(e):(e=c.length,function(l){for(var u=0,p;u<e;++u)a[(p=c[u]).i]=p.x(l);return a.join("")})}var Ne=180/Math.PI,Ut={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ke(t,e,n,r,i,o){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Ne,skewX:Math.atan(c)*Ne,scaleX:s,scaleY:a}}var xt;function ai(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Ut:Ke(e.a,e.b,e.c,e.d,e.e,e.f)}function ci(t){return t==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",t),!(t=xt.transform.baseVal.consolidate()))?Ut:(t=t.matrix,Ke(t.a,t.b,t.c,t.d,t.e,t.f))}function Ge(t,e,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,p,d,g,m){if(l!==p||u!==d){var E=g.push("translate(",null,e,null,n);m.push({i:E-4,x:H(l,p)},{i:E-2,x:H(u,d)})}else(p||d)&&g.push("translate("+p+e+d+n)}function s(l,u,p,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:p.push(i(p)+"rotate(",null,r)-2,x:H(l,u)})):u&&p.push(i(p)+"rotate("+u+r)}function a(l,u,p,d){l!==u?d.push({i:p.push(i(p)+"skewX(",null,r)-2,x:H(l,u)}):u&&p.push(i(p)+"skewX("+u+r)}function c(l,u,p,d,g,m){if(l!==p||u!==d){var E=g.push(i(g)+"scale(",null,",",null,")");m.push({i:E-4,x:H(l,p)},{i:E-2,x:H(u,d)})}else(p!==1||d!==1)&&g.push(i(g)+"scale("+p+","+d+")")}return function(l,u){var p=[],d=[];return l=t(l),u=t(u),o(l.translateX,l.translateY,u.translateX,u.translateY,p,d),s(l.rotate,u.rotate,p,d),a(l.skewX,u.skewX,p,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,p,d),l=u=null,function(g){for(var m=-1,E=d.length,A;++m<E;)p[(A=d[m]).i]=A.x(g);return p.join("")}}}var li=Ge(ai,"px, ","px)","deg)"),ui=Ge(ci,", ",")",")"),J=0,nt=0,et=0,We=1e3,Ct,rt,At=0,K=0,Rt=0,lt=typeof performance=="object"&&performance.now?performance:Date,Je=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ne(){return K||(Je(fi),K=lt.now()+Rt)}function fi(){K=0}function kt(){this._call=this._time=this._next=null}kt.prototype=Qe.prototype={constructor:kt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?ne():+n)+(e==null?0:+e),!this._next&&rt!==this&&(rt?rt._next=this:Ct=this,rt=this),this._call=t,this._time=n,Zt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zt())}};function Qe(t,e,n){var r=new kt;return r.restart(t,e,n),r}function hi(){ne(),++J;for(var t=Ct,e;t;)(e=K-t._time)>=0&&t._call.call(void 0,e),t=t._next;--J}function Ce(){K=(At=lt.now())+Rt,J=nt=0;try{hi()}finally{J=0,di(),K=0}}function pi(){var t=lt.now(),e=t-At;e>We&&(Rt-=e,At=t)}function di(){for(var t,e=Ct,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ct=n);rt=t,Zt(r)}function Zt(t){if(!J){nt&&(nt=clearTimeout(nt));var e=t-K;e>24?(t<1/0&&(nt=setTimeout(Ce,t-lt.now()-Rt)),et&&(et=clearInterval(et))):(et||(At=lt.now(),et=setInterval(pi,We)),J=1,Je(Ce))}}function Ae(t,e,n){var r=new kt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var gi=Re("start","end","cancel","interrupt"),mi=[],je=0,ke=1,Kt=2,bt=3,Be=4,Gt=5,$t=6;function Mt(t,e,n,r,i,o){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;wi(t,n,{name:e,index:r,group:i,on:gi,tween:mi,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:je})}function re(t,e){var n=T(t,e);if(n.state>je)throw new Error("too late; already scheduled");return n}function P(t,e){var n=T(t,e);if(n.state>bt)throw new Error("too late; already running");return n}function T(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function wi(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Qe(o,0,n.time);function o(l){n.state=ke,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,p,d,g;if(n.state!==ke)return c();for(u in r)if(g=r[u],g.name===n.name){if(g.state===bt)return Ae(s);g.state===Be?(g.state=$t,g.timer.stop(),g.on.call("interrupt",t,t.__data__,g.index,g.group),delete r[u]):+u<e&&(g.state=$t,g.timer.stop(),g.on.call("cancel",t,t.__data__,g.index,g.group),delete r[u])}if(Ae(function(){n.state===bt&&(n.state=Be,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Kt,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Kt){for(n.state=bt,i=new Array(d=n.tween.length),u=0,p=-1;u<d;++u)(g=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++p]=g);i.length=p+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Gt,1),p=-1,d=i.length;++p<d;)i[p].call(t,u);n.state===Gt&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=$t,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function yi(t,e){var n=t.__transition,r,i,o=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){o=!1;continue}i=r.state>Kt&&r.state<Gt,r.state=$t,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}o&&delete t.__transition}}function _i(t){return this.each(function(){yi(this,t)})}function xi(t,e){var n,r;return function(){var i=P(this,t),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function vi(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=P(this,t),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:e,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===e){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function bi(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=T(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((e==null?xi:vi)(n,t,e))}function ie(t,e,n){var r=t._id;return t.each(function(){var i=P(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return T(i,r).value[e]}}function tn(t,e){var n;return(typeof e=="number"?H:e instanceof ct?Se:(n=ct(e))?(e=n,Se):si)(t,e)}function $i(t){return function(){this.removeAttribute(t)}}function Ei(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Si(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttribute(t);return s===i?null:s===r?o:o=e(r=s,n)}}function Ni(t,e,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?o:o=e(r=s,n)}}function Ci(t,e,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a)))}}function Ai(t,e,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a)))}}function ki(t,e){var n=Bt(t),r=n==="transform"?ui:tn;return this.attrTween(t,typeof e=="function"?(n.local?Ai:Ci)(n,r,ie(this,"attr."+t,e)):e==null?(n.local?Ei:$i)(n):(n.local?Ni:Si)(n,r,e))}function Bi(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ri(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Mi(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Ri(t,o)),n}return i._value=e,i}function Ti(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Bi(t,o)),n}return i._value=e,i}function Ii(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Bt(t);return this.tween(n,(r.local?Mi:Ti)(r,e))}function Oi(t,e){return function(){re(this,t).delay=+e.apply(this,arguments)}}function Pi(t,e){return e=+e,function(){re(this,t).delay=e}}function Fi(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Oi:Pi)(e,t)):T(this.node(),e).delay}function Xi(t,e){return function(){P(this,t).duration=+e.apply(this,arguments)}}function Li(t,e){return e=+e,function(){P(this,t).duration=e}}function Yi(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Xi:Li)(e,t)):T(this.node(),e).duration}function Hi(t,e){if(typeof e!="function")throw new Error;return function(){P(this,t).ease=e}}function Di(t){var e=this._id;return arguments.length?this.each(Hi(e,t)):T(this.node(),e).ease}function qi(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;P(this,t).ease=n}}function Vi(t){if(typeof t!="function")throw new Error;return this.each(qi(this._id,t))}function zi(t){typeof t!="function"&&(t=Ie(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&t.call(c,c.__data__,l,o)&&a.push(c);return new L(r,this._parents,this._name,this._id)}function Ui(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=e[a],l=n[a],u=c.length,p=s[a]=new Array(u),d,g=0;g<u;++g)(d=c[g]||l[g])&&(p[g]=d);for(;a<r;++a)s[a]=e[a];return new L(s,this._parents,this._name,this._id)}function Zi(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Ki(t,e,n){var r,i,o=Zi(e)?re:P;return function(){var s=o(this,t),a=s.on;a!==r&&(i=(r=a).copy()).on(e,n),s.on=i}}function Gi(t,e){var n=this._id;return arguments.length<2?T(this.node(),n).on.on(t):this.each(Ki(n,t,e))}function Wi(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Ji(){return this.on("end.remove",Wi(this._id))}function Qi(t){var e=this._name,n=this._id;typeof t!="function"&&(t=jt(t));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,p,d=0;d<c;++d)(u=a[d])&&(p=t.call(u,u.__data__,d,a))&&("__data__"in u&&(p.__data__=u.__data__),l[d]=p,Mt(l[d],e,n,d,l,T(u,n)));return new L(o,this._parents,e,n)}function ji(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Te(t));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,p=0;p<l;++p)if(u=c[p]){for(var d=t.call(u,u.__data__,p,c),g,m=T(u,n),E=0,A=d.length;E<A;++E)(g=d[E])&&Mt(g,e,n,E,d,m);o.push(d),s.push(u)}return new L(o,s,e,n)}var to=ut.prototype.constructor;function eo(){return new to(this._groups,this._parents)}function no(t,e){var n,r,i;return function(){var o=W(this,t),s=(this.style.removeProperty(t),W(this,t));return o===s?null:o===n&&s===r?i:i=e(n=o,r=s)}}function en(t){return function(){this.style.removeProperty(t)}}function ro(t,e,n){var r,i=n+"",o;return function(){var s=W(this,t);return s===i?null:s===r?o:o=e(r=s,n)}}function io(t,e,n){var r,i,o;return function(){var s=W(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),W(this,t))),s===c?null:s===r&&c===i?o:(i=c,o=e(r=s,a))}}function oo(t,e){var n,r,i,o="style."+e,s="end."+o,a;return function(){var c=P(this,t),l=c.on,u=c.value[o]==null?a||(a=en(e)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function so(t,e,n){var r=(t+="")=="transform"?li:tn;return e==null?this.styleTween(t,no(t,r)).on("end.style."+t,en(t)):typeof e=="function"?this.styleTween(t,io(t,r,ie(this,"style."+t,e))).each(oo(this._id,t)):this.styleTween(t,ro(t,r,e),n).on("end.style."+t,null)}function ao(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function co(t,e,n){var r,i;function o(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&ao(t,s,n)),r}return o._value=e,o}function lo(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,co(t,e,n??""))}function uo(t){return function(){this.textContent=t}}function fo(t){return function(){var e=t(this);this.textContent=e??""}}function ho(t){return this.tween("text",typeof t=="function"?fo(ie(this,"text",t)):uo(t==null?"":t+""))}function po(t){return function(e){this.textContent=t.call(this,e)}}function go(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&po(i)),e}return r._value=t,r}function mo(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,go(t))}function wo(){for(var t=this._name,e=this._id,n=nn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=T(c,e);Mt(c,t,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new L(r,this._parents,t,n)}function yo(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=P(this,r),u=l.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),l.on=e}),i===0&&o()})}var _o=0;function L(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function nn(){return++_o}var X=ut.prototype;L.prototype={constructor:L,select:Qi,selectAll:ji,selectChild:X.selectChild,selectChildren:X.selectChildren,filter:zi,merge:Ui,selection:eo,transition:wo,call:X.call,nodes:X.nodes,node:X.node,size:X.size,empty:X.empty,each:X.each,on:Gi,attr:ki,attrTween:Ii,style:so,styleTween:lo,text:ho,textTween:mo,remove:Ji,tween:bi,delay:Fi,duration:Yi,ease:Di,easeVarying:Vi,end:yo,[Symbol.iterator]:X[Symbol.iterator]};function xo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var vo={time:null,delay:0,duration:250,ease:xo};function bo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function $o(t){var e,n;t instanceof L?(e=t._id,t=t._name):(e=nn(),(n=vo).time=ne(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Mt(c,t,e,l,s,n||bo(c,e));return new L(r,this._parents,t,e)}ut.prototype.interrupt=_i;ut.prototype.transition=$o;function it(t,e,n){this.k=t,this.x=e,this.y=n}it.prototype={constructor:it,scale:function(t){return t===1?this:new it(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new it(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};it.prototype;let R=[],ot=[],Wt=[],D=new Map,Dt="",z=1,Jt={};async function Eo(){const t=await window.gitopo.git.exec("rev-parse --show-toplevel");if(t.success){const e=t.output.trim();return e.split("/").pop()||e}return"Unknown Repository"}async function So(){const t=await window.gitopo.config.get();return t.success?t.config:(console.error("Failed to fetch config:",t.error),{})}async function No(){const t=await window.gitopo.gh.exec("pr list --state open --json number,title,headRefName,headRefOid");if(!t.success)return console.error("Failed to fetch pull requests:",t.error),[];try{return JSON.parse(t.output).map(n=>({number:n.number,title:n.title,branch:n.headRefName,headCommit:n.headRefOid}))}catch(e){return console.error("Failed to parse PR data:",e),[]}}async function Co(){const t=await window.gitopo.git.exec('log --all --format="%H|%P|%ct|%s" --date-order -1000');if(!t.success)return console.error("Failed to fetch commits:",t.error),[];const e=[],n=t.output.trim().split(`
|
|
2
|
+
`);for(const r of n){const i=r.split("|");if(i.length>=4){const o=i[0],s=i[1],a=parseInt(i[2],10),c=i.slice(3).join("|"),l=s.trim()?s.trim().split(" "):[];e.push({hash:o,parents:l,timestamp:a,message:c})}}return e.sort((r,i)=>i.timestamp-r.timestamp),e}async function Ao(){const t=await window.gitopo.git.exec('branch -a --format="%(refname:short) %(objectname)"');if(!t.success)return console.error("Failed to fetch branches:",t.error),[];const e=[],n=t.output.trim().split(`
|
|
3
|
+
`);for(const r of n){const i=r.trim().split(" ");if(i.length>=2){const o=i[0],s=i[1];e.push({name:o,hash:s})}}return e}function ko(t){const e=["branch1","branch2","branch3"],n=Jt.keyBranches||[],r=t.find(i=>i.name==="main"||i.name==="master");e.forEach((i,o)=>{const s=document.getElementById(i);s.innerHTML="";const a=document.createElement("option");if(a.value="",a.textContent="----",s.appendChild(a),t.forEach(c=>{const l=document.createElement("option");l.value=c.name,l.textContent=c.name,s.appendChild(l)}),n[o]){const c=t.find(l=>l.name===n[o]);c&&(s.value=c.name)}else o===0&&r&&(s.value=r.name);s.addEventListener("change",()=>Qt())})}function Bo(t){const e=ot.find(i=>i.name===t);if(!e)return new Set;const n=new Set;let r=e.hash;for(;r;){n.add(r);const i=D.get(r);if(i&&i.parents.length>0)r=i.parents[0];else break}return n}function Ro(t,e=new Set){const n=[],r=new Set,i=new Map;for(const c of R)for(const l of c.parents)i.has(l)||i.set(l,[]),i.get(l).push(c.hash);function o(c){const l=new Set,u=[c];for(;u.length>0;){const p=u.pop();if(l.has(p)||t.has(p)||e.has(p)||r.has(p))continue;const d=D.get(p);if(!d)continue;l.add(p);for(const m of d.parents)!t.has(m)&&!e.has(m)&&!l.has(m)&&u.push(m);const g=i.get(p)||[];for(const m of g)!t.has(m)&&!e.has(m)&&!l.has(m)&&u.push(m)}return l}function s(c){for(const l of c){const u=D.get(l);if(u){for(const p of u.parents)if(!t.has(p)&&!c.has(p))return!1}}return!0}function a(c){for(const l of t){const u=D.get(l);if(!(!u||u.parents.length<2)){for(let p=1;p<u.parents.length;p++)if(c.has(u.parents[p]))return l}}return null}for(const c of R){if(t.has(c.hash)||e.has(c.hash)||r.has(c.hash))continue;const l=o(c.hash);l.size>0&&s(l)&&(l.forEach(u=>r.add(u)),n.push({mergeCommit:a(l),commits:l}))}return n}function Mo(){const t=[];return["branch1","branch2","branch3"].forEach(e=>{const n=document.getElementById(e);n&&n.value&&t.push(n.value)}),t}function Qt(){const t=Lt("#graph");t.selectAll("*").remove();const e=Lt("#app");e.selectAll(".tooltip").remove();const n=document.getElementById("controls").offsetHeight,r=window.innerWidth,i=window.innerHeight-n;t.attr("width",r).attr("height",i);const o=6,s=30,a=150,c=30,l=50,u=50,d=Mo().map(f=>({name:f,lineage:Bo(f)})),g=new Set;d.forEach(({lineage:f})=>{f.forEach(h=>g.add(h))});const m=d.map(({name:f,lineage:h})=>{const w=new Set;d.forEach(y=>{y.name!==f&&y.lineage.forEach(_=>w.add(_))});const v=Ro(h,w);return{name:f,lineage:h,subBranches:v}}),E=new Map;ot.forEach(f=>{E.has(f.hash)||E.set(f.hash,[]),E.get(f.hash).push(f.name)});const A=new Map;R.forEach(f=>{A.set(f.hash,{mainCol:m.length,subOffset:0,isSubBranch:!1})}),m.forEach((f,h)=>{for(const w of f.lineage)A.set(w,{mainCol:h,subOffset:0,isSubBranch:!1})});let Tt=0;m.forEach((f,h)=>{const w=new Map;[...f.subBranches].sort((y,_)=>{const $=x=>{let b=1/0;return x.commits.forEach(S=>{const C=D.get(S);C&&C.timestamp<b&&(b=C.timestamp)}),b};return $(y)-$(_)}).forEach(y=>{const _=`sb-${Tt++}`,$=[];y.commits.forEach(S=>{const C=R.findIndex(j=>j.hash===S);C>=0&&$.push(C)});let x=1,b=!0;for(;b;){b=!1;for(const S of $)if((w.get(S)||new Set).has(x)){b=!0,x++;break}}for(const S of $)w.has(S)||w.set(S,new Set),w.get(S).add(x);y.commits.forEach(S=>{A.set(S,{mainCol:h,subOffset:x,isSubBranch:!0,subBranchId:_})})})});const I=new Map;let q=u;for(let f=0;f<=m.length;f++)if(I.set(f,q),f<m.length){let h=0;R.forEach(w=>{const v=A.get(w.hash);v.mainCol===f&&v.subOffset>h&&(h=v.subOffset)}),q+=a+h*c}const N=new Map;R.forEach((f,h)=>{const w=A.get(f.hash),y=I.get(w.mainCol)+w.subOffset*c;N.set(f.hash,{col:w.mainCol,subOffset:w.subOffset,row:h,x:y,y:l+h*s,isSubBranch:w.isSubBranch,subBranchId:w.subBranchId||null})});const ht=Array.from(A.values()).some(f=>f.mainCol===m.length),F=t.append("g").attr("class","main-group"),It=t.append("g").attr("class","header-group"),Ot=e.append("div").attr("class","tooltip").style("opacity",0),pt=["#4CAF50","#2196F3","#FF9800"],oe=20;m.forEach((f,h)=>{It.append("text").attr("x",I.get(h)).attr("y",oe).attr("text-anchor","middle").attr("fill",pt[h]||"#888").attr("font-size","14px").attr("font-weight","bold").text(f.name)}),ht&&It.append("text").attr("x",I.get(m.length)).attr("y",oe).attr("text-anchor","middle").attr("fill","#888").attr("font-size","14px").text("Other");const dt=new Map;R.forEach(f=>{f.parents.forEach(h=>{dt.has(h)||dt.set(h,[]),dt.get(h).push(f.hash)})});const rn=new Set;m.forEach(f=>{f.lineage.forEach(h=>rn.add(h))});function se(f){const h=[],w=new Set;function v(_){if(w.has(_))return;w.add(_);const $=D.get(_);$&&$.parents.forEach(x=>{h.push({source:_,target:x});const b=N.get(x);b&&b.col===m.length&&!b.isSubBranch&&v(x)})}function y(_){if(w.has(_))return;w.add(_),(dt.get(_)||[]).forEach(x=>{h.push({source:x,target:_});const b=N.get(x);b&&b.col===m.length&&!b.isSubBranch&&y(x)})}return v(f),w.delete(f),y(f),h}R.forEach(f=>{const h=N.get(f.hash);h&&f.parents.forEach(w=>{const v=N.get(w);if(v){const y=h.col===m.length||v.col===m.length,_=h.x,$=h.y*z,x=v.x,b=v.y*z;let S;if(_===x)S=`M ${_} ${$} L ${x} ${b}`;else{const wt=($+b)/2;S=`M ${_} ${$} C ${_} ${wt}, ${x} ${wt}, ${x} ${b}`}const C=h.subBranchId||v.subBranchId||null,j=h.isSubBranch||v.isSubBranch,sn=!j&&!y&&h.col<m.length;let Xt="#666";y?Xt="#444":h.col<m.length&&(Xt=pt[h.col]||"#666");let tt=1.5;y?tt=1:sn?tt=3:j&&(tt=1.5);const an=F.append("path").attr("d",S).attr("fill","none").attr("stroke",Xt).attr("stroke-width",tt).attr("stroke-opacity",y?.4:j?.5:.8).attr("stroke-dasharray",y?"4,4":"none").attr("class",C?`edge edge-${C}`:"edge").attr("data-source",f.hash).attr("data-target",w);if(C){const wt=tt;an.style("cursor","pointer").on("mouseenter",()=>{F.selectAll(`.edge-${C}`).attr("stroke-width",3).attr("stroke-opacity",.9)}).on("mouseleave",()=>{F.selectAll(`.edge-${C}`).attr("stroke-width",wt).attr("stroke-opacity",.5)})}}})});const Q=new Map;Wt.forEach(f=>{Q.set(f.headCommit,f)});const Pt=F.selectAll("g.node").data(R).enter().append("g").attr("class","node").attr("transform",f=>{const h=N.get(f.hash);return h?`translate(${h.x}, ${h.y*z})`:"translate(-100, -100)"});Pt.filter(f=>Q.has(f.hash)).append("circle").attr("r",o+6).attr("fill","none").attr("stroke","#888").attr("stroke-width",2).attr("stroke-dasharray","3,2"),Pt.append("circle").attr("r",f=>{const h=N.get(f.hash);return h.isSubBranch?o*.6:h.col<m.length?o:o*.7}).attr("fill",f=>{const h=N.get(f.hash);return h.col<m.length?pt[h.col]||"#fff":h.isSubBranch?"#a0a0a0":"#888"}).attr("stroke",f=>{const h=N.get(f.hash);return h.col<m.length&&pt[h.col]||"#333"}).attr("stroke-width",f=>{const h=N.get(f.hash);return h.isSubBranch?1:h.col<m.length?2:1}).style("cursor","pointer").on("mouseenter",(f,h)=>{const w=E.get(h.hash),v=w?`[${w.join(", ")}]<br/>`:"",y=Q.get(h.hash),_=y?`<span class="pr-info">PR #${y.number}: ${y.title}</span><br/>`:"",$=new Date(h.timestamp*1e3).toLocaleString();Ot.html(`<strong>${h.hash.substring(0,7)}</strong><br/>${_}${v}${h.message}<br/><span class="date">${$}</span>`).style("left",f.pageX+15+"px").style("top",f.pageY-10+"px").style("opacity",1);const x=N.get(h.hash);x&&x.col===m.length&&!x.isSubBranch&&se(h.hash).forEach(({source:S,target:C})=>{F.selectAll(`path.edge[data-source="${S}"][data-target="${C}"]`).attr("stroke-width",3).attr("stroke-opacity",.9)})}).on("mousemove",f=>{Ot.style("left",f.pageX+15+"px").style("top",f.pageY-10+"px")}).on("mouseleave",(f,h)=>{Ot.style("opacity",0);const w=N.get(h.hash);w&&w.col===m.length&&!w.isSubBranch&&se(h.hash).forEach(({source:y,target:_})=>{F.selectAll(`path.edge[data-source="${y}"][data-target="${_}"]`).attr("stroke-width",1).attr("stroke-opacity",.4)})}),Pt.filter(f=>Q.has(f.hash)).append("text").attr("x",o+10).attr("y",4).attr("fill","#ccc").attr("font-size","11px").text(f=>{const h=Q.get(f.hash);return`PR #${h.number}: ${h.title.substring(0,30)}${h.title.length>30?"...":""}`});let V=0,Y=0,gt=!1,ae=0,ce=0,le=0,ue=0;function Ft(f){return f*z}function mt(){F.attr("transform",`translate(${V}, ${Y})`),It.attr("transform",`translate(${V}, 0)`)}function on(){F.selectAll("g.node").attr("transform",f=>{const h=N.get(f.hash);return h?`translate(${h.x}, ${Ft(h.y)})`:"translate(-100, -100)"}),F.selectAll("path.edge").attr("d",function(){const f=Lt(this),h=f.attr("data-source"),w=f.attr("data-target"),v=N.get(h),y=N.get(w);if(!v||!y)return"";const _=v.x,$=Ft(v.y),x=y.x,b=Ft(y.y);if(_===x)return`M ${_} ${$} L ${x} ${b}`;{const S=($+b)/2;return`M ${_} ${$} C ${_} ${S}, ${x} ${S}, ${x} ${b}`}})}t.on("wheel",f=>{if(f.preventDefault(),f.ctrlKey||f.metaKey){const h=f.deltaY>0?.9:1.1,y=Math.max(.1,Math.min(5,z*h)),_=t.node().getBoundingClientRect(),$=f.clientY-_.top,x=$-Y;Y=$-x*(y/z),z=y,on(),mt()}else V-=f.deltaX,Y-=f.deltaY,mt()}),t.on("mousedown",f=>{f.button===0&&(gt=!0,ae=f.clientX,ce=f.clientY,le=V,ue=Y,f.preventDefault())}),t.on("mousemove",f=>{gt&&(V=le+(f.clientX-ae),Y=ue+(f.clientY-ce),mt())}),t.on("mouseup",f=>{f.button===0&&(gt=!1)}),t.on("mouseleave",()=>{gt=!1});let fe=0,he=0,pe=0,de=0;t.on("touchstart",f=>{if(f.touches.length===1){const h=f.touches[0];fe=h.clientX,he=h.clientY,pe=V,de=Y}}),t.on("touchmove",f=>{if(f.touches.length===1){f.preventDefault();const h=f.touches[0];V=pe+(h.clientX-fe),Y=de+(h.clientY-he),mt()}}),t.on("contextmenu",f=>{f.preventDefault()})}async function To(){[R,ot,Dt,Wt,Jt]=await Promise.all([Co(),Ao(),Eo(),No(),So()]),document.getElementById("repo-name").textContent=Dt,D.clear(),R.forEach(t=>D.set(t.hash,t)),console.log("Repository:",Dt),console.log("Commits:",R.length),console.log("Branches:",ot.length),console.log("Open PRs:",Wt.length),console.log("Config:",Jt),ko(ot),Qt(),window.addEventListener("resize",()=>{Qt()})}To();
|