gitrings 0.1.0__py3-none-any.whl

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.
gitrings/story.html ADDED
@@ -0,0 +1,1338 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
+ <meta name="theme-color" content="#070A08">
7
+ <title>gitrings</title>
8
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%230C1410'/%3E%3Cg fill='none' stroke='%23E8ECE1' stroke-width='2'%3E%3Ccircle cx='16' cy='16' r='11'/%3E%3Ccircle cx='16' cy='16' r='6.5'/%3E%3C/g%3E%3Ccircle cx='16' cy='16' r='2.5' fill='%23FFB23E'/%3E%3C/svg%3E">
9
+ <link rel="preconnect" href="https://api.fontshare.com" crossorigin>
10
+ <link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=clash-display@500,600&display=swap">
11
+ <link rel="stylesheet" href="https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&display=swap">
12
+ <link rel="stylesheet" href="https://fonts.bunny.net/css?family=jetbrains-mono:400,500&display=swap">
13
+ <link rel="stylesheet" href="https://unpkg.com/@phosphor-icons/web@2.1.1/src/light/style.css">
14
+ <style>
15
+ @property --glow { syntax: "<color>"; inherits: true; initial-value: #0C1410; }
16
+
17
+ :root {
18
+ --night: #0C1410;
19
+ --moss: #1D4A34;
20
+ --resin: #FFB23E;
21
+ --ember: #F2552C;
22
+ --bone: #E8ECE1;
23
+ --ink: #0F1712;
24
+ --display: "Clash Display", "Satoshi", system-ui, sans-serif;
25
+ --body: "Satoshi", system-ui, sans-serif;
26
+ --mono: "JetBrains Mono", ui-monospace, monospace;
27
+ --out: cubic-bezier(0.16, 1, 0.3, 1);
28
+ --glide: cubic-bezier(0.32, 0.72, 0, 1);
29
+ --spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.6%, 1);
30
+ }
31
+
32
+ * { box-sizing: border-box; margin: 0; }
33
+ html, body { height: 100%; }
34
+ body {
35
+ display: grid;
36
+ place-items: center;
37
+ background: #070A08;
38
+ color: var(--bone);
39
+ font-family: var(--body);
40
+ -webkit-font-smoothing: antialiased;
41
+ overflow: hidden;
42
+ transition: --glow 1.2s var(--glide);
43
+ }
44
+ body::after {
45
+ content: "";
46
+ position: fixed;
47
+ inset: 0;
48
+ pointer-events: none;
49
+ z-index: 40;
50
+ opacity: 0.09;
51
+ mix-blend-mode: overlay;
52
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
53
+ }
54
+ .backdrop {
55
+ position: fixed;
56
+ inset: 0;
57
+ background: radial-gradient(55% 60% at 50% 48%, color-mix(in oklab, var(--glow) 55%, transparent), transparent 72%);
58
+ filter: blur(40px);
59
+ }
60
+
61
+ .shell {
62
+ position: relative;
63
+ height: min(100dvh - 40px, 940px);
64
+ aspect-ratio: 9 / 16;
65
+ padding: 6px;
66
+ border-radius: 38px;
67
+ background: rgb(255 255 255 / 0.04);
68
+ box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08), 0 50px 140px -50px color-mix(in oklab, var(--glow) 70%, black);
69
+ }
70
+ .story {
71
+ position: relative;
72
+ width: 100%;
73
+ height: 100%;
74
+ overflow: hidden;
75
+ border-radius: 32px;
76
+ container-type: size;
77
+ background: var(--night);
78
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08);
79
+ touch-action: manipulation;
80
+ user-select: none;
81
+ -webkit-user-select: none;
82
+ }
83
+
84
+ .bars {
85
+ position: absolute;
86
+ inset: 3.2cqw 4.5cqw auto;
87
+ display: flex;
88
+ gap: 1cqw;
89
+ z-index: 4;
90
+ }
91
+ .bar { flex: 1; height: 3px; border-radius: 3px; background: color-mix(in oklab, currentColor 22%, transparent); overflow: hidden; }
92
+ .bar i { display: block; height: 100%; background: currentColor; transform: scaleX(0); transform-origin: left; }
93
+ .bar.done i { transform: scaleX(1); }
94
+ .bar.active i { animation: fill var(--dur, 7s) linear forwards; }
95
+ .paused .bar.active i, .hidden-tab .bar.active i { animation-play-state: paused; }
96
+ @keyframes fill { to { transform: scaleX(1); } }
97
+
98
+ .top {
99
+ position: absolute;
100
+ inset: 7cqw 4.5cqw auto;
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: space-between;
104
+ z-index: 4;
105
+ pointer-events: none;
106
+ }
107
+ .mark { font-family: var(--display); font-weight: 600; font-size: 4.6cqw; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 1.6cqw; }
108
+ .mark svg { width: 5cqw; height: 5cqw; }
109
+ .chrome-btn {
110
+ pointer-events: auto;
111
+ display: inline-flex;
112
+ align-items: center;
113
+ gap: 1.4cqw;
114
+ padding: 1.4cqw 3cqw 1.4cqw 2.2cqw;
115
+ border: 0;
116
+ border-radius: 999px;
117
+ background: color-mix(in oklab, currentColor 12%, transparent);
118
+ box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 22%, transparent);
119
+ color: inherit;
120
+ font: 500 3.2cqw var(--body);
121
+ cursor: pointer;
122
+ transition: transform 0.4s var(--spring), background-color 0.3s var(--out);
123
+ }
124
+ .chrome-btn i { font-size: 4.2cqw; }
125
+ .chrome-btn:active { transform: scale(0.96); }
126
+ .eq { display: inline-flex; gap: 0.5cqw; align-items: flex-end; height: 3cqw; }
127
+ .eq b { width: 0.6cqw; height: 100%; background: currentColor; border-radius: 1px; transform-origin: bottom; transform: scaleY(0.3); }
128
+ .sound-on .eq b { animation: eq 0.9s var(--out) infinite alternate; }
129
+ .sound-on .eq b:nth-child(2) { animation-delay: -0.3s; }
130
+ .sound-on .eq b:nth-child(3) { animation-delay: -0.6s; }
131
+ @keyframes eq { to { transform: scaleY(1); } }
132
+
133
+ .slide {
134
+ position: absolute;
135
+ inset: 0;
136
+ display: flex;
137
+ flex-direction: column;
138
+ padding: 19cqw 7.5cqw 9cqw;
139
+ background: var(--bg);
140
+ color: var(--fg);
141
+ visibility: hidden;
142
+ overflow: hidden;
143
+ }
144
+ .slide.is-current { visibility: visible; z-index: 1; }
145
+ .slide.is-entering { visibility: visible; z-index: 2; animation: reveal 1s var(--glide) both; }
146
+ @keyframes reveal {
147
+ from { clip-path: circle(0% at var(--x, 50%) var(--y, 50%)); }
148
+ to { clip-path: circle(150% at var(--x, 50%) var(--y, 50%)); }
149
+ }
150
+ .tone-night { --bg: var(--night); --fg: var(--bone); --accent: var(--resin); }
151
+ .tone-moss { --bg: var(--moss); --fg: var(--bone); --accent: var(--resin); }
152
+ .tone-resin { --bg: var(--resin); --fg: var(--ink); --accent: var(--ink); }
153
+ .tone-ember { --bg: var(--ember); --fg: var(--ink); --accent: var(--bone); }
154
+ .tone-bone { --bg: var(--bone); --fg: var(--ink); --accent: var(--ember); }
155
+
156
+ .is-on .rise {
157
+ animation: rise 1.1s var(--out) both;
158
+ animation-delay: calc(0.35s + var(--lag, 0s) + var(--i, 0) * 0.12s);
159
+ }
160
+ @keyframes rise { from { opacity: 0; transform: translateY(7cqw); filter: blur(6px); } }
161
+ .teased { --lag: 1.9s; }
162
+ .tease { position: absolute; inset: 0 7.5cqw; display: grid; place-content: center; font: 500 9cqw/1.06 var(--display); letter-spacing: -0.025em; opacity: 0; pointer-events: none; }
163
+ .is-on .tease { animation: tease 2.3s var(--out) 0.3s both; }
164
+ @keyframes tease { from { opacity: 0; transform: translateY(5cqw); filter: blur(6px); } 25%, 70% { opacity: 1; transform: none; filter: blur(0); } to { opacity: 0; transform: translateY(-6cqw); filter: blur(8px); } }
165
+ .is-on.teased > :not(.tease, .rise) { animation: appear 0.9s var(--out) var(--lag) both; }
166
+ @keyframes appear { from { opacity: 0; } }
167
+
168
+ .kicker { font-size: 5.4cqw; font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; }
169
+ .big { font-family: var(--display); font-weight: 600; line-height: 0.88; letter-spacing: -0.035em; }
170
+ .headline { font-family: var(--display); font-weight: 600; font-size: 11.5cqw; line-height: 0.95; letter-spacing: -0.03em; }
171
+ .sub { font-size: 4.3cqw; line-height: 1.4; max-width: 34ch; opacity: 0.86; }
172
+ .sub strong { font-weight: 700; opacity: 1; }
173
+ .num { font-variant-numeric: tabular-nums; }
174
+ .mono { font-family: var(--mono); font-size: 3cqw; letter-spacing: 0.02em; }
175
+ .spacer { flex: 1; }
176
+
177
+ svg.chart { display: block; overflow: visible; }
178
+ .trunk { color: var(--fg); }
179
+ .trunk .fill { fill: currentColor; opacity: 0.055; }
180
+ .trunk path, .trunk line { fill: none; stroke: currentColor; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
181
+ .trunk .fill { stroke: none; }
182
+ .trunk .edge { stroke-width: 1.6; }
183
+ .trunk .late { stroke-width: 5; opacity: 0.16; }
184
+ .trunk .grain { stroke-width: 0.7; opacity: 0.42; }
185
+ .trunk .ray { stroke-width: 0.6; opacity: 0.16; }
186
+ .trunk .now { stroke: var(--accent); stroke-width: 2.2; }
187
+ .trunk .pith { fill: currentColor; }
188
+ .draw path, .draw line { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
189
+ .is-on .draw path, .is-on .draw line { animation: draw var(--t, 1.7s) var(--out) forwards; animation-delay: calc(0.3s + var(--lag, 0s) + var(--d, 0s)); }
190
+ @keyframes draw { to { stroke-dashoffset: 0; } }
191
+ .trunk .fill, .trunk .pith { opacity: 0; transition: opacity 1.6s var(--out); }
192
+ .is-on .trunk .fill { opacity: 0.055; transition-delay: calc(0.9s + var(--lag, 0s)); }
193
+ .is-on .trunk .pith { opacity: 1; transition-delay: calc(0.2s + var(--lag, 0s)); }
194
+
195
+ .cta {
196
+ align-self: flex-start;
197
+ display: inline-flex;
198
+ align-items: center;
199
+ gap: 3.2cqw;
200
+ padding: 2cqw 2cqw 2cqw 6cqw;
201
+ border: 0;
202
+ border-radius: 999px;
203
+ background: var(--fg);
204
+ color: var(--bg);
205
+ font: 700 4.6cqw var(--body);
206
+ cursor: pointer;
207
+ transition: transform 0.5s var(--spring);
208
+ }
209
+ .cta .knob {
210
+ display: grid;
211
+ place-items: center;
212
+ width: 10cqw;
213
+ height: 10cqw;
214
+ border-radius: 50%;
215
+ background: color-mix(in oklab, var(--bg) 14%, transparent);
216
+ transition: transform 0.5s var(--spring);
217
+ }
218
+ .cta .knob i { font-size: 5cqw; }
219
+ .cta:hover .knob { transform: translateX(0.8cqw) scale(1.06); }
220
+ .cta:active { transform: scale(0.97); }
221
+ .ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--fg) 35%, transparent); }
222
+ .ghost .knob { background: color-mix(in oklab, var(--fg) 10%, transparent); }
223
+ :focus-visible { outline: 2px solid var(--accent, var(--resin)); outline-offset: 3px; }
224
+
225
+ .cover .year { font-size: 47cqw; margin-top: 2cqw; }
226
+ .cover .year span { display: block; }
227
+ .cover .who { margin-bottom: 1cqw; }
228
+ .cover .trunk-wrap { position: absolute; width: 118cqw; right: -44cqw; bottom: -30cqw; opacity: 0.55; }
229
+ .cover .trunk-wrap svg { animation: turn 140s linear infinite; }
230
+ @keyframes turn { to { transform: rotate(1turn); } }
231
+ .cover .lede { font-family: var(--display); font-weight: 500; font-size: 8.5cqw; line-height: 1; letter-spacing: -0.02em; margin-bottom: 6cqw; max-width: 8ch; }
232
+
233
+ .hello .avatar { position: relative; width: 36cqw; aspect-ratio: 1; margin: 4cqw 0 10cqw 4cqw; }
234
+ .hello .avatar img, .hello .avatar .initial {
235
+ position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
236
+ box-shadow: 0 0 0 2cqw var(--bg), 0 0 0 2.3cqw color-mix(in oklab, var(--fg) 40%, transparent);
237
+ }
238
+ .hello .initial { display: grid; place-items: center; background: var(--accent); color: var(--ink); font: 600 18cqw var(--display); }
239
+ .ripple { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--fg) 50%, transparent); opacity: 0; }
240
+ .is-on .ripple { animation: ripple 3.6s var(--out) infinite; animation-delay: calc(var(--i) * 0.9s); }
241
+ @keyframes ripple { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2.6); opacity: 0; } }
242
+ .hello .headline { font-size: 15cqw; margin-bottom: 5cqw; }
243
+
244
+ .rings-slide .trunk-wrap { width: 92cqw; align-self: center; margin: 5cqw 0 4cqw; }
245
+ .ledger { display: flex; flex-wrap: wrap; gap: 1.6cqw 4cqw; }
246
+ .ledger span { display: flex; flex-direction: column; gap: 0.6cqw; }
247
+ .is-on .ledger span { animation: rise 0.8s var(--out) both; animation-delay: calc(0.6s + var(--d, 0s)); }
248
+ .ledger b { font: 600 5.2cqw var(--display); letter-spacing: -0.02em; }
249
+ .ledger .is-now b { color: var(--accent); }
250
+
251
+ .total .backring { position: absolute; width: 220cqw; left: -60cqw; top: calc(100cqh - 92cqw); opacity: 0.55; pointer-events: none; }
252
+ .total .count { font-size: 33cqw; margin: 2cqw 0 1cqw -1cqw; }
253
+ .total .unit { font: 600 9cqw var(--display); letter-spacing: -0.02em; }
254
+
255
+ .tree .name { font-size: 30cqw; margin: 1.5cqw 0 3cqw -1cqw; }
256
+ .ladder { display: grid; gap: 0.6cqw; margin-top: auto; }
257
+ .ladder li {
258
+ list-style: none;
259
+ display: flex;
260
+ justify-content: space-between;
261
+ align-items: baseline;
262
+ padding: 1.4cqw 3.4cqw;
263
+ border-radius: 999px;
264
+ font-size: 4cqw;
265
+ font-weight: 500;
266
+ }
267
+ .ladder li.above { opacity: 0.4; }
268
+ .ladder li.here { background: var(--fg); color: var(--bg); font-weight: 700; }
269
+ .ladder ul { padding: 0; display: grid; gap: 0.6cqw; }
270
+
271
+ .season .month { margin: 1.5cqw 0 3cqw -0.6cqw; }
272
+ .dial { width: 84cqw; align-self: center; margin-block: auto; }
273
+ .dial .spoke { stroke: var(--fg); stroke-width: 1.8; stroke-linecap: round; opacity: 0.34; vector-effect: non-scaling-stroke; }
274
+ .dial .spoke.peak { opacity: 1; stroke-width: 2.4; }
275
+ .dial .base { fill: none; stroke: var(--fg); opacity: 0.3; vector-effect: non-scaling-stroke; }
276
+ .dial text { fill: var(--fg); font: 500 30px var(--mono); text-anchor: middle; dominant-baseline: central; opacity: 0.7; }
277
+ .dial text.peak { opacity: 1; font-weight: 700; }
278
+
279
+ .shape .band-wrap { width: 88cqw; align-self: center; margin-block: auto; position: relative; }
280
+ .band .early { fill: var(--fg); opacity: 0.28; }
281
+ .band .late { fill: var(--accent); }
282
+ .band .arc { fill: none; stroke: var(--bg); stroke-width: 1; opacity: 0.35; vector-effect: non-scaling-stroke; }
283
+ .band text.pct { font: 600 56px var(--display); }
284
+ .band .split { stroke: var(--fg); stroke-dasharray: 6 8; opacity: 0.6; vector-effect: non-scaling-stroke; }
285
+ .band text { fill: var(--fg); font: 500 30px var(--mono); text-anchor: middle; }
286
+ .band g.grow { transform-origin: 0 0; transform: scale(0); opacity: 0; }
287
+ .is-on .band g.grow { animation: grow 1.6s var(--spring) 0.5s forwards; }
288
+ @keyframes grow { to { transform: none; opacity: 1; } }
289
+
290
+ .dots { width: 86cqw; align-self: center; margin-block: auto; }
291
+ .dots circle { fill: var(--fg); transform-box: fill-box; transform-origin: center; opacity: 0; }
292
+ .dots circle.off { opacity: 0; }
293
+ .is-on .dots circle { animation: pop 0.5s var(--spring) forwards; animation-delay: calc(0.5s + var(--lag, 0s) + var(--d)); }
294
+ .is-on .dots circle.off { animation-name: pop-off; }
295
+ .dots circle.run { fill: var(--accent); }
296
+ @keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: none; opacity: 1; } }
297
+ @keyframes pop-off { from { opacity: 0; } to { opacity: 0.22; } }
298
+ .dots text { fill: var(--fg); font: 500 30px var(--mono); text-anchor: middle; dominant-baseline: central; opacity: 0; transition: opacity 1.2s var(--out) calc(1.4s + var(--lag, 0s)); }
299
+ .is-on .dots text { opacity: 0.6; }
300
+
301
+ .week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2.4cqw; align-items: end; height: 62cqw; margin-top: auto; }
302
+ .week .col { display: flex; flex-direction: column; align-items: center; gap: 1.6cqw; height: 100%; justify-content: flex-end; }
303
+ .week .col b { width: 100%; border-radius: 4px 4px 0 0; background: var(--fg); opacity: 0.3; transform: scaleY(0); transform-origin: bottom; }
304
+ .week .col.best b { opacity: 1; }
305
+ .week .col small { font: 500 3cqw var(--mono); }
306
+ .week .col em { font: 600 3.8cqw var(--display); font-style: normal; opacity: 0; }
307
+ .week .col.best em { opacity: 1; }
308
+ .is-on .week .col b { animation: bar 1.2s var(--spring) forwards; animation-delay: calc(0.6s + var(--lag, 0s) + var(--i) * 0.08s); }
309
+ @keyframes bar { to { transform: scaleY(1); } }
310
+
311
+ .layers { display: grid; gap: 4.2cqw; margin-top: 7cqw; }
312
+ .layer { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 1.6cqw; }
313
+ .layer span { font-size: 4.4cqw; font-weight: 500; }
314
+ .layer b { font: 600 9cqw var(--display); letter-spacing: -0.03em; }
315
+ .layer i { grid-column: 1 / -1; height: 1.8cqw; border-radius: 0 4px 4px 0; background: var(--fg); width: var(--w); transform: scaleX(0); transform-origin: left; }
316
+ .is-on .layer i { animation: bar-x 1.3s var(--out) forwards; animation-delay: calc(0.55s + var(--i) * 0.12s); }
317
+ @keyframes bar-x { to { transform: scaleX(1); } }
318
+ .made .sum { margin-top: auto; padding-top: 6cqw; }
319
+ .made .private { margin-top: 3cqw; font-size: 3.9cqw; line-height: 1.4; display: flex; gap: 2.4cqw; align-items: flex-start; }
320
+ .made .private i { font-size: 5cqw; flex: none; }
321
+
322
+ .donut-wrap { position: relative; width: 70cqw; align-self: center; margin-block: auto; padding-block: 5cqw; }
323
+ .donut circle { fill: none; stroke-width: 92; transition: stroke-dasharray 1.4s var(--out); }
324
+ .donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
325
+ .donut-center b { font: 600 13cqw var(--display); letter-spacing: -0.03em; }
326
+ .legend { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4cqw 5cqw; padding: 0; }
327
+ .legend li { list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 2cqw; align-items: center; font-size: 3.9cqw; font-weight: 500; }
328
+ .legend li u { width: 3cqw; height: 3cqw; border-radius: 50%; background: var(--c); text-decoration: none; }
329
+
330
+ .finale { padding-bottom: 7cqw; }
331
+ .card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3cqw; }
332
+ .card-top .mono { opacity: 0.6; }
333
+ .studio { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 3.4cqw; }
334
+ .card-stage { flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; touch-action: pan-y; }
335
+ .card-stage svg { --ar: 0.5625; aspect-ratio: var(--ar); height: min(100cqh, 100cqw / var(--ar)); width: auto; border-radius: 14px; box-shadow: 0 0 0 1px color-mix(in oklab, var(--fg) 12%, transparent), 0 24px 60px -24px rgb(0 0 0 / 0.7); animation: swap 0.7s var(--spring); }
336
+ .card-stage svg[data-card="wide"] { --ar: 1.7778; }
337
+ @keyframes swap { from { opacity: 0; transform: translateY(12px) scale(0.95); } }
338
+ .styles { align-self: center; display: flex; gap: 0.8cqw; padding: 0.9cqw; border-radius: 999px; background: color-mix(in oklab, var(--fg) 8%, transparent); }
339
+ .styles button { border: 0; border-radius: 999px; padding: 1.8cqw 3.6cqw; background: transparent; color: inherit; font: 500 3.4cqw var(--body); cursor: pointer; transition: background-color 0.35s var(--out), color 0.35s var(--out); }
340
+ .styles button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
341
+ .swatches { display: flex; gap: 3cqw; justify-content: center; }
342
+ .swatches button { width: 7cqw; height: 7cqw; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: linear-gradient(135deg, var(--c) 50%, var(--d) 50%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); transition: transform 0.4s var(--spring), box-shadow 0.3s var(--out); }
343
+ .swatches button[aria-checked="true"] { transform: scale(1.08); box-shadow: 0 0 0 0.7cqw var(--bg), 0 0 0 1.1cqw var(--fg); }
344
+ .actions { display: flex; gap: 2cqw; margin-top: auto; padding-top: 4cqw; position: relative; z-index: 5; }
345
+ .actions .cta { font-size: 3.9cqw; gap: 2.4cqw; padding-left: 4.4cqw; }
346
+ .actions .cta .knob { width: 9cqw; height: 9cqw; }
347
+ .sheet { position: absolute; inset: 0; z-index: 8; display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; background: rgb(5 8 6 / 0.55); backdrop-filter: blur(6px); animation: fade 0.3s var(--out); }
348
+ .sheet[hidden] { display: none; }
349
+ .sheet-card { margin: 3cqw; padding: 6cqw; border-radius: 6cqw; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3cqw; background: var(--bone); color: var(--ink); animation: sheet 0.6s var(--spring); }
350
+ @keyframes sheet { from { transform: translateY(105%); } }
351
+ @keyframes fade { from { opacity: 0; } }
352
+ .sheet-head { display: flex; justify-content: space-between; align-items: center; }
353
+ .sheet h3 { font: 600 8cqw var(--display); letter-spacing: -0.03em; }
354
+ .sheet .x { width: 9cqw; height: 9cqw; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgb(15 23 18 / 0.08); color: inherit; cursor: pointer; }
355
+ .sheet .x i { font-size: 4.6cqw; }
356
+ .sheet-row { display: flex; gap: 2.4cqw; }
357
+ .pill { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 2cqw; padding: 3.2cqw; border: 0; border-radius: 999px; background: var(--ink); color: var(--bone); font: 700 3.8cqw var(--body); white-space: nowrap; cursor: pointer; transition: transform 0.4s var(--spring); }
358
+ .pill[hidden] { display: none; }
359
+ .pill.soft { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px rgb(15 23 18 / 0.3); }
360
+ .pill:active { transform: scale(0.97); }
361
+ .pill i { font-size: 4.6cqw; }
362
+ .sheet p { font-size: 3.5cqw; line-height: 1.4; }
363
+ .sheet p.note { opacity: 0.7; }
364
+ .sheet .label { padding-top: 3cqw; border-top: 1px solid rgb(15 23 18 / 0.14); font: 500 2.8cqw var(--mono); letter-spacing: 0.08em; opacity: 0.6; }
365
+ .code { display: flex; align-items: center; gap: 2cqw; padding: 1.4cqw 1.4cqw 1.4cqw 3.4cqw; border-radius: 3cqw; background: rgb(15 23 18 / 0.07); }
366
+ .code code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 2.9cqw var(--mono); user-select: text; -webkit-user-select: text; }
367
+ .code button { border: 0; border-radius: 2cqw; padding: 2cqw 3.2cqw; background: var(--ink); color: var(--resin); font: 700 3.2cqw var(--body); cursor: pointer; }
368
+
369
+ .seal { position: absolute; left: 0; top: 0; width: 17cqw; aspect-ratio: 1; z-index: 3; pointer-events: none; transform: translate(calc(var(--sx, 50) * 1cqw - 50%), calc(var(--sy, 50) * 1cqh - 50%)) rotate(var(--sr, 0deg)) scale(var(--ss, 0)); transition: transform 1.3s var(--spring), color 0.8s var(--out); }
370
+ .seal svg { display: block; width: 100%; height: 100%; overflow: visible; animation: turn 36s linear infinite; }
371
+ .seal text { font: 500 8.6px var(--mono); fill: currentColor; }
372
+ .seal path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
373
+ .seal circle { fill: currentColor; }
374
+
375
+ .nav { position: fixed; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 0; color: var(--bone); background: rgb(255 255 255 / 0.05); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12); display: grid; place-items: center; cursor: pointer; transition: transform 0.4s var(--spring), opacity 0.3s; z-index: 30; }
376
+ .nav i { font-size: 22px; }
377
+ .nav:hover { transform: translateY(-50%) scale(1.06); }
378
+ .nav:disabled { opacity: 0.25; cursor: default; }
379
+ .nav.prev { left: calc(50% - (min(100dvh - 40px, 940px) * 9 / 32) - 84px); }
380
+ .nav.next { right: calc(50% - (min(100dvh - 40px, 940px) * 9 / 32) - 84px); }
381
+ .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
382
+
383
+ @media (max-width: 600px), (max-aspect-ratio: 10/16) {
384
+ .shell { height: 100dvh; width: 100vw; aspect-ratio: auto; padding: 0; border-radius: 0; box-shadow: none; }
385
+ .story { border-radius: 0; }
386
+ .nav { display: none; }
387
+ }
388
+ @media (prefers-reduced-motion: reduce) {
389
+ .is-on .rise, .is-on .ledger span, .is-on .draw path, .is-on .draw line, .is-on .dots circle, .is-on .week .col b, .is-on .layer i, .is-on .band g.grow { animation-duration: 1ms; animation-delay: 0s; }
390
+ .slide.is-entering { animation: none; }
391
+ .teased { --lag: 0s; }
392
+ .tease { display: none; }
393
+ .cover .trunk-wrap svg, .is-on .ripple, .card-stage svg, .sheet, .sheet-card, .seal svg { animation: none; }
394
+ .seal { transition: none; }
395
+ }
396
+ </style>
397
+ </head>
398
+ <body>
399
+ <div class="backdrop" aria-hidden="true"></div>
400
+ <div class="shell">
401
+ <main class="story" id="story" aria-roledescription="carousel" aria-label="Your year on GitHub, as tree rings">
402
+ <div class="bars" aria-hidden="true"></div>
403
+ <header class="top">
404
+ <span class="mark"><svg viewBox="-10 -10 20 20" aria-hidden="true"><circle r="8.6" fill="none" stroke="currentColor" stroke-width="1.6"/><circle r="5.2" fill="none" stroke="currentColor" stroke-width="1.6"/><circle r="1.9" fill="currentColor"/></svg>gitrings</span>
405
+ <button class="chrome-btn sound" type="button"><span class="eq" aria-hidden="true"><b></b><b></b><b></b></span><span class="label">Sound off</span></button>
406
+ </header>
407
+ <div class="slides"></div>
408
+ <p class="sr" aria-live="polite" id="announce"></p>
409
+ <div class="sheet" hidden>
410
+ <div class="sheet-card" role="dialog" aria-modal="true" aria-labelledby="sheet-title">
411
+ <div class="sheet-head"><h3 id="sheet-title">Share your rings</h3><button class="x" type="button" data-close aria-label="Close"><i class="ph-light ph-x"></i></button></div>
412
+ <div class="sheet-row">
413
+ <button class="pill" type="button" data-out="save"><i class="ph-light ph-download-simple"></i><span>Save</span></button>
414
+ <button class="pill soft" type="button" data-out="copy"><i class="ph-light ph-copy"></i><span>Copy</span></button>
415
+ <button class="pill soft" type="button" data-out="share" hidden><i class="ph-light ph-share-network"></i><span>Share</span></button>
416
+ </div>
417
+ <p class="label">ADD TO YOUR GITHUB README</p>
418
+ <p>Save this workflow in your profile repository. Every day it redraws your card on a gitrings branch; the second line puts it in your README, dark or light to match the reader.</p>
419
+ <div class="code"><code data-copy="name: gitrings
420
+ on:
421
+ schedule:
422
+ - cron: '17 4 * * *'
423
+ workflow_dispatch:
424
+ permissions:
425
+ contents: write
426
+ jobs:
427
+ rings:
428
+ runs-on: ubuntu-latest
429
+ steps:
430
+ - uses: cengizhandemiir/gitrings@main
431
+ with:
432
+ token: ${{ secrets.GITRINGS_TOKEN }}
433
+ ">.github/workflows/gitrings.yml</code><button type="button" data-copy-text>Copy</button></div>
434
+ <div class="code"><code data-md></code><button type="button" data-copy-text>Copy</button></div>
435
+ <p class="note">Private work counts too when your profile shows private contributions. With that setting off, save a classic token with repo and read:user as the GITRINGS_TOKEN secret.</p>
436
+ </div>
437
+ </div>
438
+ </main>
439
+ </div>
440
+ <button class="nav prev" type="button" aria-label="Previous slide"><i class="ph-light ph-arrow-left"></i></button>
441
+ <button class="nav next" type="button" aria-label="Next slide"><i class="ph-light ph-arrow-right"></i></button>
442
+
443
+ <script id="gitrings-data" type="application/json">__GITRINGS__</script>
444
+ <script>
445
+ (() => {
446
+ const D = JSON.parse(document.getElementById("gitrings-data").textContent);
447
+ const TAU = Math.PI * 2;
448
+ const MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
449
+ const DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
450
+ const TONES = { night: "#0C1410", moss: "#1D4A34", resin: "#FFB23E", ember: "#F2552C", bone: "#E8ECE1" };
451
+ const TREES = [["Sequoia", 9000], ["Redwood", 4000], ["Cedar", 2000], ["Oak", 1000], ["Birch", 500], ["Sapling", 200], ["Sprout", 50], ["Seed", 0]];
452
+ const calm = matchMedia("(prefers-reduced-motion: reduce)").matches;
453
+ const fmt = (n) => Math.round(n).toLocaleString("en-US");
454
+ const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
455
+ const short = (iso) => { const [y, m, d] = iso.split("-").map(Number); return `${MONTHS[m - 1].slice(0, 3)} ${d}`; };
456
+ const article = (word) => (/^[AEIOU]/.test(word) ? "an" : "a");
457
+ const first = esc(D.name.split(" ")[0]);
458
+ const Y = D.year;
459
+ const last = D.rings[D.rings.length - 1];
460
+ const peak = D.months.indexOf(Math.max(...D.months));
461
+
462
+ function seeded(text) {
463
+ let h = 1779033703 ^ text.length;
464
+ for (const ch of text) { h = Math.imul(h ^ ch.charCodeAt(0), 3432918353); h = (h << 13) | (h >>> 19); }
465
+ return () => { h = Math.imul(h ^ (h >>> 16), 2246822507); h = Math.imul(h ^ (h >>> 13), 3266489909); return ((h ^= h >>> 16) >>> 0) / 4294967296; };
466
+ }
467
+
468
+ function smooth(points) {
469
+ const n = points.length;
470
+ const p = (i) => points[(i + n) % n];
471
+ const f = (v) => v.toFixed(1);
472
+ let d = `M${f(p(0)[0])},${f(p(0)[1])}`;
473
+ for (let i = 0; i < n; i++) {
474
+ const [a, b, c, e] = [p(i - 1), p(i), p(i + 1), p(i + 2)];
475
+ d += `C${f(b[0] + (c[0] - a[0]) / 6)},${f(b[1] + (c[1] - a[1]) / 6)} ${f(c[0] - (e[0] - b[0]) / 6)},${f(c[1] - (e[1] - b[1]) / 6)} ${f(c[0])},${f(c[1])}`;
476
+ }
477
+ return d + "Z";
478
+ }
479
+
480
+ const N = last.edge.length;
481
+ const PITH = 0.05;
482
+ const polar = (r, i, R) => { const a = (i / N) * TAU; return [r * R * Math.sin(a), -r * R * Math.cos(a)]; };
483
+ const loop = (radii, R) => smooth(radii.map((r, i) => polar(r, i, R)));
484
+
485
+ function trunk({ R = 470, grain = true, rays = true, stagger = 0.32, label = true } = {}) {
486
+ const rand = seeded(D.login);
487
+ let prev = Array(N).fill(PITH);
488
+ const fills = [];
489
+ const lines = [];
490
+ D.rings.forEach((ring, k) => {
491
+ const width = (ring.edge.reduce((s, x, i) => s + x - prev[i], 0) / N) * R;
492
+ const count = grain ? Math.min(12, Math.round(width / 15)) : 0;
493
+ const start = k * stagger;
494
+ for (let g = 1; g <= count; g++) {
495
+ const t = g / (count + 1);
496
+ lines.push(`<path class="grain" pathLength="1" style="--d:${(start + t * 0.25).toFixed(2)}s" d="${loop(prev.map((p, i) => p + (ring.edge[i] - p) * t), R)}"/>`);
497
+ }
498
+ const edge = loop(ring.edge, R);
499
+ fills.unshift(`<path class="fill" d="${edge}"/>`);
500
+ lines.push(`<path class="late" pathLength="1" style="--d:${(start + 0.2).toFixed(2)}s" d="${edge}"/>`);
501
+ lines.push(`<path class="edge${k === D.rings.length - 1 ? " now" : ""}" pathLength="1" style="--d:${(start + 0.2).toFixed(2)}s" d="${edge}"><title>${ring.year}: ${fmt(ring.total)} contributions</title></path>`);
502
+ prev = ring.edge;
503
+ });
504
+ if (rays) {
505
+ for (let j = 0; j < 26; j++) {
506
+ const i = Math.floor(rand() * N);
507
+ const a = (i / N) * TAU;
508
+ const r0 = (PITH + 0.03 + rand() * 0.25) * R;
509
+ const r1 = last.edge[i] * R * (0.55 + rand() * 0.4);
510
+ if (r1 <= r0) continue;
511
+ lines.push(`<line class="ray" pathLength="1" style="--d:${(0.4 + rand() * 0.8).toFixed(2)}s;--t:2.4s" x1="${(r0 * Math.sin(a)).toFixed(1)}" y1="${(-r0 * Math.cos(a)).toFixed(1)}" x2="${(r1 * Math.sin(a)).toFixed(1)}" y2="${(-r1 * Math.cos(a)).toFixed(1)}"/>`);
512
+ }
513
+ }
514
+ const summary = D.rings.map((r) => `${r.year}: ${fmt(r.total)}`).join(", ");
515
+ return `<svg class="chart trunk" viewBox="-500 -500 1000 1000" ${label ? `role="img" aria-label="Tree rings, one per year from the center out. ${summary}."` : 'aria-hidden="true"'}>${fills.join("")}<g class="draw">${lines.join("")}</g><circle class="pith" r="${(PITH * R).toFixed(1)}"/></svg>`;
516
+ }
517
+
518
+ function dial() {
519
+ const days = D.days;
520
+ const length = last.year % 4 === 0 && (last.year % 100 !== 0 || last.year % 400 === 0) ? 366 : 365;
521
+ const max = Math.max(1, ...days);
522
+ const r0 = 250;
523
+ let starts = [];
524
+ let cursor = new Date(Date.UTC(Y, 0, 1));
525
+ let spokes = "";
526
+ for (let i = 0; i < length; i++) {
527
+ const month = cursor.getUTCMonth();
528
+ if (cursor.getUTCDate() === 1) starts.push(i);
529
+ cursor = new Date(cursor.getTime() + 86400000);
530
+ const v = days[i] || 0;
531
+ if (!v) continue;
532
+ const a = (i / length) * TAU;
533
+ const r1 = r0 + 8 + (205 * v) / max;
534
+ spokes += `<line class="spoke${month === peak ? " peak" : ""}" pathLength="1" style="--d:${(i * 0.004).toFixed(3)}s;--t:0.9s" x1="${(r0 * Math.sin(a)).toFixed(1)}" y1="${(-r0 * Math.cos(a)).toFixed(1)}" x2="${(r1 * Math.sin(a)).toFixed(1)}" y2="${(-r1 * Math.cos(a)).toFixed(1)}"/>`;
535
+ }
536
+ const labels = starts.map((s, m) => {
537
+ const a = ((s + 15) / length) * TAU;
538
+ return `<text class="${m === peak ? "peak" : ""}" x="${(196 * Math.sin(a)).toFixed(1)}" y="${(-196 * Math.cos(a)).toFixed(1)}">${MONTHS[m][0]}</text>`;
539
+ }).join("");
540
+ return `<svg class="chart dial" viewBox="-480 -480 960 960" role="img" aria-label="Daily contributions around the year, January at the top, clockwise. ${MONTHS[peak]} was the busiest month."><circle class="base" r="${r0}"/><g class="draw">${spokes}</g>${labels}</svg>`;
541
+ }
542
+
543
+ function band() {
544
+ const shares = [1 - D.late, D.late];
545
+ const top = Math.max(...shares) || 1;
546
+ const R = 410;
547
+ const pieces = shares.map((share, k) => {
548
+ const r = R * Math.sqrt(share / top);
549
+ const side = k === 0 ? 1 : 0;
550
+ const arc = (rr) => `M0,${(-rr).toFixed(1)}A${rr.toFixed(1)},${rr.toFixed(1)} 0 0 ${side} 0,${rr.toFixed(1)}`;
551
+ const grain = Array.from({ length: Math.max(0, Math.round(r / 34) - 1) }, (_, g) => `<path class="arc" d="${arc((r * (g + 1)) / Math.round(r / 34))}"/>`).join("");
552
+ const cls = share === top ? "late" : "early";
553
+ return r < 2 ? "" : `<path class="${cls}" d="${arc(r)}Z"/>${grain}`;
554
+ });
555
+ const pct = (v) => (v > 0 && v < 0.01 ? "<1" : v > 0.99 && v < 1 ? "99" : Math.round(v * 100));
556
+ return `<svg class="chart band" viewBox="-500 -500 1000 1000" role="img" aria-label="${Y} growth by half year: ${pct(shares[0])} percent January to June, ${pct(shares[1])} percent July to December."><g class="grow">${pieces.join("")}</g><line class="split" x1="0" y1="-470" x2="0" y2="470"/><text x="-250" y="-440">Jul to Dec</text><text x="250" y="-440">Jan to Jun</text><text class="pct" x="-250" y="480">${pct(shares[1])}%</text><text class="pct" x="250" y="480">${pct(shares[0])}%</text></svg>`;
557
+ }
558
+
559
+ function dots() {
560
+ const length = D.days.length > 365 ? 366 : 365;
561
+ const runStart = (Date.UTC(...D.streak.start.split("-").map((v, i) => (i === 1 ? v - 1 : +v))) - Date.UTC(Y, 0, 1)) / 86400000;
562
+ let out = "";
563
+ for (let i = 0; i < length; i++) {
564
+ const a = (i / length) * TAU - Math.PI / 2;
565
+ const v = D.days[i] || 0;
566
+ const run = D.streak.days >= 2 && i >= runStart && i < runStart + D.streak.days;
567
+ const r = v ? 6.4 : 3.2;
568
+ out += `<circle class="${v ? (run ? "run" : "on") : "off"}" style="--d:${(i * 0.005).toFixed(3)}s" cx="${(410 * Math.cos(a)).toFixed(1)}" cy="${(410 * Math.sin(a)).toFixed(1)}" r="${r}"/>`;
569
+ }
570
+ MONTHS.forEach((m, k) => {
571
+ const a = ((Date.UTC(Y, k, 15) - Date.UTC(Y, 0, 1)) / 86400000 / length) * TAU - Math.PI / 2;
572
+ out += `<text x="${(350 * Math.cos(a)).toFixed(1)}" y="${(350 * Math.sin(a)).toFixed(1)}">${m[0]}</text>`;
573
+ });
574
+ return `<svg class="chart dots" viewBox="-460 -460 920 920" role="img" aria-label="Every day of ${Y} as a dot around a circle, January at the top. ${D.activeDays} days had contributions.">${out}</svg>`;
575
+ }
576
+
577
+ function donut(rows, total) {
578
+ let start = 0;
579
+ const circles = rows.map((row) => {
580
+ const pct = (row.commits / total) * 100;
581
+ const gap = rows.length > 1 ? 0.7 : 0;
582
+ const el = `<circle r="290" stroke="${row.color}" pathLength="100" stroke-dasharray="0 100" data-dash="${Math.max(0.2, pct - gap).toFixed(2)} ${(100 - pct + gap).toFixed(2)}" stroke-dashoffset="${(-start).toFixed(2)}" transform="rotate(-90)"/>`;
583
+ start += pct;
584
+ return el;
585
+ });
586
+ return `<svg class="chart donut" viewBox="-400 -400 800 800" aria-hidden="true">${circles.join("")}</svg>`;
587
+ }
588
+
589
+ const languages = (() => {
590
+ const commits = Math.max(D.kinds.commits || 0, D.languages.reduce((s, l) => s + l.commits, 0));
591
+ const top = D.languages.slice(0, 5);
592
+ const rest = commits - top.reduce((s, l) => s + l.commits, 0);
593
+ const rows = rest > 0 ? [...top, { name: "Other", color: "#8C958E", commits: rest }] : top;
594
+ return { commits, rows };
595
+ })();
596
+
597
+ const kinds = [
598
+ ["Commits", D.kinds.commits],
599
+ ["Pull requests", D.kinds.pullRequests],
600
+ ["Reviews", D.kinds.reviews],
601
+ ["Issues", D.kinds.issues],
602
+ ["New repositories", D.kinds.repositories],
603
+ ["Private, totals only", D.kinds.restricted],
604
+ ].filter(([, v]) => v > 0);
605
+ const kindSum = kinds.reduce((s, [, v]) => s + v, 0);
606
+ const tree = TREES.find(([, floor]) => D.total >= floor);
607
+ const treeIndex = TREES.indexOf(tree);
608
+ const best = D.weekdays.indexOf(Math.max(...D.weekdays));
609
+ const quiet = D.weekdays.indexOf(Math.min(...D.weekdays));
610
+ const PERSONAS = {
611
+ late: ["Late bloomer.", `<strong>${Math.floor(D.late * 100)}%</strong> of your ${Y} growth came after June.`],
612
+ early: ["Early bloomer.", `<strong>${Math.floor((1 - D.late) * 100)}%</strong> of your ${Y} growth came before July.`],
613
+ evergreen: ["Evergreen.", `You grew in <strong>${D.activeWeeks} of ${D.weeks}</strong> weeks this year.`],
614
+ steady: ["Steady grower.", `Your growth split close to evenly: <strong>${Math.round(D.late * 100)}%</strong> of it came after June.`],
615
+ dormant: ["Dormant.", "A quiet ring. Every tree has those years."],
616
+ };
617
+ const longRun = D.streak.days >= 14;
618
+
619
+ const INK = { night: [TONES.bone, TONES.resin], moss: [TONES.bone, TONES.resin], resin: ["#0F1712", "#0F1712"], ember: ["#0F1712", TONES.bone], bone: ["#0F1712", TONES.ember] };
620
+ const PALETTES = [["Night", "night", "resin", "moss"], ["Moss", "moss", "resin", "night"], ["Resin", "resin", "night", "ember"], ["Ember", "ember", "night", "bone"], ["Bone", "bone", "ember", "moss"]];
621
+ const STYLES = [["trunk", "Trunk"], ["bento", "Bento"], ["headline", "Headline"], ["wide", "Wide"]];
622
+ const FONT = { d: "Clash Display, sans-serif", b: "Satoshi, sans-serif", m: "JetBrains Mono, monospace" };
623
+ const gauge = document.createElement("canvas").getContext("2d");
624
+ const T = (x, y, size, body, { f = "b", w = 500, o, a, c, ls } = {}) => `<text x="${x}" y="${y}" font-size="${size}" font-family="${FONT[f]}" font-weight="${w}"${o ? ` opacity="${o}"` : ""}${a ? ` text-anchor="${a}"` : ""}${c ? ` fill="${c}"` : ""}${ls ? ` letter-spacing="${ls}"` : ""}>${body}</text>`;
625
+ const big = (x, y, max, size, body, more) => {
626
+ gauge.font = `600 ${size}px "Clash Display"`;
627
+ const s = Math.min(size, Math.floor((size * max) / gauge.measureText(body).width));
628
+ return T(x, y, s, esc(body), { f: "d", w: 600, ls: (-0.025 * s).toFixed(1), ...more });
629
+ };
630
+ const mark = (x, y, c) => `<g transform="translate(${x} ${y})" fill="none" stroke="${c}" stroke-width="3"><circle r="18"/><circle r="11"/><circle r="4" fill="${c}" stroke="none"/></g>`;
631
+ const glow = (p, cx, cy, r, c = p.ac === p.fg ? TONES.bone : p.ac) => `<defs><radialGradient id="glow"><stop offset="0" stop-color="${c}" stop-opacity="0.16"/><stop offset="1" stop-color="${c}" stop-opacity="0"/></radialGradient></defs><circle cx="${cx}" cy="${cy}" r="${r}" fill="url(#glow)"/>`;
632
+ const facts = [["Ring size", tree[0]], ["Contributions", fmt(D.total)], ["Busiest month", MONTHS[peak]], ["Shape", PERSONAS[D.persona][0].replace(".", "")]];
633
+ const run = `${D.streak.days} ${D.streak.days === 1 ? "day" : "days"}`;
634
+
635
+ function rings(R, p) {
636
+ let prev = Array(N).fill(PITH), fills = "", lines = "";
637
+ D.rings.forEach((ring, k) => {
638
+ const count = Math.min(12, Math.round(((ring.edge.reduce((s, x, i) => s + x - prev[i], 0) / N) * R) / 15));
639
+ for (let g = 1; g <= count; g++) lines += `<path d="${loop(prev.map((q, i) => q + (ring.edge[i] - q) * (g / (count + 1))), R)}" stroke-width="${(R / 320).toFixed(2)}" stroke-opacity="0.42"/>`;
640
+ const d = loop(ring.edge, R);
641
+ const now = k === D.rings.length - 1;
642
+ fills = `<path d="${d}"/>${fills}`;
643
+ lines += `<path d="${d}" stroke-width="${(R / 44).toFixed(1)}" stroke-opacity="0.14"/><path d="${d}" stroke-width="${(R / (now ? 90 : 130)).toFixed(2)}"${now ? ` stroke="${p.ac}"` : ""}/>`;
644
+ prev = ring.edge;
645
+ });
646
+ return `<g fill="${p.fg}" fill-opacity="0.055">${fills}</g><g fill="none" stroke="${p.fg}" stroke-linejoin="round">${lines}</g><circle r="${(PITH * R).toFixed(1)}" fill="${p.fg}"/>`;
647
+ }
648
+
649
+ const CARDS = {
650
+ trunk: (p) => `${glow(p, 540, 880, 760)}
651
+ ${T(90, 150, 34, `@${esc(D.login)}`, { f: "m", o: 0.7 })}${T(990, 150, 34, `${D.rings.length} rings`, { f: "m", o: 0.7, a: "end" })}
652
+ ${big(84, 316, 912, 132, `${Y} in rings`)}
653
+ <g transform="translate(540 880)">${rings(420, p)}</g>
654
+ <rect x="90" y="1390" width="900" height="2" fill="${p.fg}" fill-opacity="0.18"/>
655
+ ${facts.map(([k, v], i) => { const x = 90 + (i % 2) * 460, y = 1480 + Math.floor(i / 2) * 190; return T(x, y, 34, k, { o: 0.66 }) + big(x, y + 86, 420, 76, v); }).join("")}
656
+ ${mark(108, 1836, p.fg)}${T(140, 1846, 30, "gitrings", { f: "d", w: 600 })}${T(990, 1846, 28, "one ring per year", { f: "m", o: 0.5, a: "end" })}`,
657
+ bento: (p, avatar) => {
658
+ const [hot, hotInk] = p.hot, [cool, coolInk] = p.cool;
659
+ const tile = (x, y, w, h, fill, o) => `<rect x="${x}" y="${y}" width="${w}" height="${h}" rx="40" fill="${fill}"${o ? ` fill-opacity="${o}"` : ""}/>`;
660
+ const top = Math.max(1, ...D.months);
661
+ const versus = D.previous ? `${D.total >= D.previous ? "Up" : "Down"} from ${fmt(D.previous)} in ${Y - 1}` : "Your first growing year";
662
+ const pct = (v) => { const n = (v / languages.commits) * 100; return n > 0 && n < 1 ? "<1" : Math.round(n); };
663
+ let x = 96;
664
+ const langs = languages.rows.length
665
+ ? T(96, 1712, 28, "Languages", { o: 0.66 }) + languages.rows.map((l) => { const w = (l.commits / languages.commits) * 888; const r = `<rect x="${x.toFixed(1)}" y="1738" width="${Math.max(1, w - 6).toFixed(1)}" height="28" rx="6" fill="${esc(l.color)}" stroke="${p.fg}" stroke-opacity="0.3" stroke-width="2"/>`; x += w; return r; }).join("")
666
+ + languages.rows.slice(0, 3).map((l, i) => `<circle cx="${106 + i * 296}" cy="1812" r="10" fill="${esc(l.color)}" stroke="${p.fg}" stroke-opacity="0.3" stroke-width="2"/>${T(126 + i * 296, 1822, 28, `${esc(l.name)} ${pct(l.commits)}%`)}`).join("")
667
+ : T(96, 1712, 28, "Active days", { o: 0.66 }) + big(96, 1812, 860, 72, `${fmt(D.activeDays)} days with growth`);
668
+ return `<clipPath id="av"><circle cx="120" cy="128" r="56"/></clipPath>
669
+ <circle cx="120" cy="128" r="63" fill="none" stroke="${p.fg}" stroke-opacity="0.3" stroke-width="2"/>
670
+ ${avatar ? `<image href="${esc(avatar)}" x="64" y="72" width="112" height="112" clip-path="url(#av)" preserveAspectRatio="xMidYMid slice"/>` : `<circle cx="120" cy="128" r="56" fill="${p.ac}"/>${T(120, 150, 60, first[0] || "@", { f: "d", w: 600, a: "middle", c: p.bg })}`}
671
+ ${T(200, 120, 44, esc(D.name || D.login), { w: 700 })}${T(200, 166, 28, `@${esc(D.login)}`, { f: "m", o: 0.6 })}
672
+ ${T(970, 138, 30, "gitrings", { f: "d", w: 600, a: "end" })}${mark(1002, 128, p.fg)}
673
+ ${big(56, 316, 968, 140, `${Y} in rings`)}
674
+ ${tile(60, 370, 960, 540, hot)}
675
+ ${T(108, 440, 34, "Contributions", { c: hotInk, o: 0.7 })}${big(100, 630, 860, 200, fmt(D.total), { c: hotInk })}${T(108, 696, 34, versus, { c: hotInk, o: 0.8 })}
676
+ ${D.months.map((v, m) => { const h = Math.max(4, (v / top) * 110); const bx = 108 + m * 73; return `<rect x="${bx}" y="${(850 - h).toFixed(1)}" width="61" height="${h.toFixed(1)}" rx="8" fill="${hotInk}" fill-opacity="${m === peak ? 1 : 0.3}"/>${T(bx + 30.5, 886, 22, MONTHS[m][0], { f: "m", a: "middle", c: hotInk, o: 0.7 })}`; }).join("")}
677
+ ${tile(60, 934, 468, 440, p.fg, 0.07)}<g transform="translate(294 1130)">${rings(165, p)}</g>${T(96, 1344, 26, `${D.rings.length} rings since ${D.joined}`, { f: "m", o: 0.6 })}
678
+ ${tile(552, 934, 468, 208, cool)}${T(592, 994, 32, "Ring size", { c: coolInk, o: 0.7 })}${big(588, 1100, 390, 84, tree[0], { c: coolInk })}
679
+ ${tile(552, 1166, 468, 208, p.fg, 0.07)}${T(592, 1226, 32, "Shape", { o: 0.66 })}${big(588, 1332, 390, 64, facts[3][1])}
680
+ ${[["Longest run", run], ["Busiest month", MONTHS[peak]], ["Best weekday", DAYS[best]]].map(([k, v], i) => tile(60 + i * 328, 1398, 304, 230, p.fg, 0.07) + T(96 + i * 328, 1462, 28, k, { o: 0.66 }) + big(96 + i * 328, 1570, 236, 64, v)).join("")}
681
+ ${tile(60, 1652, 960, 208, p.fg, 0.07)}${langs}`;
682
+ },
683
+ headline: (p) => {
684
+ const lang = languages.rows[0];
685
+ const list = [["Busiest month", MONTHS[peak]], ["Longest run", run], lang ? ["Mostly", lang.name] : ["Active days", fmt(D.activeDays)]];
686
+ return `<g transform="translate(920 1660)">${rings(420, p)}</g>
687
+ ${T(90, 150, 34, `@${esc(D.login)}`, { f: "m", o: 0.7 })}${T(946, 150, 30, "gitrings", { f: "d", w: 600, a: "end" })}${mark(976, 140, p.fg)}
688
+ ${T(84, 430, 88, `In ${Y}, I made`, { f: "d", o: 0.85 })}
689
+ ${big(76, 700, 924, 300, fmt(D.total), { c: p.ac })}
690
+ ${big(84, 830, 912, 112, "contributions.")}
691
+ ${T(84, 1010, 72, "That makes my ring", { f: "d", o: 0.85 })}
692
+ ${big(80, 1150, 912, 150, `${article(tree[0])} ${tree[0]}.`)}
693
+ ${list.map(([k, v], i) => T(90, 1400 + i * 160, 30, k, { o: 0.66 }) + big(90, 1470 + i * 160, 400, 60, v)).join("")}`;
694
+ },
695
+ wide: (p) => `${glow(p, 1180, 450, 620)}
696
+ <g transform="translate(1180 450)">${rings(380, p)}</g>
697
+ ${T(96, 120, 28, `@${esc(D.login)}`, { f: "m", o: 0.7 })}
698
+ ${big(90, 262, 640, 112, `${Y} in rings`)}
699
+ ${T(96, 322, 30, `One ring per year since ${D.joined}.`, { o: 0.75 })}
700
+ <rect x="96" y="392" width="620" height="2" fill="${p.fg}" fill-opacity="0.18"/>
701
+ ${facts.map(([k, v], i) => { const x = 96 + (i % 2) * 320, y = 470 + Math.floor(i / 2) * 150; return T(x, y, 28, k, { o: 0.66 }) + big(x, y + 62, 290, 54, v); }).join("")}
702
+ ${mark(112, 824, p.fg)}${T(144, 834, 30, "gitrings", { f: "d", w: 600 })}`,
703
+ };
704
+
705
+ function card(style, k, avatar = D.avatar && `${D.avatar}&s=240`) {
706
+ const [, bg, hot, cool] = PALETTES[k];
707
+ const p = { bg: TONES[bg], fg: INK[bg][0], ac: INK[bg][1], hot: [TONES[hot], INK[hot][0]], cool: [TONES[cool], INK[cool][0]] };
708
+ const [w, h] = style === "wide" ? [1600, 900] : [1080, 1920];
709
+ return `<svg xmlns="http://www.w3.org/2000/svg" data-card="${style}" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}" role="img" aria-label="${Y} in rings: ${fmt(D.total)} contributions, ${article(tree[0])} ${tree[0]} ring." fill="${p.fg}"><rect width="${w}" height="${h}" fill="${p.bg}"/>${CARDS[style](p, avatar)}</svg>`;
710
+ }
711
+
712
+ const assets = (() => {
713
+ let cache;
714
+ const inline = async (url) => {
715
+ const blob = await (await fetch(url)).blob();
716
+ return new Promise((ok) => { const r = new FileReader(); r.onload = () => ok(r.result); r.readAsDataURL(blob); });
717
+ };
718
+ const load = async () => {
719
+ const css = (await Promise.all([...document.querySelectorAll('link[rel=stylesheet][href*="font"]')].map((l) => fetch(l.href).then((r) => r.text())))).join("");
720
+ const faces = css.match(/@font-face\s*{[^}]*}/g).filter((f) => !f.includes("unicode-range") || /unicode-range:\s*U\+0000-00FF/.test(f));
721
+ const embedded = await Promise.all(faces.map(async (f) => f.replace(/src:[^;]*;/, `src: url(${await inline(new URL(f.match(/url\(['"]?([^'")]+\.woff2)/)[1], "https://fonts.bunny.net").href)}) format("woff2");`)));
722
+ const avatar = D.avatar ? await inline(`${D.avatar}&s=240`).catch(() => "") : "";
723
+ return { css: embedded.join(""), avatar };
724
+ };
725
+ return () => (cache ??= load().catch((err) => { cache = null; throw err; }));
726
+ })();
727
+
728
+ const renders = new Map();
729
+ function png(style, k) {
730
+ const key = `${style}-${k}`;
731
+ if (!renders.has(key)) {
732
+ renders.set(key, (async () => {
733
+ const { css, avatar } = await assets();
734
+ const img = new Image();
735
+ img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(card(style, k, avatar).replace("<rect", `<style>${css}</style><rect`))}`;
736
+ await img.decode();
737
+ const canvas = Object.assign(document.createElement("canvas"), { width: img.width, height: img.height });
738
+ canvas.getContext("2d").drawImage(img, 0, 0);
739
+ return new Promise((ok) => canvas.toBlob(ok, "image/png"));
740
+ })().catch((err) => { renders.delete(key); throw err; }));
741
+ }
742
+ return renders.get(key);
743
+ }
744
+
745
+ const SLIDES = [
746
+ {
747
+ tone: "night", level: 0, name: "cover",
748
+ html: () => `
749
+ <div class="trunk-wrap" aria-hidden="true">${trunk({ label: false })}</div>
750
+ <p class="mono who rise" style="--i:0">@${esc(D.login)}</p>
751
+ <h1 class="big year rise" style="--i:1"><span>${String(Y).slice(0, 2)}</span><span>${String(Y).slice(2)}</span></h1>
752
+ <div class="spacer"></div>
753
+ <p class="lede rise" style="--i:2">Your year, in rings.</p>
754
+ <button class="cta rise" style="--i:3" type="button" data-begin>Begin<span class="knob"><i class="ph-light ph-arrow-right"></i></span></button>`,
755
+ },
756
+ {
757
+ tone: "moss", level: 1, time: 6.5, name: "hello", seal: [76, 21],
758
+ html: () => `
759
+ <div class="avatar rise" style="--i:0">
760
+ <span class="ripple" style="--i:0"></span><span class="ripple" style="--i:1"></span><span class="ripple" style="--i:2"></span>
761
+ ${D.avatar ? `<img src="${esc(D.avatar)}&s=320" alt="" crossorigin="anonymous" onerror="this.replaceWith(Object.assign(document.createElement('span'),{className:'initial',textContent:'${first[0]}'}))">` : `<span class="initial">${first[0]}</span>`}
762
+ </div>
763
+ <h2 class="headline rise" style="--i:1">Hey, ${first}.</h2>
764
+ <p class="sub rise" style="--i:2">A tree keeps a record of every year it lives: one ring per year, wider when the year was good.</p>
765
+ <div class="spacer"></div>
766
+ <p class="kicker rise" style="--i:3">Your GitHub keeps one too. Here is yours.</p>`,
767
+ },
768
+ {
769
+ tone: "night", level: 1, time: 4 + D.rings.length * 0.4, name: "rings", seal: [80, 79],
770
+ html: () => `
771
+ <h2 class="headline rise" style="--i:0">${D.rings.length} ${D.rings.length === 1 ? "ring" : "rings"} since ${D.joined}.</h2>
772
+ <p class="sub rise" style="--i:1">Read from the center out. The bright line is ${Y}.</p>
773
+ <div class="trunk-wrap">${trunk()}</div>
774
+ <div class="spacer"></div>
775
+ <div class="ledger">${D.rings.map((r, k) => `<span class="${r.year === Y ? "is-now" : ""}" style="--d:${(k * 0.32 + 0.2).toFixed(2)}s"><small class="mono">${r.year}</small><b class="num">${fmt(r.total)}</b></span>`).join("")}</div>`,
776
+ },
777
+ {
778
+ tone: "resin", level: 2, time: 8.5, name: "total", seal: [78, 48], tease: "A ring takes a whole year to grow…",
779
+ html: () => {
780
+ const prev = D.previous;
781
+ const ratio = prev ? D.total / prev : 0;
782
+ const line = prev == null || prev === 0
783
+ ? "Your first growing year on record."
784
+ : ratio >= 2
785
+ ? `That is <strong>${ratio >= 10 ? fmt(ratio) : ratio.toFixed(1)}×</strong> your ${Y - 1} total of ${fmt(prev)}.`
786
+ : ratio >= 1
787
+ ? `Up from <strong>${fmt(prev)}</strong> in ${Y - 1}.`
788
+ : `Down from <strong>${fmt(prev)}</strong> in ${Y - 1}. Quieter rings make a tree stronger too.`;
789
+ return `
790
+ <div class="backring" aria-hidden="true">${trunk({ label: false, rays: false, stagger: 0.12 })}</div>
791
+ <p class="kicker rise" style="--i:0">In ${Y} you made</p>
792
+ <p class="big count num rise" style="--i:1" data-count="${D.total}">0</p>
793
+ <p class="unit rise" style="--i:2">contributions.</p>
794
+ <div class="spacer"></div>
795
+ <p class="sub rise" style="--i:3">${line}</p>`;
796
+ },
797
+ },
798
+ {
799
+ tone: "bone", level: 2, time: 7, name: "tree", seal: [78, 47],
800
+ html: () => {
801
+ const next = TREES[treeIndex - 1];
802
+ const range = next ? `${fmt(tree[1])} to ${fmt(next[1] - 1)} contributions in one year.` : `${fmt(tree[1])} or more contributions in one year.`;
803
+ return `
804
+ <p class="kicker rise" style="--i:0">That makes your ${Y} ring ${article(tree[0])}</p>
805
+ <h2 class="big name rise" style="--i:1" data-fit="30">${tree[0]}.</h2>
806
+ <p class="sub rise" style="--i:2">${range} ${next ? `Next up: ${next[0]} at ${fmt(next[1])}.` : "The widest ring there is."}</p>
807
+ <ul class="ladder" aria-label="Ring sizes, largest first">${TREES.map(([name, floor], k) => `<li class="rise ${k < treeIndex ? "above" : k === treeIndex ? "here" : ""}" style="--i:${3 + (TREES.length - k) * 0.35}"><span>${name}</span><span class="mono">${floor ? fmt(floor) + "+" : "under 50"}</span></li>`).join("")}</ul>`;
808
+ },
809
+ },
810
+ {
811
+ tone: "ember", level: 3, time: 9.5, name: "season", seal: [80, 89], when: () => D.total > 0, tease: "Every ring has a season when it grows fastest…",
812
+ html: () => {
813
+ const word = MONTHS[peak];
814
+ return `
815
+ <p class="kicker rise" style="--i:0">Your ring grew most in</p>
816
+ <h2 class="big month rise" style="--i:1" data-fit="24">${word}</h2>
817
+ <p class="sub rise" style="--i:2"><strong>${fmt(D.months[peak])}</strong> contributions that month. Your biggest single day was ${short(D.best.date)}, with ${fmt(D.best.count)}.</p>
818
+ ${dial()}`;
819
+ },
820
+ },
821
+ {
822
+ tone: "moss", level: 3, time: 7, name: "shape", seal: [80, 92],
823
+ html: () => `
824
+ <p class="kicker rise" style="--i:0">Your ${Y} ring has a shape.</p>
825
+ <h2 class="big rise" style="--i:1;font-size:17cqw;margin:2cqw 0 3cqw">${PERSONAS[D.persona][0]}</h2>
826
+ <p class="sub rise" style="--i:2">${PERSONAS[D.persona][1]}</p>
827
+ <div class="band-wrap">${band()}</div>`,
828
+ },
829
+ {
830
+ tone: "night", level: 3, time: 9, name: "days", seal: [20, 89], when: () => D.activeDays > 0, tease: "Trees don't grow every day…",
831
+ html: () => `
832
+ <h2 class="big rise num" style="--i:0;font-size:${longRun ? 30 : 26}cqw" data-count="${longRun ? D.streak.days : D.activeDays}">0</h2>
833
+ <p class="headline rise" style="--i:1;font-size:9cqw;margin:2cqw 0 3cqw">${longRun ? "days in a row." : "days with growth."}</p>
834
+ <p class="sub rise" style="--i:2">${longRun ? `${short(D.streak.start)} to ${short(D.streak.end)}, without a gap. ${D.activeDays} active days in all.` : `Your longest run was <strong>${D.streak.days} ${D.streak.days === 1 ? "day" : "days"}</strong>${D.streak.days > 1 ? `, ${short(D.streak.start)} to ${short(D.streak.end)}` : ""}. Bright dots mark it.`}</p>
835
+ ${dots()}`,
836
+ },
837
+ {
838
+ tone: "resin", level: 3, time: 8.5, name: "rhythm", seal: [78, 45], when: () => D.total > 0, tease: "Some days the sap runs faster…",
839
+ html: () => {
840
+ const max = Math.max(...D.weekdays);
841
+ return `
842
+ <p class="kicker rise" style="--i:0">You grow on</p>
843
+ <h2 class="big rise" style="--i:1;margin:2cqw 0 3cqw" data-fit="22">${DAYS[best]}s.</h2>
844
+ <p class="sub rise" style="--i:2"><strong>${fmt(D.weekdays[best])}</strong> contributions on ${DAYS[best]}s this year. ${quiet > 4 && D.weekdays[5] === D.weekdays[6] ? "Weekend" : DAYS[quiet]}s were the quietest${D.weekdays[quiet] ? `, with ${fmt(D.weekdays[quiet])}` : ", with none at all"}.</p>
845
+ <div class="week" role="img" aria-label="Contributions by weekday: ${DAYS.map((d, i) => `${d} ${D.weekdays[i]}`).join(", ")}">${DAYS.map((d, i) => `<div class="col${i === best ? " best" : ""}" style="--i:${i}"><em class="num">${fmt(D.weekdays[i])}</em><b style="height:${Math.max(1.5, (D.weekdays[i] / max) * 100)}%"></b><small>${d.slice(0, 3)}</small></div>`).join("")}</div>`;
846
+ },
847
+ },
848
+ {
849
+ tone: "ember", level: 3, time: 8.5, name: "made", seal: [78, 70], when: () => kinds.length > 0,
850
+ html: () => {
851
+ const max = Math.max(...kinds.map(([, v]) => v));
852
+ const parts = kinds.map(([, v]) => fmt(v)).join(" + ");
853
+ const sum = kindSum === D.total
854
+ ? `${parts} = <strong>${fmt(D.total)}</strong>, your full calendar.`
855
+ : `${parts} = <strong>${fmt(kindSum)}</strong> of the ${fmt(D.total)} on your calendar.`;
856
+ const privateLine = D.kinds.restricted > 0
857
+ ? `${fmt(D.kinds.restricted)} private contributions came through as a total only. A token with the user scope breaks them down.`
858
+ : D.privateCommits > 0
859
+ ? `${fmt(D.privateCommits)} of your ${fmt(D.kinds.commits)} commits went to private repositories. Counted here, never named.`
860
+ : "";
861
+ return `
862
+ <h2 class="headline rise" style="--i:0">What this ring is made of.</h2>
863
+ <div class="layers">${kinds.map(([name, v], i) => `<div class="layer rise" style="--i:${1 + i * 0.5}"><span>${name}</span><b class="num" data-count="${v}">0</b><i style="--w:${Math.max(1, (v / max) * 100)}%;--i:${i}"></i></div>`).join("")}</div>
864
+ <p class="sub sum rise" style="--i:4">${sum}</p>
865
+ ${privateLine ? `<p class="private rise" style="--i:5"><i class="ph-light ph-lock-simple"></i><span>${privateLine}</span></p>` : ""}`;
866
+ },
867
+ },
868
+ {
869
+ tone: "bone", level: 3, time: 7, name: "languages", seal: [84, 74], when: () => languages.rows.length > 0 && languages.commits > 0,
870
+ html: () => {
871
+ const lead = languages.rows[0];
872
+ const pct = (v) => { const p = (v / languages.commits) * 100; return p > 0 && p < 1 ? "<1" : Math.round(p); };
873
+ return `
874
+ <h2 class="headline rise" style="--i:0">Mostly ${esc(lead.name)}.</h2>
875
+ <p class="sub rise" style="--i:1">${esc(lead.name)} repositories got <strong>${pct(lead.commits)}%</strong> of your ${fmt(languages.commits)} commits in ${Y}.</p>
876
+ <div class="donut-wrap rise" style="--i:2">${donut(languages.rows, languages.commits)}<div class="donut-center"><b class="num">${pct(lead.commits)}%</b><span class="mono">${esc(lead.name)}</span></div></div>
877
+ <ul class="legend">${languages.rows.map((l, i) => `<li class="rise" style="--i:${3 + i * 0.3};--c:${esc(l.color)}"><u></u><span>${esc(l.name)}</span><span class="mono num">${pct(l.commits)}%</span></li>`).join("")}</ul>`;
878
+ },
879
+ },
880
+ {
881
+ tone: "night", level: 4, name: "finale",
882
+ html: () => `
883
+ <div class="card-top rise" style="--i:0"><span class="mono">Your ${Y} card</span><span class="mono">${D.rings.length} rings</span></div>
884
+ <div class="studio rise" style="--i:1">
885
+ <div class="card-stage"></div>
886
+ <div class="styles" role="tablist" aria-label="Card style">${STYLES.map(([key, name], i) => `<button type="button" role="tab" aria-selected="${!i}" data-style="${key}">${name}</button>`).join("")}</div>
887
+ <div class="swatches" role="radiogroup" aria-label="Colors">${PALETTES.map(([name, bg], i) => `<button type="button" role="radio" aria-checked="${!i}" aria-label="${name}" data-palette="${i}" style="--c:${TONES[bg]};--d:${INK[bg][1]}"></button>`).join("")}</div>
888
+ </div>
889
+ <div class="actions rise" style="--i:2">
890
+ <button class="cta" type="button" data-share>Share card<span class="knob"><i class="ph-light ph-export"></i></span></button>
891
+ <button class="cta ghost" type="button" data-replay>Replay<span class="knob"><i class="ph-light ph-arrow-counter-clockwise"></i></span></button>
892
+ </div>`,
893
+ },
894
+ ].filter((s) => !s.when || s.when());
895
+
896
+ const Sound = (() => {
897
+ const MOODS = { Forest: 84, Lofi: 72, Pulse: 112 };
898
+ const hz = (m) => 440 * 2 ** ((m - 69) / 12);
899
+ const CHORDS = [[50, 54, 57, 61], [47, 50, 54, 57], [43, 47, 50, 54], [45, 47, 52, 57]];
900
+ const ROOTS = [38, 35, 31, 33];
901
+ const SCALE = [62, 64, 66, 69, 71, 74, 76, 78, 81, 83];
902
+ const weeks = [];
903
+ for (let i = 0; i < D.days.length; i += 7) weeks.push(D.days.slice(i, i + 7).reduce((s, v) => s + v, 0));
904
+ const top = Math.max(1, ...weeks);
905
+ const melody = weeks.map((w) => (w ? SCALE[Math.min(SCALE.length - 1, Math.floor(Math.sqrt(w / top) * SCALE.length))] : null));
906
+ let ctx, master, bus, pads, echo, noise, timer;
907
+ let step = 0, next = 0, level = 0, playing = false, mood = null;
908
+ const len = () => 30 / MOODS[mood || "Forest"];
909
+
910
+ function build() {
911
+ ctx = new (window.AudioContext || window.webkitAudioContext)();
912
+ master = ctx.createGain();
913
+ master.gain.value = 0;
914
+ const squeeze = ctx.createDynamicsCompressor();
915
+ squeeze.threshold.value = -16;
916
+ squeeze.ratio.value = 3;
917
+ master.connect(squeeze).connect(ctx.destination);
918
+ const verb = ctx.createConvolver();
919
+ const length = ctx.sampleRate * 3.4;
920
+ const impulse = ctx.createBuffer(2, length, ctx.sampleRate);
921
+ for (let c = 0; c < 2; c++) {
922
+ const data = impulse.getChannelData(c);
923
+ for (let i = 0; i < length; i++) data[i] = (Math.random() * 2 - 1) * (1 - i / length) ** 2.6;
924
+ }
925
+ verb.buffer = impulse;
926
+ const wet = ctx.createGain();
927
+ wet.gain.value = 0.42;
928
+ verb.connect(wet).connect(master);
929
+ bus = ctx.createGain();
930
+ bus.connect(master);
931
+ bus.connect(verb);
932
+ pads = ctx.createBiquadFilter();
933
+ pads.type = "lowpass";
934
+ pads.frequency.value = 700;
935
+ pads.Q.value = 0.6;
936
+ pads.connect(bus);
937
+ echo = ctx.createDelay(2);
938
+ echo.delayTime.value = len() * 3;
939
+ const feedback = ctx.createGain();
940
+ feedback.gain.value = 0.34;
941
+ const tone = ctx.createBiquadFilter();
942
+ tone.type = "lowpass";
943
+ tone.frequency.value = 2600;
944
+ echo.connect(tone).connect(feedback).connect(echo);
945
+ tone.connect(bus);
946
+ noise = ctx.createBuffer(1, ctx.sampleRate * 0.2, ctx.sampleRate);
947
+ const n = noise.getChannelData(0);
948
+ for (let i = 0; i < n.length; i++) n[i] = Math.random() * 2 - 1;
949
+ }
950
+ function voice(type, freq, t, peak, attack, hold, release, out, detune = 0) {
951
+ const o = ctx.createOscillator();
952
+ const g = ctx.createGain();
953
+ o.type = type;
954
+ o.frequency.value = freq;
955
+ o.detune.value = detune;
956
+ g.gain.setValueAtTime(0.0001, t);
957
+ g.gain.exponentialRampToValueAtTime(peak, t + attack);
958
+ if (hold) g.gain.setValueAtTime(peak, t + attack + hold);
959
+ g.gain.exponentialRampToValueAtTime(0.0001, t + attack + hold + release);
960
+ o.connect(g).connect(out);
961
+ o.start(t);
962
+ o.stop(t + attack + hold + release + 0.05);
963
+ return g;
964
+ }
965
+ function knock(t, v) {
966
+ const src = ctx.createBufferSource();
967
+ src.buffer = noise;
968
+ const f = ctx.createBiquadFilter();
969
+ f.type = "bandpass";
970
+ f.frequency.value = 1750;
971
+ f.Q.value = 7;
972
+ const g = ctx.createGain();
973
+ g.gain.setValueAtTime(0.5 * v, t);
974
+ g.gain.exponentialRampToValueAtTime(0.0001, t + 0.08);
975
+ src.connect(f).connect(g).connect(bus);
976
+ src.start(t);
977
+ src.stop(t + 0.1);
978
+ voice("sine", 880, t, 0.09 * v, 0.002, 0, 0.06, bus);
979
+ }
980
+ function kick(t) {
981
+ const o = ctx.createOscillator();
982
+ const g = ctx.createGain();
983
+ o.frequency.setValueAtTime(120, t);
984
+ o.frequency.exponentialRampToValueAtTime(42, t + 0.14);
985
+ g.gain.setValueAtTime(0.42, t);
986
+ g.gain.exponentialRampToValueAtTime(0.0001, t + 0.32);
987
+ o.connect(g).connect(master);
988
+ o.start(t);
989
+ o.stop(t + 0.35);
990
+ }
991
+ function hiss(t, type, freq, q, peak, decay) {
992
+ const src = ctx.createBufferSource();
993
+ src.buffer = noise;
994
+ const f = ctx.createBiquadFilter();
995
+ f.type = type;
996
+ f.frequency.value = freq;
997
+ f.Q.value = q;
998
+ const g = ctx.createGain();
999
+ g.gain.setValueAtTime(peak, t);
1000
+ g.gain.exponentialRampToValueAtTime(0.0001, t + decay);
1001
+ src.connect(f).connect(g).connect(bus);
1002
+ src.start(t);
1003
+ src.stop(t + decay + 0.02);
1004
+ }
1005
+ function play(s, t) {
1006
+ const chord = Math.floor(s / 16) % 4;
1007
+ const beat = s % 8;
1008
+ const root = hz(ROOTS[chord]);
1009
+ const note = level >= 3 && melody[s % melody.length];
1010
+ if (mood === "Lofi") {
1011
+ if (beat === 0 || beat === 3 || beat === 6) CHORDS[chord].forEach((m) => voice("triangle", hz(m + 12), t, 0.028, 0.012, 0.06, 1.3, pads, beat ? 7 : -7));
1012
+ if (level >= 1 && (beat === 0 || beat === 3)) voice("sine", root, t, 0.2, 0.012, 0.12, 0.7, bus);
1013
+ if (level >= 2) {
1014
+ if (beat === 0 || beat === 5) kick(t);
1015
+ if (beat === 2 || beat === 6) hiss(t, "bandpass", 1400, 0.8, 0.3, 0.18);
1016
+ if (beat % 2) hiss(t, "highpass", 7000, 0.7, 0.05, 0.03);
1017
+ }
1018
+ if (Math.random() < 0.3) hiss(t + Math.random() * len(), "highpass", 3000, 0.5, 0.025, 0.004);
1019
+ if (note) voice("sine", hz(note), t, 0.1, 0.01, 0.05, 0.9, bus).connect(echo);
1020
+ return;
1021
+ }
1022
+ if (mood === "Pulse") {
1023
+ if (s % 16 === 0) CHORDS[chord].forEach((m) => voice("sawtooth", hz(m), t, 0.014, 0.6, len() * 16 - 0.6, 1.2, pads, 9));
1024
+ if (level >= 1 && beat % 2) voice("sawtooth", root * 2, t, 0.06, 0.005, 0.04, 0.14, pads);
1025
+ if (level >= 2) {
1026
+ if (beat % 2 === 0) kick(t);
1027
+ else hiss(t, "highpass", 8000, 0.7, 0.08, 0.04);
1028
+ if (beat === 2 || beat === 6) knock(t, 0.8);
1029
+ }
1030
+ if (level >= 3) voice("square", hz(CHORDS[chord][s % 4] + 12), t, 0.012, 0.003, 0, 0.11, bus);
1031
+ if (note) voice("triangle", hz(note), t, 0.08, 0.004, 0, 0.5, bus).connect(echo);
1032
+ return;
1033
+ }
1034
+ if (s % 16 === 0) CHORDS[chord].forEach((m) => [-7, 7].forEach((c) => voice("sawtooth", hz(m), t, 0.022, 1.4, len() * 16 - 1.4, 1.8, pads, c)));
1035
+ if (level >= 1 && (beat === 0 || beat === 5)) voice("sine", root, t, beat ? 0.12 : 0.2, 0.012, 0.1, 0.9, bus);
1036
+ if (level >= 2) {
1037
+ if (beat === 0 || beat === 4) kick(t);
1038
+ if (beat === 2 || beat === 6) knock(t, 1);
1039
+ if (beat === 7) knock(t, 0.35);
1040
+ }
1041
+ if (note) {
1042
+ voice("triangle", hz(note), t, 0.085, 0.004, 0, 1.1, bus).connect(echo);
1043
+ voice("sine", hz(note + 12), t, 0.02, 0.004, 0, 0.6, bus);
1044
+ }
1045
+ }
1046
+ function tick() {
1047
+ while (next < ctx.currentTime + 0.15) {
1048
+ play(step, next + (mood === "Lofi" && step % 2 ? len() * 0.22 : 0));
1049
+ step += 1;
1050
+ next += len();
1051
+ }
1052
+ }
1053
+ function begin() {
1054
+ if (!ctx) build();
1055
+ ctx.resume();
1056
+ if (!timer) {
1057
+ next = ctx.currentTime + 0.08;
1058
+ timer = setInterval(tick, 25);
1059
+ }
1060
+ master.gain.cancelScheduledValues(ctx.currentTime);
1061
+ master.gain.setTargetAtTime(0.62, ctx.currentTime, 0.8);
1062
+ playing = true;
1063
+ }
1064
+ function stop() {
1065
+ if (!ctx) return;
1066
+ master.gain.cancelScheduledValues(ctx.currentTime);
1067
+ master.gain.setTargetAtTime(0, ctx.currentTime, 0.15);
1068
+ playing = false;
1069
+ setTimeout(() => { if (!playing) { clearInterval(timer); timer = null; ctx.suspend(); } }, 700);
1070
+ }
1071
+ return {
1072
+ get mood() { return mood; },
1073
+ set(m) {
1074
+ mood = m;
1075
+ if (!m) stop();
1076
+ else if (echo) echo.delayTime.setTargetAtTime(len() * 3, ctx.currentTime, 0.1);
1077
+ },
1078
+ start() { if (mood) begin(); },
1079
+ pause() { if (playing) stop(); },
1080
+ resume() { if (mood && ctx) begin(); },
1081
+ level(l) {
1082
+ level = l;
1083
+ if (pads) pads.frequency.setTargetAtTime(700 + l * 420, ctx.currentTime, 1.2);
1084
+ },
1085
+ };
1086
+ })();
1087
+
1088
+ const story = document.getElementById("story");
1089
+ const holder = story.querySelector(".slides");
1090
+ const bars = story.querySelector(".bars");
1091
+ const soundBtn = story.querySelector(".sound");
1092
+ const announce = document.getElementById("announce");
1093
+ const prevBtn = document.querySelector(".nav.prev");
1094
+ const nextBtn = document.querySelector(".nav.next");
1095
+ let index = -1;
1096
+ let begun = false;
1097
+
1098
+ const els = SLIDES.map((s, i) => {
1099
+ const el = document.createElement("section");
1100
+ el.className = `slide tone-${s.tone} ${s.name}${s.name === "rings" ? " rings-slide" : ""}${s.tease ? " teased" : ""}`;
1101
+ el.setAttribute("role", "group");
1102
+ el.setAttribute("aria-roledescription", "slide");
1103
+ el.setAttribute("aria-label", `${i + 1} of ${SLIDES.length}`);
1104
+ el.innerHTML = (s.tease ? `<p class="tease">${s.tease}</p>` : "") + s.html();
1105
+ holder.append(el);
1106
+ return el;
1107
+ });
1108
+ const seal = document.createElement("div");
1109
+ seal.className = "seal";
1110
+ seal.setAttribute("aria-hidden", "true");
1111
+ seal.innerHTML = `<svg viewBox="-50 -50 100 100"><defs><path id="seal-arc" d="M0,-41a41,41 0 1,1 0,82a41,41 0 1,1 0,-82"/></defs><text><textPath href="#seal-arc" textLength="254">GITRINGS · ${Y} · ONE RING PER YEAR ·</textPath></text>${D.rings.map((r) => `<path d="${loop(r.edge, 29)}"/>`).join("")}<circle r="3.6"/></svg>`;
1112
+ holder.after(seal);
1113
+ SLIDES.forEach(() => bars.insertAdjacentHTML("beforeend", '<span class="bar"><i></i></span>'));
1114
+
1115
+ function countUp(el) {
1116
+ el.querySelectorAll("[data-count]").forEach((node) => {
1117
+ const target = +node.dataset.count;
1118
+ if (calm) { node.textContent = fmt(target); return; }
1119
+ const t0 = performance.now() + 450 + (el.classList.contains("teased") ? 1900 : 0);
1120
+ const run = (now) => {
1121
+ const p = Math.min(1, Math.max(0, (now - t0) / 1700));
1122
+ node.textContent = fmt(target * (1 - 2 ** (-10 * p)));
1123
+ if (p < 1) requestAnimationFrame(run);
1124
+ else node.textContent = fmt(target);
1125
+ };
1126
+ requestAnimationFrame(run);
1127
+ });
1128
+ }
1129
+
1130
+ function fit(root) {
1131
+ root.querySelectorAll("[data-fit]").forEach((node) => {
1132
+ const max = +node.dataset.fit;
1133
+ node.style.fontSize = `${max}cqw`;
1134
+ const range = document.createRange();
1135
+ range.selectNodeContents(node);
1136
+ const need = range.getBoundingClientRect().width;
1137
+ const room = node.clientWidth;
1138
+ if (need > room) node.style.fontSize = `${((max * room) / need) * 0.97}cqw`;
1139
+ });
1140
+ }
1141
+ document.fonts.ready.then(() => els.forEach(fit));
1142
+ addEventListener("resize", () => els.forEach(fit));
1143
+
1144
+ function go(i, origin) {
1145
+ if (i < 0 || i >= SLIDES.length || i === index) return;
1146
+ const old = els[index];
1147
+ const el = els[i];
1148
+ const s = SLIDES[i];
1149
+ el.classList.remove("is-on", "is-entering", "is-current");
1150
+ void el.offsetWidth;
1151
+ const box = story.getBoundingClientRect();
1152
+ el.style.setProperty("--x", origin ? `${origin[0] - box.left}px` : "50%");
1153
+ el.style.setProperty("--y", origin ? `${origin[1] - box.top}px` : "50%");
1154
+ el.classList.add(old ? "is-entering" : "is-current", "is-on");
1155
+ if (old) {
1156
+ el.addEventListener("animationend", function done(e) {
1157
+ if (e.target !== el) return;
1158
+ el.removeEventListener("animationend", done);
1159
+ el.classList.replace("is-entering", "is-current");
1160
+ if (old !== el) old.classList.remove("is-current", "is-on");
1161
+ });
1162
+ }
1163
+ el.querySelectorAll(".donut circle").forEach((c) => { c.setAttribute("stroke-dasharray", "0 100"); });
1164
+ requestAnimationFrame(() => setTimeout(() => el.querySelectorAll(".donut circle").forEach((c, k) => setTimeout(() => c.setAttribute("stroke-dasharray", c.dataset.dash), k * 140)), 500));
1165
+ countUp(el);
1166
+ index = i;
1167
+ [...bars.children].forEach((bar, k) => {
1168
+ bar.className = "bar" + (k < i ? " done" : "");
1169
+ const fill = bar.firstElementChild;
1170
+ fill.style.removeProperty("--dur");
1171
+ if (k === i && s.time) {
1172
+ void bar.offsetWidth;
1173
+ bar.classList.add("active");
1174
+ fill.style.setProperty("--dur", `${s.time}s`);
1175
+ }
1176
+ });
1177
+ story.style.color = getComputedStyle(el).color;
1178
+ seal.style.cssText = `--sx:${s.seal?.[0] ?? 50};--sy:${s.seal?.[1] ?? 50};--sr:${i * 75}deg;--ss:${s.seal ? 1 : 0};color:${INK[s.tone][1]}`;
1179
+ document.body.style.setProperty("--glow", TONES[s.tone]);
1180
+ soundBtn.style.color = "";
1181
+ prevBtn.disabled = i === 0;
1182
+ nextBtn.disabled = i === SLIDES.length - 1 || !begun;
1183
+ announce.textContent = el.innerText.replace(/\s+/g, " ").trim().slice(0, 240);
1184
+ Sound.level(s.level);
1185
+ }
1186
+
1187
+ bars.addEventListener("animationend", (e) => {
1188
+ if (e.target.parentElement?.classList.contains("active")) go(index + 1);
1189
+ });
1190
+
1191
+ function begin(origin) {
1192
+ begun = true;
1193
+ Sound.start();
1194
+ paintSound();
1195
+ go(1, origin);
1196
+ }
1197
+
1198
+ function step(dir, origin) {
1199
+ if (!begun) { if (dir > 0) begin(origin); return; }
1200
+ Sound.start();
1201
+ paintSound();
1202
+ if (index + dir < 1) return;
1203
+ go(index + dir, origin);
1204
+ }
1205
+
1206
+ let holdTimer = null;
1207
+ let held = false;
1208
+ holder.addEventListener("pointerdown", (e) => {
1209
+ if (e.target.closest("button, .studio")) return;
1210
+ held = false;
1211
+ holdTimer = setTimeout(() => { held = true; story.classList.add("paused"); }, 260);
1212
+ });
1213
+ holder.addEventListener("pointerup", (e) => {
1214
+ clearTimeout(holdTimer);
1215
+ if (e.target.closest("button, .studio")) return;
1216
+ story.classList.remove("paused");
1217
+ if (held) return;
1218
+ const box = story.getBoundingClientRect();
1219
+ step(e.clientX - box.left < box.width * 0.3 ? -1 : 1, [e.clientX, e.clientY]);
1220
+ });
1221
+ holder.addEventListener("pointercancel", () => { clearTimeout(holdTimer); story.classList.remove("paused"); });
1222
+
1223
+ holder.addEventListener("click", (e) => {
1224
+ const target = e.target.closest("button");
1225
+ if (!target) return;
1226
+ if (target.hasAttribute("data-begin")) begin([e.clientX, e.clientY]);
1227
+ if (target.hasAttribute("data-replay")) go(1, [e.clientX, e.clientY]);
1228
+ if (target.hasAttribute("data-share")) openSheet();
1229
+ if (target.dataset.style) { studio.style = target.dataset.style; paintCard(); }
1230
+ if (target.dataset.palette) { studio.palette = +target.dataset.palette; paintCard(); }
1231
+ });
1232
+ prevBtn.addEventListener("click", () => step(-1));
1233
+ nextBtn.addEventListener("click", () => step(1));
1234
+ document.addEventListener("keydown", (e) => {
1235
+ if (!sheet.hidden) { if (e.key === "Escape") closeSheet(); return; }
1236
+ if (e.key === "ArrowRight") step(1);
1237
+ if (e.key === "ArrowLeft") step(-1);
1238
+ if (e.key === " " && begun) { e.preventDefault(); story.classList.toggle("paused"); }
1239
+ if (e.key.toLowerCase() === "m") soundBtn.click();
1240
+ });
1241
+
1242
+ const MOOD_ORDER = [null, "Forest", "Lofi", "Pulse"];
1243
+ function paintSound() {
1244
+ story.classList.toggle("sound-on", Boolean(Sound.mood));
1245
+ soundBtn.setAttribute("aria-label", `Soundtrack: ${Sound.mood || "off"}. Press to change.`);
1246
+ soundBtn.querySelector(".label").textContent = Sound.mood || "Sound off";
1247
+ }
1248
+ soundBtn.addEventListener("click", () => {
1249
+ Sound.set(MOOD_ORDER[(MOOD_ORDER.indexOf(Sound.mood) + 1) % MOOD_ORDER.length]);
1250
+ Sound.start();
1251
+ paintSound();
1252
+ });
1253
+ paintSound();
1254
+
1255
+ document.addEventListener("visibilitychange", () => {
1256
+ story.classList.toggle("hidden-tab", document.hidden);
1257
+ document.hidden ? Sound.pause() : Sound.resume();
1258
+ });
1259
+
1260
+ const studio = { style: "trunk", palette: 0 };
1261
+ const finale = els[SLIDES.findIndex((s) => s.name === "finale")];
1262
+ const stage = finale.querySelector(".card-stage");
1263
+ const sheet = story.querySelector(".sheet");
1264
+ sheet.querySelector('[data-out="share"]').hidden = !navigator.canShare?.({ files: [new File([""], "rings.png", { type: "image/png" })] });
1265
+
1266
+ function paintCard() {
1267
+ stage.innerHTML = card(studio.style, studio.palette);
1268
+ finale.querySelectorAll("[data-style]").forEach((b) => b.setAttribute("aria-selected", String(b.dataset.style === studio.style)));
1269
+ finale.querySelectorAll("[data-palette]").forEach((b) => b.setAttribute("aria-checked", String(+b.dataset.palette === studio.palette)));
1270
+ }
1271
+ paintCard();
1272
+ document.fonts.ready.then(paintCard);
1273
+
1274
+ function flash(el, text) {
1275
+ el.dataset.was ??= el.textContent;
1276
+ el.textContent = text;
1277
+ clearTimeout(el.timer);
1278
+ el.timer = setTimeout(() => { el.textContent = el.dataset.was; }, 1800);
1279
+ }
1280
+
1281
+ function openSheet() {
1282
+ const raw = `https://raw.githubusercontent.com/${D.login}/${D.login}/gitrings/gitrings`;
1283
+ sheet.querySelector("[data-md]").textContent = `<picture><source media="(prefers-color-scheme: dark)" srcset="${raw}-dark.svg"><img alt="@${D.login}'s GitHub years as tree rings" src="${raw}.svg"></picture>`;
1284
+ sheet.hidden = false;
1285
+ sheet.querySelector("[data-out]").focus();
1286
+ png(studio.style, studio.palette).catch(() => {});
1287
+ }
1288
+
1289
+ function closeSheet() {
1290
+ sheet.hidden = true;
1291
+ finale.querySelector("[data-share]").focus();
1292
+ }
1293
+
1294
+ async function deliver(button) {
1295
+ const kind = button.dataset.out;
1296
+ const name = `gitrings-${D.login}-${Y}-${studio.style}.png`;
1297
+ try {
1298
+ if (kind === "copy") {
1299
+ await navigator.clipboard.write([new ClipboardItem({ "image/png": png(studio.style, studio.palette) })]);
1300
+ } else {
1301
+ const blob = await png(studio.style, studio.palette);
1302
+ if (kind === "share") {
1303
+ await navigator.share({ files: [new File([blob], name, { type: "image/png" })], title: `${Y} in rings` });
1304
+ } else {
1305
+ const link = Object.assign(document.createElement("a"), { href: URL.createObjectURL(blob), download: name });
1306
+ link.click();
1307
+ setTimeout(() => URL.revokeObjectURL(link.href), 4000);
1308
+ }
1309
+ }
1310
+ flash(button.querySelector("span"), { copy: "Copied", share: "Shared", save: "Saved" }[kind]);
1311
+ } catch (err) {
1312
+ if (err.name !== "AbortError") flash(button.querySelector("span"), "Try again");
1313
+ }
1314
+ }
1315
+
1316
+ sheet.addEventListener("click", async (e) => {
1317
+ if (e.target === sheet || e.target.closest("[data-close]")) return closeSheet();
1318
+ const out = e.target.closest("[data-out]");
1319
+ if (out) return deliver(out);
1320
+ const copy = e.target.closest("[data-copy-text]");
1321
+ if (copy) {
1322
+ const code = copy.previousElementSibling;
1323
+ await navigator.clipboard.writeText(code.dataset.copy ?? code.textContent);
1324
+ flash(copy, "Copied");
1325
+ }
1326
+ });
1327
+
1328
+ const deep = SLIDES.findIndex((s) => `#${s.name}` === location.hash);
1329
+ if (deep > 0) {
1330
+ begun = true;
1331
+ go(deep);
1332
+ } else {
1333
+ go(0);
1334
+ }
1335
+ })();
1336
+ </script>
1337
+ </body>
1338
+ </html>