slidetake 0.5.0 → 0.5.2
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 +38 -57
- package/dist/slidetake.js +83 -36
- package/package.json +1 -1
package/dist/slidetake.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Slidetake 0.5.
|
|
2
|
-
"use strict";(()=>{var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var
|
|
1
|
+
/* Slidetake 0.5.2 · https://slidetake.com · Apache-2.0 */
|
|
2
|
+
"use strict";(()=>{var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var xo,qr=G(()=>{xo=`---
|
|
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
|
|
@@ -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 Vr,Gr=G(()=>{Vr=`---
|
|
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
|
|
@@ -396,7 +396,7 @@ Open a deck straight from a link: a GitHub file, a gist or any markdown URL. Or
|
|
|
396
396
|
| \`/gh/owner/repo@branch/deck.md\` | another branch or tag |
|
|
397
397
|
| \`/gist/<id>\` | a gist's first markdown file |
|
|
398
398
|
| \`/?src=https://\u2026/deck.md\` | anything else |
|
|
399
|
-
| \`/new\` | a template: blank, talk or
|
|
399
|
+
| \`/new\` | a template: blank, talk, recording or short (9:16) |
|
|
400
400
|
|
|
401
401
|
### On your computer
|
|
402
402
|
|
|
@@ -731,7 +731,7 @@ It stays on its slide; \`pip: behind\` makes it the whole deck's. With the camer
|
|
|
731
731
|
- a slide's words are larger, to read on a phone
|
|
732
732
|
- easy mode records the column from the middle of the screen: a Retina laptop makes 720p, a 16" one or a screen on its side 1080p
|
|
733
733
|
|
|
734
|
-
[
|
|
734
|
+
Start from the [Short template](https://slidetake.com/new?template=short): **New** \u2192 **Short**.
|
|
735
735
|
|
|
736
736
|
### Take by take
|
|
737
737
|
|
|
@@ -807,7 +807,7 @@ Every deck you open is **read-only**: Slidetake's own decks, templates, files on
|
|
|
807
807
|
No accounts, and no decks kept. Recording stays on your device.
|
|
808
808
|
|
|
809
809
|
Next, everything that leaves your browser, and where it goes: **[Privacy \u2192](/privacy)**
|
|
810
|
-
`});var
|
|
810
|
+
`});var Kr,Yr=G(()=>{Kr=`---
|
|
811
811
|
title: Slidetake Features
|
|
812
812
|
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."
|
|
813
813
|
brand: slidetake
|
|
@@ -891,7 +891,7 @@ For Safari, Firefox or any browser, a screen too small for easy mode, or whateve
|
|
|
891
891
|
|---|---|
|
|
892
892
|
| **[OBS](https://obsproject.com), driven by the deck** | it starts and stops for you; you only talk |
|
|
893
893
|
| **16:9 check** | Setup warns before a video with bars; use a 16:9 screen, physical or virtual |
|
|
894
|
-
| **Shorts and Reels** (\`format: portrait\`) | a 9:16 deck and video, the words above or below you |
|
|
894
|
+
| **Shorts and Reels** (\`format: portrait\`) | a 9:16 deck and video, the words above or below you; New \u2192 Short starts one |
|
|
895
895
|
|
|
896
896
|
## \u2702\uFE0F Edit by picking the best take
|
|
897
897
|
|
|
@@ -921,7 +921,7 @@ For Safari, Firefox or any browser, a screen too small for easy mode, or whateve
|
|
|
921
921
|
| **Open source, Apache 2.0** | read it, host it, change it: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake) |
|
|
922
922
|
|
|
923
923
|
Next, see them working: **[Showcase \u2192](/showcase)**
|
|
924
|
-
`});var
|
|
924
|
+
`});var $r,Jr=G(()=>{$r=`---
|
|
925
925
|
title: Slidetake Privacy
|
|
926
926
|
brand: slidetake
|
|
927
927
|
pip: none
|
|
@@ -992,7 +992,7 @@ A shared link carries the whole deck after \`#\`. Browsers never send that part
|
|
|
992
992
|
## \u2709\uFE0F Questions
|
|
993
993
|
|
|
994
994
|
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.
|
|
995
|
-
`});var
|
|
995
|
+
`});var Qr,Xr=G(()=>{Qr=`---
|
|
996
996
|
title: My deck
|
|
997
997
|
---
|
|
998
998
|
|
|
@@ -1007,7 +1007,7 @@ Every heading is a card. \`##\` sections branch from the first card.
|
|
|
1007
1007
|
### A detail
|
|
1008
1008
|
|
|
1009
1009
|
\`###\` branches from the section above it.
|
|
1010
|
-
`});var
|
|
1010
|
+
`});var en,Zr=G(()=>{en=`---
|
|
1011
1011
|
title: Talk title
|
|
1012
1012
|
duration: 15m
|
|
1013
1013
|
---
|
|
@@ -1048,7 +1048,7 @@ Something concrete the audience will recognise.
|
|
|
1048
1048
|
## \u{1F64F} Thank you
|
|
1049
1049
|
|
|
1050
1050
|
Where to find you, and the link to these slides.
|
|
1051
|
-
`});var
|
|
1051
|
+
`});var an,tn=G(()=>{an=`---
|
|
1052
1052
|
title: Video title
|
|
1053
1053
|
duration: 10m
|
|
1054
1054
|
pip: bottom-right
|
|
@@ -1097,7 +1097,53 @@ Slides you talk over in the corner.
|
|
|
1097
1097
|
<!-- camera: on, full, on, off -->
|
|
1098
1098
|
|
|
1099
1099
|
Ends on you full screen, then back to the slide, then without the camera.
|
|
1100
|
-
`});var
|
|
1100
|
+
`});var rn,on=G(()=>{rn=`---
|
|
1101
|
+
title: My Short
|
|
1102
|
+
description: "A portrait (9:16) deck for Shorts and Reels: one markdown file, the camera behind the words."
|
|
1103
|
+
format: portrait
|
|
1104
|
+
pip: behind bottom
|
|
1105
|
+
---
|
|
1106
|
+
|
|
1107
|
+
# A hook in one line
|
|
1108
|
+
|
|
1109
|
+
What the viewer gets, in under a minute.
|
|
1110
|
+
|
|
1111
|
+
## The first point
|
|
1112
|
+
|
|
1113
|
+
<!-- camera: behind top -->
|
|
1114
|
+
|
|
1115
|
+
The words above, you below. Keep each slide to a line or two.
|
|
1116
|
+
|
|
1117
|
+
## Split screen
|
|
1118
|
+
|
|
1119
|
+
<!-- camera: behind top solid, behind bottom solid -->
|
|
1120
|
+
|
|
1121
|
+
\`solid\` hides the camera behind the card. Press \u2192 and you swap places.
|
|
1122
|
+
|
|
1123
|
+
## A number that matters
|
|
1124
|
+
|
|
1125
|
+
<!-- camera: behind top -->
|
|
1126
|
+
|
|
1127
|
+
\`\`\`echarts
|
|
1128
|
+
{
|
|
1129
|
+
"xAxis": {"type": "category", "data": ["Mon", "Tue", "Wed", "Thu", "Fri"]},
|
|
1130
|
+
"yAxis": {"type": "value"},
|
|
1131
|
+
"series": [{"type": "bar", "data": [3, 5, 4, 8, 11]}]
|
|
1132
|
+
}
|
|
1133
|
+
\`\`\`
|
|
1134
|
+
|
|
1135
|
+
## Just you
|
|
1136
|
+
|
|
1137
|
+
<!-- camera: full -->
|
|
1138
|
+
|
|
1139
|
+
Say the key line straight to the camera.
|
|
1140
|
+
|
|
1141
|
+
## Follow for more
|
|
1142
|
+
|
|
1143
|
+
<!-- camera: on -->
|
|
1144
|
+
|
|
1145
|
+
The camera back in its corner, the slide full size.
|
|
1146
|
+
`});var sn,nn=G(()=>{sn=`---
|
|
1101
1147
|
title: Slidetake Showcase
|
|
1102
1148
|
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."
|
|
1103
1149
|
brand: slidetake
|
|
@@ -1298,7 +1344,7 @@ Add \`solid\` and the card hides the camera behind it: a split screen, with the
|
|
|
1298
1344
|
|
|
1299
1345
|
### Shorts and Reels
|
|
1300
1346
|
|
|
1301
|
-
\`format: portrait\` in the top block turns the whole deck into a 9:16 column, for a video at 1080\xD71920. The words go above or below you.
|
|
1347
|
+
\`format: portrait\` in the top block turns the whole deck into a 9:16 column, for a video at 1080\xD71920. The words go above or below you. Start from the [Short template](https://slidetake.com/new?template=short).
|
|
1302
1348
|
|
|
1303
1349
|
### A picture beside you
|
|
1304
1350
|
|
|
@@ -1387,29 +1433,29 @@ Try it: this deck is a file on GitHub, and opens from there too: **[slidetake.co
|
|
|
1387
1433
|
|
|
1388
1434
|
## \u{1F680} Start your own
|
|
1389
1435
|
|
|
1390
|
-
Open **\u270E Editor** and press **New** for a template (blank, talk or
|
|
1436
|
+
Open **\u270E Editor** and press **New** for a template (blank, talk, recording or a 9:16 short), or type in this deck to make it your copy.
|
|
1391
1437
|
|
|
1392
1438
|
The templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.
|
|
1393
1439
|
|
|
1394
1440
|
Next, how it all works, step by step: **[Docs \u2192](/docs)**
|
|
1395
|
-
`});function
|
|
1441
|
+
`});function mt(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function qt(e){return e.replace(/<[^>]*>/g,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function A(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function ln(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)):Gs[a.toLowerCase()]??t)}function Gt(e){let t={};for(let a of e.matchAll(/([\w-]+)="([^"]*)"/g))t[a[1]]=a[2];return t}function Vt(e,t){let a=[[]],o=null;return e.split(`
|
|
1396
1442
|
`).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(`
|
|
1397
|
-
`))}function
|
|
1443
|
+
`))}function cn(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 xa(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 ft(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 Gs,ka=G(()=>{"use strict";Gs={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function hn(e){let t=null;return e.split(`
|
|
1398
1444
|
`).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(`
|
|
1399
|
-
`).replace(/`[^`\n]*`/g,"")}function
|
|
1400
|
-
`).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
|
|
1445
|
+
`).replace(/`[^`\n]*`/g,"")}function ko(e){return/<!--\s*view\s*:\s*(overview|map)\s*-->/i.test(hn(e))}function So(e){let t=hn(e).match(/<!--\s*camera\s*:\s*([\s\S]*?)\s*-->/i);return t?t[1].trim():null}function Vs(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(`
|
|
1446
|
+
`).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 pn(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?`---
|
|
1401
1447
|
`+o.join(`
|
|
1402
1448
|
`)+`
|
|
1403
1449
|
---
|
|
1404
|
-
`:""}function
|
|
1450
|
+
`:""}function Ys(e){let t=e.split(`
|
|
1405
1451
|
`),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(`
|
|
1406
|
-
`).replace(/^\n+/,""))}return{meta:a,body:o}}function
|
|
1407
|
-
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?
|
|
1408
|
-
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=
|
|
1409
|
-
`).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,
|
|
1452
|
+
`).replace(/^\n+/,""))}return{meta:a,body:o}}function Ks(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(`
|
|
1453
|
+
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?ln(qt(r)).replace(/\s+/g," ").trim():null}function dn(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?Gt(t[1]):{}}function un(e,{render:t=a=>({html:a,err:null})}={}){let a=new Map,o=f=>{let b=f,p=2;for(;a.has(b);)b=f+"-"+p++;return b},r=f=>(a.set(f.id,{x:null,y:null,children:[],...f}),f.id);e=e.replace(/\r\n?/g,`
|
|
1454
|
+
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=Vs(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!n&&(Vt(e,/^--\s*$/).length>1||s&&Vt(e,/^---\s*$/).length>1),c=n?k():l?m():d();return a.forEach(f=>{(!f.parent||f.parent===f.id||!a.has(f.parent))&&(f.parent=null)}),a.forEach(f=>{let b=new Set([f.id]),p=f.parent;for(;p;){if(b.has(p)){f.parent=null;break}b.add(p),p=a.get(p).parent}}),a.forEach(f=>{f.parent&&a.get(f.parent).children.push(f.id)}),{deck:i,nodes:a,format:n?"+++":l?"reveal":"headings",errCount:c};function d(){let f=[],b=null,p=null,T={level:0,title:null,explicitId:null,lines:[]};e.split(`
|
|
1455
|
+
`).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,oe=L.match(/\s*\{#([\w\-:.]+)\}\s*$/);oe&&($=oe[1],L=L.slice(0,oe.index)),b={level:E[1].length,title:qt(L),explicitId:$,lines:[E[1]+" "+L]},f.push(b)}else(b||T).lines.push(x)});let C=T.lines.join(`
|
|
1410
1456
|
`);C.trim()&&(f.length&&!C.replace(/<!--[\s\S]*?-->/g,"").trim()?f[0].lines.splice(1,0,...T.lines):f.unshift(T));let w=[];return f.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(`
|
|
1411
|
-
`).trim(),L=x.title||
|
|
1412
|
-
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||
|
|
1457
|
+
`).trim(),L=x.title||qt((E.split(`
|
|
1458
|
+
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||mt(L));let{html:$,err:oe}=t(E);r({id:x.id,parent:y,title:L,html:$,err:oe,camera:So(E),mapFirst:ko(E)}),w.push(x)}),0}function k(){let f=e.split(/\n\+\+\+[ \t]*\n/).map(T=>T.trim()).filter(T=>T.length),b=null,p=0;return f.forEach((T,C)=>{let{meta:w,body:x}=Ys(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?qt(L[1]):y),{html:oe,err:X}=t(x);X&&p++,r({id:y,parent:E,title:$,html:oe,err:X,camera:w.camera||So(x),mapFirst:ko(x),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),b=y}),p}function m(){let f=0,b=0,p=null;function T(w,x){let y=w.body.trim();b++;let E=Ks(y)||"Slide "+b,L=x?a.get(x).title:null;L&&E.startsWith(L+" / ")&&(E=E.slice(L.length+3));let $=o(mt(E)),{html:oe,err:X}=t(y);return X&&f++,r({id:$,parent:x,title:E,html:oe,err:X,camera:So(y),mapFirst:ko(y),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let C=[];return Vt(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:Gt(E[1])}]);let y=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");y.trim()&&C.push([{body:y,attrs:dn(y)}]);return}let x=Vt(w,/^--\s*$/).filter(y=>y.trim()).map(y=>({body:y,attrs:dn(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)})}),f}}var mn=G(()=>{"use strict";ka()});function $e(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=Eo(parseFloat(a)),e.used=!0):Yt.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 fn(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function gn(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=>!$e({},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 Yt,Js,Eo,yn=G(()=>{"use strict";Yt=["top-left","top-right","bottom-left","bottom-right"],Js=["left","right","top","bottom"],Eo=e=>Math.max(8,Math.min(60,e))});function bn(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:Co+[r,n,s].join("/")+"/"+c}}if(r&&n&&!i)return{kind:"url",url:Co+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=Mo(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 Mo(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:Co+[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 vn(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 Co,To=G(()=>{"use strict";Co="https://raw.githubusercontent.com/"});function $s(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 Xs(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,a=>a.charCodeAt(0))}async function wn(e,t){let a=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await a.arrayBuffer())}async function xn(e){return $s(await wn(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function kn(e){return new TextDecoder().decode(await wn(Xs(e),new DecompressionStream("deflate-raw")))}function Sa(e){let t=e.replace(/^#/,"");if(!t.startsWith(Lo)){let n=t;try{n=decodeURIComponent(t)}catch{}return{data:null,slide:n}}let a=t.slice(Lo.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 Ao(e,t){return"#"+Lo+e+(t?"~"+encodeURIComponent(t):"")}var Lo,Bo=G(()=>{"use strict";Lo="deflate:"});function Sn(e,t,a){let o=e.replace(/\/+$/,"")||"/",r=new URLSearchParams(t),{data:n,slide:i}=Sa(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&&Qs.includes(c)?{page:"source",source:{kind:"builtin",id:"template:"+c},slide:i}:{page:"pick"}}let s=Mo(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 Ce(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 Ea(e,t,{exported:a=!1}={}){return{text:e,origin:t,originText:e,exported:a?e:null}}function Ca(e){return e.text!==(e.exported??e.originText)}function Ma(e){return e.text===e.originText}function En(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 Qs,Cn=G(()=>{"use strict";To();Bo();Qs=["blank","talk","recording","short"]});function Oo(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:Zs(t.searchParams.get("t")||t.searchParams.get("start")||""),portrait:r}}function Zs(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 Mn(e){return"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(e.id)+"?enablejsapi=1&rel=0&playsinline=1"+(e.start?"&start="+e.start:"")}var Tn=G(()=>{"use strict"});function ve(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:Ln(o)+(o.skip||0),end:i?Ln(i)-(i.lead||0):a})}),t}function Kt(e){let t=[],a=La(e);return ve(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=An(n.start,a),s=An(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 el(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 Io(e,t){let a=0,o=[];return Kt(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 On(e,t){let{list:a,length:o}=Io(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=>xa(n.t)+" "+n.title),dropped:a.length-r.length,length:o}}function In(e,t,{input:a,outputName:o,sectionOf:r,loudness:n}){let i=el(Kt(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=tl(a)+o,{list:l,length:c}=Io(e,r),d=y=>String(y).replace(/[=;#\\\n]/g,E=>"\\"+E),m=`cat > /tmp/slidetake-chapters.txt <<'EOF'
|
|
1413
1459
|
`+(`;FFMETADATA1
|
|
1414
1460
|
title=`+d(e.deckTitle)+`
|
|
1415
1461
|
`+l.map((y,E)=>`[CHAPTER]
|
|
@@ -1419,23 +1465,23 @@ END=`+Math.round(l[E+1]?l[E+1].t:c)+`
|
|
|
1419
1465
|
title=`+d(y.title)).join(`
|
|
1420
1466
|
`))+`
|
|
1421
1467
|
EOF
|
|
1422
|
-
`,f=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let y=i.map(L=>"file "+
|
|
1423
|
-
inpoint `+
|
|
1424
|
-
outpoint `+
|
|
1468
|
+
`,f=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let y=i.map(L=>"file "+Ta(a)+`
|
|
1469
|
+
inpoint `+Bn(L.start)+`
|
|
1470
|
+
outpoint `+Bn(L.end)).join(`
|
|
1425
1471
|
`);return(i.length>1?`# Careful: without re-encoding, cuts can only land on keyframes (OBS puts one about every 2 s),
|
|
1426
1472
|
# 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.
|
|
1427
1473
|
`:"")+`cat > /tmp/slidetake-cuts.txt <<'EOF'
|
|
1428
1474
|
`+y+`
|
|
1429
1475
|
EOF
|
|
1430
|
-
`+m+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+f+" -c copy -movflags +faststart "+
|
|
1431
|
-
`)};[ul(),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(),Je=Je||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),Je.clearRect(0,0,1,1),Je.fillStyle="#000",Je.fillStyle=a,Je.fillRect(0,0,1,1),"#"+[...Je.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function fl(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 so(){if(U&&U.themeKey&&!Vn){let t=j(U.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Vn||j("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function hi(){let e=so()==="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 pi(){let e=so()==="light"?"dark":"light";U&&U.themeKey?(W(U.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):W("slidetake:mode",e),hi(),se.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&At(!0)}function gl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Ko(e){if(!e)return[];let t=hn(e.camera);return!te||t.some(yl)?t:[]}function yl(e){return!!Ke({},e).behind}function Rt(e){return pn(Ko(e),e&&e.frags?e.frags.length:0)}function ui(){let e=Rt(u.get(g));return e[Math.min(ke,e.length-1)]||{cam:0,frag:0}}function bl(){if(!g)return null;let e=u.get(g),t=Ko(e);if(t.length)return t[Math.min(ui().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=v.indexOf(g)-1;a>=0;a--){let o=Ko(u.get(v[a]));if(o.length)return Ke({},o[o.length-1]).behind?null:o[o.length-1]}return null}function vl(){let e={corner:(R.pip||"none").toLowerCase(),size:So(parseFloat(R.pip_size)||(Ie()?40:24)),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:Fi(),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",Ke(e,t)}return Ke(e,bl()),ve&&!/\b(off|hide)\b/i.test(ve)&&(e.off=!1),Ke(e,ve),!Vt.includes(e.corner)&&(re||e.used)&&(e.corner="bottom-right"),e.flip&&Vt.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function Pe(){let e=!B.hidden&&B.offsetWidth?B.getBoundingClientRect():null,t=Ne=vl();t.behind&&(!g||ue)&&(t.full=!1,t.behind=!1);let a=Vt.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,ce.dataset.pip=B.hidden||t.full?"none":t.corner,ce.classList.toggle("cam-behind",!B.hidden&&!!t.behind),ce.style.setProperty("--cam-card",String((t.card||0)/100)),ce.classList.toggle("cam-card",(t.card||0)>0),ce.classList.toggle("cam-solid",(t.card||0)>=100),ce.classList.toggle("cam-live",!B.hidden&&!!t.behind&&!o);let r=!!Ae;if(Ie()&&/^(left|right)$/.test(t.place||"")&&(t.place="bottom"),Jo(!B.hidden&&t.behind&&t.place||""),Ae&&!r&&e&&!Ue&&Me.animate&&Me.animate([{opacity:0},{opacity:1}],{duration:300,delay:550,easing:"ease-out",fill:"backwards"}),B.hidden||Ue||!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=Math.max(e.width/i.width,e.height/i.height),l=e.left+e.width/2-(i.left+i.width/2),c=e.top+e.height/2-(i.top+i.height/2),d=Math.max(0,(i.width-e.width/s)/2),k=Math.max(0,(i.height-e.height/s)/2),m=parseFloat(getComputedStyle(B).borderTopLeftRadius)||0;B.animate([{transformOrigin:"50% 50%",transform:"translate("+l+"px,"+c+"px) scale("+s+")",clipPath:"inset("+k+"px "+d+"px round "+10/s+"px)"},{transformOrigin:"50% 50%",transform:"none",clipPath:"inset(0px 0px round "+m+"px)"}],{duration:600,easing:n})}function Jo(e){let t=Ae,a=Me.querySelector(".cam-box"),o=a&&a.getBoundingClientRect();Ae=e,ce.dataset.place=e,Me.innerHTML="";let r=e&&u.get(g);if(!r||!r.el)return;let n=r.el.querySelector(".body"),i=[...n.children].map(k=>{let m=k.cloneNode(!0);return[m,...m.querySelectorAll("[style]")].forEach(f=>{f.style.removeProperty("opacity"),f.style.removeProperty("transform"),f.style.removeProperty("visibility")}),[m,...m.querySelectorAll("[data-text]")].forEach(f=>{f.dataset.text&&(f.textContent=f.dataset.text)}),m}),s=k=>k.matches("figure.media, .diagram, .echarts-container, .gallery"),l=[[e,i]],c=n.clientWidth;l.forEach(([k,m])=>{if(!m.length)return;let f=document.createElement("div");f.className="cam-box "+k;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),f.appendChild(C)};b("cam-text",m.filter(p=>!s(p))),b("cam-media",m.filter(s)),Me.appendChild(f)}),Me.querySelectorAll("img").forEach(k=>{k.complete||k.addEventListener("load",$o,{once:!0})}),$o();let d=Me.querySelector(".cam-box");if(o&&t&&t!==e&&d&&!Ue&&d.animate){let k=d.getBoundingClientRect();Math.abs(o.width-k.width)<2&&Math.abs(o.height-k.height)<2&&d.animate([{transform:"translate("+(o.left-k.left)+"px,"+(o.top-k.top)+"px)"},{transform:"none"}],{duration:600,easing:"cubic-bezier(.65,0,.35,1)"})}}function $o(){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 wl(){let e=Ne;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 xl(){if(!Ge)return;if(te){Ht(!0);return}let e=gl();Fe=(Fe+1)%e.length,ve=e[Fe],Pe(),K||Et("Camera: "+ve),!re&&!B.hidden?ct():fe()}function mi(e){let t=cn(e,{render:dl});R=t.deck,u=t.nodes,Ya();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];tl.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,aa.textContent=t.errCount?t.errCount+" card(s) had errors":""}function fi(){tt=[...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}}tt.forEach(o=>t(o,0)),v=[];function a(o){v.push(o),u.get(o).children.forEach(a)}return tt.forEach(a),Math.max(1,e)}function kl(){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 gi(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 Sl(){let{maxH:e,maxDepth:t}=kl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+nl;let o=rl-Mt,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(k=>n(k,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)}tt.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,gi(l)})}function El(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?tt.length>1?sl*.5:0:i+il;for(let d=0;d<400&&(l.forEach(m=>{let f=(m._slot+.5)*t-Math.PI/2;m.cx=c*Math.cos(f),m.cy=c*Math.sin(f),gi(m)}),!!l.some((m,f)=>l.some((b,p)=>p>f&&r(m,b))||o.some(b=>r(m,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function Cl(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(Ut(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 Ll(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||!Ml.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"+ ++Tl+"-";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 De(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 Ho(e){let t=document.createElement("figure");t.className="media",De(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function Al(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="'+kn(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 Gn(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 Ol(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=Ll(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",De(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&&Bo(s);l&&De(n,Al(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>jo(s)||Pl(s))||(n.classList.add("gallery"),i.some(s=>!jo(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!jo(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),Ho(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)})):Gn(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!Bl(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){De(n,i[0]),Ho(i[0]);return}let s=document.createElement("div");s.className="gallery grid",De(n,s),i.forEach(l=>{s.appendChild(l),Ho(l)}),Gn(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 yi(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function Il(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 zl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!Bo(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(bi)),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 Rl(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 ur(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&&yi(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Dl(){try{return R.base?new URL(R.base,He||location.href):He?new URL(He):null}catch{return null}}function Fl(e){let t=Dl(),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 lo(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=Mt;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-Da*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Da*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(Da*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(No,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(Mt,Math.min(le,(Da-ol)*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=No);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(No,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||Yo,t.classList.remove("measuring")}function Nl(){clearTimeout(Yn),Yn=setTimeout(()=>{u.forEach(lo),ha(),fe(!0)},200)}function _l(){let e=so()==="light"?"light":"dark",t=Le(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Kn.has(a)||(Ul(a,Wl[e],t),Kn.add(a)),a}function Ul(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 Gl(){let e=so()==="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={...Vl[e],N7:t,B1:Le("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=fl(a,t,n)}),r}function Yl(){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 Xo(e){return Wo[e]||(Wo[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete Wo[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function $l(){let e=$e,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,De(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 Xo(Hl),_o=_o||await Viz.instance(),e!==$e)return;let n=Yl();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(_o.renderSVGElement(Kl(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}De(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!Fa){let i=await import(ql);Fa=new i.D2}if(e!==$e)return;let n=Gl();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await Fa.compile(Jl(i.textContent));s.innerHTML=await Fa.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==$e)return;De(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Xo(jl),e!==$e)return;let n=_l();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(g)||{}).el&&Jo(Ae)}),l.setOption(Object.assign({backgroundColor:"transparent",animation:!Ue},s))})}catch{r.push("charts")}e===$e&&(Ae&&Jo(Ae),r.length&&(aa.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(lo),ha(),fe(!0))}function Xl(){let e=[];return v.forEach(t=>{let a=zt(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function Ql(){let a=0,o=0,r=0;Xl().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,k)=>{let m=u.get(d);k&&(l+=90+m._w/2),m.cx=l,m.cy=a,c=l,l+=m._w/2}),o=c,r=s})}function Zl(){u.forEach(e=>{e.cx=0,e.cy=0})}function vi(){$e++,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=fi(),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?co(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");Cl(n),Il(n),zl(n),Ol(o,n),/^slidetake$/i.test(R.brand||"")&&pl(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Fl(n),a.frags=Rl(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Nl,{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,ur(a,a.frags.length)}),t&&!aa.textContent&&(aa.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(lo),ha(e),$l()}function ha(e){e===void 0&&(e=fi()),J==="radial"?El(e):J==="path"?Ql():J==="focus"?Zl():Sl(),se.classList.toggle("focus",J==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),ec(),Dt(),gr()}function ec(){let e="";if(J==="focus"){Fo.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+'"/>'}Fo.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+'"/>'}}),Fo.innerHTML=e}function co(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function Tt(){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)",Li()}function mr(){ea&&(ea.kill(),ea=null)}function wi(e,t){if(mr(),t||Ue||!window.gsap){Object.assign(z,e),Tt();return}let a=N.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:Tt,onComplete:()=>{ea=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+Mt)));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);ea=n}function tc(){let e=N.getBoundingClientRect(),t=14,a=[];if(!ze.hidden&&ze.offsetWidth){let r=ze.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=wl();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function ac(){let e=N.clientWidth,t=N.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return tc().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=N.clientWidth,r=N.clientHeight,n=null;return ac().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 xi(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function nt(e,t){let a=u.get(e);if(!a)return;let o=Qo(a._w,a._h,oa),r=zt(e),n=v.filter(l=>zt(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return Qo(c._w,c._h,oa).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));wi(Object.assign(xi(a.cx,a.cy,o,s),{zoom:s}),t)}function pa(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=Qo(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));wi(Object.assign(xi((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function fe(e){g&&u.has(g)?nt(g,e):pa(e)}function Dt(){let e=g?co(g):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===g),a.classList.toggle("active-path",e.includes(t.id))}),se.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!g&&v.indexOf(t.dataset.to)<=v.indexOf(g):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),ic(e),Si()}function ki(){return rn(new URLSearchParams(location.search).get("duration")??R.duration)}function oc(){return K&&ki()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Ka(){let e=oc()&&je.start>0;if(Qe.classList.toggle("timed",e),!e){Qe.classList.remove("over");return}let a=(h.active&&h.t0?Bt():performance.now()-je.start)/ki();Qe.firstChild.style.width=Math.min(100,a*100)+"%",Qe.classList.toggle("over",a>=1)}function rc(){je.start=performance.now(),clearInterval(je.timer),je.timer=setInterval(Ka,1e3),Ka()}function nc(){clearInterval(je.timer),je.timer=null,je.start=0,Ka()}function Si(){let e=K&&v.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(Qe.classList.toggle("show",e),!e)return;Ka();let t=v.indexOf(g),a=0,o=0;v.forEach((r,n)=>{let i=Rt(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(ke,i-1)+1)}),Qe.lastChild.style.width=(a?o/a*100:0)+"%"}function ic(e){Un.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===g?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),Un.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||_(t.dataset.id)}))}function ua(e){let t=u.get(g);t&&(ur(t,ui().frag,e),Pe(),(B.hidden||!Ne||!Ne.full||Ne.behind)&&cc(t),fr(t))}function lc(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 cc(e){if(e._played||!window.gsap||Ue)return;e._played=!0;let t=lc(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"),Jn(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(Jn)}function ra(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=>sc.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 Jn(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 fr(e){clearTimeout(Lt),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(Lt=setTimeout(()=>{g===e.id&&We(1)},e.autoslide))}function Ei(e){let t=e&&e!==v[0]?e:"";try{M&&M.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Lo(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!==g){ve=null,Fe=-1,ke=a?Rt(u.get(e)).length-1:0;let n=u.get(g);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),Mi()}let o=e!==g;if(o&&(Ci=g),g=e,clearTimeout(ue),ue=null,o&&J==="focus"&&!t&&!Ue){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ua(o),o&&!Be&&la("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(pa(),ue=setTimeout(()=>{ue=null,g===e&&(Pe(),nt(e))},1900),Pe()):nt(e,t),Dt(),gr(),Ei(e)}function Mi(){let e=u.get(g);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>yi(t,"pauseVideo")),ur(e,e.frags.length,!0),ra(e))}function dc(){if(!g&&Ze&&u.has(Ze)){Ti();return}g&&(Ze=g),J==="focus"&&yr("path"),Mi(),clearTimeout(Lt),g=null,Pe(),Dt(),gr(),pa(),Ei(null)}function Ti(){if(ue)return clearTimeout(ue),ue=null,Pe(),nt(g),!0;if(!g&&Ze&&u.has(Ze)){let e=Ze;return Ze=null,_(e),!0}return!1}function We(e){if(!g){v.length&&_(v[e>0?0:v.length-1]);return}if(ue&&e>0){clearTimeout(ue),ue=null,Pe(),nt(g);return}let t=Rt(u.get(g)),a=Math.min(ke,t.length-1)+e;if(a>=0&&a<t.length){ke=a,ve=null,Fe=-1,ua(),!re&&!B.hidden&&Ne.used?ct():fe(),Dt();return}let o=v.indexOf(g)+e;o>=0&&o<v.length&&_(v[o],!1,e<0)}function hc(){let e=u.get(g);e&&e.parent&&_(e.parent)}function pc(){let e=u.get(g);e&&e.children.length?_(e.children[0]):!g&&v.length&&_(v[0])}function gr(){let e=[...u.values()];if(!e.length){Go.innerHTML="",Ce=null;return}al.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-Mt/2,r=Math.max(...e.map(t))+Mt/2,n=Math.min(...e.map(a))-Yo/2,i=Math.max(...e.map(a))+Yo/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)),k=l/2-(o+r)/2*d,m=c/2+5-(n+i)/2*d,f=g?co(g):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+k)+'" y1="'+(a(T)*d+m)+'" x2="'+(t(p)*d+k)+'" y2="'+(a(p)*d+m)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===g?"var(--accent)":f.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+k)+'" cy="'+(a(p)*d+m)+'" r="'+(p.id===g?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"/>',Go.innerHTML=b,Ce={s:d,ox:k,oy:m},Li()}function Li(){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 At(e){mi(ie.value),g&&!u.has(g)&&(g=null),vi(),g?_(g,e):v.length?_(v[0],e):(g=null,pa(!0))}function yr(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&&!Ue&&(se.classList.add("morph"),setTimeout(()=>se.classList.remove("morph"),700)),ha(),Tt(),g?nt(g,t):pa(t))}function Ai(e){return Math.max(.04,Math.min(5,e))}function uc(e){oa=Math.round(Math.max(ll,Math.min(cl,e))*100)/100,W("slidetake:slideSize",oa),g&&nt(g)}function $n(e){g?uc(oa+e*.1):Bi(e>0?1.2:1/1.2)}function Bi(e,t,a){mr();let o=Ai(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,Tt()}function ho(){U||(qe.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!qe.classList.contains("collapsed")))}function we(e){K=e,document.body.classList.toggle("presenting",e),ws(document.getElementById("btn-present"),e),xs();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!g&&v.length&&_(v[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!re&&!te&&ct(),e?fr(u.get(g)):clearTimeout(Lt),e?rc():nc(),Si()}function Bt(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function ma(e){e.classList.add("open")}function yc(e){if(W("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+fc]=!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}))}Ii()}function Ii(){wr.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===gc())))}function fa(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function bc(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Ja.value=t||"localhost",$a.value=a||"4455",Xa.value=o.join(":"),!0}try{let t=JSON.parse(j("slidetake:obs")||"null");t&&(Ja.value=t.host||"localhost",$a.value=t.port||"4455",Xa.value=t.password||"",br.checked=!0)}catch{}return!1}function zi(){if(br.checked)W("slidetake:obs",JSON.stringify({host:Ja.value.trim(),port:$a.value.trim(),password:Xa.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Kt(e,t,a){ta.textContent=e,ta.className=t||"",ta.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function wc(e){return location.protocol==="https:"&&!vc(e)}async function xr(){let e=Ja.value.trim()||"localhost",t="ws://"+e+":"+($a.value.trim()||"4455");if(wc(e)){Oe=!1,Kt("Blocked here","err",xc);return}Kt("Connecting\u2026"),ta.title="Connecting to "+t;try{await Xo(mc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Oe=!1,Kt("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&et&&(et(),et=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&Pt("Stopped in OBS")});let o=await ne.connect(t,Xa.value||void 0);Oe=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(vr=r.fpsNumerator/r.fpsDenominator),Oi=r&&r.outputWidth&&r.outputHeight?Pn(r.outputWidth,r.outputHeight):""}catch{}Kt("Connected","ok",""),ta.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),zi(),Y.classList.contains("open")&&st()&&(O("Connected to OBS. Press \u25CF Record."),Ye())}catch(a){Oe=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";Kt("Could not connect","err",o+" Is OBS running with its WebSocket server on, and are the port and password right?")}}function kc(){let e=document.getElementById("rec-screen"),t=screen.width,a=screen.height;if(Ie()){e.innerHTML='<span class="warn">This deck is portrait (9:16). In OBS, set the canvas to 1080\xD71920 (Settings \u2192 Video) and fit the 9:16 column in the middle of the screen to it.</span>';return}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?Bn(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}=An(screen.width,screen.height,devicePixelRatio||1,Ie());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 po(){tr++,he&&(cancelAnimationFrame(he.raf),he.stream.getTracks().forEach(e=>e.stop()),he.ctx.close().catch(()=>{}),he=null,er.value=0,kt.getContext("2d").clearRect(0,0,kt.width,kt.height),Ri())}function Ri(){ar++,Wa&&(Wa.getTracks().forEach(e=>e.stop()),Wa=null),kr.srcObject=null}async function Di(){Ri(),Sr();let e=ar,t=xt.value;if(Ha.hidden=t!=="none"&&!!t,Ha.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==ar){a.getTracks().forEach(o=>o.stop());return}Wa=a,kr.srcObject=a}catch{Ha.hidden=!1,Ha.textContent="The camera isn\u2019t available"}}async function Qa(){await po();let e=tr;try{let t=Ot.value,a=await navigator.mediaDevices.getUserMedia({audio:Qi(t)});if(e!==tr){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=he={stream:a,ctx:o,raf:0},s=kt.getContext("2d"),l=kt.width,c=kt.height,d=Le("--accent"),k=()=>{if(he!==i)return;r.getFloatTimeDomainData(n);let m=0;for(let f of n)m=Math.max(m,Math.abs(f));er.value=Math.max(m,er.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let f=0;f<n.length;f++){let b=f/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[f]*3))*(c/2-4);f?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(k)};k()}catch(t){vt.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function Za(e=!0){try{e&&!he&&await Qa();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"),k=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),m=d.map((b,p)=>In(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));m.forEach((b,p)=>{let T=m.slice(0,p).filter(C=>C===b).length;T&&(m[p]=b+" "+(T+1))});let f=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(k)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===f?" selected":"")+">"+A(m[p]+(k(b)?" (system default)":""))+"</option>").join("")},o=Er();xt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=j("slidetake:mic")||"";Ot.innerHTML=a("audioinput",r),r&&Ot.value===r&&he&&he.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Qa()}catch{}}function Fi(){let e=j("slidetake:mirror");return e?e==="on":/^(yes|true|on)$/i.test(R.pip_mirror||"")}function Sr(){eo.checked=Fi(),kr.parentElement.classList.toggle("mirror",eo.checked)}function Er(){let e=j(Ni());return e||(Ec()?j("slidetake:cam")||"default":"none")}function Cc(e){W(Ni(),e),e!=="none"&&e!=="default"&&W("slidetake:cam",e)}function Mc(){h.camWas=!te;let e=Er()!=="none";e!==!te&&Ht(e,!0)}function Hi(){h.camWas!=null&&(h.camWas!==!te&&Ht(h.camWas,!0),h.camWas=null)}async function ji(){let e=Se();if(!e.ok)return vt.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;ja&&(vt.innerHTML='<span class="warn">'+A(ja)+"</span>",ja="");let t=ft.indexOf(e.quality),a=j("slidetake:quality");It.innerHTML=ft.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=ft.find(s=>s.name===It.value)||e.quality;o=" Room for about "+Math.floor((r-n)/On(i))+" minutes of takes."}catch{}return vt.querySelector(".warn")||(vt.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function Tc(e){me=e,W("slidetake:rec-mode",e),sa({setup:Nt()})}function sa(e={}){Ge&&(Se().ok&&(me||"browser")==="browser"?Ir(e):Lc(e))}function Lc(e={}){let t=uo().find(a=>a.key===Ve()&&a.withObs&&!a.inBrowser);as(t||{key:Ve(),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:vr,events:[],picks:{},empty:!0},e)}async function Cr(){if(!(!Ge||h.active||!v.length)){if(!Ac()){nr({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(Se().ok&&(me||"browser")==="browser"){let t=za(lt(),go()).filter(r=>!r.pick).map(r=>r.id),a=v.indexOf(g),o=t.length?t:a>0?v.slice(a):v;to("browser",o.length===v.length?null:o);return}if(!Oe&&j("slidetake:obs")&&await xr(),Oe){to("obs");return}nr({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function Mr(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function Tr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}function _i(){if(!document.body.classList.contains("rec-frame"))return;let e=devicePixelRatio||1,t=Ie()?9/16:16/9,a=wt.clientWidth,o=wt.clientHeight,r=s=>Math.floor(s*e/2)*2/e,n=r(Math.min(o,a/t)),i=r(n*t);i>a&&(i=r(a),n=r(i/t)),Object.assign(ce.style,{width:i+"px",height:n+"px",aspectRatio:"auto",margin:Math.floor((o-n)/2)+"px 0 0 "+Math.floor((a-i)/2)+"px"})}function Lr(e){document.body.classList.toggle("rec-frame",e),e?_i():["width","height","aspectRatio","margin"].forEach(t=>ce.style.removeProperty(t.replace(/[A-Z]/g,a=>"-"+a.toLowerCase())))}async function Ui(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(ce)):await e.cropTo(await CropTarget.fromElement(ce))}function Bc(e,{w:t,h:a}){let o=document.createElement("video");o.muted=!0,o.playsInline=!0,o.srcObject=new MediaStream([e]);let r=document.createElement("canvas");r.width=t,r.height=a;let n=r.getContext("2d",{alpha:!1}),i=!0,s=()=>{if(!i)return;let c=o.videoWidth,d=o.videoHeight;if(c&&d){let k=Math.max(t/c,a/d),m=c*k,f=d*k;n.drawImage(o,(t-m)/2,(a-f)/2,m,f)}o.requestVideoFrameCallback(s)};o.requestVideoFrameCallback(s),o.play().catch(()=>{});let l=r.captureStream(gt).getVideoTracks()[0];return{track:l,stop(){i=!1,l.stop(),o.srcObject=null}}}async function Oc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Ui(e.track)}catch{}e.scaled||await e.track.applyConstraints(Wi(e.quality)).catch(t=>console.warn("Slidetake: the recording size was refused",t)),await ia()}async function Ic(){let e=Se();if(!e.ok)throw new Error(e.why);let t=ft.find(l=>l.name===It.value)||e.quality;Lr(!0);let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:gt},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),o=a.getVideoTracks()[0],r=()=>a.getTracks().forEach(l=>l.stop());if(!o.restrictTo&&!o.cropTo)throw r(),new Error("Share \u201Cthis tab\u201D to record the slides.");try{await Ui(o)}catch(l){throw r(),new Error("Chrome could not record just the slides ("+(l.message||l.name)+").")}let n=Ie()?Bc(o,Ba(t,!0)):null;n||await o.applyConstraints(Wi(t)).catch(l=>console.warn("Slidetake: the recording size was refused",l));let i;try{let l=j("slidetake:mic");i=await navigator.mediaDevices.getUserMedia({audio:Qi(l)})}catch(l){throw r(),new Error("The microphone isn\u2019t available ("+(l.message||l.name)+").")}let s=new Date().toISOString().replace(/[:.]/g,"-");h.browser={id:s,display:a,mic:i,track:o,quality:t,type:e.type,scaled:n,stream:new MediaStream([n?n.track:o,...i.getAudioTracks()]),dir:await Mr(s,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&Pt("Sharing stopped")})}function qi(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),e.scaled&&e.scaled.stop(),Lr(!1))}function Pc(e){let t=h.browser,a="take-"+t.clips.length+"."+Io(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:Aa}),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(Bt()),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 to(e,t){if(h.active||!v.length)return;let a=e==="obs";if(po(),me||(me=a?"obs":"browser",W("slidetake:rec-mode",me)),e==="browser"){K||we(!0);try{await Ic()}catch(l){Lr(!1),K&&we(!1),ja=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,Ir({setup:!0});return}}fa();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"),zr(),K||we(!0),Mc(),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 ia(),document.body.classList.remove("no-anim")):(g===r&&(ke=0,ve=null,Fe=-1),_(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=$t.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",$t.querySelector(".num").textContent=l,$t.classList.add("show"),await na(1e3),!h.active)return;if($t.classList.remove("show"),await ia(),a){let l=new Promise(c=>{et=c,setTimeout(()=>{et&&(et(),et=null)},2500)});try{await ne.call("StartRecord")}catch(c){Ar("OBS could not start recording: "+(c&&c.message||c));return}if(await l,!h.active)return}h.browser&&await Oc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){la("slide",r),h.browser&&await h.browser.chain,ra(s),Be=!0,_(r),Be=!1;return}ra(s),ua(!0),la("slide",g)}function Ar(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(()=>Tr(t.id)),qi(),h.browser=null}$t.classList.remove("show"),document.body.classList.remove("recording"),K&&we(!1),Hi(),Et(e)}function la(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(Bt()),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&&Pc(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 zc(e){let t=e.key;if((Qn.includes(t)||Zn.includes(t)||ei.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?Ar("Take cancelled"):Pt("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||at)){if(ei.includes(t)){Nc();return}h.paused||(Qn.includes(t)?Rc():Zn.includes(t)&&Dc())}}function Rc(){let e=Rt(u.get(g)),t=Math.min(ke,e.length-1)>=e.length-1,a=v.indexOf(g);if(!t){We(1);return}if(!h.only){a===v.length-1?Pt():We(1);return}let o=v.slice(a+1).find(r=>h.only.has(r));o?v[a+1]===o?We(1):Vi(v[v.indexOf(o)-1],o,"slide"):Pt()}async function Dc(){let e=u.get(g);if(!e||at)return;let t=g,a=Ci;if(!a||a===t||!u.has(a)){Fc(e);return}Vi(a,t,"retake")}async function Vi(e,t,a){let o=u.get(t);if(!o||at)return;at=!0;let r=Bt();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 ia(),document.body.classList.remove("no-anim"),la(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await Gi(),ra(o),Be=!0,_(t),Be=!1,!re&&!B.hidden&&Ne.used&&ct(),at=!1}async function Gi(){let e=h.events[h.events.length-1];e&&(e.skip=ti/2),await na(ti)}async function Fc(e){at=!0,ke=0,ve=null,Fe=-1,ra(e),ua(!0),!re&&!B.hidden&&Ne.used?ct():fe(),Dt(),la("retake",g),h.withObs&&await Gi(),at=!1}async function Nc(){if(h.t0)if(h.paused){if(Zo.classList.remove("show"),await ia(),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,fr(u.get(g))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(Lt),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()})}Zo.classList.add("show")}}async function Pt(e){if(!h.active||h.finishing)return;if(h.counting){Ar("Take cancelled");return}h.finishing=!0,clearTimeout(Lt),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Zo.classList.remove("show"));let t=Math.round(Bt()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await na(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 na(600),await o.chain,t=Math.round(Bt()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),qi(),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&&we(!1),Hi();let r={key:Ve(),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?gt:vr,...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){Gc(r);return}Br(r),as(r,{note:(e?e+". ":"")+be(r).size+" slides recorded with OBS."})}function Ve(){return pt(R.title||(v[0]?u.get(v[0]).title:"deck"))}function uo(){try{return JSON.parse(j("slidetake:sessions")||"[]")}catch{return[]}}function Br(e){let t=uo().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&Tr(a.takesId)}),W("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function zt(e){let t=u.has(e)?co(e):[e];return t[Math.min(1,t.length-1)]}function Yi(e,t){let a=zt(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function O(e,{warn:t=!1,html:a="",title:o=""}={}){Jt.classList.toggle("warn",t),a?Jt.innerHTML=a:Jt.textContent=e,Jt.title=o||Jt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>hs(!0))}function as(e,t={}){fa(),H=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":be(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+ut(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?" ("+mt(e.outputPath)+")":"";let n=Ta(e);ao.value=[...ao.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,S.src&&(e.inBrowser||_e!==mt(e.outputPath)&&e.outputPath)&&(S.removeAttribute("src"),S.load(),_e=""),document.getElementById("rv-novideo").hidden=!!S.src||!!e.empty,Z=null,F=null,Ft(),mo(),ma(Y),t.setup?yo(t):(bo(),Za(!1).then(Ye)),O(t.note||(e.empty?Oe?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(S.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||Xc(e)}function mo(){if(H&&H.board){it();return}let e=H,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...be(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=zt(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 "+ut(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+wa(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,Br(e),mo();let r=be(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&&fo([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else ro([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,rs(e),is(e)}function rs(e){let t=Hc(e),a=document.getElementById("rv-chapters");os=t.lines.join(`
|
|
1432
|
-
`),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 ns(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 is(e){let t=document.getElementById("rv-final"),a=++Uo,o=Gt(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 ")+ut(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of Yt(e))Ua.has(i.clip)||Ua.set(i.clip,(await ga(i.clip)).size),n+=Ua.get(i.clip);a===Uo&&(t.textContent=r(n))}catch{a===Uo&&(t.textContent=r(null))}}function ro(e){if(!S.src){oo=e,O(sr?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}oo=null,Z={ranges:e,i:0},O("\u25B6 "+e[0].title);let t=()=>{S.currentTime=e[0].start/1e3,S.play().catch(a=>{a&&a.name!=="AbortError"&&O("Could not play: "+a.message,{warn:!0})})};S.readyState>=1?t():S.addEventListener("loadedmetadata",t,{once:!0})}function Ft(){St=null}function Or(){let e=F&&!F.single&&!S.paused;ss.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 Wc(e){let t=H?Yt(H):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;St=o?o.id:null,O(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function ls(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 ga(e){let[t,a]=e.split("/");return(await(await Mr(t)).getFileHandle(a)).getFile()}async function fo(e,t=0,a=!1){if(!(!H||H.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ga(e[t].clip);if(!Y.classList.contains("open"))return;S.src&&URL.revokeObjectURL(S.src),S.src=URL.createObjectURL(o),O("\u25B6 "+e[t].title),await S.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 cs(){let e=F;if(e.i+1<e.parts.length){fo(e.parts,e.i+1,e.single);return}F=null,S.pause(),e.single?Wc(e.parts[0]):O(""),Or()}async function _c(e){if(!e.where)return!0;try{let t=await Pr("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 hs(e){let t=H;if(!t||!t.inBrowser||t.cleaned)return;let a=Yt(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)]),ot(),ca(),t.type]),r=t.board&&I.lastDownload;if(!e&&r&&r.sig===o&&await _c(r)){O("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(qo(r))+".",title:"Already saved in "+qo(r)+". A new video is made only when a take or the sound settings change."});return}let n=Io(t.type||"")==="mp4",i=Ve()+" "+qc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await ps(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=no;c.disabled=!0,Xe("Preparing\u2026");try{let d=await import(Sc),k=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:k}),f=1,b="",p=ot()&&ca();if(ot()){let D=await ai(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let q=zo(D,{limit:p});if(p&&Math.abs(q)>=.05){let Q=await ai(d,a,Pa(q),!0,"Checking");Q&&isFinite(Q.integrated)&&(q=Math.min(q+(-14-Q.integrated),Po))}f=Pa(q);let de=p?-14:D.integrated+q,oe=!p&&zo(D,{limit:!0})-q>.5;b=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(q)<.05?" LUFS, left as is":" \u2192 "+de.toFixed(1)+" LUFS")+(oe?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=f!==1||p;await Uc(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),de=new Float32Array(D.n*D.ch);q.forEach((oe,Q)=>de.set(oe,Q*D.n)),await w.add(new d.AudioSample({data:de,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,q]of a.entries()){Xe("Joining "+(D+1)+"/"+a.length);let de=new d.Input({source:new d.BlobSource(await ga(q.clip)),formats:d.ALL_FORMATS}),oe=await de.getPrimaryVideoTrack(),Q=await de.getPrimaryAudioTrack();if(!oe)throw new Error(q.title+" has no video");C||(C=new d.EncodedVideoPacketSource(await oe.getCodec()),m.addVideoTrack(C,{frameRate:gt}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Aa}):new d.EncodedAudioPacketSource(await Q.getCodec()),m.addAudioTrack(w)),await m.start());let Wt={decoderConfig:await oe.getDecoderConfig()},dt=0,Nr=!0;for await(let V of new d.EncodedPacketSink(oe).packets())V.timestamp>=q.keep||(y=Oa(y,x+V.timestamp),await C.add(V.clone({timestamp:y}),Nr&&D===0?Wt:void 0),Nr=!1,dt=Math.max(dt,V.timestamp+V.duration));if(Q&&w&&T)for await(let V of new d.AudioSampleSink(Q).samples(0,dt)){if(V.timestamp+V.duration>dt+1e-4){V.close();continue}E=Oa(E,x+V.timestamp);let ge=ls(V);if(ge.forEach(ye=>{for(let ht=0;ht<ye.length;ht++)ye[ht]*=f}),p)L=L||Ro(V.sampleRate,ge.length),L.push(ge),$.push({t:E,n:V.numberOfFrames,rate:V.sampleRate,ch:ge.length}),V.close(),await ae();else{let ye=V.numberOfFrames,ht=new Float32Array(ye*ge.length);ge.forEach((Ts,Ls)=>ht.set(Ts,Ls*ye)),await w.add(new d.AudioSample({data:ht,format:"f32-planar",numberOfChannels:ge.length,sampleRate:V.sampleRate,timestamp:E})),V.close()}}else if(Q&&w){let V={decoderConfig:await Q.getDecoderConfig()},ge=!0;for await(let ye of new d.EncodedPacketSink(Q).packets())ye.timestamp+ye.duration>dt+1e-4||(E=Oa(E,x+ye.timestamp),await w.add(ye.clone({timestamp:E}),ge&&D===0?V:void 0),ge=!1)}x+=dt}if(L&&(L.end(),await ae(),L.events&&(b+=", "+L.events+" peak"+(L.events===1?"":"s")+" limited")),Xe("Finishing\u2026"),await m.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([k.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,ya()),O("Saved in "+qo(X)+" ("+ut(x*1e3)+b+")."),Xe("\u2713 Saved"),ds=setTimeout(()=>Xe(),2500)}catch(d){Xe(),O("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function ai(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){Xe(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ga(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let k=ls(d);n=n||Rn(d.sampleRate,k.length),a!==1&&o?(k.forEach(m=>{for(let f=0;f<m.length;f++)m[f]*=a}),i=i||Ro(d.sampleRate,k.length),i.push(k),i.ready()&&n.add(i.take(i.ready()))):n.add(k),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function Uc(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ga(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 ps(e){if(!window.showDirectoryPicker)return null;let t=e?null:await Pr("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"}),gs("video-folder",t),t}function lt(){let e=us();if(I&&rr===e)return I;rr=e;try{I=JSON.parse(j(e)||"null")}catch{I=null}return(!I||!Array.isArray(I.takes))&&(I={takes:[],picks:{},type:"",quality:""}),I}function Gc(e){lt();let t=Hn(e,e.takesId,go());t.forEach(a=>{delete I.picks[a.id]}),I.takes.push(...t),Object.assign(I,{type:e.type,quality:e.quality}),ya(),Re.clear(),Ir({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function ms(){let e=za(lt(),go()),t=Object.assign(jn(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 yo(e={}){Y.classList.add("setup-view"),ri.textContent=e.note||"",ri.hidden=!e.note,rt.textContent="\u2190 Back",rt.title="Back to Studio",rt.setAttribute("aria-expanded","true"),Yc()}function bo(){let e=Nt();e&&Y.classList.remove("setup-view"),rt.textContent="\u2699 Setup",rt.title="Settings: camera, microphone, video, OBS and files",rt.setAttribute("aria-expanded","false"),e&&(po(),Ye())}function nr(e={}){Y.classList.contains("open")?yo(e):sa({...e,setup:!0})}function Yc(){let e=()=>{Ye(),Nt()&&Di()};if(st()){kc(),Za(!1).then(e);return}vt.innerHTML="",ji().then(t=>{t.ok?Za().then(e):e()})}function Ye(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(xt)||(Er()==="none"?"No camera":"Camera"),a=st(),o=a?Oi:Se().ok?It.value:"",r=a?[t]:[t,e(Ot)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",bt.classList.toggle("on",a),bt.setAttribute("aria-pressed",String(a)),bt.disabled=!Se().ok,bt.title=bt.disabled?qa+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+qa:"Easy mode: recording in "+qa+". Click for pro mode, with OBS"}function Ir(e={}){Ge&&(fa(),lt(),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,S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),Z=null,F=null,Ft(),_a=-1,it(),ma(Y),e.setup||!Se().ok?yo(e):(bo(),ji().then(()=>Za(!1)).then(Ye)),O(e.note||ts()||(I.takes.length?Kc()+". Click a take to preview it.":v.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function Kc(){let e=za(lt(),go()),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 it(){let{rows:e,sess:t}=ms();H=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=zt(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"},k=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 "+ut(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":"")+(Re.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(Re.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+k+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{I.picks[i.dataset.id]=i.dataset.uid,ya(),it();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&fo([{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?Wn(v,oi,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?Re.add(c):Re.delete(c)}),Ft(),oi=i.dataset.id,it()}));let r=Ra(v,Re),n=Se().ok;document.getElementById("rv-rec").disabled=!n,_a>=0&&r.length!==_a&&O(ts()||"Record takes the whole deck."),_a=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,rs(t),is(t)}async function Jc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await Mr(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]}),ya(),S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ft(),it()}function fs(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 Pr(e){let t=async a=>{let o=await fs(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 gs(e,t){try{(await fs()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function vo(e){sr=!0;try{return await $c(e)}finally{sr=!1}}async function $c(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 ba(e,t,a){S.src&&URL.revokeObjectURL(S.src),Xt=t||null,a||(ir=0),S.src=URL.createObjectURL(e),_e=e.name,document.getElementById("rv-novideo").hidden=!0,O("Loaded "+e.name+". Click a take to preview it."),oo?ro(oo):a&&Z&&ro(Z.ranges.slice(Z.i))}async function Xc(e){let t=mt(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(_e===t&&S.src))try{let a=await Pr("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);O("Opening "+t+"\u2026"),ba(await vo(o),o)}catch{}}function Et(e,t){if(!h.active){if(clearTimeout(Va),!B.hidden&&!B.classList.contains("live")){Zt.classList.remove("show"),bs.textContent=e,B.classList.add("msg"),t||(Va=setTimeout(vs,9e3));return}Zt.textContent=e,Zt.classList.add("show"),t||(Va=setTimeout(()=>Zt.classList.remove("show"),9e3))}}function vs(){bs.textContent="PIP camera",B.classList.remove("msg")}function zr(){clearTimeout(Va),Zt.classList.remove("show"),vs()}function Vo(){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 Rr(){re&&re.getTracks().forEach(t=>t.stop()),re=null;let e=B.querySelector("video");e&&e.remove()}async function ct(){if(!(re||te)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Et("Camera not available on this page."+Vo(),!0);return}if(Te.disabled)return;Te.disabled=!0,Et("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}),zr()}catch(t){let a=t&&t.name;Et(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Vo():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+")":"")+"."+Vo(),!0);return}finally{Te.disabled=!1,Dr()}re.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Rr(),Ya(),fe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=re,B.appendChild(e)}Ya(),fe()}}function ws(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Dr(){Te.querySelector("svg")||(Te.innerHTML=Qc+'<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 Ht(e,t){e&&!Ge||(te=!e,t||W("slidetake:camera",e?"on":"off"),te&&(Rr(),zr()),ve=null,Fe=-1,ke=Math.min(ke,Math.max(0,Rt(u.get(g)).length-1)),Dr(),Ya(),ua(),Dt(),fe(),!K&&!t&&Et(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&ct())}function xs(){document.body.classList.remove("idle"),clearTimeout(ni),K&&(ni=setTimeout(()=>document.body.classList.add("idle"),2e3))}function da(e,t){Ct.textContent=e,Ct.classList.add("show"),clearTimeout(si),si=setTimeout(()=>Ct.classList.remove("show"),t||2500)}function lr(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(fn(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 ed(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(M.kind==="source")return{link:lr(M.source,t),inside:!1};if(M.kind==="copy"&&Ca(P)&&["url","gist","builtin"].includes(P.origin.kind))return{link:lr(P.origin,t),inside:!1};let o=M.kind==="share"?M.data:await yn(ie.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+Lo(o,e),inside:!0}}function td(){let e=j("slidetake:draft");if(!e||e===wo)return null;let t=Sa(e,{kind:"file",name:"your earlier draft"},{exported:!0});W("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function va(){W("slidetake:copy",JSON.stringify(P))}function jt(){if(U)return;let e;if(Fr())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>"+(Ea(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,qe.classList.toggle("unsaved",M.kind==="copy"&&Ea(P)),document.getElementById("btn-reset").hidden=!(M.kind==="copy"&&!Ca(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 ks(e){return!P||!Ea(P)?!0:confirm("Your copy of "+Ee(P.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function Ss(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function ad(){let e=M.kind==="share"?{kind:"shared"}:M.source;return ks("a copy of "+Ee(e))?(P=Sa(M.text,e),M={kind:"copy"},history.pushState(null,"",Ss()+(g&&g!==v[0]?"#"+encodeURIComponent(g):"")),da("Editing your own copy of "+Ee(e)+". The original is unchanged.",4e3),!0):(ie.value=M.text,!1)}function od(){M={kind:"copy"},history.pushState(null,"",Ss()),qe.classList.contains("collapsed")&&ho(),ie.value=P.text,At(!0),jt()}function Fr(){return!!(pe&&M&&M.kind==="source"&&M.source.kind==="url"&&new URL(M.source.url,location.href).pathname===pe.deck)}function rd(e){fetch(pe.save,{method:"PUT",body:e}).catch(()=>da("Could not save "+pe.file+": is npx slidetake still running?",6e3))}async function nd(e){if(e.kind==="builtin")return Ga[e.id==="help"?"docs":e.id]??Ga.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 He=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 He=new URL(e.url,location.href).href,await t.text()}function di(){return M={kind:"source",source:{kind:"builtin",id:"home"},text:Ga.home},M.text}async function id(){if(pe&&ee.page==="source"&&ee.source.kind==="builtin"&&ee.source.id==="home"&&location.pathname==="/"&&(ee.source={kind:"url",url:pe.deck}),U)return He=U.base||location.href,M={kind:"source",source:{kind:"url",url:He},text:ln(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 ma(document.getElementById("new-dialog")),M={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ga["template:blank"]},M.text;if(ee.page==="share")try{let e=await bn(ee.data);return M={kind:"share",data:ee.data,text:e},e}catch{return da("This link's deck is damaged or cut short, so it could not be opened.",6e3),di()}try{let e=await nd(ee.source);return M={kind:"source",source:ee.source,text:e},e}catch(e){return aa.textContent="Could not load the deck ("+e.message+")",da("Could not load "+Ee(ee.source)+": "+e.message,6e3),di()}}var U,pe,hr,Ge,Ue,Ga,ie,N,se,Fo,Un,tl,aa,Go,al,qe,Da,ol,Mt,No,le,Yo,rl,nl,il,sl,ll,cl,oa,u,v,tt,g,pr,J,K,R,te,re,ze,B,ce,z,ea,hl,Ie,qn,Je,Vn,ke,ve,Fe,Ne,Me,Ae,Ml,Tl,Bl,bi,jo,Pl,He,Yn,Hl,jl,Wl,Kn,ql,Fa,Vl,Kl,Jl,Wo,$e,_o,Qe,je,sc,Lt,ue,Ci,Be,Ze,Ce,Na,wt,yt,Xn,mc,Qn,Zn,ei,Y,$t,Zo,Ja,$a,Xa,br,ta,ne,Oe,et,vr,Oi,h,na,ia,fc,wr,gc,Pi,vc,xc,Sc,xt,Ot,It,er,vt,kt,me,ja,he,tr,kr,Ha,Wa,ar,eo,Ec,Ni,st,Ac,Wi,at,ti,_e,Hc,jc,Ki,ot,Ji,or,ca,$i,Xi,Qi,Zi,es,H,Z,S,Jt,_a,ts,os,Ua,Uo,ao,oo,ss,St,F,no,ds,Xe,qo,qc,I,rr,oi,Re,us,ya,Vc,go,rt,ri,Nt,qa,bt,Xt,ir,sr,Qt,ys,Te,Zt,Va,bs,Qc,ni,xe,ii,Ct,si,Zc,cr,dr,li,io,ee,ci,M,P,Es=G(()=>{"use strict";_r();Ur();Vr();Yr();Jr();Xr();Zr();tn();xa();dn();un();Mo();Ao();xn();Sn();zn();Dn();_n();La();U=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();pe=window.SLIDETAKE_LOCAL||null,hr=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!U);Ge=!U||U.recording===!0;document.documentElement.classList.toggle("no-record",!Ge);Ue=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ga={home:wo,docs:qr,features:Gr,privacy:Kr,showcase:an,"template:blank":$r,"template:talk":Qr,"template:recording":en},ie=document.getElementById("editor"),N=document.getElementById("stage"),se=document.getElementById("world"),Fo=document.getElementById("connectors"),Un=document.getElementById("breadcrumbs"),tl=document.getElementById("status-count"),aa=document.getElementById("status-err"),Go=document.getElementById("mm-svg"),al=document.getElementById("mm-label"),qe=document.getElementById("editor-pane"),Da=540,ol=96,Mt=440,No=720,le=960,Yo=180,rl=540,nl=100,il=110,sl=420,ll=.35,cl=1,oa=parseFloat(j("slidetake:slideSize"))||.92,u=new Map,v=[],tt=[],g=null,pr=["focus","path","radial","tree"],J="path",K=!1,R={},te=!0,re=null,ze=document.getElementById("brand"),B=document.getElementById("pip"),ce=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},ea=null;hl='<span class="st-name">'+hr+'Slide<span class="st-take">take</span></span>';Ie=()=>/^(portrait|vertical|9:16)$/i.test(String(R.format||"").trim());qn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};Je=null;Vn=new URLSearchParams(location.search).get("mode");ke=0;ve=null,Fe=-1,Ne=null;Me=document.getElementById("cam-overlay"),Ae="";new ResizeObserver(()=>{Ae&&$o()}).observe(ce);Ml=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(" ")),Tl=0;Bl=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));bi=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),jo=e=>!!e.querySelector("img")&&!e.textContent.trim(),Pl=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(bi)||e.children[0].matches("div.diagram"));He=null;Yn=null;Hl="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",jl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Wl={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"}};Kn=new Set;ql="https://esm.sh/@terrastruct/d2@0.1.33",Fa=null,Vl={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"}};Kl=(e,t)=>e.replace("{","{"+t),Jl=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1476
|
+
`+m+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+f+" -c copy -movflags +faststart "+Ta(s)}let b=La(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 m+"ffmpeg -i "+Ta(a)+" -i /tmp/slidetake-chapters.txt"+f+` -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 "+Ta(s)}var Ln,La,An,gt,tl,Ta,Bn,Aa=G(()=>{"use strict";ka();Ln=e=>e.obsT??e.t,La=e=>e.fps||60,An=(e,t)=>Math.round(e*t/1e3);gt=e=>String(e||"").split(/[\\/]/).pop()||"",tl=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},Ta=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",Bn=e=>(e/1e3).toFixed(3)});function al(e,t,a){let o=a?.5625:1.7777777777777777,r=Math.min(e,t*o),n=r/o;return{w:r,h:n,x:(e-r)/2,y:(t-n)/2}}function Pn(e,t,a,o){let r=al(e,t,o),n=[Math.floor(r.w*a),Math.floor(r.h*a)];return{quality:Re.find(i=>{let s=Oa(i,o);return n[0]>=s.w&&n[1]>=s.h})||null,device:n}}function Jt(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 ve(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 Re,Ba,yt,Oa,ol,zn,Po,Rn,Ia,Dn,Fn,Nn,Hn=G(()=>{"use strict";Aa();Re=[{name:"1080p",w:1920,h:1080,bitrate:8e6},{name:"720p",w:1280,h:720,bitrate:5e6}],Ba=192e3,yt=30,Oa=(e,t)=>t?{...e,w:e.h,h:e.w}:e;ol=["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"],zn=e=>ol.find(t=>e(t))||"",Po=e=>e.startsWith("video/mp4")?"mp4":"webm",Rn=e=>Math.round((e.bitrate+Ba)/8*60);Ia=(e,t)=>t>e?t:e+.001,Dn=e=>e>1/yt?e:0,Fn=e=>e.replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i,""),Nn=(e,t)=>Math.min(e,t)+"p"+(t>e?" portrait":"")});function rl(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 jn(e,t){let{shelf:a,highPass:o}=rl(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 k=d[0].length;for(let m=0;m<t;m++){let f=d[m]||d[0],b=i[m],p=s(m),[T,C,w,x,y,E,L,$]=b,oe=l,X=Math.floor(oe/r),D=(X+1)*r,V=0;for(let de=0;de<k;de++){let ee=f[de];ee>c?c=ee:-ee>c&&(c=-ee);let Q=a.b0*ee+a.b1*T+a.b2*C-a.a1*w-a.a2*x;C=T,T=ee,x=w,w=Q;let Ut=o.b0*Q+o.b1*y+o.b2*E-o.a1*L-o.a2*$;E=y,y=Q,$=L,L=Ut,V+=Ut*Ut,++oe===D&&(n[X]=(n[X]||0)+p*V,V=0,X++,D+=r)}V&&(n[X]=(n[X]||0)+p*V),b.set([T,C,w,x,y,E,L,$])}l+=k},result(){let d=Math.floor(l/r),k=[];for(let p=3;p<d;p++)k.push(((n[p-3]||0)+(n[p-2]||0)+(n[p-1]||0)+(n[p]||0))/(4*r));let m=p=>p.reduce((T,C)=>T+C,0)/p.length,f=k.filter(p=>Pa(p)>-70),b=f.length?f.filter(p=>Pa(p)>Pa(m(f))-10):[];return{integrated:b.length?Pa(m(b)):-1/0,peak:c,peakDb:c>0?nl(c):-1/0}}}}function Ro(e,{limit:t=!1,target:a=-14,ceiling:o=-1.5}={}){if(!isFinite(e.integrated))return 0;let r=Math.min(a-e.integrated,zo);return r<=0||t||e.peakDb==null||!isFinite(e.peakDb)?r:Math.max(0,Math.min(r,o-e.peakDb))}function Do(e,t,a={}){let o=za(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,k=r,m=1,f=!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(m=w<m?w:m+(w-m)*n,m>.999&&(m=1),k+=m-c[d%r],c[d%r]=m,d>=r-1){let x=k/r,y=x>.999?1:x;s.push(y),y<.999&&!f&&b++,f=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 nl,Pa,zo,za,Wn=G(()=>{"use strict";nl=e=>20*Math.log10(e),Pa=e=>-.691+10*Math.log10(e);zo=20;za=e=>Math.pow(10,e/20)});function _n(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 Un(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 qn(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 ve(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 Ra(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 Gn(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 Da(e,t){let a=new Set(t);return e.filter(o=>a.has(o))}function Vn(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 Yn=G(()=>{"use strict";Aa()});var md={};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 fl(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 yl(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,gl),o.replaceWith(...r.childNodes)})}function Ka(){let e=R.brand||"",t=R.logo||"",a=/^chip$/i.test(R.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+pr+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+A(t)+'">':"")+(e?"<span"+(a?' class="chip"':"")+">"+A(e)+"</span>":"");if(De.dataset.html!==o){De.dataset.html=o,De.innerHTML=o;let n=De.querySelector("img");n&&(n.onload=n.onerror=()=>ge(!0))}De.hidden=!o;let r=document.body.classList.contains("portrait");document.body.classList.toggle("portrait",Pe()),r!==Pe()&&ge(!0),ze(),document.title=R.title||"Slidetake",vl(),fi()}function bl(){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 vl(){let e="",t=(o,r)=>{let n=Object.entries(r||{}).filter(([i,s])=>Jn[i]&&s&&typeof s!="object").map(([i,s])=>Jn[i]+":"+String(s).replace(/[;{}<>]/g,"")).join(";");n&&(e+=o+"{"+n+`}
|
|
1477
|
+
`)};[bl(),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 Ae(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),Xe=Xe||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),Xe.clearRect(0,0,1,1),Xe.fillStyle="#000",Xe.fillStyle=a,Xe.fillRect(0,0,1,1),"#"+[...Xe.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function wl(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 lo(){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 fi(){let e=lo()==="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 gi(){let e=lo()==="light"?"dark":"light";U&&U.themeKey?(W(U.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):W("slidetake:mode",e),fi(),le.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&Bt(!0)}function xl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Jo(e){if(!e)return[];let t=fn(e.camera);return!ae||t.some(kl)?t:[]}function kl(e){return!!$e({},e).behind}function Ft(e){return gn(Jo(e),e&&e.frags?e.frags.length:0)}function yi(){let e=Ft(u.get(g));return e[Math.min(Se,e.length-1)]||{cam:0,frag:0}}function Sl(){if(!g)return null;let e=u.get(g),t=Jo(e);if(t.length)return t[Math.min(yi().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=v.indexOf(g)-1;a>=0;a--){let o=Jo(u.get(v[a]));if(o.length)return $e({},o[o.length-1]).behind?null:o[o.length-1]}return null}function El(){let e={corner:(R.pip||"none").toLowerCase(),size:Eo(parseFloat(R.pip_size)||(Pe()?40:24)),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:Wi(),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",$e(e,t)}return $e(e,Sl()),we&&!/\b(off|hide)\b/i.test(we)&&(e.off=!1),$e(e,we),!Yt.includes(e.corner)&&(re||e.used)&&(e.corner="bottom-right"),e.flip&&Yt.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function ze(){let e=!B.hidden&&B.offsetWidth?B.getBoundingClientRect():null,t=je=El();t.behind&&(!g||me)&&(t.full=!1,t.behind=!1);let a=Yt.includes(t.corner),o=ae&&!!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||ae&&!o,ie.dataset.pip=B.hidden||t.full?"none":t.corner,ie.classList.toggle("cam-behind",!B.hidden&&!!t.behind),ie.style.setProperty("--cam-card",String((t.card||0)/100)),ie.classList.toggle("cam-card",(t.card||0)>0),ie.classList.toggle("cam-solid",(t.card||0)>=100),ie.classList.toggle("cam-live",!B.hidden&&!!t.behind&&!o);let r=!!Be;if(Pe()&&/^(left|right)$/.test(t.place||"")&&(t.place="bottom"),$o(!B.hidden&&t.behind&&t.place||""),Be&&!r&&e&&!Ge&&Te.animate&&Te.animate([{opacity:0},{opacity:1}],{duration:300,delay:550,easing:"ease-out",fill:"backwards"}),B.hidden||Ge||!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=Math.max(e.width/i.width,e.height/i.height),l=e.left+e.width/2-(i.left+i.width/2),c=e.top+e.height/2-(i.top+i.height/2),d=Math.max(0,(i.width-e.width/s)/2),k=Math.max(0,(i.height-e.height/s)/2),m=parseFloat(getComputedStyle(B).borderTopLeftRadius)||0;B.animate([{transformOrigin:"50% 50%",transform:"translate("+l+"px,"+c+"px) scale("+s+")",clipPath:"inset("+k+"px "+d+"px round "+10/s+"px)"},{transformOrigin:"50% 50%",transform:"none",clipPath:"inset(0px 0px round "+m+"px)"}],{duration:600,easing:n})}function $o(e){let t=Be,a=Te.querySelector(".cam-box"),o=a&&a.getBoundingClientRect();Be=e,ie.dataset.place=e,Te.innerHTML="";let r=e&&u.get(g);if(!r||!r.el)return;let n=r.el.querySelector(".body"),i=[...n.children].map(k=>{let m=k.cloneNode(!0);return[m,...m.querySelectorAll("[style]")].forEach(f=>{f.style.removeProperty("opacity"),f.style.removeProperty("transform"),f.style.removeProperty("visibility")}),[m,...m.querySelectorAll("[data-text]")].forEach(f=>{f.dataset.text&&(f.textContent=f.dataset.text)}),m}),s=k=>k.matches("figure.media, .diagram, .echarts-container, .gallery"),l=[[e,i]],c=n.clientWidth;l.forEach(([k,m])=>{if(!m.length)return;let f=document.createElement("div");f.className="cam-box "+k;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),f.appendChild(C)};b("cam-text",m.filter(p=>!s(p))),b("cam-media",m.filter(s)),Te.appendChild(f)}),Te.querySelectorAll("img").forEach(k=>{k.complete||k.addEventListener("load",Xo,{once:!0})}),Xo();let d=Te.querySelector(".cam-box");if(o&&t&&t!==e&&d&&!Ge&&d.animate){let k=d.getBoundingClientRect();Math.abs(o.width-k.width)<2&&Math.abs(o.height-k.height)<2&&d.animate([{transform:"translate("+(o.left-k.left)+"px,"+(o.top-k.top)+"px)"},{transform:"none"}],{duration:600,easing:"cubic-bezier(.65,0,.35,1)"})}}function Xo(){let e=N.clientHeight/240;Te.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+")"}),Te.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 Cl(){let e=je;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 Ml(){if(!Ke)return;if(ae){Wt(!0);return}let e=xl();He=(He+1)%e.length,we=e[He],ze(),K||Ct("Camera: "+we),!re&&!B.hidden?ht():ge()}function bi(e){let t=un(e,{render:fl});R=t.deck,u=t.nodes,Ka();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];il.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,ra.textContent=t.errCount?t.errCount+" card(s) had errors":""}function vi(){ot=[...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}}ot.forEach(o=>t(o,0)),v=[];function a(o){v.push(o),u.get(o).children.forEach(a)}return ot.forEach(a),Math.max(1,e)}function Tl(){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 wi(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 Ll(){let{maxH:e,maxDepth:t}=Tl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+dl;let o=cl-Tt,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(k=>n(k,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)}ot.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,wi(l)})}function Al(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?ot.length>1?pl*.5:0:i+hl;for(let d=0;d<400&&(l.forEach(m=>{let f=(m._slot+.5)*t-Math.PI/2;m.cx=c*Math.cos(f),m.cy=c*Math.sin(f),wi(m)}),!!l.some((m,f)=>l.some((b,p)=>p>f&&r(m,b))||o.some(b=>r(m,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function Bl(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(Gt(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 Pl(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||!Ol.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"+ ++Il+"-";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 Ne(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 jo(e){let t=document.createElement("figure");t.className="media",Ne(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function zl(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="'+Mn(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 Xn(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 Dl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=Pl(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",Ne(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&&Oo(s);l&&Ne(n,zl(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>Wo(s)||Nl(s))||(n.classList.add("gallery"),i.some(s=>!Wo(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!Wo(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),jo(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)})):Xn(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!Rl(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){Ne(n,i[0]),jo(i[0]);return}let s=document.createElement("div");s.className="gallery grid",Ne(n,s),i.forEach(l=>{s.appendChild(l),jo(l)}),Xn(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 xi(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function Fl(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 Hl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!Oo(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(ki)),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 jl(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 mr(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&&xi(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Wl(){try{return R.base?new URL(R.base,We||location.href):We?new URL(We):null}catch{return null}}function _l(e){let t=Wl(),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 co(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=Tt;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=ce);let r=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay","img-cover"),r&&(o=ce),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=ce-Fa*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Fa*l)+"px"),o=ce;else if(r||Math.abs(l-16/9)<.08)t.classList.add("img-overlay"),o=ce,l>=16/9&&l<=16/9*1.15&&t.classList.add("img-cover");else if(l<1.3){let d=Math.min(Math.round(Fa*l),ce-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(ce,Math.max(Ho,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(Tt,Math.min(ce,(Fa-ll)*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=Ho);let n=a.querySelectorAll("table");if(n.length){t.style.width=ce+"px";let l=t.offsetWidth-a.clientWidth;n.forEach(c=>{o=Math.max(o,Math.min(Ho,Math.ceil(c.offsetWidth)+l+12))})}let i=a.querySelectorAll("pre");if(i.length){t.style.width=ce+"px";let l=t.offsetWidth-a.clientWidth;i.forEach(c=>{c.style.width="max-content",o=Math.max(o,Math.min(ce,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(ce,Math.ceil(c.offsetWidth*1.3)+l))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(ce,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||Ko,t.classList.remove("measuring")}function Ul(){clearTimeout(Qn),Qn=setTimeout(()=>{u.forEach(co),pa(),ge(!0)},200)}function Yl(){let e=lo()==="light"?"light":"dark",t=Ae(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Zn.has(a)||(Kl(a,Vl[e],t),Zn.add(a)),a}function Kl(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 Xl(){let e=lo()==="light"?"light":"dark",t=Ae("--node-bg"),a=Ae(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...$l[e],N7:t,B1:Ae("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=wl(a,t,n)}),r}function Ql(){let e=Ae("--text"),t=Ae("--text-muted"),a=Ae("--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 Qo(e){return _o[e]||(_o[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete _o[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function tc(){let e=Qe,t=[...le.querySelectorAll(".node pre > code.language-dot")];le.querySelectorAll(".node pre > code.language-echarts").forEach(n=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=n.textContent,Ne(n.parentElement,i)});let a=[...le.querySelectorAll(".node .echarts-container[data-chart]")],o=[...le.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!a.length&&!o.length)return;let r=[];if(t.length)try{if(await Qo(ql),Uo=Uo||await Viz.instance(),e!==Qe)return;let n=Ql();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(Uo.renderSVGElement(Zl(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}Ne(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!Na){let i=await import(Jl);Na=new i.D2}if(e!==Qe)return;let n=Xl();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await Na.compile(ec(i.textContent));s.innerHTML=await Na.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==Qe)return;Ne(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Qo(Gl),e!==Qe)return;let n=Yl();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",()=>{Be&&i.closest(".node")===(u.get(g)||{}).el&&$o(Be)}),l.setOption(Object.assign({backgroundColor:"transparent",animation:!Ge},s))})}catch{r.push("charts")}e===Qe&&(Be&&$o(Be),r.length&&(ra.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(co),pa(),ge(!0))}function ac(){let e=[];return v.forEach(t=>{let a=Rt(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function oc(){let a=0,o=0,r=0;ac().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,k)=>{let m=u.get(d);k&&(l+=90+m._w/2),m.cx=l,m.cy=a,c=l,l+=m._w/2}),o=c,r=s})}function rc(){u.forEach(e=>{e.cx=0,e.cy=0})}function Si(){Qe++,window.echarts&&le.querySelectorAll(".echarts-container").forEach(a=>{let o=echarts.getInstanceByDom(a);o&&o.dispose()}),le.querySelectorAll("div.node").forEach(a=>a.remove());let e=vi(),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?ho(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");Bl(n),Fl(n),Hl(n),Dl(o,n),/^slidetake$/i.test(R.brand||"")&&yl(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=_l(n),a.frags=jl(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Ul,{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)}),le.appendChild(o),a.el=o,mr(a,a.frags.length)}),t&&!ra.textContent&&(ra.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(co),pa(e),tc()}function pa(e){e===void 0&&(e=vi()),J==="radial"?Al(e):J==="path"?oc():J==="focus"?rc():Ll(),le.classList.toggle("focus",J==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),nc(),Nt(),yr()}function nc(){let e="";if(J==="focus"){No.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+'"/>'}No.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+'"/>'}}),No.innerHTML=e}function ho(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function Lt(){let e=N.clientWidth,t=N.clientHeight;le.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+z.zoom+") translate("+-z.x+"px,"+-z.y+"px)",Ii()}function fr(){aa&&(aa.kill(),aa=null)}function Ei(e,t){if(fr(),t||Ge||!window.gsap){Object.assign(z,e),Lt();return}let a=N.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:Lt,onComplete:()=>{aa=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+Tt)));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);aa=n}function ic(){let e=N.getBoundingClientRect(),t=14,a=[];if(!De.hidden&&De.offsetWidth){let r=De.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=Cl();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function sc(){let e=N.clientWidth,t=N.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return ic().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 Zo(e,t,a){let o=N.clientWidth,r=N.clientHeight,n=null;return sc().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 Ci(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function st(e,t){let a=u.get(e);if(!a)return;let o=Zo(a._w,a._h,na),r=Rt(e),n=v.filter(l=>Rt(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return Zo(c._w,c._h,na).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));Ei(Object.assign(Ci(a.cx,a.cy,o,s),{zoom:s}),t)}function ua(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=Zo(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));Ei(Object.assign(Ci((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function ge(e){g&&u.has(g)?st(g,e):ua(e)}function Nt(){let e=g?ho(g):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===g),a.classList.toggle("active-path",e.includes(t.id))}),le.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!g&&v.indexOf(t.dataset.to)<=v.indexOf(g):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),hc(e),Ti()}function Mi(){return cn(new URLSearchParams(location.search).get("duration")??R.duration)}function lc(){return K&&Mi()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Ja(){let e=lc()&&_e.start>0;if(et.classList.toggle("timed",e),!e){et.classList.remove("over");return}let a=(h.active&&h.t0?Ot():performance.now()-_e.start)/Mi();et.firstChild.style.width=Math.min(100,a*100)+"%",et.classList.toggle("over",a>=1)}function cc(){_e.start=performance.now(),clearInterval(_e.timer),_e.timer=setInterval(Ja,1e3),Ja()}function dc(){clearInterval(_e.timer),_e.timer=null,_e.start=0,Ja()}function Ti(){let e=K&&v.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(et.classList.toggle("show",e),!e)return;Ja();let t=v.indexOf(g),a=0,o=0;v.forEach((r,n)=>{let i=Ft(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(Se,i-1)+1)}),et.lastChild.style.width=(a?o/a*100:0)+"%"}function hc(e){Kn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===g?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),Kn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||_(t.dataset.id)}))}function ma(e){let t=u.get(g);t&&(mr(t,yi().frag,e),ze(),(B.hidden||!je||!je.full||je.behind)&&mc(t),gr(t))}function uc(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 mc(e){if(e._played||!window.gsap||Ge)return;e._played=!0;let t=uc(e);t&&t.length&&(e._auto=t,gsap.from(t,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.3,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(fc)}function ia(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=>pc.includes(r)?"transform":r));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function fc(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 gr(e){clearTimeout(At),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(At=setTimeout(()=>{g===e.id&&Ue(1)},e.autoslide))}function Li(e){let t=e&&e!==v[0]?e:"";try{M&&M.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Ao(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!==g){we=null,He=-1,Se=a?Ft(u.get(e)).length-1:0;let n=u.get(g);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),Bi()}let o=e!==g;if(o&&(Ai=g),g=e,clearTimeout(me),me=null,o&&J==="focus"&&!t&&!Ge){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ma(o),o&&!Oe&&da("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(ua(),me=setTimeout(()=>{me=null,g===e&&(ze(),st(e))},1900),ze()):st(e,t),Nt(),yr(),Li(e)}function Bi(){let e=u.get(g);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>xi(t,"pauseVideo")),mr(e,e.frags.length,!0),ia(e))}function gc(){if(!g&&tt&&u.has(tt)){Oi();return}g&&(tt=g),J==="focus"&&br("path"),Bi(),clearTimeout(At),g=null,ze(),Nt(),yr(),ua(),Li(null)}function Oi(){if(me)return clearTimeout(me),me=null,ze(),st(g),!0;if(!g&&tt&&u.has(tt)){let e=tt;return tt=null,_(e),!0}return!1}function Ue(e){if(!g){v.length&&_(v[e>0?0:v.length-1]);return}if(me&&e>0){clearTimeout(me),me=null,ze(),st(g);return}let t=Ft(u.get(g)),a=Math.min(Se,t.length-1)+e;if(a>=0&&a<t.length){Se=a,we=null,He=-1,ma(),!re&&!B.hidden&&je.used?ht():ge(),Nt();return}let o=v.indexOf(g)+e;o>=0&&o<v.length&&_(v[o],!1,e<0)}function yc(){let e=u.get(g);e&&e.parent&&_(e.parent)}function bc(){let e=u.get(g);e&&e.children.length?_(e.children[0]):!g&&v.length&&_(v[0])}function yr(){let e=[...u.values()];if(!e.length){Yo.innerHTML="",Me=null;return}sl.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-Tt/2,r=Math.max(...e.map(t))+Tt/2,n=Math.min(...e.map(a))-Ko/2,i=Math.max(...e.map(a))+Ko/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)),k=l/2-(o+r)/2*d,m=c/2+5-(n+i)/2*d,f=g?ho(g):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+k)+'" y1="'+(a(T)*d+m)+'" x2="'+(t(p)*d+k)+'" y2="'+(a(p)*d+m)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===g?"var(--accent)":f.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+k)+'" cy="'+(a(p)*d+m)+'" r="'+(p.id===g?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"/>',Yo.innerHTML=b,Me={s:d,ox:k,oy:m},Ii()}function Ii(){let e=document.getElementById("mm-viewport");if(!e||!Me)return;let t=N.clientWidth/z.zoom,a=N.clientHeight/z.zoom;e.setAttribute("x",(z.x-t/2)*Me.s+Me.ox),e.setAttribute("y",(z.y-a/2)*Me.s+Me.oy),e.setAttribute("width",Math.max(2,t*Me.s)),e.setAttribute("height",Math.max(2,a*Me.s))}function Bt(e){bi(se.value),g&&!u.has(g)&&(g=null),Si(),g?_(g,e):v.length?_(v[0],e):(g=null,ua(!0))}function br(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&&!Ge&&(le.classList.add("morph"),setTimeout(()=>le.classList.remove("morph"),700)),pa(),Lt(),g?st(g,t):ua(t))}function Pi(e){return Math.max(.04,Math.min(5,e))}function vc(e){na=Math.round(Math.max(ul,Math.min(ml,e))*100)/100,W("slidetake:slideSize",na),g&&st(g)}function ei(e){g?vc(na+e*.1):zi(e>0?1.2:1/1.2)}function zi(e,t,a){fr();let o=Pi(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,Lt()}function po(){U||(Ve.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!Ve.classList.contains("collapsed")))}function xe(e){K=e,document.body.classList.toggle("presenting",e),Es(document.getElementById("btn-present"),e),Cs();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!g&&v.length&&_(v[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!re&&!ae&&ht(),e?gr(u.get(g)):clearTimeout(At),e?cc():dc(),Ti()}function Ot(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function fa(e){e.classList.add("open")}function Sc(e){if(W("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+xc]=!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}))}Di()}function Di(){xr.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===kc())))}function ga(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function Ec(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return $a.value=t||"localhost",Xa.value=a||"4455",Qa.value=o.join(":"),!0}try{let t=JSON.parse(j("slidetake:obs")||"null");t&&($a.value=t.host||"localhost",Xa.value=t.port||"4455",Qa.value=t.password||"",vr.checked=!0)}catch{}return!1}function Ni(){if(vr.checked)W("slidetake:obs",JSON.stringify({host:$a.value.trim(),port:Xa.value.trim(),password:Qa.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function $t(e,t,a){oa.textContent=e,oa.className=t||"",oa.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function Mc(e){return location.protocol==="https:"&&!Cc(e)}async function kr(){let e=$a.value.trim()||"localhost",t="ws://"+e+":"+(Xa.value.trim()||"4455");if(Mc(e)){Ie=!1,$t("Blocked here","err",Tc);return}$t("Connecting\u2026"),oa.title="Connecting to "+t;try{await Qo(wc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Ie=!1,$t("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&at&&(at(),at=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&zt("Stopped in OBS")});let o=await ne.connect(t,Qa.value||void 0);Ie=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(wr=r.fpsNumerator/r.fpsDenominator),Ri=r&&r.outputWidth&&r.outputHeight?Nn(r.outputWidth,r.outputHeight):""}catch{}$t("Connected","ok",""),oa.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),Ni(),Y.classList.contains("open")&&ct()&&(O("Connected to OBS. Press \u25CF Record."),Je())}catch(a){Ie=!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 Lc(){let e=document.getElementById("rec-screen"),t=screen.width,a=screen.height;if(Pe()){e.innerHTML='<span class="warn">This deck is portrait (9:16). In OBS, set the canvas to 1080\xD71920 (Settings \u2192 Video) and fit the 9:16 column in the middle of the screen to it.</span>';return}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 Ee(){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?zn(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}=Pn(screen.width,screen.height-Bc,devicePixelRatio||1,Pe());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 uo(){ar++,pe&&(cancelAnimationFrame(pe.raf),pe.stream.getTracks().forEach(e=>e.stop()),pe.ctx.close().catch(()=>{}),pe=null,tr.value=0,St.getContext("2d").clearRect(0,0,St.width,St.height),Hi())}function Hi(){or++,_a&&(_a.getTracks().forEach(e=>e.stop()),_a=null),Sr.srcObject=null}async function ji(){Hi(),Er();let e=or,t=kt.value;if(ja.hidden=t!=="none"&&!!t,ja.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==or){a.getTracks().forEach(o=>o.stop());return}_a=a,Sr.srcObject=a}catch{ja.hidden=!1,ja.textContent="The camera isn\u2019t available"}}async function Za(){await uo();let e=ar;try{let t=It.value,a=await navigator.mediaDevices.getUserMedia({audio:as(t)});if(e!==ar){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=pe={stream:a,ctx:o,raf:0},s=St.getContext("2d"),l=St.width,c=St.height,d=Ae("--accent"),k=()=>{if(pe!==i)return;r.getFloatTimeDomainData(n);let m=0;for(let f of n)m=Math.max(m,Math.abs(f));tr.value=Math.max(m,tr.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let f=0;f<n.length;f++){let b=f/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[f]*3))*(c/2-4);f?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(k)};k()}catch(t){wt.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function eo(e=!0){try{e&&!pe&&await Za();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"),k=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),m=d.map((b,p)=>Fn(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));m.forEach((b,p)=>{let T=m.slice(0,p).filter(C=>C===b).length;T&&(m[p]=b+" "+(T+1))});let f=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(k)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===f?" selected":"")+">"+A(m[p]+(k(b)?" (system default)":""))+"</option>").join("")},o=Cr();kt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=j("slidetake:mic")||"";It.innerHTML=a("audioinput",r),r&&It.value===r&&pe&&pe.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Za()}catch{}}function Wi(){let e=j("slidetake:mirror");return e?e==="on":/^(yes|true|on)$/i.test(R.pip_mirror||"")}function Er(){to.checked=Wi(),Sr.parentElement.classList.toggle("mirror",to.checked)}function Cr(){let e=j(_i());return e||(Oc()?j("slidetake:cam")||"default":"none")}function Ic(e){W(_i(),e),e!=="none"&&e!=="default"&&W("slidetake:cam",e)}function Pc(){h.camWas=!ae;let e=Cr()!=="none";e!==!ae&&Wt(e,!0)}function Ui(){h.camWas!=null&&(h.camWas!==!ae&&Wt(h.camWas,!0),h.camWas=null)}async function qi(){let e=Ee();if(!e.ok)return wt.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;Wa&&(wt.innerHTML='<span class="warn">'+A(Wa)+"</span>",Wa="");let t=Re.indexOf(e.quality),a=j("slidetake:quality");Pt.innerHTML=Re.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=Re.find(s=>s.name===Pt.value)||e.quality;o=" Room for about "+Math.floor((r-n)/Rn(i))+" minutes of takes."}catch{}return wt.querySelector(".warn")||(wt.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function zc(e){fe=e,W("slidetake:rec-mode",e),ca({setup:jt()})}function ca(e={}){Ke&&(Ee().ok&&(fe||"browser")==="browser"?Pr(e):Rc(e))}function Rc(e={}){let t=mo().find(a=>a.key===Ye()&&a.withObs&&!a.inBrowser);is(t||{key:Ye(),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:wr,events:[],picks:{},empty:!0},e)}async function Mr(){if(!(!Ke||h.active||!v.length)){if(!Dc()){ir({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(Ee().ok&&(fe||"browser")==="browser"){let t=Ra(dt(),yo()).filter(r=>!r.pick).map(r=>r.id),a=v.indexOf(g),o=t.length?t:a>0?v.slice(a):v;ao("browser",o.length===v.length?null:o);return}if(!Ie&&j("slidetake:obs")&&await kr(),Ie){ao("obs");return}ir({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function Tr(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function Lr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}function Vi(){if(!document.body.classList.contains("rec-frame"))return;let e=devicePixelRatio||1,t=Pe()?9/16:16/9,a=xt.clientWidth,o=xt.clientHeight,r=s=>Math.floor(s*e/2)*2/e,n=r(Math.min(o,a/t)),i=r(n*t);i>a&&(i=r(a),n=r(i/t)),Object.assign(ie.style,{width:i+"px",height:n+"px",aspectRatio:"auto",margin:Math.floor((o-n)/2)+"px 0 0 "+Math.floor((a-i)/2)+"px"})}function Ar(e){document.body.classList.toggle("rec-frame",e),e?Vi():["width","height","aspectRatio","margin"].forEach(t=>ie.style.removeProperty(t.replace(/[A-Z]/g,a=>"-"+a.toLowerCase())))}async function Yi(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(ie)):await e.cropTo(await CropTarget.fromElement(ie))}function Fc(e){let t=devicePixelRatio||1,a=ie.clientWidth*t,o=ie.clientHeight*t,r=Re.slice(Re.indexOf(e));return r.find(n=>{let i=Oa(n,Pe());return a>=i.w-2&&o>=i.h-2})||r[r.length-1]}async function Nc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Yi(e.track)}catch{}let t=Fc(e.quality);t!==e.quality&&(Dt("Recording at "+t.name+": the frame on this screen is too small for "+e.quality.name+".",5e3),e.quality=t),await e.track.applyConstraints(Gi(e.quality)).catch(a=>console.warn("Slidetake: the recording size was refused",a)),await la()}async function Hc(){let e=Ee();if(!e.ok)throw new Error(e.why);let t=Re.find(s=>s.name===Pt.value)||e.quality;Ar(!0);let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:yt},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 Yi(o)}catch(s){throw r(),new Error("Chrome could not record just the slides ("+(s.message||s.name)+").")}await o.applyConstraints(Gi(t)).catch(s=>console.warn("Slidetake: the recording size was refused",s));let n;try{let s=j("slidetake:mic");n=await navigator.mediaDevices.getUserMedia({audio:as(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 Tr(i,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&zt("Sharing stopped")})}function Ki(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),Ar(!1))}function jc(e){let t=h.browser,a="take-"+t.clips.length+"."+Po(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:Ba}),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(Ot()),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 ao(e,t){if(h.active||!v.length)return;let a=e==="obs";if(uo(),fe||(fe=a?"obs":"browser",W("slidetake:rec-mode",fe)),e==="browser"){K||xe(!0);try{await Hc()}catch(l){Ar(!1),K&&xe(!1),Wa=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,Pr({setup:!0});return}}ga();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"),Rr(),K||xe(!0),Pc(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Oe=!0,_(n,!0,!0),Oe=!1,B.getAnimations().forEach(l=>l.finish()),await la(),document.body.classList.remove("no-anim")):(g===r&&(Se=0,we=null,He=-1),_(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=Qt.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",Qt.querySelector(".num").textContent=l,Qt.classList.add("show"),await sa(1e3),!h.active)return;if(Qt.classList.remove("show"),await la(),a){let l=new Promise(c=>{at=c,setTimeout(()=>{at&&(at(),at=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 Nc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){da("slide",r),h.browser&&await h.browser.chain,ia(s),Oe=!0,_(r),Oe=!1;return}ia(s),ma(!0),da("slide",g)}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(()=>Lr(t.id)),Ki(),h.browser=null}Qt.classList.remove("show"),document.body.classList.remove("recording"),K&&xe(!1),Ui(),Ct(e)}function da(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(Ot()),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&&jc(r),h.withObs&&Ie&&(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((ai.includes(t)||oi.includes(t)||ri.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?Br("Take cancelled"):zt("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||rt)){if(ri.includes(t)){Gc();return}h.paused||(ai.includes(t)?_c():oi.includes(t)&&Uc())}}function _c(){let e=Ft(u.get(g)),t=Math.min(Se,e.length-1)>=e.length-1,a=v.indexOf(g);if(!t){Ue(1);return}if(!h.only){a===v.length-1?zt():Ue(1);return}let o=v.slice(a+1).find(r=>h.only.has(r));o?v[a+1]===o?Ue(1):Ji(v[v.indexOf(o)-1],o,"slide"):zt()}async function Uc(){let e=u.get(g);if(!e||rt)return;let t=g,a=Ai;if(!a||a===t||!u.has(a)){qc(e);return}Ji(a,t,"retake")}async function Ji(e,t,a){let o=u.get(t);if(!o||rt)return;rt=!0;let r=Ot();document.body.classList.add("no-anim");let n=u.get(e);Oe=!0,n._played=!0,_(e,!0,!0),B.getAnimations().forEach(i=>i.finish()),Oe=!1,await la(),document.body.classList.remove("no-anim"),da(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await $i(),ia(o),Oe=!0,_(t),Oe=!1,!re&&!B.hidden&&je.used&&ht(),rt=!1}async function $i(){let e=h.events[h.events.length-1];e&&(e.skip=ni/2),await sa(ni)}async function qc(e){rt=!0,Se=0,we=null,He=-1,ia(e),ma(!0),!re&&!B.hidden&&je.used?ht():ge(),Nt(),da("retake",g),h.withObs&&await $i(),rt=!1}async function Gc(){if(h.t0)if(h.paused){if(er.classList.remove("show"),await la(),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,gr(u.get(g))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(At),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()})}er.classList.add("show")}}async function zt(e){if(!h.active||h.finishing)return;if(h.counting){Br("Take cancelled");return}h.finishing=!0,clearTimeout(At),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,er.classList.remove("show"));let t=Math.round(Ot()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await sa(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 sa(600),await o.chain,t=Math.round(Ot()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),Ki(),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&&xe(!1),Ui();let r={key:Ye(),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?yt:wr,...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){Zc(r);return}Or(r),is(r,{note:(e?e+". ":"")+ve(r).size+" slides recorded with OBS."})}function Ye(){return mt(R.title||(v[0]?u.get(v[0]).title:"deck"))}function mo(){try{return JSON.parse(j("slidetake:sessions")||"[]")}catch{return[]}}function Or(e){let t=mo().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&Lr(a.takesId)}),W("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function Rt(e){let t=u.has(e)?ho(e):[e];return t[Math.min(1,t.length-1)]}function Xi(e,t){let a=Rt(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function O(e,{warn:t=!1,html:a="",title:o=""}={}){Xt.classList.toggle("warn",t),a?Xt.innerHTML=a:Xt.textContent=e,Xt.title=o||Xt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>fs(!0))}function is(e,t={}){ga(),H=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":ve(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+ft(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?" ("+gt(e.outputPath)+")":"";let n=La(e);oo.value=[...oo.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,S.src&&(e.inBrowser||qe!==gt(e.outputPath)&&e.outputPath)&&(S.removeAttribute("src"),S.load(),qe=""),document.getElementById("rv-novideo").hidden=!!S.src||!!e.empty,Z=null,F=null,Ht(),fo(),fa(Y),t.setup?bo(t):(vo(),eo(!1).then(Je)),O(t.note||(e.empty?Ie?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(S.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||rd(e)}function fo(){if(H&&H.board){lt();return}let e=H,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...ve(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=Rt(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 "+ft(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+xa(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,Or(e),fo();let r=ve(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&&go([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else no([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,ls(e),ds(e)}function ls(e){let t=Vc(e),a=document.getElementById("rv-chapters");ss=t.lines.join(`
|
|
1478
|
+
`),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 cs(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 ds(e){let t=document.getElementById("rv-final"),a=++qo,o=Kt(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 ")+ft(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of Jt(e))qa.has(i.clip)||qa.set(i.clip,(await ya(i.clip)).size),n+=qa.get(i.clip);a===qo&&(t.textContent=r(n))}catch{a===qo&&(t.textContent=r(null))}}function no(e){if(!S.src){ro=e,O(lr?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}ro=null,Z={ranges:e,i:0},O("\u25B6 "+e[0].title);let t=()=>{S.currentTime=e[0].start/1e3,S.play().catch(a=>{a&&a.name!=="AbortError"&&O("Could not play: "+a.message,{warn:!0})})};S.readyState>=1?t():S.addEventListener("loadedmetadata",t,{once:!0})}function Ht(){Et=null}function Ir(){let e=F&&!F.single&&!S.paused;hs.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 Kc(e){let t=H?Jt(H):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;Et=o?o.id:null,O(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function ps(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 ya(e){let[t,a]=e.split("/");return(await(await Tr(t)).getFileHandle(a)).getFile()}async function go(e,t=0,a=!1){if(!(!H||H.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ya(e[t].clip);if(!Y.classList.contains("open"))return;S.src&&URL.revokeObjectURL(S.src),S.src=URL.createObjectURL(o),O("\u25B6 "+e[t].title),await S.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 us(){let e=F;if(e.i+1<e.parts.length){go(e.parts,e.i+1,e.single);return}F=null,S.pause(),e.single?Kc(e.parts[0]):O(""),Ir()}async function Jc(e){if(!e.where)return!0;try{let t=await zr("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 fs(e){let t=H;if(!t||!t.inBrowser||t.cleaned)return;let a=Jt(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)]),nt(),ha(),t.type]),r=t.board&&I.lastDownload;if(!e&&r&&r.sig===o&&await Jc(r)){O("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(Go(r))+".",title:"Already saved in "+Go(r)+". A new video is made only when a take or the sound settings change."});return}let n=Po(t.type||"")==="mp4",i=Ye()+" "+Xc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await gs(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=io;c.disabled=!0,Ze("Preparing\u2026");try{let d=await import(Ac),k=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:k}),f=1,b="",p=nt()&&ha();if(nt()){let D=await ii(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let V=Ro(D,{limit:p});if(p&&Math.abs(V)>=.05){let Q=await ii(d,a,za(V),!0,"Checking");Q&&isFinite(Q.integrated)&&(V=Math.min(V+(-14-Q.integrated),zo))}f=za(V);let de=p?-14:D.integrated+V,ee=!p&&Ro(D,{limit:!0})-V>.5;b=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(V)<.05?" LUFS, left as is":" \u2192 "+de.toFixed(1)+" LUFS")+(ee?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=f!==1||p;await $c(d,a);let C=null,w=null,x=0,y=-1,E=-1,L=null,$=[],oe=async()=>{for(;$.length&&L.ready()>=$[0].n;){let D=$.shift(),V=L.take(D.n),de=new Float32Array(D.n*D.ch);V.forEach((ee,Q)=>de.set(ee,Q*D.n)),await w.add(new d.AudioSample({data:de,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,V]of a.entries()){Ze("Joining "+(D+1)+"/"+a.length);let de=new d.Input({source:new d.BlobSource(await ya(V.clip)),formats:d.ALL_FORMATS}),ee=await de.getPrimaryVideoTrack(),Q=await de.getPrimaryAudioTrack();if(!ee)throw new Error(V.title+" has no video");C||(C=new d.EncodedVideoPacketSource(await ee.getCodec()),m.addVideoTrack(C,{frameRate:yt}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Ba}):new d.EncodedAudioPacketSource(await Q.getCodec()),m.addAudioTrack(w)),await m.start());let Ut={decoderConfig:await ee.getDecoderConfig()},Hr=await new d.EncodedPacketSink(ee).getFirstPacket(),ye=Dn(Hr?Hr.timestamp:0),pt=0,jr=!0;for await(let q of new d.EncodedPacketSink(ee).packets())q.timestamp>=V.keep||(y=Ia(y,x+q.timestamp-ye),await C.add(q.clone({timestamp:y}),jr&&D===0?Ut:void 0),jr=!1,pt=Math.max(pt,q.timestamp-ye+q.duration));if(Q&&w&&T)for await(let q of new d.AudioSampleSink(Q).samples(ye,ye+pt)){if(q.timestamp<ye-1e-4||q.timestamp-ye+q.duration>pt+1e-4){q.close();continue}E=Ia(E,x+q.timestamp-ye);let be=ps(q);if(be.forEach(he=>{for(let ut=0;ut<he.length;ut++)he[ut]*=f}),p)L=L||Do(q.sampleRate,be.length),L.push(be),$.push({t:E,n:q.numberOfFrames,rate:q.sampleRate,ch:be.length}),q.close(),await oe();else{let he=q.numberOfFrames,ut=new Float32Array(he*be.length);be.forEach((Os,Is)=>ut.set(Os,Is*he)),await w.add(new d.AudioSample({data:ut,format:"f32-planar",numberOfChannels:be.length,sampleRate:q.sampleRate,timestamp:E})),q.close()}}else if(Q&&w){let q={decoderConfig:await Q.getDecoderConfig()},be=!0;for await(let he of new d.EncodedPacketSink(Q).packets())he.timestamp<ye-1e-4||he.timestamp-ye+he.duration>pt+1e-4||(E=Ia(E,x+he.timestamp-ye),await w.add(he.clone({timestamp:E}),be&&D===0?q:void 0),be=!1)}x+=pt}if(L&&(L.end(),await oe(),L.events&&(b+=", "+L.events+" peak"+(L.events===1?"":"s")+" limited")),Ze("Finishing\u2026"),await m.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([k.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,ba()),O("Saved in "+Go(X)+" ("+ft(x*1e3)+b+")."),Ze("\u2713 Saved"),ms=setTimeout(()=>Ze(),2500)}catch(d){Ze(),O("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function ii(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){Ze(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ya(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let k=ps(d);n=n||jn(d.sampleRate,k.length),a!==1&&o?(k.forEach(m=>{for(let f=0;f<m.length;f++)m[f]*=a}),i=i||Do(d.sampleRate,k.length),i.push(k),i.ready()&&n.add(i.take(i.ready()))):n.add(k),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function $c(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ya(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 gs(e){if(!window.showDirectoryPicker)return null;let t=e?null:await zr("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"}),ws("video-folder",t),t}function dt(){let e=ys();if(I&&nr===e)return I;nr=e;try{I=JSON.parse(j(e)||"null")}catch{I=null}return(!I||!Array.isArray(I.takes))&&(I={takes:[],picks:{},type:"",quality:""}),I}function Zc(e){dt();let t=qn(e,e.takesId,yo());t.forEach(a=>{delete I.picks[a.id]}),I.takes.push(...t),Object.assign(I,{type:e.type,quality:e.quality}),ba(),Fe.clear(),Pr({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function bs(){let e=Ra(dt(),yo()),t=Object.assign(Gn(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 bo(e={}){Y.classList.add("setup-view"),li.textContent=e.note||"",li.hidden=!e.note,it.textContent="\u2190 Back",it.title="Back to Studio",it.setAttribute("aria-expanded","true"),ed()}function vo(){let e=jt();e&&Y.classList.remove("setup-view"),it.textContent="\u2699 Setup",it.title="Settings: camera, microphone, video, OBS and files",it.setAttribute("aria-expanded","false"),e&&(uo(),Je())}function ir(e={}){Y.classList.contains("open")?bo(e):ca({...e,setup:!0})}function ed(){let e=()=>{Je(),jt()&&ji()};if(ct()){Lc(),eo(!1).then(e);return}wt.innerHTML="",qi().then(t=>{t.ok?eo().then(e):e()})}function Je(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(kt)||(Cr()==="none"?"No camera":"Camera"),a=ct(),o=a?Ri:Ee().ok?Pt.value:"",r=a?[t]:[t,e(It)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",vt.classList.toggle("on",a),vt.setAttribute("aria-pressed",String(a)),vt.disabled=!Ee().ok,vt.title=vt.disabled?Ga+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+Ga:"Easy mode: recording in "+Ga+". Click for pro mode, with OBS"}function Pr(e={}){Ke&&(ga(),dt(),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,S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),Z=null,F=null,Ht(),Ua=-1,lt(),fa(Y),e.setup||!Ee().ok?bo(e):(vo(),qi().then(()=>eo(!1)).then(Je)),O(e.note||ns()||(I.takes.length?td()+". Click a take to preview it.":v.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function td(){let e=Ra(dt(),yo()),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 lt(){let{rows:e,sess:t}=bs();H=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=Rt(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"},k=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 "+ft(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":"")+(Fe.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(Fe.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+k+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{I.picks[i.dataset.id]=i.dataset.uid,ba(),lt();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&go([{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?Vn(v,si,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?Fe.add(c):Fe.delete(c)}),Ht(),si=i.dataset.id,lt()}));let r=Da(v,Fe),n=Ee().ok;document.getElementById("rv-rec").disabled=!n,Ua>=0&&r.length!==Ua&&O(ns()||"Record takes the whole deck."),Ua=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,ls(t),ds(t)}async function ad(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await Tr(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]}),ba(),S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ht(),lt()}function vs(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 zr(e){let t=async a=>{let o=await vs(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 ws(e,t){try{(await vs()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function wo(e){lr=!0;try{return await od(e)}finally{lr=!1}}async function od(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 va(e,t,a){S.src&&URL.revokeObjectURL(S.src),Zt=t||null,a||(sr=0),S.src=URL.createObjectURL(e),qe=e.name,document.getElementById("rv-novideo").hidden=!0,O("Loaded "+e.name+". Click a take to preview it."),ro?no(ro):a&&Z&&no(Z.ranges.slice(Z.i))}async function rd(e){let t=gt(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(qe===t&&S.src))try{let a=await zr("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);O("Opening "+t+"\u2026"),va(await wo(o),o)}catch{}}function Ct(e,t){if(!h.active){if(clearTimeout(Va),!B.hidden&&!B.classList.contains("live")){ta.classList.remove("show"),ks.textContent=e,B.classList.add("msg"),t||(Va=setTimeout(Ss,9e3));return}ta.textContent=e,ta.classList.add("show"),t||(Va=setTimeout(()=>ta.classList.remove("show"),9e3))}}function Ss(){ks.textContent="PIP camera",B.classList.remove("msg")}function Rr(){clearTimeout(Va),ta.classList.remove("show"),Ss()}function Vo(){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 Dr(){re&&re.getTracks().forEach(t=>t.stop()),re=null;let e=B.querySelector("video");e&&e.remove()}async function ht(){if(!(re||ae)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Ct("Camera not available on this page."+Vo(),!0);return}if(Le.disabled)return;Le.disabled=!0,Ct("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}),Rr()}catch(t){let a=t&&t.name;Ct(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Vo():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+")":"")+"."+Vo(),!0);return}finally{Le.disabled=!1,Fr()}re.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Dr(),Ka(),ge()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=re,B.appendChild(e)}Ka(),ge()}}function Es(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Fr(){Le.querySelector("svg")||(Le.innerHTML=nd+'<span class="lbl"> <u class="key">C</u>amera</span>'),Le.classList.toggle("on",!ae),Le.setAttribute("aria-pressed",String(!ae)),Le.title=ae?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function Wt(e,t){e&&!Ke||(ae=!e,t||W("slidetake:camera",e?"on":"off"),ae&&(Dr(),Rr()),we=null,He=-1,Se=Math.min(Se,Math.max(0,Ft(u.get(g)).length-1)),Fr(),Ka(),ma(),Nt(),ge(),!K&&!t&&Ct(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&ht())}function Cs(){document.body.classList.remove("idle"),clearTimeout(ci),K&&(ci=setTimeout(()=>document.body.classList.add("idle"),2e3))}function Dt(e,t){Mt.textContent=e,Mt.classList.add("show"),clearTimeout(hi),hi=setTimeout(()=>Mt.classList.remove("show"),t||2500)}function cr(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(vn(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 sd(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(M.kind==="source")return{link:cr(M.source,t),inside:!1};if(M.kind==="copy"&&Ma(P)&&["url","gist","builtin"].includes(P.origin.kind))return{link:cr(P.origin,t),inside:!1};let o=M.kind==="share"?M.data:await xn(se.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+Ao(o,e),inside:!0}}function ld(){let e=j("slidetake:draft");if(!e||e===xo)return null;let t=Ea(e,{kind:"file",name:"your earlier draft"},{exported:!0});W("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function wa(){W("slidetake:copy",JSON.stringify(P))}function _t(){if(U)return;let e;if(Nr())e='<span class="mine">'+A(ue.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(Ce(P.origin))+"</span>"+(Ca(P)?' <span class="edited">\xB7 edited</span>':"");else{let a=M.kind==="share"?"a shared deck":Ce(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,Ve.classList.toggle("unsaved",M.kind==="copy"&&Ca(P)),document.getElementById("btn-reset").hidden=!(M.kind==="copy"&&!Ma(P));let t=document.getElementById("continue");t.hidden=M.kind==="copy"||!P,P&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+Ce(P.origin))}function Ms(e){return!P||!Ca(P)?!0:confirm("Your copy of "+Ce(P.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function Ts(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function cd(){let e=M.kind==="share"?{kind:"shared"}:M.source;return Ms("a copy of "+Ce(e))?(P=Ea(M.text,e),M={kind:"copy"},history.pushState(null,"",Ts()+(g&&g!==v[0]?"#"+encodeURIComponent(g):"")),Dt("Editing your own copy of "+Ce(e)+". The original is unchanged.",4e3),!0):(se.value=M.text,!1)}function dd(){M={kind:"copy"},history.pushState(null,"",Ts()),Ve.classList.contains("collapsed")&&po(),se.value=P.text,Bt(!0),_t()}function Nr(){return!!(ue&&M&&M.kind==="source"&&M.source.kind==="url"&&new URL(M.source.url,location.href).pathname===ue.deck)}function hd(e){fetch(ue.save,{method:"PUT",body:e}).catch(()=>Dt("Could not save "+ue.file+": is npx slidetake still running?",6e3))}async function pd(e){if(e.kind==="builtin")return Ya[e.id==="help"?"docs":e.id]??Ya.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 We=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 We=new URL(e.url,location.href).href,await t.text()}function mi(){return M={kind:"source",source:{kind:"builtin",id:"home"},text:Ya.home},M.text}async function ud(){if(ue&&te.page==="source"&&te.source.kind==="builtin"&&te.source.id==="home"&&location.pathname==="/"&&(te.source={kind:"url",url:ue.deck}),U)return We=U.base||location.href,M={kind:"source",source:{kind:"url",url:We},text:pn(U.settings||{})+String(U.markdown||"")},M.text;if(te.page==="edit"){if(P)return M={kind:"copy"},P.text;history.replaceState(null,"","/new"+location.search),te.page="pick"}if(te.page==="pick")return fa(document.getElementById("new-dialog")),M={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ya["template:blank"]},M.text;if(te.page==="share")try{let e=await kn(te.data);return M={kind:"share",data:te.data,text:e},e}catch{return Dt("This link's deck is damaged or cut short, so it could not be opened.",6e3),mi()}try{let e=await pd(te.source);return M={kind:"source",source:te.source,text:e},e}catch(e){return ra.textContent="Could not load the deck ("+e.message+")",Dt("Could not load "+Ce(te.source)+": "+e.message,6e3),mi()}}var U,ue,pr,Ke,Ge,Ya,se,N,le,No,Kn,il,ra,Yo,sl,Ve,Fa,ll,Tt,Ho,ce,Ko,cl,dl,hl,pl,ul,ml,na,u,v,ot,g,ur,J,K,R,ae,re,De,B,ie,z,aa,gl,Pe,Jn,Xe,$n,Se,we,He,je,Te,Be,Ol,Il,Rl,ki,Wo,Nl,We,Qn,ql,Gl,Vl,Zn,Jl,Na,$l,Zl,ec,_o,Qe,Uo,et,_e,pc,At,me,Ai,Oe,tt,Me,Ha,xt,bt,ti,wc,ai,oi,ri,Y,Qt,er,$a,Xa,Qa,vr,oa,ne,Ie,at,wr,Ri,h,sa,la,xc,xr,kc,Fi,Cc,Tc,Ac,kt,It,Pt,tr,wt,St,fe,Wa,pe,Bc,ar,Sr,ja,_a,or,to,Oc,_i,ct,Dc,Gi,rt,ni,qe,Vc,Yc,Qi,nt,Zi,rr,ha,es,ts,as,os,rs,H,Z,S,Xt,Ua,ns,ss,qa,qo,oo,ro,hs,Et,F,io,ms,Ze,Go,Xc,I,nr,si,Fe,ys,ba,Qc,yo,it,li,jt,Ga,vt,Zt,sr,lr,ea,xs,Le,ta,Va,ks,nd,ci,ke,di,Mt,hi,id,dr,hr,pi,so,te,ui,M,P,Ls=G(()=>{"use strict";qr();Gr();Yr();Jr();Xr();Zr();tn();on();nn();ka();mn();yn();To();Bo();Cn();Tn();Hn();Wn();Yn();Aa();U=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();ue=window.SLIDETAKE_LOCAL||null,pr=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!U);Ke=!U||U.recording===!0;document.documentElement.classList.toggle("no-record",!Ke);Ge=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ya={home:xo,docs:Vr,features:Kr,privacy:$r,showcase:sn,"template:blank":Qr,"template:talk":en,"template:recording":an,"template:short":rn},se=document.getElementById("editor"),N=document.getElementById("stage"),le=document.getElementById("world"),No=document.getElementById("connectors"),Kn=document.getElementById("breadcrumbs"),il=document.getElementById("status-count"),ra=document.getElementById("status-err"),Yo=document.getElementById("mm-svg"),sl=document.getElementById("mm-label"),Ve=document.getElementById("editor-pane"),Fa=540,ll=96,Tt=440,Ho=720,ce=960,Ko=180,cl=540,dl=100,hl=110,pl=420,ul=.35,ml=1,na=parseFloat(j("slidetake:slideSize"))||.92,u=new Map,v=[],ot=[],g=null,ur=["focus","path","radial","tree"],J="path",K=!1,R={},ae=!0,re=null,De=document.getElementById("brand"),B=document.getElementById("pip"),ie=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},aa=null;gl='<span class="st-name">'+pr+'Slide<span class="st-take">take</span></span>';Pe=()=>/^(portrait|vertical|9:16)$/i.test(String(R.format||"").trim());Jn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};Xe=null;$n=new URLSearchParams(location.search).get("mode");Se=0;we=null,He=-1,je=null;Te=document.getElementById("cam-overlay"),Be="";new ResizeObserver(()=>{Be&&Xo()}).observe(ie);Ol=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(" ")),Il=0;Rl=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));ki=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),Wo=e=>!!e.querySelector("img")&&!e.textContent.trim(),Nl=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(ki)||e.children[0].matches("div.diagram"));We=null;Qn=null;ql="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Gl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Vl={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"}};Zn=new Set;Jl="https://esm.sh/@terrastruct/d2@0.1.33",Na=null,$l={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"}};Zl=(e,t)=>e.replace("{","{"+t),ec=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1433
1479
|
d2-config: {
|
|
1434
1480
|
layout-engine: elk
|
|
1435
1481
|
}
|
|
1436
1482
|
}
|
|
1437
|
-
`+e,
|
|
1438
|
-
`+t.html):""},go=()=>Nn(v,e=>({title:u.get(e).title,fp:Vc(e)}));rt=document.getElementById("rv-setup-btn"),ri=document.getElementById("setup-note"),Nt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||bo()}).observe(Y,{attributes:!0,attributeFilter:["class"]});rt.onclick=()=>{Nt()?bo():yo()};document.getElementById("setup-record").onclick=()=>{fa(),me||(me=st()?"obs":"browser",W("slidetake:rec-mode",me)),Cr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&po()});qa=(()=>{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=qa});document.getElementById("rv-rec").onclick=()=>{if(!st()){to("browser",Ra(v,Re));return}if(Oe){to("obs");return}nr({note:"Connect to OBS first: OBS \u2192 Connect."})};bt=document.getElementById("rv-pro");bt.onclick=()=>{Se().ok&&Tc(st()?"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}=ms(),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 Jc(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={},ya();for(let t of e)await Tr(t);S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ft(),O("All takes purged."),it()};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(uo().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),I=null,rr="",lt(),Ua.clear(),S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ft(),it(),O("Purged "+i+" of takes from every deck.")}};Xt=null,ir=0,sr=!1;S.addEventListener("error",async()=>{if(S.getAttribute("src")){if(Xt&&ir<5){ir++,O("Reloading "+_e+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{ba(await vo(Xt),Xt,!0);return}catch{}}O(Xt?"Chrome cannot play "+_e+". 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 "+(_e||"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})}});Qt=document.getElementById("rv-file-input");Qt.addEventListener("change",()=>{Qt.files[0]&&ba(Qt.files[0]),Qt.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Qt.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"),ba(await vo(e),e)}catch(e){(!e||e.name!=="AbortError")&&O("Could not open that file.",{warn:!0})}};ys=document.getElementById("rv-folder");window.showDirectoryPicker||(ys.style.display="none");ys.onclick=async()=>{let e=H&&mt(H.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(gs("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);ba(await vo(a),a)}catch{}};bc()&&new URLSearchParams(location.search).get("obs")&&xr();Te=document.getElementById("btn-camera"),Zt=document.getElementById("pip-msg"),Va=null,bs=B.querySelector("span");Qc='<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=()=>Ht(te);Dr();ni=null;window.addEventListener("pointermove",xs);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?Pt("Stopped: the browser left fullscreen"):K&&we(!1))});xe=document.getElementById("help");new MutationObserver(()=>ws(document.getElementById("btn-keys"),xe.classList.contains("open"))).observe(xe,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=Y.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!S.paused&&S.pause()}).observe(Y,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>xe.classList.add("open");document.getElementById("help-close").onclick=()=>xe.classList.remove("open");xe.addEventListener("click",e=>{e.target===xe&&xe.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||sa();return}if(h.active){zc(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&Nt();if(e.key==="Escape")fa();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"?st()?"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(xe.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&xe.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),We(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),We(-1)):a==="ArrowDown"?(e.preventDefault(),pc()):a==="ArrowUp"?(e.preventDefault(),hc()):a==="Home"?v.length&&_(v[0]):a==="End"?v.length&&_(v[v.length-1]):a==="o"||a==="O"?dc():a==="e"||a==="E"?ho():a==="f"||a==="F"||a==="p"||a==="P"?we(!K):a==="r"||a==="R"?Cr():a==="s"||a==="S"?sa():/^[1-4]$/.test(a)?yr(pr[+a-1]):a==="c"||a==="C"?Ht(te):a==="v"||a==="V"?xl():a==="l"||a==="L"?pi():a==="+"||a==="="?$n(1):a==="-"||a==="_"?$n(-1):a==="?"||a==="/"||a==="k"||a==="K"?xe.classList.add("open"):a==="Escape"&&!Ti()&&K&&we(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=ka(location.hash);if(e&&!(M&&M.kind==="share"&&e===M.data)){location.reload();return}t&&t!==g&&u.has(t)&&_(t)});ii="";new ResizeObserver(()=>{let e=N.clientWidth+"x"+N.clientHeight;e!==ii&&(ii=e,Tt(),fe(!0))}).observe(N);Ct=document.createElement("div");Ct.id="toast";Ct.setAttribute("role","status");document.body.appendChild(Ct);si=null;Zc=document.getElementById("open-dialog"),cr=document.getElementById("open-url"),dr=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{dr.hidden=!0,ma(Zc),cr.focus(),cr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=mn(cr.value);if(!t){dr.textContent="That doesn't look like a link.",dr.hidden=!1;return}location.href=lr(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await ed(g&&g!==v[0]?g:""),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),da(a,5e3)}catch{prompt("Copy this link:",e)}M.kind==="copy"&&(P.exported=P.text,va(),jt())};li=j("slidetake:layout");J=pr.includes(li)?li:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));io=new URLSearchParams(location.search);pr.includes(io.get("layout"))&&(J=io.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=hr+'<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=()=>we(!K))}ee=vn(location.pathname,location.search,location.hash),ci=ee.page==="pick"?"":ee.slide,M=null,P=wn(j("slidetake:copy"))||td();window.addEventListener("popstate",()=>location.reload());pe&&window.EventSource&&(new EventSource(pe.events).onmessage=async e=>{if(!Fr())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,At(!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)})});(io.get("edit")==="1"||ee.page==="edit"&&P&&io.get("edit")!=="0")&&ho();id().then(e=>(ie.value=e,jt(),mi(ie.value),vi(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(lo),ha(),_(u.has(ci)?ci:v[0],!0),Ge&&j("slidetake:camera")==="on"&&Ht(!0,!0)})});var Hr=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1483
|
+
`+e,_o={};Qe=0,Uo=null;et=document.getElementById("progress");et.innerHTML="<b></b><i></i>";_e={start:0,timer:null};pc=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];At=null;me=null,Ai=null,Oe=!1;tt=null;Me=null;Yo.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!h.active&&_(t.dataset.id)});Ha=null;se.addEventListener("input",()=>{if(Nr()){M.text=se.value,clearTimeout(Ha),Ha=setTimeout(()=>{hd(se.value),Bt(!0)},300);return}M.kind!=="copy"&&!cd()||(P.text=se.value,_t(),clearTimeout(Ha),Ha=setTimeout(()=>{wa(),Bt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==J&&br(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,fr(),N.classList.add("dragging")),a&&(e.size===2&&o?z.zoom=Pi(o.zoom*r()/o.d):(z.x-=l/z.zoom,z.y-=c/z.zoom),Lt())});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&&zi(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>Ue(-1);document.getElementById("nav-next").onclick=()=>Ue(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=()=>{Ms("a copy of "+t.name)&&(P=Ea(String(a.result),{kind:"file",name:t.name},{exported:!0}),wa(),We=null,g=null,dd())},a.readAsText(t),e.target.value=""});document.getElementById("btn-save").onclick=()=>{let e=new Blob([se.value],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=(ot[0]?mt(u.get(ot[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),M.kind==="copy"&&(P.exported=P.text,wa(),_t())};document.getElementById("btn-reset").onclick=()=>{M.kind!=="copy"||Ma(P)||confirm("Discard your edits and go back to "+Ce(P.origin)+" as it was?")&&(P.text=P.originText,wa(),se.value=P.text,g=null,Bt(!0),_t())};document.getElementById("btn-edit-toggle").onclick=po;xt=document.querySelector("main"),bt=document.getElementById("editor-resizer"),ti=parseFloat(j("slidetake:editorWidth"));ti&&Ve.style.setProperty("--editor-w",ti+"px");bt.addEventListener("pointerdown",e=>{e.preventDefault(),bt.setPointerCapture(e.pointerId),xt.classList.add("resizing");let t=xt.getBoundingClientRect().right,a=r=>{let n=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-r.clientX)));Ve.style.setProperty("--editor-w",n+"px")},o=()=>{xt.classList.remove("resizing"),bt.removeEventListener("pointermove",a),W("slidetake:editorWidth",String(Ve.getBoundingClientRect().width))};bt.addEventListener("pointermove",a),bt.addEventListener("pointerup",o,{once:!0})});bt.addEventListener("dblclick",()=>{Ve.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=gi;document.getElementById("btn-present").onclick=()=>xe(!K);wc="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",ai=["ArrowRight","PageDown"," ","ArrowDown","Enter"],oi=["ArrowLeft","PageUp","ArrowUp","r","R"],ri=["b","B","."],Y=document.getElementById("review"),Qt=document.getElementById("rec-countdown"),er=document.getElementById("rec-paused"),$a=document.getElementById("obs-host"),Xa=document.getElementById("obs-port"),Qa=document.getElementById("obs-pass"),vr=document.getElementById("obs-remember"),oa=document.getElementById("obs-status"),ne=null,Ie=!1,at=null,wr=null,Ri="",h={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null,browser:null},sa=e=>new Promise(t=>setTimeout(t,e)),la=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),sa(100)]);xc="G-3S9FY4MQLS",xr=document.getElementById("analytics-dialog"),kc=()=>j("slidetake:analytics")!=="off";xr.querySelectorAll("[data-analytics]").forEach(e=>e.onclick=()=>Sc(e.dataset.analytics==="on"));Fi=document.getElementById("btn-analytics");Fi.hidden=!/^(www\.)?slidetake\.com$/.test(location.hostname);Fi.onclick=()=>{Di(),fa(xr)};document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});Cc=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);Tc="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=kr;vr.addEventListener("change",Ni);Ac="https://cdn.jsdelivr.net/npm/mediabunny@1.64.0/+esm",kt=document.getElementById("rec-cam"),It=document.getElementById("rec-mic"),Pt=document.getElementById("rec-quality"),tr=document.getElementById("rec-meter"),wt=document.getElementById("rec-browser-check"),St=document.getElementById("rec-wave"),fe=j("slidetake:rec-mode")||"",Wa="",pe=null,Bc=96;ar=0;Sr=document.getElementById("rec-cam-preview"),ja=document.getElementById("rec-cam-none"),_a=null,or=0;It.onchange=()=>{W("slidetake:mic",It.value),Za(),Je()};to=document.getElementById("rec-mirror");to.onchange=()=>{W("slidetake:mirror",to.checked?"on":"off"),Er(),ze()};Er();kt.onchange=()=>{Ic(kt.value),kt.value!=="none"&&re&&(Dr(),ht()),jt()&&ji(),Je()};Oc=()=>(R.pip||"none").toLowerCase()!=="none"||!!R.camera||[...u.values()].some(e=>e.camera),_i=()=>"slidetake:rec-cam:"+Ye();Pt.onchange=()=>{W("slidetake:quality",Pt.value),Je()};ct=()=>!(Ee().ok&&(fe||"browser")==="browser");document.getElementById("btn-studio").onclick=()=>ca();Dc=()=>!!fe||dt().takes.length>0||mo().some(e=>e.key===Ye());document.getElementById("btn-record").onclick=()=>Mr();Gi=e=>{let t=Oa(e,Pe());return{width:t.w,height:t.h,aspectRatio:t.w/t.h,frameRate:yt,resizeMode:"crop-and-scale"}};new ResizeObserver(Vi).observe(xt);rt=!1;ni=600;qe="";Vc=e=>On(e,Xi),Yc=(e,t)=>In(e,t,{input:e.outputPath||qe||"recording.mov",outputName:Ye()+"-final.mp4",sectionOf:Xi,loudness:nt()}),Qi=document.querySelectorAll(".rv-loud"),nt=()=>j("slidetake:loudness")!=="off",Zi=()=>Qi.forEach(e=>{e.setAttribute("aria-pressed",String(nt())),e.classList.toggle("on",nt())}),rr=document.getElementById("rv-limiter"),ha=()=>j("slidetake:limiter")==="on",es=()=>{rr.setAttribute("aria-pressed",String(ha())),rr.classList.toggle("on",ha())};es();rr.onclick=()=>{W("slidetake:limiter",ha()?"off":"on"),es()};ts=()=>j("slidetake:mic-sound")==="raw"?"raw":"voice",as=e=>({...e?{deviceId:{ideal:e}}:{},echoCancellation:!1,autoGainControl:!1,noiseSuppression:ts()==="voice"}),os=document.querySelectorAll("[data-sound]"),rs=()=>os.forEach(e=>{let t=e.dataset.sound===ts();e.classList.toggle("active",t),e.setAttribute("aria-checked",String(t))});rs();os.forEach(e=>e.onclick=()=>{W("slidetake:mic-sound",e.dataset.sound),rs(),pe&&Za()});Zi();Qi.forEach(e=>e.onclick=()=>{W("slidetake:loudness",nt()?"off":"on"),Zi(),H&&fo()});H=null,Z=null,S=document.getElementById("rv-video"),Xt=document.getElementById("rv-now");Ua=-1,ns=()=>{let e=Da(v,Fe).length;return e?e+"/"+v.length+" slide"+(e===1?"":"s")+" up for a take":""};ss="";document.getElementById("rv-chapters").onclick=e=>cs(e.currentTarget,ss);document.getElementById("rv-ffmpeg-copy").onclick=e=>{!H||!H.events.length||(cs(e.currentTarget,Yc(H,document.getElementById("rv-mode").value)),O("Copied the ffmpeg command: run it in a terminal, in the folder with "+(gt(H.outputPath)||"the recording")+"."))};qa=new Map,qo=0;oo=document.getElementById("rv-fps");oo.onchange=()=>{H&&(H.fps=parseFloat(oo.value),Or(H),fo())};ro=null;S.addEventListener("timeupdate",()=>{if(!Z)return;let e=Z.ranges[Z.i];if(S.currentTime*1e3<e.end)return;if(Z.i++,Z.i>=Z.ranges.length){S.pause(),Z=null,O("");return}let t=Z.ranges[Z.i];S.currentTime=t.start/1e3,O("\u25B6 "+t.title)});hs=document.getElementById("rv-play-final"),Et=null;hs.onclick=()=>{if(!H)return;if(!H.inBrowser){no(Kt(H).map(a=>({start:a.start,end:a.end,title:a.title})));return}if(F&&!F.single){S.paused?S.play().catch(()=>{}):S.pause();return}let e=Jt(H),t=Math.max(0,Et?e.findIndex(a=>a.id===Et):0);Et=null,go(e.slice(t))};S.addEventListener("play",Ir);S.addEventListener("pause",()=>{F&&F.single&&S.currentTime<F.parts[0].keep-.05&&(Et=F.parts[0].id,O("Preview starts from "+F.parts[0].title.replace(/ · take \d+$/,"")+".")),Ir()});F=null;S.addEventListener("timeupdate",()=>{F&&S.currentTime>=F.parts[F.i].keep&&us()});S.addEventListener("ended",()=>{F&&us()});io=document.getElementById("rv-render-btn");io.onclick=()=>fs(!1);ms=0,Ze=e=>{clearTimeout(ms),e?io.textContent=e:io.innerHTML='\u2193 <span><u class="key">D</u>ownload</span>'},Go=e=>e.where?"\u201C"+e.where+"\u201D as "+e.name:"your downloads as "+e.name;Xc=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 gs(!0);e&&O("Videos now go to "+e.name+".")}catch{}};I=null,nr="",si=null,Fe=new Set,ys=()=>"slidetake:board:"+Ye();ba=()=>W(ys(),JSON.stringify(I)),Qc=e=>{let t=u.get(e);return t?_n(t.title+`
|
|
1484
|
+
`+t.html):""},yo=()=>Un(v,e=>({title:u.get(e).title,fp:Qc(e)}));it=document.getElementById("rv-setup-btn"),li=document.getElementById("setup-note"),jt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||vo()}).observe(Y,{attributes:!0,attributeFilter:["class"]});it.onclick=()=>{jt()?vo():bo()};document.getElementById("setup-record").onclick=()=>{ga(),fe||(fe=ct()?"obs":"browser",W("slidetake:rec-mode",fe)),Mr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&uo()});Ga=(()=>{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=Ga});document.getElementById("rv-rec").onclick=()=>{if(!ct()){ao("browser",Da(v,Fe));return}if(Ie){ao("obs");return}ir({note:"Connect to OBS first: OBS \u2192 Connect."})};vt=document.getElementById("rv-pro");vt.onclick=()=>{Ee().ok&&zc(ct()?"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}=bs(),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 ad(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={},ba();for(let t of e)await Lr(t);S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ht(),O("All takes purged."),lt()};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(mo().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),I=null,nr="",dt(),qa.clear(),S.src&&(URL.revokeObjectURL(S.src),S.removeAttribute("src"),S.load()),F=null,Ht(),lt(),O("Purged "+i+" of takes from every deck.")}};Zt=null,sr=0,lr=!1;S.addEventListener("error",async()=>{if(S.getAttribute("src")){if(Zt&&sr<5){sr++,O("Reloading "+qe+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{va(await wo(Zt),Zt,!0);return}catch{}}O(Zt?"Chrome cannot play "+qe+". 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 "+(qe||"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})}});ea=document.getElementById("rv-file-input");ea.addEventListener("change",()=>{ea.files[0]&&va(ea.files[0]),ea.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return ea.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"),va(await wo(e),e)}catch(e){(!e||e.name!=="AbortError")&&O("Could not open that file.",{warn:!0})}};xs=document.getElementById("rv-folder");window.showDirectoryPicker||(xs.style.display="none");xs.onclick=async()=>{let e=H&>(H.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(ws("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);va(await wo(a),a)}catch{}};Ec()&&new URLSearchParams(location.search).get("obs")&&kr();Le=document.getElementById("btn-camera"),ta=document.getElementById("pip-msg"),Va=null,ks=B.querySelector("span");nd='<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>';Le.onclick=()=>Wt(ae);Fr();ci=null;window.addEventListener("pointermove",Cs);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?zt("Stopped: the browser left fullscreen"):K&&xe(!1))});ke=document.getElementById("help");new MutationObserver(()=>Es(document.getElementById("btn-keys"),ke.classList.contains("open"))).observe(ke,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=Y.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!S.paused&&S.pause()}).observe(Y,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>ke.classList.add("open");document.getElementById("help-close").onclick=()=>ke.classList.remove("open");ke.addEventListener("click",e=>{e.target===ke&&ke.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||ca();return}if(h.active){Wc(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&jt();if(e.key==="Escape")ga();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"?ct()?"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(ke.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&ke.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),Ue(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),Ue(-1)):a==="ArrowDown"?(e.preventDefault(),bc()):a==="ArrowUp"?(e.preventDefault(),yc()):a==="Home"?v.length&&_(v[0]):a==="End"?v.length&&_(v[v.length-1]):a==="o"||a==="O"?gc():a==="e"||a==="E"?po():a==="f"||a==="F"||a==="p"||a==="P"?xe(!K):a==="r"||a==="R"?Mr():a==="s"||a==="S"?ca():/^[1-4]$/.test(a)?br(ur[+a-1]):a==="c"||a==="C"?Wt(ae):a==="v"||a==="V"?Ml():a==="l"||a==="L"?gi():a==="+"||a==="="?ei(1):a==="-"||a==="_"?ei(-1):a==="?"||a==="/"||a==="k"||a==="K"?ke.classList.add("open"):a==="Escape"&&!Oi()&&K&&xe(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=Sa(location.hash);if(e&&!(M&&M.kind==="share"&&e===M.data)){location.reload();return}t&&t!==g&&u.has(t)&&_(t)});di="";new ResizeObserver(()=>{let e=N.clientWidth+"x"+N.clientHeight;e!==di&&(di=e,Lt(),ge(!0))}).observe(N);Mt=document.createElement("div");Mt.id="toast";Mt.setAttribute("role","status");document.body.appendChild(Mt);hi=null;id=document.getElementById("open-dialog"),dr=document.getElementById("open-url"),hr=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{hr.hidden=!0,fa(id),dr.focus(),dr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=bn(dr.value);if(!t){hr.textContent="That doesn't look like a link.",hr.hidden=!1;return}location.href=cr(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await sd(g&&g!==v[0]?g:""),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),Dt(a,5e3)}catch{prompt("Copy this link:",e)}M.kind==="copy"&&(P.exported=P.text,wa(),_t())};pi=j("slidetake:layout");J=ur.includes(pi)?pi:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));so=new URLSearchParams(location.search);ur.includes(so.get("layout"))&&(J=so.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=pr+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),Ke||(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=()=>xe(!K))}te=Sn(location.pathname,location.search,location.hash),ui=te.page==="pick"?"":te.slide,M=null,P=En(j("slidetake:copy"))||ld();window.addEventListener("popstate",()=>location.reload());ue&&window.EventSource&&(new EventSource(ue.events).onmessage=async e=>{if(!Nr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===ue.file){let a=await(await fetch(ue.deck,{cache:"no-store"})).text();if(a===se.value)return;se.value=M.text=a,Bt(!0);return}le.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)})});(so.get("edit")==="1"||te.page==="edit"&&P&&so.get("edit")!=="0")&&po();ud().then(e=>(se.value=e,_t(),bi(se.value),Si(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(co),pa(),_(u.has(ui)?ui:v[0],!0),Ke&&j("slidetake:camera")==="on"&&Wt(!0,!0)})});var Wr=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1439
1485
|
deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
|
|
1440
1486
|
its own (accent: in its top block); see applyColors in app.js. */
|
|
1441
1487
|
:root{
|
|
@@ -2269,7 +2315,7 @@ EOF
|
|
|
2269
2315
|
#minimap{display:none;}
|
|
2270
2316
|
#navbar .lbl{display:none;}
|
|
2271
2317
|
}
|
|
2272
|
-
`;var
|
|
2318
|
+
`;var _r=`
|
|
2273
2319
|
<noscript>
|
|
2274
2320
|
<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>
|
|
2275
2321
|
<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>
|
|
@@ -2394,6 +2440,7 @@ EOF
|
|
|
2394
2440
|
<li><a href="/new?template=blank"><strong>Blank</strong><span>A first card, a section and a detail.</span></a></li>
|
|
2395
2441
|
<li><a href="/new?template=talk"><strong>Talk</strong><span>Why it matters, the idea, trade-offs, summary.</span></a></li>
|
|
2396
2442
|
<li><a href="/new?template=recording"><strong>Recording</strong><span>Camera steps, an overview moment and a closing on camera.</span></a></li>
|
|
2443
|
+
<li><a href="/new?template=short"><strong>Short</strong><span>A 9:16 deck for Shorts and Reels: words above or below you.</span></a></li>
|
|
2397
2444
|
<li><a href="/showcase"><strong>Showcase</strong><span>Every feature in one deck: diagrams, charts, images, YouTube, camera.</span></a></li>
|
|
2398
2445
|
</ul>
|
|
2399
2446
|
<p>Or <strong>\u21E3 Load</strong> a deck from a link, or <strong>Open</strong> a file from this computer.</p>
|
|
@@ -2549,5 +2596,5 @@ EOF
|
|
|
2549
2596
|
<div id="rec-paused">Paused \xB7 press B to resume</div>
|
|
2550
2597
|
|
|
2551
2598
|
<!-- The sample deck. Plain markdown, nothing else. -->
|
|
2552
|
-
`;var
|
|
2553
|
-
<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
|
|
2599
|
+
`;var Ur=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
2600
|
+
<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 As=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 Bs(){document.head.insertAdjacentHTML("beforeend",Ur);let e=document.createElement("style");e.textContent=Wr,document.head.appendChild(e),document.body.insertAdjacentHTML("afterbegin",_r),await Promise.all([window.gsap?null:As("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"),window.marked?null:As("https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js")]),await Promise.resolve().then(()=>(Ls(),md))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Bs,{once:!0}):Bs();})();
|