slidetake 0.4.5 → 0.4.6
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/README.md +1 -1
- package/dist/index.html +233 -26
- package/dist/slidetake.js +205 -49
- package/package.json +1 -1
package/dist/slidetake.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Slidetake 0.4.
|
|
2
|
-
"use strict";(()=>{var V=(e,t)=>()=>(e&&(t=e(e=0)),t);var
|
|
1
|
+
/* Slidetake 0.4.6 · https://slidetake.com · Apache-2.0 */
|
|
2
|
+
"use strict";(()=>{var V=(e,t)=>()=>(e&&(t=e(e=0)),t);var yo,Hr=V(()=>{yo=`---
|
|
3
3
|
title: Slidetake \u2014 write in markdown with AI, record without timeline editing
|
|
4
4
|
description: "Write a deck in markdown, with AI, present it on a spatial canvas, and record it slide by slide: retake any slide, pick the best take, download the video. Open source."
|
|
5
5
|
brand: slidetake
|
|
@@ -206,7 +206,7 @@ Your headings are the hierarchy: \`#\` is the first card, \`##\` branches from i
|
|
|
206
206
|
|
|
207
207
|
<!-- camera: on, full, on -->
|
|
208
208
|
|
|
209
|
-
A comment in a slide moves you: corner, full screen, or
|
|
209
|
+
A comment in a slide moves you: corner, full screen, beside the words, or a split screen. Turn on **Camera** and watch this slide do it.
|
|
210
210
|
|
|
211
211
|
### Your colours
|
|
212
212
|
|
|
@@ -365,7 +365,7 @@ Images next to the markdown load as they are. Save in any editor and the deck re
|
|
|
365
365
|
Open source, Apache 2.0: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake). Nothing to sign up for, and your decks stay yours: [Privacy](/privacy).
|
|
366
366
|
|
|
367
367
|
Next, every feature and what it saves you: **[Features \u2192](/features)**
|
|
368
|
-
`});var
|
|
368
|
+
`});var Wr,jr=V(()=>{Wr=`---
|
|
369
369
|
title: Slidetake Docs
|
|
370
370
|
description: "How to use Slidetake, step by step: get started, write a deck, present it, record a video in the browser or with OBS, and share it."
|
|
371
371
|
brand: slidetake
|
|
@@ -629,7 +629,7 @@ Two modes, both slide by slide, so there's no timeline to edit afterwards. **\u2
|
|
|
629
629
|
|
|
630
630
|
### Easy mode: record in the browser
|
|
631
631
|
|
|
632
|
-
1. **\u25CF Record** (R) the first time opens **\u2699 Setup**: pick your camera (or **No camera**) and microphone. Recording turns the camera on and off by itself.
|
|
632
|
+
1. **\u25CF Record** (R) the first time opens **\u2699 Setup**: pick your camera (or **No camera**, and **Mirror** if you want it flipped; off, it shows you as others see you) and microphone. Recording turns the camera on and off by itself.
|
|
633
633
|
2. **\u25CF Record** again, and share **this tab** when the browser asks. Only the 16:9 frame is recorded: slides and camera.
|
|
634
634
|
3. Next time, **\u25CF Record** carries on with the slides that have no take yet. When every slide has one, it records from the slide on screen to the end.
|
|
635
635
|
|
|
@@ -679,14 +679,14 @@ A dummy HDMI plug works on any system.
|
|
|
679
679
|
|
|
680
680
|
### Add your camera
|
|
681
681
|
|
|
682
|
-
**C** (or **Camera**) turns your webcam on in its box while presenting. A recording doesn't depend on it: it turns on the camera chosen for the deck (or none) by itself.
|
|
682
|
+
**C** (or **Camera**) turns your webcam on in its box while presenting. A recording doesn't depend on it: it turns on the camera chosen for the deck (or none) by itself. It stays as you left it when the page reloads. While it's off, the deck's camera settings are ignored, so readers get slides using the whole screen, except a slide with the camera behind it, which shows its layout over an empty frame.
|
|
683
683
|
|
|
684
684
|
\`\`\`yaml
|
|
685
685
|
---
|
|
686
686
|
pip: bottom-right \u2190 corner, or none
|
|
687
687
|
pip_size: 24% \u2190 box width
|
|
688
688
|
pip_shape: rect \u2190 or circle
|
|
689
|
-
pip_mirror: yes \u2190 mirror the webcam
|
|
689
|
+
pip_mirror: yes \u2190 mirror the webcam (until you choose in Setup)
|
|
690
690
|
camera: 24%, full, off \u2190 what V cycles
|
|
691
691
|
---
|
|
692
692
|
\`\`\`
|
|
@@ -705,10 +705,23 @@ A comment in a slide changes the camera from that slide on:
|
|
|
705
705
|
<!-- camera: 18% flip --> \u2190 small, other side
|
|
706
706
|
\`\`\`
|
|
707
707
|
|
|
708
|
-
Words you can combine: \`on\`, \`off\`, \`full\`, \`behind\` (
|
|
708
|
+
Words you can combine: \`on\`, \`off\`, \`full\`, \`behind\` (next), a size like \`30%\`, a corner, \`flip\`, \`circle\` / \`rect\`, \`mirror\` / \`unmirror\`. List them with commas to step through them on one slide: \`full, on\` opens on you, and the next \u2192 shrinks the camera to its corner and shows the slide.
|
|
709
709
|
|
|
710
710
|
**V** steps through the deck's \`camera:\` list by hand.
|
|
711
711
|
|
|
712
|
+
### Talk beside your slides
|
|
713
|
+
|
|
714
|
+
\`behind\` fills the frame with you and puts the slide's words beside you, on a half see-through card:
|
|
715
|
+
|
|
716
|
+
\`\`\`md
|
|
717
|
+
<!-- camera: behind --> \u2190 words on the left
|
|
718
|
+
<!-- camera: behind right --> \u2190 or right, top, bottom
|
|
719
|
+
<!-- camera: behind solid --> \u2190 split screen: you centred on the other side
|
|
720
|
+
<!-- camera: behind bottom clear --> \u2190 no card, for a plain wall
|
|
721
|
+
\`\`\`
|
|
722
|
+
|
|
723
|
+
It stays on its slide; \`pip: behind\` makes it the whole deck's. With the camera off, the slide still shows this way, over an empty frame.
|
|
724
|
+
|
|
712
725
|
### Take by take
|
|
713
726
|
|
|
714
727
|
**\u25CF Record** (R) counts down and starts. From then on \u2192 drives everything: slides, reveals and camera moves (a Bluetooth clicker works).
|
|
@@ -783,7 +796,7 @@ Every deck you open is **read-only**: Slidetake's own decks, templates, files on
|
|
|
783
796
|
No accounts, and no decks kept. Recording stays on your device.
|
|
784
797
|
|
|
785
798
|
Next, everything that leaves your browser, and where it goes: **[Privacy \u2192](/privacy)**
|
|
786
|
-
`});var
|
|
799
|
+
`});var Ur,_r=V(()=>{Ur=`---
|
|
787
800
|
title: Slidetake Features
|
|
788
801
|
description: "Every Slidetake feature, one line each: recording in the browser or with OBS, a map instead of a stack, the camera in the deck, plain markdown, your colours, and where it runs."
|
|
789
802
|
brand: slidetake
|
|
@@ -823,9 +836,12 @@ The complete list, one line each. Press \u2192 to walk it, **O** for the map.
|
|
|
823
836
|
|---|---|
|
|
824
837
|
| **Webcam in its box** | you and the slides in one recording, no compositing |
|
|
825
838
|
| **Camera per slide** | corner, size, side, circle, full screen, behind the slide or off |
|
|
839
|
+
| **Words around you** (\`behind left\`\u2026) | the slide's content beside, above or below you, on a see-through card, a solid one (split screen) or none |
|
|
840
|
+
| **Smooth moves** | the camera glides between corner, full frame and split screen, and swaps sides with the words |
|
|
826
841
|
| **Steps on one slide** | open on you, then reveal the slide |
|
|
827
842
|
| **Camera layouts** (V) | try them live, without editing the deck |
|
|
828
|
-
| **Off until you turn it on** |
|
|
843
|
+
| **Off until you turn it on** | the slides get the whole screen; a slide built around you shows an empty frame; a reload remembers it |
|
|
844
|
+
| **Mirror** (Setup) | off by default, so writing behind you reads the right way |
|
|
829
845
|
|
|
830
846
|
### Your colours
|
|
831
847
|
|
|
@@ -893,7 +909,7 @@ For Safari, Firefox or any browser, a screen too small for easy mode, or whateve
|
|
|
893
909
|
| **Open source, Apache 2.0** | read it, host it, change it: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake) |
|
|
894
910
|
|
|
895
911
|
Next, see them working: **[Showcase \u2192](/showcase)**
|
|
896
|
-
`});var
|
|
912
|
+
`});var Gr,qr=V(()=>{Gr=`---
|
|
897
913
|
title: Slidetake Privacy
|
|
898
914
|
brand: slidetake
|
|
899
915
|
pip: none
|
|
@@ -964,7 +980,7 @@ A shared link carries the whole deck after \`#\`. Browsers never send that part
|
|
|
964
980
|
## \u2709\uFE0F Questions
|
|
965
981
|
|
|
966
982
|
Open an issue on [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake/issues). Slidetake is open source, so everything above can be checked in its code.
|
|
967
|
-
`});var
|
|
983
|
+
`});var Yr,Vr=V(()=>{Yr=`---
|
|
968
984
|
title: My deck
|
|
969
985
|
---
|
|
970
986
|
|
|
@@ -979,7 +995,7 @@ Every heading is a card. \`##\` sections branch from the first card.
|
|
|
979
995
|
### A detail
|
|
980
996
|
|
|
981
997
|
\`###\` branches from the section above it.
|
|
982
|
-
`});var
|
|
998
|
+
`});var Jr,Kr=V(()=>{Jr=`---
|
|
983
999
|
title: Talk title
|
|
984
1000
|
duration: 15m
|
|
985
1001
|
---
|
|
@@ -1020,7 +1036,7 @@ Something concrete the audience will recognise.
|
|
|
1020
1036
|
## \u{1F64F} Thank you
|
|
1021
1037
|
|
|
1022
1038
|
Where to find you, and the link to these slides.
|
|
1023
|
-
`});var
|
|
1039
|
+
`});var Xr,$r=V(()=>{Xr=`---
|
|
1024
1040
|
title: Video title
|
|
1025
1041
|
duration: 10m
|
|
1026
1042
|
pip: bottom-right
|
|
@@ -1069,7 +1085,7 @@ Slides you talk over in the corner.
|
|
|
1069
1085
|
<!-- camera: on, full, on, off -->
|
|
1070
1086
|
|
|
1071
1087
|
Ends on you full screen, then back to the slide, then without the camera.
|
|
1072
|
-
`});var
|
|
1088
|
+
`});var Zr,Qr=V(()=>{Zr=`---
|
|
1073
1089
|
title: Slidetake Showcase
|
|
1074
1090
|
description: "Everything a Slidetake deck can hold, working on screen: text, steps, code, Graphviz, D2, SVG, charts, image layouts, YouTube, the camera and the map."
|
|
1075
1091
|
brand: slidetake
|
|
@@ -1242,7 +1258,92 @@ A YouTube link alone on a line becomes the video: the next press plays it, leavi
|
|
|
1242
1258
|
|
|
1243
1259
|
<!-- camera: on, full, on -->
|
|
1244
1260
|
|
|
1245
|
-
Try it: press **C** to turn on your camera, then \u2192. This card puts you in the corner, then full screen, then back, from one comment: \`<!-- camera: on, full, on -->\`.
|
|
1261
|
+
Try it: press **C** to turn on your camera, then \u2192. This card puts you in the corner, then full screen, then back, from one comment: \`<!-- camera: on, full, on -->\`. The cards after it put the words beside you.
|
|
1262
|
+
|
|
1263
|
+
### Behind the slide
|
|
1264
|
+
|
|
1265
|
+
<!-- camera: behind -->
|
|
1266
|
+
|
|
1267
|
+
With the camera on, you fill the frame and this slide's words sit beside you: a talking head with slides. One comment does it: \`<!-- camera: behind -->\`, or \`pip: behind\` for a whole deck. They go on the left, on a half see-through card; \`right\`, \`top\` or \`bottom\` put them elsewhere.
|
|
1268
|
+
|
|
1269
|
+
### Words around you
|
|
1270
|
+
|
|
1271
|
+
<!-- camera: behind left, behind right, behind top, behind bottom -->
|
|
1272
|
+
|
|
1273
|
+
Press \u2192 and these words move around you: \`left\`, \`right\`, \`top\`, \`bottom\`. One comment, one press each.
|
|
1274
|
+
|
|
1275
|
+
### Split screen
|
|
1276
|
+
|
|
1277
|
+
<!-- camera: behind solid, behind right solid, behind top solid, behind bottom solid -->
|
|
1278
|
+
|
|
1279
|
+
Add \`solid\` and the card hides the camera behind it: a split screen, with the camera moved to the other side and you centred there.
|
|
1280
|
+
|
|
1281
|
+
### Clear
|
|
1282
|
+
|
|
1283
|
+
<!-- camera: behind clear, behind bottom clear -->
|
|
1284
|
+
|
|
1285
|
+
\`clear\` takes the card away: the words sit straight on the camera. Best over a plain wall or a green screen.
|
|
1286
|
+
|
|
1287
|
+
### A picture beside you
|
|
1288
|
+
|
|
1289
|
+
<!-- camera: behind right, behind left, behind bottom -->
|
|
1290
|
+
|
|
1291
|
+

|
|
1292
|
+
|
|
1293
|
+
### A Graphviz diagram beside you
|
|
1294
|
+
|
|
1295
|
+
<!-- camera: behind left, behind left solid -->
|
|
1296
|
+
|
|
1297
|
+
Talk through the flow while it sits beside you.
|
|
1298
|
+
|
|
1299
|
+
\`\`\`dot
|
|
1300
|
+
digraph {
|
|
1301
|
+
rankdir=LR
|
|
1302
|
+
node [shape=box style=rounded]
|
|
1303
|
+
Markdown -> Deck -> Takes -> Video
|
|
1304
|
+
}
|
|
1305
|
+
\`\`\`
|
|
1306
|
+
|
|
1307
|
+
### A D2 diagram beside you
|
|
1308
|
+
|
|
1309
|
+
<!-- camera: behind right, behind top -->
|
|
1310
|
+
|
|
1311
|
+
\`\`\`d2
|
|
1312
|
+
direction: right
|
|
1313
|
+
write: Write
|
|
1314
|
+
present: Present
|
|
1315
|
+
record: Record
|
|
1316
|
+
write -> present -> record
|
|
1317
|
+
\`\`\`
|
|
1318
|
+
|
|
1319
|
+
### An SVG beside you
|
|
1320
|
+
|
|
1321
|
+
<!-- camera: behind left, behind bottom solid -->
|
|
1322
|
+
|
|
1323
|
+
Drawn in the deck's colours.
|
|
1324
|
+
|
|
1325
|
+
\`\`\`svg
|
|
1326
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 130">
|
|
1327
|
+
<rect x="10" y="10" width="90" height="80" rx="10" style="fill:var(--accent)"/>
|
|
1328
|
+
<rect x="115" y="10" width="90" height="80" rx="10" style="fill:var(--accent);opacity:.6"/>
|
|
1329
|
+
<rect x="220" y="10" width="90" height="80" rx="10" fill="none" stroke="currentColor" stroke-width="2"/>
|
|
1330
|
+
<text x="160" y="120" text-anchor="middle" font-size="14" fill="currentColor">accent, faded, outlined</text>
|
|
1331
|
+
</svg>
|
|
1332
|
+
\`\`\`
|
|
1333
|
+
|
|
1334
|
+
### A chart beside you
|
|
1335
|
+
|
|
1336
|
+
<!-- camera: behind right, behind bottom -->
|
|
1337
|
+
|
|
1338
|
+
Views a month, and growing.
|
|
1339
|
+
|
|
1340
|
+
\`\`\`echarts
|
|
1341
|
+
{
|
|
1342
|
+
"xAxis": {"type": "category", "data": ["Jan", "Feb", "Mar", "Apr", "May"]},
|
|
1343
|
+
"yAxis": {"type": "value"},
|
|
1344
|
+
"series": [{"type": "bar", "data": [12, 19, 15, 24, 30]}]
|
|
1345
|
+
}
|
|
1346
|
+
\`\`\`
|
|
1246
1347
|
|
|
1247
1348
|
## \u{1F5FA}\uFE0F Layouts and the map
|
|
1248
1349
|
|
|
@@ -1275,50 +1376,50 @@ Open **\u270E Editor** and press **New** for a template (blank, talk or recordin
|
|
|
1275
1376
|
The templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.
|
|
1276
1377
|
|
|
1277
1378
|
Next, how it all works, step by step: **[Docs \u2192](/docs)**
|
|
1278
|
-
`});function
|
|
1379
|
+
`});function ht(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function Ht(e){return e.replace(/<[^>]*>/g,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function A(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function en(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,a)=>a[0]==="#"?String.fromCodePoint(a[1].toLowerCase()==="x"?parseInt(a.slice(2),16):parseInt(a.slice(1),10)):Ds[a.toLowerCase()]??t)}function jt(e){let t={};for(let a of e.matchAll(/([\w-]+)="([^"]*)"/g))t[a[1]]=a[2];return t}function Wt(e,t){let a=[[]],o=null;return e.split(`
|
|
1279
1380
|
`).forEach(r=>{let n=r.match(/^\s{0,3}(`{3,}|~{3,})/);n&&(o?n[1][0]===o[0]&&n[1].length>=o.length&&(o=null):o=n[1]),!o&&!n&&t.test(r)?a.push([]):a[a.length-1].push(r)}),a.map(r=>r.join(`
|
|
1280
|
-
`))}function
|
|
1381
|
+
`))}function tn(e){let t=String(e??"").trim().toLowerCase();if(!t)return 0;let a=t.match(/^(\d+):(\d{1,2})$/);if(a)return(+a[1]*60+ +a[2])*1e3;if(a=t.match(/^(\d+(?:\.\d+)?)\s*(h|hrs?|hours?|m|mins?|minutes?|s|secs?|seconds?)?$/),!a)return 0;let o=(a[2]||"m")[0];return parseFloat(a[1])*(o==="h"?3600:o==="s"?1:60)*1e3}function ba(e){let t=Math.max(0,Math.round(e/1e3)),a=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60;return(a?a+":"+String(o).padStart(2,"0"):o)+":"+String(r).padStart(2,"0")}function pt(e){let t=Math.max(0,Math.round(e/1e3)),a=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60;return a?a+"h "+String(o).padStart(2,"0")+"m":o?o+"m "+String(r).padStart(2,"0")+"s":r+"s"}var Ds,va=V(()=>{"use strict";Ds={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function on(e){let t=null;return e.split(`
|
|
1281
1382
|
`).filter(a=>{let o=a.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(`
|
|
1282
|
-
`).replace(/`[^`\n]*`/g,"")}function
|
|
1283
|
-
`).forEach(r=>{let n=r.match(/^\s+-\s+(.*)$/);if(n&&o){t[o].push(n[1].trim().replace(/^["']|["']$/g,""));return}let i=r.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(a[0].length)}}function
|
|
1383
|
+
`).replace(/`[^`\n]*`/g,"")}function bo(e){return/<!--\s*view\s*:\s*(overview|map)\s*-->/i.test(on(e))}function vo(e){let t=on(e).match(/<!--\s*camera\s*:\s*([\s\S]*?)\s*-->/i);return t?t[1].trim():null}function Fs(e){let t={},a=e.match(/^---[ \t]*\n([\s\S]*?)\n---[ \t]*(?:\n|$)/);if(!a)return{deck:t,body:e};let o=null;return a[1].split(`
|
|
1384
|
+
`).forEach(r=>{let n=r.match(/^\s+-\s+(.*)$/);if(n&&o){t[o].push(n[1].trim().replace(/^["']|["']$/g,""));return}let i=r.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(a[0].length)}}function rn(e){let t=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean",a=r=>String(r).replace(/\s*\n\s*/g," "),o=[];for(let[r,n]of Object.entries(e||{}))/^[A-Za-z_][\w-]*$/.test(r)&&(t(n)?o.push(r+": "+a(n)):Array.isArray(n)&&n.every(t)&&(o.push(r+":"),n.forEach(i=>o.push(" - "+a(i)))));return o.length?`---
|
|
1284
1385
|
`+o.join(`
|
|
1285
1386
|
`)+`
|
|
1286
1387
|
---
|
|
1287
|
-
`:""}function
|
|
1388
|
+
`:""}function Ns(e){let t=e.split(`
|
|
1288
1389
|
`),a={},o=e;if(t[0]!==void 0&&t[0].trim()==="---"){let r=-1;for(let n=1;n<t.length;n++)if(t[n].trim()==="---"){r=n;break}r!==-1&&(t.slice(1,r).forEach(n=>{let i=n.indexOf(":");i>-1&&(a[n.slice(0,i).trim()]=n.slice(i+1).trim().replace(/^["']|["']$/g,""))}),o=t.slice(r+1).join(`
|
|
1289
|
-
`).replace(/^\n+/,""))}return{meta:a,body:o}}function
|
|
1290
|
-
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?
|
|
1291
|
-
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=
|
|
1292
|
-
`).forEach(x=>{let
|
|
1293
|
-
`);
|
|
1294
|
-
`).trim(),
|
|
1295
|
-
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||
|
|
1390
|
+
`).replace(/^\n+/,""))}return{meta:a,body:o}}function Hs(e){let t=e.replace(/<!--[\s\S]*?-->/g,""),a=t.match(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/m),o=t.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i),r=null;if(a&&(!o||a.index<o.index)?r=a[1]:o&&(r=o[1].replace(/<[^>]+>/g," ")),!r){let n=t.split(`
|
|
1391
|
+
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?en(Ht(r)).replace(/\s+/g," ").trim():null}function an(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?jt(t[1]):{}}function nn(e,{render:t=a=>({html:a,err:null})}={}){let a=new Map,o=g=>{let b=g,p=2;for(;a.has(b);)b=g+"-"+p++;return b},r=g=>(a.set(g.id,{x:null,y:null,children:[],...g}),g.id);e=e.replace(/\r\n?/g,`
|
|
1392
|
+
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=Fs(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!n&&(Wt(e,/^--\s*$/).length>1||s&&Wt(e,/^---\s*$/).length>1),c=n?S():l?f():d();return a.forEach(g=>{(!g.parent||g.parent===g.id||!a.has(g.parent))&&(g.parent=null)}),a.forEach(g=>{let b=new Set([g.id]),p=g.parent;for(;p;){if(b.has(p)){g.parent=null;break}b.add(p),p=a.get(p).parent}}),a.forEach(g=>{g.parent&&a.get(g.parent).children.push(g.id)}),{deck:i,nodes:a,format:n?"+++":l?"reveal":"headings",errCount:c};function d(){let g=[],b=null,p=null,T={level:0,title:null,explicitId:null,lines:[]};e.split(`
|
|
1393
|
+
`).forEach(x=>{let y=x.match(/^\s{0,3}(`{3,}|~{3,})/);y&&(p?y[1][0]===p[0]&&y[1].length>=p.length&&(p=null):p=y[1]);let E=!p&&!y?x.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(E){let L=E[2],$=null,ae=L.match(/\s*\{#([\w\-:.]+)\}\s*$/);ae&&($=ae[1],L=L.slice(0,ae.index)),b={level:E[1].length,title:Ht(L),explicitId:$,lines:[E[1]+" "+L]},g.push(b)}else(b||T).lines.push(x)});let C=T.lines.join(`
|
|
1394
|
+
`);C.trim()&&(g.length&&!C.replace(/<!--[\s\S]*?-->/g,"").trim()?g[0].lines.splice(1,0,...T.lines):g.unshift(T));let w=[];return g.forEach(x=>{for(;w.length&&w[w.length-1].level>=x.level;)w.pop();let y=w.length?w[w.length-1].id:null,E=x.lines.join(`
|
|
1395
|
+
`).trim(),L=x.title||Ht((E.split(`
|
|
1396
|
+
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||ht(L));let{html:$,err:ae}=t(E);r({id:x.id,parent:y,title:L,html:$,err:ae,camera:vo(E),mapFirst:bo(E)}),w.push(x)}),0}function S(){let g=e.split(/\n\+\+\+[ \t]*\n/).map(T=>T.trim()).filter(T=>T.length),b=null,p=0;return g.forEach((T,C)=>{let{meta:w,body:x}=Ns(T),y=o(w.id||"slide-"+(C+1)),E="parent"in w?w.parent||null:b,L=x.match(/^#{1,6}\s+(.+)$/m),$=w.title||(L?Ht(L[1]):y),{html:ae,err:X}=t(x);X&&p++,r({id:y,parent:E,title:$,html:ae,err:X,camera:w.camera||vo(x),mapFirst:bo(x),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),b=y}),p}function f(){let g=0,b=0,p=null;function T(w,x){let y=w.body.trim();b++;let E=Hs(y)||"Slide "+b,L=x?a.get(x).title:null;L&&E.startsWith(L+" / ")&&(E=E.slice(L.length+3));let $=o(ht(E)),{html:ae,err:X}=t(y);return X&&g++,r({id:$,parent:x,title:E,html:ae,err:X,camera:vo(y),mapFirst:bo(y),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let C=[];return Wt(e,/^---\s*$/).forEach(w=>{if(/<section\b/i.test(w)){for(let E of w.matchAll(/<section\b([^>]*)>([\s\S]*?)<\/section>/gi))C.push([{body:E[2],attrs:jt(E[1])}]);let y=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");y.trim()&&C.push([{body:y,attrs:an(y)}]);return}let x=Wt(w,/^--\s*$/).filter(y=>y.trim()).map(y=>({body:y,attrs:an(y)}));x.length&&C.push(x)}),C.forEach(w=>{let x=null;w.forEach((y,E)=>{if(!p){p=x=T(y,null);return}E===0?x=T(y,p):T(y,x)})}),g}}var sn=V(()=>{"use strict";va()});function Ye(e,t){return String(t||"").toLowerCase().split(/\s+/).forEach(a=>{a&&(a==="solid"?(e.card=100,e.used=!0):a==="clear"?(e.card=0,e.used=!0):a==="off"||a==="hide"?e.off=!0:a==="on"||a==="pip"||a==="show"?(e.off=!1,e.full=!1,e.behind=!1,e.place="",e.used=!0):a==="full"||a==="fullscreen"?(e.full=!0,e.behind=!1,e.place="",e.off=!1,e.used=!0):a==="behind"||a==="under"?(e.full=!0,e.behind=!0,e.place="left",e.off=!1,e.used=!0):js.includes(a)?(e.place=a,e.used=!0):/^\d+(\.\d+)?%?$/.test(a)?(e.size=wo(parseFloat(a)),e.used=!0):_t.includes(a)?(e.corner=a,e.used=!0):a==="flip"?(e.flip=!e.flip,e.used=!0):a==="circle"?e.circle=!0:a==="rect"?e.circle=!1:a==="mirror"?e.mirror=!0:(a==="unmirror"||a==="no-mirror")&&(e.mirror=!1))}),e}function ln(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function cn(e,t){let a=[];if(!e.length){for(let r=0;r<=t;r++)a.push({cam:0,frag:r});return a}let o=e.findIndex(r=>!Ye({},r).full);o<0&&(o=e.length-1);for(let r=0;r<=o;r++)a.push({cam:r,frag:0});for(let r=1;r<=t;r++)a.push({cam:o,frag:r});for(let r=o+1;r<e.length;r++)a.push({cam:r,frag:t});return a}var _t,js,wo,dn=V(()=>{"use strict";_t=["top-left","top-right","bottom-left","bottom-right"],js=["left","right","top","bottom"],wo=e=>Math.max(8,Math.min(60,e))});function hn(e){let t=String(e||"").trim();if(!t)return null;let a;try{a=new URL(/^[a-z]+:\/\//i.test(t)?t:"https://"+t)}catch{return null}let o=a.pathname.split("/").filter(Boolean);if(a.hostname==="github.com"||a.hostname==="www.github.com"){let[r,n,i,s,...l]=o;if(r&&n&&(i==="blob"||i==="raw"||i==="tree")&&s){let c=l.join("/");return(i==="tree"||!/\.(md|markdown|txt)$/i.test(c))&&(c=(c?c+"/":"")+"index.md"),{kind:"url",url:xo+[r,n,s].join("/")+"/"+c}}if(r&&n&&!i)return{kind:"url",url:xo+r+"/"+n+"/HEAD/README.md"}}if(a.hostname==="gist.github.com"){let r=o.length>=2?o[1]:o[0];if(r&&/^[\da-f]+$/i.test(r))return{kind:"gist",id:r}}if(a.hostname==="slidetake.com"||a.hostname==="www.slidetake.com"){let r=ko(a.pathname);if(r)return r;let n=a.searchParams.get("src");if(n)return{kind:"url",url:n}}return{kind:"url",url:a.href}}function ko(e){let t=String(e||"").split("/").filter(Boolean).map(a=>{try{return decodeURIComponent(a)}catch{return a}});if(t[0]==="gh"&&t.length>=4){let[,a,o,...r]=t,n=o.indexOf("@"),i=n<0?o:o.slice(0,n),s=n<0?"HEAD":o.slice(n+1);return!a||!i||!s?null:{kind:"url",url:xo+[a,i,s,...r].map(encodeURIComponent).join("/")}}return t.length===1&&(t[0]==="docs"||t[0]==="help")?{kind:"builtin",id:"docs"}:t[0]==="showcase"&&t.length===1?{kind:"builtin",id:"showcase"}:t[0]==="examples"&&(t.length===1||t.length===2&&t[1]==="showcase")?{kind:"builtin",id:"showcase"}:t.length===1&&t[0]==="features"?{kind:"builtin",id:"features"}:t.length===1&&t[0]==="privacy"?{kind:"builtin",id:"privacy"}: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 pn(e){if(e.kind==="builtin")return e.id==="home"?"/":e.id==="showcase"?"/showcase":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[,a,o,r,n]=t;if(!/^refs$/.test(r))return"/gh/"+a+"/"+o+(r==="HEAD"?"":"@"+r)+"/"+n}return"/?src="+encodeURIComponent(e.url)}var xo,So=V(()=>{"use strict";xo="https://raw.githubusercontent.com/"});function Ws(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function _s(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,a=>a.charCodeAt(0))}async function un(e,t){let a=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await a.arrayBuffer())}async function mn(e){return Ws(await un(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function fn(e){return new TextDecoder().decode(await un(_s(e),new DecompressionStream("deflate-raw")))}function wa(e){let t=e.replace(/^#/,"");if(!t.startsWith(Eo)){let n=t;try{n=decodeURIComponent(t)}catch{}return{data:null,slide:n}}let a=t.slice(Eo.length),o=a.indexOf("~"),r=o<0?"":a.slice(o+1);try{r=decodeURIComponent(r)}catch{}return{data:o<0?a:a.slice(0,o),slide:r}}function Co(e,t){return"#"+Eo+e+(t?"~"+encodeURIComponent(t):"")}var Eo,Mo=V(()=>{"use strict";Eo="deflate:"});function gn(e,t,a){let o=e.replace(/\/+$/,"")||"/",r=new URLSearchParams(t),{data:n,slide:i}=wa(a);if(o==="/share")return n?{page:"share",data:n,slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:""};if(o==="/edit")return{page:"edit",slide:i};if(o==="/new"){let c=r.get("template");return c&&Us.includes(c)?{page:"source",source:{kind:"builtin",id:"template:"+c},slide:i}:{page:"pick"}}let s=ko(o);if(s)return{page:"source",source:s,slide:i};let l=r.get("src");return o==="/"&&l?{page:"source",source:{kind:"url",url:l},slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:i}}function Ee(e){switch(e.kind){case"builtin":return e.id==="home"?"Home":e.id==="docs"||e.id==="help"?"the docs":e.id==="showcase"?"the showcase":e.id==="features"?"the features":e.id==="privacy"?"the privacy page":"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 a=new URL(e.url);return a.hostname+a.pathname}catch{return e.url}}}}function xa(e,t,{exported:a=!1}={}){return{text:e,origin:t,originText:e,exported:a?e:null}}function ka(e){return e.text!==(e.exported??e.originText)}function Sa(e){return e.text===e.originText}function yn(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 Us,bn=V(()=>{"use strict";So();Mo();Us=["blank","talk","recording"]});function To(e){let t;try{t=new URL(e)}catch{return null}let a=t.hostname.replace(/^(www\.|m\.)/,""),o=null,r=!1;if(a==="youtu.be")o=t.pathname.slice(1).split("/")[0];else if(a==="youtube.com"||a==="youtube-nocookie.com"){let n=t.pathname.split("/").filter(Boolean);n[0]==="watch"?o=t.searchParams.get("v"):["shorts","live","embed"].includes(n[0])&&(o=n[1]||null,r=n[0]==="shorts")}return!o||!/^[\w-]{6,}$/.test(o)?null:{id:o,start:qs(t.searchParams.get("t")||t.searchParams.get("start")||""),portrait:r}}function qs(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 vn(e){return"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(e.id)+"?enablejsapi=1&rel=0&playsinline=1"+(e.start?"&start="+e.start:"")}var wn=V(()=>{"use strict"});function ye(e){let t=new Map,a=e.totalObs??e.total;return e.events.forEach((o,r)=>{t.has(o.id)||t.set(o.id,{id:o.id,title:o.title,takes:[]});let n=t.get(o.id),i=e.events[r+1];n.takes.push({no:n.takes.length+1,start:xn(o)+(o.skip||0),end:i?xn(i)-(i.lead||0):a})}),t}function Ut(e){let t=[],a=Ca(e);return ye(e).forEach(o=>{let r=e.picks[o.id]??o.takes.length;if(!r)return;let n=o.takes[r-1];if(!n)return;let i=kn(n.start,a),s=kn(n.end,a);s>i&&t.push({id:o.id,title:o.title,f0:i,f1:s,start:i*1e3/a,end:s*1e3/a})}),t}function Gs(e){let t=[];return e.forEach(a=>{let o=t[t.length-1];o&&a.f0===o.f1?(o.f1=a.f1,o.end=a.end):t.push({f0:a.f0,f1:a.f1,start:a.start,end:a.end})}),t}function Lo(e,t){let a=0,o=[];return Ut(e).forEach(r=>{let{sec:n,title:i}=t(r.id,r.title),s=o[o.length-1];(!s||s.sec!==n&&s.title!==i)&&o.push({sec:n,title:i,t:a}),a+=r.end-r.start}),{list:o,length:a}}function En(e,t){let{list:a,length:o}=Lo(e,t),r=a.filter((n,i)=>i===0||(a[i+1]?a[i+1].t:o)-n.t>=1e4);return r.length&&(r[0].t=0),{lines:r.map(n=>ba(n.t)+" "+n.title),dropped:a.length-r.length,length:o}}function Cn(e,t,{input:a,outputName:o,sectionOf:r,loudness:n}){let i=Gs(Ut(e));if(!e.withObs)return"# This was a rehearsal: nothing was recorded.";if(!i.length)return"# Every slide is left out: nothing to render.";let s=Vs(a)+o,{list:l,length:c}=Lo(e,r),d=y=>String(y).replace(/[=;#\\\n]/g,E=>"\\"+E),f=`cat > /tmp/slidetake-chapters.txt <<'EOF'
|
|
1296
1397
|
`+(`;FFMETADATA1
|
|
1297
1398
|
title=`+d(e.deckTitle)+`
|
|
1298
|
-
`+l.map((
|
|
1399
|
+
`+l.map((y,E)=>`[CHAPTER]
|
|
1299
1400
|
TIMEBASE=1/1000
|
|
1300
|
-
START=`+Math.round(
|
|
1301
|
-
END=`+Math.round(l[
|
|
1302
|
-
title=`+d(
|
|
1401
|
+
START=`+Math.round(y.t)+`
|
|
1402
|
+
END=`+Math.round(l[E+1]?l[E+1].t:c)+`
|
|
1403
|
+
title=`+d(y.title)).join(`
|
|
1303
1404
|
`))+`
|
|
1304
1405
|
EOF
|
|
1305
|
-
`,
|
|
1306
|
-
inpoint `+
|
|
1307
|
-
outpoint `+
|
|
1406
|
+
`,g=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let y=i.map(L=>"file "+Ea(a)+`
|
|
1407
|
+
inpoint `+Sn(L.start)+`
|
|
1408
|
+
outpoint `+Sn(L.end)).join(`
|
|
1308
1409
|
`);return(i.length>1?`# Careful: without re-encoding, cuts can only land on keyframes (OBS puts one about every 2 s),
|
|
1309
1410
|
# so `+(i.length===2?"the cut":"each of the "+(i.length-1)+" cuts")+` here may keep or lose up to ~2 s. Use a frame-accurate option for retakes.
|
|
1310
1411
|
`:"")+`cat > /tmp/slidetake-cuts.txt <<'EOF'
|
|
1311
|
-
`+
|
|
1412
|
+
`+y+`
|
|
1312
1413
|
EOF
|
|
1313
|
-
`+
|
|
1314
|
-
`)};[tl(),_&&_.colors].filter(Boolean).forEach(o=>{["dark","light"].forEach(r=>{let n={...o,...o[r]||{}},i=r==="dark";n.accent&&typeof n.accent=="string"&&(n.accentSoft=n.accentSoft||n.accent,n.line=n.line||"color-mix(in srgb, "+n.accent+(i?" 45%, #09090b)":" 55%, #fff)"),n.ring=n.ring||(i?n.accent:n.line),n.onAccent=n.onAccent||(i?"color-mix(in srgb, "+n.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',n)})});let a=document.getElementById("st-colors");a||(a=document.createElement("style"),a.id="st-colors",document.head.appendChild(a)),a.textContent!==e&&(a.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Me(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),_e=_e||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),_e.clearRect(0,0,1,1),_e.fillStyle="#000",_e.fillStyle=a,_e.fillRect(0,0,1,1),"#"+[..._e.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function ol(e,t,a){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),r=o(e),n=o(t);return"#"+r.map((i,s)=>Math.round(i*a+n[s]*(1-a)).toString(16).padStart(2,"0")).join("")}function eo(){if(_&&_.themeKey&&!Rn){let t=W(_.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Rn||W("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function ti(){let e=eo()==="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 ai(){let e=eo()==="light"?"dark":"light";_&&_.themeKey?(U(_.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):U("slidetake:mode",e),ti(),se.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&wt(!0)}function rl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Wo(e){return!re&&e?en(e.camera):[]}function Tt(e){return tn(Wo(e),e&&e.frags?e.frags.length:0)}function oi(){let e=Tt(u.get(f));return e[Math.min(we,e.length-1)]||{cam:0,frag:0}}function nl(){if(!f)return null;let e=u.get(f),t=Wo(e);if(t.length)return t[Math.min(oi().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=g.indexOf(f)-1;a>=0;a--){let o=Wo(u.get(g[a]));if(o.length)return o[o.length-1]}return null}function il(){let e={corner:(R.pip||"none").toLowerCase(),size:go(parseFloat(R.pip_size)||24),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(R.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return(e.corner==="behind"||e.corner==="under")&&(e.corner="bottom-right",Ft(e,"behind")),Ft(e,nl()),ye&&!/\b(off|hide)\b/i.test(ye)&&(e.off=!1),Ft(e,ye),!Dt.includes(e.corner)&&(oe||e.used)&&(e.corner="bottom-right"),e.flip&&Dt.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function nr(){let e=!P.hidden&&P.offsetWidth?P.getBoundingClientRect():null,t=Pe=il(),a=Dt.includes(t.corner);if(P.className=a?[t.corner,t.circle&&"circle",oe&&"live",t.mirror&&"mirror",t.full&&"full",t.behind&&"behind",P.classList.contains("msg")&&"msg"].filter(Boolean).join(" "):"",P.style.width=t.size+"%",P.hidden=!a||re||t.off,ja.dataset.pip=P.hidden||t.full?"none":t.corner,ja.classList.toggle("cam-behind",!P.hidden&&!!t.behind),P.hidden||Mt||!P.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){P.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let r=P.getBoundingClientRect();Math.abs(e.left-r.left)+Math.abs(e.top-r.top)+Math.abs(e.width-r.width)+Math.abs(e.height-r.height)<2||P.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-r.left)+"px,"+(e.top-r.top)+"px) scale("+e.width/r.width+","+e.height/r.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function sl(){let e=Pe;if(!e||P.hidden||e.full)return null;let t=H.clientWidth,a=H.clientHeight,o=16,r=t*e.size/100,n=e.circle?r:r*9/16,i=e.corner.includes("left")?o:t-o-r,s=e.corner.includes("top")?o:a-o-n;return{x0:i,y0:s,x1:i+r,y1:s+n}}function ll(){if(!Ze)return;if(re){pa(!0);return}let e=rl();Ie=(Ie+1)%e.length,ye=e[Ie],nr(),K||mt("Camera: "+ye),!oe&&!P.hidden?at():xe()}function ri(e){let t=Qr(e,{render:Qs});R=t.deck,u=t.nodes,_a();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Us.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,Jt.textContent=t.errCount?t.errCount+" card(s) had errors":""}function ni(){Ye=[...u.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,r){let n=u.get(o);if(n.depth=r,n.children.length===0)n._slot=e++;else{n.children.forEach(s=>t(s,r+1));let i=n.children.map(s=>u.get(s)._slot);n._slot=(Math.min(...i)+Math.max(...i))/2}}Ye.forEach(o=>t(o,0)),g=[];function a(o){g.push(o),u.get(o).children.forEach(a)}return Ye.forEach(a),Math.max(1,e)}function cl(){let e=[],t=[],a=[];return u.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),a[o.depth]=(a[o.depth]||0)+1}),{maxH:e,maxW:t,count:a,maxDepth:e.length-1}}function ii(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 dl(){let{maxH:e,maxDepth:t}=cl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+Ys;let o=Vs-yt,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(M=>n(M,c))},i=l=>{let c=u.get(l);r[c.depth]=Math.max(r[c.depth]??-1/0,c.cx+c._w/2),c.children.forEach(i)};function s(l){let c=u.get(l),d=r[c.depth]!==void 0?r[c.depth]+o:-1/0;c.children.length?(c.children.forEach(s),c.cx=(u.get(c.children[0]).cx+u.get(c.children[c.children.length-1]).cx)/2,c.cx-c._w/2<d&&n(l,d-(c.cx-c._w/2))):c.cx=(d===-1/0?0:d)+c._w/2,i(l)}Ye.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,ii(l)})}function hl(e){let t=Math.PI*2/e,a=32,o=[],r=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+a&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+a,n=Math.max(0,...[...u.values()].map(s=>s.depth)),i=0;for(let s=0;s<=n;s++){let l=[...u.values()].filter(d=>d.depth===s);if(!l.length)continue;let c=s===0?Ye.length>1?Js*.5:0:i+Ks;for(let d=0;d<400&&(l.forEach(m=>{let y=(m._slot+.5)*t-Math.PI/2;m.cx=c*Math.cos(y),m.cy=c*Math.sin(y),ii(m)}),!!l.some((m,y)=>l.some((b,p)=>p>y&&r(m,b))||o.some(b=>r(m,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function pl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)a.push(t.currentNode);a.forEach(o=>{let r=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!r)return;let n=o.previousSibling;for(;n&&n.nodeType===3&&!n.data.trim();)n=n.previousSibling;let i=n&&n.nodeType===1?n:o.parentElement;i&&Object.entries(zt(r[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 ml(e){let t=new DOMParser().parseFromString(e,"image/svg+xml"),a=t.documentElement;if(!a||a.localName!=="svg"||t.getElementsByTagName("parsererror").length)return null;let o=a.namespaceURI,r=i=>{[...i.children].forEach(s=>{s.namespaceURI!==o||!ul.has(s.localName)?s.remove():r(s)}),[...i.attributes].forEach(s=>{let l=s.name.toLowerCase(),c=s.value;(l.startsWith("on")||/javascript:|expression\(/i.test(c)||/url\(\s*['"]?(?!#)/i.test(c)||(l==="href"||l==="xlink:href")&&!c.trim().startsWith("#"))&&i.removeAttribute(s.name)})};r(a);let n="st-svg"+ ++fl+"-";return[a,...a.querySelectorAll("*")].forEach(i=>[...i.attributes].forEach(s=>{let l=s.name==="id"?n+s.value:s.value.replace(/url\(\s*(['"]?)#/g,"url($1#"+n);(s.name==="href"||s.name==="xlink:href")&&l.startsWith("#")&&(l="#"+n+l.slice(1)),l!==s.value&&(s.value=l)})),document.importNode(a,!0)}function Oe(e,t){let a=e.classList.contains("fragment");["fragment","fade-up","visible","current-fragment"].forEach(o=>{e.classList.contains(o)&&(t.classList.add(o),e.classList.remove(o))}),e.dataset.fragmentIndex!==void 0&&(t.dataset.fragmentIndex=e.dataset.fragmentIndex,delete e.dataset.fragmentIndex),e.replaceWith(t),a&&u.forEach(o=>o.frags&&o.frags.forEach(r=>{let n=r.indexOf(e);n>=0&&(r[n]=t)}))}function Io(e){let t=document.createElement("figure");t.className="media",Oe(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function gl(e,t){let a=document.createElement("figure");return a.className="media yt fragment yt-play"+(e.portrait?" portrait":""),a.innerHTML='<div class="frame"><iframe src="'+pn(e)+'" title="'+A(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+A(t)+"</figcaption>":""),a}function Dn(e,t){let a=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",a),e.style.setProperty("--rows",Math.ceil(t/a))}function vl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=ml(n.textContent.trim()),s=document.createElement("div");s.className=i?"diagram svg":"diagram err",i?s.appendChild(i):s.textContent="SVG error: not a valid <svg> drawing",Oe(n.parentElement,s)}),t.querySelectorAll(":scope > p").forEach(n=>{let i=n.children.length===1?n.children[0]:null;if(!i)return;let s=i.tagName==="A"&&n.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&So(s);l&&Oe(n,gl(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>Po(s)||wl(s))||(n.classList.add("gallery"),i.some(s=>!Po(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!Po(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),Io(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(n.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let c=s.querySelector("figcaption");c&&(c.dataset.count=l+1+" / "+i.length)})):Dn(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!yl(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){Oe(n,i[0]),Io(i[0]);return}let s=document.createElement("div");s.className="gallery grid",Oe(n,s),i.forEach(l=>{s.appendChild(l),Io(l)}),Dn(s,i.length)});let a=[...t.children].filter(n=>!/^H[1-6]$/.test(n.tagName)&&!(n.nodeType===1&&n.tagName==="HR")),o=a.filter(n=>n.matches("figure.media"));o.length===1&&a.length===1&&e.classList.add("card-media");let r=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;r.nextNode();)/^\s*view\s*:\s*full\s*$/i.test(r.currentNode.data)&&e.classList.add("card-full");if(a.length===1&&(a[0].matches("figure.media:not(.yt)")||a[0].matches(".gallery.carousel:not(.diagrams)")))e.classList.add("card-bleed");else if(o.length===1&&a.length>1&&!o[0].matches(".yt")){e.classList.add("card-split",a.indexOf(o[0])===0?"media-first":"media-last");let n=document.createElement("div");n.className="split-text",a.filter(i=>i!==o[0]).forEach(i=>n.appendChild(i)),o[0].after(n),a.indexOf(o[0])!==0&&n.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function si(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function bl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&a.push(t.currentNode);a.forEach(o=>{for(let r=o.nextSibling;r&&!(r.nodeType===8&&/^\s*steps\s*:\s*off\s*$/i.test(r.data));r=r.nextSibling)r.nodeType!==1||r.classList.contains("fragment")||(/^(UL|OL)$/.test(r.tagName)?r.querySelectorAll(":scope > li").forEach(n=>n.classList.add("fragment","fade-up")):r.classList.add("fragment","fade-up"))})}function xl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!So(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(li)),a=[],o=[];[...e.children].forEach(r=>{t(r)?o.push(r):(o.length>1&&a.push(o),o=[])}),o.length>1&&a.push(o),a.forEach(r=>{let n=document.createElement("ul");r[0].before(n),r.forEach(i=>{let s=document.createElement("li");s.className="fragment fade-up",i.classList.remove("fragment","fade-up"),s.appendChild(i),n.appendChild(s)})})}function kl(e){let t=[...e.querySelectorAll(".fragment")].map((r,n)=>({e:r,i:n,k:r.dataset.fragmentIndex}));if(t.every(r=>r.k===void 0))return t.map(r=>[r.e]);let a=0;t.forEach(r=>{r.k=r.k===void 0?a:parseFloat(r.k),a=Math.max(a,r.k)+1}),t.sort((r,n)=>r.k-n.k||r.i-n.i);let o=[];return t.forEach((r,n)=>{n&&t[n-1].k===r.k?o[o.length-1].push(r.e):o.push([r.e])}),o}function ir(e,t,a){!e||!e.frags||(a&&e.el.classList.add("snap"),e.frags.forEach((o,r)=>o.forEach(n=>{let i=n.classList.contains("visible");n.classList.toggle("visible",r<t),n.classList.toggle("current-fragment",r===t-1),n.classList.contains("yt-play")&&i!==r<t&&!a&&si(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Sl(){try{return R.base?new URL(R.base,ze||location.href):ze?new URL(ze):null}catch{return null}}function El(e){let t=Sl(),a=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let r=o.hasAttribute("src")?"src":"href",n=o.getAttribute(r);if(!n||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(n))return;if(!t){r==="src"&&!n.startsWith("/")&&a++;return}let i=t;try{R.site&&(i=new URL(R.site,t))}catch{}o.setAttribute(r,new URL(n,n.startsWith("/")?i:t).href)}),a}function to(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=yt;e.visual=!!a.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=le);let r=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay","img-cover"),r&&(o=le),t.classList.contains("card-bleed")){let l=Math.max(0,...[...a.querySelectorAll("img")].map(d=>d.naturalWidth&&d.naturalHeight?d.naturalWidth/d.naturalHeight:0))||1.7777777777777777,c=le-Aa*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Aa*l)+"px"),o=le;else if(r||Math.abs(l-16/9)<.08)t.classList.add("img-overlay"),o=le,l>=16/9&&l<=16/9*1.15&&t.classList.add("img-cover");else if(l<1.3){let d=Math.min(Math.round(Aa*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(Oo,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(yt,Math.min(le,(Aa-Gs)*l))),t.style.setProperty("--img-h",Math.round(o/l)+"px")}else(a.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||a.querySelectorAll("img").length>=4)&&(o=Oo);let n=a.querySelectorAll("table");if(n.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;n.forEach(c=>{o=Math.max(o,Math.min(Oo,Math.ceil(c.offsetWidth)+l+12))})}let i=a.querySelectorAll("pre");if(i.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;i.forEach(c=>{c.style.width="max-content",o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth)+l+2)),c.style.width=""})}let s=a.querySelectorAll(".fragment.grow");if(s.length){t.style.width=o+"px";let l=t.offsetWidth-a.clientWidth;s.forEach(c=>{o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth*1.3)+l))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(le,t.scrollWidth+24))+"px"),a.scrollWidth>a.clientWidth+2&&(a.style.zoom=(a.clientWidth/a.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||_o,t.classList.remove("measuring")}function Cl(){clearTimeout(Fn),Fn=setTimeout(()=>{u.forEach(to),ra(),xe(!0)},200)}function Al(){let e=eo()==="light"?"light":"dark",t=Me(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Nn.has(a)||(Bl(a,Ll[e],t),Nn.add(a)),a}function Bl(e,t,a){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:[a,...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}},pie:{label:{color:t.text,textBorderWidth:0},labelLine:{lineStyle:{color:t.muted}}},funnel:{label:{color:t.text,textBorderWidth:0}}})}function Pl(){let e=eo()==="light"?"light":"dark",t=Me("--node-bg"),a=Me(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...Il[e],N7:t,B1:Me("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=ol(a,t,n)}),r}function zl(){let e=Me("--text"),t=Me("--text-muted"),a=Me("--accent"),o='"Helvetica,Arial,sans-serif"';return' graph [bgcolor=transparent color="'+t+'" fontcolor="'+e+'" fontname='+o+'] node [color="'+a+'" fontcolor="'+e+'" fontname='+o+'] edge [color="'+t+'" fontcolor="'+t+'" fontname='+o+"] "}function Uo(e){return zo[e]||(zo[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete zo[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Fl(){let e=We,t=[...se.querySelectorAll(".node pre > code.language-dot")];se.querySelectorAll(".node pre > code.language-echarts").forEach(n=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=n.textContent,Oe(n.parentElement,i)});let a=[...se.querySelectorAll(".node .echarts-container[data-chart]")],o=[...se.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!a.length&&!o.length)return;let r=[];if(t.length)try{if(await Uo(Ml),Ro=Ro||await Viz.instance(),e!==We)return;let n=zl();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(Ro.renderSVGElement(Rl(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}Oe(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!Ba){let i=await import(Ol);Ba=new i.D2}if(e!==We)return;let n=Pl();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await Ba.compile(Dl(i.textContent));s.innerHTML=await Ba.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==We)return;Oe(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Uo(Tl),e!==We)return;let n=Al();a.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}echarts.init(i,n,{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!Mt},s))})}catch{r.push("charts")}e===We&&(r.length&&(Jt.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(to),ra(),xe(!0))}function Nl(){let e=[];return g.forEach(t=>{let a=Ct(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function Hl(){let a=0,o=0,r=0;Nl().forEach((n,i)=>{let s=Math.max(...n.ids.map(d=>u.get(d)._h));i&&(a+=r/2+120+s/2);let l=o,c=o;n.ids.forEach((d,M)=>{let m=u.get(d);M&&(l+=90+m._w/2),m.cx=l,m.cy=a,c=l,l+=m._w/2}),o=c,r=s})}function jl(){u.forEach(e=>{e.cx=0,e.cy=0})}function ci(){We++,window.echarts&&se.querySelectorAll(".echarts-container").forEach(a=>{let o=echarts.getInstanceByDom(a);o&&o.dispose()}),se.querySelectorAll("div.node").forEach(a=>a.remove());let e=ni(),t=0;u.forEach(a=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=a.id;let r=a.parent?ao(a.id).slice(0,-1).map(i=>u.get(i).title).join(" / "):"";o.innerHTML=(r?'<div class="crumb">'+A(r)+"</div>":"")+'<div class="body">'+a.html+"</div>"+(a.err?'<div class="err-badge">!</div>':"");let n=o.querySelector(".body");pl(n),bl(n),xl(n),vl(o,n),/^slidetake$/i.test(R.brand||"")&&el(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=El(n),a.frags=kl(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Cl,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));u.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),h.active||j(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{h.active||j(a.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&j(a.id)}),se.appendChild(o),a.el=o,ir(a,a.frags.length)}),t&&!Jt.textContent&&(Jt.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(to),ra(e),Fl()}function ra(e){e===void 0&&(e=ni()),J==="radial"?hl(e):J==="path"?Hl():J==="focus"?jl():dl(),se.classList.toggle("focus",J==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),_l(),Lt(),cr()}function _l(){let e="";if(J==="focus"){Bo.innerHTML="";return}if(J==="path"){for(let t=1;t<g.length;t++){let a=u.get(g[t-1]),o=u.get(g[t]);e+='<path data-from="'+a.id+'" data-to="'+o.id+'" d="M '+a.cx+" "+a.cy+" L "+o.cx+" "+o.cy+'"/>'}Bo.innerHTML=e;return}u.forEach(t=>{if(!t.parent)return;let a=u.get(t.parent);if(J==="radial")e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+a.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=a.cy+a._h/2,r=t.cy-t._h/2,n=o+(r-o)/2;e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+o+" L "+a.cx+" "+n+" L "+t.cx+" "+n+" L "+t.cx+" "+r+'"/>'}}),Bo.innerHTML=e}function ao(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function vt(){let e=H.clientWidth,t=H.clientHeight;se.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+z.zoom+") translate("+-z.x+"px,"+-z.y+"px)",vi()}function sr(){Yt&&(Yt.kill(),Yt=null)}function di(e,t){if(sr(),t||Mt||!window.gsap){Object.assign(z,e),vt();return}let a=H.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:vt,onComplete:()=>{Yt=null}}),{zoom:i,...s}=e,l=o*Math.min(z.zoom,r),c=Math.max(.55,Math.min(1.3,.55+l/a*.3));if(n.to(z,{...s,duration:c,ease:"power2.inOut"},0),l>a*1.2){let d=Math.max(.06,Math.min(z.zoom,r,a*.9/(o+yt)));n.to(z,{zoom:d,duration:c/2,ease:"sine.out"},0).to(z,{zoom:r,duration:c/2,ease:"sine.in"},c/2)}else n.to(z,{zoom:r,duration:c,ease:"power2.inOut"},0);Yt=n}function Wl(){let e=H.getBoundingClientRect(),t=14,a=[];if(!Ae.hidden&&Ae.offsetWidth){let r=Ae.getBoundingClientRect();a.push({x0:r.left-e.left-t,y0:r.top-e.top-t,x1:r.right-e.left+t,y1:r.bottom-e.top+t})}let o=sl();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function Ul(){let e=H.clientWidth,t=H.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return Wl().forEach(o=>{let r=[];a.forEach(n=>{if(o.x1<=n.x0||o.x0>=n.x1||o.y1<=n.y0||o.y0>=n.y1){r.push(n);return}[{...n,x1:Math.min(n.x1,o.x0)},{...n,x0:Math.max(n.x0,o.x1)},{...n,y1:Math.min(n.y1,o.y0)},{...n,y0:Math.max(n.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&r.push(i)})}),r.length&&(a=r)}),a}function qo(e,t,a){let o=H.clientWidth,r=H.clientHeight,n=null;return Ul().forEach(i=>{let s=a*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!n||s>n.zoom)&&(n={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-r/2})}),n}function hi(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function Xe(e,t){let a=u.get(e);if(!a)return;let o=qo(a._w,a._h,$t),r=Ct(e),n=g.filter(l=>Ct(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return qo(c._w,c._h,$t).zoom}).sort((l,c)=>l-c),i=n.length?n[Math.floor((n.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));di(Object.assign(hi(a.cx,a.cy,o,s),{zoom:s}),t)}function na(e){let t=[...u.values()];if(!t.length)return;let a=H.clientWidth,o=H.clientHeight,r=Math.min(...t.map(d=>d.cx-d._w/2)),n=Math.max(...t.map(d=>d.cx+d._w/2)),i=Math.min(...t.map(d=>d.cy-d._h/2)),s=Math.max(...t.map(d=>d.cy+d._h/2)),l=qo(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));di(Object.assign(hi((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function xe(e){f&&u.has(f)?Xe(f,e):na(e)}function Lt(){let e=f?ao(f):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===f),a.classList.toggle("active-path",e.includes(t.id))}),se.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!f&&g.indexOf(t.dataset.to)<=g.indexOf(f):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),Yl(e),ui()}function pi(){return Kr(new URLSearchParams(location.search).get("duration")??R.duration)}function ql(){return K&&pi()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Wa(){let e=ql()&&Re.start>0;if(qe.classList.toggle("timed",e),!e){qe.classList.remove("over");return}let a=(h.active&&h.t0?xt():performance.now()-Re.start)/pi();qe.firstChild.style.width=Math.min(100,a*100)+"%",qe.classList.toggle("over",a>=1)}function Gl(){Re.start=performance.now(),clearInterval(Re.timer),Re.timer=setInterval(Wa,1e3),Wa()}function Vl(){clearInterval(Re.timer),Re.timer=null,Re.start=0,Wa()}function ui(){let e=K&&g.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(qe.classList.toggle("show",e),!e)return;Wa();let t=g.indexOf(f),a=0,o=0;g.forEach((r,n)=>{let i=Tt(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(we,i-1)+1)}),qe.lastChild.style.width=(a?o/a*100:0)+"%"}function Yl(e){Pn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===f?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),Pn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||j(t.dataset.id)}))}function ia(e){let t=u.get(f);t&&(ir(t,oi().frag,e),nr(),(P.hidden||!Pe||!Pe.full||Pe.behind)&&$l(t),lr(t))}function Jl(e){return!g.length||e.id!==g[0]&&e.id!==g[g.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function $l(e){if(e._played||!window.gsap||Mt)return;e._played=!0;let t=Jl(e);if(t&&t.length){e._auto=t;let[a,...o]=t;/^H[1-3]$/.test(a.tagName)&&!a.children.length?(a.classList.add("auto-scramble"),Hn(a)):o.unshift(a),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(a=>{let o;try{o=JSON.parse(a.dataset.gsap)}catch{return}let r={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(a,o.from||{},Object.assign({},o.to,r)):o.from&&gsap.from(a,Object.assign({},o.from,r))}),e.el.querySelectorAll(".title-scramble").forEach(Hn)}function Xt(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 a={};try{a=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},a.from,a.to)).map(r=>Kl.includes(r)?"transform":r));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 Hn(e){let t=e.dataset.text||(e.dataset.text=e.textContent),a=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",r={p:0};e._scramble=gsap.to(r,{p:1,duration:1.4,ease:"none",onUpdate(){let n=Math.floor(r.p*a.length);e.textContent=a.map((i,s)=>s<n||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function lr(e){clearTimeout(bt),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(bt=setTimeout(()=>{f===e.id&&De(1)},e.autoslide))}function fi(e){let t=e&&e!==g[0]?e:"";try{E&&E.kind==="share"?history.replaceState(null,"",location.pathname+location.search+xo(E.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function j(e,t,a){if(!u.has(e))return;if(e!==f){ye=null,Ie=-1,we=a?Tt(u.get(e)).length-1:0;let n=u.get(f);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),gi()}let o=e!==f;if(o&&(mi=f),f=e,clearTimeout(ge),ge=null,o&&J==="focus"&&!t&&!Mt){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ia(o),o&&!Te&&ta("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(na(),ge=setTimeout(()=>{ge=null,f===e&&Xe(e)},1900)):Xe(e,t),Lt(),cr(),fi(e)}function gi(){let e=u.get(f);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>si(t,"pauseVideo")),ir(e,e.frags.length,!0),Xt(e))}function Xl(){if(!f&&Ge&&u.has(Ge)){yi();return}f&&(Ge=f),J==="focus"&&dr("path"),gi(),clearTimeout(bt),f=null,Lt(),cr(),na(),fi(null)}function yi(){if(ge)return clearTimeout(ge),ge=null,Xe(f),!0;if(!f&&Ge&&u.has(Ge)){let e=Ge;return Ge=null,j(e),!0}return!1}function De(e){if(!f){g.length&&j(g[e>0?0:g.length-1]);return}if(ge&&e>0){clearTimeout(ge),ge=null,Xe(f);return}let t=Tt(u.get(f)),a=Math.min(we,t.length-1)+e;if(a>=0&&a<t.length){we=a,ye=null,Ie=-1,ia(),!oe&&!P.hidden&&Pe.used?at():xe(),Lt();return}let o=g.indexOf(f)+e;o>=0&&o<g.length&&j(g[o],!1,e<0)}function Ql(){let e=u.get(f);e&&e.parent&&j(e.parent)}function Zl(){let e=u.get(f);e&&e.children.length?j(e.children[0]):!f&&g.length&&j(g[0])}function cr(){let e=[...u.values()];if(!e.length){jo.innerHTML="",Ee=null;return}qs.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-yt/2,r=Math.max(...e.map(t))+yt/2,n=Math.min(...e.map(a))-_o/2,i=Math.max(...e.map(a))+_o/2,s=16,l=180,c=130,d=Math.min((l-2*s)/Math.max(1,r-o),(c-2*s-6)/Math.max(1,i-n)),M=l/2-(o+r)/2*d,m=c/2+5-(n+i)/2*d,y=f?ao(f):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+M)+'" y1="'+(a(T)*d+m)+'" x2="'+(t(p)*d+M)+'" y2="'+(a(p)*d+m)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===f?"var(--accent)":y.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+M)+'" cy="'+(a(p)*d+m)+'" r="'+(p.id===f?4:3)+'" fill="'+T+'"><title>'+A(p.title)+"</title></circle>"}),b+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',jo.innerHTML=b,Ee={s:d,ox:M,oy:m},vi()}function vi(){let e=document.getElementById("mm-viewport");if(!e||!Ee)return;let t=H.clientWidth/z.zoom,a=H.clientHeight/z.zoom;e.setAttribute("x",(z.x-t/2)*Ee.s+Ee.ox),e.setAttribute("y",(z.y-a/2)*Ee.s+Ee.oy),e.setAttribute("width",Math.max(2,t*Ee.s)),e.setAttribute("height",Math.max(2,a*Ee.s))}function wt(e){ri(ie.value),f&&!u.has(f)&&(f=null),ci(),f?j(f,e):g.length?j(g[0],e):(f=null,na(!0))}function dr(e,t){J=e,U("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(a=>a.classList.toggle("active",a.dataset.mode===e)),u.size&&(!t&&!Mt&&(se.classList.add("morph"),setTimeout(()=>se.classList.remove("morph"),700)),ra(),vt(),f?Xe(f,t):na(t))}function bi(e){return Math.max(.04,Math.min(5,e))}function ec(e){$t=Math.round(Math.max($s,Math.min(Xs,e))*100)/100,U("slidetake:slideSize",$t),f&&Xe(f)}function jn(e){f?ec($t+e*.1):wi(e>0?1.2:1/1.2)}function wi(e,t,a){sr();let o=bi(z.zoom*e);if(t!==void 0){let r=H.getBoundingClientRect(),n=t-r.left-r.width/2,i=a-r.top-r.height/2;z.x+=n/z.zoom-n/o,z.y+=i/z.zoom-i/o}z.zoom=o,vt()}function oo(){_||(Ne.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!Ne.classList.contains("collapsed")))}function ve(e){K=e,document.body.classList.toggle("presenting",e),cs(document.getElementById("btn-present"),e),ds();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!f&&g.length&&j(g[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!oe&&!re&&at(),e?lr(u.get(f)):clearTimeout(bt),e?Gl():Vl(),ui()}function xt(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function sa(e){e.classList.add("open")}function rc(e){if(U("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+ac]=!0;let t=["","; Domain="+location.hostname,"; Domain=."+location.hostname.replace(/^www\./,"")];document.cookie.split(";").map(a=>a.split("=")[0].trim()).filter(a=>a==="_ga"||a.startsWith("_ga_")).forEach(a=>t.forEach(o=>{document.cookie=a+"=; Max-Age=0; Path=/"+o}))}ki()}function ki(){ur.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===oc())))}function la(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function nc(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Ua.value=t||"localhost",qa.value=a||"4455",Ga.value=o.join(":"),!0}try{let t=JSON.parse(W("slidetake:obs")||"null");t&&(Ua.value=t.host||"localhost",qa.value=t.port||"4455",Ga.value=t.password||"",hr.checked=!0)}catch{}return!1}function Ei(){if(hr.checked)U("slidetake:obs",JSON.stringify({host:Ua.value.trim(),port:qa.value.trim(),password:Ga.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function _t(e,t,a){Kt.textContent=e,Kt.className=t||"",Kt.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function sc(e){return location.protocol==="https:"&&!ic(e)}async function fr(){let e=Ua.value.trim()||"localhost",t="ws://"+e+":"+(qa.value.trim()||"4455");if(sc(e)){Le=!1,_t("Blocked here","err",lc);return}_t("Connecting\u2026"),Kt.title="Connecting to "+t;try{await Uo(tc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Le=!1,_t("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ve&&(Ve(),Ve=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&Et("Stopped in OBS")});let o=await ne.connect(t,Ga.value||void 0);Le=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(pr=r.fpsNumerator/r.fpsDenominator),xi=r&&r.outputWidth&&r.outputHeight?Sn(r.outputWidth,r.outputHeight):""}catch{}_t("Connected","ok",""),Kt.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),Ei(),Y.classList.contains("open")&&et()&&(B("Connected to OBS. Press \u25CF Record."),je())}catch(a){Le=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";_t("Could not connect","err",o+" Is OBS running with its WebSocket server on, and are the port and password right?")}}function cc(){let e=document.getElementById("rec-screen"),t=screen.width,a=screen.height;if(Math.abs(t/a-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+a+"), 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]],[r,n]=o.reduce((s,l)=>Math.abs(l[1]-t/a)<Math.abs(s[1]-t/a)?l:s),i=Math.abs(n-t/a)<.005?r:"about "+r;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+a+"), 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 ke(){let e=navigator.mediaDevices;if(!window.isSecureContext||!e||!e.getDisplayMedia)return{why:"This page can\u2019t capture itself here. Open Slidetake in Chrome or Edge on a computer."};if(!window.RestrictionTarget&&!window.CropTarget)return{why:"Recording in the browser needs Chrome or Edge (or another Chromium browser) on a computer."};let t=window.MediaRecorder?wn(r=>MediaRecorder.isTypeSupported(r)):"";if(!t||!navigator.storage||!navigator.storage.getDirectory)return{why:"This browser can\u2019t record video here. Use a recent Chrome or Edge."};let{quality:a,device:o}=bn(screen.width,screen.height,devicePixelRatio||1);return a?{ok:!0,type:t,quality:a}:{why:"This screen gives a "+o[0]+"\xD7"+o[1]+" frame, less than 720p. Use pro mode (OBS), or a larger screen."}}async function ro(){Yo++,de&&(cancelAnimationFrame(de.raf),de.stream.getTracks().forEach(e=>e.stop()),de.ctx.close().catch(()=>{}),de=null,Vo.value=0,ut.getContext("2d").clearRect(0,0,ut.width,ut.height),Mi())}function Mi(){Ko++,za&&(za.getTracks().forEach(e=>e.stop()),za=null),Ci.srcObject=null}async function Ti(){Mi();let e=Ko,t=pt.value;if(Ia.hidden=t!=="none"&&!!t,Ia.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==Ko){a.getTracks().forEach(o=>o.stop());return}za=a,Ci.srcObject=a}catch{Ia.hidden=!1,Ia.textContent="The camera isn\u2019t available"}}async function Va(){await ro();let e=Yo;try{let t=kt.value,a=await navigator.mediaDevices.getUserMedia({audio:_i(t)});if(e!==Yo){a.getTracks().forEach(m=>m.stop());return}let o=new AudioContext,r=o.createAnalyser();r.fftSize=512,o.createMediaStreamSource(a).connect(r);let n=new Float32Array(r.fftSize),i=de={stream:a,ctx:o,raf:0},s=ut.getContext("2d"),l=ut.width,c=ut.height,d=Me("--accent"),M=()=>{if(de!==i)return;r.getFloatTimeDomainData(n);let m=0;for(let y of n)m=Math.max(m,Math.abs(y));Vo.value=Math.max(m,Vo.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let y=0;y<n.length;y++){let b=y/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[y]*3))*(c/2-4);y?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(M)};M()}catch(t){ht.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function Ya(e=!0){try{e&&!de&&await Va();let t=await navigator.mediaDevices.enumerateDevices(),a=(n,i)=>{let s=t.filter(b=>b.kind===n),l=s.find(b=>b.deviceId==="default"),c=l?l.label.replace(/^Default - /,""):"",d=s.filter(b=>b.deviceId!=="default"&&b.deviceId!=="communications"),M=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),m=d.map((b,p)=>kn(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));m.forEach((b,p)=>{let T=m.slice(0,p).filter(L=>L===b).length;T&&(m[p]=b+" "+(T+1))});let y=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(M)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===y?" selected":"")+">"+A(m[p]+(M(b)?" (system default)":""))+"</option>").join("")},o=mr();pt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=W("slidetake:mic")||"";kt.innerHTML=a("audioinput",r),r&&kt.value===r&&de&&de.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Va()}catch{}}function mr(){let e=W(Li());return e||(hc()?W("slidetake:cam")||"default":"none")}function pc(e){U(Li(),e),e!=="none"&&e!=="default"&&U("slidetake:cam",e)}function uc(){h.camWas=!re;let e=mr()!=="none";e!==!re&&pa(e,!0)}function Ai(){h.camWas!=null&&(h.camWas!==!re&&pa(h.camWas,!0),h.camWas=null)}async function Bi(){let e=ke();if(!e.ok)return ht.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;Pa&&(ht.innerHTML='<span class="warn">'+A(Pa)+"</span>",Pa="");let t=lt.indexOf(e.quality),a=W("slidetake:quality");St.innerHTML=lt.slice(t).map(r=>"<option"+(r.name===a?" selected":"")+">"+r.name+"</option>").join("");let o="";try{let{quota:r,usage:n}=await navigator.storage.estimate(),i=lt.find(s=>s.name===St.value)||e.quality;o=" Room for about "+Math.floor((r-n)/xn(i))+" minutes of takes."}catch{}return ht.querySelector(".warn")||(ht.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function fc(e){pe=e,U("slidetake:rec-mode",e),ea({setup:Bt()})}function ea(e={}){Ze&&(ke().ok&&(pe||"browser")==="browser"?kr(e):mc(e))}function mc(e={}){let t=no().find(a=>a.key===He()&&a.withObs&&!a.inBrowser);Gi(t||{key:He(),deckTitle:R.title||(g[0]?u.get(g[0]).title:"Deck"),date:new Date().toISOString(),withObs:!0,outputPath:null,reason:"",total:0,totalObs:null,fps:pr,events:[],picks:{},empty:!0},e)}async function gr(){if(!(!Ze||h.active||!g.length)){if(!gc()){Xo({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(ke().ok&&(pe||"browser")==="browser"){let t=Ta(tt(),lo()).filter(r=>!r.pick).map(r=>r.id),a=g.indexOf(f),o=t.length?t:a>0?g.slice(a):g;Ka("browser",o.length===g.length?null:o);return}if(!Le&&W("slidetake:obs")&&await fr(),Le){Ka("obs");return}Xo({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function yr(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function vr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}async function Ii(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(ja)):await e.cropTo(await CropTarget.fromElement(ja))}async function yc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Ii(e.track)}catch{}await e.track.applyConstraints(Oi(e.quality)).catch(()=>{}),await Zt()}async function vc(){let e=ke();if(!e.ok)throw new Error(e.why);let t=lt.find(s=>s.name===St.value)||e.quality;document.body.classList.add("rec-frame");let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:Ht},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),o=a.getVideoTracks()[0],r=()=>a.getTracks().forEach(s=>s.stop());if(!o.restrictTo&&!o.cropTo)throw r(),new Error("Share \u201Cthis tab\u201D to record the slides.");try{await Ii(o)}catch(s){throw r(),new Error("Chrome could not record just the slides ("+(s.message||s.name)+").")}await o.applyConstraints(Oi(t)).catch(()=>{});let n;try{let s=W("slidetake:mic");n=await navigator.mediaDevices.getUserMedia({audio:_i(s)})}catch(s){throw r(),new Error("The microphone isn\u2019t available ("+(s.message||s.name)+").")}let i=new Date().toISOString().replace(/[:.]/g,"-");h.browser={id:i,display:a,mic:n,track:o,quality:t,type:e.type,stream:new MediaStream([o,...n.getAudioTracks()]),dir:await yr(i,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&Et("Sharing stopped")})}function Pi(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),document.body.classList.remove("rec-frame"))}function bc(e){let t=h.browser,a="take-"+t.clips.length+"."+Co(t.type),o={name:a,rec:null,done:null};t.clips.push(o),e.clip=t.id+"/"+a,t.chain=t.chain.then(async()=>{let r=await(await t.dir.getFileHandle(a,{create:!0})).createWritable(),n=new MediaRecorder(t.stream,{mimeType:t.type,videoBitsPerSecond:t.quality.bitrate,audioBitsPerSecond:Sa}),i=Promise.resolve();n.ondataavailable=l=>{l.data.size&&(i=i.then(()=>r.write(l.data)).catch(c=>{t.error=c}))},o.done=new Promise(l=>{n.onstop=async()=>{await i,await r.close().catch(()=>{}),l()}}),await new Promise(l=>{n.onstart=l,n.start(1e3)}),e.t=Math.round(xt()),e.cutAt!=null&&(e.lead=Math.max(0,Math.round(e.t-e.cutAt)));let s=t.cur;t.cur=o,o.rec=n,s&&s.rec.state!=="inactive"&&s.rec.stop()}).catch(r=>{t.error=r})}async function Ka(e,t){if(h.active||!g.length)return;let a=e==="obs";if(ro(),pe||(pe=a?"obs":"browser",U("slidetake:rec-mode",pe)),e==="browser"){K||ve(!0);try{await vc()}catch(l){document.body.classList.remove("rec-frame"),K&&ve(!1),Pa=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,kr({setup:!0});return}}la();let o=t&&t.length?t.filter(l=>g.includes(l)):null,r=o?o[0]:g[0],n=g[g.indexOf(r)-1]||null;Object.assign(h,{active:!0,withObs:a,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null,only:o?new Set(o):null}),e!=="browser"&&(h.browser=null),document.body.classList.add("recording"),Er(),K||ve(!0),uc(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Te=!0,j(n,!0,!0),Te=!1,P.getAnimations().forEach(l=>l.finish()),await Zt(),document.body.classList.remove("no-anim")):(f===r&&(we=0,ye=null,Ie=-1),j(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=Ut.querySelector(".hint");for(let l=3;l>0;l--)if(i.textContent=(document.fullscreenElement?"":"Press F for fullscreen \xB7 ")+"recording starts after the countdown \xB7 Esc to cancel",Ut.querySelector(".num").textContent=l,Ut.classList.add("show"),await Qt(1e3),!h.active)return;if(Ut.classList.remove("show"),await Zt(),a){let l=new Promise(c=>{Ve=c,setTimeout(()=>{Ve&&(Ve(),Ve=null)},2500)});try{await ne.call("StartRecord")}catch(c){br("OBS could not start recording: "+(c&&c.message||c));return}if(await l,!h.active)return}h.browser&&await yc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){ta("slide",r),h.browser&&await h.browser.chain,Xt(s),Te=!0,j(r),Te=!1;return}Xt(s),ia(!0),ta("slide",f)}function br(e){if(h.active=!1,h.counting=!1,h.browser){let t=h.browser;t.chain.then(()=>{t.cur&&t.cur.rec.state!=="inactive"&&t.cur.rec.stop()}).then(()=>vr(t.id)),Pi(),h.browser=null}Ut.classList.remove("show"),document.body.classList.remove("recording"),K&&ve(!1),Ai(),mt(e)}function ta(e,t,a){if(!h.active||!h.t0||h.finishing)return;let o=u.get(t),r={id:t,title:o?o.title:t,retake:e==="retake",t:Math.round(xt()),obsT:null};a==null&&h.browser&&(a=r.t),a!=null&&(r.cutAt=a,r.lead=Math.max(0,Math.round(r.t-a))),h.events.push(r),h.browser&&bc(r),h.withObs&&Le&&(ne.call("GetRecordStatus").then(n=>{n&&typeof n.outputDuration=="number"&&(r.obsT=n.outputDuration)}).catch(()=>{}),o&&ne.call("CreateRecordChapter",{chapterName:(r.retake?"RETAKE \xB7 ":"")+o.title}).catch(()=>{}))}function wc(e){let t=e.key;if((Wn.includes(t)||Un.includes(t)||qn.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?br("Take cancelled"):Et("Stopped early");return}if((t==="f"||t==="F")&&!document.fullscreenElement&&document.documentElement.requestFullscreen){e.preventDefault(),document.documentElement.requestFullscreen().catch(()=>{});return}if(!(h.counting||h.finishing||Ke)){if(qn.includes(t)){Ec();return}h.paused||(Wn.includes(t)?xc():Un.includes(t)&&kc())}}function xc(){let e=Tt(u.get(f)),t=Math.min(we,e.length-1)>=e.length-1,a=g.indexOf(f);if(!t){De(1);return}if(!h.only){a===g.length-1?Et():De(1);return}let o=g.slice(a+1).find(r=>h.only.has(r));o?g[a+1]===o?De(1):zi(g[g.indexOf(o)-1],o,"slide"):Et()}async function kc(){let e=u.get(f);if(!e||Ke)return;let t=f,a=mi;if(!a||a===t||!u.has(a)){Sc(e);return}zi(a,t,"retake")}async function zi(e,t,a){let o=u.get(t);if(!o||Ke)return;Ke=!0;let r=xt();document.body.classList.add("no-anim");let n=u.get(e);Te=!0,n._played=!0,j(e,!0,!0),P.getAnimations().forEach(i=>i.finish()),Te=!1,await Zt(),document.body.classList.remove("no-anim"),ta(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await Ri(),Xt(o),Te=!0,j(t),Te=!1,!oe&&!P.hidden&&Pe.used&&at(),Ke=!1}async function Ri(){let e=h.events[h.events.length-1];e&&(e.skip=Gn/2),await Qt(Gn)}async function Sc(e){Ke=!0,we=0,ye=null,Ie=-1,Xt(e),ia(!0),!oe&&!P.hidden&&Pe.used?at():xe(),Lt(),ta("retake",f),h.withObs&&await Ri(),Ke=!1}async function Ec(){if(h.t0)if(h.paused){if(Go.classList.remove("show"),await Zt(),h.withObs&&await ne.call("ResumeRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="paused"&&e.cur.rec.resume()})}h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,lr(u.get(f))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(bt),h.withObs&&await ne.call("PauseRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="recording"&&e.cur.rec.pause()})}Go.classList.add("show")}}async function Et(e){if(!h.active||h.finishing)return;if(h.counting){br("Take cancelled");return}h.finishing=!0,clearTimeout(bt),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Go.classList.remove("show"));let t=Math.round(xt()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await Qt(1200);try{let n=await ne.call("StopRecord");h.outputPath=n&&n.outputPath}catch(n){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(n&&n.message||n)+")"}}let o=h.browser;o&&(await Qt(600),await o.chain,t=Math.round(xt()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),Pi(),h.browser=null,o.error&&(e=(e?e+". ":"")+"Some of the take could not be saved ("+(o.error.message||o.error.name)+")")),h.active=!1,h.finishing=!1,document.body.classList.remove("recording"),K&&ve(!1),Ai();let r={key:He(),deckTitle:R.title||u.get(g[0]).title,date:new Date().toISOString(),withObs:h.withObs,outputPath:h.outputPath,reason:e||"",total:t,totalObs:a,fps:o?Ht:pr,...o?{inBrowser:!0,takesId:o.id,quality:o.quality.name,type:o.type}:{},events:h.events.map(n=>({id:n.id,title:n.title,retake:n.retake,t:n.t,obsT:n.obsT,...n.lead?{lead:n.lead}:{},...n.skip?{skip:n.skip}:{},...n.clip?{clip:n.clip}:{}})),picks:{}};if(r.inBrowser){Ic(r);return}wr(r),Gi(r,{note:(e?e+". ":"")+me(r).size+" slides recorded with OBS."})}function He(){return nt(R.title||(g[0]?u.get(g[0]).title:"deck"))}function no(){try{return JSON.parse(W("slidetake:sessions")||"[]")}catch{return[]}}function wr(e){let t=no().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&vr(a.takesId)}),U("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function Ct(e){let t=u.has(e)?ao(e):[e];return t[Math.min(1,t.length-1)]}function Di(e,t){let a=Ct(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function B(e,{warn:t=!1,html:a="",title:o=""}={}){Wt.classList.toggle("warn",t),a?Wt.innerHTML=a:Wt.textContent=e,Wt.title=o||Wt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>es(!0))}function Gi(e,t={}){la(),N=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":me(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+it(e.totalObs??e.total)+". ";Y.classList.remove("in-browser","board"),Y.classList.add("obs");let r=document.getElementById("rv-rec");r.title="Records the deck with OBS: a new video in place of this one",r.disabled=!1,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-clean").disabled=!!e.cleaned,document.getElementById("rv-file").textContent=e.outputPath?" ("+st(e.outputPath)+")":"";let n=xa(e);Ja.value=[...Ja.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,k.src&&(e.inBrowser||Fe!==st(e.outputPath)&&e.outputPath)&&(k.removeAttribute("src"),k.load(),Fe=""),document.getElementById("rv-novideo").hidden=!!k.src||!!e.empty,Z=null,F=null,At(),io(),sa(Y),t.setup?co(t):(ho(),Ya(!1).then(je)),B(t.note||(e.empty?Le?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(k.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||Fc(e)}function io(){if(N&&N.board){Qe();return}let e=N,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...me(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=Ct(o.id),i=n!==a;a=n;let s=o.takes.map(l=>'<button class="rv-chip'+(r===l.no?" on":"")+'" data-id="'+A(o.id)+'" data-take="'+l.no+'">Take '+l.no+" \xB7 "+it(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+fa(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,wr(e),io();let r=me(e).get(o.dataset.id),n=r&&r.takes[+o.dataset.take-1];if(!n)return;let i=r.title+(r.takes.length>1?" \xB7 take "+n.no:"");if(e.inBrowser){let s=e.events.filter(l=>l.id===o.dataset.id)[n.no-1];s&&s.clip&&so([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else Xa([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,Yi(e),Ji(e)}function Yi(e){let t=Cc(e),a=document.getElementById("rv-chapters");Vi=t.lines.join(`
|
|
1315
|
-
`),a.disabled=t.lines.length<3,a.title=t.lines.length<3?"YouTube needs at least three chapters of 10 seconds or more":"Copies the "+t.lines.length+" chapters, to paste into the YouTube description"}function Ki(e,t){let a=e.dataset.label||(e.dataset.label=e.textContent);(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject()).catch(()=>{}),e.textContent="\u2713 Copied",clearTimeout(+e.dataset.timer),e.dataset.timer=String(setTimeout(()=>{e.textContent=a},1500))}async function Ji(e){let t=document.getElementById("rv-final"),a=++Fo,o=Nt(e).reduce((n,i)=>n+i.end-i.start,0),r=n=>(n?"about "+(n>1e9?(n/1e9).toFixed(1)+" GB":Math.max(1,Math.round(n/1e6))+" MB")+" \xB7 ":"Final cut ")+it(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of jt(e))Da.has(i.clip)||Da.set(i.clip,(await ca(i.clip)).size),n+=Da.get(i.clip);a===Fo&&(t.textContent=r(n))}catch{a===Fo&&(t.textContent=r(null))}}function Xa(e){if(!k.src){$a=e,B(Zo?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}$a=null,Z={ranges:e,i:0},B("\u25B6 "+e[0].title);let t=()=>{k.currentTime=e[0].start/1e3,k.play().catch(a=>{a&&a.name!=="AbortError"&&B("Could not play: "+a.message,{warn:!0})})};k.readyState>=1?t():k.addEventListener("loadedmetadata",t,{once:!0})}function At(){ft=null}function xr(){let e=F&&!F.single&&!k.paused;$i.innerHTML=e?'\u275A\u275A <span><u class="key">P</u>ause</span>':'\u25B6 <span><u class="key">P</u>review</span>',document.querySelectorAll("#rv-list .rv-row.playing").forEach(o=>o.classList.remove("playing"));let t=F&&F.parts[F.i],a=t&&t.id&&document.querySelector('#rv-list .rv-row[data-id="'+CSS.escape(t.id)+'"]');a&&(a.classList.add("playing"),a.scrollIntoView({block:"nearest"}))}function Tc(e){let t=N?jt(N):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;ft=o?o.id:null,B(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function Xi(e){return Array.from({length:e.numberOfChannels},(t,a)=>{let o=new Float32Array(e.numberOfFrames);return e.copyTo(o,{planeIndex:a,format:"f32-planar"}),o})}async function ca(e){let[t,a]=e.split("/");return(await(await yr(t)).getFileHandle(a)).getFile()}async function so(e,t=0,a=!1){if(!(!N||N.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ca(e[t].clip);if(!Y.classList.contains("open"))return;k.src&&URL.revokeObjectURL(k.src),k.src=URL.createObjectURL(o),B("\u25B6 "+e[t].title),await k.play()}catch(o){if(o&&o.name==="AbortError")return;F=null,B(o&&o.name==="NotFoundError"?"This take is no longer in the browser.":"Could not play this take: "+(o&&o.message||o),{warn:!0})}}}function Qi(){let e=F;if(e.i+1<e.parts.length){so(e.parts,e.i+1,e.single);return}F=null,k.pause(),e.single?Tc(e.parts[0]):B(""),xr()}async function Lc(e){if(!e.where)return!0;try{let t=await Sr("video-folder");return!t||t.name!==e.where||await t.queryPermission({mode:"readwrite"})!=="granted"||await t.getFileHandle(e.name),!0}catch{return!1}}async function es(e){let t=N;if(!t||!t.inBrowser||t.cleaned)return;let a=jt(t);if(!a.length){B("No slide has a take yet: nothing to save.",{warn:!0});return}let o=JSON.stringify([a.map(d=>[d.clip,Math.round(d.keep*1e3)]),Je(),aa(),t.type]),r=t.board&&O.lastDownload;if(!e&&r&&r.sig===o&&await Lc(r)){B("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(No(r))+".",title:"Already saved in "+No(r)+". A new video is made only when a take or the sound settings change."});return}let n=Co(t.type||"")==="mp4",i=He()+" "+Bc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await ts(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=Qa;c.disabled=!0,Ue("Preparing\u2026");try{let d=await import(dc),M=s?new d.StreamTarget(s):new d.BufferTarget,m=new d.Output({format:n?new d.Mp4OutputFormat({fastStart:s?!1:"in-memory"}):new d.WebMOutputFormat,target:M}),y=1,b="",p=Je()&&aa();if(Je()){let D=await Vn(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let q=To(D,{limit:p});if(p&&Math.abs(q)>=.05){let Q=await Vn(d,a,Ma(q),!0,"Checking");Q&&isFinite(Q.integrated)&&(q=Math.min(q+(-14-Q.integrated),Mo))}y=Ma(q);let ce=p?-14:D.integrated+q,ae=!p&&To(D,{limit:!0})-q>.5;b=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(q)<.05?" LUFS, left as is":" \u2192 "+ce.toFixed(1)+" LUFS")+(ae?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=y!==1||p;await Ac(d,a);let L=null,w=null,x=0,v=-1,S=-1,C=null,$=[],te=async()=>{for(;$.length&&C.ready()>=$[0].n;){let D=$.shift(),q=C.take(D.n),ce=new Float32Array(D.n*D.ch);q.forEach((ae,Q)=>ce.set(ae,Q*D.n)),await w.add(new d.AudioSample({data:ce,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,q]of a.entries()){Ue("Joining "+(D+1)+"/"+a.length);let ce=new d.Input({source:new d.BlobSource(await ca(q.clip)),formats:d.ALL_FORMATS}),ae=await ce.getPrimaryVideoTrack(),Q=await ce.getPrimaryAudioTrack();if(!ae)throw new Error(q.title+" has no video");L||(L=new d.EncodedVideoPacketSource(await ae.getCodec()),m.addVideoTrack(L,{frameRate:Ht}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Sa}):new d.EncodedAudioPacketSource(await Q.getCodec()),m.addAudioTrack(w)),await m.start());let It={decoderConfig:await ae.getDecoderConfig()},ot=0,Lr=!0;for await(let G of new d.EncodedPacketSink(ae).packets())G.timestamp>=q.keep||(v=Ea(v,x+G.timestamp),await L.add(G.clone({timestamp:v}),Lr&&D===0?It:void 0),Lr=!1,ot=Math.max(ot,G.timestamp+G.duration));if(Q&&w&&T)for await(let G of new d.AudioSampleSink(Q).samples(0,ot)){if(G.timestamp+G.duration>ot+1e-4){G.close();continue}S=Ea(S,x+G.timestamp);let ue=Xi(G);if(ue.forEach(fe=>{for(let rt=0;rt<fe.length;rt++)fe[rt]*=y}),p)C=C||Lo(G.sampleRate,ue.length),C.push(ue),$.push({t:S,n:G.numberOfFrames,rate:G.sampleRate,ch:ue.length}),G.close(),await te();else{let fe=G.numberOfFrames,rt=new Float32Array(fe*ue.length);ue.forEach((gs,ys)=>rt.set(gs,ys*fe)),await w.add(new d.AudioSample({data:rt,format:"f32-planar",numberOfChannels:ue.length,sampleRate:G.sampleRate,timestamp:S})),G.close()}}else if(Q&&w){let G={decoderConfig:await Q.getDecoderConfig()},ue=!0;for await(let fe of new d.EncodedPacketSink(Q).packets())fe.timestamp+fe.duration>ot+1e-4||(S=Ea(S,x+fe.timestamp),await w.add(fe.clone({timestamp:S}),ue&&D===0?G:void 0),ue=!1)}x+=ot}if(C&&(C.end(),await te(),C.events&&(b+=", "+C.events+" peak"+(C.events===1?"":"s")+" limited")),Ue("Finishing\u2026"),await m.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([M.buffer],{type:n?"video/mp4":"video/webm"})),D.download=i,D.click(),setTimeout(()=>URL.revokeObjectURL(D.href),1e4)}let X={sig:o,name:i,where:l};t.board&&(O.lastDownload=X,da()),B("Saved in "+No(X)+" ("+it(x*1e3)+b+")."),Ue("\u2713 Saved"),Zi=setTimeout(()=>Ue(),2500)}catch(d){Ue(),B("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function Vn(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){Ue(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ca(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let M=Xi(d);n=n||Cn(d.sampleRate,M.length),a!==1&&o?(M.forEach(m=>{for(let y=0;y<m.length;y++)m[y]*=a}),i=i||Lo(d.sampleRate,M.length),i.push(M),i.ready()&&n.add(i.take(i.ready()))):n.add(M),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function Ac(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ca(i.clip)),formats:e.ALL_FORMATS}).getPrimaryVideoTrack(),l=s&&await s.getDecoderConfig();a.push(l?l.codec+" "+l.codedWidth+"\xD7"+l.codedHeight+" "+(l.description?[...new Uint8Array(l.description)].join("."):""):"none")}let o=new Map;a.forEach(i=>o.set(i,(o.get(i)||0)+1));let r=[...o.entries()].sort((i,s)=>s[1]-i[1])[0][0],n=t.filter((i,s)=>a[s]!==r);if(n.length)throw new Error(n.map(i=>i.title).join(", ")+(n.length===1?" was":" were")+" recorded at a different size ("+a[t.indexOf(n[0])].split(" ")[1]+", not "+r.split(" ")[1]+"). Tick "+(n.length===1?"it":"them")+" and record again")}async function ts(e){if(!window.showDirectoryPicker)return null;let t=e?null:await Sr("video-folder");if(t){let a=await t.queryPermission({mode:"readwrite"});if(a==="prompt"&&(a=await t.requestPermission({mode:"readwrite"})),a==="granted")return t}return t=await window.showDirectoryPicker({id:"slidetake-videos",mode:"readwrite",startIn:"videos"}),ns("video-folder",t),t}function tt(){let e=as();if(O&&$o===e)return O;$o=e;try{O=JSON.parse(W(e)||"null")}catch{O=null}return(!O||!Array.isArray(O.takes))&&(O={takes:[],picks:{},type:"",quality:""}),O}function Ic(e){tt();let t=An(e,e.takesId,lo());t.forEach(a=>{delete O.picks[a.id]}),O.takes.push(...t),Object.assign(O,{type:e.type,quality:e.quality}),da(),Be.clear(),kr({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function os(){let e=Ta(tt(),lo()),t=Object.assign(Bn(e),{board:!0,inBrowser:!0,withObs:!1,type:O.type||"video/mp4",quality:O.quality||"",deckTitle:R.title||(g[0]?u.get(g[0]).title:"Deck"),date:new Date().toISOString()});return{rows:e,sess:t}}function co(e={}){Y.classList.add("setup-view"),Kn.textContent=e.note||"",Kn.hidden=!e.note,$e.textContent="\u2190 Back",$e.title="Back to Studio",$e.setAttribute("aria-expanded","true"),Pc()}function ho(){let e=Bt();e&&Y.classList.remove("setup-view"),$e.textContent="\u2699 Setup",$e.title="Settings: camera, microphone, video, OBS and files",$e.setAttribute("aria-expanded","false"),e&&(ro(),je())}function Xo(e={}){Y.classList.contains("open")?co(e):ea({...e,setup:!0})}function Pc(){let e=()=>{je(),Bt()&&Ti()};if(et()){cc(),Ya(!1).then(e);return}ht.innerHTML="",Bi().then(t=>{t.ok?Ya().then(e):e()})}function je(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(pt)||(mr()==="none"?"No camera":"Camera"),a=et(),o=a?xi:ke().ok?St.value:"",r=a?[t]:[t,e(kt)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",dt.classList.toggle("on",a),dt.setAttribute("aria-pressed",String(a)),dt.disabled=!ke().ok,dt.title=dt.disabled?Fa+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+Fa:"Easy mode: recording in "+Fa+". Click for pro mode, with OBS"}function kr(e={}){Ze&&(la(),tt(),Y.classList.remove("obs"),Y.classList.add("in-browser","board"),document.getElementById("rv-rec").title="Records the whole deck, or only the ticked slides (shift-click ticks a range)",document.getElementById("rv-novideo").hidden=!0,k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),Z=null,F=null,At(),Ra=-1,Qe(),sa(Y),e.setup||!ke().ok?co(e):(ho(),Bi().then(()=>Ya(!1)).then(je)),B(e.note||qi()||(O.takes.length?zc()+". Click a take to preview it.":g.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function zc(){let e=Ta(tt(),lo()),t=e.filter(o=>o.pick).length,a=e.filter(o=>o.takes.length&&!o.pick).length;return t+" of "+e.length+" slides ready"+(a?", "+a+" to record again":"")}function Qe(){let{rows:e,sess:t}=os();N=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=Ct(i.id),l=s!==o;o=s;let c=A(i.id),d={slide:"Recorded before this slide changed",before:"Starts with the entry from the slide before, which has changed or is gone: record this slide again"},M=i.takes.length?i.takes.map(m=>'<button class="rv-chip'+(i.pick===m.uid?" on":"")+(m.outdated?' outdated" title="'+d[m.outdated]:"")+'" data-id="'+c+'" data-uid="'+A(m.uid)+'">Take '+m.no+" \xB7 "+it(m.ms)+"</button>").join("")+(i.pick?"":'<span class="rv-none">'+(i.takes.some(m=>m.outdated==="before")&&!i.takes.some(m=>m.outdated==="slide")?"The slide before changed: record again":"Changed since: record again")+"</span>"):'<span class="rv-none">No take yet</span>';return'<div class="rv-row with-sel'+(l?" sec":"")+(Be.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(Be.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+M+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{O.picks[i.dataset.id]=i.dataset.uid,da(),Qe();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&so([{id:s.id,clip:l.clip,keep:l.ms/1e3,title:s.title+" \xB7 take "+l.no}],0,!0)}),a.querySelectorAll(".rv-sel").forEach(i=>i.addEventListener("click",s=>{(s.shiftKey?On(g,Yn,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?Be.add(c):Be.delete(c)}),At(),Yn=i.dataset.id,Qe()}));let r=La(g,Be),n=ke().ok;document.getElementById("rv-rec").disabled=!n,Ra>=0&&r.length!==Ra&&B(qi()||"Record takes the whole deck."),Ra=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,Yi(t),Ji(t)}async function Rc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await yr(o)).removeEntry(r)}catch{}let t=new Set(e.map(a=>a.uid));O.takes=O.takes.filter(a=>!t.has(a.uid)),Object.keys(O.picks).forEach(a=>{t.has(O.picks[a])&&delete O.picks[a]}),da(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,At(),Qe()}function rs(e){return new Promise((t,a)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>a(o.error)})}async function Sr(e){let t=async a=>{let o=await rs(a);return await new Promise(r=>{let n=o.transaction("kv").objectStore("kv").get(e);n.onsuccess=()=>r(n.result),n.onerror=()=>r(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function ns(e,t){try{(await rs()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function po(e){Zo=!0;try{return await Dc(e)}finally{Zo=!1}}async function Dc(e){let t=await e.getFile();for(let a=0;a<10;a++){await new Promise(r=>setTimeout(r,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function ha(e,t,a){k.src&&URL.revokeObjectURL(k.src),qt=t||null,a||(Qo=0),k.src=URL.createObjectURL(e),Fe=e.name,document.getElementById("rv-novideo").hidden=!0,B("Loaded "+e.name+". Click a take to preview it."),$a?Xa($a):a&&Z&&Xa(Z.ranges.slice(Z.i))}async function Fc(e){let t=st(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(Fe===t&&k.src))try{let a=await Sr("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);B("Opening "+t+"\u2026"),ha(await po(o),o)}catch{}}function mt(e,t){if(!h.active){if(clearTimeout(Na),!P.hidden&&!P.classList.contains("live")){Vt.classList.remove("show"),ss.textContent=e,P.classList.add("msg"),t||(Na=setTimeout(ls,9e3));return}Vt.textContent=e,Vt.classList.add("show"),t||(Na=setTimeout(()=>Vt.classList.remove("show"),9e3))}}function ls(){ss.textContent="PIP camera",P.classList.remove("msg")}function Er(){clearTimeout(Na),Vt.classList.remove("show"),ls()}function Ho(){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 Cr(){oe&&oe.getTracks().forEach(t=>t.stop()),oe=null;let e=P.querySelector("video");e&&e.remove()}async function at(){if(!(oe||re)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){mt("Camera not available on this page."+Ho(),!0);return}if(Ce.disabled)return;Ce.disabled=!0,mt("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{let t=W("slidetake:cam");oe=await navigator.mediaDevices.getUserMedia({video:{...t?{deviceId:{ideal:t}}:{},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),Er()}catch(t){let a=t&&t.name;mt(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Ho():a==="NotFoundError"||a==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":a==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(a?" ("+a+")":"")+"."+Ho(),!0);return}finally{Ce.disabled=!1,Mr()}oe.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Cr(),_a(),xe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=oe,P.appendChild(e)}_a(),xe()}}function cs(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Mr(){Ce.querySelector("svg")||(Ce.innerHTML=Nc+'<span class="lbl"> <u class="key">C</u>amera</span>'),Ce.classList.toggle("on",!re),Ce.setAttribute("aria-pressed",String(!re)),Ce.title=re?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function pa(e,t){e&&!Ze||(re=!e,re&&(Cr(),Er()),ye=null,Ie=-1,we=Math.min(we,Math.max(0,Tt(u.get(f)).length-1)),Mr(),_a(),ia(),Lt(),xe(),!K&&!t&&mt(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&at())}function ds(){document.body.classList.remove("idle"),clearTimeout(Jn),K&&(Jn=setTimeout(()=>document.body.classList.add("idle"),2e3))}function oa(e,t){gt.textContent=e,gt.classList.add("show"),clearTimeout(Xn),Xn=setTimeout(()=>gt.classList.remove("show"),t||2500)}function er(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(rn(e),location.origin);return new URLSearchParams(location.search).forEach((n,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!a||r.searchParams.set(i,n)}),o&&(r.hash=o),r.href.replace(r.pathname,r.pathname.replace(/%40/g,"@"))}async function jc(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(E.kind==="source")return{link:er(E.source,t),inside:!1};if(E.kind==="copy"&&ba(I)&&["url","gist","builtin"].includes(I.origin.kind))return{link:er(I.origin,t),inside:!1};let o=E.kind==="share"?E.data:await sn(ie.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+xo(o,e),inside:!0}}function _c(){let e=W("slidetake:draft");if(!e||e===uo)return null;let t=ya(e,{kind:"file",name:"your earlier draft"},{exported:!0});U("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function ua(){U("slidetake:copy",JSON.stringify(I))}function Ot(){if(_)return;let e;if(Tr())e='<span class="mine">'+A(he.file)+'</span> <span class="ro">\xB7 on this computer, saved as you type</span>';else if(E.kind==="copy")e='<span class="mine">Your copy of '+A(Se(I.origin))+"</span>"+(va(I)?' <span class="edited">\xB7 edited</span>':"");else{let a=E.kind==="share"?"a shared deck":Se(E.source);e='<span class="mine">'+A(a.charAt(0).toUpperCase()+a.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,Ne.classList.toggle("unsaved",E.kind==="copy"&&va(I)),document.getElementById("btn-reset").hidden=!(E.kind==="copy"&&!ba(I));let t=document.getElementById("continue");t.hidden=E.kind==="copy"||!I,I&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+Se(I.origin))}function hs(e){return!I||!va(I)?!0:confirm("Your copy of "+Se(I.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function ps(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function Wc(){let e=E.kind==="share"?{kind:"shared"}:E.source;return hs("a copy of "+Se(e))?(I=ya(E.text,e),E={kind:"copy"},history.pushState(null,"",ps()+(f&&f!==g[0]?"#"+encodeURIComponent(f):"")),oa("Editing your own copy of "+Se(e)+". The original is unchanged.",4e3),!0):(ie.value=E.text,!1)}function Uc(){E={kind:"copy"},history.pushState(null,"",ps()),Ne.classList.contains("collapsed")&&oo(),ie.value=I.text,wt(!0),Ot()}function Tr(){return!!(he&&E&&E.kind==="source"&&E.source.kind==="url"&&new URL(E.source.url,location.href).pathname===he.deck)}function qc(e){fetch(he.save,{method:"PUT",body:e}).catch(()=>oa("Could not save "+he.file+": is npx slidetake still running?",6e3))}async function Gc(e){if(e.kind==="builtin")return Ha[e.id==="help"?"docs":e.id]??Ha.home;if(e.kind==="gist"){let a=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!a.ok)throw new Error(a.status===404?"no such gist":a.status+" "+a.statusText);let o=Object.values((await a.json()).files||{}),r=o.find(n=>n.filename===e.file)||o.find(n=>/\.(md|markdown)$/i.test(n.filename))||o[0];if(!r)throw new Error("the gist has no files");return ze=r.raw_url,r.truncated?await(await fetch(r.raw_url)).text():r.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return ze=new URL(e.url,location.href).href,await t.text()}function ei(){return E={kind:"source",source:{kind:"builtin",id:"home"},text:Ha.home},E.text}async function Vc(){if(he&&ee.page==="source"&&ee.source.kind==="builtin"&&ee.source.id==="home"&&location.pathname==="/"&&(ee.source={kind:"url",url:he.deck}),_)return ze=_.base||location.href,E={kind:"source",source:{kind:"url",url:ze},text:Xr(_.settings||{})+String(_.markdown||"")},E.text;if(ee.page==="edit"){if(I)return E={kind:"copy"},I.text;history.replaceState(null,"","/new"+location.search),ee.page="pick"}if(ee.page==="pick")return sa(document.getElementById("new-dialog")),E={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ha["template:blank"]},E.text;if(ee.page==="share")try{let e=await ln(ee.data);return E={kind:"share",data:ee.data,text:e},e}catch{return oa("This link's deck is damaged or cut short, so it could not be opened.",6e3),ei()}try{let e=await Gc(ee.source);return E={kind:"source",source:ee.source,text:e},e}catch(e){return Jt.textContent="Could not load the deck ("+e.message+")",oa("Could not load "+Se(ee.source)+": "+e.message,6e3),ei()}}var _,he,or,Ze,Mt,Ha,ie,H,se,Bo,Pn,Us,Jt,jo,qs,Ne,Aa,Gs,yt,Oo,le,_o,Vs,Ys,Ks,Js,$s,Xs,$t,u,g,Ye,f,rr,J,K,R,re,oe,Ae,P,ja,z,Yt,Zs,zn,_e,Rn,we,ye,Ie,Pe,ul,fl,yl,li,Po,wl,ze,Fn,Ml,Tl,Ll,Nn,Ol,Ba,Il,Rl,Dl,zo,We,Ro,qe,Re,Kl,bt,ge,mi,Te,Ge,Ee,Oa,Do,ct,_n,tc,Wn,Un,qn,Y,Ut,Go,Ua,qa,Ga,hr,Kt,ne,Le,Ve,pr,xi,h,Qt,Zt,ac,ur,oc,Si,ic,lc,dc,pt,kt,St,Vo,ht,ut,pe,Pa,de,Yo,Ci,Ia,za,Ko,hc,Li,et,gc,Oi,Ke,Gn,Fe,Cc,Mc,Fi,Je,Ni,Jo,aa,Hi,ji,_i,Wi,Ui,N,Z,k,Wt,Ra,qi,Vi,Da,Fo,Ja,$a,$i,ft,F,Qa,Zi,Ue,No,Bc,O,$o,Yn,Be,as,da,Oc,lo,$e,Kn,Bt,Fa,dt,qt,Qo,Zo,Gt,is,Ce,Vt,Na,ss,Nc,Jn,be,$n,gt,Xn,Hc,tr,ar,Qn,Za,ee,Zn,E,I,us=V(()=>{"use strict";Ir();Pr();Rr();Fr();Hr();_r();Ur();Gr();ma();Zr();an();bo();ko();hn();un();En();Mn();In();ka();_=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();he=window.SLIDETAKE_LOCAL||null,or=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!_);Ze=!_||_.recording===!0;document.documentElement.classList.toggle("no-record",!Ze);Mt=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ha={home:uo,docs:zr,features:Dr,privacy:Nr,showcase:Vr,"template:blank":jr,"template:talk":Wr,"template:recording":qr},ie=document.getElementById("editor"),H=document.getElementById("stage"),se=document.getElementById("world"),Bo=document.getElementById("connectors"),Pn=document.getElementById("breadcrumbs"),Us=document.getElementById("status-count"),Jt=document.getElementById("status-err"),jo=document.getElementById("mm-svg"),qs=document.getElementById("mm-label"),Ne=document.getElementById("editor-pane"),Aa=540,Gs=96,yt=440,Oo=720,le=960,_o=180,Vs=540,Ys=100,Ks=110,Js=420,$s=.35,Xs=1,$t=parseFloat(W("slidetake:slideSize"))||.92,u=new Map,g=[],Ye=[],f=null,rr=["focus","path","radial","tree"],J="path",K=!1,R={},re=!0,oe=null,Ae=document.getElementById("brand"),P=document.getElementById("pip"),ja=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},Yt=null;Zs='<span class="st-name">'+or+'Slide<span class="st-take">take</span></span>';zn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};_e=null;Rn=new URLSearchParams(location.search).get("mode");we=0;ye=null,Ie=-1,Pe=null;ul=new Set("svg g defs symbol use path rect circle ellipse line polyline polygon text tspan textPath title desc marker linearGradient radialGradient stop clipPath mask pattern filter feGaussianBlur feOffset feBlend feFlood feComposite feMerge feMergeNode feColorMatrix feDropShadow".split(" ")),fl=0;yl=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));li=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),Po=e=>!!e.querySelector("img")&&!e.textContent.trim(),wl=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(li)||e.children[0].matches("div.diagram"));ze=null;Fn=null;Ml="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Tl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Ll={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"}};Nn=new Set;Ol="https://esm.sh/@terrastruct/d2@0.1.33",Ba=null,Il={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"}};Rl=(e,t)=>e.replace("{","{"+t),Dl=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1414
|
+
`+f+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+g+" -c copy -movflags +faststart "+Ea(s)}let b=Ca(e),p=y=>(y/b).toFixed(6),T=y=>((y-.5)/b).toFixed(6),C=i.map(y=>"gte(t,"+T(y.f0)+")*lt(t,"+T(y.f1)+")").join("+"),w=i.map(y=>"gte(t,"+p(y.f0)+")*lt(t,"+p(y.f1)+")").join("+"),x=t==="mac"?"-c:v h264_videotoolbox -b:v 12M":"-c:v libx264 -crf 18 -preset medium";return f+"ffmpeg -i "+Ea(a)+" -i /tmp/slidetake-chapters.txt"+g+` -vf "select='`+C+`',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='`+w+"',asetpts=N/SR/TB"+(n?",loudnorm=I=-14:TP=-1:LRA=11":"")+'"'+(n?" -ar 48000":"")+" "+x+" -c:a aac -b:a 192k -movflags +faststart "+Ea(s)}var xn,Ca,kn,ut,Vs,Ea,Sn,Ma=V(()=>{"use strict";va();xn=e=>e.obsT??e.t,Ca=e=>e.fps||60,kn=(e,t)=>Math.round(e*t/1e3);ut=e=>String(e||"").split(/[\\/]/).pop()||"",Vs=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},Ea=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",Sn=e=>(e/1e3).toFixed(3)});function Ys(e,t){let a=Math.min(e,t*16/9),o=a*9/16;return{w:a,h:o,x:(e-a)/2,y:(t-o)/2}}function Mn(e,t,a){let o=Ys(e,t),r=[Math.floor(o.w*a),Math.floor(o.h*a)];return{quality:mt.find(n=>r[0]>=n.w&&r[1]>=n.h)||null,device:r}}function Gt(e){let t=new Map;e.events.forEach((o,r)=>{t.has(o.id)||t.set(o.id,[]),t.get(o.id).push(r)});let a=[];return ye(e).forEach(o=>{let r=e.picks[o.id]??o.takes.length,n=r?o.takes[r-1]:null;if(!n)return;let i=e.events[t.get(o.id)[r-1]];i&&i.clip&&n.end>n.start&&a.push({id:o.id,title:o.title,clip:i.clip,keep:(n.end-n.start)/1e3})}),a}var mt,Ta,qt,Ks,Tn,Ao,Ln,La,An,Bn,On=V(()=>{"use strict";Ma();mt=[{name:"1080p",w:1920,h:1080,bitrate:8e6},{name:"720p",w:1280,h:720,bitrate:5e6}],Ta=192e3,qt=30;Ks=["video/mp4;codecs=avc1.640028,mp4a.40.2","video/mp4;codecs=avc1,mp4a.40.2","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm"],Tn=e=>Ks.find(t=>e(t))||"",Ao=e=>e.startsWith("video/mp4")?"mp4":"webm",Ln=e=>Math.round((e.bitrate+Ta)/8*60);La=(e,t)=>t>e?t:e+.001,An=e=>e.replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i,""),Bn=(e,t)=>Math.min(e,t)+"p"+(t>e?" portrait":"")});function Js(e){let t=1681.974450955533,a=.7071752369554196,o=Math.tan(Math.PI*t/e),r=Math.pow(10,3.999843853973347/20),n=Math.pow(r,.4996667741545416),i=1+o/a+o*o,s={b0:(r+n*o/a+o*o)/i,b1:2*(o*o-r)/i,b2:(r-n*o/a+o*o)/i,a1:2*(o*o-1)/i,a2:(1-o/a+o*o)/i};t=38.13547087602444,a=.5003270373238773,o=Math.tan(Math.PI*t/e),i=1+o/a+o*o;let l={b0:1,b1:-2,b2:1,a1:2*(o*o-1)/i,a2:(1-o/a+o*o)/i};return{shelf:s,highPass:l}}function In(e,t){let{shelf:a,highPass:o}=Js(e),r=Math.round(e/10),n=[],i=Array.from({length:t},()=>new Float64Array(8)),s=d=>d>=3&&d<=4?1.41:1,l=0,c=0;return{add(d){let S=d[0].length;for(let f=0;f<t;f++){let g=d[f]||d[0],b=i[f],p=s(f),[T,C,w,x,y,E,L,$]=b,ae=l,X=Math.floor(ae/r),D=(X+1)*r,q=0;for(let ce=0;ce<S;ce++){let oe=g[ce];oe>c?c=oe:-oe>c&&(c=-oe);let Q=a.b0*oe+a.b1*T+a.b2*C-a.a1*w-a.a2*x;C=T,T=oe,x=w,w=Q;let Nt=o.b0*Q+o.b1*y+o.b2*E-o.a1*L-o.a2*$;E=y,y=Q,$=L,L=Nt,q+=Nt*Nt,++ae===D&&(n[X]=(n[X]||0)+p*q,q=0,X++,D+=r)}q&&(n[X]=(n[X]||0)+p*q),b.set([T,C,w,x,y,E,L,$])}l+=S},result(){let d=Math.floor(l/r),S=[];for(let p=3;p<d;p++)S.push(((n[p-3]||0)+(n[p-2]||0)+(n[p-1]||0)+(n[p]||0))/(4*r));let f=p=>p.reduce((T,C)=>T+C,0)/p.length,g=S.filter(p=>Aa(p)>-70),b=g.length?g.filter(p=>Aa(p)>Aa(f(g))-10):[];return{integrated:b.length?Aa(f(b)):-1/0,peak:c,peakDb:c>0?$s(c):-1/0}}}}function Oo(e,{limit:t=!1,target:a=-14,ceiling:o=-1.5}={}){if(!isFinite(e.integrated))return 0;let r=Math.min(a-e.integrated,Bo);return r<=0||t||e.peakDb==null||!isFinite(e.peakDb)?r:Math.max(0,Math.min(r,o-e.peakDb))}function Io(e,t,a={}){let o=Ba(a.ceilingDb??-1.5),r=Math.max(1,Math.round((a.lookahead??.005)*e)),n=1-Math.exp(-1/((a.release??.05)*e)),i=Array.from({length:t},()=>[]),s=[],l=[],c=new Float64Array(r),d=0,S=r,f=1,g=!1,b=0,p=0;c.fill(1);let T=C=>{for(;l.length&&l[l.length-1][1]>=C;)l.pop();for(l.push([d,C]);l[0][0]<=d-r;)l.shift();let w=l[0][1];if(f=w<f?w:f+(w-f)*n,f>.999&&(f=1),S+=f-c[d%r],c[d%r]=f,d>=r-1){let x=S/r,y=x>.999?1:x;s.push(y),y<.999&&!g&&b++,g=y<.999}d++};return{push(C){let w=C[0].length;for(let x=0;x<w;x++){let y=0;for(let E=0;E<t;E++){let L=(C[E]||C[0])[x];i[E].push(L),L>y?y=L:-L>y&&(y=-L)}T(y>o?o/y:1)}},ready:()=>s.length-p,take(C){let w=Array.from({length:t},()=>new Float32Array(C));for(let x=0;x<C;x++){let y=s[p+x];for(let E=0;E<t;E++)w[E][x]=i[E][p+x]*y}return p+=C,p>65536&&(s.splice(0,p),i.forEach(x=>x.splice(0,p)),p=0),w},end(){for(let C=0;C<r-1;C++){for(let w=0;w<t;w++)i[w].push(0);T(1)}},get events(){return b}}}var $s,Aa,Bo,Ba,Pn=V(()=>{"use strict";$s=e=>20*Math.log10(e),Aa=e=>-.691+10*Math.log10(e);Bo=20;Ba=e=>Math.pow(10,e/20)});function zn(e){let t=2166136261;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Rn(e,t){return e.map((a,o)=>{let r=e[o-1]||"";return{id:a,title:t(a).title,fp:t(a).fp,prev:r,prevFp:r?t(r).fp:""}})}function Dn(e,t,a){let o=new Map(a.map(i=>[i.id,i])),r=new Map;e.events.forEach(i=>{r.has(i.id)||r.set(i.id,[]),r.get(i.id).push(i)});let n=[];return ye(e).forEach(i=>i.takes.forEach((s,l)=>{let c=r.get(i.id)[l];if(!c||!c.clip||s.end<=s.start)return;let d=o.get(i.id);d&&n.push({uid:c.clip,id:i.id,title:i.title,clip:c.clip,ms:s.end-s.start,run:t,date:e.date,fp:d.fp,prev:d.prev,prevFp:d.prevFp,at:s.start})})),n.sort((i,s)=>i.at-s.at).map(({at:i,...s})=>s)}function Oa(e,t){return t.map(a=>{let o=e.takes.filter(i=>i.id===a.id).map((i,s)=>({...i,no:s+1,outdated:i.fp!==a.fp?"slide":(i.prev??null)!==a.prev||i.prevFp!==a.prevFp?"before":""})),r=e.picks[a.id],n=null;if(r&&o.some(i=>i.uid===r))n=r;else{let i=o.filter(s=>!s.outdated);n=i.length?i[i.length-1].uid:null}return{id:a.id,title:a.title,takes:o,pick:n}})}function Fn(e){let t=[],a=0;return e.forEach(o=>{let r=o.pick?o.takes.find(n=>n.uid===o.pick):null;r&&(t.push({id:o.id,title:o.title,t:a,clip:r.clip}),a+=r.ms)}),{events:t,picks:{},total:a}}function Ia(e,t){let a=new Set(t);return e.filter(o=>a.has(o))}function Nn(e,t,a){let o=t?e.indexOf(t):-1,r=e.indexOf(a);return o<0||r<0?[a]:e.slice(Math.min(o,r),Math.max(o,r)+1)}var Hn=V(()=>{"use strict";Ma()});var ad={};function j(e){try{let t=localStorage.getItem(e);if(t!==null||!e.startsWith("slidetake:"))return t;let a=e.slice(10);return localStorage.getItem("slidetake:"+a)??localStorage.getItem("traverse:"+a)}catch{return null}}function W(e,t){try{localStorage.setItem(e,t)}catch{}}function il(e){try{return{html:window.marked?window.marked.parse(e):"<pre>"+A(e)+"</pre>",err:null}}catch{return{html:"<p>(could not render)</p>",err:"render error"}}}function ll(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>/Slidetake/.test(o.nodeValue||"")&&!o.parentElement?.closest("code, pre, kbd, svg, em, .st-name")?1:2}),a=[];for(;t.nextNode();)a.push(t.currentNode);a.forEach(o=>{let r=document.createElement("span");r.innerHTML=A(o.nodeValue||"").replace(/Slidetake/g,sl),o.replaceWith(...r.childNodes)})}function qa(){let e=R.brand||"",t=R.logo||"",a=/^chip$/i.test(R.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+cr+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+A(t)+'">':"")+(e?"<span"+(a?' class="chip"':"")+">"+A(e)+"</span>":"");if(Pe.dataset.html!==o){Pe.dataset.html=o,Pe.innerHTML=o;let r=Pe.querySelector("img");r&&(r.onload=r.onerror=()=>ke(!0))}Pe.hidden=!o,Ie(),document.title=R.title||"Slidetake",dl(),li()}function cl(){let e=String(R.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=a=>"oklch(from "+e+" "+a+" 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 dl(){let e="",t=(o,r)=>{let n=Object.entries(r||{}).filter(([i,s])=>Wn[i]&&s&&typeof s!="object").map(([i,s])=>Wn[i]+":"+String(s).replace(/[;{}<>]/g,"")).join(";");n&&(e+=o+"{"+n+`}
|
|
1415
|
+
`)};[cl(),U&&U.colors].filter(Boolean).forEach(o=>{["dark","light"].forEach(r=>{let n={...o,...o[r]||{}},i=r==="dark";n.accent&&typeof n.accent=="string"&&(n.accentSoft=n.accentSoft||n.accent,n.line=n.line||"color-mix(in srgb, "+n.accent+(i?" 45%, #09090b)":" 55%, #fff)"),n.ring=n.ring||(i?n.accent:n.line),n.onAccent=n.onAccent||(i?"color-mix(in srgb, "+n.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',n)})});let a=document.getElementById("st-colors");a||(a=document.createElement("style"),a.id="st-colors",document.head.appendChild(a)),a.textContent!==e&&(a.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Le(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),Ke=Ke||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),Ke.clearRect(0,0,1,1),Ke.fillStyle="#000",Ke.fillStyle=a,Ke.fillRect(0,0,1,1),"#"+[...Ke.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function hl(e,t,a){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),r=o(e),n=o(t);return"#"+r.map((i,s)=>Math.round(i*a+n[s]*(1-a)).toString(16).padStart(2,"0")).join("")}function ro(){if(U&&U.themeKey&&!_n){let t=j(U.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(_n||j("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function li(){let e=ro()==="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 ci(){let e=ro()==="light"?"dark":"light";U&&U.themeKey?(W(U.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):W("slidetake:mode",e),li(),se.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&Mt(!0)}function pl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Vo(e){if(!e)return[];let t=ln(e.camera);return!te||t.some(ul)?t:[]}function ul(e){return!!Ye({},e).behind}function It(e){return cn(Vo(e),e&&e.frags?e.frags.length:0)}function di(){let e=It(u.get(m));return e[Math.min(xe,e.length-1)]||{cam:0,frag:0}}function ml(){if(!m)return null;let e=u.get(m),t=Vo(e);if(t.length)return t[Math.min(di().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=v.indexOf(m)-1;a>=0;a--){let o=Vo(u.get(v[a]));if(o.length)return Ye({},o[o.length-1]).behind?null:o[o.length-1]}return null}function fl(){let e={corner:(R.pip||"none").toLowerCase(),size:wo(parseFloat(R.pip_size)||24),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:zi(),full:!1,off:!1,flip:!1,used:!1,card:50};if(/^(behind|under)\b/.test(e.corner)){let t=e.corner;e.corner="bottom-right",Ye(e,t)}return Ye(e,ml()),be&&!/\b(off|hide)\b/i.test(be)&&(e.off=!1),Ye(e,be),!_t.includes(e.corner)&&(re||e.used)&&(e.corner="bottom-right"),e.flip&&_t.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function Ie(){let e=!B.hidden&&B.offsetWidth?B.getBoundingClientRect():null,t=Fe=fl();t.behind&&(!m||ue)&&(t.full=!1,t.behind=!1);let a=_t.includes(t.corner),o=te&&!!t.behind&&!t.off;B.className=a?[t.corner,t.circle&&"circle",re&&"live",t.mirror&&"mirror",t.full&&"full",t.behind&&"behind",o&&"empty",B.classList.contains("msg")&&"msg"].filter(Boolean).join(" "):"",B.style.width=t.full?"":t.size+"%",B.hidden=!a||t.off||te&&!o,de.dataset.pip=B.hidden||t.full?"none":t.corner,de.classList.toggle("cam-behind",!B.hidden&&!!t.behind),de.style.setProperty("--cam-card",String((t.card||0)/100)),de.classList.toggle("cam-card",(t.card||0)>0),de.classList.toggle("cam-solid",(t.card||0)>=100),de.classList.toggle("cam-live",!B.hidden&&!!t.behind&&!o);let r=!!Ae;if(Yo(!B.hidden&&t.behind&&t.place||""),Ae&&!r&&e&&!_e&&Me.animate&&Me.animate([{opacity:0},{opacity:1}],{duration:300,delay:550,easing:"ease-out",fill:"backwards"}),B.hidden||_e||!B.animate)return;let n="cubic-bezier(.65,0,.35,1)";if(!e){B.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let i=B.getBoundingClientRect();if(Math.abs(e.left-i.left)+Math.abs(e.top-i.top)+Math.abs(e.width-i.width)+Math.abs(e.height-i.height)<2)return;let s=(B.offsetParent||de).getBoundingClientRect(),l=c=>({left:c.left-s.left+"px",top:c.top-s.top+"px",width:c.width+"px",height:c.height+"px",right:"auto",bottom:"auto",aspectRatio:"auto"});B.animate([l(e),l(i)],{duration:600,easing:n})}function Yo(e){let t=Ae,a=Me.querySelector(".cam-box"),o=a&&a.getBoundingClientRect();Ae=e,de.dataset.place=e,Me.innerHTML="";let r=e&&u.get(m);if(!r||!r.el)return;let n=r.el.querySelector(".body"),i=[...n.children].map(S=>S.cloneNode(!0)),s=S=>S.matches("figure.media, .diagram, .echarts-container, .gallery"),l=[[e,i]],c=n.clientWidth;l.forEach(([S,f])=>{if(!f.length)return;let g=document.createElement("div");g.className="cam-box "+S;let b=(p,T)=>{if(!T.length)return;let C=document.createElement("div");C.className=p;let w=document.createElement("section");w.className="node";let x=document.createElement("div");x.className="body",T.forEach(y=>x.appendChild(y)),w.appendChild(x),p==="cam-media"&&(w.style.width=c+"px"),C.appendChild(w),g.appendChild(C)};b("cam-text",f.filter(p=>!s(p))),b("cam-media",f.filter(s)),Me.appendChild(g)}),Me.querySelectorAll("img").forEach(S=>{S.complete||S.addEventListener("load",Ko,{once:!0})}),Ko();let d=Me.querySelector(".cam-box");if(o&&t&&t!==e&&d&&!_e&&d.animate){let S=d.getBoundingClientRect();Math.abs(o.width-S.width)<2&&Math.abs(o.height-S.height)<2&&d.animate([{transform:"translate("+(o.left-S.left)+"px,"+(o.top-S.top)+"px)"},{transform:"none"}],{duration:600,easing:"cubic-bezier(.65,0,.35,1)"})}}function Ko(){let e=N.clientHeight/240;Me.querySelectorAll(".cam-media").forEach(t=>{let a=t.firstElementChild,o=Math.min(t.clientWidth/a.offsetWidth,t.clientHeight/a.offsetHeight,e*1.5);a.style.transform="translate(-50%, -50%) scale("+o+")"}),Me.querySelectorAll(".cam-text").forEach(t=>{let a=t.firstElementChild,o=t.clientWidth,r=t.clientHeight,n=.3,i=e;for(let s=0;s<12;s++){let l=(n+i)/2;a.style.width=o/l+"px",a.offsetHeight*l<=r?n=l:i=l}a.style.width=o/n+"px",a.style.transform="scale("+n+")"})}function gl(){let e=Fe;if(!e||B.hidden||e.full)return null;let t=N.clientWidth,a=N.clientHeight,o=16,r=t*e.size/100,n=e.circle?r:r*9/16,i=e.corner.includes("left")?o:t-o-r,s=e.corner.includes("top")?o:a-o-n;return{x0:i,y0:s,x1:i+r,y1:s+n}}function yl(){if(!Ge)return;if(te){Dt(!0);return}let e=pl();De=(De+1)%e.length,be=e[De],Ie(),K||xt("Camera: "+be),!re&&!B.hidden?lt():ke()}function hi(e){let t=nn(e,{render:il});R=t.deck,u=t.nodes,qa();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Xs.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,ea.textContent=t.errCount?t.errCount+" card(s) had errors":""}function pi(){et=[...u.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,r){let n=u.get(o);if(n.depth=r,n.children.length===0)n._slot=e++;else{n.children.forEach(s=>t(s,r+1));let i=n.children.map(s=>u.get(s)._slot);n._slot=(Math.min(...i)+Math.max(...i))/2}}et.forEach(o=>t(o,0)),v=[];function a(o){v.push(o),u.get(o).children.forEach(a)}return et.forEach(a),Math.max(1,e)}function bl(){let e=[],t=[],a=[];return u.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),a[o.depth]=(a[o.depth]||0)+1}),{maxH:e,maxW:t,count:a,maxDepth:e.length-1}}function ui(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 vl(){let{maxH:e,maxDepth:t}=bl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+tl;let o=el-St,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(S=>n(S,c))},i=l=>{let c=u.get(l);r[c.depth]=Math.max(r[c.depth]??-1/0,c.cx+c._w/2),c.children.forEach(i)};function s(l){let c=u.get(l),d=r[c.depth]!==void 0?r[c.depth]+o:-1/0;c.children.length?(c.children.forEach(s),c.cx=(u.get(c.children[0]).cx+u.get(c.children[c.children.length-1]).cx)/2,c.cx-c._w/2<d&&n(l,d-(c.cx-c._w/2))):c.cx=(d===-1/0?0:d)+c._w/2,i(l)}et.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,ui(l)})}function wl(e){let t=Math.PI*2/e,a=32,o=[],r=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+a&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+a,n=Math.max(0,...[...u.values()].map(s=>s.depth)),i=0;for(let s=0;s<=n;s++){let l=[...u.values()].filter(d=>d.depth===s);if(!l.length)continue;let c=s===0?et.length>1?ol*.5:0:i+al;for(let d=0;d<400&&(l.forEach(f=>{let g=(f._slot+.5)*t-Math.PI/2;f.cx=c*Math.cos(g),f.cy=c*Math.sin(g),ui(f)}),!!l.some((f,g)=>l.some((b,p)=>p>g&&r(f,b))||o.some(b=>r(f,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function xl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)a.push(t.currentNode);a.forEach(o=>{let r=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!r)return;let n=o.previousSibling;for(;n&&n.nodeType===3&&!n.data.trim();)n=n.previousSibling;let i=n&&n.nodeType===1?n:o.parentElement;i&&Object.entries(jt(r[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 El(e){let t=new DOMParser().parseFromString(e,"image/svg+xml"),a=t.documentElement;if(!a||a.localName!=="svg"||t.getElementsByTagName("parsererror").length)return null;let o=a.namespaceURI,r=i=>{[...i.children].forEach(s=>{s.namespaceURI!==o||!kl.has(s.localName)?s.remove():r(s)}),[...i.attributes].forEach(s=>{let l=s.name.toLowerCase(),c=s.value;(l.startsWith("on")||/javascript:|expression\(/i.test(c)||/url\(\s*['"]?(?!#)/i.test(c)||(l==="href"||l==="xlink:href")&&!c.trim().startsWith("#"))&&i.removeAttribute(s.name)})};r(a);let n="st-svg"+ ++Sl+"-";return[a,...a.querySelectorAll("*")].forEach(i=>[...i.attributes].forEach(s=>{let l=s.name==="id"?n+s.value:s.value.replace(/url\(\s*(['"]?)#/g,"url($1#"+n);(s.name==="href"||s.name==="xlink:href")&&l.startsWith("#")&&(l="#"+n+l.slice(1)),l!==s.value&&(s.value=l)})),document.importNode(a,!0)}function Re(e,t){let a=e.classList.contains("fragment");["fragment","fade-up","visible","current-fragment"].forEach(o=>{e.classList.contains(o)&&(t.classList.add(o),e.classList.remove(o))}),e.dataset.fragmentIndex!==void 0&&(t.dataset.fragmentIndex=e.dataset.fragmentIndex,delete e.dataset.fragmentIndex),e.replaceWith(t),a&&u.forEach(o=>o.frags&&o.frags.forEach(r=>{let n=r.indexOf(e);n>=0&&(r[n]=t)}))}function Do(e){let t=document.createElement("figure");t.className="media",Re(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function Cl(e,t){let a=document.createElement("figure");return a.className="media yt fragment yt-play"+(e.portrait?" portrait":""),a.innerHTML='<div class="frame"><iframe src="'+vn(e)+'" title="'+A(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+A(t)+"</figcaption>":""),a}function Un(e,t){let a=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",a),e.style.setProperty("--rows",Math.ceil(t/a))}function Tl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=El(n.textContent.trim()),s=document.createElement("div");s.className=i?"diagram svg":"diagram err",i?s.appendChild(i):s.textContent="SVG error: not a valid <svg> drawing",Re(n.parentElement,s)}),t.querySelectorAll(":scope > p").forEach(n=>{let i=n.children.length===1?n.children[0]:null;if(!i)return;let s=i.tagName==="A"&&n.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&To(s);l&&Re(n,Cl(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>Fo(s)||Al(s))||(n.classList.add("gallery"),i.some(s=>!Fo(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!Fo(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),Do(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(n.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let c=s.querySelector("figcaption");c&&(c.dataset.count=l+1+" / "+i.length)})):Un(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!Ml(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){Re(n,i[0]),Do(i[0]);return}let s=document.createElement("div");s.className="gallery grid",Re(n,s),i.forEach(l=>{s.appendChild(l),Do(l)}),Un(s,i.length)});let a=[...t.children].filter(n=>!/^H[1-6]$/.test(n.tagName)&&!(n.nodeType===1&&n.tagName==="HR")),o=a.filter(n=>n.matches("figure.media"));o.length===1&&a.length===1&&e.classList.add("card-media");let r=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;r.nextNode();)/^\s*view\s*:\s*full\s*$/i.test(r.currentNode.data)&&e.classList.add("card-full");if(a.length===1&&(a[0].matches("figure.media:not(.yt)")||a[0].matches(".gallery.carousel:not(.diagrams)")))e.classList.add("card-bleed");else if(o.length===1&&a.length>1&&!o[0].matches(".yt")){e.classList.add("card-split",a.indexOf(o[0])===0?"media-first":"media-last");let n=document.createElement("div");n.className="split-text",a.filter(i=>i!==o[0]).forEach(i=>n.appendChild(i)),o[0].after(n),a.indexOf(o[0])!==0&&n.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function mi(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function Ll(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&a.push(t.currentNode);a.forEach(o=>{for(let r=o.nextSibling;r&&!(r.nodeType===8&&/^\s*steps\s*:\s*off\s*$/i.test(r.data));r=r.nextSibling)r.nodeType!==1||r.classList.contains("fragment")||(/^(UL|OL)$/.test(r.tagName)?r.querySelectorAll(":scope > li").forEach(n=>n.classList.add("fragment","fade-up")):r.classList.add("fragment","fade-up"))})}function Bl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!To(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(fi)),a=[],o=[];[...e.children].forEach(r=>{t(r)?o.push(r):(o.length>1&&a.push(o),o=[])}),o.length>1&&a.push(o),a.forEach(r=>{let n=document.createElement("ul");r[0].before(n),r.forEach(i=>{let s=document.createElement("li");s.className="fragment fade-up",i.classList.remove("fragment","fade-up"),s.appendChild(i),n.appendChild(s)})})}function Ol(e){let t=[...e.querySelectorAll(".fragment")].map((r,n)=>({e:r,i:n,k:r.dataset.fragmentIndex}));if(t.every(r=>r.k===void 0))return t.map(r=>[r.e]);let a=0;t.forEach(r=>{r.k=r.k===void 0?a:parseFloat(r.k),a=Math.max(a,r.k)+1}),t.sort((r,n)=>r.k-n.k||r.i-n.i);let o=[];return t.forEach((r,n)=>{n&&t[n-1].k===r.k?o[o.length-1].push(r.e):o.push([r.e])}),o}function hr(e,t,a){!e||!e.frags||(a&&e.el.classList.add("snap"),e.frags.forEach((o,r)=>o.forEach(n=>{let i=n.classList.contains("visible");n.classList.toggle("visible",r<t),n.classList.toggle("current-fragment",r===t-1),n.classList.contains("yt-play")&&i!==r<t&&!a&&mi(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Il(){try{return R.base?new URL(R.base,Ne||location.href):Ne?new URL(Ne):null}catch{return null}}function Pl(e){let t=Il(),a=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let r=o.hasAttribute("src")?"src":"href",n=o.getAttribute(r);if(!n||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(n))return;if(!t){r==="src"&&!n.startsWith("/")&&a++;return}let i=t;try{R.site&&(i=new URL(R.site,t))}catch{}o.setAttribute(r,new URL(n,n.startsWith("/")?i:t).href)}),a}function no(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=St;e.visual=!!a.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=le);let r=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay","img-cover"),r&&(o=le),t.classList.contains("card-bleed")){let l=Math.max(0,...[...a.querySelectorAll("img")].map(d=>d.naturalWidth&&d.naturalHeight?d.naturalWidth/d.naturalHeight:0))||1.7777777777777777,c=le-Pa*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Pa*l)+"px"),o=le;else if(r||Math.abs(l-16/9)<.08)t.classList.add("img-overlay"),o=le,l>=16/9&&l<=16/9*1.15&&t.classList.add("img-cover");else if(l<1.3){let d=Math.min(Math.round(Pa*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(Ro,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(St,Math.min(le,(Pa-Zs)*l))),t.style.setProperty("--img-h",Math.round(o/l)+"px")}else(a.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||a.querySelectorAll("img").length>=4)&&(o=Ro);let n=a.querySelectorAll("table");if(n.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;n.forEach(c=>{o=Math.max(o,Math.min(Ro,Math.ceil(c.offsetWidth)+l+12))})}let i=a.querySelectorAll("pre");if(i.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;i.forEach(c=>{c.style.width="max-content",o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth)+l+2)),c.style.width=""})}let s=a.querySelectorAll(".fragment.grow");if(s.length){t.style.width=o+"px";let l=t.offsetWidth-a.clientWidth;s.forEach(c=>{o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth*1.3)+l))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(le,t.scrollWidth+24))+"px"),a.scrollWidth>a.clientWidth+2&&(a.style.zoom=(a.clientWidth/a.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||Go,t.classList.remove("measuring")}function zl(){clearTimeout(qn),qn=setTimeout(()=>{u.forEach(no),ca(),ke(!0)},200)}function Nl(){let e=ro()==="light"?"light":"dark",t=Le(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Gn.has(a)||(Hl(a,Fl[e],t),Gn.add(a)),a}function Hl(e,t,a){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:[a,...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}},pie:{label:{color:t.text,textBorderWidth:0},labelLine:{lineStyle:{color:t.muted}}},funnel:{label:{color:t.text,textBorderWidth:0}}})}function _l(){let e=ro()==="light"?"light":"dark",t=Le("--node-bg"),a=Le(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...Wl[e],N7:t,B1:Le("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=hl(a,t,n)}),r}function Ul(){let e=Le("--text"),t=Le("--text-muted"),a=Le("--accent"),o='"Helvetica,Arial,sans-serif"';return' graph [bgcolor=transparent color="'+t+'" fontcolor="'+e+'" fontname='+o+'] node [color="'+a+'" fontcolor="'+e+'" fontname='+o+'] edge [color="'+t+'" fontcolor="'+t+'" fontname='+o+"] "}function Jo(e){return No[e]||(No[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete No[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Vl(){let e=Je,t=[...se.querySelectorAll(".node pre > code.language-dot")];se.querySelectorAll(".node pre > code.language-echarts").forEach(n=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=n.textContent,Re(n.parentElement,i)});let a=[...se.querySelectorAll(".node .echarts-container[data-chart]")],o=[...se.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!a.length&&!o.length)return;let r=[];if(t.length)try{if(await Jo(Rl),Ho=Ho||await Viz.instance(),e!==Je)return;let n=Ul();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(Ho.renderSVGElement(ql(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}Re(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!za){let i=await import(jl);za=new i.D2}if(e!==Je)return;let n=_l();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await za.compile(Gl(i.textContent));s.innerHTML=await za.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==Je)return;Re(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Jo(Dl),e!==Je)return;let n=Nl();a.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}let l=echarts.init(i,n,{renderer:"svg"});l.on("finished",()=>{Ae&&i.closest(".node")===(u.get(m)||{}).el&&Yo(Ae)}),l.setOption(Object.assign({backgroundColor:"transparent",animation:!_e},s))})}catch{r.push("charts")}e===Je&&(Ae&&Yo(Ae),r.length&&(ea.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(no),ca(),ke(!0))}function Yl(){let e=[];return v.forEach(t=>{let a=Ot(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function Kl(){let a=0,o=0,r=0;Yl().forEach((n,i)=>{let s=Math.max(...n.ids.map(d=>u.get(d)._h));i&&(a+=r/2+120+s/2);let l=o,c=o;n.ids.forEach((d,S)=>{let f=u.get(d);S&&(l+=90+f._w/2),f.cx=l,f.cy=a,c=l,l+=f._w/2}),o=c,r=s})}function Jl(){u.forEach(e=>{e.cx=0,e.cy=0})}function gi(){Je++,window.echarts&&se.querySelectorAll(".echarts-container").forEach(a=>{let o=echarts.getInstanceByDom(a);o&&o.dispose()}),se.querySelectorAll("div.node").forEach(a=>a.remove());let e=pi(),t=0;u.forEach(a=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=a.id;let r=a.parent?io(a.id).slice(0,-1).map(i=>u.get(i).title).join(" / "):"";o.innerHTML=(r?'<div class="crumb">'+A(r)+"</div>":"")+'<div class="body">'+a.html+"</div>"+(a.err?'<div class="err-badge">!</div>':"");let n=o.querySelector(".body");xl(n),Ll(n),Bl(n),Tl(o,n),/^slidetake$/i.test(R.brand||"")&&ll(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Pl(n),a.frags=Ol(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",zl,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));u.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),h.active||_(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{h.active||_(a.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&_(a.id)}),se.appendChild(o),a.el=o,hr(a,a.frags.length)}),t&&!ea.textContent&&(ea.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(no),ca(e),Vl()}function ca(e){e===void 0&&(e=pi()),J==="radial"?wl(e):J==="path"?Kl():J==="focus"?Jl():vl(),se.classList.toggle("focus",J==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),$l(),Pt(),mr()}function $l(){let e="";if(J==="focus"){zo.innerHTML="";return}if(J==="path"){for(let t=1;t<v.length;t++){let a=u.get(v[t-1]),o=u.get(v[t]);e+='<path data-from="'+a.id+'" data-to="'+o.id+'" d="M '+a.cx+" "+a.cy+" L "+o.cx+" "+o.cy+'"/>'}zo.innerHTML=e;return}u.forEach(t=>{if(!t.parent)return;let a=u.get(t.parent);if(J==="radial")e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+a.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=a.cy+a._h/2,r=t.cy-t._h/2,n=o+(r-o)/2;e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+o+" L "+a.cx+" "+n+" L "+t.cx+" "+n+" L "+t.cx+" "+r+'"/>'}}),zo.innerHTML=e}function io(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function Et(){let e=N.clientWidth,t=N.clientHeight;se.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+z.zoom+") translate("+-z.x+"px,"+-z.y+"px)",Ci()}function pr(){Qt&&(Qt.kill(),Qt=null)}function yi(e,t){if(pr(),t||_e||!window.gsap){Object.assign(z,e),Et();return}let a=N.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:Et,onComplete:()=>{Qt=null}}),{zoom:i,...s}=e,l=o*Math.min(z.zoom,r),c=Math.max(.55,Math.min(1.3,.55+l/a*.3));if(n.to(z,{...s,duration:c,ease:"power2.inOut"},0),l>a*1.2){let d=Math.max(.06,Math.min(z.zoom,r,a*.9/(o+St)));n.to(z,{zoom:d,duration:c/2,ease:"sine.out"},0).to(z,{zoom:r,duration:c/2,ease:"sine.in"},c/2)}else n.to(z,{zoom:r,duration:c,ease:"power2.inOut"},0);Qt=n}function Xl(){let e=N.getBoundingClientRect(),t=14,a=[];if(!Pe.hidden&&Pe.offsetWidth){let r=Pe.getBoundingClientRect();a.push({x0:r.left-e.left-t,y0:r.top-e.top-t,x1:r.right-e.left+t,y1:r.bottom-e.top+t})}let o=gl();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function Ql(){let e=N.clientWidth,t=N.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return Xl().forEach(o=>{let r=[];a.forEach(n=>{if(o.x1<=n.x0||o.x0>=n.x1||o.y1<=n.y0||o.y0>=n.y1){r.push(n);return}[{...n,x1:Math.min(n.x1,o.x0)},{...n,x0:Math.max(n.x0,o.x1)},{...n,y1:Math.min(n.y1,o.y0)},{...n,y0:Math.max(n.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&r.push(i)})}),r.length&&(a=r)}),a}function $o(e,t,a){let o=N.clientWidth,r=N.clientHeight,n=null;return Ql().forEach(i=>{let s=a*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!n||s>n.zoom)&&(n={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-r/2})}),n}function bi(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function rt(e,t){let a=u.get(e);if(!a)return;let o=$o(a._w,a._h,ta),r=Ot(e),n=v.filter(l=>Ot(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return $o(c._w,c._h,ta).zoom}).sort((l,c)=>l-c),i=n.length?n[Math.floor((n.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));yi(Object.assign(bi(a.cx,a.cy,o,s),{zoom:s}),t)}function da(e){let t=[...u.values()];if(!t.length)return;let a=N.clientWidth,o=N.clientHeight,r=Math.min(...t.map(d=>d.cx-d._w/2)),n=Math.max(...t.map(d=>d.cx+d._w/2)),i=Math.min(...t.map(d=>d.cy-d._h/2)),s=Math.max(...t.map(d=>d.cy+d._h/2)),l=$o(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));yi(Object.assign(bi((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function ke(e){m&&u.has(m)?rt(m,e):da(e)}function Pt(){let e=m?io(m):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===m),a.classList.toggle("active-path",e.includes(t.id))}),se.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!m&&v.indexOf(t.dataset.to)<=v.indexOf(m):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),ac(e),wi()}function vi(){return tn(new URLSearchParams(location.search).get("duration")??R.duration)}function Zl(){return K&&vi()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Ga(){let e=Zl()&&He.start>0;if(Xe.classList.toggle("timed",e),!e){Xe.classList.remove("over");return}let a=(h.active&&h.t0?Tt():performance.now()-He.start)/vi();Xe.firstChild.style.width=Math.min(100,a*100)+"%",Xe.classList.toggle("over",a>=1)}function ec(){He.start=performance.now(),clearInterval(He.timer),He.timer=setInterval(Ga,1e3),Ga()}function tc(){clearInterval(He.timer),He.timer=null,He.start=0,Ga()}function wi(){let e=K&&v.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(Xe.classList.toggle("show",e),!e)return;Ga();let t=v.indexOf(m),a=0,o=0;v.forEach((r,n)=>{let i=It(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(xe,i-1)+1)}),Xe.lastChild.style.width=(a?o/a*100:0)+"%"}function ac(e){jn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===m?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),jn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||_(t.dataset.id)}))}function ha(e){let t=u.get(m);t&&(hr(t,di().frag,e),Ie(),(B.hidden||!Fe||!Fe.full||Fe.behind)&&nc(t),ur(t))}function rc(e){return!v.length||e.id!==v[0]&&e.id!==v[v.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function nc(e){if(e._played||!window.gsap||_e)return;e._played=!0;let t=rc(e);if(t&&t.length){e._auto=t;let[a,...o]=t;/^H[1-3]$/.test(a.tagName)&&!a.children.length?(a.classList.add("auto-scramble"),Vn(a)):o.unshift(a),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(a=>{let o;try{o=JSON.parse(a.dataset.gsap)}catch{return}let r={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(a,o.from||{},Object.assign({},o.to,r)):o.from&&gsap.from(a,Object.assign({},o.from,r))}),e.el.querySelectorAll(".title-scramble").forEach(Vn)}function aa(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 a={};try{a=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},a.from,a.to)).map(r=>oc.includes(r)?"transform":r));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 Vn(e){let t=e.dataset.text||(e.dataset.text=e.textContent),a=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",r={p:0};e._scramble=gsap.to(r,{p:1,duration:1.4,ease:"none",onUpdate(){let n=Math.floor(r.p*a.length);e.textContent=a.map((i,s)=>s<n||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function ur(e){clearTimeout(Ct),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(Ct=setTimeout(()=>{m===e.id&&je(1)},e.autoslide))}function xi(e){let t=e&&e!==v[0]?e:"";try{M&&M.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Co(M.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function _(e,t,a){if(!u.has(e))return;if(e!==m){be=null,De=-1,xe=a?It(u.get(e)).length-1:0;let n=u.get(m);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),Si()}let o=e!==m;if(o&&(ki=m),m=e,clearTimeout(ue),ue=null,o&&J==="focus"&&!t&&!_e){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ha(o),o&&!Be&&ia("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(da(),ue=setTimeout(()=>{ue=null,m===e&&(Ie(),rt(e))},1900),Ie()):rt(e,t),Pt(),mr(),xi(e)}function Si(){let e=u.get(m);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>mi(t,"pauseVideo")),hr(e,e.frags.length,!0),aa(e))}function ic(){if(!m&&Qe&&u.has(Qe)){Ei();return}m&&(Qe=m),J==="focus"&&fr("path"),Si(),clearTimeout(Ct),m=null,Ie(),Pt(),mr(),da(),xi(null)}function Ei(){if(ue)return clearTimeout(ue),ue=null,Ie(),rt(m),!0;if(!m&&Qe&&u.has(Qe)){let e=Qe;return Qe=null,_(e),!0}return!1}function je(e){if(!m){v.length&&_(v[e>0?0:v.length-1]);return}if(ue&&e>0){clearTimeout(ue),ue=null,Ie(),rt(m);return}let t=It(u.get(m)),a=Math.min(xe,t.length-1)+e;if(a>=0&&a<t.length){xe=a,be=null,De=-1,ha(),!re&&!B.hidden&&Fe.used?lt():ke(),Pt();return}let o=v.indexOf(m)+e;o>=0&&o<v.length&&_(v[o],!1,e<0)}function sc(){let e=u.get(m);e&&e.parent&&_(e.parent)}function lc(){let e=u.get(m);e&&e.children.length?_(e.children[0]):!m&&v.length&&_(v[0])}function mr(){let e=[...u.values()];if(!e.length){qo.innerHTML="",Ce=null;return}Qs.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-St/2,r=Math.max(...e.map(t))+St/2,n=Math.min(...e.map(a))-Go/2,i=Math.max(...e.map(a))+Go/2,s=16,l=180,c=130,d=Math.min((l-2*s)/Math.max(1,r-o),(c-2*s-6)/Math.max(1,i-n)),S=l/2-(o+r)/2*d,f=c/2+5-(n+i)/2*d,g=m?io(m):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+S)+'" y1="'+(a(T)*d+f)+'" x2="'+(t(p)*d+S)+'" y2="'+(a(p)*d+f)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===m?"var(--accent)":g.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+S)+'" cy="'+(a(p)*d+f)+'" r="'+(p.id===m?4:3)+'" fill="'+T+'"><title>'+A(p.title)+"</title></circle>"}),b+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',qo.innerHTML=b,Ce={s:d,ox:S,oy:f},Ci()}function Ci(){let e=document.getElementById("mm-viewport");if(!e||!Ce)return;let t=N.clientWidth/z.zoom,a=N.clientHeight/z.zoom;e.setAttribute("x",(z.x-t/2)*Ce.s+Ce.ox),e.setAttribute("y",(z.y-a/2)*Ce.s+Ce.oy),e.setAttribute("width",Math.max(2,t*Ce.s)),e.setAttribute("height",Math.max(2,a*Ce.s))}function Mt(e){hi(ie.value),m&&!u.has(m)&&(m=null),gi(),m?_(m,e):v.length?_(v[0],e):(m=null,da(!0))}function fr(e,t){J=e,W("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(a=>a.classList.toggle("active",a.dataset.mode===e)),u.size&&(!t&&!_e&&(se.classList.add("morph"),setTimeout(()=>se.classList.remove("morph"),700)),ca(),Et(),m?rt(m,t):da(t))}function Mi(e){return Math.max(.04,Math.min(5,e))}function cc(e){ta=Math.round(Math.max(rl,Math.min(nl,e))*100)/100,W("slidetake:slideSize",ta),m&&rt(m)}function Yn(e){m?cc(ta+e*.1):Ti(e>0?1.2:1/1.2)}function Ti(e,t,a){pr();let o=Mi(z.zoom*e);if(t!==void 0){let r=N.getBoundingClientRect(),n=t-r.left-r.width/2,i=a-r.top-r.height/2;z.x+=n/z.zoom-n/o,z.y+=i/z.zoom-i/o}z.zoom=o,Et()}function so(){U||(Ue.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!Ue.classList.contains("collapsed")))}function ve(e){K=e,document.body.classList.toggle("presenting",e),gs(document.getElementById("btn-present"),e),ys();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!m&&v.length&&_(v[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!re&&!te&<(),e?ur(u.get(m)):clearTimeout(Ct),e?ec():tc(),wi()}function Tt(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function pa(e){e.classList.add("open")}function uc(e){if(W("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+hc]=!0;let t=["","; Domain="+location.hostname,"; Domain=."+location.hostname.replace(/^www\./,"")];document.cookie.split(";").map(a=>a.split("=")[0].trim()).filter(a=>a==="_ga"||a.startsWith("_ga_")).forEach(a=>t.forEach(o=>{document.cookie=a+"=; Max-Age=0; Path=/"+o}))}Ai()}function Ai(){br.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===pc())))}function ua(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function mc(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Va.value=t||"localhost",Ya.value=a||"4455",Ka.value=o.join(":"),!0}try{let t=JSON.parse(j("slidetake:obs")||"null");t&&(Va.value=t.host||"localhost",Ya.value=t.port||"4455",Ka.value=t.password||"",gr.checked=!0)}catch{}return!1}function Oi(){if(gr.checked)W("slidetake:obs",JSON.stringify({host:Va.value.trim(),port:Ya.value.trim(),password:Ka.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Vt(e,t,a){Zt.textContent=e,Zt.className=t||"",Zt.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function gc(e){return location.protocol==="https:"&&!fc(e)}async function vr(){let e=Va.value.trim()||"localhost",t="ws://"+e+":"+(Ya.value.trim()||"4455");if(gc(e)){Oe=!1,Vt("Blocked here","err",yc);return}Vt("Connecting\u2026"),Zt.title="Connecting to "+t;try{await Jo(dc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Oe=!1,Vt("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ze&&(Ze(),Ze=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&Bt("Stopped in OBS")});let o=await ne.connect(t,Ka.value||void 0);Oe=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(yr=r.fpsNumerator/r.fpsDenominator),Li=r&&r.outputWidth&&r.outputHeight?Bn(r.outputWidth,r.outputHeight):""}catch{}Vt("Connected","ok",""),Zt.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),Oi(),Y.classList.contains("open")&&it()&&(O("Connected to OBS. Press \u25CF Record."),Ve())}catch(a){Oe=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";Vt("Could not connect","err",o+" Is OBS running with its WebSocket server on, and are the port and password right?")}}function bc(){let e=document.getElementById("rec-screen"),t=screen.width,a=screen.height;if(Math.abs(t/a-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+a+"), 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]],[r,n]=o.reduce((s,l)=>Math.abs(l[1]-t/a)<Math.abs(s[1]-t/a)?l:s),i=Math.abs(n-t/a)<.005?r:"about "+r;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+a+"), 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 Se(){let e=navigator.mediaDevices;if(!window.isSecureContext||!e||!e.getDisplayMedia)return{why:"This page can\u2019t capture itself here. Open Slidetake in Chrome or Edge on a computer."};if(!window.RestrictionTarget&&!window.CropTarget)return{why:"Recording in the browser needs Chrome or Edge (or another Chromium browser) on a computer."};let t=window.MediaRecorder?Tn(r=>MediaRecorder.isTypeSupported(r)):"";if(!t||!navigator.storage||!navigator.storage.getDirectory)return{why:"This browser can\u2019t record video here. Use a recent Chrome or Edge."};let{quality:a,device:o}=Mn(screen.width,screen.height,devicePixelRatio||1);return a?{ok:!0,type:t,quality:a}:{why:"This screen gives a "+o[0]+"\xD7"+o[1]+" frame, less than 720p. Use pro mode (OBS), or a larger screen."}}async function lo(){Zo++,he&&(cancelAnimationFrame(he.raf),he.stream.getTracks().forEach(e=>e.stop()),he.ctx.close().catch(()=>{}),he=null,Qo.value=0,vt.getContext("2d").clearRect(0,0,vt.width,vt.height),Ii())}function Ii(){er++,Na&&(Na.getTracks().forEach(e=>e.stop()),Na=null),wr.srcObject=null}async function Pi(){Ii(),xr();let e=er,t=bt.value;if(Da.hidden=t!=="none"&&!!t,Da.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==er){a.getTracks().forEach(o=>o.stop());return}Na=a,wr.srcObject=a}catch{Da.hidden=!1,Da.textContent="The camera isn\u2019t available"}}async function Ja(){await lo();let e=Zo;try{let t=Lt.value,a=await navigator.mediaDevices.getUserMedia({audio:Ki(t)});if(e!==Zo){a.getTracks().forEach(f=>f.stop());return}let o=new AudioContext,r=o.createAnalyser();r.fftSize=512,o.createMediaStreamSource(a).connect(r);let n=new Float32Array(r.fftSize),i=he={stream:a,ctx:o,raf:0},s=vt.getContext("2d"),l=vt.width,c=vt.height,d=Le("--accent"),S=()=>{if(he!==i)return;r.getFloatTimeDomainData(n);let f=0;for(let g of n)f=Math.max(f,Math.abs(g));Qo.value=Math.max(f,Qo.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let g=0;g<n.length;g++){let b=g/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[g]*3))*(c/2-4);g?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(S)};S()}catch(t){yt.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function $a(e=!0){try{e&&!he&&await Ja();let t=await navigator.mediaDevices.enumerateDevices(),a=(n,i)=>{let s=t.filter(b=>b.kind===n),l=s.find(b=>b.deviceId==="default"),c=l?l.label.replace(/^Default - /,""):"",d=s.filter(b=>b.deviceId!=="default"&&b.deviceId!=="communications"),S=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),f=d.map((b,p)=>An(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));f.forEach((b,p)=>{let T=f.slice(0,p).filter(C=>C===b).length;T&&(f[p]=b+" "+(T+1))});let g=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(S)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===g?" selected":"")+">"+A(f[p]+(S(b)?" (system default)":""))+"</option>").join("")},o=kr();bt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=j("slidetake:mic")||"";Lt.innerHTML=a("audioinput",r),r&&Lt.value===r&&he&&he.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Ja()}catch{}}function zi(){let e=j("slidetake:mirror");return e?e==="on":/^(yes|true|on)$/i.test(R.pip_mirror||"")}function xr(){Xa.checked=zi(),wr.parentElement.classList.toggle("mirror",Xa.checked)}function kr(){let e=j(Ri());return e||(wc()?j("slidetake:cam")||"default":"none")}function xc(e){W(Ri(),e),e!=="none"&&e!=="default"&&W("slidetake:cam",e)}function kc(){h.camWas=!te;let e=kr()!=="none";e!==!te&&Dt(e,!0)}function Di(){h.camWas!=null&&(h.camWas!==!te&&Dt(h.camWas,!0),h.camWas=null)}async function Fi(){let e=Se();if(!e.ok)return yt.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;Fa&&(yt.innerHTML='<span class="warn">'+A(Fa)+"</span>",Fa="");let t=mt.indexOf(e.quality),a=j("slidetake:quality");At.innerHTML=mt.slice(t).map(r=>"<option"+(r.name===a?" selected":"")+">"+r.name+"</option>").join("");let o="";try{let{quota:r,usage:n}=await navigator.storage.estimate(),i=mt.find(s=>s.name===At.value)||e.quality;o=" Room for about "+Math.floor((r-n)/Ln(i))+" minutes of takes."}catch{}return yt.querySelector(".warn")||(yt.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function Sc(e){me=e,W("slidetake:rec-mode",e),na({setup:Rt()})}function na(e={}){Ge&&(Se().ok&&(me||"browser")==="browser"?Ar(e):Ec(e))}function Ec(e={}){let t=co().find(a=>a.key===qe()&&a.withObs&&!a.inBrowser);Qi(t||{key:qe(),deckTitle:R.title||(v[0]?u.get(v[0]).title:"Deck"),date:new Date().toISOString(),withObs:!0,outputPath:null,reason:"",total:0,totalObs:null,fps:yr,events:[],picks:{},empty:!0},e)}async function Sr(){if(!(!Ge||h.active||!v.length)){if(!Cc()){or({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(Se().ok&&(me||"browser")==="browser"){let t=Oa(st(),uo()).filter(r=>!r.pick).map(r=>r.id),a=v.indexOf(m),o=t.length?t:a>0?v.slice(a):v;Qa("browser",o.length===v.length?null:o);return}if(!Oe&&j("slidetake:obs")&&await vr(),Oe){Qa("obs");return}or({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function Er(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function Cr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}async function Hi(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(de)):await e.cropTo(await CropTarget.fromElement(de))}async function Mc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Hi(e.track)}catch{}await e.track.applyConstraints(Ni(e.quality)).catch(()=>{}),await ra()}async function Tc(){let e=Se();if(!e.ok)throw new Error(e.why);let t=mt.find(s=>s.name===At.value)||e.quality;document.body.classList.add("rec-frame");let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:qt},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),o=a.getVideoTracks()[0],r=()=>a.getTracks().forEach(s=>s.stop());if(!o.restrictTo&&!o.cropTo)throw r(),new Error("Share \u201Cthis tab\u201D to record the slides.");try{await Hi(o)}catch(s){throw r(),new Error("Chrome could not record just the slides ("+(s.message||s.name)+").")}await o.applyConstraints(Ni(t)).catch(()=>{});let n;try{let s=j("slidetake:mic");n=await navigator.mediaDevices.getUserMedia({audio:Ki(s)})}catch(s){throw r(),new Error("The microphone isn\u2019t available ("+(s.message||s.name)+").")}let i=new Date().toISOString().replace(/[:.]/g,"-");h.browser={id:i,display:a,mic:n,track:o,quality:t,type:e.type,stream:new MediaStream([o,...n.getAudioTracks()]),dir:await Er(i,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&Bt("Sharing stopped")})}function ji(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),document.body.classList.remove("rec-frame"))}function Lc(e){let t=h.browser,a="take-"+t.clips.length+"."+Ao(t.type),o={name:a,rec:null,done:null};t.clips.push(o),e.clip=t.id+"/"+a,t.chain=t.chain.then(async()=>{let r=await(await t.dir.getFileHandle(a,{create:!0})).createWritable(),n=new MediaRecorder(t.stream,{mimeType:t.type,videoBitsPerSecond:t.quality.bitrate,audioBitsPerSecond:Ta}),i=Promise.resolve();n.ondataavailable=l=>{l.data.size&&(i=i.then(()=>r.write(l.data)).catch(c=>{t.error=c}))},o.done=new Promise(l=>{n.onstop=async()=>{await i,await r.close().catch(()=>{}),l()}}),await new Promise(l=>{n.onstart=l,n.start(1e3)}),e.t=Math.round(Tt()),e.cutAt!=null&&(e.lead=Math.max(0,Math.round(e.t-e.cutAt)));let s=t.cur;t.cur=o,o.rec=n,s&&s.rec.state!=="inactive"&&s.rec.stop()}).catch(r=>{t.error=r})}async function Qa(e,t){if(h.active||!v.length)return;let a=e==="obs";if(lo(),me||(me=a?"obs":"browser",W("slidetake:rec-mode",me)),e==="browser"){K||ve(!0);try{await Tc()}catch(l){document.body.classList.remove("rec-frame"),K&&ve(!1),Fa=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,Ar({setup:!0});return}}ua();let o=t&&t.length?t.filter(l=>v.includes(l)):null,r=o?o[0]:v[0],n=v[v.indexOf(r)-1]||null;Object.assign(h,{active:!0,withObs:a,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null,only:o?new Set(o):null}),e!=="browser"&&(h.browser=null),document.body.classList.add("recording"),Or(),K||ve(!0),kc(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Be=!0,_(n,!0,!0),Be=!1,B.getAnimations().forEach(l=>l.finish()),await ra(),document.body.classList.remove("no-anim")):(m===r&&(xe=0,be=null,De=-1),_(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=Kt.querySelector(".hint");for(let l=3;l>0;l--)if(i.textContent=(document.fullscreenElement?"":"Press F for fullscreen \xB7 ")+"recording starts after the countdown \xB7 Esc to cancel",Kt.querySelector(".num").textContent=l,Kt.classList.add("show"),await oa(1e3),!h.active)return;if(Kt.classList.remove("show"),await ra(),a){let l=new Promise(c=>{Ze=c,setTimeout(()=>{Ze&&(Ze(),Ze=null)},2500)});try{await ne.call("StartRecord")}catch(c){Mr("OBS could not start recording: "+(c&&c.message||c));return}if(await l,!h.active)return}h.browser&&await Mc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){ia("slide",r),h.browser&&await h.browser.chain,aa(s),Be=!0,_(r),Be=!1;return}aa(s),ha(!0),ia("slide",m)}function Mr(e){if(h.active=!1,h.counting=!1,h.browser){let t=h.browser;t.chain.then(()=>{t.cur&&t.cur.rec.state!=="inactive"&&t.cur.rec.stop()}).then(()=>Cr(t.id)),ji(),h.browser=null}Kt.classList.remove("show"),document.body.classList.remove("recording"),K&&ve(!1),Di(),xt(e)}function ia(e,t,a){if(!h.active||!h.t0||h.finishing)return;let o=u.get(t),r={id:t,title:o?o.title:t,retake:e==="retake",t:Math.round(Tt()),obsT:null};a==null&&h.browser&&(a=r.t),a!=null&&(r.cutAt=a,r.lead=Math.max(0,Math.round(r.t-a))),h.events.push(r),h.browser&&Lc(r),h.withObs&&Oe&&(ne.call("GetRecordStatus").then(n=>{n&&typeof n.outputDuration=="number"&&(r.obsT=n.outputDuration)}).catch(()=>{}),o&&ne.call("CreateRecordChapter",{chapterName:(r.retake?"RETAKE \xB7 ":"")+o.title}).catch(()=>{}))}function Ac(e){let t=e.key;if((Jn.includes(t)||$n.includes(t)||Xn.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?Mr("Take cancelled"):Bt("Stopped early");return}if((t==="f"||t==="F")&&!document.fullscreenElement&&document.documentElement.requestFullscreen){e.preventDefault(),document.documentElement.requestFullscreen().catch(()=>{});return}if(!(h.counting||h.finishing||tt)){if(Xn.includes(t)){Pc();return}h.paused||(Jn.includes(t)?Bc():$n.includes(t)&&Oc())}}function Bc(){let e=It(u.get(m)),t=Math.min(xe,e.length-1)>=e.length-1,a=v.indexOf(m);if(!t){je(1);return}if(!h.only){a===v.length-1?Bt():je(1);return}let o=v.slice(a+1).find(r=>h.only.has(r));o?v[a+1]===o?je(1):Wi(v[v.indexOf(o)-1],o,"slide"):Bt()}async function Oc(){let e=u.get(m);if(!e||tt)return;let t=m,a=ki;if(!a||a===t||!u.has(a)){Ic(e);return}Wi(a,t,"retake")}async function Wi(e,t,a){let o=u.get(t);if(!o||tt)return;tt=!0;let r=Tt();document.body.classList.add("no-anim");let n=u.get(e);Be=!0,n._played=!0,_(e,!0,!0),B.getAnimations().forEach(i=>i.finish()),Be=!1,await ra(),document.body.classList.remove("no-anim"),ia(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await _i(),aa(o),Be=!0,_(t),Be=!1,!re&&!B.hidden&&Fe.used&<(),tt=!1}async function _i(){let e=h.events[h.events.length-1];e&&(e.skip=Qn/2),await oa(Qn)}async function Ic(e){tt=!0,xe=0,be=null,De=-1,aa(e),ha(!0),!re&&!B.hidden&&Fe.used?lt():ke(),Pt(),ia("retake",m),h.withObs&&await _i(),tt=!1}async function Pc(){if(h.t0)if(h.paused){if(Xo.classList.remove("show"),await ra(),h.withObs&&await ne.call("ResumeRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="paused"&&e.cur.rec.resume()})}h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,ur(u.get(m))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(Ct),h.withObs&&await ne.call("PauseRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="recording"&&e.cur.rec.pause()})}Xo.classList.add("show")}}async function Bt(e){if(!h.active||h.finishing)return;if(h.counting){Mr("Take cancelled");return}h.finishing=!0,clearTimeout(Ct),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Xo.classList.remove("show"));let t=Math.round(Tt()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await oa(1200);try{let n=await ne.call("StopRecord");h.outputPath=n&&n.outputPath}catch(n){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(n&&n.message||n)+")"}}let o=h.browser;o&&(await oa(600),await o.chain,t=Math.round(Tt()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),ji(),h.browser=null,o.error&&(e=(e?e+". ":"")+"Some of the take could not be saved ("+(o.error.message||o.error.name)+")")),h.active=!1,h.finishing=!1,document.body.classList.remove("recording"),K&&ve(!1),Di();let r={key:qe(),deckTitle:R.title||u.get(v[0]).title,date:new Date().toISOString(),withObs:h.withObs,outputPath:h.outputPath,reason:e||"",total:t,totalObs:a,fps:o?qt:yr,...o?{inBrowser:!0,takesId:o.id,quality:o.quality.name,type:o.type}:{},events:h.events.map(n=>({id:n.id,title:n.title,retake:n.retake,t:n.t,obsT:n.obsT,...n.lead?{lead:n.lead}:{},...n.skip?{skip:n.skip}:{},...n.clip?{clip:n.clip}:{}})),picks:{}};if(r.inBrowser){Wc(r);return}Tr(r),Qi(r,{note:(e?e+". ":"")+ye(r).size+" slides recorded with OBS."})}function qe(){return ht(R.title||(v[0]?u.get(v[0]).title:"deck"))}function co(){try{return JSON.parse(j("slidetake:sessions")||"[]")}catch{return[]}}function Tr(e){let t=co().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&Cr(a.takesId)}),W("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function Ot(e){let t=u.has(e)?io(e):[e];return t[Math.min(1,t.length-1)]}function Ui(e,t){let a=Ot(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function O(e,{warn:t=!1,html:a="",title:o=""}={}){Yt.classList.toggle("warn",t),a?Yt.innerHTML=a:Yt.textContent=e,Yt.title=o||Yt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>ss(!0))}function Qi(e,t={}){ua(),H=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":ye(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+pt(e.totalObs??e.total)+". ";Y.classList.remove("in-browser","board"),Y.classList.add("obs");let r=document.getElementById("rv-rec");r.title="Records the deck with OBS: a new video in place of this one",r.disabled=!1,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-clean").disabled=!!e.cleaned,document.getElementById("rv-file").textContent=e.outputPath?" ("+ut(e.outputPath)+")":"";let n=Ca(e);Za.value=[...Za.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,k.src&&(e.inBrowser||We!==ut(e.outputPath)&&e.outputPath)&&(k.removeAttribute("src"),k.load(),We=""),document.getElementById("rv-novideo").hidden=!!k.src||!!e.empty,Z=null,F=null,zt(),ho(),pa(Y),t.setup?mo(t):(fo(),$a(!1).then(Ve)),O(t.note||(e.empty?Oe?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(k.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||Vc(e)}function ho(){if(H&&H.board){nt();return}let e=H,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...ye(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=Ot(o.id),i=n!==a;a=n;let s=o.takes.map(l=>'<button class="rv-chip'+(r===l.no?" on":"")+'" data-id="'+A(o.id)+'" data-take="'+l.no+'">Take '+l.no+" \xB7 "+pt(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+ba(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,Tr(e),ho();let r=ye(e).get(o.dataset.id),n=r&&r.takes[+o.dataset.take-1];if(!n)return;let i=r.title+(r.takes.length>1?" \xB7 take "+n.no:"");if(e.inBrowser){let s=e.events.filter(l=>l.id===o.dataset.id)[n.no-1];s&&s.clip&&po([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else to([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,es(e),as(e)}function es(e){let t=zc(e),a=document.getElementById("rv-chapters");Zi=t.lines.join(`
|
|
1416
|
+
`),a.disabled=t.lines.length<3,a.title=t.lines.length<3?"YouTube needs at least three chapters of 10 seconds or more":"Copies the "+t.lines.length+" chapters, to paste into the YouTube description"}function ts(e,t){let a=e.dataset.label||(e.dataset.label=e.textContent);(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject()).catch(()=>{}),e.textContent="\u2713 Copied",clearTimeout(+e.dataset.timer),e.dataset.timer=String(setTimeout(()=>{e.textContent=a},1500))}async function as(e){let t=document.getElementById("rv-final"),a=++Wo,o=Ut(e).reduce((n,i)=>n+i.end-i.start,0),r=n=>(n?"about "+(n>1e9?(n/1e9).toFixed(1)+" GB":Math.max(1,Math.round(n/1e6))+" MB")+" \xB7 ":"Final cut ")+pt(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of Gt(e))ja.has(i.clip)||ja.set(i.clip,(await ma(i.clip)).size),n+=ja.get(i.clip);a===Wo&&(t.textContent=r(n))}catch{a===Wo&&(t.textContent=r(null))}}function to(e){if(!k.src){eo=e,O(nr?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}eo=null,Z={ranges:e,i:0},O("\u25B6 "+e[0].title);let t=()=>{k.currentTime=e[0].start/1e3,k.play().catch(a=>{a&&a.name!=="AbortError"&&O("Could not play: "+a.message,{warn:!0})})};k.readyState>=1?t():k.addEventListener("loadedmetadata",t,{once:!0})}function zt(){wt=null}function Lr(){let e=F&&!F.single&&!k.paused;os.innerHTML=e?'\u275A\u275A <span><u class="key">P</u>ause</span>':'\u25B6 <span><u class="key">P</u>review</span>',document.querySelectorAll("#rv-list .rv-row.playing").forEach(o=>o.classList.remove("playing"));let t=F&&F.parts[F.i],a=t&&t.id&&document.querySelector('#rv-list .rv-row[data-id="'+CSS.escape(t.id)+'"]');a&&(a.classList.add("playing"),a.scrollIntoView({block:"nearest"}))}function Dc(e){let t=H?Gt(H):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;wt=o?o.id:null,O(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function rs(e){return Array.from({length:e.numberOfChannels},(t,a)=>{let o=new Float32Array(e.numberOfFrames);return e.copyTo(o,{planeIndex:a,format:"f32-planar"}),o})}async function ma(e){let[t,a]=e.split("/");return(await(await Er(t)).getFileHandle(a)).getFile()}async function po(e,t=0,a=!1){if(!(!H||H.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ma(e[t].clip);if(!Y.classList.contains("open"))return;k.src&&URL.revokeObjectURL(k.src),k.src=URL.createObjectURL(o),O("\u25B6 "+e[t].title),await k.play()}catch(o){if(o&&o.name==="AbortError")return;F=null,O(o&&o.name==="NotFoundError"?"This take is no longer in the browser.":"Could not play this take: "+(o&&o.message||o),{warn:!0})}}}function ns(){let e=F;if(e.i+1<e.parts.length){po(e.parts,e.i+1,e.single);return}F=null,k.pause(),e.single?Dc(e.parts[0]):O(""),Lr()}async function Fc(e){if(!e.where)return!0;try{let t=await Br("video-folder");return!t||t.name!==e.where||await t.queryPermission({mode:"readwrite"})!=="granted"||await t.getFileHandle(e.name),!0}catch{return!1}}async function ss(e){let t=H;if(!t||!t.inBrowser||t.cleaned)return;let a=Gt(t);if(!a.length){O("No slide has a take yet: nothing to save.",{warn:!0});return}let o=JSON.stringify([a.map(d=>[d.clip,Math.round(d.keep*1e3)]),at(),sa(),t.type]),r=t.board&&I.lastDownload;if(!e&&r&&r.sig===o&&await Fc(r)){O("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(_o(r))+".",title:"Already saved in "+_o(r)+". A new video is made only when a take or the sound settings change."});return}let n=Ao(t.type||"")==="mp4",i=qe()+" "+Hc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await ls(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=ao;c.disabled=!0,$e("Preparing\u2026");try{let d=await import(vc),S=s?new d.StreamTarget(s):new d.BufferTarget,f=new d.Output({format:n?new d.Mp4OutputFormat({fastStart:s?!1:"in-memory"}):new d.WebMOutputFormat,target:S}),g=1,b="",p=at()&&sa();if(at()){let D=await Zn(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let q=Oo(D,{limit:p});if(p&&Math.abs(q)>=.05){let Q=await Zn(d,a,Ba(q),!0,"Checking");Q&&isFinite(Q.integrated)&&(q=Math.min(q+(-14-Q.integrated),Bo))}g=Ba(q);let ce=p?-14:D.integrated+q,oe=!p&&Oo(D,{limit:!0})-q>.5;b=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(q)<.05?" LUFS, left as is":" \u2192 "+ce.toFixed(1)+" LUFS")+(oe?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=g!==1||p;await Nc(d,a);let C=null,w=null,x=0,y=-1,E=-1,L=null,$=[],ae=async()=>{for(;$.length&&L.ready()>=$[0].n;){let D=$.shift(),q=L.take(D.n),ce=new Float32Array(D.n*D.ch);q.forEach((oe,Q)=>ce.set(oe,Q*D.n)),await w.add(new d.AudioSample({data:ce,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,q]of a.entries()){$e("Joining "+(D+1)+"/"+a.length);let ce=new d.Input({source:new d.BlobSource(await ma(q.clip)),formats:d.ALL_FORMATS}),oe=await ce.getPrimaryVideoTrack(),Q=await ce.getPrimaryAudioTrack();if(!oe)throw new Error(q.title+" has no video");C||(C=new d.EncodedVideoPacketSource(await oe.getCodec()),f.addVideoTrack(C,{frameRate:qt}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Ta}):new d.EncodedAudioPacketSource(await Q.getCodec()),f.addAudioTrack(w)),await f.start());let Nt={decoderConfig:await oe.getDecoderConfig()},ct=0,Rr=!0;for await(let G of new d.EncodedPacketSink(oe).packets())G.timestamp>=q.keep||(y=La(y,x+G.timestamp),await C.add(G.clone({timestamp:y}),Rr&&D===0?Nt:void 0),Rr=!1,ct=Math.max(ct,G.timestamp+G.duration));if(Q&&w&&T)for await(let G of new d.AudioSampleSink(Q).samples(0,ct)){if(G.timestamp+G.duration>ct+1e-4){G.close();continue}E=La(E,x+G.timestamp);let fe=rs(G);if(fe.forEach(ge=>{for(let dt=0;dt<ge.length;dt++)ge[dt]*=g}),p)L=L||Io(G.sampleRate,fe.length),L.push(fe),$.push({t:E,n:G.numberOfFrames,rate:G.sampleRate,ch:fe.length}),G.close(),await ae();else{let ge=G.numberOfFrames,dt=new Float32Array(ge*fe.length);fe.forEach((Ss,Es)=>dt.set(Ss,Es*ge)),await w.add(new d.AudioSample({data:dt,format:"f32-planar",numberOfChannels:fe.length,sampleRate:G.sampleRate,timestamp:E})),G.close()}}else if(Q&&w){let G={decoderConfig:await Q.getDecoderConfig()},fe=!0;for await(let ge of new d.EncodedPacketSink(Q).packets())ge.timestamp+ge.duration>ct+1e-4||(E=La(E,x+ge.timestamp),await w.add(ge.clone({timestamp:E}),fe&&D===0?G:void 0),fe=!1)}x+=ct}if(L&&(L.end(),await ae(),L.events&&(b+=", "+L.events+" peak"+(L.events===1?"":"s")+" limited")),$e("Finishing\u2026"),await f.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([S.buffer],{type:n?"video/mp4":"video/webm"})),D.download=i,D.click(),setTimeout(()=>URL.revokeObjectURL(D.href),1e4)}let X={sig:o,name:i,where:l};t.board&&(I.lastDownload=X,fa()),O("Saved in "+_o(X)+" ("+pt(x*1e3)+b+")."),$e("\u2713 Saved"),is=setTimeout(()=>$e(),2500)}catch(d){$e(),O("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function Zn(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){$e(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ma(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let S=rs(d);n=n||In(d.sampleRate,S.length),a!==1&&o?(S.forEach(f=>{for(let g=0;g<f.length;g++)f[g]*=a}),i=i||Io(d.sampleRate,S.length),i.push(S),i.ready()&&n.add(i.take(i.ready()))):n.add(S),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function Nc(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ma(i.clip)),formats:e.ALL_FORMATS}).getPrimaryVideoTrack(),l=s&&await s.getDecoderConfig();a.push(l?l.codec+" "+l.codedWidth+"\xD7"+l.codedHeight+" "+(l.description?[...new Uint8Array(l.description)].join("."):""):"none")}let o=new Map;a.forEach(i=>o.set(i,(o.get(i)||0)+1));let r=[...o.entries()].sort((i,s)=>s[1]-i[1])[0][0],n=t.filter((i,s)=>a[s]!==r);if(n.length)throw new Error(n.map(i=>i.title).join(", ")+(n.length===1?" was":" were")+" recorded at a different size ("+a[t.indexOf(n[0])].split(" ")[1]+", not "+r.split(" ")[1]+"). Tick "+(n.length===1?"it":"them")+" and record again")}async function ls(e){if(!window.showDirectoryPicker)return null;let t=e?null:await Br("video-folder");if(t){let a=await t.queryPermission({mode:"readwrite"});if(a==="prompt"&&(a=await t.requestPermission({mode:"readwrite"})),a==="granted")return t}return t=await window.showDirectoryPicker({id:"slidetake-videos",mode:"readwrite",startIn:"videos"}),ps("video-folder",t),t}function st(){let e=cs();if(I&&ar===e)return I;ar=e;try{I=JSON.parse(j(e)||"null")}catch{I=null}return(!I||!Array.isArray(I.takes))&&(I={takes:[],picks:{},type:"",quality:""}),I}function Wc(e){st();let t=Dn(e,e.takesId,uo());t.forEach(a=>{delete I.picks[a.id]}),I.takes.push(...t),Object.assign(I,{type:e.type,quality:e.quality}),fa(),ze.clear(),Ar({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function ds(){let e=Oa(st(),uo()),t=Object.assign(Fn(e),{board:!0,inBrowser:!0,withObs:!1,type:I.type||"video/mp4",quality:I.quality||"",deckTitle:R.title||(v[0]?u.get(v[0]).title:"Deck"),date:new Date().toISOString()});return{rows:e,sess:t}}function mo(e={}){Y.classList.add("setup-view"),ti.textContent=e.note||"",ti.hidden=!e.note,ot.textContent="\u2190 Back",ot.title="Back to Studio",ot.setAttribute("aria-expanded","true"),_c()}function fo(){let e=Rt();e&&Y.classList.remove("setup-view"),ot.textContent="\u2699 Setup",ot.title="Settings: camera, microphone, video, OBS and files",ot.setAttribute("aria-expanded","false"),e&&(lo(),Ve())}function or(e={}){Y.classList.contains("open")?mo(e):na({...e,setup:!0})}function _c(){let e=()=>{Ve(),Rt()&&Pi()};if(it()){bc(),$a(!1).then(e);return}yt.innerHTML="",Fi().then(t=>{t.ok?$a().then(e):e()})}function Ve(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(bt)||(kr()==="none"?"No camera":"Camera"),a=it(),o=a?Li:Se().ok?At.value:"",r=a?[t]:[t,e(Lt)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",gt.classList.toggle("on",a),gt.setAttribute("aria-pressed",String(a)),gt.disabled=!Se().ok,gt.title=gt.disabled?Wa+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+Wa:"Easy mode: recording in "+Wa+". Click for pro mode, with OBS"}function Ar(e={}){Ge&&(ua(),st(),Y.classList.remove("obs"),Y.classList.add("in-browser","board"),document.getElementById("rv-rec").title="Records the whole deck, or only the ticked slides (shift-click ticks a range)",document.getElementById("rv-novideo").hidden=!0,k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),Z=null,F=null,zt(),Ha=-1,nt(),pa(Y),e.setup||!Se().ok?mo(e):(fo(),Fi().then(()=>$a(!1)).then(Ve)),O(e.note||Xi()||(I.takes.length?Uc()+". Click a take to preview it.":v.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function Uc(){let e=Oa(st(),uo()),t=e.filter(o=>o.pick).length,a=e.filter(o=>o.takes.length&&!o.pick).length;return t+" of "+e.length+" slides ready"+(a?", "+a+" to record again":"")}function nt(){let{rows:e,sess:t}=ds();H=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=Ot(i.id),l=s!==o;o=s;let c=A(i.id),d={slide:"Recorded before this slide changed",before:"Starts with the entry from the slide before, which has changed or is gone: record this slide again"},S=i.takes.length?i.takes.map(f=>'<button class="rv-chip'+(i.pick===f.uid?" on":"")+(f.outdated?' outdated" title="'+d[f.outdated]:"")+'" data-id="'+c+'" data-uid="'+A(f.uid)+'">Take '+f.no+" \xB7 "+pt(f.ms)+"</button>").join("")+(i.pick?"":'<span class="rv-none">'+(i.takes.some(f=>f.outdated==="before")&&!i.takes.some(f=>f.outdated==="slide")?"The slide before changed: record again":"Changed since: record again")+"</span>"):'<span class="rv-none">No take yet</span>';return'<div class="rv-row with-sel'+(l?" sec":"")+(ze.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(ze.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+S+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{I.picks[i.dataset.id]=i.dataset.uid,fa(),nt();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&po([{id:s.id,clip:l.clip,keep:l.ms/1e3,title:s.title+" \xB7 take "+l.no}],0,!0)}),a.querySelectorAll(".rv-sel").forEach(i=>i.addEventListener("click",s=>{(s.shiftKey?Nn(v,ei,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?ze.add(c):ze.delete(c)}),zt(),ei=i.dataset.id,nt()}));let r=Ia(v,ze),n=Se().ok;document.getElementById("rv-rec").disabled=!n,Ha>=0&&r.length!==Ha&&O(Xi()||"Record takes the whole deck."),Ha=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,es(t),as(t)}async function qc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await Er(o)).removeEntry(r)}catch{}let t=new Set(e.map(a=>a.uid));I.takes=I.takes.filter(a=>!t.has(a.uid)),Object.keys(I.picks).forEach(a=>{t.has(I.picks[a])&&delete I.picks[a]}),fa(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,zt(),nt()}function hs(e){return new Promise((t,a)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>a(o.error)})}async function Br(e){let t=async a=>{let o=await hs(a);return await new Promise(r=>{let n=o.transaction("kv").objectStore("kv").get(e);n.onsuccess=()=>r(n.result),n.onerror=()=>r(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function ps(e,t){try{(await hs()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function go(e){nr=!0;try{return await Gc(e)}finally{nr=!1}}async function Gc(e){let t=await e.getFile();for(let a=0;a<10;a++){await new Promise(r=>setTimeout(r,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function ga(e,t,a){k.src&&URL.revokeObjectURL(k.src),Jt=t||null,a||(rr=0),k.src=URL.createObjectURL(e),We=e.name,document.getElementById("rv-novideo").hidden=!0,O("Loaded "+e.name+". Click a take to preview it."),eo?to(eo):a&&Z&&to(Z.ranges.slice(Z.i))}async function Vc(e){let t=ut(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(We===t&&k.src))try{let a=await Br("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);O("Opening "+t+"\u2026"),ga(await go(o),o)}catch{}}function xt(e,t){if(!h.active){if(clearTimeout(_a),!B.hidden&&!B.classList.contains("live")){Xt.classList.remove("show"),ms.textContent=e,B.classList.add("msg"),t||(_a=setTimeout(fs,9e3));return}Xt.textContent=e,Xt.classList.add("show"),t||(_a=setTimeout(()=>Xt.classList.remove("show"),9e3))}}function fs(){ms.textContent="PIP camera",B.classList.remove("msg")}function Or(){clearTimeout(_a),Xt.classList.remove("show"),fs()}function Uo(){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 Ir(){re&&re.getTracks().forEach(t=>t.stop()),re=null;let e=B.querySelector("video");e&&e.remove()}async function lt(){if(!(re||te)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){xt("Camera not available on this page."+Uo(),!0);return}if(Te.disabled)return;Te.disabled=!0,xt("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{let t=j("slidetake:cam");re=await navigator.mediaDevices.getUserMedia({video:{...t?{deviceId:{ideal:t}}:{},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),Or()}catch(t){let a=t&&t.name;xt(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Uo():a==="NotFoundError"||a==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":a==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(a?" ("+a+")":"")+"."+Uo(),!0);return}finally{Te.disabled=!1,Pr()}re.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Ir(),qa(),ke()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=re,B.appendChild(e)}qa(),ke()}}function gs(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Pr(){Te.querySelector("svg")||(Te.innerHTML=Yc+'<span class="lbl"> <u class="key">C</u>amera</span>'),Te.classList.toggle("on",!te),Te.setAttribute("aria-pressed",String(!te)),Te.title=te?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function Dt(e,t){e&&!Ge||(te=!e,t||W("slidetake:camera",e?"on":"off"),te&&(Ir(),Or()),be=null,De=-1,xe=Math.min(xe,Math.max(0,It(u.get(m)).length-1)),Pr(),qa(),ha(),Pt(),ke(),!K&&!t&&xt(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&<())}function ys(){document.body.classList.remove("idle"),clearTimeout(ai),K&&(ai=setTimeout(()=>document.body.classList.add("idle"),2e3))}function la(e,t){kt.textContent=e,kt.classList.add("show"),clearTimeout(ri),ri=setTimeout(()=>kt.classList.remove("show"),t||2500)}function ir(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(pn(e),location.origin);return new URLSearchParams(location.search).forEach((n,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!a||r.searchParams.set(i,n)}),o&&(r.hash=o),r.href.replace(r.pathname,r.pathname.replace(/%40/g,"@"))}async function Jc(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(M.kind==="source")return{link:ir(M.source,t),inside:!1};if(M.kind==="copy"&&Sa(P)&&["url","gist","builtin"].includes(P.origin.kind))return{link:ir(P.origin,t),inside:!1};let o=M.kind==="share"?M.data:await mn(ie.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+Co(o,e),inside:!0}}function $c(){let e=j("slidetake:draft");if(!e||e===yo)return null;let t=xa(e,{kind:"file",name:"your earlier draft"},{exported:!0});W("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function ya(){W("slidetake:copy",JSON.stringify(P))}function Ft(){if(U)return;let e;if(zr())e='<span class="mine">'+A(pe.file)+'</span> <span class="ro">\xB7 on this computer, saved as you type</span>';else if(M.kind==="copy")e='<span class="mine">Your copy of '+A(Ee(P.origin))+"</span>"+(ka(P)?' <span class="edited">\xB7 edited</span>':"");else{let a=M.kind==="share"?"a shared deck":Ee(M.source);e='<span class="mine">'+A(a.charAt(0).toUpperCase()+a.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,Ue.classList.toggle("unsaved",M.kind==="copy"&&ka(P)),document.getElementById("btn-reset").hidden=!(M.kind==="copy"&&!Sa(P));let t=document.getElementById("continue");t.hidden=M.kind==="copy"||!P,P&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+Ee(P.origin))}function bs(e){return!P||!ka(P)?!0:confirm("Your copy of "+Ee(P.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function vs(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function Xc(){let e=M.kind==="share"?{kind:"shared"}:M.source;return bs("a copy of "+Ee(e))?(P=xa(M.text,e),M={kind:"copy"},history.pushState(null,"",vs()+(m&&m!==v[0]?"#"+encodeURIComponent(m):"")),la("Editing your own copy of "+Ee(e)+". The original is unchanged.",4e3),!0):(ie.value=M.text,!1)}function Qc(){M={kind:"copy"},history.pushState(null,"",vs()),Ue.classList.contains("collapsed")&&so(),ie.value=P.text,Mt(!0),Ft()}function zr(){return!!(pe&&M&&M.kind==="source"&&M.source.kind==="url"&&new URL(M.source.url,location.href).pathname===pe.deck)}function Zc(e){fetch(pe.save,{method:"PUT",body:e}).catch(()=>la("Could not save "+pe.file+": is npx slidetake still running?",6e3))}async function ed(e){if(e.kind==="builtin")return Ua[e.id==="help"?"docs":e.id]??Ua.home;if(e.kind==="gist"){let a=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!a.ok)throw new Error(a.status===404?"no such gist":a.status+" "+a.statusText);let o=Object.values((await a.json()).files||{}),r=o.find(n=>n.filename===e.file)||o.find(n=>/\.(md|markdown)$/i.test(n.filename))||o[0];if(!r)throw new Error("the gist has no files");return Ne=r.raw_url,r.truncated?await(await fetch(r.raw_url)).text():r.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return Ne=new URL(e.url,location.href).href,await t.text()}function si(){return M={kind:"source",source:{kind:"builtin",id:"home"},text:Ua.home},M.text}async function td(){if(pe&&ee.page==="source"&&ee.source.kind==="builtin"&&ee.source.id==="home"&&location.pathname==="/"&&(ee.source={kind:"url",url:pe.deck}),U)return Ne=U.base||location.href,M={kind:"source",source:{kind:"url",url:Ne},text:rn(U.settings||{})+String(U.markdown||"")},M.text;if(ee.page==="edit"){if(P)return M={kind:"copy"},P.text;history.replaceState(null,"","/new"+location.search),ee.page="pick"}if(ee.page==="pick")return pa(document.getElementById("new-dialog")),M={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ua["template:blank"]},M.text;if(ee.page==="share")try{let e=await fn(ee.data);return M={kind:"share",data:ee.data,text:e},e}catch{return la("This link's deck is damaged or cut short, so it could not be opened.",6e3),si()}try{let e=await ed(ee.source);return M={kind:"source",source:ee.source,text:e},e}catch(e){return ea.textContent="Could not load the deck ("+e.message+")",la("Could not load "+Ee(ee.source)+": "+e.message,6e3),si()}}var U,pe,cr,Ge,_e,Ua,ie,N,se,zo,jn,Xs,ea,qo,Qs,Ue,Pa,Zs,St,Ro,le,Go,el,tl,al,ol,rl,nl,ta,u,v,et,m,dr,J,K,R,te,re,Pe,B,de,z,Qt,sl,Wn,Ke,_n,xe,be,De,Fe,Me,Ae,kl,Sl,Ml,fi,Fo,Al,Ne,qn,Rl,Dl,Fl,Gn,jl,za,Wl,ql,Gl,No,Je,Ho,Xe,He,oc,Ct,ue,ki,Be,Qe,Ce,Ra,jo,ft,Kn,dc,Jn,$n,Xn,Y,Kt,Xo,Va,Ya,Ka,gr,Zt,ne,Oe,Ze,yr,Li,h,oa,ra,hc,br,pc,Bi,fc,yc,vc,bt,Lt,At,Qo,yt,vt,me,Fa,he,Zo,wr,Da,Na,er,Xa,wc,Ri,it,Cc,Ni,tt,Qn,We,zc,Rc,qi,at,Gi,tr,sa,Vi,Yi,Ki,Ji,$i,H,Z,k,Yt,Ha,Xi,Zi,ja,Wo,Za,eo,os,wt,F,ao,is,$e,_o,Hc,I,ar,ei,ze,cs,fa,jc,uo,ot,ti,Rt,Wa,gt,Jt,rr,nr,$t,us,Te,Xt,_a,ms,Yc,ai,we,oi,kt,ri,Kc,sr,lr,ni,oo,ee,ii,M,P,ws=V(()=>{"use strict";Hr();jr();_r();qr();Vr();Kr();$r();Qr();va();sn();dn();So();Mo();bn();wn();On();Pn();Hn();Ma();U=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();pe=window.SLIDETAKE_LOCAL||null,cr=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!U);Ge=!U||U.recording===!0;document.documentElement.classList.toggle("no-record",!Ge);_e=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ua={home:yo,docs:Wr,features:Ur,privacy:Gr,showcase:Zr,"template:blank":Yr,"template:talk":Jr,"template:recording":Xr},ie=document.getElementById("editor"),N=document.getElementById("stage"),se=document.getElementById("world"),zo=document.getElementById("connectors"),jn=document.getElementById("breadcrumbs"),Xs=document.getElementById("status-count"),ea=document.getElementById("status-err"),qo=document.getElementById("mm-svg"),Qs=document.getElementById("mm-label"),Ue=document.getElementById("editor-pane"),Pa=540,Zs=96,St=440,Ro=720,le=960,Go=180,el=540,tl=100,al=110,ol=420,rl=.35,nl=1,ta=parseFloat(j("slidetake:slideSize"))||.92,u=new Map,v=[],et=[],m=null,dr=["focus","path","radial","tree"],J="path",K=!1,R={},te=!0,re=null,Pe=document.getElementById("brand"),B=document.getElementById("pip"),de=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},Qt=null;sl='<span class="st-name">'+cr+'Slide<span class="st-take">take</span></span>';Wn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};Ke=null;_n=new URLSearchParams(location.search).get("mode");xe=0;be=null,De=-1,Fe=null;Me=document.getElementById("cam-overlay"),Ae="";new ResizeObserver(()=>{Ae&&Ko()}).observe(de);kl=new Set("svg g defs symbol use path rect circle ellipse line polyline polygon text tspan textPath title desc marker linearGradient radialGradient stop clipPath mask pattern filter feGaussianBlur feOffset feBlend feFlood feComposite feMerge feMergeNode feColorMatrix feDropShadow".split(" ")),Sl=0;Ml=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));fi=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),Fo=e=>!!e.querySelector("img")&&!e.textContent.trim(),Al=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(fi)||e.children[0].matches("div.diagram"));Ne=null;qn=null;Rl="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Dl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Fl={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"}};Gn=new Set;jl="https://esm.sh/@terrastruct/d2@0.1.33",za=null,Wl={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"}};ql=(e,t)=>e.replace("{","{"+t),Gl=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1316
1417
|
d2-config: {
|
|
1317
1418
|
layout-engine: elk
|
|
1318
1419
|
}
|
|
1319
1420
|
}
|
|
1320
|
-
`+e,
|
|
1321
|
-
`+t.html):""},lo=()=>Ln(g,e=>({title:u.get(e).title,fp:Oc(e)}));$e=document.getElementById("rv-setup-btn"),Kn=document.getElementById("setup-note"),Bt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||ho()}).observe(Y,{attributes:!0,attributeFilter:["class"]});$e.onclick=()=>{Bt()?ho():co()};document.getElementById("setup-record").onclick=()=>{la(),pe||(pe=et()?"obs":"browser",U("slidetake:rec-mode",pe)),gr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&ro()});Fa=(()=>{let e=(navigator.userAgentData&&navigator.userAgentData.brands||[]).map(a=>a.brand).filter(a=>!/chromium|not.?a.?brand/i.test(a));if(e.length)return e[0].replace(/^(Google|Microsoft) /,"");let t=navigator.userAgent;return/Firefox\//.test(t)?"Firefox":/Edg\//.test(t)?"Edge":/OPR\//.test(t)?"Opera":/Chrome\//.test(t)?"Chrome":/Safari\//.test(t)?"Safari":"this browser"})();document.querySelectorAll(".browser-name").forEach(e=>{e.textContent=Fa});document.getElementById("rv-rec").onclick=()=>{if(!et()){Ka("browser",La(g,Be));return}if(Le){Ka("obs");return}Xo({note:"Connect to OBS first: OBS \u2192 Connect."})};dt=document.getElementById("rv-pro");dt.onclick=()=>{ke().ok&&fc(et()?"browser":"obs")};document.querySelectorAll(".rv-purge .rv-menu button").forEach(e=>e.addEventListener("click",()=>{e.closest("details").open=!1}));document.getElementById("rv-clean-unused").onclick=async()=>{let{rows:e}=os(),t=new Set(e.map(o=>o.pick).filter(Boolean)),a=O.takes.filter(o=>!t.has(o.uid));if(!a.length){B("Every take is in use.");return}confirm("Purge "+a.length+" take"+(a.length===1?"":"s")+" the video doesn\u2019t use (earlier attempts and outdated takes)?")&&(await Rc(a),B("Purged "+a.length+" unused take"+(a.length===1?"":"s")+"."))};document.getElementById("rv-clean").onclick=async()=>{if(!O.takes.length||!confirm("Purge all "+O.takes.length+" takes of this deck from this browser? Download the video first if you need it."))return;let e=new Set(O.takes.map(t=>t.clip.split("/")[0]));O.takes=[],O.picks={},da();for(let t of e)await vr(t);k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,At(),B("All takes purged."),Qe()};document.getElementById("rv-clean-every").onclick=async()=>{let e,t=0,a=0;try{e=await navigator.storage.getDirectory()}catch{return}let o=async s=>{for await(let l of s.values())l.kind==="directory"?await o(l):(a++,t+=(await l.getFile()).size)};try{await o(await e.getDirectoryHandle("slidetake-takes"))}catch{}let r=[];try{for(let s=0;s<localStorage.length;s++){let l=localStorage.key(s);l&&l.startsWith("slidetake:board:")&&r.push(l)}}catch{}let n=r.filter(s=>{try{return JSON.parse(localStorage.getItem(s)||"{}").takes.length>0}catch{return!1}}).length;if(!a){B("No takes are kept in this browser.");return}let i=t>1e9?(t/1e9).toFixed(1)+" GB":Math.max(1,Math.round(t/1e6))+" MB";if(confirm("Purge "+i+" of takes ("+a+" file"+(a===1?"":"s")+") from "+(n||"no")+" deck"+(n===1?"":"s")+" and any left behind? Every deck loses its takes; download the videos you need first.")){try{await e.removeEntry("slidetake-takes",{recursive:!0})}catch{}r.forEach(s=>{try{localStorage.removeItem(s)}catch{}}),U("slidetake:sessions",JSON.stringify(no().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),O=null,$o="",tt(),Da.clear(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,At(),Qe(),B("Purged "+i+" of takes from every deck.")}};qt=null,Qo=0,Zo=!1;k.addEventListener("error",async()=>{if(k.getAttribute("src")){if(qt&&Qo<5){Qo++,B("Reloading "+Fe+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{ha(await po(qt),qt,!0);return}catch{}}B(qt?"Chrome cannot play "+Fe+". 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 "+(Fe||"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.",{warn:!0})}});Gt=document.getElementById("rv-file-input");Gt.addEventListener("change",()=>{Gt.files[0]&&ha(Gt.files[0]),Gt.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Gt.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});B("Opening "+e.name+"\u2026"),ha(await po(e),e)}catch(e){(!e||e.name!=="AbortError")&&B("Could not open that file.",{warn:!0})}};is=document.getElementById("rv-folder");window.showDirectoryPicker||(is.style.display="none");is.onclick=async()=>{let e=N&&st(N.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(ns("obs-folder",t),!e){B("Folder remembered. This session has no file name from OBS; open the file instead.");return}let a=await t.getFileHandle(e);ha(await po(a),a)}catch{}};nc()&&new URLSearchParams(location.search).get("obs")&&fr();Ce=document.getElementById("btn-camera"),Vt=document.getElementById("pip-msg"),Na=null,ss=P.querySelector("span");Nc='<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>';Ce.onclick=()=>pa(re);Mr();Jn=null;window.addEventListener("pointermove",ds);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?Et("Stopped: the browser left fullscreen"):K&&ve(!1))});be=document.getElementById("help");new MutationObserver(()=>cs(document.getElementById("btn-keys"),be.classList.contains("open"))).observe(be,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=Y.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!k.paused&&k.pause()}).observe(Y,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>be.classList.add("open");document.getElementById("help-close").onclick=()=>be.classList.remove("open");be.addEventListener("click",e=>{e.target===be&&be.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||ea();return}if(h.active){wc(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&Bt();if(e.key==="Escape")la();else if(Y.classList.contains("open")&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!/^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName||"")){let r=e.key.toLowerCase(),n=r==="r"?o?"setup-record":"rv-rec":o?"":r==="p"?"rv-play-final":r==="d"?et()?"rv-ffmpeg-copy":"rv-render-btn":"",i=n?document.getElementById(n):null;i&&!i.disabled&&(e.preventDefault(),i.click())}return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(be.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&be.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),De(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),De(-1)):a==="ArrowDown"?(e.preventDefault(),Zl()):a==="ArrowUp"?(e.preventDefault(),Ql()):a==="Home"?g.length&&j(g[0]):a==="End"?g.length&&j(g[g.length-1]):a==="o"||a==="O"?Xl():a==="e"||a==="E"?oo():a==="f"||a==="F"||a==="p"||a==="P"?ve(!K):a==="r"||a==="R"?gr():a==="s"||a==="S"?ea():/^[1-4]$/.test(a)?dr(rr[+a-1]):a==="c"||a==="C"?pa(re):a==="v"||a==="V"?ll():a==="l"||a==="L"?ai():a==="+"||a==="="?jn(1):a==="-"||a==="_"?jn(-1):a==="?"||a==="/"||a==="k"||a==="K"?be.classList.add("open"):a==="Escape"&&!yi()&&K&&ve(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=ga(location.hash);if(e&&!(E&&E.kind==="share"&&e===E.data)){location.reload();return}t&&t!==f&&u.has(t)&&j(t)});$n="";new ResizeObserver(()=>{let e=H.clientWidth+"x"+H.clientHeight;e!==$n&&($n=e,vt(),xe(!0))}).observe(H);gt=document.createElement("div");gt.id="toast";gt.setAttribute("role","status");document.body.appendChild(gt);Xn=null;Hc=document.getElementById("open-dialog"),tr=document.getElementById("open-url"),ar=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{ar.hidden=!0,sa(Hc),tr.focus(),tr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=on(tr.value);if(!t){ar.textContent="That doesn't look like a link.",ar.hidden=!1;return}location.href=er(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await jc(f&&f!==g[0]?f:""),a=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),oa(a,5e3)}catch{prompt("Copy this link:",e)}E.kind==="copy"&&(I.exported=I.text,ua(),Ot())};Qn=W("slidetake:layout");J=rr.includes(Qn)?Qn:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));Za=new URLSearchParams(location.search);rr.includes(Za.get("layout"))&&(J=Za.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J)));if(_){let e=(Array.isArray(_.trail)?_.trail:_.back?[_.back]:[]).filter(r=>r&&r.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((r,n)=>(n?'<span class="sep" aria-hidden="true">|</span>':"")+(r.url?'<a href="'+A(r.url)+'">'+A(r.label)+"</a>":"<span>"+A(r.label)+"</span>")).join("")+"</nav>");let a=document.createElement("a");a.id="credit",a.href="https://slidetake.com",a.target="_blank",a.rel="noopener",a.title="Made with Slidetake",a.setAttribute("aria-label","Made with Slidetake"),a.innerHTML=or+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),Ze||(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=()=>ve(!K))}ee=cn(location.pathname,location.search,location.hash),Zn=ee.page==="pick"?"":ee.slide,E=null,I=dn(W("slidetake:copy"))||_c();window.addEventListener("popstate",()=>location.reload());he&&window.EventSource&&(new EventSource(he.events).onmessage=async e=>{if(!Tr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===he.file){let a=await(await fetch(he.deck,{cache:"no-store"})).text();if(a===ie.value)return;ie.value=E.text=a,wt(!0);return}se.querySelectorAll("img").forEach(a=>{let o=new URL(a.src);decodeURIComponent(o.pathname).endsWith("/"+t)&&(o.searchParams.set("t",String(Date.now())),a.src=o.href)})});(Za.get("edit")==="1"||ee.page==="edit"&&I&&Za.get("edit")!=="0")&&oo();Vc().then(e=>(ie.value=e,Ot(),ri(ie.value),ci(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(to),ra(),j(u.has(Zn)?Zn:g[0],!0)})});var Ar=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1421
|
+
`+e,No={};Je=0,Ho=null;Xe=document.getElementById("progress");Xe.innerHTML="<b></b><i></i>";He={start:0,timer:null};oc=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];Ct=null;ue=null,ki=null,Be=!1;Qe=null;Ce=null;qo.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!h.active&&_(t.dataset.id)});Ra=null;ie.addEventListener("input",()=>{if(zr()){M.text=ie.value,clearTimeout(Ra),Ra=setTimeout(()=>{Zc(ie.value),Mt(!0)},300);return}M.kind!=="copy"&&!Xc()||(P.text=ie.value,Ft(),clearTimeout(Ra),Ra=setTimeout(()=>{ya(),Mt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==J&&fr(e.dataset.mode)})});(function(){let e=new Map,t=0,a=!1,o=null,r=()=>{let[i,s]=[...e.values()];return Math.hypot(i.x-s.x,i.y-s.y)||1};N.addEventListener("pointerdown",i=>{i.pointerType==="mouse"&&i.button!==0||h.active||i.target.closest("a, pre, code, input, textarea")||(e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t=0,a=!1,e.size===2&&(o={d:r(),zoom:z.zoom}))}),window.addEventListener("pointermove",i=>{let s=e.get(i.pointerId);if(!s)return;let l=i.clientX-s.x,c=i.clientY-s.y;e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t+=Math.abs(l)+Math.abs(c),!a&&t>5&&(a=!0,pr(),N.classList.add("dragging")),a&&(e.size===2&&o?z.zoom=Mi(o.zoom*r()/o.d):(z.x-=l/z.zoom,z.y-=c/z.zoom),Et())});let n=i=>{e.delete(i.pointerId),e.size<2&&(o=null),e.size||N.classList.remove("dragging")};window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),N.addEventListener("click",i=>{a&&(i.stopPropagation(),i.preventDefault(),a=!1)},!0)})();N.addEventListener("wheel",e=>{e.preventDefault(),!h.active&&Ti(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>je(-1);document.getElementById("nav-next").onclick=()=>je(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 a=new FileReader;a.onload=()=>{bs("a copy of "+t.name)&&(P=xa(String(a.result),{kind:"file",name:t.name},{exported:!0}),ya(),Ne=null,m=null,Qc())},a.readAsText(t),e.target.value=""});document.getElementById("btn-save").onclick=()=>{let e=new Blob([ie.value],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=(et[0]?ht(u.get(et[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),M.kind==="copy"&&(P.exported=P.text,ya(),Ft())};document.getElementById("btn-reset").onclick=()=>{M.kind!=="copy"||Sa(P)||confirm("Discard your edits and go back to "+Ee(P.origin)+" as it was?")&&(P.text=P.originText,ya(),ie.value=P.text,m=null,Mt(!0),Ft())};document.getElementById("btn-edit-toggle").onclick=so;jo=document.querySelector("main"),ft=document.getElementById("editor-resizer"),Kn=parseFloat(j("slidetake:editorWidth"));Kn&&Ue.style.setProperty("--editor-w",Kn+"px");ft.addEventListener("pointerdown",e=>{e.preventDefault(),ft.setPointerCapture(e.pointerId),jo.classList.add("resizing");let t=jo.getBoundingClientRect().right,a=r=>{let n=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-r.clientX)));Ue.style.setProperty("--editor-w",n+"px")},o=()=>{jo.classList.remove("resizing"),ft.removeEventListener("pointermove",a),W("slidetake:editorWidth",String(Ue.getBoundingClientRect().width))};ft.addEventListener("pointermove",a),ft.addEventListener("pointerup",o,{once:!0})});ft.addEventListener("dblclick",()=>{Ue.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=ci;document.getElementById("btn-present").onclick=()=>ve(!K);dc="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",Jn=["ArrowRight","PageDown"," ","ArrowDown","Enter"],$n=["ArrowLeft","PageUp","ArrowUp","r","R"],Xn=["b","B","."],Y=document.getElementById("review"),Kt=document.getElementById("rec-countdown"),Xo=document.getElementById("rec-paused"),Va=document.getElementById("obs-host"),Ya=document.getElementById("obs-port"),Ka=document.getElementById("obs-pass"),gr=document.getElementById("obs-remember"),Zt=document.getElementById("obs-status"),ne=null,Oe=!1,Ze=null,yr=null,Li="",h={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null,browser:null},oa=e=>new Promise(t=>setTimeout(t,e)),ra=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),oa(100)]);hc="G-3S9FY4MQLS",br=document.getElementById("analytics-dialog"),pc=()=>j("slidetake:analytics")!=="off";br.querySelectorAll("[data-analytics]").forEach(e=>e.onclick=()=>uc(e.dataset.analytics==="on"));Bi=document.getElementById("btn-analytics");Bi.hidden=!/^(www\.)?slidetake\.com$/.test(location.hostname);Bi.onclick=()=>{Ai(),pa(br)};document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});fc=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);yc="Run OBS on this computer and connect to localhost: a secure (https) page can't reach OBS at any other address.";document.getElementById("obs-connect").onclick=vr;gr.addEventListener("change",Oi);vc="https://cdn.jsdelivr.net/npm/mediabunny@1.64.0/+esm",bt=document.getElementById("rec-cam"),Lt=document.getElementById("rec-mic"),At=document.getElementById("rec-quality"),Qo=document.getElementById("rec-meter"),yt=document.getElementById("rec-browser-check"),vt=document.getElementById("rec-wave"),me=j("slidetake:rec-mode")||"",Fa="",he=null;Zo=0;wr=document.getElementById("rec-cam-preview"),Da=document.getElementById("rec-cam-none"),Na=null,er=0;Lt.onchange=()=>{W("slidetake:mic",Lt.value),Ja(),Ve()};Xa=document.getElementById("rec-mirror");Xa.onchange=()=>{W("slidetake:mirror",Xa.checked?"on":"off"),xr(),Ie()};xr();bt.onchange=()=>{xc(bt.value),bt.value!=="none"&&re&&(Ir(),lt()),Rt()&&Pi(),Ve()};wc=()=>(R.pip||"none").toLowerCase()!=="none"||!!R.camera||[...u.values()].some(e=>e.camera),Ri=()=>"slidetake:rec-cam:"+qe();At.onchange=()=>{W("slidetake:quality",At.value),Ve()};it=()=>!(Se().ok&&(me||"browser")==="browser");document.getElementById("btn-studio").onclick=()=>na();Cc=()=>!!me||st().takes.length>0||co().some(e=>e.key===qe());document.getElementById("btn-record").onclick=()=>Sr();Ni=e=>({width:e.w,height:e.h,aspectRatio:16/9,frameRate:qt,resizeMode:"crop-and-scale"});tt=!1;Qn=600;We="";zc=e=>En(e,Ui),Rc=(e,t)=>Cn(e,t,{input:e.outputPath||We||"recording.mov",outputName:qe()+"-final.mp4",sectionOf:Ui,loudness:at()}),qi=document.querySelectorAll(".rv-loud"),at=()=>j("slidetake:loudness")!=="off",Gi=()=>qi.forEach(e=>{e.setAttribute("aria-pressed",String(at())),e.classList.toggle("on",at())}),tr=document.getElementById("rv-limiter"),sa=()=>j("slidetake:limiter")==="on",Vi=()=>{tr.setAttribute("aria-pressed",String(sa())),tr.classList.toggle("on",sa())};Vi();tr.onclick=()=>{W("slidetake:limiter",sa()?"off":"on"),Vi()};Yi=()=>j("slidetake:mic-sound")==="raw"?"raw":"voice",Ki=e=>({...e?{deviceId:{ideal:e}}:{},echoCancellation:!1,autoGainControl:!1,noiseSuppression:Yi()==="voice"}),Ji=document.querySelectorAll("[data-sound]"),$i=()=>Ji.forEach(e=>{let t=e.dataset.sound===Yi();e.classList.toggle("active",t),e.setAttribute("aria-checked",String(t))});$i();Ji.forEach(e=>e.onclick=()=>{W("slidetake:mic-sound",e.dataset.sound),$i(),he&&Ja()});Gi();qi.forEach(e=>e.onclick=()=>{W("slidetake:loudness",at()?"off":"on"),Gi(),H&&ho()});H=null,Z=null,k=document.getElementById("rv-video"),Yt=document.getElementById("rv-now");Ha=-1,Xi=()=>{let e=Ia(v,ze).length;return e?e+"/"+v.length+" slide"+(e===1?"":"s")+" up for a take":""};Zi="";document.getElementById("rv-chapters").onclick=e=>ts(e.currentTarget,Zi);document.getElementById("rv-ffmpeg-copy").onclick=e=>{!H||!H.events.length||(ts(e.currentTarget,Rc(H,document.getElementById("rv-mode").value)),O("Copied the ffmpeg command: run it in a terminal, in the folder with "+(ut(H.outputPath)||"the recording")+"."))};ja=new Map,Wo=0;Za=document.getElementById("rv-fps");Za.onchange=()=>{H&&(H.fps=parseFloat(Za.value),Tr(H),ho())};eo=null;k.addEventListener("timeupdate",()=>{if(!Z)return;let e=Z.ranges[Z.i];if(k.currentTime*1e3<e.end)return;if(Z.i++,Z.i>=Z.ranges.length){k.pause(),Z=null,O("");return}let t=Z.ranges[Z.i];k.currentTime=t.start/1e3,O("\u25B6 "+t.title)});os=document.getElementById("rv-play-final"),wt=null;os.onclick=()=>{if(!H)return;if(!H.inBrowser){to(Ut(H).map(a=>({start:a.start,end:a.end,title:a.title})));return}if(F&&!F.single){k.paused?k.play().catch(()=>{}):k.pause();return}let e=Gt(H),t=Math.max(0,wt?e.findIndex(a=>a.id===wt):0);wt=null,po(e.slice(t))};k.addEventListener("play",Lr);k.addEventListener("pause",()=>{F&&F.single&&k.currentTime<F.parts[0].keep-.05&&(wt=F.parts[0].id,O("Preview starts from "+F.parts[0].title.replace(/ · take \d+$/,"")+".")),Lr()});F=null;k.addEventListener("timeupdate",()=>{F&&k.currentTime>=F.parts[F.i].keep&&ns()});k.addEventListener("ended",()=>{F&&ns()});ao=document.getElementById("rv-render-btn");ao.onclick=()=>ss(!1);is=0,$e=e=>{clearTimeout(is),e?ao.textContent=e:ao.innerHTML='\u2193 <span><u class="key">D</u>ownload</span>'},_o=e=>e.where?"\u201C"+e.where+"\u201D as "+e.name:"your downloads as "+e.name;Hc=e=>{let t=a=>String(a).padStart(2,"0");return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+"-"+t(e.getMinutes())+"-"+t(e.getSeconds())};document.getElementById("rv-folder-change").onclick=async()=>{try{let e=await ls(!0);e&&O("Videos now go to "+e.name+".")}catch{}};I=null,ar="",ei=null,ze=new Set,cs=()=>"slidetake:board:"+qe();fa=()=>W(cs(),JSON.stringify(I)),jc=e=>{let t=u.get(e);return t?zn(t.title+`
|
|
1422
|
+
`+t.html):""},uo=()=>Rn(v,e=>({title:u.get(e).title,fp:jc(e)}));ot=document.getElementById("rv-setup-btn"),ti=document.getElementById("setup-note"),Rt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||fo()}).observe(Y,{attributes:!0,attributeFilter:["class"]});ot.onclick=()=>{Rt()?fo():mo()};document.getElementById("setup-record").onclick=()=>{ua(),me||(me=it()?"obs":"browser",W("slidetake:rec-mode",me)),Sr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&lo()});Wa=(()=>{let e=(navigator.userAgentData&&navigator.userAgentData.brands||[]).map(a=>a.brand).filter(a=>!/chromium|not.?a.?brand/i.test(a));if(e.length)return e[0].replace(/^(Google|Microsoft) /,"");let t=navigator.userAgent;return/Firefox\//.test(t)?"Firefox":/Edg\//.test(t)?"Edge":/OPR\//.test(t)?"Opera":/Chrome\//.test(t)?"Chrome":/Safari\//.test(t)?"Safari":"this browser"})();document.querySelectorAll(".browser-name").forEach(e=>{e.textContent=Wa});document.getElementById("rv-rec").onclick=()=>{if(!it()){Qa("browser",Ia(v,ze));return}if(Oe){Qa("obs");return}or({note:"Connect to OBS first: OBS \u2192 Connect."})};gt=document.getElementById("rv-pro");gt.onclick=()=>{Se().ok&&Sc(it()?"browser":"obs")};document.querySelectorAll(".rv-purge .rv-menu button").forEach(e=>e.addEventListener("click",()=>{e.closest("details").open=!1}));document.getElementById("rv-clean-unused").onclick=async()=>{let{rows:e}=ds(),t=new Set(e.map(o=>o.pick).filter(Boolean)),a=I.takes.filter(o=>!t.has(o.uid));if(!a.length){O("Every take is in use.");return}confirm("Purge "+a.length+" take"+(a.length===1?"":"s")+" the video doesn\u2019t use (earlier attempts and outdated takes)?")&&(await qc(a),O("Purged "+a.length+" unused take"+(a.length===1?"":"s")+"."))};document.getElementById("rv-clean").onclick=async()=>{if(!I.takes.length||!confirm("Purge all "+I.takes.length+" takes of this deck from this browser? Download the video first if you need it."))return;let e=new Set(I.takes.map(t=>t.clip.split("/")[0]));I.takes=[],I.picks={},fa();for(let t of e)await Cr(t);k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,zt(),O("All takes purged."),nt()};document.getElementById("rv-clean-every").onclick=async()=>{let e,t=0,a=0;try{e=await navigator.storage.getDirectory()}catch{return}let o=async s=>{for await(let l of s.values())l.kind==="directory"?await o(l):(a++,t+=(await l.getFile()).size)};try{await o(await e.getDirectoryHandle("slidetake-takes"))}catch{}let r=[];try{for(let s=0;s<localStorage.length;s++){let l=localStorage.key(s);l&&l.startsWith("slidetake:board:")&&r.push(l)}}catch{}let n=r.filter(s=>{try{return JSON.parse(localStorage.getItem(s)||"{}").takes.length>0}catch{return!1}}).length;if(!a){O("No takes are kept in this browser.");return}let i=t>1e9?(t/1e9).toFixed(1)+" GB":Math.max(1,Math.round(t/1e6))+" MB";if(confirm("Purge "+i+" of takes ("+a+" file"+(a===1?"":"s")+") from "+(n||"no")+" deck"+(n===1?"":"s")+" and any left behind? Every deck loses its takes; download the videos you need first.")){try{await e.removeEntry("slidetake-takes",{recursive:!0})}catch{}r.forEach(s=>{try{localStorage.removeItem(s)}catch{}}),W("slidetake:sessions",JSON.stringify(co().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),I=null,ar="",st(),ja.clear(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,zt(),nt(),O("Purged "+i+" of takes from every deck.")}};Jt=null,rr=0,nr=!1;k.addEventListener("error",async()=>{if(k.getAttribute("src")){if(Jt&&rr<5){rr++,O("Reloading "+We+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{ga(await go(Jt),Jt,!0);return}catch{}}O(Jt?"Chrome cannot play "+We+". 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 "+(We||"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.",{warn:!0})}});$t=document.getElementById("rv-file-input");$t.addEventListener("change",()=>{$t.files[0]&&ga($t.files[0]),$t.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return $t.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});O("Opening "+e.name+"\u2026"),ga(await go(e),e)}catch(e){(!e||e.name!=="AbortError")&&O("Could not open that file.",{warn:!0})}};us=document.getElementById("rv-folder");window.showDirectoryPicker||(us.style.display="none");us.onclick=async()=>{let e=H&&ut(H.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(ps("obs-folder",t),!e){O("Folder remembered. This session has no file name from OBS; open the file instead.");return}let a=await t.getFileHandle(e);ga(await go(a),a)}catch{}};mc()&&new URLSearchParams(location.search).get("obs")&&vr();Te=document.getElementById("btn-camera"),Xt=document.getElementById("pip-msg"),_a=null,ms=B.querySelector("span");Yc='<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>';Te.onclick=()=>Dt(te);Pr();ai=null;window.addEventListener("pointermove",ys);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?Bt("Stopped: the browser left fullscreen"):K&&ve(!1))});we=document.getElementById("help");new MutationObserver(()=>gs(document.getElementById("btn-keys"),we.classList.contains("open"))).observe(we,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=Y.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!k.paused&&k.pause()}).observe(Y,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>we.classList.add("open");document.getElementById("help-close").onclick=()=>we.classList.remove("open");we.addEventListener("click",e=>{e.target===we&&we.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||na();return}if(h.active){Ac(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&Rt();if(e.key==="Escape")ua();else if(Y.classList.contains("open")&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!/^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName||"")){let r=e.key.toLowerCase(),n=r==="r"?o?"setup-record":"rv-rec":o?"":r==="p"?"rv-play-final":r==="d"?it()?"rv-ffmpeg-copy":"rv-render-btn":"",i=n?document.getElementById(n):null;i&&!i.disabled&&(e.preventDefault(),i.click())}return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(we.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&we.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),je(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),je(-1)):a==="ArrowDown"?(e.preventDefault(),lc()):a==="ArrowUp"?(e.preventDefault(),sc()):a==="Home"?v.length&&_(v[0]):a==="End"?v.length&&_(v[v.length-1]):a==="o"||a==="O"?ic():a==="e"||a==="E"?so():a==="f"||a==="F"||a==="p"||a==="P"?ve(!K):a==="r"||a==="R"?Sr():a==="s"||a==="S"?na():/^[1-4]$/.test(a)?fr(dr[+a-1]):a==="c"||a==="C"?Dt(te):a==="v"||a==="V"?yl():a==="l"||a==="L"?ci():a==="+"||a==="="?Yn(1):a==="-"||a==="_"?Yn(-1):a==="?"||a==="/"||a==="k"||a==="K"?we.classList.add("open"):a==="Escape"&&!Ei()&&K&&ve(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=wa(location.hash);if(e&&!(M&&M.kind==="share"&&e===M.data)){location.reload();return}t&&t!==m&&u.has(t)&&_(t)});oi="";new ResizeObserver(()=>{let e=N.clientWidth+"x"+N.clientHeight;e!==oi&&(oi=e,Et(),ke(!0))}).observe(N);kt=document.createElement("div");kt.id="toast";kt.setAttribute("role","status");document.body.appendChild(kt);ri=null;Kc=document.getElementById("open-dialog"),sr=document.getElementById("open-url"),lr=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{lr.hidden=!0,pa(Kc),sr.focus(),sr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=hn(sr.value);if(!t){lr.textContent="That doesn't look like a link.",lr.hidden=!1;return}location.href=ir(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await Jc(m&&m!==v[0]?m:""),a=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),la(a,5e3)}catch{prompt("Copy this link:",e)}M.kind==="copy"&&(P.exported=P.text,ya(),Ft())};ni=j("slidetake:layout");J=dr.includes(ni)?ni:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));oo=new URLSearchParams(location.search);dr.includes(oo.get("layout"))&&(J=oo.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J)));if(U){let e=(Array.isArray(U.trail)?U.trail:U.back?[U.back]:[]).filter(r=>r&&r.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((r,n)=>(n?'<span class="sep" aria-hidden="true">|</span>':"")+(r.url?'<a href="'+A(r.url)+'">'+A(r.label)+"</a>":"<span>"+A(r.label)+"</span>")).join("")+"</nav>");let a=document.createElement("a");a.id="credit",a.href="https://slidetake.com",a.target="_blank",a.rel="noopener",a.title="Made with Slidetake",a.setAttribute("aria-label","Made with Slidetake"),a.innerHTML=cr+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),Ge||(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=()=>ve(!K))}ee=gn(location.pathname,location.search,location.hash),ii=ee.page==="pick"?"":ee.slide,M=null,P=yn(j("slidetake:copy"))||$c();window.addEventListener("popstate",()=>location.reload());pe&&window.EventSource&&(new EventSource(pe.events).onmessage=async e=>{if(!zr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===pe.file){let a=await(await fetch(pe.deck,{cache:"no-store"})).text();if(a===ie.value)return;ie.value=M.text=a,Mt(!0);return}se.querySelectorAll("img").forEach(a=>{let o=new URL(a.src);decodeURIComponent(o.pathname).endsWith("/"+t)&&(o.searchParams.set("t",String(Date.now())),a.src=o.href)})});(oo.get("edit")==="1"||ee.page==="edit"&&P&&oo.get("edit")!=="0")&&so();td().then(e=>(ie.value=e,Ft(),hi(ie.value),gi(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(no),ca(),_(u.has(ii)?ii:v[0],!0),Ge&&j("slidetake:camera")==="on"&&Dt(!0,!0)})});var Dr=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1322
1423
|
deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
|
|
1323
1424
|
its own (accent: in its top block); see applyColors in app.js. */
|
|
1324
1425
|
:root{
|
|
@@ -1741,7 +1842,8 @@ EOF
|
|
|
1741
1842
|
#rv-setup{margin:8px 0 0;}
|
|
1742
1843
|
/* the chosen camera, live, as a recording would see it (mirrored like the camera box), and the mic's waveform */
|
|
1743
1844
|
.setup-cam{position:relative;aspect-ratio:16/9;background:#000;border-radius:8px;overflow:hidden;border:1px solid var(--panel-line);}
|
|
1744
|
-
.setup-cam video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;
|
|
1845
|
+
.setup-cam video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;}
|
|
1846
|
+
.setup-cam.mirror video{transform:scaleX(-1);}
|
|
1745
1847
|
.setup-cam span{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;color:#a1a1aa;}
|
|
1746
1848
|
.setup-cam span[hidden]{display:none;}
|
|
1747
1849
|
.setup-wave{display:block;width:100%;height:60px;border-radius:8px;border:1px solid var(--panel-line);
|
|
@@ -1997,7 +2099,7 @@ EOF
|
|
|
1997
2099
|
html.embed.no-record #navbar{display:flex;}
|
|
1998
2100
|
html.embed.no-record #navbar > :not(.touch-only){display:none !important;}
|
|
1999
2101
|
}
|
|
2000
|
-
html.no-record #btn-camera, html.no-record #btn-studio, html.no-record #btn-record, html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
|
|
2102
|
+
html.no-record #btn-camera, html.no-record #btn-studio, html.no-record #btn-record, html.no-record #pip:not(.empty), html.no-record #help tr.rec{display:none !important;}
|
|
2001
2103
|
/* the logo written into a heading: #  Slidetake */
|
|
2002
2104
|
.node .body :is(h1,h2) img[src$="favicon.svg"]{height:1em;width:auto;vertical-align:-.12em;margin-right:.25em;display:inline;}
|
|
2003
2105
|
#brand .st-mark{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:700;font-size:20px;color:var(--text);}
|
|
@@ -2028,13 +2130,63 @@ EOF
|
|
|
2028
2130
|
#pip.bottom-right{bottom:16px;right:16px;}
|
|
2029
2131
|
/* full: the camera takes the whole stage, under the brand and the controls */
|
|
2030
2132
|
/* it also swallows clicks, so a click can't land on the hidden cards behind it */
|
|
2031
|
-
#pip.full{inset:0;width:100
|
|
2133
|
+
#pip.full{inset:0;width:100%;height:100%;aspect-ratio:auto;border-radius:0;z-index:9;pointer-events:auto;}
|
|
2032
2134
|
/* behind: the camera fills the frame under the slides, which stay on top as cards; the stage's dotted
|
|
2033
2135
|
background makes way so the camera shows around them */
|
|
2034
2136
|
#pip.full.behind{z-index:0;pointer-events:none;box-shadow:none;}
|
|
2137
|
+
/* split screen (a solid card): the camera fills what the card leaves, centred there, and glides into it */
|
|
2138
|
+
/* behind a split screen the frame is the card's colour, so as the words and the camera pass each other on a
|
|
2139
|
+
swap, the edges they uncover read as card */
|
|
2140
|
+
#stage-wrap.cam-solid{background:var(--panel);}
|
|
2141
|
+
#stage-wrap.cam-solid[data-place="left"] #pip.full.behind{left:50%;width:50%;}
|
|
2142
|
+
#stage-wrap.cam-solid[data-place="right"] #pip.full.behind{right:50%;width:50%;}
|
|
2143
|
+
#stage-wrap.cam-solid[data-place="top"] #pip.full.behind{top:25%;height:75%;}
|
|
2144
|
+
#stage-wrap.cam-solid[data-place="bottom"] #pip.full.behind{bottom:25%;height:75%;}
|
|
2145
|
+
/* the camera behind the slide while it is off: an empty frame with a faint person where you'd be */
|
|
2146
|
+
#stage-wrap #pip.empty{border:none;background:color-mix(in srgb, var(--text) 6%, var(--bg)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23fff' fill-opacity='.07'%3E%3Ccircle cx='50' cy='40' r='15'/%3E%3Cpath d='M18 100c0-22 14-36 32-36s32 14 32 36z'/%3E%3C/g%3E%3C/svg%3E") 50% 100%/auto 70% no-repeat;}
|
|
2147
|
+
body[data-mode="light"] #stage-wrap #pip.empty{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23000' fill-opacity='.06'%3E%3Ccircle cx='50' cy='40' r='15'/%3E%3Cpath d='M18 100c0-22 14-36 32-36s32 14 32 36z'/%3E%3C/g%3E%3C/svg%3E");}
|
|
2148
|
+
/* the person stands where the words leave room */
|
|
2149
|
+
#stage-wrap[data-place="left"] #pip.empty{background-position:76% 100%;}
|
|
2150
|
+
#stage-wrap[data-place="right"] #pip.empty{background-position:24% 100%;}
|
|
2151
|
+
#pip.empty:not(.msg) > span{position:absolute;left:50%;bottom:4%;transform:translateX(-50%);font-size:0;}
|
|
2152
|
+
#pip.empty:not(.msg) > span::after{content:"Camera off \xB7 press C";font-size:12px;color:var(--text);opacity:.45;letter-spacing:.08em;}
|
|
2153
|
+
html.no-record #pip.empty > span{display:none;}
|
|
2035
2154
|
#stage-wrap.cam-behind #stage{z-index:1;background:transparent;}
|
|
2036
|
-
/*
|
|
2037
|
-
|
|
2155
|
+
/* behind: the slide's content in regions around the person (the card itself steps aside), in the deck's own
|
|
2156
|
+
colours, light or dark, camera on or off. A card under the words (half see-through unless set) keeps them
|
|
2157
|
+
readable; with card 0% they sit straight on the video, and diagrams, charts and table cells keep a pane */
|
|
2158
|
+
#cam-overlay{position:absolute;inset:0;z-index:2;pointer-events:none;display:none;color:var(--text);}
|
|
2159
|
+
#stage-wrap.cam-live:not(.cam-card) #cam-overlay .cam-media :is(.diagram, .echarts-container){
|
|
2160
|
+
background:color-mix(in srgb, var(--bg) 85%, transparent);border-radius:14px;padding:14px;}
|
|
2161
|
+
#stage-wrap.cam-live:not(.cam-card) #cam-overlay .body :is(th, td){background:color-mix(in srgb, var(--bg) 70%, transparent);}
|
|
2162
|
+
#stage-wrap:not([data-place=""])[data-place] #cam-overlay{display:block;}
|
|
2163
|
+
#stage-wrap:not([data-place=""])[data-place] #world{opacity:0;}
|
|
2164
|
+
/* the card under the words: half see-through, solid (no camera through it) or clear (none, kept off the edges) */
|
|
2165
|
+
#cam-overlay .cam-box{position:absolute;display:flex;flex-direction:column;gap:3%;box-sizing:border-box;padding:1.2%;
|
|
2166
|
+
border-radius:18px;background:color-mix(in srgb, var(--panel) calc(var(--cam-card, 0) * 100%), transparent);}
|
|
2167
|
+
#cam-overlay .cam-box.left{left:4%;top:8%;width:42%;height:84%;}
|
|
2168
|
+
#cam-overlay .cam-box.right{right:4%;top:8%;width:42%;height:84%;}
|
|
2169
|
+
#cam-overlay .cam-box.top{left:5%;top:3%;width:90%;height:22%;flex-direction:row;}
|
|
2170
|
+
#cam-overlay .cam-box.bottom{left:5%;bottom:3%;width:90%;height:22%;flex-direction:row;}
|
|
2171
|
+
/* with a card, the region fills its part of the frame edge to edge: a half or a quarter band */
|
|
2172
|
+
#stage-wrap.cam-card #cam-overlay .cam-box{border-radius:0;padding:2.5%;}
|
|
2173
|
+
#stage-wrap.cam-card #cam-overlay .cam-box.left{left:0;top:0;width:50%;height:100%;}
|
|
2174
|
+
#stage-wrap.cam-card #cam-overlay .cam-box.right{right:0;top:0;width:50%;height:100%;}
|
|
2175
|
+
#stage-wrap.cam-card #cam-overlay .cam-box.top{left:0;top:0;width:100%;height:25%;}
|
|
2176
|
+
#stage-wrap.cam-card #cam-overlay .cam-box.bottom{left:0;bottom:0;width:100%;height:25%;}
|
|
2177
|
+
/* the words take what the picture leaves: below it beside you, to its left in a band */
|
|
2178
|
+
#cam-overlay .cam-text{flex:1 1 0;min-width:0;min-height:0;display:flex;align-items:center;}
|
|
2179
|
+
#cam-overlay .cam-box.top .cam-text{align-items:flex-start;}
|
|
2180
|
+
#cam-overlay .cam-box.bottom .cam-text{align-items:flex-end;}
|
|
2181
|
+
#cam-overlay .cam-media{flex:1 1 0;min-width:0;min-height:0;position:relative;}
|
|
2182
|
+
#cam-overlay .cam-text + .cam-media{flex:0 0 55%;}
|
|
2183
|
+
#cam-overlay :is(.cam-box.top, .cam-box.bottom) .cam-text + .cam-media{flex-basis:38%;}
|
|
2184
|
+
#cam-overlay .node{background:none;border:none;padding:0;}
|
|
2185
|
+
#cam-overlay .cam-text > .node{flex:none;transform-origin:0 0;}
|
|
2186
|
+
#cam-overlay .cam-box.bottom .cam-text > .node{transform-origin:0 100%;}
|
|
2187
|
+
#cam-overlay .cam-box.left .cam-text > .node, #cam-overlay .cam-box.right .cam-text > .node{transform-origin:0 50%;}
|
|
2188
|
+
#cam-overlay .cam-media > .node{position:absolute;left:50%;top:50%;transform-origin:50% 50%;}
|
|
2189
|
+
#cam-overlay .cam-media > .node > .body > *{margin:0;}
|
|
2038
2190
|
/* while presenting the box is empty so the camera overlay sits on plain background */
|
|
2039
2191
|
/* while presenting, the empty box stays as a faint guide for lining up a camera overlay */
|
|
2040
2192
|
body.presenting #pip{border-color:color-mix(in srgb, var(--accent-teal) 30%, transparent);background:none;}
|
|
@@ -2081,7 +2233,7 @@ EOF
|
|
|
2081
2233
|
#minimap{display:none;}
|
|
2082
2234
|
#navbar .lbl{display:none;}
|
|
2083
2235
|
}
|
|
2084
|
-
`;var
|
|
2236
|
+
`;var Fr=`
|
|
2085
2237
|
<noscript>
|
|
2086
2238
|
<style>#deck-text{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal;max-width:760px;margin:24px auto;padding:0 16px;}#deck-text img{max-width:100%;height:auto;}#deck-text :is(h1,h2) img{height:1em;width:auto;vertical-align:-.12em;}#deck-text table{border-collapse:collapse;}#deck-text :is(td,th){border:1px solid #3f3f46;padding:4px 8px;}#deck-text a{color:#29b685;}</style>
|
|
2087
2239
|
<p class="deck-text-note">Slidetake needs JavaScript to present and record decks. Here is this page as text; the source is on <a href="https://github.com/slidetake/slidetake">GitHub</a>.</p>
|
|
@@ -2132,6 +2284,7 @@ EOF
|
|
|
2132
2284
|
<div id="minimap"><div class="mm-label" id="mm-label">map</div><svg id="mm-svg" width="180" height="130"></svg></div>
|
|
2133
2285
|
<div id="brand" hidden></div>
|
|
2134
2286
|
<div id="pip" hidden><span>PIP camera</span></div>
|
|
2287
|
+
<div id="cam-overlay" aria-hidden="true"></div>
|
|
2135
2288
|
<div id="pip-msg" role="status"></div>
|
|
2136
2289
|
</div>
|
|
2137
2290
|
<div id="editor-resizer" role="separator" aria-orientation="vertical" aria-label="Resize the editor" title="Drag to resize"></div>
|
|
@@ -2265,6 +2418,9 @@ EOF
|
|
|
2265
2418
|
<h4>Camera</h4>
|
|
2266
2419
|
<select id="rec-cam" aria-label="Camera"></select>
|
|
2267
2420
|
<div class="setup-cam"><video id="rec-cam-preview" muted playsinline autoplay></video><span id="rec-cam-none">No camera</span></div>
|
|
2421
|
+
<div class="rv-setup-row">
|
|
2422
|
+
<label class="check rv-setup-label" title="Flip the camera left to right, like a mirror. Off, it shows you as others see you, and words on a shirt or sign read the right way."><input type="checkbox" id="rec-mirror"> Mirror</label>
|
|
2423
|
+
</div>
|
|
2268
2424
|
<p class="rv-setup-note">Turns on by itself when recording starts. Choose No camera for slides only.</p>
|
|
2269
2425
|
</section>
|
|
2270
2426
|
<section class="for-browser">
|
|
@@ -2357,5 +2513,5 @@ EOF
|
|
|
2357
2513
|
<div id="rec-paused">Paused \xB7 press B to resume</div>
|
|
2358
2514
|
|
|
2359
2515
|
<!-- The sample deck. Plain markdown, nothing else. -->
|
|
2360
|
-
`;var
|
|
2361
|
-
<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
|
|
2516
|
+
`;var Nr=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
2517
|
+
<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 xs=e=>new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>a(new Error("could not load "+e)),document.head.appendChild(o)});async function ks(){document.head.insertAdjacentHTML("beforeend",Nr);let e=document.createElement("style");e.textContent=Dr,document.head.appendChild(e),document.body.insertAdjacentHTML("afterbegin",Fr),await Promise.all([window.gsap?null:xs("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"),window.marked?null:xs("https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js")]),await Promise.resolve().then(()=>(ws(),ad))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ks,{once:!0}):ks();})();
|