slidetake 0.1.0 → 0.2.0

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/dist/slidetake.js CHANGED
@@ -1,6 +1,6 @@
1
- /* Slidetake 0.1.0 · https://slidetake.com · Apache-2.0 */
2
- "use strict";(()=>{var W=(e,t)=>()=>(e&&(t=e(e=0)),t);var Dt,On=W(()=>{Dt=`---
3
- title: Slidetake \u2014 markdown to finished video
1
+ /* Slidetake 0.2.0 · https://slidetake.com · Apache-2.0 */
2
+ "use strict";(()=>{var j=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ft,jn=j(()=>{Ft=`---
3
+ title: Slidetake \u2014 write in markdown, record without timeline editing
4
4
  brand: slidetake
5
5
  pip: bottom-right
6
6
  ---
@@ -9,68 +9,68 @@ pip: bottom-right
9
9
 
10
10
  # ![](/favicon.svg) Slidetake
11
11
 
12
- **Markdown to finished video.** Write a deck in markdown, present it as a map you move through, and record it take by take.
12
+ **Write in markdown. Present on a spatial canvas. Record without timeline editing.**
13
13
 
14
- Press \u2192 to walk this deck, or **O** to see its map.
14
+ For developers and technical educators who explain things on video. You're inside a Slidetake deck right now: press \u2192 to walk it, **O** for the map.
15
15
 
16
- ## \u270D\uFE0F Write
16
+ ## \u2702\uFE0F Stop editing on a timeline
17
17
 
18
- Ordinary markdown is the whole format.
18
+ **Retake by slide.** The slide is the timeline marker, so a fumbled line costs one press, not an editing session.
19
19
 
20
- ### Headings are cards
20
+ ### Every slide is a take
21
21
 
22
- \`#\` is the first card, \`##\` sections branch from it, \`###\` go a level deeper. This card is a \`###\`.
22
+ Stumbled on a slide? Press \u2190 and say it again. Every attempt is kept, and recording carries on.
23
23
 
24
- ### The tree is the map
24
+ ### Pick, don't scrub
25
25
 
26
- \u2193 goes into a section, \u2191 comes back out. This deck is a tree you're walking right now.
26
+ Choose the best take of each slide. Slidetake writes the frame-exact **ffmpeg** cut, the YouTube **chapters** and the description.
27
27
 
28
- ## \u{1F3AC} Present
28
+ ## \u{1F5FA}\uFE0F A map, not a stack
29
29
 
30
30
  <!-- view: overview -->
31
31
 
32
- The deck is a map: this slide pulls back to all of it first.
32
+ Your headings are the hierarchy: zoom out for the whole system, zoom in for one part. This slide just showed you the map.
33
33
 
34
- ### Four layouts
34
+ ### Headings become cards
35
35
 
36
- **Tree**, **radial**, **path** or **focus** at the top. Path is a staircase made for video; focus fades slide to slide.
36
+ \`#\` is the first card, \`##\` branches from it, \`###\` goes a level deeper. No layout to draw.
37
37
 
38
- ### Fullscreen
38
+ ### A path your viewer can follow
39
39
 
40
- **F** fills the screen. A thin bar along the bottom tracks your progress, and the clock if the deck has a length.
40
+ \u2192 always walks the same order, and **path** lays it out as a staircase, so the audience never loses its place.
41
41
 
42
- ## \u23FA\uFE0F Record
42
+ ## \u{1F3A5} The camera is part of the deck
43
43
 
44
44
  <!-- camera: on, full, on -->
45
45
 
46
- With **[OBS](https://obsproject.com)**, the deck directs the video. Turn on **Camera** and this slide moves you around the screen.
46
+ A comment in a slide moves you: corner, full screen, or off. Turn on **Camera** and watch this slide do it.
47
47
 
48
- ### Every slide is a take
48
+ ### Broadcast-quality recording
49
49
 
50
- Fumbled a slide? \u2190 starts it again. Every attempt is kept; pick the best one later.
50
+ **[OBS](https://obsproject.com)** records at full quality; Slidetake drives it. No scenes to switch, no recording to watch.
51
51
 
52
- ### The cut
52
+ ### One session, one finished video
53
53
 
54
- Slidetake writes a frame-exact **ffmpeg** command for the takes you picked, with YouTube **chapters** and a description.
54
+ Write, present and record in one sitting. What comes out is ready to upload.
55
55
 
56
- ## \u{1F517} Open and share
56
+ ## \u270D\uFE0F Plain text in
57
57
 
58
- **\u270E Editor** opens the markdown beside the deck.
58
+ Markdown you already know: headings, lists, tables, code, diagrams, charts, images and YouTube links. [See every example \u2192](/examples)
59
59
 
60
60
  ### Your copy
61
61
 
62
62
  Type in any deck, this one included, and it becomes your own copy. The original stays as it is.
63
63
 
64
- ### Links
64
+ ### Open and share
65
65
 
66
- **\u21E3 Load** a GitHub file or gist, **New** from a template, and **Share** a link with your deck inside it.
66
+ **\u21E3 Load** a GitHub file or gist, start from a template, and **Share** a link with the deck inside it.
67
67
 
68
68
  ## \u{1F49B} Free and open
69
69
 
70
70
  Open source, Apache 2.0: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).
71
71
 
72
72
  Everything else is in the guide: **[slidetake.com/help](/help)**.
73
- `});var zn,In=W(()=>{zn=`---
73
+ `});var Nn,_n=j(()=>{Nn=`---
74
74
  title: Slidetake help
75
75
  brand: slidetake
76
76
  pip: none
@@ -102,6 +102,25 @@ See the [roadmap](#plan).
102
102
  - A card's id is its heading slugified (\`## Moving around\` \u2192 \`moving-around\`), or set one with \`{#id}\` at the end of the heading.
103
103
  - A link to \`#id\` flies to that card.
104
104
 
105
+ ### What a card can hold
106
+
107
+ Plain markdown, and the layout follows from what's on the card. [See every one \u2192](/examples)
108
+
109
+ | Write | Get |
110
+ |---|---|
111
+ | \`<!-- steps -->\` before a list | one item per press |
112
+ | \` \`\`\`dot \`, \` \`\`\`d2 \` | a Graphviz or D2 diagram |
113
+ | \` \`\`\`echarts \` with JSON options | a chart, in the deck's colors for dark and light |
114
+ | \` \`\`\`svg \` or \`![](drawing.svg)\` | an SVG drawing |
115
+ | an image alone | an image card: a phone shot sits beside the heading and caption, a landscape one spans the card between them, a 16:9 one fills it |
116
+ | an image and text | a split card: the image sits on the side written first |
117
+ | a list of images | a gallery; with \`<!-- steps -->\` a carousel, one image per press, laid out like an image card |
118
+ | \`<!-- view: full -->\` in a card | the card fills the whole screen |
119
+ | images in one paragraph | a grid, up to four a row |
120
+ | a YouTube link alone on a line | the video: the next press plays it, leaving pauses it |
121
+
122
+ The first and last cards animate in on their own. The alt text of an image is its caption.
123
+
105
124
  ### reveal.js decks
106
125
 
107
126
  Decks written for reveal.js open as they are: \`---\` starts a slide and \`--\` a vertical one beneath it, and the first slide becomes the root card.
@@ -172,7 +191,7 @@ For a file from your computer whose images sit next to it online, add \`base: ht
172
191
  | + \u2212 | bigger / smaller slides (remembered) |
173
192
  | E | editor |
174
193
  | L | light / dark |
175
- | ? | keys (also \u2328 in the bottom bar) |
194
+ | K or ? | keys (also \u2328 Keys on screen) |
176
195
  | C \xB7 V \xB7 R | camera, camera layouts, record |
177
196
 
178
197
  Click a card to fly to it. Drag to pan; scroll or pinch to zoom. On a touch screen, the bottom bar adds \u2190 \u2192 buttons.
@@ -256,9 +275,12 @@ pip_size: 24% \u2190 camera box width
256
275
  pip_shape: rect \u2190 rect (16:9) or circle
257
276
  pip_mirror: yes \u2190 mirror the webcam
258
277
  camera: 24%, 40%, full, off \u2190 layouts V cycles through
278
+ accent: "#3b82f6" \u2190 the deck's colour, instead of Slidetake's green
259
279
  ---
260
280
  \`\`\`
261
281
 
282
+ \`accent\` is one colour; Slidetake sets it bright for dark mode and deep enough to read on white for light mode, and uses it for text accents, lines, charts and diagrams.
283
+
262
284
  Slides are always placed clear of the brand and the camera box.
263
285
 
264
286
  ### Camera per slide
@@ -300,7 +322,7 @@ Your draft and settings stay in this browser. Decks inside links live in the par
300
322
  slidetake.com counts visits with Google Analytics. What it records leaves out the \`#\` part and \`?obs=\`, so neither your deck nor an OBS password reaches it. Copies you host yourself send nothing.
301
323
 
302
324
  Slidetake is open source: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).
303
- `});var Rn,Pn=W(()=>{Rn=`---
325
+ `});var Fn,Hn=j(()=>{Fn=`---
304
326
  title: My deck
305
327
  ---
306
328
 
@@ -315,7 +337,7 @@ Every heading is a card. \`##\` sections branch from the first card.
315
337
  ### A detail
316
338
 
317
339
  \`###\` branches from the section above it.
318
- `});var Dn,An=W(()=>{Dn=`---
340
+ `});var Un,Wn=j(()=>{Un=`---
319
341
  title: Talk title
320
342
  duration: 15m
321
343
  ---
@@ -356,7 +378,7 @@ Something concrete the audience will recognise.
356
378
  ## \u{1F64F} Thank you
357
379
 
358
380
  Where to find you, and the link to these slides.
359
- `});var jn,_n=W(()=>{jn=`---
381
+ `});var $n,qn=j(()=>{$n=`---
360
382
  title: Video title
361
383
  duration: 10m
362
384
  pip: bottom-right
@@ -405,50 +427,209 @@ Slides you talk over in the corner.
405
427
  <!-- camera: on, full, on, off -->
406
428
 
407
429
  Ends on you full screen, then back to the slide, then without the camera.
408
- `});function Ee(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function Ae(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function B(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}function Fn(e){if(typeof document<"u"){let t=document.createElement("textarea");return t.innerHTML=e,t.value}return e.replace(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>n[0]==="#"?String.fromCodePoint(n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10)):wa[n.toLowerCase()]??t)}function De(e){let t={};for(let n of e.matchAll(/([\w-]+)="([^"]*)"/g))t[n[1]]=n[2];return t}function nt(e,t){let n=[[]],o=null;return e.split(`
430
+ `});var Gn,Yn=j(()=>{Gn=`---
431
+ title: Slidetake examples
432
+ brand: slidetake
433
+ duration: 10m
434
+ ---
435
+
436
+ # Slidetake examples
437
+
438
+ Everything a deck can hold, written in plain markdown. Open **\u270E Editor** to see the source of any card, or press **O** for the map.
439
+
440
+ ## \u270D\uFE0F Text
441
+
442
+ Paragraphs, **bold**, *italic*, \`code\`, [links](https://slidetake.com) and lists, as markdown writes them.
443
+
444
+ - One point
445
+ - Another point
446
+ - A detail under it
447
+
448
+ ### Steps
449
+
450
+ Put \`<!-- steps -->\` before a list and it reveals one item per press:
451
+
452
+ <!-- steps -->
453
+ - First, the problem
454
+ - Then, the idea
455
+ - Finally, the result
456
+
457
+ ### Quotes and tables
458
+
459
+ > A quote stands out from the text around it.
460
+
461
+ | Plan | Price | Users |
462
+ |---|---:|---:|
463
+ | Free | \u20B90 | 1 |
464
+ | Team | \u20B9499 | 10 |
465
+
466
+ ### Code
467
+
468
+ \`\`\`python
469
+ def take(slide):
470
+ return slide.best_attempt()
471
+ \`\`\`
472
+
473
+ ## \u{1F9ED} Diagrams
474
+
475
+ Write the diagram in a fenced block named after its language.
476
+
477
+ ### Graphviz
478
+
479
+ \`\`\`dot
480
+ digraph {
481
+ rankdir=LR
482
+ node [shape=box style=rounded]
483
+ Markdown -> Deck -> Takes -> Video
484
+ }
485
+ \`\`\`
486
+
487
+ ### D2
488
+
489
+ \`\`\`d2
490
+ direction: right
491
+ write: Write {shape: rectangle}
492
+ present: Present
493
+ record: Record
494
+ write -> present -> record: one session
495
+ \`\`\`
496
+
497
+ ### SVG
498
+
499
+ \`\`\`svg
500
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 120">
501
+ <rect x="10" y="20" width="90" height="80" rx="10" fill="#22c55e"/>
502
+ <rect x="115" y="20" width="90" height="80" rx="10" fill="#22c55e" opacity=".7"/>
503
+ <rect x="220" y="20" width="90" height="80" rx="10" fill="#22c55e" opacity=".4"/>
504
+ </svg>
505
+ \`\`\`
506
+
507
+ ## \u{1F4CA} Charts
508
+
509
+ ECharts, as a fenced \`echarts\` block of JSON options.
510
+
511
+ ### A bar chart
512
+
513
+ \`\`\`echarts
514
+ {
515
+ "xAxis": {"type": "category", "data": ["Jan", "Feb", "Mar", "Apr", "May"]},
516
+ "yAxis": {"type": "value"},
517
+ "series": [{"type": "bar", "data": [12, 19, 15, 24, 30]}]
518
+ }
519
+ \`\`\`
520
+
521
+ ### A donut
522
+
523
+ \`\`\`echarts
524
+ {
525
+ "series": [{"type": "pie", "radius": ["45%", "70%"],
526
+ "data": [{"name": "Equity", "value": 85}, {"name": "Debt", "value": 5}, {"name": "Gold", "value": 10}]}]
527
+ }
528
+ \`\`\`
529
+
530
+ ## \u{1F5BC}\uFE0F Images
531
+
532
+ The layout comes from what's on the slide; the alt text is the caption.
533
+
534
+ ### One image
535
+
536
+ ![An image alone fills the card edge to edge](https://slidetake.com/og.jpg)
537
+
538
+ ### Image and text
539
+
540
+ ![Written first, so it sits on the left](https://slidetake.com/og.jpg)
541
+
542
+ An image beside text makes a split card. Write the text first and the image moves to the right.
543
+
544
+ ### A gallery
545
+
546
+ A list of images is a gallery. With \`<!-- steps -->\` it becomes a carousel: one image at a time, the next on each press.
547
+
548
+ <!-- steps -->
549
+ - ![The logo](https://slidetake.com/favicon.svg)
550
+ - ![The home-screen icon](https://slidetake.com/apple-touch-icon.png)
551
+ - ![The link preview](https://slidetake.com/og.jpg)
552
+
553
+ ### A grid
554
+
555
+ Several images in one paragraph sit side by side, up to four a row:
556
+
557
+ ![Logo](https://slidetake.com/favicon.svg) ![Icon](https://slidetake.com/apple-touch-icon.png) ![Preview](https://slidetake.com/og.jpg)
558
+
559
+ ### Full screen
560
+
561
+ <!-- view: full -->
562
+
563
+ ![A card tagged view: full fills the whole screen](https://slidetake.com/og.jpg)
564
+
565
+ ## \u25B6\uFE0F YouTube
566
+
567
+ A YouTube link alone on a line becomes the video. The next press plays it; leaving the slide pauses it.
568
+
569
+ https://www.youtube.com/watch?v=jNQXAC9IVRw
570
+
571
+ ## \u{1F3A5} Camera and map
572
+
573
+ <!-- camera: on, full, on -->
574
+ <!-- view: overview -->
575
+
576
+ Two comments do what markdown can't: \`<!-- camera: on, full, on -->\` moves the presenter's camera, and \`<!-- view: overview -->\` shows the whole map first.
577
+
578
+ ## \u{1F680} Start your own
579
+
580
+ Press **New** for a template (blank, talk or recording), or type in this deck to make it your copy.
581
+
582
+ The templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.
583
+ `});function Te(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function He(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function T(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t])}function Kn(e){if(typeof document<"u"){let t=document.createElement("textarea");return t.innerHTML=e,t.value}return e.replace(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>n[0]==="#"?String.fromCodePoint(n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10)):_a[n.toLowerCase()]??t)}function Fe(e){let t={};for(let n of e.matchAll(/([\w-]+)="([^"]*)"/g))t[n[1]]=n[2];return t}function We(e,t){let n=[[]],o=null;return e.split(`
409
584
  `).forEach(a=>{let r=a.match(/^\s{0,3}(`{3,}|~{3,})/);r&&(o?r[1][0]===o[0]&&r[1].length>=o.length&&(o=null):o=r[1]),!o&&!r&&t.test(a)?n.push([]):n[n.length-1].push(a)}),n.map(a=>a.join(`
410
- `))}function Hn(e){let t=String(e??"").trim().toLowerCase();if(!t)return 0;let n=t.match(/^(\d+):(\d{1,2})$/);if(n)return(+n[1]*60+ +n[2])*1e3;if(n=t.match(/^(\d+(?:\.\d+)?)\s*(h|hrs?|hours?|m|mins?|minutes?|s|secs?|seconds?)?$/),!n)return 0;let o=(n[2]||"m")[0];return parseFloat(n[1])*(o==="h"?3600:o==="s"?1:60)*1e3}function Y(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),a=t%60;return(n?n+":"+String(o).padStart(2,"0"):o)+":"+String(a).padStart(2,"0")}var wa,ot=W(()=>{"use strict";wa={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function Un(e){let t=null;return e.split(`
585
+ `))}function Vn(e){let t=String(e??"").trim().toLowerCase();if(!t)return 0;let n=t.match(/^(\d+):(\d{1,2})$/);if(n)return(+n[1]*60+ +n[2])*1e3;if(n=t.match(/^(\d+(?:\.\d+)?)\s*(h|hrs?|hours?|m|mins?|minutes?|s|secs?|seconds?)?$/),!n)return 0;let o=(n[2]||"m")[0];return parseFloat(n[1])*(o==="h"?3600:o==="s"?1:60)*1e3}function K(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),a=t%60;return(n?n+":"+String(o).padStart(2,"0"):o)+":"+String(a).padStart(2,"0")}var _a,lt=j(()=>{"use strict";_a={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function Jn(e){let t=null;return e.split(`
411
586
  `).filter(n=>{let o=n.match(/^\s{0,3}(`{3,}|~{3,})/);return o?(t?o[1][0]===t[0]&&o[1].length>=t.length&&(t=null):t=o[1],!1):!t}).join(`
412
- `).replace(/`[^`\n]*`/g,"")}function _t(e){return/<!--\s*view\s*:\s*(overview|map)\s*-->/i.test(Un(e))}function jt(e){let t=Un(e).match(/<!--\s*camera\s*:\s*([\s\S]*?)\s*-->/i);return t?t[1].trim():null}function ka(e){let t={},n=e.match(/^---[ \t]*\n([\s\S]*?)\n---[ \t]*(?:\n|$)/);if(!n)return{deck:t,body:e};let o=null;return n[1].split(`
413
- `).forEach(a=>{let r=a.match(/^\s+-\s+(.*)$/);if(r&&o){t[o].push(r[1].trim().replace(/^["']|["']$/g,""));return}let i=a.match(/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/);if(!i){o=null;return}let s=i[1].toLowerCase(),l=i[2].trim().replace(/^["']|["']$/g,"");l===""?(t[s]=[],o=s):(t[s]=l,o=null)}),{deck:t,body:e.slice(n[0].length)}}function Nn(e){let t=a=>typeof a=="string"||typeof a=="number"||typeof a=="boolean",n=a=>String(a).replace(/\s*\n\s*/g," "),o=[];for(let[a,r]of Object.entries(e||{}))/^[A-Za-z_][\w-]*$/.test(a)&&(t(r)?o.push(a+": "+n(r)):Array.isArray(r)&&r.every(t)&&(o.push(a+":"),r.forEach(i=>o.push(" - "+n(i)))));return o.length?`---
587
+ `).replace(/`[^`\n]*`/g,"")}function Wt(e){return/<!--\s*view\s*:\s*(overview|map)\s*-->/i.test(Jn(e))}function Ut(e){let t=Jn(e).match(/<!--\s*camera\s*:\s*([\s\S]*?)\s*-->/i);return t?t[1].trim():null}function Na(e){let t={},n=e.match(/^---[ \t]*\n([\s\S]*?)\n---[ \t]*(?:\n|$)/);if(!n)return{deck:t,body:e};let o=null;return n[1].split(`
588
+ `).forEach(a=>{let r=a.match(/^\s+-\s+(.*)$/);if(r&&o){t[o].push(r[1].trim().replace(/^["']|["']$/g,""));return}let i=a.match(/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/);if(!i){o=null;return}let s=i[1].toLowerCase(),l=i[2].trim().replace(/^["']|["']$/g,"");l===""?(t[s]=[],o=s):(t[s]=l,o=null)}),{deck:t,body:e.slice(n[0].length)}}function Zn(e){let t=a=>typeof a=="string"||typeof a=="number"||typeof a=="boolean",n=a=>String(a).replace(/\s*\n\s*/g," "),o=[];for(let[a,r]of Object.entries(e||{}))/^[A-Za-z_][\w-]*$/.test(a)&&(t(r)?o.push(a+": "+n(r)):Array.isArray(r)&&r.every(t)&&(o.push(a+":"),r.forEach(i=>o.push(" - "+n(i)))));return o.length?`---
414
589
  `+o.join(`
415
590
  `)+`
416
591
  ---
417
- `:""}function Ea(e){let t=e.split(`
592
+ `:""}function Ha(e){let t=e.split(`
418
593
  `),n={},o=e;if(t[0]!==void 0&&t[0].trim()==="---"){let a=-1;for(let r=1;r<t.length;r++)if(t[r].trim()==="---"){a=r;break}a!==-1&&(t.slice(1,a).forEach(r=>{let i=r.indexOf(":");i>-1&&(n[r.slice(0,i).trim()]=r.slice(i+1).trim().replace(/^["']|["']$/g,""))}),o=t.slice(a+1).join(`
419
- `).replace(/^\n+/,""))}return{meta:n,body:o}}function Sa(e){let t=e.replace(/<!--[\s\S]*?-->/g,""),n=t.match(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/m),o=t.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i),a=null;if(n&&(!o||n.index<o.index)?a=n[1]:o&&(a=o[1].replace(/<[^>]+>/g," ")),!a){let r=t.split(`
420
- `).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));a=r?r.slice(0,60):null}return a?Fn(Ae(a)).replace(/\s+/g," ").trim():null}function Wn(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?De(t[1]):{}}function qn(e,{render:t=n=>({html:n,err:null})}={}){let n=new Map,o=h=>{let C=h,x=2;for(;n.has(C);)C=h+"-"+x++;return C},a=h=>(n.set(h.id,{x:null,y:null,children:[],...h}),h.id);e=e.replace(/\r\n?/g,`
421
- `);let r=/^\+\+\+[ \t]*$/m.test(e),i={};r||({deck:i,body:e}=ka(e));let s=!r&&(/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||""))||nt(e,/^--\s*$/).length>1),l=r?g():s?j():d();return n.forEach(h=>{(!h.parent||h.parent===h.id||!n.has(h.parent))&&(h.parent=null)}),n.forEach(h=>{let C=new Set([h.id]),x=h.parent;for(;x;){if(C.has(x)){h.parent=null;break}C.add(x),x=n.get(x).parent}}),n.forEach(h=>{h.parent&&n.get(h.parent).children.push(h.id)}),{deck:i,nodes:n,format:r?"+++":s?"reveal":"headings",errCount:l};function d(){let h=[],C=null,x=null,b={level:0,title:null,explicitId:null,lines:[]};e.split(`
422
- `).forEach(E=>{let m=E.match(/^\s{0,3}(`{3,}|~{3,})/);m&&(x?m[1][0]===x[0]&&m[1].length>=x.length&&(x=null):x=m[1]);let S=!x&&!m?E.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(S){let R=S[2],ie=null,te=R.match(/\s*\{#([\w\-:.]+)\}\s*$/);te&&(ie=te[1],R=R.slice(0,te.index)),C={level:S[1].length,title:Ae(R),explicitId:ie,lines:[S[1]+" "+R]},h.push(C)}else(C||b).lines.push(E)});let A=b.lines.join(`
423
- `);A.trim()&&(h.length&&!A.replace(/<!--[\s\S]*?-->/g,"").trim()?h[0].lines.splice(1,0,...b.lines):h.unshift(b));let w=[];return h.forEach(E=>{for(;w.length&&w[w.length-1].level>=E.level;)w.pop();let m=w.length?w[w.length-1].id:null,S=E.lines.join(`
424
- `).trim(),R=E.title||Ae((S.split(`
425
- `).find(me=>me.trim())||"Intro").slice(0,48));E.id=o(E.explicitId||Ee(R));let{html:ie,err:te}=t(S);a({id:E.id,parent:m,title:R,html:ie,err:te,camera:jt(S),mapFirst:_t(S)}),w.push(E)}),0}function g(){let h=e.split(/\n\+\+\+[ \t]*\n/).map(b=>b.trim()).filter(b=>b.length),C=null,x=0;return h.forEach((b,A)=>{let{meta:w,body:E}=Ea(b),m=o(w.id||"slide-"+(A+1)),S="parent"in w?w.parent||null:C,R=E.match(/^#{1,6}\s+(.+)$/m),ie=w.title||(R?Ae(R[1]):m),{html:te,err:me}=t(E);me&&x++,a({id:m,parent:S,title:ie,html:te,err:me,camera:w.camera||jt(E),mapFirst:_t(E),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),C=m}),x}function j(){let h=0,C=0,x=null;function b(w,E){let m=w.body.trim();C++;let S=Sa(m)||"Slide "+C,R=E?n.get(E).title:null;R&&S.startsWith(R+" / ")&&(S=S.slice(R.length+3));let ie=o(Ee(S)),{html:te,err:me}=t(m);return me&&h++,a({id:ie,parent:E,title:S,html:te,err:me,camera:jt(m),mapFirst:_t(m),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let A=[];return nt(e,/^---\s*$/).forEach(w=>{if(/<section\b/i.test(w)){for(let S of w.matchAll(/<section\b([^>]*)>([\s\S]*?)<\/section>/gi))A.push([{body:S[2],attrs:De(S[1])}]);let m=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");m.trim()&&A.push([{body:m,attrs:Wn(m)}]);return}let E=nt(w,/^--\s*$/).filter(m=>m.trim()).map(m=>({body:m,attrs:Wn(m)}));E.length&&A.push(E)}),A.forEach(w=>{let E=null;w.forEach((m,S)=>{if(!x){x=E=b(m,null);return}S===0?E=b(m,x):b(m,E)})}),h}}var $n=W(()=>{"use strict";ot()});function at(e,t){return String(t||"").toLowerCase().split(/\s+/).forEach(n=>{n&&(n==="off"||n==="hide"?e.off=!0:n==="on"||n==="pip"||n==="show"?(e.off=!1,e.full=!1,e.used=!0):n==="full"||n==="fullscreen"?(e.full=!0,e.off=!1,e.used=!0):/^\d+(\.\d+)?%?$/.test(n)?(e.size=Ft(parseFloat(n)),e.used=!0):_e.includes(n)?(e.corner=n,e.used=!0):n==="flip"?(e.flip=!e.flip,e.used=!0):n==="circle"?e.circle=!0:n==="rect"?e.circle=!1:n==="mirror"?e.mirror=!0:(n==="unmirror"||n==="no-mirror")&&(e.mirror=!1))}),e}function Yn(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function Gn(e,t){let n=[];if(!e.length){for(let a=0;a<=t;a++)n.push({cam:0,frag:a});return n}let o=e.findIndex(a=>!at({},a).full);o<0&&(o=e.length-1);for(let a=0;a<=o;a++)n.push({cam:a,frag:0});for(let a=1;a<=t;a++)n.push({cam:o,frag:a});for(let a=o+1;a<e.length;a++)n.push({cam:a,frag:t});return n}var _e,Ft,Kn=W(()=>{"use strict";_e=["top-left","top-right","bottom-left","bottom-right"],Ft=e=>Math.max(8,Math.min(60,e))});function Vn(e){let t=String(e||"").trim();if(!t)return null;let n;try{n=new URL(/^[a-z]+:\/\//i.test(t)?t:"https://"+t)}catch{return null}let o=n.pathname.split("/").filter(Boolean);if(n.hostname==="github.com"||n.hostname==="www.github.com"){let[a,r,i,s,...l]=o;if(a&&r&&(i==="blob"||i==="raw"||i==="tree")&&s){let d=l.join("/");return(i==="tree"||!/\.(md|markdown|txt)$/i.test(d))&&(d=(d?d+"/":"")+"index.md"),{kind:"url",url:Ht+[a,r,s].join("/")+"/"+d}}if(a&&r&&!i)return{kind:"url",url:Ht+a+"/"+r+"/HEAD/README.md"}}if(n.hostname==="gist.github.com"){let a=o.length>=2?o[1]:o[0];if(a&&/^[\da-f]+$/i.test(a))return{kind:"gist",id:a}}if(n.hostname==="slidetake.com"||n.hostname==="www.slidetake.com"){let a=Wt(n.pathname);if(a)return a;let r=n.searchParams.get("src");if(r)return{kind:"url",url:r}}return{kind:"url",url:n.href}}function Wt(e){let t=String(e||"").split("/").filter(Boolean).map(n=>{try{return decodeURIComponent(n)}catch{return n}});if(t[0]==="gh"&&t.length>=4){let[,n,o,...a]=t,r=o.indexOf("@"),i=r<0?o:o.slice(0,r),s=r<0?"HEAD":o.slice(r+1);return!n||!i||!s?null:{kind:"url",url:Ht+[n,i,s,...a].map(encodeURIComponent).join("/")}}return t.length===1&&t[0]==="help"?{kind:"builtin",id:"help"}:t[0]==="gist"&&t[1]&&/^[\da-f]+$/i.test(t[1])?t[2]?{kind:"gist",id:t[1],file:t[2]}:{kind:"gist",id:t[1]}:null}function Xn(e){if(e.kind==="builtin")return e.id==="home"?"/":e.id.startsWith("template:")?"/new?template="+e.id.slice(9):"/"+e.id;if(e.kind==="gist")return"/gist/"+e.id+(e.file?"/"+encodeURIComponent(e.file):"");let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/([^/]+)\/(.+)$/);if(t){let[,n,o,a,r]=t;if(!/^refs$/.test(a))return"/gh/"+n+"/"+o+(a==="HEAD"?"":"@"+a)+"/"+r}return"/?src="+encodeURIComponent(e.url)}var Ht,Ut=W(()=>{"use strict";Ht="https://raw.githubusercontent.com/"});function La(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ca(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,n=>n.charCodeAt(0))}async function Jn(e,t){let n=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await n.arrayBuffer())}async function Zn(e){return La(await Jn(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function Qn(e){return new TextDecoder().decode(await Jn(Ca(e),new DecompressionStream("deflate-raw")))}function rt(e){let t=e.replace(/^#/,"");if(!t.startsWith(Nt)){let r=t;try{r=decodeURIComponent(t)}catch{}return{data:null,slide:r}}let n=t.slice(Nt.length),o=n.indexOf("~"),a=o<0?"":n.slice(o+1);try{a=decodeURIComponent(a)}catch{}return{data:o<0?n:n.slice(0,o),slide:a}}function qt(e,t){return"#"+Nt+e+(t?"~"+encodeURIComponent(t):"")}var Nt,$t=W(()=>{"use strict";Nt="deflate:"});function eo(e,t,n){let o=e.replace(/\/+$/,"")||"/",a=new URLSearchParams(t),{data:r,slide:i}=rt(n);if(o==="/share")return r?{page:"share",data:r,slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:""};if(o==="/edit")return{page:"edit",slide:i};if(o==="/new"){let d=a.get("template");return d&&Ta.includes(d)?{page:"source",source:{kind:"builtin",id:"template:"+d},slide:i}:{page:"pick"}}let s=Wt(o);if(s)return{page:"source",source:s,slide:i};let l=a.get("src");return o==="/"&&l?{page:"source",source:{kind:"url",url:l},slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:i}}function ne(e){switch(e.kind){case"builtin":return e.id==="home"?"Home":e.id==="help"?"Help":"the "+e.id.replace(/^template:/,"")+" template";case"gist":return"a gist"+(e.file?" ("+e.file+")":"");case"shared":return"a shared deck";case"file":return e.name;case"url":{let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/[^/]+\/(.+)$/);if(t)return t[1]+"/"+t[2]+"/"+t[3];try{let n=new URL(e.url);return n.hostname+n.pathname}catch{return e.url}}}}function it(e,t,{exported:n=!1}={}){return{text:e,origin:t,originText:e,exported:n?e:null}}function st(e){return e.text!==(e.exported??e.originText)}function lt(e){return e.text===e.originText}function to(e){try{let t=JSON.parse(e||"null");return!t||typeof t.text!="string"||!t.origin||typeof t.origin.kind!="string"?null:{text:t.text,origin:t.origin,originText:typeof t.originText=="string"?t.originText:t.text,exported:typeof t.exported=="string"?t.exported:null}}catch{return null}}var Ta,no=W(()=>{"use strict";Ut();$t();Ta=["blank","talk","recording"]});function je(e){let t=new Map,n=e.totalObs??e.total;return e.events.forEach((o,a)=>{t.has(o.id)||t.set(o.id,{id:o.id,title:o.title,takes:[]});let r=t.get(o.id),i=e.events[a+1];r.takes.push({no:r.takes.length+1,start:oo(o),end:i?oo(i):n})}),t}function Fe(e){let t=[],n=dt(e);return je(e).forEach(o=>{let a=e.picks[o.id]??o.takes.length;if(!a)return;let r=o.takes[a-1];if(!r)return;let i=ao(r.start,n),s=ao(r.end,n);s>i&&t.push({id:o.id,title:o.title,f0:i,f1:s,start:i*1e3/n,end:s*1e3/n})}),t}function Ma(e){let t=[];return e.forEach(n=>{let o=t[t.length-1];o&&n.f0===o.f1?(o.f1=n.f1,o.end=n.end):t.push({f0:n.f0,f1:n.f1,start:n.start,end:n.end})}),t}function Yt(e,t){let n=0,o=[];return Fe(e).forEach(a=>{let{sec:r,title:i}=t(a.id,a.title),s=o[o.length-1];(!s||s.sec!==r&&s.title!==i)&&o.push({sec:r,title:i,t:n}),n+=a.end-a.start}),{list:o,length:n}}function io(e,t){let{list:n,length:o}=Yt(e,t),a=n.filter((r,i)=>i===0||(n[i+1]?n[i+1].t:o)-r.t>=1e4);return a.length&&(a[0].t=0),{lines:a.map(r=>Y(r.t)+" "+r.title),dropped:n.length-a.length,length:o}}function so(e,t,{input:n,outputName:o,sectionOf:a}){let r=Ma(Fe(e));if(!e.withObs)return"# This was a rehearsal: nothing was recorded.";if(!r.length)return"# Every slide is left out: nothing to render.";let i=Ba(n)+o,{list:s,length:l}=Yt(e,a),d=m=>String(m).replace(/[=;#\\\n]/g,S=>"\\"+S),j=`cat > /tmp/slidetake-chapters.txt <<'EOF'
594
+ `).replace(/^\n+/,""))}return{meta:n,body:o}}function Fa(e){let t=e.replace(/<!--[\s\S]*?-->/g,""),n=t.match(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/m),o=t.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i),a=null;if(n&&(!o||n.index<o.index)?a=n[1]:o&&(a=o[1].replace(/<[^>]+>/g," ")),!a){let r=t.split(`
595
+ `).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));a=r?r.slice(0,60):null}return a?Kn(He(a)).replace(/\s+/g," ").trim():null}function Xn(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?Fe(t[1]):{}}function Qn(e,{render:t=n=>({html:n,err:null})}={}){let n=new Map,o=b=>{let S=b,g=2;for(;n.has(S);)S=b+"-"+g++;return S},a=b=>(n.set(b.id,{x:null,y:null,children:[],...b}),b.id);e=e.replace(/\r\n?/g,`
596
+ `);let r=/^\+\+\+[ \t]*$/m.test(e),i={};r||({deck:i,body:e}=Na(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!r&&(We(e,/^--\s*$/).length>1||s&&We(e,/^---\s*$/).length>1),d=r?N():l?O():f();return n.forEach(b=>{(!b.parent||b.parent===b.id||!n.has(b.parent))&&(b.parent=null)}),n.forEach(b=>{let S=new Set([b.id]),g=b.parent;for(;g;){if(S.has(g)){b.parent=null;break}S.add(g),g=n.get(g).parent}}),n.forEach(b=>{b.parent&&n.get(b.parent).children.push(b.id)}),{deck:i,nodes:n,format:r?"+++":l?"reveal":"headings",errCount:d};function f(){let b=[],S=null,g=null,B={level:0,title:null,explicitId:null,lines:[]};e.split(`
597
+ `).forEach(m=>{let v=m.match(/^\s{0,3}(`{3,}|~{3,})/);v&&(g?v[1][0]===g[0]&&v[1].length>=g.length&&(g=null):g=v[1]);let L=!g&&!v?m.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(L){let D=L[2],le=null,ne=D.match(/\s*\{#([\w\-:.]+)\}\s*$/);ne&&(le=ne[1],D=D.slice(0,ne.index)),S={level:L[1].length,title:He(D),explicitId:le,lines:[L[1]+" "+D]},b.push(S)}else(S||B).lines.push(m)});let G=B.lines.join(`
598
+ `);G.trim()&&(b.length&&!G.replace(/<!--[\s\S]*?-->/g,"").trim()?b[0].lines.splice(1,0,...B.lines):b.unshift(B));let w=[];return b.forEach(m=>{for(;w.length&&w[w.length-1].level>=m.level;)w.pop();let v=w.length?w[w.length-1].id:null,L=m.lines.join(`
599
+ `).trim(),D=m.title||He((L.split(`
600
+ `).find(be=>be.trim())||"Intro").slice(0,48));m.id=o(m.explicitId||Te(D));let{html:le,err:ne}=t(L);a({id:m.id,parent:v,title:D,html:le,err:ne,camera:Ut(L),mapFirst:Wt(L)}),w.push(m)}),0}function N(){let b=e.split(/\n\+\+\+[ \t]*\n/).map(B=>B.trim()).filter(B=>B.length),S=null,g=0;return b.forEach((B,G)=>{let{meta:w,body:m}=Ha(B),v=o(w.id||"slide-"+(G+1)),L="parent"in w?w.parent||null:S,D=m.match(/^#{1,6}\s+(.+)$/m),le=w.title||(D?He(D[1]):v),{html:ne,err:be}=t(m);be&&g++,a({id:v,parent:L,title:le,html:ne,err:be,camera:w.camera||Ut(m),mapFirst:Wt(m),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),S=v}),g}function O(){let b=0,S=0,g=null;function B(w,m){let v=w.body.trim();S++;let L=Fa(v)||"Slide "+S,D=m?n.get(m).title:null;D&&L.startsWith(D+" / ")&&(L=L.slice(D.length+3));let le=o(Te(L)),{html:ne,err:be}=t(v);return be&&b++,a({id:le,parent:m,title:L,html:ne,err:be,camera:Ut(v),mapFirst:Wt(v),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let G=[];return We(e,/^---\s*$/).forEach(w=>{if(/<section\b/i.test(w)){for(let L of w.matchAll(/<section\b([^>]*)>([\s\S]*?)<\/section>/gi))G.push([{body:L[2],attrs:Fe(L[1])}]);let v=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");v.trim()&&G.push([{body:v,attrs:Xn(v)}]);return}let m=We(w,/^--\s*$/).filter(v=>v.trim()).map(v=>({body:v,attrs:Xn(v)}));m.length&&G.push(m)}),G.forEach(w=>{let m=null;w.forEach((v,L)=>{if(!g){g=m=B(v,null);return}L===0?m=B(v,g):B(v,m)})}),b}}var eo=j(()=>{"use strict";lt()});function ct(e,t){return String(t||"").toLowerCase().split(/\s+/).forEach(n=>{n&&(n==="off"||n==="hide"?e.off=!0:n==="on"||n==="pip"||n==="show"?(e.off=!1,e.full=!1,e.used=!0):n==="full"||n==="fullscreen"?(e.full=!0,e.off=!1,e.used=!0):/^\d+(\.\d+)?%?$/.test(n)?(e.size=qt(parseFloat(n)),e.used=!0):Ue.includes(n)?(e.corner=n,e.used=!0):n==="flip"?(e.flip=!e.flip,e.used=!0):n==="circle"?e.circle=!0:n==="rect"?e.circle=!1:n==="mirror"?e.mirror=!0:(n==="unmirror"||n==="no-mirror")&&(e.mirror=!1))}),e}function to(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function no(e,t){let n=[];if(!e.length){for(let a=0;a<=t;a++)n.push({cam:0,frag:a});return n}let o=e.findIndex(a=>!ct({},a).full);o<0&&(o=e.length-1);for(let a=0;a<=o;a++)n.push({cam:a,frag:0});for(let a=1;a<=t;a++)n.push({cam:o,frag:a});for(let a=o+1;a<e.length;a++)n.push({cam:a,frag:t});return n}var Ue,qt,oo=j(()=>{"use strict";Ue=["top-left","top-right","bottom-left","bottom-right"],qt=e=>Math.max(8,Math.min(60,e))});function ao(e){let t=String(e||"").trim();if(!t)return null;let n;try{n=new URL(/^[a-z]+:\/\//i.test(t)?t:"https://"+t)}catch{return null}let o=n.pathname.split("/").filter(Boolean);if(n.hostname==="github.com"||n.hostname==="www.github.com"){let[a,r,i,s,...l]=o;if(a&&r&&(i==="blob"||i==="raw"||i==="tree")&&s){let d=l.join("/");return(i==="tree"||!/\.(md|markdown|txt)$/i.test(d))&&(d=(d?d+"/":"")+"index.md"),{kind:"url",url:$t+[a,r,s].join("/")+"/"+d}}if(a&&r&&!i)return{kind:"url",url:$t+a+"/"+r+"/HEAD/README.md"}}if(n.hostname==="gist.github.com"){let a=o.length>=2?o[1]:o[0];if(a&&/^[\da-f]+$/i.test(a))return{kind:"gist",id:a}}if(n.hostname==="slidetake.com"||n.hostname==="www.slidetake.com"){let a=Yt(n.pathname);if(a)return a;let r=n.searchParams.get("src");if(r)return{kind:"url",url:r}}return{kind:"url",url:n.href}}function Yt(e){let t=String(e||"").split("/").filter(Boolean).map(n=>{try{return decodeURIComponent(n)}catch{return n}});if(t[0]==="gh"&&t.length>=4){let[,n,o,...a]=t,r=o.indexOf("@"),i=r<0?o:o.slice(0,r),s=r<0?"HEAD":o.slice(r+1);return!n||!i||!s?null:{kind:"url",url:$t+[n,i,s,...a].map(encodeURIComponent).join("/")}}return t.length===1&&t[0]==="help"?{kind:"builtin",id:"help"}:t.length===1&&t[0]==="examples"?{kind:"builtin",id:"showcase"}:t[0]==="gist"&&t[1]&&/^[\da-f]+$/i.test(t[1])?t[2]?{kind:"gist",id:t[1],file:t[2]}:{kind:"gist",id:t[1]}:null}function ro(e){if(e.kind==="builtin")return e.id==="home"?"/":e.id==="showcase"?"/examples":e.id.startsWith("template:")?"/new?template="+e.id.slice(9):"/"+e.id;if(e.kind==="gist")return"/gist/"+e.id+(e.file?"/"+encodeURIComponent(e.file):"");let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/([^/]+)\/(.+)$/);if(t){let[,n,o,a,r]=t;if(!/^refs$/.test(a))return"/gh/"+n+"/"+o+(a==="HEAD"?"":"@"+a)+"/"+r}return"/?src="+encodeURIComponent(e.url)}var $t,Gt=j(()=>{"use strict";$t="https://raw.githubusercontent.com/"});function Wa(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ua(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,n=>n.charCodeAt(0))}async function io(e,t){let n=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await n.arrayBuffer())}async function so(e){return Wa(await io(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function lo(e){return new TextDecoder().decode(await io(Ua(e),new DecompressionStream("deflate-raw")))}function dt(e){let t=e.replace(/^#/,"");if(!t.startsWith(Kt)){let r=t;try{r=decodeURIComponent(t)}catch{}return{data:null,slide:r}}let n=t.slice(Kt.length),o=n.indexOf("~"),a=o<0?"":n.slice(o+1);try{a=decodeURIComponent(a)}catch{}return{data:o<0?n:n.slice(0,o),slide:a}}function Vt(e,t){return"#"+Kt+e+(t?"~"+encodeURIComponent(t):"")}var Kt,Xt=j(()=>{"use strict";Kt="deflate:"});function co(e,t,n){let o=e.replace(/\/+$/,"")||"/",a=new URLSearchParams(t),{data:r,slide:i}=dt(n);if(o==="/share")return r?{page:"share",data:r,slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:""};if(o==="/edit")return{page:"edit",slide:i};if(o==="/new"){let d=a.get("template");return d&&qa.includes(d)?{page:"source",source:{kind:"builtin",id:"template:"+d},slide:i}:{page:"pick"}}let s=Yt(o);if(s)return{page:"source",source:s,slide:i};let l=a.get("src");return o==="/"&&l?{page:"source",source:{kind:"url",url:l},slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:i}}function oe(e){switch(e.kind){case"builtin":return e.id==="home"?"Home":e.id==="help"?"Help":e.id==="showcase"?"the examples":"the "+e.id.replace(/^template:/,"")+" template";case"gist":return"a gist"+(e.file?" ("+e.file+")":"");case"shared":return"a shared deck";case"file":return e.name;case"url":{let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/[^/]+\/(.+)$/);if(t)return t[1]+"/"+t[2]+"/"+t[3];try{let n=new URL(e.url);return n.hostname+n.pathname}catch{return e.url}}}}function pt(e,t,{exported:n=!1}={}){return{text:e,origin:t,originText:e,exported:n?e:null}}function ut(e){return e.text!==(e.exported??e.originText)}function ht(e){return e.text===e.originText}function po(e){try{let t=JSON.parse(e||"null");return!t||typeof t.text!="string"||!t.origin||typeof t.origin.kind!="string"?null:{text:t.text,origin:t.origin,originText:typeof t.originText=="string"?t.originText:t.text,exported:typeof t.exported=="string"?t.exported:null}}catch{return null}}var qa,uo=j(()=>{"use strict";Gt();Xt();qa=["blank","talk","recording"]});function ho(e){let t;try{t=new URL(e)}catch{return null}let n=t.hostname.replace(/^(www\.|m\.)/,""),o=null,a=!1;if(n==="youtu.be")o=t.pathname.slice(1).split("/")[0];else if(n==="youtube.com"||n==="youtube-nocookie.com"){let r=t.pathname.split("/").filter(Boolean);r[0]==="watch"?o=t.searchParams.get("v"):["shorts","live","embed"].includes(r[0])&&(o=r[1]||null,a=r[0]==="shorts")}return!o||!/^[\w-]{6,}$/.test(o)?null:{id:o,start:$a(t.searchParams.get("t")||t.searchParams.get("start")||""),portrait:a}}function $a(e){if(/^\d+$/.test(e))return+e;let t=e.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);return t&&e?+(t[1]||0)*3600+ +(t[2]||0)*60+ +(t[3]||0):0}function mo(e){return"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(e.id)+"?enablejsapi=1&rel=0&playsinline=1"+(e.start?"&start="+e.start:"")}var fo=j(()=>{"use strict"});function qe(e){let t=new Map,n=e.totalObs??e.total;return e.events.forEach((o,a)=>{t.has(o.id)||t.set(o.id,{id:o.id,title:o.title,takes:[]});let r=t.get(o.id),i=e.events[a+1];r.takes.push({no:r.takes.length+1,start:go(o),end:i?go(i):n})}),t}function $e(e){let t=[],n=ft(e);return qe(e).forEach(o=>{let a=e.picks[o.id]??o.takes.length;if(!a)return;let r=o.takes[a-1];if(!r)return;let i=bo(r.start,n),s=bo(r.end,n);s>i&&t.push({id:o.id,title:o.title,f0:i,f1:s,start:i*1e3/n,end:s*1e3/n})}),t}function Ya(e){let t=[];return e.forEach(n=>{let o=t[t.length-1];o&&n.f0===o.f1?(o.f1=n.f1,o.end=n.end):t.push({f0:n.f0,f1:n.f1,start:n.start,end:n.end})}),t}function Jt(e,t){let n=0,o=[];return $e(e).forEach(a=>{let{sec:r,title:i}=t(a.id,a.title),s=o[o.length-1];(!s||s.sec!==r&&s.title!==i)&&o.push({sec:r,title:i,t:n}),n+=a.end-a.start}),{list:o,length:n}}function vo(e,t){let{list:n,length:o}=Jt(e,t),a=n.filter((r,i)=>i===0||(n[i+1]?n[i+1].t:o)-r.t>=1e4);return a.length&&(a[0].t=0),{lines:a.map(r=>K(r.t)+" "+r.title),dropped:n.length-a.length,length:o}}function xo(e,t,{input:n,outputName:o,sectionOf:a}){let r=Ya($e(e));if(!e.withObs)return"# This was a rehearsal: nothing was recorded.";if(!r.length)return"# Every slide is left out: nothing to render.";let i=Ga(n)+o,{list:s,length:l}=Jt(e,a),d=m=>String(m).replace(/[=;#\\\n]/g,v=>"\\"+v),N=`cat > /tmp/slidetake-chapters.txt <<'EOF'
426
601
  `+(`;FFMETADATA1
427
602
  title=`+d(e.deckTitle)+`
428
- `+s.map((m,S)=>`[CHAPTER]
603
+ `+s.map((m,v)=>`[CHAPTER]
429
604
  TIMEBASE=1/1000
430
605
  START=`+Math.round(m.t)+`
431
- END=`+Math.round(s[S+1]?s[S+1].t:l)+`
606
+ END=`+Math.round(s[v+1]?s[v+1].t:l)+`
432
607
  title=`+d(m.title)).join(`
433
608
  `))+`
434
609
  EOF
435
- `,h=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let m=r.map(R=>"file "+ct(n)+`
436
- inpoint `+ro(R.start)+`
437
- outpoint `+ro(R.end)).join(`
610
+ `,O=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let m=r.map(L=>"file "+mt(n)+`
611
+ inpoint `+yo(L.start)+`
612
+ outpoint `+yo(L.end)).join(`
438
613
  `);return(r.length>1?`# Careful: without re-encoding, cuts can only land on keyframes (OBS puts one about every 2 s),
439
614
  # so `+(r.length===2?"the cut":"each of the "+(r.length-1)+" cuts")+` here may keep or lose up to ~2 s. Use a frame-accurate option for retakes.
440
615
  `:"")+`cat > /tmp/slidetake-cuts.txt <<'EOF'
441
616
  `+m+`
442
617
  EOF
443
- `+j+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+h+" -c copy -movflags +faststart "+ct(i)}let C=dt(e),x=m=>(m/C).toFixed(6),b=m=>((m-.5)/C).toFixed(6),A=r.map(m=>"gte(t,"+b(m.f0)+")*lt(t,"+b(m.f1)+")").join("+"),w=r.map(m=>"gte(t,"+x(m.f0)+")*lt(t,"+x(m.f1)+")").join("+"),E=t==="mac"?"-c:v h264_videotoolbox -b:v 12M":"-c:v libx264 -crf 18 -preset medium";return j+"ffmpeg -i "+ct(n)+" -i /tmp/slidetake-chapters.txt"+h+` -vf "select='`+A+`',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='`+w+`',asetpts=N/SR/TB" `+E+" -c:a aac -b:a 192k -movflags +faststart "+ct(i)}var oo,dt,ao,Se,Ba,ct,ro,lo=W(()=>{"use strict";ot();oo=e=>e.obsT??e.t,dt=e=>e.fps||60,ao=(e,t)=>Math.round(e*t/1e3);Se=e=>String(e||"").split(/[\\/]/).pop()||"",Ba=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},ct=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",ro=e=>(e/1e3).toFixed(3)});var Yr={};function J(e){try{let t=localStorage.getItem(e);if(t!==null||!e.startsWith("slidetake:"))return t;let n=e.slice(10);return localStorage.getItem("slidetake:"+n)??localStorage.getItem("traverse:"+n)}catch{return null}}function Z(e,t){try{localStorage.setItem(e,t)}catch{}}function Fa(e){try{return{html:window.marked?window.marked.parse(e):"<pre>"+B(e)+"</pre>",err:null}}catch{return{html:"<p>(could not render)</p>",err:"render error"}}}function ft(){let e=y.brand||"",t=y.logo||"",n=/^chip$/i.test(y.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+To+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+B(t)+'">':"")+(e?"<span"+(n?' class="chip"':"")+">"+B(e)+"</span>":"");if(se.dataset.html!==o){se.dataset.html=o,se.innerHTML=o;let r=se.querySelector("img");r&&(r.onload=r.onerror=()=>ee(!0))}se.hidden=!o,hn(),document.title=y.title||"Slidetake";let a=String(y.theme||y.palette||"").toLowerCase();a?document.body.dataset.palette=a:delete document.body.dataset.palette,Mo()}function un(){if(M&&M.themeKey&&!uo){let t=J(M.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(uo||J("slidetake:mode")||y.mode||"dark").toLowerCase()==="light"?"light":"dark"}function Mo(){let e=un()==="light";e?document.body.dataset.mode="light":delete document.body.dataset.mode;let t=document.getElementById("btn-mode");t&&(t.innerHTML=e?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4.5"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>',t.title=(e?"Dark theme":"Light theme")+" (L)",t.setAttribute("aria-label",t.title))}function Bo(){let e=un()==="light"?"dark":"light";M&&M.themeKey?(Z(M.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):Z("slidetake:mode",e),Mo(),G.querySelector(".echarts-container")&&Bt(!0)}function Ha(){let t=(y.camera||"").replace(/^\[|\]$/g,"").split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function en(e){return!N&&e?Yn(e.camera):[]}function ke(e){return Gn(en(e),e&&e.frags?e.frags.length:0)}function Oo(){let e=ke(c.get(p));return e[Math.min(Q,e.length-1)]||{cam:0,frag:0}}function Wa(){if(!p)return null;let e=en(c.get(p));if(e.length)return e[Math.min(Oo().cam,e.length-1)];for(let t=f.indexOf(p)-1;t>=0;t--){let n=en(c.get(f[t]));if(n.length)return n[n.length-1]}return null}function Ua(){let e={corner:(y.pip||"none").toLowerCase(),size:Ft(parseFloat(y.pip_size)||24),circle:(y.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(y.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return at(e,Wa()),at(e,he),!_e.includes(e.corner)&&(U||e.used)&&(e.corner="bottom-right"),e.flip&&_e.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function hn(){let e=!O.hidden&&O.offsetWidth?O.getBoundingClientRect():null,t=Me=Ua(),n=_e.includes(t.corner);if(O.className=n?[t.corner,t.circle&&"circle",U&&"live",t.mirror&&"mirror",t.full&&"full"].filter(Boolean).join(" "):"",O.style.width=t.size+"%",O.hidden=!n||N||t.off,ja.dataset.pip=O.hidden||t.full?"none":t.corner,O.hidden||ze||!O.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){O.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let a=O.getBoundingClientRect();Math.abs(e.left-a.left)+Math.abs(e.top-a.top)+Math.abs(e.width-a.width)+Math.abs(e.height-a.height)<2||O.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-a.left)+"px,"+(e.top-a.top)+"px) scale("+e.width/a.width+","+e.height/a.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function Na(){let e=Me;if(!e||O.hidden||e.full)return null;let t=T.clientWidth,n=T.clientHeight,o=16,a=t*e.size/100,r=e.circle?a:a*9/16,i=e.corner.includes("left")?o:t-o-a,s=e.corner.includes("top")?o:n-o-r;return{x0:i,y0:s,x1:i+a,y1:s+r}}function qa(){if(!Ct)return;if(N){Cn(!0);return}let e=Ha();le=(le+1)%e.length,he=e[le],hn(),D||Ce("Camera: "+he),!U&&!O.hidden?et():ee()}function Io(e){let t=qn(e,{render:Fa});y=t.deck,c=t.nodes,ft();let n={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Oa.textContent=c.size+(c.size===1?" card":" cards")+" \xB7 "+n,Ye.textContent=t.errCount?t.errCount+" card(s) had errors":""}function zo(){re=[...c.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,a){let r=c.get(o);if(r.depth=a,r.children.length===0)r._slot=e++;else{r.children.forEach(s=>t(s,a+1));let i=r.children.map(s=>c.get(s)._slot);r._slot=(Math.min(...i)+Math.max(...i))/2}}re.forEach(o=>t(o,0)),f=[];function n(o){f.push(o),c.get(o).children.forEach(n)}return re.forEach(n),Math.max(1,e)}function $a(){let e=[],t=[],n=[];return c.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),n[o.depth]=(n[o.depth]||0)+1}),{maxH:e,maxW:t,count:n,maxDepth:e.length-1}}function Po(e){e.x!==null&&!isNaN(e.x)&&(e.cx=e.x+e._w/2),e.y!==null&&!isNaN(e.y)&&(e.cy=e.y+e._h/2)}function Ya(){let{maxH:e,maxDepth:t}=$a(),n=[0];for(let l=1;l<=t;l++)n[l]=n[l-1]+e[l-1]+Pa;let o=za-Ge,a=[],r=(l,d)=>{let g=c.get(l);g.cx+=d,g.children.forEach(j=>r(j,d))},i=l=>{let d=c.get(l);a[d.depth]=Math.max(a[d.depth]??-1/0,d.cx+d._w/2),d.children.forEach(i)};function s(l){let d=c.get(l),g=a[d.depth]!==void 0?a[d.depth]+o:-1/0;d.children.length?(d.children.forEach(s),d.cx=(c.get(d.children[0]).cx+c.get(d.children[d.children.length-1]).cx)/2,d.cx-d._w/2<g&&r(l,g-(d.cx-d._w/2))):d.cx=(g===-1/0?0:g)+d._w/2,i(l)}re.forEach(s),c.forEach(l=>{l.cy=n[l.depth]+l._h/2,Po(l)})}function Ga(e){let t=Math.PI*2/e,n=32,o=[],a=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+n&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+n,r=Math.max(0,...[...c.values()].map(s=>s.depth)),i=0;for(let s=0;s<=r;s++){let l=[...c.values()].filter(g=>g.depth===s);if(!l.length)continue;let d=s===0?re.length>1?Aa*.5:0:i+Ra;for(let g=0;g<400&&(l.forEach(h=>{let C=(h._slot+.5)*t-Math.PI/2;h.cx=d*Math.cos(C),h.cy=d*Math.sin(C),Po(h)}),!!l.some((h,C)=>l.some((x,b)=>b>C&&a(h,x))||o.some(x=>a(h,x))));g++)d=d*1.02+10;i=d,o.push(...l)}}function Ka(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);n.forEach(o=>{let a=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!a)return;let r=o.previousSibling;for(;r&&r.nodeType===3&&!r.data.trim();)r=r.previousSibling;let i=r&&r.nodeType===1?r:o.parentElement;i&&Object.entries(De(a[1])).forEach(([s,l])=>{s==="class"?i.classList.add(...l.split(/\s+/).filter(Boolean)):s==="style"?i.style.cssText+=";"+l:i.setAttribute(s,l)})})}function Va(e){let t=[...e.querySelectorAll(".fragment")].map((a,r)=>({e:a,i:r,k:a.dataset.fragmentIndex}));if(t.every(a=>a.k===void 0))return t.map(a=>[a.e]);let n=0;t.forEach(a=>{a.k=a.k===void 0?n:parseFloat(a.k),n=Math.max(n,a.k)+1}),t.sort((a,r)=>a.k-r.k||a.i-r.i);let o=[];return t.forEach((a,r)=>{r&&t[r-1].k===a.k?o[o.length-1].push(a.e):o.push([a.e])}),o}function mn(e,t,n){!e||!e.frags||(n&&e.el.classList.add("snap"),e.frags.forEach((o,a)=>o.forEach(r=>{r.classList.toggle("visible",a<t),r.classList.toggle("current-fragment",a===t-1)})),n&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Xa(){try{return y.base?new URL(y.base,V||location.href):V?new URL(V):null}catch{return null}}function Ja(e){let t=Xa(),n=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let a=o.hasAttribute("src")?"src":"href",r=o.getAttribute(a);if(!r||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(r))return;if(!t){a==="src"&&n++;return}let i=t;try{y.site&&(i=new URL(y.site,t))}catch{}o.setAttribute(a,new URL(r,r.startsWith("/")?i:t).href)}),n}function Tt(e){let t=e.el,n=t.querySelector(".body");t.classList.add("measuring"),n.style.zoom="";let o=Ge;e.visual=!!n.querySelector("iframe, .echarts-container, pre > code.language-dot, .diagram"),e.visual?o=pt:(n.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||n.querySelectorAll("img").length>=4)&&(o=po);let a=n.querySelectorAll("table");if(a.length){t.style.width=pt+"px";let i=t.offsetWidth-n.clientWidth;a.forEach(s=>{o=Math.max(o,Math.min(po,Math.ceil(s.offsetWidth)+i+12))})}let r=n.querySelectorAll(".fragment.grow");if(r.length){t.style.width=o+"px";let i=t.offsetWidth-n.clientWidth;r.forEach(s=>{o=Math.max(o,Math.min(pt,Math.ceil(s.offsetWidth*1.3)+i))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(pt,t.scrollWidth+24))+"px"),n.scrollWidth>n.clientWidth+2&&(n.style.zoom=(n.clientWidth/n.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||Qt,t.classList.remove("measuring")}function Za(){clearTimeout(ho),ho=setTimeout(()=>{c.forEach(Tt),Xe(),ee(!0)},200)}function tn(e){return Kt[e]||(Kt[e]=new Promise((t,n)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete Kt[e],n(new Error("could not load "+e))},document.head.appendChild(o)}))}async function tr(){let e=We,t=[...G.querySelectorAll(".node pre > code.language-dot")],n=[...G.querySelectorAll(".node .echarts-container[data-chart]")];if(!t.length&&!n.length)return;let o=[];if(t.length)try{if(await tn(Qa),Vt=Vt||await Viz.instance(),e!==We)return;t.forEach(a=>{let r=document.createElement("div");r.className="diagram";try{r.appendChild(Vt.renderSVGElement(a.textContent))}catch(i){r.className="diagram err",r.textContent="Diagram error: "+i.message}a.parentElement.replaceWith(r)})}catch{o.push("diagrams")}if(n.length)try{if(await tn(er),e!==We)return;n.forEach(a=>{let r;try{r=JSON.parse(a.dataset.chart)}catch{a.textContent="Chart data is not valid JSON.";return}echarts.init(a,un()==="light"?null:"dark",{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!ze},r))})}catch{o.push("charts")}e===We&&(o.length&&(Ye.textContent="Could not load the "+o.join(" and ")+" renderer (offline?)"),c.forEach(Tt),Xe(),ee(!0))}function nr(){let e=[];return f.forEach(t=>{let n=Ve(t),o=e[e.length-1];o&&o.sec===n?o.ids.push(t):e.push({sec:n,ids:[t]})}),e}function or(){let n=0,o=0,a=0;nr().forEach((r,i)=>{let s=Math.max(...r.ids.map(g=>c.get(g)._h));i&&(n+=a/2+120+s/2);let l=o,d=o;r.ids.forEach((g,j)=>{let h=c.get(g);j&&(l+=90+h._w/2),h.cx=l,h.cy=n,d=l,l+=h._w/2}),o=d,a=s})}function ar(){c.forEach(e=>{e.cx=0,e.cy=0})}function Ro(){We++,window.echarts&&G.querySelectorAll(".echarts-container").forEach(n=>{let o=echarts.getInstanceByDom(n);o&&o.dispose()}),G.querySelectorAll("div.node").forEach(n=>n.remove());let e=zo(),t=0;c.forEach(n=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=n.id;let a=n.parent?Mt(n.id).slice(0,-1).map(i=>c.get(i).title).join(" / "):"";o.innerHTML=(a?'<div class="crumb">'+B(a)+"</div>":"")+'<div class="body">'+n.html+"</div>"+(n.err?'<div class="err-badge">!</div>':"");let r=o.querySelector(".body");Ka(r),r.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Ja(r),n.frags=Va(r),r.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Za,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));c.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),u.active||P(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{u.active||P(n.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&P(n.id)}),G.appendChild(o),n.el=o,mn(n,n.frags.length)}),t&&!Ye.textContent&&(Ye.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),c.forEach(Tt),Xe(e),tr()}function Xe(e){e===void 0&&(e=zo()),z==="radial"?Ga(e):z==="path"?or():z==="focus"?ar():Ya(),G.classList.toggle("focus",z==="focus"),c.forEach(t=>{let n=t.el.style;n.setProperty("--cx",t.cx),n.setProperty("--cy",t.cy)}),rr(),Pe(),vn()}function rr(){let e="";if(z==="focus"){Gt.innerHTML="";return}if(z==="path"){for(let t=1;t<f.length;t++){let n=c.get(f[t-1]),o=c.get(f[t]);e+='<path data-from="'+n.id+'" data-to="'+o.id+'" d="M '+n.cx+" "+n.cy+" L "+o.cx+" "+o.cy+'"/>'}Gt.innerHTML=e;return}c.forEach(t=>{if(!t.parent)return;let n=c.get(t.parent);if(z==="radial")e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+n.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=n.cy+n._h/2,a=t.cy-t._h/2,r=o+(a-o)/2;e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+o+" L "+n.cx+" "+r+" L "+t.cx+" "+r+" L "+t.cx+" "+a+'"/>'}}),Gt.innerHTML=e}function Mt(e){let t=[],n=e;for(;n;)t.unshift(n),n=c.get(n).parent;return t}function Be(){let e=T.clientWidth,t=T.clientHeight;G.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+L.zoom+") translate("+-L.x+"px,"+-L.y+"px)",Uo()}function fn(){qe&&(qe.kill(),qe=null)}function Ao(e,t){if(fn(),t||ze||!window.gsap){Object.assign(L,e),Be();return}let n=T.clientWidth,o=Math.hypot(e.x-L.x,e.y-L.y),a=e.zoom,r=gsap.timeline({onUpdate:Be,onComplete:()=>{qe=null}}),{zoom:i,...s}=e,l=o*Math.min(L.zoom,a),d=Math.max(.55,Math.min(1.3,.55+l/n*.3));if(r.to(L,{...s,duration:d,ease:"power2.inOut"},0),l>n*1.2){let g=Math.max(.06,Math.min(L.zoom,a,n*.9/(o+Ge)));r.to(L,{zoom:g,duration:d/2,ease:"sine.out"},0).to(L,{zoom:a,duration:d/2,ease:"sine.in"},d/2)}else r.to(L,{zoom:a,duration:d,ease:"power2.inOut"},0);qe=r}function ir(){let e=T.getBoundingClientRect(),t=14,n=[];if(!se.hidden&&se.offsetWidth){let a=se.getBoundingClientRect();n.push({x0:a.left-e.left-t,y0:a.top-e.top-t,x1:a.right-e.left+t,y1:a.bottom-e.top+t})}let o=Na();return o&&n.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),n}function sr(){let e=T.clientWidth,t=T.clientHeight,n=[{x0:16,y0:D?20:56,x1:e-16,y1:t-(D?20:74)}];return ir().forEach(o=>{let a=[];n.forEach(r=>{if(o.x1<=r.x0||o.x0>=r.x1||o.y1<=r.y0||o.y0>=r.y1){a.push(r);return}[{...r,x1:Math.min(r.x1,o.x0)},{...r,x0:Math.max(r.x0,o.x1)},{...r,y1:Math.min(r.y1,o.y0)},{...r,y0:Math.max(r.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&a.push(i)})}),a.length&&(n=a)}),n}function nn(e,t,n){let o=T.clientWidth,a=T.clientHeight,r=null;return sr().forEach(i=>{let s=n*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!r||s>r.zoom)&&(r={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-a/2})}),r}function Do(e,t,n,o){return{x:e-n.sx/o,y:t-n.sy/o}}function xe(e,t){let n=c.get(e);if(!n)return;let o=nn(n._w,n._h,Ke),a=Ve(e),r=f.filter(l=>Ve(l)===a&&!c.get(l).visual).map(l=>{let d=c.get(l);return nn(d._w,d._h,Ke).zoom}).sort((l,d)=>l-d),i=r.length?r[Math.floor((r.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));Ao(Object.assign(Do(n.cx,n.cy,o,s),{zoom:s}),t)}function Je(e){let t=[...c.values()];if(!t.length)return;let n=T.clientWidth,o=T.clientHeight,a=Math.min(...t.map(g=>g.cx-g._w/2)),r=Math.max(...t.map(g=>g.cx+g._w/2)),i=Math.min(...t.map(g=>g.cy-g._h/2)),s=Math.max(...t.map(g=>g.cy+g._h/2)),l=nn(r-a,s-i,.94),d=Math.max(.05,Math.min(1,l.zoom));Ao(Object.assign(Do((a+r)/2,(i+s)/2,l,d),{zoom:d}),e)}function ee(e){p&&c.has(p)?xe(p,e):Je(e)}function Pe(){let e=p?Mt(p):[];c.forEach(t=>{let n=t.el;n.classList.toggle("current",t.id===p),n.classList.toggle("active-path",e.includes(t.id))}),G.querySelectorAll("#connectors path").forEach(t=>{let n=z==="path"?!!p&&f.indexOf(t.dataset.to)<=f.indexOf(p):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",n)}),pr(e),jo()}function _o(){return Hn(new URLSearchParams(location.search).get("duration")??y.duration)}function lr(){return D&&_o()>0&&(!u.active||/^always$/i.test(y.timer||""))}function gt(){let e=lr()&&ce.start>0;if(ge.classList.toggle("timed",e),!e){ge.classList.remove("over");return}let n=(u.active&&u.t0?xt():performance.now()-ce.start)/_o();ge.firstChild.style.width=Math.min(100,n*100)+"%",ge.classList.toggle("over",n>=1)}function cr(){ce.start=performance.now(),clearInterval(ce.timer),ce.timer=setInterval(gt,1e3),gt()}function dr(){clearInterval(ce.timer),ce.timer=null,ce.start=0,gt()}function jo(){let e=D&&f.length>1&&!/^(off|no|false)$/i.test(y.progress||"");if(ge.classList.toggle("show",e),!e)return;gt();let t=f.indexOf(p),n=0,o=0;f.forEach((a,r)=>{let i=ke(c.get(a)).length;n+=i,r<t?o+=i:r===t&&(o+=Math.min(Q,i-1)+1)}),ge.lastChild.style.width=(n?o/n*100:0)+"%"}function pr(e){co.innerHTML=e.map((t,n)=>(n>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===p?" here":"")+'" data-id="'+B(t)+'">'+B(c.get(t).title)+"</button>").join(""),co.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{u.active||P(t.dataset.id)}))}function Ze(e){let t=c.get(p);t&&(mn(t,Oo().frag,e),hn(),(O.hidden||!Me||!Me.full)&&hr(t),bn(t))}function hr(e){e._played||!window.gsap||ze||(e._played=!0,e.el.querySelectorAll("[data-gsap]").forEach(t=>{let n;try{n=JSON.parse(t.dataset.gsap)}catch{return}let o={duration:n.duration??1,delay:n.delay??0,ease:n.ease||"power2.out"};n.to?gsap.fromTo(t,n.from||{},Object.assign({},n.to,o)):n.from&&gsap.from(t,Object.assign({},n.from,o))}),e.el.querySelectorAll(".title-scramble").forEach(mr))}function gn(e){!e||!e._played||(e._played=!1,window.gsap&&(e.el.querySelectorAll("[data-gsap]").forEach(t=>{gsap.killTweensOf(t);let n={};try{n=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},n.from,n.to)).map(a=>ur.includes(a)?"transform":a));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function mr(e){let t=e.dataset.text||(e.dataset.text=e.textContent),n=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",a={p:0};e._scramble=gsap.to(a,{p:1,duration:1.4,ease:"none",onUpdate(){let r=Math.floor(a.p*n.length);e.textContent=n.map((i,s)=>s<r||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function bn(e){clearTimeout(Oe),!(!D||!e||!e.autoslide||u.active&&(!u.t0||u.paused))&&(Oe=setTimeout(()=>{p===e.id&&Ie(1)},e.autoslide))}function Fo(e){let t=e&&e!==f[0]?e:"";try{v&&v.kind==="share"?history.replaceState(null,"",location.pathname+location.search+qt(v.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function P(e,t,n){if(!c.has(e))return;if(e!==p){he=null,le=-1,Q=n?ke(c.get(e)).length-1:0;let r=c.get(p);r&&z==="focus"&&!t&&(r.el.classList.add("leaving"),setTimeout(()=>r.el.classList.remove("leaving"),600)),Ho()}let o=e!==p;if(p=e,clearTimeout(K),K=null,o&&z==="focus"&&!t&&!ze){let r=c.get(e).el;r.classList.add("entering"),r.offsetWidth,r.classList.remove("entering")}Ze(o),o&&En("slide",e);let a=c.get(e);o&&a.mapFirst&&!n&&!t&&z!=="focus"?(Je(),K=setTimeout(()=>{K=null,p===e&&xe(e)},1900)):xe(e,t),Pe(),vn(),Fo(e)}function Ho(){let e=c.get(p);e&&(mn(e,e.frags.length,!0),gn(e))}function fr(){if(!p&&be&&c.has(be)){Wo();return}p&&(be=p),z==="focus"&&ve("path"),Ho(),clearTimeout(Oe),p=null,Pe(),vn(),Je(),Fo(null)}function Wo(){if(K)return clearTimeout(K),K=null,xe(p),!0;if(!p&&be&&c.has(be)){let e=be;return be=null,P(e),!0}return!1}function Ie(e){if(!p){f.length&&P(f[e>0?0:f.length-1]);return}if(K&&e>0){clearTimeout(K),K=null,xe(p);return}let t=ke(c.get(p)),n=Math.min(Q,t.length-1)+e;if(n>=0&&n<t.length){Q=n,he=null,le=-1,Ze(),!U&&!O.hidden&&Me.used?et():ee(),Pe();return}let o=f.indexOf(p)+e;o>=0&&o<f.length&&P(f[o],!1,e<0)}function gr(){let e=c.get(p);e&&e.parent&&P(e.parent)}function br(){let e=c.get(p);e&&e.children.length?P(e.children[0]):!p&&f.length&&P(f[0])}function vn(){let e=[...c.values()];if(!e.length){Zt.innerHTML="",oe=null;return}Ia.textContent="map";let t=b=>b.cx,n=b=>b.cy,o=Math.min(...e.map(t))-Ge/2,a=Math.max(...e.map(t))+Ge/2,r=Math.min(...e.map(n))-Qt/2,i=Math.max(...e.map(n))+Qt/2,s=16,l=180,d=130,g=Math.min((l-2*s)/Math.max(1,a-o),(d-2*s-6)/Math.max(1,i-r)),j=l/2-(o+a)/2*g,h=d/2+5-(r+i)/2*g,C=p?Mt(p):[],x="";e.forEach(b=>{if(!b.parent)return;let A=c.get(b.parent);x+='<line x1="'+(t(A)*g+j)+'" y1="'+(n(A)*g+h)+'" x2="'+(t(b)*g+j)+'" y2="'+(n(b)*g+h)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(b=>{let A=b.id===p?"var(--accent)":C.includes(b.id)?"var(--accent-teal)":"var(--node-border)";x+='<circle data-id="'+B(b.id)+'" cx="'+(t(b)*g+j)+'" cy="'+(n(b)*g+h)+'" r="'+(b.id===p?4:3)+'" fill="'+A+'"><title>'+B(b.title)+"</title></circle>"}),x+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',Zt.innerHTML=x,oe={s:g,ox:j,oy:h},Uo()}function Uo(){let e=document.getElementById("mm-viewport");if(!e||!oe)return;let t=T.clientWidth/L.zoom,n=T.clientHeight/L.zoom;e.setAttribute("x",(L.x-t/2)*oe.s+oe.ox),e.setAttribute("y",(L.y-n/2)*oe.s+oe.oy),e.setAttribute("width",Math.max(2,t*oe.s)),e.setAttribute("height",Math.max(2,n*oe.s))}function Bt(e){Io(X.value),p&&!c.has(p)&&(p=null),Ro(),p?P(p,e):f.length?P(f[0],e):(p=null,Je(!0))}function ve(e,t){z=e,Z("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(n=>n.classList.toggle("active",n.dataset.mode===e)),c.size&&(!t&&!ze&&(G.classList.add("morph"),setTimeout(()=>G.classList.remove("morph"),700)),Xe(),Be(),p?xe(p,t):Je(t))}function No(e){return Math.max(.04,Math.min(5,e))}function vr(e){Ke=Math.round(Math.max(Da,Math.min(_a,e))*100)/100,Z("slidetake:slideSize",Ke),p&&xe(p)}function fo(e){p?vr(Ke+e*.1):qo(e>0?1.2:1/1.2)}function qo(e,t,n){fn();let o=No(L.zoom*e);if(t!==void 0){let a=T.getBoundingClientRect(),r=t-a.left-a.width/2,i=n-a.top-a.height/2;L.x+=r/L.zoom-r/o,L.y+=i/L.zoom-i/o}L.zoom=o,Be()}function Ot(){M||(ue.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!ue.classList.contains("collapsed")))}function we(e){D=e,document.body.classList.toggle("presenting",e),sa();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!p&&f.length&&P(f[0]);let n=y.camera||[...c.values()].some(o=>o.camera);e&&n&&!U&&!N&&et(),e?bn(c.get(p)):clearTimeout(Oe),e?cr():dr(),jo()}function xt(){return(u.paused?u.pauseAt:performance.now())-u.t0-u.pausedMs}function It(e){e.classList.add("open")}function wn(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function kr(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,n,...o]=e.split(":");return bt.value=t||"localhost",vt.value=n||"4455",yt.value=o.join(":"),!0}try{let t=JSON.parse(J("slidetake:obs")||"null");t&&(bt.value=t.host||"localhost",vt.value=t.port||"4455",yt.value=t.password||"",yn.checked=!0)}catch{}return!1}function Go(){if(yn.checked)Z("slidetake:obs",JSON.stringify({host:bt.value.trim(),port:vt.value.trim(),password:yt.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function He(e,t){xo.textContent=e,xo.className=t||""}function Sr(e){return location.protocol==="https:"&&!Er(e)}async function Ko(){let e=bt.value.trim()||"localhost",t="ws://"+e+":"+(vt.value.trim()||"4455");if(Sr(e)){fe=!1,$e.disabled=!0,He(Lr,"err");return}He("Connecting to "+t+"\u2026");try{await tn(yr);let n=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(H)try{await H.disconnect()}catch{}H=new n,H.on("ConnectionClosed",()=>{fe=!1,He("Disconnected from OBS","err"),$e.disabled=!0}),H.on("RecordStateChanged",a=>{a.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&ye&&(ye(),ye=null),a.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&u.active&&u.withObs&&!u.finishing&&zt("Stopped in OBS")});let o=await H.connect(t,yt.value||void 0);fe=!0;try{let a=await H.call("GetVideoSettings");a&&a.fpsNumerator&&a.fpsDenominator&&($o=a.fpsNumerator/a.fpsDenominator)}catch{}He("Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),"ok"),Go()}catch(n){fe=!1,He("Could not connect ("+(n&&n.message||n)+"). Is OBS running with its WebSocket server on, and is the password right?","err")}$e.disabled=!fe}function Cr(){let e=document.getElementById("rec-screen"),t=screen.width,n=screen.height;if(Math.abs(t/n-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+n+"), right for YouTube.</span>";return}let o=[["16:10",1.6],["3:2",1.5],["4:3",4/3],["21:9",21/9],["16:9",16/9]],[a,r]=o.reduce((s,l)=>Math.abs(l[1]-t/n)<Math.abs(s[1]-t/n)?l:s),i=Math.abs(r-t/n)<.005?a:"about "+a;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+n+"), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>"}function an(){if(!Ct)return;let e=f.reduce((n,o)=>n+ke(c.get(o)).length,0),t=y.camera||[...c.values()].some(n=>n.camera);document.getElementById("rec-deck-info").innerHTML=B(y.title||(re[0]?c.get(re[0]).title:"This deck"))+" \xB7 "+f.length+" slides \xB7 "+e+" presses"+(t&&N?'<br><span class="warn">The camera is off. Press C first if this take should include your webcam.</span>':""),$e.disabled=!fe,Ir(),Cr(),It(xr)}async function Vo(e){if(u.active||!f.length)return;wn(),Object.assign(u,{active:!0,withObs:e,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null}),document.body.classList.add("recording"),ra();let t=document.getElementById("rec-layout").value;t!=="current"&&t!==z&&ve(t,!0),D||we(!0),p===f[0]&&(Q=0,he=null,le=-1),P(f[0],!0);for(let o=3;o>0;o--)if(ut.querySelector(".num").textContent=o,ut.classList.add("show"),await xn(1e3),!u.active)return;if(ut.classList.remove("show"),await Yo(),e){let o=new Promise(a=>{ye=a,setTimeout(()=>{ye&&(ye(),ye=null)},2500)});try{await H.call("StartRecord")}catch(a){kn("OBS could not start recording: "+(a&&a.message||a));return}if(await o,!u.active)return}u.counting=!1,u.t0=performance.now();let n=c.get(p);gn(n),Ze(!0),En("slide",p)}function kn(e){u.active=!1,u.counting=!1,ut.classList.remove("show"),document.body.classList.remove("recording"),D&&we(!1),Ce(e)}function En(e,t){if(!u.active||!u.t0||u.finishing)return;let n=c.get(t),o={id:t,title:n?n.title:t,retake:e==="retake",t:Math.round(xt()),obsT:null};u.events.push(o),u.withObs&&fe&&(H.call("GetRecordStatus").then(a=>{a&&typeof a.outputDuration=="number"&&(o.obsT=a.outputDuration)}).catch(()=>{}),n&&H.call("CreateRecordChapter",{chapterName:(o.retake?"RETAKE \xB7 ":"")+n.title}).catch(()=>{}))}function Tr(e){let t=e.key;if((bo.includes(t)||vo.includes(t)||yo.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){u.counting?kn("Take cancelled"):zt("Stopped early");return}if(!(u.counting||u.finishing)){if(yo.includes(t)){Or();return}u.paused||(bo.includes(t)?Mr():vo.includes(t)&&Br())}}function Mr(){let e=ke(c.get(p));Math.min(Q,e.length-1)>=e.length-1&&f.indexOf(p)===f.length-1?zt():Ie(1)}function Br(){let e=c.get(p);e&&(En("retake",p),Q=0,he=null,le=-1,gn(e),Ze(!0),!U&&!O.hidden&&Me.used?et():ee(),Pe())}async function Or(){u.t0&&(u.paused?(on.classList.remove("show"),await Yo(),u.withObs&&await H.call("ResumeRecord").catch(()=>{}),u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,bn(c.get(p))):(u.paused=!0,u.pauseAt=performance.now(),clearTimeout(Oe),u.withObs&&await H.call("PauseRecord").catch(()=>{}),on.classList.add("show")))}async function zt(e){if(!u.active||u.finishing)return;if(u.counting){kn("Take cancelled");return}u.finishing=!0,clearTimeout(Oe),u.paused&&(u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,on.classList.remove("show"));let t=Math.round(xt()),n=null;if(u.withObs){await xn(1200),t=Math.round(xt());try{let a=await H.call("GetRecordStatus");a&&typeof a.outputDuration=="number"&&(n=a.outputDuration)}catch{}try{let a=await H.call("StopRecord");u.outputPath=a&&a.outputPath}catch(a){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(a&&a.message||a)+")"}}u.active=!1,u.finishing=!1,document.body.classList.remove("recording"),D&&we(!1);let o={key:Pt(),deckTitle:y.title||c.get(f[0]).title,date:new Date().toISOString(),withObs:u.withObs,outputPath:u.outputPath,reason:e||"",total:t,totalObs:n,fps:$o,events:u.events.map(a=>({id:a.id,title:a.title,retake:a.retake,t:a.t,obsT:a.obsT})),picks:{}};Sn(o),na(o)}function Pt(){return Ee(y.title||(f[0]?c.get(f[0]).title:"deck"))}function Xo(){try{return JSON.parse(J("slidetake:sessions")||"[]")}catch{return[]}}function Sn(e){let t=Xo().filter(n=>n.date!==e.date);t.unshift(e),Z("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function Ir(){let e=document.getElementById("rec-sessions"),t=Xo().filter(n=>n.key===Pt());e.innerHTML=t.length?"<h3>Earlier takes of this deck</h3>"+t.map((n,o)=>'<div class="row"><button class="btn small" data-session="'+o+'">Review</button><span>'+B(new Date(n.date).toLocaleString())+" \xB7 "+Y(n.totalObs??n.total)+(n.withObs?"":" \xB7 rehearsal")+(n.outputPath?" \xB7 "+B(Se(n.outputPath)):"")+"</span></div>").join(""):"",e.querySelectorAll("[data-session]").forEach(n=>n.onclick=()=>{wn(),na(t[+n.dataset.session])})}function Ve(e){let t=c.has(e)?Mt(e):[e];return t[Math.min(1,t.length-1)]}function Jo(e,t){let n=Ve(e);return{sec:n,title:c.has(n)?c.get(n).title:t}}function ea(){let e=Object.keys(y).filter(t=>t==="tags"||/_tags$/.test(t)).flatMap(t=>[].concat(y[t])).filter(t=>typeof t=="string");return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function zr(){return[].concat(y.related||[]).map(e=>{let t=String(e).match(/^\[([^\]]+)\]\(([^)]+)\)$/),n=String(e).split("|");return t?t[1]+": "+t[2]:n.length===2?n[0].trim()+": "+n[1].trim():String(e)})}function Pr(){if(y.permalink||y.url)return y.permalink||y.url;let e=y.site||J("slidetake:site");if(!e||!V)return"";try{let t=new URL(V).pathname.replace(/\/index\.md$/i,"/").replace(/\.md$/i,"/");return new URL(t,e).href}catch{return""}}function ta(e){let t=Zo(e),n=document.getElementById("rv-link").value.trim(),o=zr(),a=ea(),r=[];y.summary&&r.push(y.summary),n&&r.push("\u{1F4D1} Slides: "+n),t.lines.length>=3&&r.push(`Chapters
618
+ `+N+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+O+" -c copy -movflags +faststart "+mt(i)}let b=ft(e),S=m=>(m/b).toFixed(6),g=m=>((m-.5)/b).toFixed(6),B=r.map(m=>"gte(t,"+g(m.f0)+")*lt(t,"+g(m.f1)+")").join("+"),G=r.map(m=>"gte(t,"+S(m.f0)+")*lt(t,"+S(m.f1)+")").join("+"),w=t==="mac"?"-c:v h264_videotoolbox -b:v 12M":"-c:v libx264 -crf 18 -preset medium";return N+"ffmpeg -i "+mt(n)+" -i /tmp/slidetake-chapters.txt"+O+` -vf "select='`+B+`',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='`+G+`',asetpts=N/SR/TB" `+w+" -c:a aac -b:a 192k -movflags +faststart "+mt(i)}var go,ft,bo,Me,Ga,mt,yo,wo=j(()=>{"use strict";lt();go=e=>e.obsT??e.t,ft=e=>e.fps||60,bo=(e,t)=>Math.round(e*t/1e3);Me=e=>String(e||"").split(/[\\/]/).pop()||"",Ga=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},mt=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",yo=e=>(e/1e3).toFixed(3)});var Li={};function Z(e){try{let t=localStorage.getItem(e);if(t!==null||!e.startsWith("slidetake:"))return t;let n=e.slice(10);return localStorage.getItem("slidetake:"+n)??localStorage.getItem("traverse:"+n)}catch{return null}}function Q(e,t){try{localStorage.setItem(e,t)}catch{}}function ar(e){try{return{html:window.marked?window.marked.parse(e):"<pre>"+T(e)+"</pre>",err:null}}catch{return{html:"<p>(could not render)</p>",err:"render error"}}}function xt(){let e=x.brand||"",t=x.logo||"",n=/^chip$/i.test(x.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+Uo+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+T(t)+'">':"")+(e?"<span"+(n?' class="chip"':"")+">"+T(e)+"</span>":"");if(ce.dataset.html!==o){ce.dataset.html=o,ce.innerHTML=o;let a=ce.querySelector("img");a&&(a.onload=a.onerror=()=>te(!0))}ce.hidden=!o,xn(),document.title=x.title||"Slidetake",ir(),qo()}function rr(){let e=String(x.accent||"").trim();if(!e||!window.CSS||!CSS.supports("color",e))return null;if(!CSS.supports("color","oklch(from red l c h)"))return{accent:e,line:e};let t=n=>"oklch(from "+e+" "+n+" c h)";return{dark:{accent:t(.8),accentSoft:t(.87),line:t(.5)},light:{accent:t(.45),accentSoft:t(.4),line:t(.75),ring:t(.7)}}}function ir(){let e="",t=(o,a)=>{let r=Object.entries(a||{}).filter(([i,s])=>Eo[i]&&s&&typeof s!="object").map(([i,s])=>Eo[i]+":"+String(s).replace(/[;{}<>]/g,"")).join(";");r&&(e+=o+"{"+r+`}
619
+ `)};[M&&M.colors,rr()].filter(Boolean).forEach(o=>{["dark","light"].forEach(a=>{let r={...o,...o[a]||{}},i=a==="dark";r.accent&&typeof r.accent=="string"&&(r.accentSoft=r.accentSoft||r.accent,r.line=r.line||"color-mix(in srgb, "+r.accent+(i?" 45%, #09090b)":" 55%, #fff)"),r.ring=r.ring||(i?r.accent:r.line),r.onAccent=r.onAccent||(i?"color-mix(in srgb, "+r.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',r)})});let n=document.getElementById("st-colors");n||(n=document.createElement("style"),n.id="st-colors",document.head.appendChild(n)),n.textContent!==e&&(n.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Ge(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let n=getComputedStyle(t).color;return t.remove(),ye=ye||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),ye.clearRect(0,0,1,1),ye.fillStyle="#000",ye.fillStyle=n,ye.fillRect(0,0,1,1),"#"+[...ye.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function sr(e,t,n){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),a=o(e),r=o(t);return"#"+a.map((i,s)=>Math.round(i*n+r[s]*(1-n)).toString(16).padStart(2,"0")).join("")}function zt(){if(M&&M.themeKey&&!Lo){let t=Z(M.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Lo||Z("slidetake:mode")||x.mode||"dark").toLowerCase()==="light"?"light":"dark"}function qo(){let e=zt()==="light";e?document.body.dataset.mode="light":delete document.body.dataset.mode;let t=document.getElementById("btn-mode");t&&(t.innerHTML=e?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4.5"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>',t.title=(e?"Dark theme":"Light theme")+" (L)",t.setAttribute("aria-label",t.title))}function $o(){let e=zt()==="light"?"dark":"light";M&&M.themeKey?(Q(M.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):Q("slidetake:mode",e),qo(),W.querySelector(".echarts-container, .diagram.d2")&&Pt(!0)}function lr(){let t=(x.camera||"").replace(/^\[|\]$/g,"").split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function ln(e){return!q&&e?to(e.camera):[]}function Ce(e){return no(ln(e),e&&e.frags?e.frags.length:0)}function Yo(){let e=Ce(c.get(p));return e[Math.min(ee,e.length-1)]||{cam:0,frag:0}}function cr(){if(!p)return null;let e=ln(c.get(p));if(e.length)return e[Math.min(Yo().cam,e.length-1)];for(let t=h.indexOf(p)-1;t>=0;t--){let n=ln(c.get(h[t]));if(n.length)return n[n.length-1]}return null}function dr(){let e={corner:(x.pip||"none").toLowerCase(),size:qt(parseFloat(x.pip_size)||24),circle:(x.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(x.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return ct(e,cr()),ct(e,fe),!Ue.includes(e.corner)&&(U||e.used)&&(e.corner="bottom-right"),e.flip&&Ue.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function xn(){let e=!z.hidden&&z.offsetWidth?z.getBoundingClientRect():null,t=Ae=dr(),n=Ue.includes(t.corner);if(z.className=n?[t.corner,t.circle&&"circle",U&&"live",t.mirror&&"mirror",t.full&&"full"].filter(Boolean).join(" "):"",z.style.width=t.size+"%",z.hidden=!n||q||t.off,or.dataset.pip=z.hidden||t.full?"none":t.corner,z.hidden||je||!z.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){z.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let a=z.getBoundingClientRect();Math.abs(e.left-a.left)+Math.abs(e.top-a.top)+Math.abs(e.width-a.width)+Math.abs(e.height-a.height)<2||z.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-a.left)+"px,"+(e.top-a.top)+"px) scale("+e.width/a.width+","+e.height/a.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function pr(){let e=Ae;if(!e||z.hidden||e.full)return null;let t=C.clientWidth,n=C.clientHeight,o=16,a=t*e.size/100,r=e.circle?a:a*9/16,i=e.corner.includes("left")?o:t-o-a,s=e.corner.includes("top")?o:n-o-r;return{x0:i,y0:s,x1:i+a,y1:s+r}}function ur(){if(!tt)return;if(q){An(!0);return}let e=lr();de=(de+1)%e.length,fe=e[de],xn(),R||Be("Camera: "+fe),!U&&!z.hidden?it():te()}function Go(e){let t=Qn(e,{render:ar});x=t.deck,c=t.nodes,xt();let n={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Ka.textContent=c.size+(c.size===1?" card":" cards")+" \xB7 "+n,Ze.textContent=t.errCount?t.errCount+" card(s) had errors":""}function Ko(){se=[...c.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,a){let r=c.get(o);if(r.depth=a,r.children.length===0)r._slot=e++;else{r.children.forEach(s=>t(s,a+1));let i=r.children.map(s=>c.get(s)._slot);r._slot=(Math.min(...i)+Math.max(...i))/2}}se.forEach(o=>t(o,0)),h=[];function n(o){h.push(o),c.get(o).children.forEach(n)}return se.forEach(n),Math.max(1,e)}function hr(){let e=[],t=[],n=[];return c.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),n[o.depth]=(n[o.depth]||0)+1}),{maxH:e,maxW:t,count:n,maxDepth:e.length-1}}function Vo(e){e.x!==null&&!isNaN(e.x)&&(e.cx=e.x+e._w/2),e.y!==null&&!isNaN(e.y)&&(e.cy=e.y+e._h/2)}function mr(){let{maxH:e,maxDepth:t}=hr(),n=[0];for(let l=1;l<=t;l++)n[l]=n[l-1]+e[l-1]+Za;let o=Ja-Ie,a=[],r=(l,d)=>{let f=c.get(l);f.cx+=d,f.children.forEach(N=>r(N,d))},i=l=>{let d=c.get(l);a[d.depth]=Math.max(a[d.depth]??-1/0,d.cx+d._w/2),d.children.forEach(i)};function s(l){let d=c.get(l),f=a[d.depth]!==void 0?a[d.depth]+o:-1/0;d.children.length?(d.children.forEach(s),d.cx=(c.get(d.children[0]).cx+c.get(d.children[d.children.length-1]).cx)/2,d.cx-d._w/2<f&&r(l,f-(d.cx-d._w/2))):d.cx=(f===-1/0?0:f)+d._w/2,i(l)}se.forEach(s),c.forEach(l=>{l.cy=n[l.depth]+l._h/2,Vo(l)})}function fr(e){let t=Math.PI*2/e,n=32,o=[],a=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+n&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+n,r=Math.max(0,...[...c.values()].map(s=>s.depth)),i=0;for(let s=0;s<=r;s++){let l=[...c.values()].filter(f=>f.depth===s);if(!l.length)continue;let d=s===0?se.length>1?er*.5:0:i+Qa;for(let f=0;f<400&&(l.forEach(O=>{let b=(O._slot+.5)*t-Math.PI/2;O.cx=d*Math.cos(b),O.cy=d*Math.sin(b),Vo(O)}),!!l.some((O,b)=>l.some((S,g)=>g>b&&a(O,S))||o.some(S=>a(O,S))));f++)d=d*1.02+10;i=d,o.push(...l)}}function gr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);n.forEach(o=>{let a=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!a)return;let r=o.previousSibling;for(;r&&r.nodeType===3&&!r.data.trim();)r=r.previousSibling;let i=r&&r.nodeType===1?r:o.parentElement;i&&Object.entries(Fe(a[1])).forEach(([s,l])=>{s==="class"?i.classList.add(...l.split(/\s+/).filter(Boolean)):s==="style"?i.style.cssText+=";"+l:i.setAttribute(s,l)})})}function en(e){let t=document.createElement("figure");t.className="media",e.replaceWith(t),t.appendChild(e);let n=e.getAttribute("alt");return n&&t.insertAdjacentHTML("beforeend","<figcaption>"+T(n)+"</figcaption>"),t}function br(e,t){let n=document.createElement("figure");return n.className="media yt fragment yt-play"+(e.portrait?" portrait":""),n.innerHTML='<div class="frame"><iframe src="'+mo(e)+'" title="'+T(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+T(t)+"</figcaption>":""),n}function Co(e,t){let n=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",n),e.style.setProperty("--rows",Math.ceil(t/n))}function vr(e,t){t.querySelectorAll("pre > code.language-svg").forEach(r=>{let i=document.createElement("img");i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(r.textContent.trim()),i.alt="";let s=document.createElement("p");s.appendChild(i),r.parentElement.replaceWith(s)}),t.querySelectorAll(":scope > p").forEach(r=>{let i=r.children.length===1?r.children[0]:null;if(!i)return;let s=i.tagName==="A"&&r.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&ho(s);l&&r.replaceWith(br(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(r=>{let i=[...r.children];!i.length||!i.every(s=>s.querySelector("img")&&!s.textContent.trim())||(r.classList.add("gallery"),i.forEach(s=>{let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),en(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(r.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let d=s.querySelector("figcaption");d&&(d.dataset.count=l+1+" / "+i.length)})):Co(r,i.length))}),t.querySelectorAll(":scope > p").forEach(r=>{if(!yr(r))return;let i=[...r.querySelectorAll("img")];if(i.length===1){r.replaceWith(i[0]),en(i[0]);return}let s=document.createElement("div");s.className="gallery grid",r.replaceWith(s),i.forEach(l=>{s.appendChild(l),en(l)}),Co(s,i.length)});let n=[...t.children].filter(r=>!/^H[1-6]$/.test(r.tagName)&&!(r.nodeType===1&&r.tagName==="HR")),o=n.filter(r=>r.matches("figure.media"));o.length===1&&n.length===1&&e.classList.add("card-media"),n.length===1&&(n[0].matches("figure.media:not(.yt)")||n[0].matches(".gallery.carousel"))&&e.classList.add("card-bleed");let a=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;a.nextNode();)if(/^\s*view\s*:\s*full\s*$/i.test(a.currentNode.data))e.classList.add("card-full");else if(o.length===1){e.classList.add("card-split",n.indexOf(o[0])===0?"media-first":"media-last");let r=document.createElement("div");r.className="split-text",n.filter(i=>i!==o[0]).forEach(i=>r.appendChild(i)),o[0].after(r),n.indexOf(o[0])!==0&&r.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function Xo(e,t){let n=e.querySelector("iframe");n&&n.contentWindow&&n.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function xr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&n.push(t.currentNode);n.forEach(o=>{let a=o.nextSibling;for(;a&&a.nodeType!==1;)a=a.nextSibling;a&&/^(UL|OL)$/.test(a.tagName)&&a.querySelectorAll(":scope > li").forEach(r=>r.classList.add("fragment","fade-up"))})}function wr(e){let t=[...e.querySelectorAll(".fragment")].map((a,r)=>({e:a,i:r,k:a.dataset.fragmentIndex}));if(t.every(a=>a.k===void 0))return t.map(a=>[a.e]);let n=0;t.forEach(a=>{a.k=a.k===void 0?n:parseFloat(a.k),n=Math.max(n,a.k)+1}),t.sort((a,r)=>a.k-r.k||a.i-r.i);let o=[];return t.forEach((a,r)=>{r&&t[r-1].k===a.k?o[o.length-1].push(a.e):o.push([a.e])}),o}function wn(e,t,n){!e||!e.frags||(n&&e.el.classList.add("snap"),e.frags.forEach((o,a)=>o.forEach(r=>{let i=r.classList.contains("visible");r.classList.toggle("visible",a<t),r.classList.toggle("current-fragment",a===t-1),r.classList.contains("yt-play")&&i!==a<t&&!n&&Xo(r,a<t?"playVideo":"pauseVideo")})),n&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function kr(){try{return x.base?new URL(x.base,X||location.href):X?new URL(X):null}catch{return null}}function Sr(e){let t=kr(),n=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let a=o.hasAttribute("src")?"src":"href",r=o.getAttribute(a);if(!r||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(r))return;if(!t){a==="src"&&n++;return}let i=t;try{x.site&&(i=new URL(x.site,t))}catch{}o.setAttribute(a,new URL(r,r.startsWith("/")?i:t).href)}),n}function It(e){let t=e.el,n=t.querySelector(".body");t.classList.add("measuring"),n.style.zoom="";let o=Ie;e.visual=!!n.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=ae);let a=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay"),a&&(o=ae),t.classList.contains("card-bleed")){let s=Math.max(0,...[...n.querySelectorAll("img")].map(l=>l.naturalWidth&&l.naturalHeight?l.naturalWidth/l.naturalHeight:0))||1.7777777777777777;if(a||Math.abs(s-16/9)<.08)t.classList.add("img-overlay"),o=ae;else if(s<1.3){let l=Math.min(Math.round(So*s),ae-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",l+"px"),o=Math.min(ae,Math.max(Qt,l*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(Ie,Math.min(ae,(So-Xa)*s))),t.style.setProperty("--img-h",Math.round(o/s)+"px")}else(n.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||n.querySelectorAll("img").length>=4)&&(o=Qt);let r=n.querySelectorAll("table");if(r.length){t.style.width=ae+"px";let s=t.offsetWidth-n.clientWidth;r.forEach(l=>{o=Math.max(o,Math.min(Qt,Math.ceil(l.offsetWidth)+s+12))})}let i=n.querySelectorAll(".fragment.grow");if(i.length){t.style.width=o+"px";let s=t.offsetWidth-n.clientWidth;i.forEach(l=>{o=Math.max(o,Math.min(ae,Math.ceil(l.offsetWidth*1.3)+s))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(ae,t.scrollWidth+24))+"px"),n.scrollWidth>n.clientWidth+2&&(n.style.zoom=(n.clientWidth/n.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||sn,t.classList.remove("measuring")}function Er(){clearTimeout(To),To=setTimeout(()=>{c.forEach(It),nt(),te(!0)},200)}function Mr(){let e=zt()==="light"?"light":"dark",t=Ge(e==="light"?"--accent-ring":"--accent"),n="slidetake-"+e+"-"+t.slice(1);return Mo.has(n)||(Or(n,Tr[e],t),Mo.add(n)),n}function Or(e,t,n){let o={axisLine:{lineStyle:{color:t.line}},axisTick:{lineStyle:{color:t.line}},axisLabel:{color:t.muted},splitLine:{lineStyle:{color:t.split}},nameTextStyle:{color:t.muted}};echarts.registerTheme(e,{color:[n,...t.palette],backgroundColor:"transparent",textStyle:{color:t.text,fontFamily:"'IBM Plex Sans', sans-serif"},title:{textStyle:{color:t.text},subtextStyle:{color:t.muted}},legend:{textStyle:{color:t.text}},tooltip:{backgroundColor:t.tip,borderColor:t.line,textStyle:{color:t.text}},categoryAxis:o,valueAxis:o,logAxis:o,timeAxis:o,line:{symbolSize:6,lineStyle:{width:2.5}}})}function Ir(){let e=zt()==="light"?"light":"dark",t=Ge("--node-bg"),n=Ge(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],a={...zr[e],B1:Ge("--accent")};return o.forEach((r,i)=>{a["B"+(i+2)]=sr(n,t,r)}),a}function cn(e){return tn[e]||(tn[e]=new Promise((t,n)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete tn[e],n(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Pr(){let e=ve,t=[...W.querySelectorAll(".node pre > code.language-dot")];W.querySelectorAll(".node pre > code.language-echarts").forEach(r=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=r.textContent,r.parentElement.replaceWith(i)});let n=[...W.querySelectorAll(".node .echarts-container[data-chart]")],o=[...W.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!n.length&&!o.length)return;let a=[];if(t.length)try{if(await cn(Lr),nn=nn||await Viz.instance(),e!==ve)return;t.forEach(r=>{let i=document.createElement("div");i.className="diagram";try{i.appendChild(nn.renderSVGElement(r.textContent))}catch(s){i.className="diagram err",i.textContent="Diagram error: "+s.message}r.parentElement.replaceWith(i)})}catch{a.push("diagrams")}if(o.length)try{if(!gt){let i=await import(Br);gt=new i.D2}if(e!==ve)return;let r=Ir();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await gt.compile(Ar(i.textContent));s.innerHTML=await gt.render(l.diagram,{...l.renderOptions||{},themeOverrides:r,darkThemeOverrides:r})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==ve)return;i.parentElement.replaceWith(s)}}catch{a.push("D2 diagrams")}if(n.length)try{if(await cn(Cr),e!==ve)return;let r=Mr();n.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}echarts.init(i,r,{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!je},s))})}catch{a.push("charts")}e===ve&&(a.length&&(Ze.textContent="Could not load the "+a.join(" and ")+" renderer (offline?)"),c.forEach(It),nt(),te(!0))}function Rr(){let e=[];return h.forEach(t=>{let n=et(t),o=e[e.length-1];o&&o.sec===n?o.ids.push(t):e.push({sec:n,ids:[t]})}),e}function Dr(){let n=0,o=0,a=0;Rr().forEach((r,i)=>{let s=Math.max(...r.ids.map(f=>c.get(f)._h));i&&(n+=a/2+120+s/2);let l=o,d=o;r.ids.forEach((f,N)=>{let O=c.get(f);N&&(l+=90+O._w/2),O.cx=l,O.cy=n,d=l,l+=O._w/2}),o=d,a=s})}function jr(){c.forEach(e=>{e.cx=0,e.cy=0})}function Jo(){ve++,window.echarts&&W.querySelectorAll(".echarts-container").forEach(n=>{let o=echarts.getInstanceByDom(n);o&&o.dispose()}),W.querySelectorAll("div.node").forEach(n=>n.remove());let e=Ko(),t=0;c.forEach(n=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=n.id;let a=n.parent?At(n.id).slice(0,-1).map(i=>c.get(i).title).join(" / "):"";o.innerHTML=(a?'<div class="crumb">'+T(a)+"</div>":"")+'<div class="body">'+n.html+"</div>"+(n.err?'<div class="err-badge">!</div>':"");let r=o.querySelector(".body");gr(r),xr(r),vr(o,r),r.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Sr(r),n.frags=wr(r),r.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Er,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));c.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),u.active||P(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{u.active||P(n.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&P(n.id)}),W.appendChild(o),n.el=o,wn(n,n.frags.length)}),t&&!Ze.textContent&&(Ze.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),c.forEach(It),nt(e),Pr()}function nt(e){e===void 0&&(e=Ko()),A==="radial"?fr(e):A==="path"?Dr():A==="focus"?jr():mr(),W.classList.toggle("focus",A==="focus"),c.forEach(t=>{let n=t.el.style;n.setProperty("--cx",t.cx),n.setProperty("--cy",t.cy)}),_r(),_e(),Ln()}function _r(){let e="";if(A==="focus"){Zt.innerHTML="";return}if(A==="path"){for(let t=1;t<h.length;t++){let n=c.get(h[t-1]),o=c.get(h[t]);e+='<path data-from="'+n.id+'" data-to="'+o.id+'" d="M '+n.cx+" "+n.cy+" L "+o.cx+" "+o.cy+'"/>'}Zt.innerHTML=e;return}c.forEach(t=>{if(!t.parent)return;let n=c.get(t.parent);if(A==="radial")e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+n.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=n.cy+n._h/2,a=t.cy-t._h/2,r=o+(a-o)/2;e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+o+" L "+n.cx+" "+r+" L "+t.cx+" "+r+" L "+t.cx+" "+a+'"/>'}}),Zt.innerHTML=e}function At(e){let t=[],n=e;for(;n;)t.unshift(n),n=c.get(n).parent;return t}function Pe(){let e=C.clientWidth,t=C.clientHeight;W.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+E.zoom+") translate("+-E.x+"px,"+-E.y+"px)",aa()}function kn(){Xe&&(Xe.kill(),Xe=null)}function dn(e,t){if(kn(),t||je||!window.gsap){Object.assign(E,e),Pe();return}let n=C.clientWidth,o=Math.hypot(e.x-E.x,e.y-E.y),a=e.zoom,r=gsap.timeline({onUpdate:Pe,onComplete:()=>{Xe=null}}),{zoom:i,...s}=e,l=o*Math.min(E.zoom,a),d=Math.max(.55,Math.min(1.3,.55+l/n*.3));if(r.to(E,{...s,duration:d,ease:"power2.inOut"},0),l>n*1.2){let f=Math.max(.06,Math.min(E.zoom,a,n*.9/(o+Ie)));r.to(E,{zoom:f,duration:d/2,ease:"sine.out"},0).to(E,{zoom:a,duration:d/2,ease:"sine.in"},d/2)}else r.to(E,{zoom:a,duration:d,ease:"power2.inOut"},0);Xe=r}function Nr(){let e=C.getBoundingClientRect(),t=14,n=[];if(!ce.hidden&&ce.offsetWidth){let a=ce.getBoundingClientRect();n.push({x0:a.left-e.left-t,y0:a.top-e.top-t,x1:a.right-e.left+t,y1:a.bottom-e.top+t})}let o=pr();return o&&n.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),n}function Hr(){let e=C.clientWidth,t=C.clientHeight,n=[{x0:16,y0:R?20:56,x1:e-16,y1:t-(R?20:74)}];return Nr().forEach(o=>{let a=[];n.forEach(r=>{if(o.x1<=r.x0||o.x0>=r.x1||o.y1<=r.y0||o.y0>=r.y1){a.push(r);return}[{...r,x1:Math.min(r.x1,o.x0)},{...r,x0:Math.max(r.x0,o.x1)},{...r,y1:Math.min(r.y1,o.y0)},{...r,y0:Math.max(r.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&a.push(i)})}),a.length&&(n=a)}),n}function pn(e,t,n){let o=C.clientWidth,a=C.clientHeight,r=null;return Hr().forEach(i=>{let s=n*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!r||s>r.zoom)&&(r={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-a/2})}),r}function Zo(e,t,n,o){return{x:e-n.sx/o,y:t-n.sy/o}}function Le(e,t){let n=c.get(e);if(!n)return;if(document.body.classList.toggle("full-card",n.el.classList.contains("card-full")),n.el.classList.contains("card-full")){let l=Math.min(C.clientWidth/n._w,C.clientHeight/n._h);dn({x:n.cx,y:n.cy,zoom:l},t);return}let o=pn(n._w,n._h,Qe),a=et(e),r=h.filter(l=>et(l)===a&&!c.get(l).visual).map(l=>{let d=c.get(l);return pn(d._w,d._h,Qe).zoom}).sort((l,d)=>l-d),i=r.length?r[Math.floor((r.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));dn(Object.assign(Zo(n.cx,n.cy,o,s),{zoom:s}),t)}function ot(e){document.body.classList.remove("full-card");let t=[...c.values()];if(!t.length)return;let n=C.clientWidth,o=C.clientHeight,a=Math.min(...t.map(f=>f.cx-f._w/2)),r=Math.max(...t.map(f=>f.cx+f._w/2)),i=Math.min(...t.map(f=>f.cy-f._h/2)),s=Math.max(...t.map(f=>f.cy+f._h/2)),l=pn(r-a,s-i,.94),d=Math.max(.05,Math.min(1,l.zoom));dn(Object.assign(Zo((a+r)/2,(i+s)/2,l,d),{zoom:d}),e)}function te(e){p&&c.has(p)?Le(p,e):ot(e)}function _e(){let e=p?At(p):[];c.forEach(t=>{let n=t.el;n.classList.toggle("current",t.id===p),n.classList.toggle("active-path",e.includes(t.id))}),W.querySelectorAll("#connectors path").forEach(t=>{let n=A==="path"?!!p&&h.indexOf(t.dataset.to)<=h.indexOf(p):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",n)}),qr(e),ea()}function Qo(){return Vn(new URLSearchParams(location.search).get("duration")??x.duration)}function Fr(){return R&&Qo()>0&&(!u.active||/^always$/i.test(x.timer||""))}function wt(){let e=Fr()&&pe.start>0;if(we.classList.toggle("timed",e),!e){we.classList.remove("over");return}let n=(u.active&&u.t0?Lt():performance.now()-pe.start)/Qo();we.firstChild.style.width=Math.min(100,n*100)+"%",we.classList.toggle("over",n>=1)}function Wr(){pe.start=performance.now(),clearInterval(pe.timer),pe.timer=setInterval(wt,1e3),wt()}function Ur(){clearInterval(pe.timer),pe.timer=null,pe.start=0,wt()}function ea(){let e=R&&h.length>1&&!/^(off|no|false)$/i.test(x.progress||"");if(we.classList.toggle("show",e),!e)return;wt();let t=h.indexOf(p),n=0,o=0;h.forEach((a,r)=>{let i=Ce(c.get(a)).length;n+=i,r<t?o+=i:r===t&&(o+=Math.min(ee,i-1)+1)}),we.lastChild.style.width=(n?o/n*100:0)+"%"}function qr(e){ko.innerHTML=e.map((t,n)=>(n>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===p?" here":"")+'" data-id="'+T(t)+'">'+T(c.get(t).title)+"</button>").join(""),ko.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{u.active||P(t.dataset.id)}))}function at(e){let t=c.get(p);t&&(wn(t,Yo().frag,e),xn(),(z.hidden||!Ae||!Ae.full)&&Gr(t),En(t))}function Yr(e){return!h.length||e.id!==h[0]&&e.id!==h[h.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function Gr(e){if(e._played||!window.gsap||je)return;e._played=!0;let t=Yr(e);if(t&&t.length){e._auto=t;let[n,...o]=t;/^H[1-3]$/.test(n.tagName)&&!n.children.length?(n.classList.add("auto-scramble"),Oo(n)):o.unshift(n),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(n=>{let o;try{o=JSON.parse(n.dataset.gsap)}catch{return}let a={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(n,o.from||{},Object.assign({},o.to,a)):o.from&&gsap.from(n,Object.assign({},o.from,a))}),e.el.querySelectorAll(".title-scramble").forEach(Oo)}function Sn(e){!e||!e._played||(e._played=!1,window.gsap&&(e._auto&&(e._auto.forEach(t=>{gsap.killTweensOf(t),gsap.set(t,{clearProps:"opacity,transform"})}),e._auto=null),e.el.querySelectorAll("[data-gsap]").forEach(t=>{gsap.killTweensOf(t);let n={};try{n=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},n.from,n.to)).map(a=>$r.includes(a)?"transform":a));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble, .auto-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function Oo(e){let t=e.dataset.text||(e.dataset.text=e.textContent),n=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",a={p:0};e._scramble=gsap.to(a,{p:1,duration:1.4,ease:"none",onUpdate(){let r=Math.floor(a.p*n.length);e.textContent=n.map((i,s)=>s<r||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function En(e){clearTimeout(Re),!(!R||!e||!e.autoslide||u.active&&(!u.t0||u.paused))&&(Re=setTimeout(()=>{p===e.id&&De(1)},e.autoslide))}function ta(e){let t=e&&e!==h[0]?e:"";try{y&&y.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Vt(y.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function P(e,t,n){if(!c.has(e))return;if(e!==p){fe=null,de=-1,ee=n?Ce(c.get(e)).length-1:0;let r=c.get(p);r&&A==="focus"&&!t&&(r.el.classList.add("leaving"),setTimeout(()=>r.el.classList.remove("leaving"),600)),na()}let o=e!==p;if(p=e,clearTimeout(V),V=null,o&&A==="focus"&&!t&&!je){let r=c.get(e).el;r.classList.add("entering"),r.offsetWidth,r.classList.remove("entering")}at(o),o&&Bn("slide",e);let a=c.get(e);o&&a.mapFirst&&!n&&!t&&A!=="focus"?(ot(),V=setTimeout(()=>{V=null,p===e&&Le(e)},1900)):Le(e,t),_e(),Ln(),ta(e)}function na(){let e=c.get(p);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>Xo(t,"pauseVideo")),wn(e,e.frags.length,!0),Sn(e))}function Kr(){if(!p&&ke&&c.has(ke)){oa();return}p&&(ke=p),A==="focus"&&Se("path"),na(),clearTimeout(Re),p=null,_e(),Ln(),ot(),ta(null)}function oa(){if(V)return clearTimeout(V),V=null,Le(p),!0;if(!p&&ke&&c.has(ke)){let e=ke;return ke=null,P(e),!0}return!1}function De(e){if(!p){h.length&&P(h[e>0?0:h.length-1]);return}if(V&&e>0){clearTimeout(V),V=null,Le(p);return}let t=Ce(c.get(p)),n=Math.min(ee,t.length-1)+e;if(n>=0&&n<t.length){ee=n,fe=null,de=-1,at(),!U&&!z.hidden&&Ae.used?it():te(),_e();return}let o=h.indexOf(p)+e;o>=0&&o<h.length&&P(h[o],!1,e<0)}function Vr(){let e=c.get(p);e&&e.parent&&P(e.parent)}function Xr(){let e=c.get(p);e&&e.children.length?P(e.children[0]):!p&&h.length&&P(h[0])}function Ln(){let e=[...c.values()];if(!e.length){rn.innerHTML="",re=null;return}Va.textContent="map";let t=g=>g.cx,n=g=>g.cy,o=Math.min(...e.map(t))-Ie/2,a=Math.max(...e.map(t))+Ie/2,r=Math.min(...e.map(n))-sn/2,i=Math.max(...e.map(n))+sn/2,s=16,l=180,d=130,f=Math.min((l-2*s)/Math.max(1,a-o),(d-2*s-6)/Math.max(1,i-r)),N=l/2-(o+a)/2*f,O=d/2+5-(r+i)/2*f,b=p?At(p):[],S="";e.forEach(g=>{if(!g.parent)return;let B=c.get(g.parent);S+='<line x1="'+(t(B)*f+N)+'" y1="'+(n(B)*f+O)+'" x2="'+(t(g)*f+N)+'" y2="'+(n(g)*f+O)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(g=>{let B=g.id===p?"var(--accent)":b.includes(g.id)?"var(--accent-teal)":"var(--node-border)";S+='<circle data-id="'+T(g.id)+'" cx="'+(t(g)*f+N)+'" cy="'+(n(g)*f+O)+'" r="'+(g.id===p?4:3)+'" fill="'+B+'"><title>'+T(g.title)+"</title></circle>"}),S+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',rn.innerHTML=S,re={s:f,ox:N,oy:O},aa()}function aa(){let e=document.getElementById("mm-viewport");if(!e||!re)return;let t=C.clientWidth/E.zoom,n=C.clientHeight/E.zoom;e.setAttribute("x",(E.x-t/2)*re.s+re.ox),e.setAttribute("y",(E.y-n/2)*re.s+re.oy),e.setAttribute("width",Math.max(2,t*re.s)),e.setAttribute("height",Math.max(2,n*re.s))}function Pt(e){Go(J.value),p&&!c.has(p)&&(p=null),Jo(),p?P(p,e):h.length?P(h[0],e):(p=null,ot(!0))}function Se(e,t){A=e,Q("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(n=>n.classList.toggle("active",n.dataset.mode===e)),c.size&&(!t&&!je&&(W.classList.add("morph"),setTimeout(()=>W.classList.remove("morph"),700)),nt(),Pe(),p?Le(p,t):ot(t))}function ra(e){return Math.max(.04,Math.min(5,e))}function Jr(e){Qe=Math.round(Math.max(tr,Math.min(nr,e))*100)/100,Q("slidetake:slideSize",Qe),p&&Le(p)}function zo(e){p?Jr(Qe+e*.1):ia(e>0?1.2:1/1.2)}function ia(e,t,n){kn();let o=ra(E.zoom*e);if(t!==void 0){let a=C.getBoundingClientRect(),r=t-a.left-a.width/2,i=n-a.top-a.height/2;E.x+=r/E.zoom-r/o,E.y+=i/E.zoom-i/o}E.zoom=o,Pe()}function Rt(){M||(me.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!me.classList.contains("collapsed")))}function ge(e){R=e,document.body.classList.toggle("presenting",e),Sa();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!p&&h.length&&P(h[0]);let n=x.camera||[...c.values()].some(o=>o.camera);e&&n&&!U&&!q&&it(),e?En(c.get(p)):clearTimeout(Re),e?Wr():Ur(),ea()}function Lt(){return(u.paused?u.pauseAt:performance.now())-u.t0-u.pausedMs}function Dt(e){e.classList.add("open")}function Mn(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function ti(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,n,...o]=e.split(":");return kt.value=t||"localhost",St.value=n||"4455",Et.value=o.join(":"),!0}try{let t=JSON.parse(Z("slidetake:obs")||"null");t&&(kt.value=t.host||"localhost",St.value=t.port||"4455",Et.value=t.password||"",Cn.checked=!0)}catch{}return!1}function ca(){if(Cn.checked)Q("slidetake:obs",JSON.stringify({host:kt.value.trim(),port:St.value.trim(),password:Et.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Ye(e,t){Do.textContent=e,Do.className=t||""}function oi(e){return location.protocol==="https:"&&!ni(e)}async function da(){let e=kt.value.trim()||"localhost",t="ws://"+e+":"+(St.value.trim()||"4455");if(oi(e)){xe=!1,Je.disabled=!0,Ye(ai,"err");return}Ye("Connecting to "+t+"\u2026");try{await cn(Zr);let n=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(F)try{await F.disconnect()}catch{}F=new n,F.on("ConnectionClosed",()=>{xe=!1,Ye("Disconnected from OBS","err"),Je.disabled=!0}),F.on("RecordStateChanged",a=>{a.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ee&&(Ee(),Ee=null),a.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&u.active&&u.withObs&&!u.finishing&&jt("Stopped in OBS")});let o=await F.connect(t,Et.value||void 0);xe=!0;try{let a=await F.call("GetVideoSettings");a&&a.fpsNumerator&&a.fpsDenominator&&(sa=a.fpsNumerator/a.fpsDenominator)}catch{}Ye("Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),"ok"),ca()}catch(n){xe=!1,Ye("Could not connect ("+(n&&n.message||n)+"). Is OBS running with its WebSocket server on, and is the password right?","err")}Je.disabled=!xe}function ri(){let e=document.getElementById("rec-screen"),t=screen.width,n=screen.height;if(Math.abs(t/n-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+n+"), right for YouTube.</span>";return}let o=[["16:10",1.6],["3:2",1.5],["4:3",4/3],["21:9",21/9],["16:9",16/9]],[a,r]=o.reduce((s,l)=>Math.abs(l[1]-t/n)<Math.abs(s[1]-t/n)?l:s),i=Math.abs(r-t/n)<.005?a:"about "+a;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+n+"), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>"}function hn(){if(!tt)return;let e=h.reduce((n,o)=>n+Ce(c.get(o)).length,0),t=x.camera||[...c.values()].some(n=>n.camera);document.getElementById("rec-deck-info").innerHTML=T(x.title||(se[0]?c.get(se[0]).title:"This deck"))+" \xB7 "+h.length+" slides \xB7 "+e+" presses"+(t&&q?'<br><span class="warn">The camera is off. Press C first if this take should include your webcam.</span>':""),Je.disabled=!xe,di(),ri(),Dt(Qr)}async function pa(e){if(u.active||!h.length)return;Mn(),Object.assign(u,{active:!0,withObs:e,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null}),document.body.classList.add("recording"),wa();let t=document.getElementById("rec-layout").value;t!=="current"&&t!==A&&Se(t,!0),R||ge(!0),p===h[0]&&(ee=0,fe=null,de=-1),P(h[0],!0);for(let o=3;o>0;o--)if(bt.querySelector(".num").textContent=o,bt.classList.add("show"),await Tn(1e3),!u.active)return;if(bt.classList.remove("show"),await la(),e){let o=new Promise(a=>{Ee=a,setTimeout(()=>{Ee&&(Ee(),Ee=null)},2500)});try{await F.call("StartRecord")}catch(a){On("OBS could not start recording: "+(a&&a.message||a));return}if(await o,!u.active)return}u.counting=!1,u.t0=performance.now();let n=c.get(p);Sn(n),at(!0),Bn("slide",p)}function On(e){u.active=!1,u.counting=!1,bt.classList.remove("show"),document.body.classList.remove("recording"),R&&ge(!1),Be(e)}function Bn(e,t){if(!u.active||!u.t0||u.finishing)return;let n=c.get(t),o={id:t,title:n?n.title:t,retake:e==="retake",t:Math.round(Lt()),obsT:null};u.events.push(o),u.withObs&&xe&&(F.call("GetRecordStatus").then(a=>{a&&typeof a.outputDuration=="number"&&(o.obsT=a.outputDuration)}).catch(()=>{}),n&&F.call("CreateRecordChapter",{chapterName:(o.retake?"RETAKE \xB7 ":"")+n.title}).catch(()=>{}))}function ii(e){let t=e.key;if((Ao.includes(t)||Po.includes(t)||Ro.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){u.counting?On("Take cancelled"):jt("Stopped early");return}if(!(u.counting||u.finishing)){if(Ro.includes(t)){ci();return}u.paused||(Ao.includes(t)?si():Po.includes(t)&&li())}}function si(){let e=Ce(c.get(p));Math.min(ee,e.length-1)>=e.length-1&&h.indexOf(p)===h.length-1?jt():De(1)}function li(){let e=c.get(p);e&&(Bn("retake",p),ee=0,fe=null,de=-1,Sn(e),at(!0),!U&&!z.hidden&&Ae.used?it():te(),_e())}async function ci(){u.t0&&(u.paused?(un.classList.remove("show"),await la(),u.withObs&&await F.call("ResumeRecord").catch(()=>{}),u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,En(c.get(p))):(u.paused=!0,u.pauseAt=performance.now(),clearTimeout(Re),u.withObs&&await F.call("PauseRecord").catch(()=>{}),un.classList.add("show")))}async function jt(e){if(!u.active||u.finishing)return;if(u.counting){On("Take cancelled");return}u.finishing=!0,clearTimeout(Re),u.paused&&(u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,un.classList.remove("show"));let t=Math.round(Lt()),n=null;if(u.withObs){await Tn(1200),t=Math.round(Lt());try{let a=await F.call("GetRecordStatus");a&&typeof a.outputDuration=="number"&&(n=a.outputDuration)}catch{}try{let a=await F.call("StopRecord");u.outputPath=a&&a.outputPath}catch(a){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(a&&a.message||a)+")"}}u.active=!1,u.finishing=!1,document.body.classList.remove("recording"),R&&ge(!1);let o={key:_t(),deckTitle:x.title||c.get(h[0]).title,date:new Date().toISOString(),withObs:u.withObs,outputPath:u.outputPath,reason:e||"",total:t,totalObs:n,fps:sa,events:u.events.map(a=>({id:a.id,title:a.title,retake:a.retake,t:a.t,obsT:a.obsT})),picks:{}};zn(o),ya(o)}function _t(){return Te(x.title||(h[0]?c.get(h[0]).title:"deck"))}function ua(){try{return JSON.parse(Z("slidetake:sessions")||"[]")}catch{return[]}}function zn(e){let t=ua().filter(n=>n.date!==e.date);t.unshift(e),Q("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function di(){let e=document.getElementById("rec-sessions"),t=ua().filter(n=>n.key===_t());e.innerHTML=t.length?"<h3>Earlier takes of this deck</h3>"+t.map((n,o)=>'<div class="row"><button class="btn small" data-session="'+o+'">Review</button><span>'+T(new Date(n.date).toLocaleString())+" \xB7 "+K(n.totalObs??n.total)+(n.withObs?"":" \xB7 rehearsal")+(n.outputPath?" \xB7 "+T(Me(n.outputPath)):"")+"</span></div>").join(""):"",e.querySelectorAll("[data-session]").forEach(n=>n.onclick=()=>{Mn(),ya(t[+n.dataset.session])})}function et(e){let t=c.has(e)?At(e):[e];return t[Math.min(1,t.length-1)]}function ha(e,t){let n=et(e);return{sec:n,title:c.has(n)?c.get(n).title:t}}function ga(){let e=Object.keys(x).filter(t=>t==="tags"||/_tags$/.test(t)).flatMap(t=>[].concat(x[t])).filter(t=>typeof t=="string");return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function pi(){return[].concat(x.related||[]).map(e=>{let t=String(e).match(/^\[([^\]]+)\]\(([^)]+)\)$/),n=String(e).split("|");return t?t[1]+": "+t[2]:n.length===2?n[0].trim()+": "+n[1].trim():String(e)})}function ui(){if(x.permalink||x.url)return x.permalink||x.url;let e=x.site||Z("slidetake:site");if(!e||!X)return"";try{let t=new URL(X).pathname.replace(/\/index\.md$/i,"/").replace(/\.md$/i,"/");return new URL(t,e).href}catch{return""}}function ba(e){let t=ma(e),n=document.getElementById("rv-link").value.trim(),o=pi(),a=ga(),r=[];x.summary&&r.push(x.summary),n&&r.push("\u{1F4D1} Slides: "+n),t.lines.length>=3&&r.push(`Chapters
444
620
  `+t.lines.join(`
445
621
  `)),o.length&&r.push(`Related
446
622
  `+o.map(i=>"\u2022 "+i).join(`
447
623
  `)),a.length&&r.push(a.slice(0,3).map(i=>"#"+i.replace(/[^\p{L}\p{N}]+/gu,"")).join(" ")),document.getElementById("rv-yt-desc").value=r.join(`
448
624
 
449
- `),document.getElementById("rv-chapters-note").textContent=(t.dropped?t.dropped+" section"+(t.dropped>1?"s were":" was")+" under 10 seconds and folded into the chapter before, as YouTube requires. ":"")+(t.lines.length<3?"YouTube needs at least three chapters, so none are listed. ":"")+"Final length "+Y(t.length)+"."}function na(e){_=e,F=null;let t=je(e),n=e.events.filter(a=>a.retake).length;document.getElementById("rv-title").textContent=(e.withObs?"Review the take \xB7 ":"Rehearsal \xB7 ")+e.deckTitle,document.getElementById("rv-info").textContent=[e.reason,new Date(e.date).toLocaleString(),(e.withObs?"recorded ":"ran ")+Y(e.totalObs??e.total),t.size+" slides",n?n+" retake"+(n>1?"s":""):"no retakes",e.outputPath?"saved to "+e.outputPath:e.withObs?"":"nothing was recorded"].filter(Boolean).join(" \xB7 "),document.getElementById("rv-file").textContent=e.outputPath?" ("+Se(e.outputPath)+")":"",document.getElementById("rv-yt-title").value=e.deckTitle;let o=dt(e);wt.value=[...wt.options].reduce((a,r)=>Math.abs(r.value-o)<Math.abs(a.value-o)?r:a).value,document.getElementById("rv-yt-tags").value=ea().join(", "),document.getElementById("rv-link").value=Pr(),I.src&&de!==Se(e.outputPath)&&e.outputPath&&(I.removeAttribute("src"),I.load(),de=""),document.getElementById("rv-novideo").hidden=!!I.src,Rt(),It(wr),_r(e)}function Rt(){let e=_,t=document.getElementById("rv-list"),n=null;t.innerHTML=[...je(e).values()].map(o=>{let a=e.picks[o.id]??o.takes.length,r=Ve(o.id),i=r!==n;n=r;let s=o.takes.map(l=>'<button class="rv-chip'+(a===l.no?" on":"")+'" data-id="'+B(o.id)+'" data-take="'+l.no+'">'+(o.takes.length>1?"Take "+l.no+" \xB7 ":"")+Y(l.end-l.start)+"</button>").join("")+'<button class="rv-chip skip'+(a===0?" on":"")+'" data-id="'+B(o.id)+'" data-take="0">Leave out</button>';return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+B(o.title)+"<small>"+Y(o.takes[0].start)+'</small></div><div class="rv-chips">'+s+"</div></div>"}).join(""),t.querySelectorAll(".rv-chip").forEach(o=>o.onclick=()=>{e.picks[o.dataset.id]=+o.dataset.take,Sn(e),Rt();let a=je(e).get(o.dataset.id),r=a&&a.takes[+o.dataset.take-1];r&&Et([{start:r.start,end:r.end,title:a.title+(a.takes.length>1?" \xB7 take "+r.no:"")}])}),document.getElementById("rv-ffmpeg").value=Qo(e,document.getElementById("rv-mode").value),ta(e)}function Et(e){if(!I.src){kt=e,q.textContent=sn?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.";return}kt=null,F={ranges:e,i:0},q.textContent="\u25B6 "+e[0].title;let t=()=>{I.currentTime=e[0].start/1e3,I.play().catch(n=>{n&&n.name!=="AbortError"&&(q.textContent="Could not play: "+n.message)})};I.readyState>=1?t():I.addEventListener("loadedmetadata",t,{once:!0})}function oa(e){return new Promise((t,n)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>n(o.error)})}async function Rr(e){let t=async n=>{let o=await oa(n);return await new Promise(a=>{let r=o.transaction("kv").objectStore("kv").get(e);r.onsuccess=()=>a(r.result),r.onerror=()=>a(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function Ar(e,t){try{(await oa()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function At(e){sn=!0;try{return await Dr(e)}finally{sn=!1}}async function Dr(e){let t=await e.getFile();for(let n=0;n<10;n++){await new Promise(a=>setTimeout(a,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function Qe(e,t,n){I.src&&URL.revokeObjectURL(I.src),Ue=t||null,n||(rn=0),I.src=URL.createObjectURL(e),de=e.name,document.getElementById("rv-novideo").hidden=!0,q.textContent="Loaded "+e.name+". Click a take to preview it.",kt?Et(kt):n&&F&&Et(F.ranges.slice(F.i)),_&&(document.getElementById("rv-ffmpeg").value=Qo(_,document.getElementById("rv-mode").value))}async function _r(e){let t=Se(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(de===t&&I.src))try{let n=await Rr("obs-folder");if(!n||await n.queryPermission({mode:"read"})!=="granted")return;let o=await n.getFileHandle(t);q.textContent="Opening "+t+"\u2026",Qe(await At(o),o)}catch{}}function Ce(e,t){u.active||(ht.textContent=e,ht.classList.add("show"),clearTimeout(ln),t||(ln=setTimeout(()=>ht.classList.remove("show"),9e3)))}function ra(){clearTimeout(ln),ht.classList.remove("show")}function Jt(){let e=!1;try{e=window.top!==window.self}catch{e=!0}return e?" This page is running inside a preview frame that may not allow cameras. Open Slidetake directly in Chrome (from localhost or as a file).":window.isSecureContext?" Allow camera access for this page in the browser\u2019s site settings (the icon at the left of the address bar), then try again.":" Browsers only allow cameras on secure pages. Open it from http://localhost or as a local file in Chrome."}function ia(){U&&U.getTracks().forEach(t=>t.stop()),U=null;let e=O.querySelector("video");e&&e.remove()}async function et(){if(!(U||N)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Ce("Camera not available on this page."+Jt());return}if(ae.disabled)return;ae.disabled=!0,Ce("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{U=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),ra()}catch(t){let n=t&&t.name;Ce(n==="NotAllowedError"||n==="SecurityError"?"Camera access was blocked."+Jt():n==="NotFoundError"||n==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":n==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(n?" ("+n+")":"")+"."+Jt());return}finally{ae.disabled=!1,Ln()}U.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{ia(),ft(),ee()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=U,O.appendChild(e)}ft(),ee()}}function Ln(){ae.querySelector("svg")||(ae.innerHTML=jr+'<span class="lbl"> Camera</span>'),ae.classList.toggle("on",!N),ae.setAttribute("aria-pressed",String(!N)),ae.title=N?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function Cn(e){e&&!Ct||(N=!e,N&&ia(),he=null,le=-1,Q=Math.min(Q,Math.max(0,ke(c.get(p)).length-1)),Ln(),ft(),Ze(),Pe(),ee(),D||Ce(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&et())}function sa(){document.body.classList.remove("idle"),clearTimeout(wo),D&&(wo=setTimeout(()=>document.body.classList.add("idle"),2e3))}function St(e,t){Te.textContent=e,Te.classList.add("show"),clearTimeout(Eo),Eo=setTimeout(()=>Te.classList.remove("show"),t||2500)}function cn(e,{keepObs:t=!0,keepEdit:n=!0,slide:o=""}={}){let a=new URL(Xn(e),location.origin);return new URLSearchParams(location.search).forEach((r,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!n||a.searchParams.set(i,r)}),o&&(a.hash=o),a.href.replace(a.pathname,a.pathname.replace(/%40/g,"@"))}async function Hr(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(v.kind==="source")return{link:cn(v.source,t),inside:!1};if(v.kind==="copy"&&lt(k)&&["url","gist","builtin"].includes(k.origin.kind))return{link:cn(k.origin,t),inside:!1};let o=v.kind==="share"?v.data:await Zn(X.value),a=new URLSearchParams(location.search);return["src","obs","edit"].forEach(r=>a.delete(r)),{link:location.origin+"/share"+(a.toString()?"?"+a:"")+qt(o,e),inside:!0}}function Wr(){let e=J("slidetake:draft");if(!e||e===Dt)return null;let t=it(e,{kind:"file",name:"your earlier draft"},{exported:!0});Z("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function tt(){Z("slidetake:copy",JSON.stringify(k))}function Re(){if(M)return;let e;if(v.kind==="copy")e='<span class="mine">Your copy of '+B(ne(k.origin))+"</span>"+(st(k)?' <span class="edited">\xB7 edited</span>':"");else{let n=v.kind==="share"?"a shared deck":ne(v.source);e='<span class="mine">'+B(n.charAt(0).toUpperCase()+n.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,ue.classList.toggle("unsaved",v.kind==="copy"&&st(k)),document.getElementById("btn-reset").hidden=!(v.kind==="copy"&&!lt(k));let t=document.getElementById("continue");t.hidden=v.kind==="copy"||!k,k&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+ne(k.origin))}function la(e){return!k||!st(k)?!0:confirm("Your copy of "+ne(k.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function ca(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function Ur(){let e=v.kind==="share"?{kind:"shared"}:v.source;return la("a copy of "+ne(e))?(k=it(v.text,e),v={kind:"copy"},history.pushState(null,"",ca()+(p&&p!==f[0]?"#"+encodeURIComponent(p):"")),St("Editing your own copy of "+ne(e)+". The original is unchanged.",4e3),!0):(X.value=v.text,!1)}function Nr(){v={kind:"copy"},history.pushState(null,"",ca()),ue.classList.contains("collapsed")&&Ot(),X.value=k.text,Bt(!0),Re()}async function qr(e){if(e.kind==="builtin")return mt[e.id]??mt.home;if(e.kind==="gist"){let n=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!n.ok)throw new Error(n.status===404?"no such gist":n.status+" "+n.statusText);let o=Object.values((await n.json()).files||{}),a=o.find(r=>r.filename===e.file)||o.find(r=>/\.(md|markdown)$/i.test(r.filename))||o[0];if(!a)throw new Error("the gist has no files");return V=a.raw_url,a.truncated?await(await fetch(a.raw_url)).text():a.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return V=new URL(e.url,location.href).href,await t.text()}function Co(){return v={kind:"source",source:{kind:"builtin",id:"home"},text:mt.home},v.text}async function $r(){if(M)return V=M.base||location.href,v={kind:"source",source:{kind:"url",url:V},text:Nn(M.settings||{})+String(M.markdown||"")},v.text;if($.page==="edit"){if(k)return v={kind:"copy"},k.text;history.replaceState(null,"","/new"+location.search),$.page="pick"}if($.page==="pick")return It(document.getElementById("new-dialog")),v={kind:"source",source:{kind:"builtin",id:"template:blank"},text:mt["template:blank"]},v.text;if($.page==="share")try{let e=await Qn($.data);return v={kind:"share",data:$.data,text:e},e}catch{return St("This link's deck is damaged or cut short, so it could not be opened.",6e3),Co()}try{let e=await qr($.source);return v={kind:"source",source:$.source,text:e},e}catch(e){return Ye.textContent="Could not load the deck ("+e.message+")",St("Could not load "+ne($.source)+": "+e.message,6e3),Co()}}var M,To,Ct,ze,mt,X,T,G,Gt,co,Oa,Ye,Zt,Ia,ue,Ge,po,pt,Qt,za,Pa,Ra,Aa,Da,_a,Ke,c,f,re,p,z,D,y,N,U,se,O,ja,L,qe,uo,Q,he,le,Me,V,ho,Qa,er,Kt,We,Vt,ge,ce,ur,Oe,K,be,oe,mo,Xt,Le,go,yr,bo,vo,yo,xr,wr,ut,on,bt,vt,yt,yn,xo,$e,H,fe,ye,$o,u,xn,Yo,Er,Lr,de,Zo,Qo,_,F,I,q,wt,kt,Ue,rn,sn,Ne,aa,ae,ht,ln,jr,wo,pe,ko,Te,Eo,Fr,dn,pn,So,Lt,$,Lo,v,k,da=W(()=>{"use strict";On();In();Pn();An();_n();ot();$n();Kn();Ut();$t();no();lo();M=window.SLIDETAKE||null,To=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!M);Ct=!M||M.recording===!0||new URLSearchParams(location.search).has("obs");document.documentElement.classList.toggle("no-record",!Ct);ze=window.matchMedia("(prefers-reduced-motion: reduce)").matches,mt={home:Dt,help:zn,"template:blank":Rn,"template:talk":Dn,"template:recording":jn},X=document.getElementById("editor"),T=document.getElementById("stage"),G=document.getElementById("world"),Gt=document.getElementById("connectors"),co=document.getElementById("breadcrumbs"),Oa=document.getElementById("status-count"),Ye=document.getElementById("status-err"),Zt=document.getElementById("mm-svg"),Ia=document.getElementById("mm-label"),ue=document.getElementById("editor-pane"),Ge=440,po=720,pt=960,Qt=180,za=540,Pa=100,Ra=110,Aa=420,Da=.35,_a=1,Ke=parseFloat(J("slidetake:slideSize"))||.92,c=new Map,f=[],re=[],p=null,z="tree",D=!1,y={},N=!0,U=null,se=document.getElementById("brand"),O=document.getElementById("pip"),ja=document.getElementById("stage-wrap"),L={x:0,y:0,zoom:.6},qe=null;uo=new URLSearchParams(location.search).get("mode");Q=0;he=null,le=-1,Me=null;V=null;ho=null;Qa="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",er="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Kt={};We=0,Vt=null;ge=document.getElementById("progress");ge.innerHTML="<b></b><i></i>";ce={start:0,timer:null};ur=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];Oe=null;K=null;be=null;oe=null;Zt.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!u.active&&P(t.dataset.id)});mo=null;X.addEventListener("input",()=>{v.kind!=="copy"&&!Ur()||(k.text=X.value,Re(),clearTimeout(mo),mo=setTimeout(()=>{tt(),Bt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==z&&ve(e.dataset.mode)})});(function(){let e=new Map,t=0,n=!1,o=null,a=()=>{let[i,s]=[...e.values()];return Math.hypot(i.x-s.x,i.y-s.y)||1};T.addEventListener("pointerdown",i=>{i.pointerType==="mouse"&&i.button!==0||u.active||i.target.closest("a, pre, code, input, textarea")||(e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t=0,n=!1,e.size===2&&(o={d:a(),zoom:L.zoom}))}),window.addEventListener("pointermove",i=>{let s=e.get(i.pointerId);if(!s)return;let l=i.clientX-s.x,d=i.clientY-s.y;e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t+=Math.abs(l)+Math.abs(d),!n&&t>5&&(n=!0,fn(),T.classList.add("dragging")),n&&(e.size===2&&o?L.zoom=No(o.zoom*a()/o.d):(L.x-=l/L.zoom,L.y-=d/L.zoom),Be())});let r=i=>{e.delete(i.pointerId),e.size<2&&(o=null),e.size||T.classList.remove("dragging")};window.addEventListener("pointerup",r),window.addEventListener("pointercancel",r),T.addEventListener("click",i=>{n&&(i.stopPropagation(),i.preventDefault(),n=!1)},!0)})();T.addEventListener("wheel",e=>{e.preventDefault(),!u.active&&qo(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>Ie(-1);document.getElementById("nav-next").onclick=()=>Ie(1);document.getElementById("btn-open").onclick=()=>document.getElementById("file-input").click();document.getElementById("file-input").addEventListener("change",e=>{let t=e.target.files[0];if(!t)return;let n=new FileReader;n.onload=()=>{la("a copy of "+t.name)&&(k=it(String(n.result),{kind:"file",name:t.name},{exported:!0}),tt(),V=null,p=null,Nr())},n.readAsText(t),e.target.value=""});document.getElementById("btn-save").onclick=()=>{let e=new Blob([X.value],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=(re[0]?Ee(c.get(re[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),v.kind==="copy"&&(k.exported=k.text,tt(),Re())};document.getElementById("btn-reset").onclick=()=>{v.kind!=="copy"||lt(k)||confirm("Discard your edits and go back to "+ne(k.origin)+" as it was?")&&(k.text=k.originText,tt(),X.value=k.text,p=null,Bt(!0),Re())};document.getElementById("btn-edit-toggle").onclick=Ot;Xt=document.querySelector("main"),Le=document.getElementById("editor-resizer"),go=parseFloat(J("slidetake:editorWidth"));go&&ue.style.setProperty("--editor-w",go+"px");Le.addEventListener("pointerdown",e=>{e.preventDefault(),Le.setPointerCapture(e.pointerId),Xt.classList.add("resizing");let t=Xt.getBoundingClientRect().right,n=a=>{let r=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-a.clientX)));ue.style.setProperty("--editor-w",r+"px")},o=()=>{Xt.classList.remove("resizing"),Le.removeEventListener("pointermove",n),Z("slidetake:editorWidth",String(ue.getBoundingClientRect().width))};Le.addEventListener("pointermove",n),Le.addEventListener("pointerup",o,{once:!0})});Le.addEventListener("dblclick",()=>{ue.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=Bo;document.getElementById("btn-present").onclick=()=>we(!D);yr="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",bo=["ArrowRight","PageDown"," ","ArrowDown","Enter"],vo=["ArrowLeft","PageUp","ArrowUp","r","R"],yo=["b","B","."],xr=document.getElementById("rec-dialog"),wr=document.getElementById("review"),ut=document.getElementById("rec-countdown"),on=document.getElementById("rec-paused"),bt=document.getElementById("obs-host"),vt=document.getElementById("obs-port"),yt=document.getElementById("obs-pass"),yn=document.getElementById("obs-remember"),xo=document.getElementById("obs-status"),$e=document.getElementById("rec-start"),H=null,fe=!1,ye=null,$o=null,u={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null},xn=e=>new Promise(t=>setTimeout(t,e)),Yo=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),xn(100)]);document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});document.querySelectorAll("[data-copy]").forEach(e=>e.addEventListener("click",()=>{let t=document.getElementById(e.dataset.copy);t.select(),(navigator.clipboard?navigator.clipboard.writeText(t.value):Promise.reject()).catch(()=>document.execCommand("copy")),e.textContent="Copied",setTimeout(()=>{e.textContent="Copy"},1500)}));Er=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);Lr="This page is served over https, and browsers block it from reaching OBS on another computer (OBS only offers plain ws://). Run OBS on this computer and use localhost, or open Slidetake from a local copy: download dist/index.html from github.com/slidetake/slidetake and serve it with python3 -m http.server.";document.getElementById("obs-connect").onclick=Ko;yn.addEventListener("change",Go);document.getElementById("btn-record").onclick=an;$e.onclick=()=>Vo(!0);document.getElementById("rec-rehearse").onclick=()=>Vo(!1);de="";Zo=e=>io(e,Jo),Qo=(e,t)=>so(e,t,{input:e.outputPath||de||"recording.mov",outputName:Pt()+"-final.mp4",sectionOf:Jo});_=null,F=null,I=document.getElementById("rv-video"),q=document.getElementById("rv-now");document.getElementById("rv-mode").onchange=()=>Rt();wt=document.getElementById("rv-fps");wt.onchange=()=>{_&&(_.fps=parseFloat(wt.value),Sn(_),Rt())};document.getElementById("rv-link").addEventListener("input",e=>{try{Z("slidetake:site",new URL(e.target.value.trim()).origin)}catch{}_&&ta(_)});kt=null;I.addEventListener("timeupdate",()=>{if(!F)return;let e=F.ranges[F.i];if(I.currentTime*1e3<e.end)return;if(F.i++,F.i>=F.ranges.length){I.pause(),F=null,q.textContent="";return}let t=F.ranges[F.i];I.currentTime=t.start/1e3,q.textContent="\u25B6 "+t.title});document.getElementById("rv-play-final").onclick=()=>{_&&Et(Fe(_).map(e=>({start:e.start,end:e.end,title:e.title})))};Ue=null,rn=0,sn=!1;I.addEventListener("error",async()=>{if(I.getAttribute("src")){if(Ue&&rn<5){rn++,q.textContent="Reloading "+de+" (OBS was still finishing it)\u2026",await new Promise(e=>setTimeout(e,1500));try{Qe(await At(Ue),Ue,!0);return}catch{}}q.textContent=Ue?"Chrome cannot play "+de+". In OBS set Recording Format to Hybrid MP4 (or MP4) with H.264 video; the ffmpeg command still works with this file.":"Could not play "+(de||"this file")+". If OBS was still finishing it when you opened it, open it again; if it still fails, set OBS to Hybrid MP4 (or MP4) with H.264 video."}});Ne=document.getElementById("rv-file-input");Ne.addEventListener("change",()=>{Ne.files[0]&&Qe(Ne.files[0]),Ne.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Ne.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});q.textContent="Opening "+e.name+"\u2026",Qe(await At(e),e)}catch(e){(!e||e.name!=="AbortError")&&(q.textContent="Could not open that file.")}};aa=document.getElementById("rv-folder");aa.hidden=!window.showDirectoryPicker;aa.onclick=async()=>{let e=_&&Se(_.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(Ar("obs-folder",t),!e){q.textContent="Folder remembered. This session has no file name from OBS; open the file instead.";return}let n=await t.getFileHandle(e);Qe(await At(n),n)}catch(t){if(t&&t.name==="AbortError")return;q.textContent=(e?e+" is not in that folder":"Could not read that folder")+". Use \u201COpen the recording file\u2026\u201D instead."}};document.getElementById("rv-download").onclick=()=>{if(!_)return;let e=_,t=Zo(e),n="# "+document.getElementById("rv-yt-title").value+`
625
+ `),document.getElementById("rv-chapters-note").textContent=(t.dropped?t.dropped+" section"+(t.dropped>1?"s were":" was")+" under 10 seconds and folded into the chapter before, as YouTube requires. ":"")+(t.lines.length<3?"YouTube needs at least three chapters, so none are listed. ":"")+"Final length "+K(t.length)+"."}function ya(e){_=e,H=null;let t=qe(e),n=e.events.filter(a=>a.retake).length;document.getElementById("rv-title").textContent=(e.withObs?"Review the take \xB7 ":"Rehearsal \xB7 ")+e.deckTitle,document.getElementById("rv-info").textContent=[e.reason,new Date(e.date).toLocaleString(),(e.withObs?"recorded ":"ran ")+K(e.totalObs??e.total),t.size+" slides",n?n+" retake"+(n>1?"s":""):"no retakes",e.outputPath?"saved to "+e.outputPath:e.withObs?"":"nothing was recorded"].filter(Boolean).join(" \xB7 "),document.getElementById("rv-file").textContent=e.outputPath?" ("+Me(e.outputPath)+")":"",document.getElementById("rv-yt-title").value=e.deckTitle;let o=ft(e);Ct.value=[...Ct.options].reduce((a,r)=>Math.abs(r.value-o)<Math.abs(a.value-o)?r:a).value,document.getElementById("rv-yt-tags").value=ga().join(", "),document.getElementById("rv-link").value=ui(),I.src&&ue!==Me(e.outputPath)&&e.outputPath&&(I.removeAttribute("src"),I.load(),ue=""),document.getElementById("rv-novideo").hidden=!!I.src,Nt(),Dt(ei),gi(e)}function Nt(){let e=_,t=document.getElementById("rv-list"),n=null;t.innerHTML=[...qe(e).values()].map(o=>{let a=e.picks[o.id]??o.takes.length,r=et(o.id),i=r!==n;n=r;let s=o.takes.map(l=>'<button class="rv-chip'+(a===l.no?" on":"")+'" data-id="'+T(o.id)+'" data-take="'+l.no+'">'+(o.takes.length>1?"Take "+l.no+" \xB7 ":"")+K(l.end-l.start)+"</button>").join("")+'<button class="rv-chip skip'+(a===0?" on":"")+'" data-id="'+T(o.id)+'" data-take="0">Leave out</button>';return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+T(o.title)+"<small>"+K(o.takes[0].start)+'</small></div><div class="rv-chips">'+s+"</div></div>"}).join(""),t.querySelectorAll(".rv-chip").forEach(o=>o.onclick=()=>{e.picks[o.dataset.id]=+o.dataset.take,zn(e),Nt();let a=qe(e).get(o.dataset.id),r=a&&a.takes[+o.dataset.take-1];r&&Mt([{start:r.start,end:r.end,title:a.title+(a.takes.length>1?" \xB7 take "+r.no:"")}])}),document.getElementById("rv-ffmpeg").value=fa(e,document.getElementById("rv-mode").value),ba(e)}function Mt(e){if(!I.src){Tt=e,$.textContent=fn?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.";return}Tt=null,H={ranges:e,i:0},$.textContent="\u25B6 "+e[0].title;let t=()=>{I.currentTime=e[0].start/1e3,I.play().catch(n=>{n&&n.name!=="AbortError"&&($.textContent="Could not play: "+n.message)})};I.readyState>=1?t():I.addEventListener("loadedmetadata",t,{once:!0})}function va(e){return new Promise((t,n)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>n(o.error)})}async function hi(e){let t=async n=>{let o=await va(n);return await new Promise(a=>{let r=o.transaction("kv").objectStore("kv").get(e);r.onsuccess=()=>a(r.result),r.onerror=()=>a(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function mi(e,t){try{(await va()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function Ht(e){fn=!0;try{return await fi(e)}finally{fn=!1}}async function fi(e){let t=await e.getFile();for(let n=0;n<10;n++){await new Promise(a=>setTimeout(a,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function rt(e,t,n){I.src&&URL.revokeObjectURL(I.src),Ke=t||null,n||(mn=0),I.src=URL.createObjectURL(e),ue=e.name,document.getElementById("rv-novideo").hidden=!0,$.textContent="Loaded "+e.name+". Click a take to preview it.",Tt?Mt(Tt):n&&H&&Mt(H.ranges.slice(H.i)),_&&(document.getElementById("rv-ffmpeg").value=fa(_,document.getElementById("rv-mode").value))}async function gi(e){let t=Me(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(ue===t&&I.src))try{let n=await hi("obs-folder");if(!n||await n.queryPermission({mode:"read"})!=="granted")return;let o=await n.getFileHandle(t);$.textContent="Opening "+t+"\u2026",rt(await Ht(o),o)}catch{}}function Be(e,t){u.active||(yt.textContent=e,yt.classList.add("show"),clearTimeout(gn),t||(gn=setTimeout(()=>yt.classList.remove("show"),9e3)))}function wa(){clearTimeout(gn),yt.classList.remove("show")}function an(){let e=!1;try{e=window.top!==window.self}catch{e=!0}return e?" This page is running inside a preview frame that may not allow cameras. Open Slidetake directly in Chrome (from localhost or as a file).":window.isSecureContext?" Allow camera access for this page in the browser\u2019s site settings (the icon at the left of the address bar), then try again.":" Browsers only allow cameras on secure pages. Open it from http://localhost or as a local file in Chrome."}function ka(){U&&U.getTracks().forEach(t=>t.stop()),U=null;let e=z.querySelector("video");e&&e.remove()}async function it(){if(!(U||q)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Be("Camera not available on this page."+an());return}if(ie.disabled)return;ie.disabled=!0,Be("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{U=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),wa()}catch(t){let n=t&&t.name;Be(n==="NotAllowedError"||n==="SecurityError"?"Camera access was blocked."+an():n==="NotFoundError"||n==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":n==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(n?" ("+n+")":"")+"."+an());return}finally{ie.disabled=!1,In()}U.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{ka(),xt(),te()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=U,z.appendChild(e)}xt(),te()}}function In(){ie.querySelector("svg")||(ie.innerHTML=bi+'<span class="lbl"> Camera</span>'),ie.classList.toggle("on",!q),ie.setAttribute("aria-pressed",String(!q)),ie.title=q?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function An(e){e&&!tt||(q=!e,q&&ka(),fe=null,de=-1,ee=Math.min(ee,Math.max(0,Ce(c.get(p)).length-1)),In(),xt(),at(),_e(),te(),R||Be(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&it())}function Sa(){document.body.classList.remove("idle"),clearTimeout(jo),R&&(jo=setTimeout(()=>document.body.classList.add("idle"),2e3))}function Ot(e,t){ze.textContent=e,ze.classList.add("show"),clearTimeout(No),No=setTimeout(()=>ze.classList.remove("show"),t||2500)}function bn(e,{keepObs:t=!0,keepEdit:n=!0,slide:o=""}={}){let a=new URL(ro(e),location.origin);return new URLSearchParams(location.search).forEach((r,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!n||a.searchParams.set(i,r)}),o&&(a.hash=o),a.href.replace(a.pathname,a.pathname.replace(/%40/g,"@"))}async function vi(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(y.kind==="source")return{link:bn(y.source,t),inside:!1};if(y.kind==="copy"&&ht(k)&&["url","gist","builtin"].includes(k.origin.kind))return{link:bn(k.origin,t),inside:!1};let o=y.kind==="share"?y.data:await so(J.value),a=new URLSearchParams(location.search);return["src","obs","edit"].forEach(r=>a.delete(r)),{link:location.origin+"/share"+(a.toString()?"?"+a:"")+Vt(o,e),inside:!0}}function xi(){let e=Z("slidetake:draft");if(!e||e===Ft)return null;let t=pt(e,{kind:"file",name:"your earlier draft"},{exported:!0});Q("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function st(){Q("slidetake:copy",JSON.stringify(k))}function Ne(){if(M)return;let e;if(y.kind==="copy")e='<span class="mine">Your copy of '+T(oe(k.origin))+"</span>"+(ut(k)?' <span class="edited">\xB7 edited</span>':"");else{let n=y.kind==="share"?"a shared deck":oe(y.source);e='<span class="mine">'+T(n.charAt(0).toUpperCase()+n.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,me.classList.toggle("unsaved",y.kind==="copy"&&ut(k)),document.getElementById("btn-reset").hidden=!(y.kind==="copy"&&!ht(k));let t=document.getElementById("continue");t.hidden=y.kind==="copy"||!k,k&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+oe(k.origin))}function Ea(e){return!k||!ut(k)?!0:confirm("Your copy of "+oe(k.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function La(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function wi(){let e=y.kind==="share"?{kind:"shared"}:y.source;return Ea("a copy of "+oe(e))?(k=pt(y.text,e),y={kind:"copy"},history.pushState(null,"",La()+(p&&p!==h[0]?"#"+encodeURIComponent(p):"")),Ot("Editing your own copy of "+oe(e)+". The original is unchanged.",4e3),!0):(J.value=y.text,!1)}function ki(){y={kind:"copy"},history.pushState(null,"",La()),me.classList.contains("collapsed")&&Rt(),J.value=k.text,Pt(!0),Ne()}async function Si(e){if(e.kind==="builtin")return vt[e.id]??vt.home;if(e.kind==="gist"){let n=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!n.ok)throw new Error(n.status===404?"no such gist":n.status+" "+n.statusText);let o=Object.values((await n.json()).files||{}),a=o.find(r=>r.filename===e.file)||o.find(r=>/\.(md|markdown)$/i.test(r.filename))||o[0];if(!a)throw new Error("the gist has no files");return X=a.raw_url,a.truncated?await(await fetch(a.raw_url)).text():a.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return X=new URL(e.url,location.href).href,await t.text()}function Wo(){return y={kind:"source",source:{kind:"builtin",id:"home"},text:vt.home},y.text}async function Ei(){if(M)return X=M.base||location.href,y={kind:"source",source:{kind:"url",url:X},text:Zn(M.settings||{})+String(M.markdown||"")},y.text;if(Y.page==="edit"){if(k)return y={kind:"copy"},k.text;history.replaceState(null,"","/new"+location.search),Y.page="pick"}if(Y.page==="pick")return Dt(document.getElementById("new-dialog")),y={kind:"source",source:{kind:"builtin",id:"template:blank"},text:vt["template:blank"]},y.text;if(Y.page==="share")try{let e=await lo(Y.data);return y={kind:"share",data:Y.data,text:e},e}catch{return Ot("This link's deck is damaged or cut short, so it could not be opened.",6e3),Wo()}try{let e=await Si(Y.source);return y={kind:"source",source:Y.source,text:e},e}catch(e){return Ze.textContent="Could not load the deck ("+e.message+")",Ot("Could not load "+oe(Y.source)+": "+e.message,6e3),Wo()}}var M,Uo,tt,je,vt,J,C,W,Zt,ko,Ka,Ze,rn,Va,me,So,Xa,Ie,Qt,ae,sn,Ja,Za,Qa,er,tr,nr,Qe,c,h,se,p,A,R,x,q,U,ce,z,or,E,Xe,Eo,ye,Lo,ee,fe,de,Ae,yr,X,To,Lr,Cr,Tr,Mo,Br,gt,zr,Ar,tn,ve,nn,we,pe,$r,Re,V,ke,re,Bo,on,Oe,Io,Zr,Ao,Po,Ro,Qr,ei,bt,un,kt,St,Et,Cn,Do,Je,F,xe,Ee,sa,u,Tn,la,ni,ai,ue,ma,fa,_,H,I,$,Ct,Tt,Ke,mn,fn,Ve,xa,ie,yt,gn,bi,jo,he,_o,ze,No,yi,yn,vn,Ho,Bt,Y,Fo,y,k,Ca=j(()=>{"use strict";jn();_n();Hn();Wn();qn();Yn();lt();eo();oo();Gt();Xt();uo();fo();wo();M=window.SLIDETAKE||null,Uo=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!M);tt=!M||M.recording===!0||new URLSearchParams(location.search).has("obs");document.documentElement.classList.toggle("no-record",!tt);je=window.matchMedia("(prefers-reduced-motion: reduce)").matches,vt={home:Ft,help:Nn,showcase:Gn,"template:blank":Fn,"template:talk":Un,"template:recording":$n},J=document.getElementById("editor"),C=document.getElementById("stage"),W=document.getElementById("world"),Zt=document.getElementById("connectors"),ko=document.getElementById("breadcrumbs"),Ka=document.getElementById("status-count"),Ze=document.getElementById("status-err"),rn=document.getElementById("mm-svg"),Va=document.getElementById("mm-label"),me=document.getElementById("editor-pane"),So=540,Xa=96,Ie=440,Qt=720,ae=960,sn=180,Ja=540,Za=100,Qa=110,er=420,tr=.35,nr=1,Qe=parseFloat(Z("slidetake:slideSize"))||.92,c=new Map,h=[],se=[],p=null,A="tree",R=!1,x={},q=!0,U=null,ce=document.getElementById("brand"),z=document.getElementById("pip"),or=document.getElementById("stage-wrap"),E={x:0,y:0,zoom:.6},Xe=null;Eo={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};ye=null;Lo=new URLSearchParams(location.search).get("mode");ee=0;fe=null,de=-1,Ae=null;yr=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));X=null;To=null;Lr="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Cr="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Tr={dark:{palette:["#60a5fa","#f472b6","#a78bfa","#fb923c","#facc15","#a1a1aa"],text:"#e4e4e7",muted:"#a1a1aa",line:"#3f3f46",split:"#27272a",tip:"#18181b"},light:{palette:["#2563eb","#db2777","#7c3aed","#ea580c","#ca8a04","#71717a"],text:"#27272a",muted:"#71717a",line:"#d4d4d8",split:"#e4e4e7",tip:"#ffffff"}};Mo=new Set;Br="https://esm.sh/@terrastruct/d2@0.1.33",gt=null,zr={dark:{N1:"#e4e4e7",N2:"#a1a1aa",N3:"#a1a1aa",N4:"#323238",N5:"#27272a",N6:"#18181b",N7:"#09090b"},light:{N1:"#27272a",N2:"#71717a",N3:"#71717a",N4:"#e4e4e7",N5:"#e4e4e7",N6:"#f4f4f5",N7:"#ffffff"}};Ar=e=>/d2-config\s*:/.test(e)?e:`vars: {
626
+ d2-config: {
627
+ layout-engine: elk
628
+ }
629
+ }
630
+ `+e,tn={};ve=0,nn=null;we=document.getElementById("progress");we.innerHTML="<b></b><i></i>";pe={start:0,timer:null};$r=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];Re=null;V=null;ke=null;re=null;rn.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!u.active&&P(t.dataset.id)});Bo=null;J.addEventListener("input",()=>{y.kind!=="copy"&&!wi()||(k.text=J.value,Ne(),clearTimeout(Bo),Bo=setTimeout(()=>{st(),Pt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==A&&Se(e.dataset.mode)})});(function(){let e=new Map,t=0,n=!1,o=null,a=()=>{let[i,s]=[...e.values()];return Math.hypot(i.x-s.x,i.y-s.y)||1};C.addEventListener("pointerdown",i=>{i.pointerType==="mouse"&&i.button!==0||u.active||i.target.closest("a, pre, code, input, textarea")||(e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t=0,n=!1,e.size===2&&(o={d:a(),zoom:E.zoom}))}),window.addEventListener("pointermove",i=>{let s=e.get(i.pointerId);if(!s)return;let l=i.clientX-s.x,d=i.clientY-s.y;e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t+=Math.abs(l)+Math.abs(d),!n&&t>5&&(n=!0,kn(),C.classList.add("dragging")),n&&(e.size===2&&o?E.zoom=ra(o.zoom*a()/o.d):(E.x-=l/E.zoom,E.y-=d/E.zoom),Pe())});let r=i=>{e.delete(i.pointerId),e.size<2&&(o=null),e.size||C.classList.remove("dragging")};window.addEventListener("pointerup",r),window.addEventListener("pointercancel",r),C.addEventListener("click",i=>{n&&(i.stopPropagation(),i.preventDefault(),n=!1)},!0)})();C.addEventListener("wheel",e=>{e.preventDefault(),!u.active&&ia(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>De(-1);document.getElementById("nav-next").onclick=()=>De(1);document.getElementById("btn-open").onclick=()=>document.getElementById("file-input").click();document.getElementById("file-input").addEventListener("change",e=>{let t=e.target.files[0];if(!t)return;let n=new FileReader;n.onload=()=>{Ea("a copy of "+t.name)&&(k=pt(String(n.result),{kind:"file",name:t.name},{exported:!0}),st(),X=null,p=null,ki())},n.readAsText(t),e.target.value=""});document.getElementById("btn-save").onclick=()=>{let e=new Blob([J.value],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=(se[0]?Te(c.get(se[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),y.kind==="copy"&&(k.exported=k.text,st(),Ne())};document.getElementById("btn-reset").onclick=()=>{y.kind!=="copy"||ht(k)||confirm("Discard your edits and go back to "+oe(k.origin)+" as it was?")&&(k.text=k.originText,st(),J.value=k.text,p=null,Pt(!0),Ne())};document.getElementById("btn-edit-toggle").onclick=Rt;on=document.querySelector("main"),Oe=document.getElementById("editor-resizer"),Io=parseFloat(Z("slidetake:editorWidth"));Io&&me.style.setProperty("--editor-w",Io+"px");Oe.addEventListener("pointerdown",e=>{e.preventDefault(),Oe.setPointerCapture(e.pointerId),on.classList.add("resizing");let t=on.getBoundingClientRect().right,n=a=>{let r=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-a.clientX)));me.style.setProperty("--editor-w",r+"px")},o=()=>{on.classList.remove("resizing"),Oe.removeEventListener("pointermove",n),Q("slidetake:editorWidth",String(me.getBoundingClientRect().width))};Oe.addEventListener("pointermove",n),Oe.addEventListener("pointerup",o,{once:!0})});Oe.addEventListener("dblclick",()=>{me.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=$o;document.getElementById("btn-present").onclick=()=>ge(!R);Zr="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",Ao=["ArrowRight","PageDown"," ","ArrowDown","Enter"],Po=["ArrowLeft","PageUp","ArrowUp","r","R"],Ro=["b","B","."],Qr=document.getElementById("rec-dialog"),ei=document.getElementById("review"),bt=document.getElementById("rec-countdown"),un=document.getElementById("rec-paused"),kt=document.getElementById("obs-host"),St=document.getElementById("obs-port"),Et=document.getElementById("obs-pass"),Cn=document.getElementById("obs-remember"),Do=document.getElementById("obs-status"),Je=document.getElementById("rec-start"),F=null,xe=!1,Ee=null,sa=null,u={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null},Tn=e=>new Promise(t=>setTimeout(t,e)),la=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),Tn(100)]);document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});document.querySelectorAll("[data-copy]").forEach(e=>e.addEventListener("click",()=>{let t=document.getElementById(e.dataset.copy);t.select(),(navigator.clipboard?navigator.clipboard.writeText(t.value):Promise.reject()).catch(()=>document.execCommand("copy")),e.textContent="Copied",setTimeout(()=>{e.textContent="Copy"},1500)}));ni=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);ai="This page is served over https, and browsers block it from reaching OBS on another computer (OBS only offers plain ws://). Run OBS on this computer and use localhost, or open Slidetake from a local copy: download dist/index.html from github.com/slidetake/slidetake and serve it with python3 -m http.server.";document.getElementById("obs-connect").onclick=da;Cn.addEventListener("change",ca);document.getElementById("btn-record").onclick=hn;Je.onclick=()=>pa(!0);document.getElementById("rec-rehearse").onclick=()=>pa(!1);ue="";ma=e=>vo(e,ha),fa=(e,t)=>xo(e,t,{input:e.outputPath||ue||"recording.mov",outputName:_t()+"-final.mp4",sectionOf:ha});_=null,H=null,I=document.getElementById("rv-video"),$=document.getElementById("rv-now");document.getElementById("rv-mode").onchange=()=>Nt();Ct=document.getElementById("rv-fps");Ct.onchange=()=>{_&&(_.fps=parseFloat(Ct.value),zn(_),Nt())};document.getElementById("rv-link").addEventListener("input",e=>{try{Q("slidetake:site",new URL(e.target.value.trim()).origin)}catch{}_&&ba(_)});Tt=null;I.addEventListener("timeupdate",()=>{if(!H)return;let e=H.ranges[H.i];if(I.currentTime*1e3<e.end)return;if(H.i++,H.i>=H.ranges.length){I.pause(),H=null,$.textContent="";return}let t=H.ranges[H.i];I.currentTime=t.start/1e3,$.textContent="\u25B6 "+t.title});document.getElementById("rv-play-final").onclick=()=>{_&&Mt($e(_).map(e=>({start:e.start,end:e.end,title:e.title})))};Ke=null,mn=0,fn=!1;I.addEventListener("error",async()=>{if(I.getAttribute("src")){if(Ke&&mn<5){mn++,$.textContent="Reloading "+ue+" (OBS was still finishing it)\u2026",await new Promise(e=>setTimeout(e,1500));try{rt(await Ht(Ke),Ke,!0);return}catch{}}$.textContent=Ke?"Chrome cannot play "+ue+". In OBS set Recording Format to Hybrid MP4 (or MP4) with H.264 video; the ffmpeg command still works with this file.":"Could not play "+(ue||"this file")+". If OBS was still finishing it when you opened it, open it again; if it still fails, set OBS to Hybrid MP4 (or MP4) with H.264 video."}});Ve=document.getElementById("rv-file-input");Ve.addEventListener("change",()=>{Ve.files[0]&&rt(Ve.files[0]),Ve.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Ve.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});$.textContent="Opening "+e.name+"\u2026",rt(await Ht(e),e)}catch(e){(!e||e.name!=="AbortError")&&($.textContent="Could not open that file.")}};xa=document.getElementById("rv-folder");xa.hidden=!window.showDirectoryPicker;xa.onclick=async()=>{let e=_&&Me(_.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(mi("obs-folder",t),!e){$.textContent="Folder remembered. This session has no file name from OBS; open the file instead.";return}let n=await t.getFileHandle(e);rt(await Ht(n),n)}catch(t){if(t&&t.name==="AbortError")return;$.textContent=(e?e+" is not in that folder":"Could not read that folder")+". Use \u201COpen the recording file\u2026\u201D instead."}};document.getElementById("rv-download").onclick=()=>{if(!_)return;let e=_,t=ma(e),n="# "+document.getElementById("rv-yt-title").value+`
450
631
 
451
- Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath:"")+" \xB7 final length "+Y(t.length)+`
632
+ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath:"")+" \xB7 final length "+K(t.length)+`
452
633
 
453
634
  ## Render
454
635
 
@@ -470,10 +651,11 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
470
651
 
471
652
  ## Picked takes
472
653
 
473
- `+Fe(e).map(a=>"- "+Y(a.start)+"\u2013"+Y(a.end)+" "+a.title).join(`
654
+ `+$e(e).map(a=>"- "+K(a.start)+"\u2013"+K(a.end)+" "+a.title).join(`
474
655
  `)+`
475
- `,o=document.createElement("a");o.href=URL.createObjectURL(new Blob([n],{type:"text/markdown"})),o.download=Pt()+"-publish.md",o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e3)};kr()&&new URLSearchParams(location.search).get("obs")&&Ko();ae=document.getElementById("btn-camera"),ht=document.getElementById("pip-msg"),ln=null;jr='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';ae.onclick=()=>Cn(N);Ln();wo=null;window.addEventListener("pointermove",sa);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(u.active?zt("Stopped: the browser left fullscreen"):D&&we(!1))});pe=document.getElementById("help");document.getElementById("btn-help").onclick=()=>window.open(M?"https://slidetake.com/help":"/help","_blank","noopener");document.getElementById("btn-keys").onclick=()=>pe.classList.add("open");document.getElementById("help-close").onclick=()=>pe.classList.remove("open");pe.addEventListener("click",e=>{e.target===pe&&pe.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),u.active||an();return}if(u.active){Tr(e);return}if(document.querySelector(".modal.open")){e.key==="Escape"&&wn();return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(pe.classList.contains("open")){e.key==="Escape"&&pe.classList.remove("open");return}let n=e.key;n==="ArrowRight"||n===" "||n==="PageDown"?(e.preventDefault(),Ie(1)):n==="ArrowLeft"||n==="PageUp"?(e.preventDefault(),Ie(-1)):n==="ArrowDown"?(e.preventDefault(),br()):n==="ArrowUp"?(e.preventDefault(),gr()):n==="Home"?f.length&&P(f[0]):n==="End"?f.length&&P(f[f.length-1]):n==="o"||n==="O"?fr():n==="e"||n==="E"?Ot():n==="f"||n==="F"||n==="p"||n==="P"?we(!D):n==="r"||n==="R"?an():n==="1"?ve("tree"):n==="2"?ve("radial"):n==="3"?ve("path"):n==="4"?ve("focus"):n==="c"||n==="C"?Cn(N):n==="v"||n==="V"?qa():n==="l"||n==="L"?Bo():n==="+"||n==="="?fo(1):n==="-"||n==="_"?fo(-1):n==="?"?pe.classList.add("open"):n==="Escape"&&!Wo()&&D&&we(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=rt(location.hash);if(e&&!(v&&v.kind==="share"&&e===v.data)){location.reload();return}t&&t!==p&&c.has(t)&&P(t)});ko="";new ResizeObserver(()=>{let e=T.clientWidth+"x"+T.clientHeight;e!==ko&&(ko=e,Be(),ee(!0))}).observe(T);Te=document.createElement("div");Te.id="toast";Te.setAttribute("role","status");document.body.appendChild(Te);Eo=null;Fr=document.getElementById("open-dialog"),dn=document.getElementById("open-url"),pn=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{pn.hidden=!0,It(Fr),dn.focus(),dn.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=Vn(dn.value);if(!t){pn.textContent="That doesn't look like a link.",pn.hidden=!1;return}location.href=cn(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await Hr(p&&p!==f[0]?p:""),n=t?"Link copied, with the whole deck inside it ("+(e.length/1024).toFixed(1)+" KB)"+(e.length>8e3?". Some chat apps cut long links short: a GitHub file or gist makes a shorter one.":"."):"Link copied.";try{await navigator.clipboard.writeText(e),St(n,5e3)}catch{prompt("Copy this link:",e)}v.kind==="copy"&&(k.exported=k.text,tt(),Re())};So=J("slidetake:layout");z=["tree","radial","path","focus"].includes(So)?So:"tree";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===z));Lt=new URLSearchParams(location.search);["tree","radial","path","focus"].includes(Lt.get("layout"))&&(z=Lt.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===z)));if(M){let e=(Array.isArray(M.trail)?M.trail:M.back?[M.back]:[]).filter(a=>a&&a.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((a,r)=>(r?'<span class="sep" aria-hidden="true">|</span>':"")+(a.url?'<a href="'+B(a.url)+'">'+B(a.label)+"</a>":"<span>"+B(a.label)+"</span>")).join("")+"</nav>");let n=document.createElement("a");n.id="credit",n.href="https://slidetake.com",n.target="_blank",n.rel="noopener",n.title="Made with Slidetake",n.setAttribute("aria-label","Made with Slidetake"),n.innerHTML=To+'<span class="word">Slide<span>take</span></span>';let o=document.getElementById("navbar");o.insertAdjacentHTML("beforeend",'<div class="divider"></div>'),o.appendChild(n)}$=eo(location.pathname,location.search,location.hash),Lo=$.page==="pick"?"":$.slide,v=null,k=to(J("slidetake:copy"))||Wr();window.addEventListener("popstate",()=>location.reload());(Lt.get("edit")==="1"||$.page==="edit"&&k&&Lt.get("edit")!=="0")&&Ot();$r().then(e=>(X.value=e,Re(),Io(X.value),Ro(),document.fonts?document.fonts.ready:null)).then(()=>{c.forEach(Tt),Xe(),P(c.has(Lo)?Lo:f[0],!0)})});var Tn=` /* One palette, Slidetake gold, at two levels: bright gold on zinc in dark mode, deep gold on white in
476
- light mode (the same values as sakthipriyan.com's Building Wealth section, so its decks match). */
656
+ `,o=document.createElement("a");o.href=URL.createObjectURL(new Blob([n],{type:"text/markdown"})),o.download=_t()+"-publish.md",o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e3)};ti()&&new URLSearchParams(location.search).get("obs")&&da();ie=document.getElementById("btn-camera"),yt=document.getElementById("pip-msg"),gn=null;bi='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';ie.onclick=()=>An(q);In();jo=null;window.addEventListener("pointermove",Sa);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(u.active?jt("Stopped: the browser left fullscreen"):R&&ge(!1))});he=document.getElementById("help");document.getElementById("btn-help").onclick=()=>window.open(M?"https://slidetake.com/help":"/help","_blank","noopener");document.getElementById("btn-keys").onclick=()=>he.classList.add("open");document.getElementById("help-close").onclick=()=>he.classList.remove("open");he.addEventListener("click",e=>{e.target===he&&he.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),u.active||hn();return}if(u.active){ii(e);return}if(document.querySelector(".modal.open")){e.key==="Escape"&&Mn();return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(he.classList.contains("open")){e.key==="Escape"&&he.classList.remove("open");return}let n=e.key;n==="ArrowRight"||n===" "||n==="PageDown"?(e.preventDefault(),De(1)):n==="ArrowLeft"||n==="PageUp"?(e.preventDefault(),De(-1)):n==="ArrowDown"?(e.preventDefault(),Xr()):n==="ArrowUp"?(e.preventDefault(),Vr()):n==="Home"?h.length&&P(h[0]):n==="End"?h.length&&P(h[h.length-1]):n==="o"||n==="O"?Kr():n==="e"||n==="E"?Rt():n==="f"||n==="F"||n==="p"||n==="P"?ge(!R):n==="r"||n==="R"?hn():n==="1"?Se("tree"):n==="2"?Se("radial"):n==="3"?Se("path"):n==="4"?Se("focus"):n==="c"||n==="C"?An(q):n==="v"||n==="V"?ur():n==="l"||n==="L"?$o():n==="+"||n==="="?zo(1):n==="-"||n==="_"?zo(-1):n==="?"||n==="k"||n==="K"?he.classList.add("open"):n==="Escape"&&!oa()&&R&&ge(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=dt(location.hash);if(e&&!(y&&y.kind==="share"&&e===y.data)){location.reload();return}t&&t!==p&&c.has(t)&&P(t)});_o="";new ResizeObserver(()=>{let e=C.clientWidth+"x"+C.clientHeight;e!==_o&&(_o=e,Pe(),te(!0))}).observe(C);ze=document.createElement("div");ze.id="toast";ze.setAttribute("role","status");document.body.appendChild(ze);No=null;yi=document.getElementById("open-dialog"),yn=document.getElementById("open-url"),vn=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{vn.hidden=!0,Dt(yi),yn.focus(),yn.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=ao(yn.value);if(!t){vn.textContent="That doesn't look like a link.",vn.hidden=!1;return}location.href=bn(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await vi(p&&p!==h[0]?p:""),n=t?"Link copied, with the whole deck inside it ("+(e.length/1024).toFixed(1)+" KB)"+(e.length>8e3?". Some chat apps cut long links short: a GitHub file or gist makes a shorter one.":"."):"Link copied.";try{await navigator.clipboard.writeText(e),Ot(n,5e3)}catch{prompt("Copy this link:",e)}y.kind==="copy"&&(k.exported=k.text,st(),Ne())};Ho=Z("slidetake:layout");A=["tree","radial","path","focus"].includes(Ho)?Ho:"tree";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===A));Bt=new URLSearchParams(location.search);["tree","radial","path","focus"].includes(Bt.get("layout"))&&(A=Bt.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===A)));if(M){let e=(Array.isArray(M.trail)?M.trail:M.back?[M.back]:[]).filter(a=>a&&a.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((a,r)=>(r?'<span class="sep" aria-hidden="true">|</span>':"")+(a.url?'<a href="'+T(a.url)+'">'+T(a.label)+"</a>":"<span>"+T(a.label)+"</span>")).join("")+"</nav>");let n=document.createElement("a");n.id="credit",n.href="https://slidetake.com",n.target="_blank",n.rel="noopener",n.title="Made with Slidetake",n.setAttribute("aria-label","Made with Slidetake"),n.innerHTML=Uo+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(n,o.firstChild),tt||(o.insertAdjacentHTML("beforeend",'<button class="btn" id="hdr-keys" title="Keyboard shortcuts (K)">\u2328 Keys</button><button class="btn" id="hdr-full" title="Fullscreen (F)">\u26F6 Fullscreen</button>'),document.getElementById("hdr-keys").onclick=()=>document.getElementById("help").classList.add("open"),document.getElementById("hdr-full").onclick=()=>ge(!R))}Y=co(location.pathname,location.search,location.hash),Fo=Y.page==="pick"?"":Y.slide,y=null,k=po(Z("slidetake:copy"))||xi();window.addEventListener("popstate",()=>location.reload());(Bt.get("edit")==="1"||Y.page==="edit"&&k&&Bt.get("edit")!=="0")&&Rt();Ei().then(e=>(J.value=e,Ne(),Go(J.value),Jo(),document.fonts?document.fonts.ready:null)).then(()=>{c.forEach(It),nt(),P(c.has(Fo)?Fo:h[0],!0)})});var Pn=` /* Every colour comes from these tokens. Slidetake's own is terminal green: bright on zinc in dark mode,
657
+ deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
658
+ its own (accent: in its top block); see applyColors in app.js. */
477
659
  :root{
478
660
  --bg:#09090b;
479
661
  --grid-dot:#1d1d21;
@@ -481,14 +663,14 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
481
663
  --panel-line:#27272a;
482
664
  --node-bg:#18181b;
483
665
  --node-border:#323238;
484
- --accent:#e0b024;
485
- --accent-teal:#f5c542; /* headings below h2 */
666
+ --accent:#4ade80;
667
+ --accent-teal:#86efac; /* headings below h2 */
486
668
  --text:#e4e4e7;
487
669
  --text-muted:#a1a1aa;
488
670
  --danger:#e0645c;
489
671
  --code-bg:#0f0f12;
490
672
  --overlay:rgba(17,17,19,.9); /* breadcrumbs, nav bar, minimap */
491
- --on-accent:#1a1408; /* text on an accent-filled button */
673
+ --on-accent:#052e16; /* text on an accent-filled button */
492
674
  --card-shadow:0 6px 24px rgba(0,0,0,.35);
493
675
  --brand-shadow:0 1px 6px rgba(0,0,0,.6);
494
676
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
@@ -498,16 +680,18 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
498
680
  /* Tokens derived from others are declared on body, not :root: a custom property resolves var() where
499
681
  it is declared, so on :root these would freeze the default palette's colours. */
500
682
  body{
501
- --accent-line:#966f04; /* borders and connector lines on the active path */
683
+ --accent-line:#15803d; /* borders and connector lines on the active path */
502
684
  --accent-ring:var(--accent); /* the current slide's border, glow and the progress bar */
503
685
  --edge:var(--node-border); /* connector lines off the active path */
686
+ --header-bg:none; /* a host's band of colour behind the header (an image layer) */
687
+ --header-ink:var(--text); /* text on that band */
504
688
  }
505
- /* Light mode (L, mode: light, ?mode=light): #7a5c12 carries text (6.2:1 on white); the brighter gold
689
+ /* Light mode (L, mode: light, ?mode=light): #15803d carries text (5.0:1 on white); the brighter green
506
690
  only rings and lines, which never need to be read. */
507
691
  body[data-mode="light"]{
508
692
  --bg:#fafaf9; --grid-dot:#e7e5e4; --panel:#ffffff; --panel-line:#e4e4e7;
509
693
  --node-bg:#ffffff; --node-border:#e4e4e7; --edge:#d4d4d8;
510
- --accent:#7a5c12; --accent-teal:#8a6610; --accent-line:#d4af37; --accent-ring:#d4af37;
694
+ --accent:#15803d; --accent-teal:#166534; --accent-line:#4ade80; --accent-ring:#22c55e;
511
695
  --text:#27272a; --text-muted:#71717a; --danger:#c2410c;
512
696
  --code-bg:#f4f4f5; --overlay:rgba(255,255,255,.92); --on-accent:#ffffff;
513
697
  --card-shadow:0 4px 18px rgba(24,24,27,.08); --brand-shadow:0 1px 4px rgba(255,255,255,.9);
@@ -533,10 +717,14 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
533
717
  min-height:56px;flex:none;
534
718
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;
535
719
  padding:8px 16px;
536
- background:var(--panel);
720
+ background:var(--header-bg), var(--panel);
537
721
  border-bottom:1px solid var(--panel-line);
538
722
  z-index:20;
539
723
  }
724
+ /* a host's coloured header band: its own ink for the text, buttons and borders on it */
725
+ body.st-header-color header{color:var(--header-ink);border-bottom-color:transparent;
726
+ --text:var(--header-ink);--text-muted:color-mix(in srgb, var(--header-ink) 72%, transparent);
727
+ --node-border:color-mix(in srgb, var(--header-ink) 28%, transparent);}
540
728
  .brand{display:flex;align-items:baseline;gap:10px;}
541
729
  .brand .mark{font-family:var(--display);font-weight:700;font-size:17px;letter-spacing:.02em;color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:7px;align-self:center;}
542
730
  .brand .mark .logo{width:20px;height:20px;fill:var(--accent);flex:none;}
@@ -835,6 +1023,65 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
835
1023
  .node .r-hstack{display:flex;flex-direction:row;align-items:center;justify-content:center;}
836
1024
  .node .r-vstack{display:flex;flex-direction:column;align-items:center;justify-content:center;}
837
1025
  .node .body img{max-width:100%;height:auto;object-fit:contain;}
1026
+ /* ---------- media from plain markdown (see applyMedia) ---------- */
1027
+ .node .body figure.media{margin:0;}
1028
+ .node .body figure.media img{display:block;width:100%;height:auto;max-height:70vh;object-fit:contain;border-radius:8px;}
1029
+ .node .body figure.media figcaption{margin-top:8px;font-size:.82em;color:var(--text-muted);line-height:1.45;}
1030
+ .node .body figure.yt .frame{position:relative;width:100%;aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#000;}
1031
+ .node .body figure.yt.portrait .frame{aspect-ratio:9/16;max-height:70vh;width:auto;margin:0 auto;}
1032
+ .node .body figure.yt iframe{position:absolute;inset:0;width:100%;height:100%;border:0;}
1033
+ /* the video is always on show; its step only plays it */
1034
+ .node .fragment.yt-play{opacity:1 !important;visibility:inherit !important;transform:none !important;}
1035
+ .node.card-split .body{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:4px 22px;align-items:center;}
1036
+ .node.card-split .body > :is(h1,h2,h3,h4,h5,h6){grid-column:1 / -1;}
1037
+ .node.card-split .body .split-text > :first-child{margin-top:0;}
1038
+ .node.card-split.media-last .body{grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);}
1039
+ .node .body .gallery{list-style:none;padding:0;margin:8px 0 0;display:grid;grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));gap:14px;align-items:end;}
1040
+ .node .body .gallery li{margin:0;}
1041
+ .node .body .gallery figure.media img{max-height:calc(56vh / var(--rows,1));margin:0 auto;}
1042
+ .node .body .gallery figure.media figcaption{font-size:.72em;text-align:center;}
1043
+ /* a stepped gallery: the images stack in one place and each press brings the next */
1044
+ .node .body .gallery.carousel{grid-template-columns:minmax(0,1fr);}
1045
+ .node .body .gallery.carousel > li{grid-area:1/1;}
1046
+ .node .body .gallery.carousel figure.media img{max-height:58vh;}
1047
+ .node .body .gallery.carousel figure.media figcaption{font-size:.82em;}
1048
+ .node .body .gallery.carousel figcaption[data-count]::before{content:attr(data-count) " ";color:var(--accent);font-weight:600;white-space:pre;}
1049
+ .node .body .gallery.carousel:has(> li.visible) > li:not(.fragment){opacity:0;visibility:hidden;transition:opacity .45s ease, visibility 0s .45s;}
1050
+ .node .body .gallery.carousel > li:not(.fragment){transition:opacity .45s ease;}
1051
+ /* image cards: an image or carousel alone, laid out by the image's shape (see sizeCard) */
1052
+ div.node.card-bleed{padding:0;overflow:hidden;}
1053
+ .node.card-bleed .body .gallery{margin:0;}
1054
+ .node.card-bleed .body figure.media img,
1055
+ .node.card-bleed .body .gallery.carousel figure.media img{max-height:none;border-radius:0;background:var(--code-bg);}
1056
+ .node.card-bleed .body figure.media figcaption{margin:0;text-align:left;font-size:.9em;}
1057
+ /* landscape: the image spans the card; the heading sits above it, the caption below */
1058
+ .node.img-landscape .crumb{margin:12px 18px 4px;}
1059
+ .node.img-landscape .body > :is(h1,h2,h3,h4,h5,h6):first-child{margin:0 18px 10px;}
1060
+ .node.img-landscape .body figure.media img{width:100%;height:var(--img-h);object-fit:contain;}
1061
+ .node.img-landscape .body figure.media figcaption{padding:10px 18px 14px;}
1062
+ /* portrait or near-square: the image on the right at the card's height; the heading and caption share the left */
1063
+ div.node.img-portrait{height:540px;padding:20px calc(var(--img-w) + 26px) 22px 24px;}
1064
+ .node.img-portrait .body{display:flex;flex-direction:column;height:100%;}
1065
+ .node.img-portrait .crumb{margin-bottom:10px;}
1066
+ .node.img-portrait .body > :is(h1,h2,h3,h4,h5,h6):first-child{font-size:22px;}
1067
+ .node.img-portrait .body > .gallery, .node.img-portrait .body > figure.media{margin-top:auto;}
1068
+ .node.img-portrait .body figure.media img{position:absolute;top:0;right:0;width:var(--img-w);height:540px;object-fit:contain;}
1069
+ .node.img-portrait .body figure.media figcaption, .node.img-portrait .body .gallery.carousel figure.media figcaption{font-size:1.35em;line-height:1.45;color:var(--text);}
1070
+ /* 16:9, or a full-screen card: the image fills the card, the heading and caption over it */
1071
+ .node.img-overlay::before{content:"";position:absolute;inset:0 0 auto;height:96px;z-index:2;pointer-events:none;
1072
+ background:linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,0));border-radius:8px 8px 0 0;}
1073
+ .node.img-overlay .crumb{position:absolute;top:12px;left:18px;right:18px;z-index:3;margin:0;color:rgba(255,255,255,.72);}
1074
+ .node.img-overlay .body > :is(h1,h2,h3,h4,h5,h6):first-child{position:absolute;top:28px;left:18px;right:18px;z-index:3;margin:0;
1075
+ color:#fff;text-shadow:0 1px 6px rgba(0,0,0,.6);}
1076
+ .node.img-overlay .body figure.media{position:relative;}
1077
+ .node.img-overlay .body figure.media img{width:100%;height:540px;object-fit:contain;}
1078
+ .node.card-full.img-overlay .body figure.media img{object-fit:cover;}
1079
+ .node.img-overlay .body figure.media figcaption{position:absolute;left:0;right:0;bottom:0;padding:36px 18px 14px;
1080
+ color:#f4f4f5;background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.78));}
1081
+ .node.img-overlay .body .gallery.carousel figure.media figcaption::before{color:color-mix(in srgb, var(--accent) 55%, #fff);}
1082
+ /* <!-- view: full -->: a 16:9 card that fills the screen, with the map and breadcrumbs out of the way */
1083
+ div.node.card-full{height:540px;overflow:hidden;}
1084
+ body.full-card #breadcrumbs, body.full-card #minimap{opacity:0;pointer-events:none;}
838
1085
  /* measure cards at their resting size, without grow/zoom transforms */
839
1086
  div.node.measuring .fragment{transform:none !important;transition:none !important;}
840
1087
  /* a card re-measured mid-entrance (a theme switch replays it) must not count a gsap "from" state such
@@ -846,6 +1093,9 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
846
1093
  .node .diagram{background:#f8fafc;border:1px solid var(--panel-line);border-radius:8px;padding:12px;margin:0 0 10px;overflow:auto;}
847
1094
  .node .diagram svg{display:block;width:100%;height:auto;max-height:640px;}
848
1095
  .node .diagram.err{background:none;color:var(--danger);font-family:var(--mono);font-size:12px;padding:0;}
1096
+ /* D2 is drawn in the deck's own palette, so it needs no light backdrop */
1097
+ .node .diagram.d2{background:none;border:none;padding:0;}
1098
+ .node .diagram.d2 svg{max-height:62vh;}
849
1099
  .node .echarts-container{width:100%;height:360px;margin:0 0 10px;}
850
1100
 
851
1101
  /* ---------- overlays ---------- */
@@ -904,22 +1154,29 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
904
1154
  html.embed .brand .trail a:hover{color:var(--accent);}
905
1155
  html.embed .brand .trail a:last-child{color:var(--accent);}
906
1156
  html.embed .brand .trail .sep{color:var(--text-muted);font-weight:400;}
907
- #navbar #credit{display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border-radius:6px;text-decoration:none;
908
- font-family:var(--display);font-weight:700;font-size:12px;color:var(--text-muted);}
909
- #navbar #credit .logo{width:16px;height:16px;fill:var(--accent);}
910
- #navbar #credit .word > span{color:var(--accent);}
911
- #navbar #credit:hover{color:var(--text);}
912
- html.no-record #btn-camera, html.no-record #btn-record, html.no-record #navbar .divider:not(:last-of-type), html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
1157
+ #credit{display:inline-flex;align-items:center;gap:6px;padding:4px 6px;text-decoration:none;
1158
+ font-family:var(--display);font-weight:700;font-size:14px;color:var(--text);}
1159
+ #credit .logo{width:18px;height:18px;fill:var(--accent);}
1160
+ #credit .word > span{color:var(--accent);}
1161
+ #credit:hover{opacity:.85;}
1162
+ html.embed #btn-help{display:none !important;}
1163
+ /* a reader's page (embedded, not recording): no bottom bar, except the arrows on touch screens */
1164
+ html.embed.no-record #navbar{display:none;}
1165
+ @media (pointer:coarse){
1166
+ html.embed.no-record #navbar{display:flex;}
1167
+ html.embed.no-record #navbar > :not(.touch-only){display:none !important;}
1168
+ }
1169
+ html.no-record #btn-camera, html.no-record #btn-record, html.no-record #navbar .divider, html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
913
1170
  /* the logo written into a heading: # ![](/favicon.svg) Slidetake */
914
1171
  .node .body :is(h1,h2) img[src$="favicon.svg"]{height:1em;width:auto;vertical-align:-.12em;margin-right:.25em;display:inline;}
915
1172
  #brand .st-mark{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:700;font-size:20px;color:var(--text);}
916
1173
  #brand .st-mark .logo{width:24px;height:24px;fill:var(--accent);}
917
1174
  #brand .st-mark .word > span{color:var(--accent);}
918
1175
  #brand img{height:40px;width:auto;display:block;}
919
- /* optional gold chip, as on the decks' title slides (brand_style: chip); plain text is the default */
1176
+ /* optional accent chip, as on the decks' title slides (brand_style: chip); plain text is the default */
920
1177
  #brand .chip{display:inline-block;padding:5px 22px;border-radius:30px;color:#fff;font-family:var(--body);
921
1178
  font-size:15px;font-weight:600;letter-spacing:.01em;text-shadow:none;
922
- background:linear-gradient(90deg, #fbbf24, #f59e0b);box-shadow:0 2px 10px rgba(0,0,0,.25);}
1179
+ background:linear-gradient(90deg, var(--accent-line), color-mix(in srgb, var(--accent-line) 80%, #000));box-shadow:0 2px 10px rgba(0,0,0,.25);}
923
1180
 
924
1181
  /* PIP camera: slides are laid out to keep clear of this box */
925
1182
  #pip{
@@ -985,7 +1242,13 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
985
1242
  #minimap{display:none;}
986
1243
  #navbar .lbl{display:none;}
987
1244
  }
988
- `;var Mn=`
1245
+ `;var Rn=`
1246
+ <noscript>
1247
+ <h1>Slidetake</h1>
1248
+ <p><strong>Write in markdown. Present on a spatial canvas. Record without timeline editing.</strong></p>
1249
+ <p>For developers and technical educators who explain things on video. Your headings become a map you move through; with OBS, every slide is a take, so a fumbled line is retaken on the spot, and Slidetake writes the frame-exact cut, YouTube chapters and description.</p>
1250
+ <p>Slidetake needs JavaScript. Read the <a href="/help.md">guide</a>, the <a href="/llms.txt">summary</a>, or the source on <a href="https://github.com/slidetake/slidetake">GitHub</a>.</p>
1251
+ </noscript>
989
1252
 
990
1253
  <header>
991
1254
  <div class="brand">
@@ -1016,7 +1279,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
1016
1279
  </div>
1017
1280
  <div id="breadcrumbs"></div>
1018
1281
  <div id="navbar">
1019
- <button id="btn-keys" title="Keyboard shortcuts (?)">\u2328<span class="lbl"> Keys</span></button>
1282
+ <button id="btn-keys" title="Keyboard shortcuts (K)">\u2328<span class="lbl"> Keys</span></button>
1020
1283
  <button id="nav-prev" class="touch-only" title="Previous (\u2190)" aria-label="Previous">\u2190</button>
1021
1284
  <button id="nav-next" class="touch-only" title="Next (\u2192)" aria-label="Next">\u2192</button>
1022
1285
  <div class="divider"></div>
@@ -1061,6 +1324,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
1061
1324
  <tr><td><kbd>E</kbd></td><td>editor: write, open, share</td></tr>
1062
1325
  <tr><td><kbd>L</kbd></td><td>light / dark</td></tr>
1063
1326
  <tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd> <kbd>R</kbd></td><td>camera, camera layouts, record</td></tr>
1327
+ <tr><td><kbd>K</kbd> <kbd>?</kbd></td><td>this card</td></tr>
1064
1328
  </table>
1065
1329
  <p>Drag to pan, scroll or pinch to zoom, click a card to fly to it.</p>
1066
1330
  <p><a href="/help" target="_blank" rel="noopener">The full guide \u2192</a> writing decks, sharing, recording, camera, review and cut.</p>
@@ -1076,6 +1340,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
1076
1340
  <li><a href="/new?template=blank"><strong>Blank</strong><span>A first card, a section and a detail.</span></a></li>
1077
1341
  <li><a href="/new?template=talk"><strong>Talk</strong><span>Why it matters, the idea, trade-offs, summary.</span></a></li>
1078
1342
  <li><a href="/new?template=recording"><strong>Recording</strong><span>Camera steps, an overview moment and a closing on camera.</span></a></li>
1343
+ <li><a href="/examples"><strong>Examples</strong><span>Everything a deck can hold: diagrams, charts, images, YouTube.</span></a></li>
1079
1344
  </ul>
1080
1345
  <p>Or <strong>\u21E3 Load</strong> a deck from a link, or <strong>Open</strong> a file from this computer.</p>
1081
1346
  </div>
@@ -1198,5 +1463,5 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
1198
1463
  <div id="rec-paused">Paused \xB7 press B to resume</div>
1199
1464
 
1200
1465
  <!-- The sample deck. Plain markdown, nothing else. -->
1201
- `;var Bn=`<link rel="preconnect" href="https://fonts.googleapis.com">
1202
- <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">`;var pa=e=>new Promise((t,n)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>n(new Error("could not load "+e)),document.head.appendChild(o)});async function ua(){document.head.insertAdjacentHTML("beforeend",Bn);let e=document.createElement("style");e.textContent=Tn,document.head.appendChild(e),document.body.insertAdjacentHTML("afterbegin",Mn),await Promise.all([window.gsap?null:pa("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"),window.marked?null:pa("https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js")]),await Promise.resolve().then(()=>(da(),Yr))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ua,{once:!0}):ua();})();
1466
+ `;var Dn=`<link rel="preconnect" href="https://fonts.googleapis.com">
1467
+ <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">`;var Ta=e=>new Promise((t,n)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>n(new Error("could not load "+e)),document.head.appendChild(o)});async function Ma(){document.head.insertAdjacentHTML("beforeend",Dn);let e=document.createElement("style");e.textContent=Pn,document.head.appendChild(e),document.body.insertAdjacentHTML("afterbegin",Rn),await Promise.all([window.gsap?null:Ta("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"),window.marked?null:Ta("https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js")]),await Promise.resolve().then(()=>(Ca(),Li))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ma,{once:!0}):Ma();})();