slidetake 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +5 -6
- package/dist/slidetake.js +21 -21
- package/package.json +1 -1
package/dist/index.html
CHANGED
|
@@ -542,7 +542,7 @@
|
|
|
542
542
|
#credit .logo{width:18px;height:18px;fill:var(--accent);}
|
|
543
543
|
#credit .word > span{color:var(--accent);}
|
|
544
544
|
#credit:hover{opacity:.85;}
|
|
545
|
-
html.embed #btn-
|
|
545
|
+
html.embed #btn-docs, html.embed #btn-github{display:none !important;}
|
|
546
546
|
/* a reader's page (embedded, not recording): no bottom bar, except the arrows on touch screens */
|
|
547
547
|
html.embed.no-record #navbar{display:none;}
|
|
548
548
|
@media (pointer:coarse){
|
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
<header>
|
|
639
639
|
<div class="brand">
|
|
640
640
|
<a class="mark" href="/" title="Slidetake home"><svg class="logo" viewBox="0 0 64 64" aria-hidden="true"><path d="M 10 8 H 38 C 41.3 8 44 10.7 44 14 V 18 H 22 C 16.5 18 12 22.5 12 28 V 36 H 10 C 6.7 36 4 33.3 4 30 V 14 C 4 10.7 6.7 8 10 8 Z" opacity="0.4"/><path fill-rule="evenodd" d="M 22 22 H 54 C 57.3 22 60 24.7 60 28 V 50 C 60 53.3 57.3 56 54 56 H 22 C 18.7 56 16 53.3 16 50 V 28 C 16 24.7 18.7 22 22 22 Z M 26 34 C 28.2 34 30 32.2 30 30 C 30 27.8 28.2 26 26 26 C 23.8 26 22 27.8 22 30 C 22 32.2 23.8 34 26 34 Z M 38 40 C 36.9 40 36 40.9 36 42 V 48 C 36 49.1 36.9 50 38 50 H 50 C 51.1 50 52 49.1 52 48 V 42 C 52 40.9 51.1 40 50 40 H 38 Z"/></svg><span class="word">Slide<span>take</span></span></a>
|
|
641
|
-
<div class="tagline">plain markdown → spatial deck → video</div>
|
|
641
|
+
<div class="tagline">plain markdown → spatial deck → video, no timeline editing</div>
|
|
642
642
|
</div>
|
|
643
643
|
<div class="hdr-actions">
|
|
644
644
|
<input type="file" id="file-input" accept=".md,.markdown,.txt,text/markdown" hidden>
|
|
@@ -648,11 +648,10 @@
|
|
|
648
648
|
<button class="seg-btn" data-mode="path" title="Path: slides in presenting order (3)">path</button>
|
|
649
649
|
<button class="seg-btn" data-mode="focus" title="Focus: one slide at a time, no travel (4)">focus</button>
|
|
650
650
|
</div>
|
|
651
|
-
<a class="btn" id="
|
|
651
|
+
<a class="btn" id="btn-docs" href="/help" target="_blank" rel="noopener" title="Docs: the full guide, itself a deck">Docs</a>
|
|
652
652
|
<button class="btn" id="btn-edit-toggle" title="Editor: write, open, share (E)">✎ Editor</button>
|
|
653
|
-
<button class="btn icon" id="btn-mode" title="Light / dark (L)" aria-label="Light / dark"></button>
|
|
654
653
|
<a class="btn icon" id="btn-github" href="https://github.com/slidetake/slidetake" target="_blank" rel="noopener noreferrer" title="GitHub repository"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/></svg><span class="sr-only">GitHub repository</span></a>
|
|
655
|
-
<button class="btn icon" id="btn-
|
|
654
|
+
<button class="btn icon" id="btn-mode" title="Light / dark (L)" aria-label="Light / dark"></button>
|
|
656
655
|
</div>
|
|
657
656
|
</header>
|
|
658
657
|
|
|
@@ -684,6 +683,7 @@
|
|
|
684
683
|
<div class="pane-bar">
|
|
685
684
|
<span class="pane-label" id="doc-state" aria-live="polite"></span>
|
|
686
685
|
<span class="pane-actions">
|
|
686
|
+
<a class="btn small" id="continue" href="/edit" hidden></a>
|
|
687
687
|
<a class="btn small" id="btn-new" href="/new" title="Start from a template">New</a>
|
|
688
688
|
<button class="btn small" id="btn-load" title="Load a deck from a link: GitHub, a gist or any URL">⇣ Load</button>
|
|
689
689
|
<button class="btn small" id="btn-open" title="Open a markdown file from this computer">Open</button>
|
|
@@ -3901,7 +3901,6 @@
|
|
|
3901
3901
|
else if (presenting) setPresent(false);
|
|
3902
3902
|
});
|
|
3903
3903
|
var help = document.getElementById("help");
|
|
3904
|
-
document.getElementById("btn-help").onclick = () => window.open(EMBED ? "https://slidetake.com/help" : "/help", "_blank", "noopener");
|
|
3905
3904
|
document.getElementById("btn-keys").onclick = () => help.classList.add("open");
|
|
3906
3905
|
document.getElementById("help-close").onclick = () => help.classList.remove("open");
|
|
3907
3906
|
help.addEventListener("click", (e) => {
|
package/dist/slidetake.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Slidetake 0.2.
|
|
1
|
+
/* Slidetake 0.2.4 · https://slidetake.com · Apache-2.0 */
|
|
2
2
|
"use strict";(()=>{var j=(e,t)=>()=>(e&&(t=e(e=0)),t);var Wt,jn=j(()=>{Wt=`---
|
|
3
3
|
title: Slidetake \u2014 write in markdown, record without timeline editing
|
|
4
4
|
brand: slidetake
|
|
@@ -322,7 +322,7 @@ Your draft and settings stay in this browser. Decks inside links live in the par
|
|
|
322
322
|
slidetake.com counts visits with Google Analytics. What it records leaves out the \`#\` part and \`?obs=\`, so neither your deck nor an OBS password reaches it. Copies you host yourself send nothing.
|
|
323
323
|
|
|
324
324
|
Slidetake is open source: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).
|
|
325
|
-
`});var Fn
|
|
325
|
+
`});var Hn,Fn=j(()=>{Hn=`---
|
|
326
326
|
title: My deck
|
|
327
327
|
---
|
|
328
328
|
|
|
@@ -580,7 +580,7 @@ Two comments do what markdown can't: \`<!-- camera: on, full, on -->\` moves the
|
|
|
580
580
|
Press **New** for a template (blank, talk or recording), or type in this deck to make it your copy.
|
|
581
581
|
|
|
582
582
|
The templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.
|
|
583
|
-
`});function Te(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function
|
|
583
|
+
`});function Te(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function Fe(e){return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function C(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function Kn(e){if(typeof document<"u"){let t=document.createElement("textarea");return t.innerHTML=e,t.value}return e.replace(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>n[0]==="#"?String.fromCodePoint(n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10)):_a[n.toLowerCase()]??t)}function He(e){let t={};for(let n of e.matchAll(/([\w-]+)="([^"]*)"/g))t[n[1]]=n[2];return t}function We(e,t){let n=[[]],o=null;return e.split(`
|
|
584
584
|
`).forEach(a=>{let r=a.match(/^\s{0,3}(`{3,}|~{3,})/);r&&(o?r[1][0]===o[0]&&r[1].length>=o.length&&(o=null):o=r[1]),!o&&!r&&t.test(a)?n.push([]):n[n.length-1].push(a)}),n.map(a=>a.join(`
|
|
585
585
|
`))}function Vn(e){let t=String(e??"").trim().toLowerCase();if(!t)return 0;let n=t.match(/^(\d+):(\d{1,2})$/);if(n)return(+n[1]*60+ +n[2])*1e3;if(n=t.match(/^(\d+(?:\.\d+)?)\s*(h|hrs?|hours?|m|mins?|minutes?|s|secs?|seconds?)?$/),!n)return 0;let o=(n[2]||"m")[0];return parseFloat(n[1])*(o==="h"?3600:o==="s"?1:60)*1e3}function K(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),a=t%60;return(n?n+":"+String(o).padStart(2,"0"):o)+":"+String(a).padStart(2,"0")}var _a,lt=j(()=>{"use strict";_a={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function Jn(e){let t=null;return e.split(`
|
|
586
586
|
`).filter(n=>{let o=n.match(/^\s{0,3}(`{3,}|~{3,})/);return o?(t?o[1][0]===t[0]&&o[1].length>=t.length&&(t=null):t=o[1],!1):!t}).join(`
|
|
@@ -589,15 +589,15 @@ The templates and this deck live in [examples/](https://github.com/slidetake/sli
|
|
|
589
589
|
`+o.join(`
|
|
590
590
|
`)+`
|
|
591
591
|
---
|
|
592
|
-
`:""}function
|
|
592
|
+
`:""}function Fa(e){let t=e.split(`
|
|
593
593
|
`),n={},o=e;if(t[0]!==void 0&&t[0].trim()==="---"){let a=-1;for(let r=1;r<t.length;r++)if(t[r].trim()==="---"){a=r;break}a!==-1&&(t.slice(1,a).forEach(r=>{let i=r.indexOf(":");i>-1&&(n[r.slice(0,i).trim()]=r.slice(i+1).trim().replace(/^["']|["']$/g,""))}),o=t.slice(a+1).join(`
|
|
594
|
-
`).replace(/^\n+/,""))}return{meta:n,body:o}}function
|
|
595
|
-
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));a=r?r.slice(0,60):null}return a?Kn(
|
|
596
|
-
`);let r=/^\+\+\+[ \t]*$/m.test(e),i={};r||({deck:i,body:e}=Na(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!r&&(We(e,/^--\s*$/).length>1||s&&We(e,/^---\s*$/).length>1),c=r?N():l?
|
|
597
|
-
`).forEach(m=>{let v=m.match(/^\s{0,3}(`{3,}|~{3,})/);v&&(g?v[1][0]===g[0]&&v[1].length>=g.length&&(g=null):g=v[1]);let L=!g&&!v?m.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(L){let D=L[2],ce=null,ae=D.match(/\s*\{#([\w\-:.]+)\}\s*$/);ae&&(ce=ae[1],D=D.slice(0,ae.index)),S={level:L[1].length,title:
|
|
594
|
+
`).replace(/^\n+/,""))}return{meta:n,body:o}}function Ha(e){let t=e.replace(/<!--[\s\S]*?-->/g,""),n=t.match(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/m),o=t.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i),a=null;if(n&&(!o||n.index<o.index)?a=n[1]:o&&(a=o[1].replace(/<[^>]+>/g," ")),!a){let r=t.split(`
|
|
595
|
+
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));a=r?r.slice(0,60):null}return a?Kn(Fe(a)).replace(/\s+/g," ").trim():null}function Xn(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?He(t[1]):{}}function Qn(e,{render:t=n=>({html:n,err:null})}={}){let n=new Map,o=b=>{let S=b,g=2;for(;n.has(S);)S=b+"-"+g++;return S},a=b=>(n.set(b.id,{x:null,y:null,children:[],...b}),b.id);e=e.replace(/\r\n?/g,`
|
|
596
|
+
`);let r=/^\+\+\+[ \t]*$/m.test(e),i={};r||({deck:i,body:e}=Na(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!r&&(We(e,/^--\s*$/).length>1||s&&We(e,/^---\s*$/).length>1),c=r?N():l?M():f();return n.forEach(b=>{(!b.parent||b.parent===b.id||!n.has(b.parent))&&(b.parent=null)}),n.forEach(b=>{let S=new Set([b.id]),g=b.parent;for(;g;){if(S.has(g)){b.parent=null;break}S.add(g),g=n.get(g).parent}}),n.forEach(b=>{b.parent&&n.get(b.parent).children.push(b.id)}),{deck:i,nodes:n,format:r?"+++":l?"reveal":"headings",errCount:c};function f(){let b=[],S=null,g=null,B={level:0,title:null,explicitId:null,lines:[]};e.split(`
|
|
597
|
+
`).forEach(m=>{let v=m.match(/^\s{0,3}(`{3,}|~{3,})/);v&&(g?v[1][0]===g[0]&&v[1].length>=g.length&&(g=null):g=v[1]);let L=!g&&!v?m.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(L){let D=L[2],ce=null,ae=D.match(/\s*\{#([\w\-:.]+)\}\s*$/);ae&&(ce=ae[1],D=D.slice(0,ae.index)),S={level:L[1].length,title:Fe(D),explicitId:ce,lines:[L[1]+" "+D]},b.push(S)}else(S||B).lines.push(m)});let G=B.lines.join(`
|
|
598
598
|
`);G.trim()&&(b.length&&!G.replace(/<!--[\s\S]*?-->/g,"").trim()?b[0].lines.splice(1,0,...B.lines):b.unshift(B));let w=[];return b.forEach(m=>{for(;w.length&&w[w.length-1].level>=m.level;)w.pop();let v=w.length?w[w.length-1].id:null,L=m.lines.join(`
|
|
599
|
-
`).trim(),D=m.title||
|
|
600
|
-
`).find(be=>be.trim())||"Intro").slice(0,48));m.id=o(m.explicitId||Te(D));let{html:ce,err:ae}=t(L);a({id:m.id,parent:v,title:D,html:ce,err:ae,camera:qt(L),mapFirst:Ut(L)}),w.push(m)}),0}function N(){let b=e.split(/\n\+\+\+[ \t]*\n/).map(B=>B.trim()).filter(B=>B.length),S=null,g=0;return b.forEach((B,G)=>{let{meta:w,body:m}=
|
|
599
|
+
`).trim(),D=m.title||Fe((L.split(`
|
|
600
|
+
`).find(be=>be.trim())||"Intro").slice(0,48));m.id=o(m.explicitId||Te(D));let{html:ce,err:ae}=t(L);a({id:m.id,parent:v,title:D,html:ce,err:ae,camera:qt(L),mapFirst:Ut(L)}),w.push(m)}),0}function N(){let b=e.split(/\n\+\+\+[ \t]*\n/).map(B=>B.trim()).filter(B=>B.length),S=null,g=0;return b.forEach((B,G)=>{let{meta:w,body:m}=Fa(B),v=o(w.id||"slide-"+(G+1)),L="parent"in w?w.parent||null:S,D=m.match(/^#{1,6}\s+(.+)$/m),ce=w.title||(D?Fe(D[1]):v),{html:ae,err:be}=t(m);be&&g++,a({id:v,parent:L,title:ce,html:ae,err:be,camera:w.camera||qt(m),mapFirst:Ut(m),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),S=v}),g}function M(){let b=0,S=0,g=null;function B(w,m){let v=w.body.trim();S++;let L=Ha(v)||"Slide "+S,D=m?n.get(m).title:null;D&&L.startsWith(D+" / ")&&(L=L.slice(D.length+3));let ce=o(Te(L)),{html:ae,err:be}=t(v);return be&&b++,a({id:ce,parent:m,title:L,html:ae,err:be,camera:qt(v),mapFirst:Ut(v),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let G=[];return We(e,/^---\s*$/).forEach(w=>{if(/<section\b/i.test(w)){for(let L of w.matchAll(/<section\b([^>]*)>([\s\S]*?)<\/section>/gi))G.push([{body:L[2],attrs:He(L[1])}]);let v=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");v.trim()&&G.push([{body:v,attrs:Xn(v)}]);return}let m=We(w,/^--\s*$/).filter(v=>v.trim()).map(v=>({body:v,attrs:Xn(v)}));m.length&&G.push(m)}),G.forEach(w=>{let m=null;w.forEach((v,L)=>{if(!g){g=m=B(v,null);return}L===0?m=B(v,g):B(v,m)})}),b}}var eo=j(()=>{"use strict";lt()});function ct(e,t){return String(t||"").toLowerCase().split(/\s+/).forEach(n=>{n&&(n==="off"||n==="hide"?e.off=!0:n==="on"||n==="pip"||n==="show"?(e.off=!1,e.full=!1,e.used=!0):n==="full"||n==="fullscreen"?(e.full=!0,e.off=!1,e.used=!0):/^\d+(\.\d+)?%?$/.test(n)?(e.size=$t(parseFloat(n)),e.used=!0):Ue.includes(n)?(e.corner=n,e.used=!0):n==="flip"?(e.flip=!e.flip,e.used=!0):n==="circle"?e.circle=!0:n==="rect"?e.circle=!1:n==="mirror"?e.mirror=!0:(n==="unmirror"||n==="no-mirror")&&(e.mirror=!1))}),e}function to(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function no(e,t){let n=[];if(!e.length){for(let a=0;a<=t;a++)n.push({cam:0,frag:a});return n}let o=e.findIndex(a=>!ct({},a).full);o<0&&(o=e.length-1);for(let a=0;a<=o;a++)n.push({cam:a,frag:0});for(let a=1;a<=t;a++)n.push({cam:o,frag:a});for(let a=o+1;a<e.length;a++)n.push({cam:a,frag:t});return n}var Ue,$t,oo=j(()=>{"use strict";Ue=["top-left","top-right","bottom-left","bottom-right"],$t=e=>Math.max(8,Math.min(60,e))});function ao(e){let t=String(e||"").trim();if(!t)return null;let n;try{n=new URL(/^[a-z]+:\/\//i.test(t)?t:"https://"+t)}catch{return null}let o=n.pathname.split("/").filter(Boolean);if(n.hostname==="github.com"||n.hostname==="www.github.com"){let[a,r,i,s,...l]=o;if(a&&r&&(i==="blob"||i==="raw"||i==="tree")&&s){let c=l.join("/");return(i==="tree"||!/\.(md|markdown|txt)$/i.test(c))&&(c=(c?c+"/":"")+"index.md"),{kind:"url",url:Yt+[a,r,s].join("/")+"/"+c}}if(a&&r&&!i)return{kind:"url",url:Yt+a+"/"+r+"/HEAD/README.md"}}if(n.hostname==="gist.github.com"){let a=o.length>=2?o[1]:o[0];if(a&&/^[\da-f]+$/i.test(a))return{kind:"gist",id:a}}if(n.hostname==="slidetake.com"||n.hostname==="www.slidetake.com"){let a=Gt(n.pathname);if(a)return a;let r=n.searchParams.get("src");if(r)return{kind:"url",url:r}}return{kind:"url",url:n.href}}function Gt(e){let t=String(e||"").split("/").filter(Boolean).map(n=>{try{return decodeURIComponent(n)}catch{return n}});if(t[0]==="gh"&&t.length>=4){let[,n,o,...a]=t,r=o.indexOf("@"),i=r<0?o:o.slice(0,r),s=r<0?"HEAD":o.slice(r+1);return!n||!i||!s?null:{kind:"url",url:Yt+[n,i,s,...a].map(encodeURIComponent).join("/")}}return t.length===1&&t[0]==="help"?{kind:"builtin",id:"help"}:t.length===1&&t[0]==="examples"?{kind:"builtin",id:"showcase"}:t[0]==="gist"&&t[1]&&/^[\da-f]+$/i.test(t[1])?t[2]?{kind:"gist",id:t[1],file:t[2]}:{kind:"gist",id:t[1]}:null}function ro(e){if(e.kind==="builtin")return e.id==="home"?"/":e.id==="showcase"?"/examples":e.id.startsWith("template:")?"/new?template="+e.id.slice(9):"/"+e.id;if(e.kind==="gist")return"/gist/"+e.id+(e.file?"/"+encodeURIComponent(e.file):"");let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/([^/]+)\/(.+)$/);if(t){let[,n,o,a,r]=t;if(!/^refs$/.test(a))return"/gh/"+n+"/"+o+(a==="HEAD"?"":"@"+a)+"/"+r}return"/?src="+encodeURIComponent(e.url)}var Yt,Kt=j(()=>{"use strict";Yt="https://raw.githubusercontent.com/"});function Wa(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ua(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,n=>n.charCodeAt(0))}async function io(e,t){let n=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await n.arrayBuffer())}async function so(e){return Wa(await io(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function lo(e){return new TextDecoder().decode(await io(Ua(e),new DecompressionStream("deflate-raw")))}function dt(e){let t=e.replace(/^#/,"");if(!t.startsWith(Vt)){let r=t;try{r=decodeURIComponent(t)}catch{}return{data:null,slide:r}}let n=t.slice(Vt.length),o=n.indexOf("~"),a=o<0?"":n.slice(o+1);try{a=decodeURIComponent(a)}catch{}return{data:o<0?n:n.slice(0,o),slide:a}}function Xt(e,t){return"#"+Vt+e+(t?"~"+encodeURIComponent(t):"")}var Vt,Jt=j(()=>{"use strict";Vt="deflate:"});function co(e,t,n){let o=e.replace(/\/+$/,"")||"/",a=new URLSearchParams(t),{data:r,slide:i}=dt(n);if(o==="/share")return r?{page:"share",data:r,slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:""};if(o==="/edit")return{page:"edit",slide:i};if(o==="/new"){let c=a.get("template");return c&&qa.includes(c)?{page:"source",source:{kind:"builtin",id:"template:"+c},slide:i}:{page:"pick"}}let s=Gt(o);if(s)return{page:"source",source:s,slide:i};let l=a.get("src");return o==="/"&&l?{page:"source",source:{kind:"url",url:l},slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:i}}function re(e){switch(e.kind){case"builtin":return e.id==="home"?"Home":e.id==="help"?"Help":e.id==="showcase"?"the examples":"the "+e.id.replace(/^template:/,"")+" template";case"gist":return"a gist"+(e.file?" ("+e.file+")":"");case"shared":return"a shared deck";case"file":return e.name;case"url":{let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/[^/]+\/(.+)$/);if(t)return t[1]+"/"+t[2]+"/"+t[3];try{let n=new URL(e.url);return n.hostname+n.pathname}catch{return e.url}}}}function pt(e,t,{exported:n=!1}={}){return{text:e,origin:t,originText:e,exported:n?e:null}}function ut(e){return e.text!==(e.exported??e.originText)}function ht(e){return e.text===e.originText}function po(e){try{let t=JSON.parse(e||"null");return!t||typeof t.text!="string"||!t.origin||typeof t.origin.kind!="string"?null:{text:t.text,origin:t.origin,originText:typeof t.originText=="string"?t.originText:t.text,exported:typeof t.exported=="string"?t.exported:null}}catch{return null}}var qa,uo=j(()=>{"use strict";Kt();Jt();qa=["blank","talk","recording"]});function ho(e){let t;try{t=new URL(e)}catch{return null}let n=t.hostname.replace(/^(www\.|m\.)/,""),o=null,a=!1;if(n==="youtu.be")o=t.pathname.slice(1).split("/")[0];else if(n==="youtube.com"||n==="youtube-nocookie.com"){let r=t.pathname.split("/").filter(Boolean);r[0]==="watch"?o=t.searchParams.get("v"):["shorts","live","embed"].includes(r[0])&&(o=r[1]||null,a=r[0]==="shorts")}return!o||!/^[\w-]{6,}$/.test(o)?null:{id:o,start:$a(t.searchParams.get("t")||t.searchParams.get("start")||""),portrait:a}}function $a(e){if(/^\d+$/.test(e))return+e;let t=e.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);return t&&e?+(t[1]||0)*3600+ +(t[2]||0)*60+ +(t[3]||0):0}function mo(e){return"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(e.id)+"?enablejsapi=1&rel=0&playsinline=1"+(e.start?"&start="+e.start:"")}var fo=j(()=>{"use strict"});function qe(e){let t=new Map,n=e.totalObs??e.total;return e.events.forEach((o,a)=>{t.has(o.id)||t.set(o.id,{id:o.id,title:o.title,takes:[]});let r=t.get(o.id),i=e.events[a+1];r.takes.push({no:r.takes.length+1,start:go(o),end:i?go(i):n})}),t}function $e(e){let t=[],n=ft(e);return qe(e).forEach(o=>{let a=e.picks[o.id]??o.takes.length;if(!a)return;let r=o.takes[a-1];if(!r)return;let i=bo(r.start,n),s=bo(r.end,n);s>i&&t.push({id:o.id,title:o.title,f0:i,f1:s,start:i*1e3/n,end:s*1e3/n})}),t}function Ya(e){let t=[];return e.forEach(n=>{let o=t[t.length-1];o&&n.f0===o.f1?(o.f1=n.f1,o.end=n.end):t.push({f0:n.f0,f1:n.f1,start:n.start,end:n.end})}),t}function Zt(e,t){let n=0,o=[];return $e(e).forEach(a=>{let{sec:r,title:i}=t(a.id,a.title),s=o[o.length-1];(!s||s.sec!==r&&s.title!==i)&&o.push({sec:r,title:i,t:n}),n+=a.end-a.start}),{list:o,length:n}}function vo(e,t){let{list:n,length:o}=Zt(e,t),a=n.filter((r,i)=>i===0||(n[i+1]?n[i+1].t:o)-r.t>=1e4);return a.length&&(a[0].t=0),{lines:a.map(r=>K(r.t)+" "+r.title),dropped:n.length-a.length,length:o}}function xo(e,t,{input:n,outputName:o,sectionOf:a}){let r=Ya($e(e));if(!e.withObs)return"# This was a rehearsal: nothing was recorded.";if(!r.length)return"# Every slide is left out: nothing to render.";let i=Ga(n)+o,{list:s,length:l}=Zt(e,a),c=m=>String(m).replace(/[=;#\\\n]/g,v=>"\\"+v),N=`cat > /tmp/slidetake-chapters.txt <<'EOF'
|
|
601
601
|
`+(`;FFMETADATA1
|
|
602
602
|
title=`+c(e.deckTitle)+`
|
|
603
603
|
`+s.map((m,v)=>`[CHAPTER]
|
|
@@ -607,7 +607,7 @@ END=`+Math.round(s[v+1]?s[v+1].t:l)+`
|
|
|
607
607
|
title=`+c(m.title)).join(`
|
|
608
608
|
`))+`
|
|
609
609
|
EOF
|
|
610
|
-
`,
|
|
610
|
+
`,M=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let m=r.map(L=>"file "+mt(n)+`
|
|
611
611
|
inpoint `+yo(L.start)+`
|
|
612
612
|
outpoint `+yo(L.end)).join(`
|
|
613
613
|
`);return(r.length>1?`# Careful: without re-encoding, cuts can only land on keyframes (OBS puts one about every 2 s),
|
|
@@ -615,19 +615,19 @@ outpoint `+yo(L.end)).join(`
|
|
|
615
615
|
`:"")+`cat > /tmp/slidetake-cuts.txt <<'EOF'
|
|
616
616
|
`+m+`
|
|
617
617
|
EOF
|
|
618
|
-
`+N+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+
|
|
619
|
-
`)};[T&&T.colors,rr()].filter(Boolean).forEach(o=>{["dark","light"].forEach(a=>{let r={...o,...o[a]||{}},i=a==="dark";r.accent&&typeof r.accent=="string"&&(r.accentSoft=r.accentSoft||r.accent,r.line=r.line||"color-mix(in srgb, "+r.accent+(i?" 45%, #09090b)":" 55%, #fff)"),r.ring=r.ring||(i?r.accent:r.line),r.onAccent=r.onAccent||(i?"color-mix(in srgb, "+r.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',r)})});let n=document.getElementById("st-colors");n||(n=document.createElement("style"),n.id="st-colors",document.head.appendChild(n)),n.textContent!==e&&(n.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Ge(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let n=getComputedStyle(t).color;return t.remove(),ye=ye||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),ye.clearRect(0,0,1,1),ye.fillStyle="#000",ye.fillStyle=n,ye.fillRect(0,0,1,1),"#"+[...ye.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function sr(e,t,n){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),a=o(e),r=o(t);return"#"+a.map((i,s)=>Math.round(i*n+r[s]*(1-n)).toString(16).padStart(2,"0")).join("")}function zt(){if(T&&T.themeKey&&!Eo){let t=ee(T.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Eo||ee("slidetake:mode")||x.mode||"dark").toLowerCase()==="light"?"light":"dark"}function Uo(){let e=zt()==="light";e?document.body.dataset.mode="light":delete document.body.dataset.mode;let t=document.getElementById("btn-mode");t&&(t.innerHTML=e?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4.5"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>',t.title=(e?"Dark theme":"Light theme")+" (L)",t.setAttribute("aria-label",t.title))}function qo(){let e=zt()==="light"?"dark":"light";T&&T.themeKey?(te(T.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):te("slidetake:mode",e),Uo(),W.querySelector(".echarts-container, .diagram.d2")&&Rt(!0)}function lr(){let t=(x.camera||"").replace(/^\[|\]$/g,"").split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function cn(e){return!q&&e?to(e.camera):[]}function Ce(e){return no(cn(e),e&&e.frags?e.frags.length:0)}function $o(){let e=Ce(d.get(p));return e[Math.min(ne,e.length-1)]||{cam:0,frag:0}}function cr(){if(!p)return null;let e=d.get(p),t=cn(e);if(t.length)return t[Math.min($o().cam,t.length-1)];if(e&&e.el.classList.contains("card-full"))return"off";for(let n=h.indexOf(p)-1;n>=0;n--){let o=cn(d.get(h[n]));if(o.length)return o[o.length-1]}return null}function dr(){let e={corner:(x.pip||"none").toLowerCase(),size:$t(parseFloat(x.pip_size)||24),circle:(x.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(x.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return ct(e,cr()),J&&!/\b(off|hide)\b/i.test(J)&&(e.off=!1),ct(e,J),!Ue.includes(e.corner)&&(U||e.used)&&(e.corner="bottom-right"),e.flip&&Ue.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function xn(){let e=!I.hidden&&I.offsetWidth?I.getBoundingClientRect():null,t=Ae=dr(),n=Ue.includes(t.corner);if(I.className=n?[t.corner,t.circle&&"circle",U&&"live",t.mirror&&"mirror",t.full&&"full"].filter(Boolean).join(" "):"",I.style.width=t.size+"%",I.hidden=!n||q||t.off,or.dataset.pip=I.hidden||t.full?"none":t.corner,I.hidden||je||!I.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){I.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let a=I.getBoundingClientRect();Math.abs(e.left-a.left)+Math.abs(e.top-a.top)+Math.abs(e.width-a.width)+Math.abs(e.height-a.height)<2||I.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-a.left)+"px,"+(e.top-a.top)+"px) scale("+e.width/a.width+","+e.height/a.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function pr(){let e=Ae;if(!e||I.hidden||e.full)return null;let t=M.clientWidth,n=M.clientHeight,o=16,a=t*e.size/100,r=e.circle?a:a*9/16,i=e.corner.includes("left")?o:t-o-a,s=e.corner.includes("top")?o:n-o-r;return{x0:i,y0:s,x1:i+a,y1:s+r}}function ur(){if(!tt)return;if(q){An(!0);return}let e=lr();pe=(pe+1)%e.length,J=e[pe],xn(),R||Be("Camera: "+J),!U&&!I.hidden?it():oe()}function Yo(e){let t=Qn(e,{render:ar});x=t.deck,d=t.nodes,wt();let n={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Ka.textContent=d.size+(d.size===1?" card":" cards")+" \xB7 "+n,Ze.textContent=t.errCount?t.errCount+" card(s) had errors":""}function Go(){le=[...d.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,a){let r=d.get(o);if(r.depth=a,r.children.length===0)r._slot=e++;else{r.children.forEach(s=>t(s,a+1));let i=r.children.map(s=>d.get(s)._slot);r._slot=(Math.min(...i)+Math.max(...i))/2}}le.forEach(o=>t(o,0)),h=[];function n(o){h.push(o),d.get(o).children.forEach(n)}return le.forEach(n),Math.max(1,e)}function hr(){let e=[],t=[],n=[];return d.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),n[o.depth]=(n[o.depth]||0)+1}),{maxH:e,maxW:t,count:n,maxDepth:e.length-1}}function Ko(e){e.x!==null&&!isNaN(e.x)&&(e.cx=e.x+e._w/2),e.y!==null&&!isNaN(e.y)&&(e.cy=e.y+e._h/2)}function mr(){let{maxH:e,maxDepth:t}=hr(),n=[0];for(let l=1;l<=t;l++)n[l]=n[l-1]+e[l-1]+Za;let o=Ja-ze,a=[],r=(l,c)=>{let f=d.get(l);f.cx+=c,f.children.forEach(N=>r(N,c))},i=l=>{let c=d.get(l);a[c.depth]=Math.max(a[c.depth]??-1/0,c.cx+c._w/2),c.children.forEach(i)};function s(l){let c=d.get(l),f=a[c.depth]!==void 0?a[c.depth]+o:-1/0;c.children.length?(c.children.forEach(s),c.cx=(d.get(c.children[0]).cx+d.get(c.children[c.children.length-1]).cx)/2,c.cx-c._w/2<f&&r(l,f-(c.cx-c._w/2))):c.cx=(f===-1/0?0:f)+c._w/2,i(l)}le.forEach(s),d.forEach(l=>{l.cy=n[l.depth]+l._h/2,Ko(l)})}function fr(e){let t=Math.PI*2/e,n=32,o=[],a=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+n&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+n,r=Math.max(0,...[...d.values()].map(s=>s.depth)),i=0;for(let s=0;s<=r;s++){let l=[...d.values()].filter(f=>f.depth===s);if(!l.length)continue;let c=s===0?le.length>1?er*.5:0:i+Qa;for(let f=0;f<400&&(l.forEach(O=>{let b=(O._slot+.5)*t-Math.PI/2;O.cx=c*Math.cos(b),O.cy=c*Math.sin(b),Ko(O)}),!!l.some((O,b)=>l.some((S,g)=>g>b&&a(O,S))||o.some(S=>a(O,S))));f++)c=c*1.02+10;i=c,o.push(...l)}}function gr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);n.forEach(o=>{let a=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!a)return;let r=o.previousSibling;for(;r&&r.nodeType===3&&!r.data.trim();)r=r.previousSibling;let i=r&&r.nodeType===1?r:o.parentElement;i&&Object.entries(Fe(a[1])).forEach(([s,l])=>{s==="class"?i.classList.add(...l.split(/\s+/).filter(Boolean)):s==="style"?i.style.cssText+=";"+l:i.setAttribute(s,l)})})}function tn(e){let t=document.createElement("figure");t.className="media",e.replaceWith(t),t.appendChild(e);let n=e.getAttribute("alt");return n&&t.insertAdjacentHTML("beforeend","<figcaption>"+C(n)+"</figcaption>"),t}function br(e,t){let n=document.createElement("figure");return n.className="media yt fragment yt-play"+(e.portrait?" portrait":""),n.innerHTML='<div class="frame"><iframe src="'+mo(e)+'" title="'+C(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+C(t)+"</figcaption>":""),n}function Lo(e,t){let n=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",n),e.style.setProperty("--rows",Math.ceil(t/n))}function vr(e,t){t.querySelectorAll("pre > code.language-svg").forEach(r=>{let i=document.createElement("img");i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(r.textContent.trim()),i.alt="";let s=document.createElement("p");s.appendChild(i),r.parentElement.replaceWith(s)}),t.querySelectorAll(":scope > p").forEach(r=>{let i=r.children.length===1?r.children[0]:null;if(!i)return;let s=i.tagName==="A"&&r.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&ho(s);l&&r.replaceWith(br(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(r=>{let i=[...r.children];!i.length||!i.every(s=>s.querySelector("img")&&!s.textContent.trim())||(r.classList.add("gallery"),i.forEach(s=>{let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),tn(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(r.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let c=s.querySelector("figcaption");c&&(c.dataset.count=l+1+" / "+i.length)})):Lo(r,i.length))}),t.querySelectorAll(":scope > p").forEach(r=>{if(!yr(r))return;let i=[...r.querySelectorAll("img")];if(i.length===1){r.replaceWith(i[0]),tn(i[0]);return}let s=document.createElement("div");s.className="gallery grid",r.replaceWith(s),i.forEach(l=>{s.appendChild(l),tn(l)}),Lo(s,i.length)});let n=[...t.children].filter(r=>!/^H[1-6]$/.test(r.tagName)&&!(r.nodeType===1&&r.tagName==="HR")),o=n.filter(r=>r.matches("figure.media"));o.length===1&&n.length===1&&e.classList.add("card-media"),n.length===1&&(n[0].matches("figure.media:not(.yt)")||n[0].matches(".gallery.carousel"))&&e.classList.add("card-bleed");let a=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;a.nextNode();)if(/^\s*view\s*:\s*full\s*$/i.test(a.currentNode.data))e.classList.add("card-full");else if(o.length===1){e.classList.add("card-split",n.indexOf(o[0])===0?"media-first":"media-last");let r=document.createElement("div");r.className="split-text",n.filter(i=>i!==o[0]).forEach(i=>r.appendChild(i)),o[0].after(r),n.indexOf(o[0])!==0&&r.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function Vo(e,t){let n=e.querySelector("iframe");n&&n.contentWindow&&n.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function xr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&n.push(t.currentNode);n.forEach(o=>{let a=o.nextSibling;for(;a&&a.nodeType!==1;)a=a.nextSibling;a&&/^(UL|OL)$/.test(a.tagName)&&a.querySelectorAll(":scope > li").forEach(r=>r.classList.add("fragment","fade-up"))})}function wr(e){let t=[...e.querySelectorAll(".fragment")].map((a,r)=>({e:a,i:r,k:a.dataset.fragmentIndex}));if(t.every(a=>a.k===void 0))return t.map(a=>[a.e]);let n=0;t.forEach(a=>{a.k=a.k===void 0?n:parseFloat(a.k),n=Math.max(n,a.k)+1}),t.sort((a,r)=>a.k-r.k||a.i-r.i);let o=[];return t.forEach((a,r)=>{r&&t[r-1].k===a.k?o[o.length-1].push(a.e):o.push([a.e])}),o}function wn(e,t,n){!e||!e.frags||(n&&e.el.classList.add("snap"),e.frags.forEach((o,a)=>o.forEach(r=>{let i=r.classList.contains("visible");r.classList.toggle("visible",a<t),r.classList.toggle("current-fragment",a===t-1),r.classList.contains("yt-play")&&i!==a<t&&!n&&Vo(r,a<t?"playVideo":"pauseVideo")})),n&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function kr(){try{return x.base?new URL(x.base,Z||location.href):Z?new URL(Z):null}catch{return null}}function Sr(e){let t=kr(),n=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let a=o.hasAttribute("src")?"src":"href",r=o.getAttribute(a);if(!r||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(r))return;if(!t){a==="src"&&n++;return}let i=t;try{x.site&&(i=new URL(x.site,t))}catch{}o.setAttribute(a,new URL(r,r.startsWith("/")?i:t).href)}),n}function At(e){let t=e.el,n=t.querySelector(".body");t.classList.add("measuring"),n.style.zoom="";let o=ze;e.visual=!!n.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=V);let a=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay"),a&&(o=V),t.classList.contains("card-bleed")){let s=Math.max(0,...[...n.querySelectorAll("img")].map(c=>c.naturalWidth&&c.naturalHeight?c.naturalWidth/c.naturalHeight:0))||1.7777777777777777,l=V-gt*s>=260;if(a&&l)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(gt*s)+"px"),o=V;else if(a||Math.abs(s-16/9)<.08)t.classList.add("img-overlay"),o=V;else if(s<1.3){let c=Math.min(Math.round(gt*s),V-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",c+"px"),o=Math.min(V,Math.max(en,c*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(ze,Math.min(V,(gt-Xa)*s))),t.style.setProperty("--img-h",Math.round(o/s)+"px")}else(n.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||n.querySelectorAll("img").length>=4)&&(o=en);let r=n.querySelectorAll("table");if(r.length){t.style.width=V+"px";let s=t.offsetWidth-n.clientWidth;r.forEach(l=>{o=Math.max(o,Math.min(en,Math.ceil(l.offsetWidth)+s+12))})}let i=n.querySelectorAll(".fragment.grow");if(i.length){t.style.width=o+"px";let s=t.offsetWidth-n.clientWidth;i.forEach(l=>{o=Math.max(o,Math.min(V,Math.ceil(l.offsetWidth*1.3)+s))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(V,t.scrollWidth+24))+"px"),n.scrollWidth>n.clientWidth+2&&(n.style.zoom=(n.clientWidth/n.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||ln,t.classList.remove("measuring")}function Er(){clearTimeout(Co),Co=setTimeout(()=>{d.forEach(At),nt(),oe(!0)},200)}function Mr(){let e=zt()==="light"?"light":"dark",t=Ge(e==="light"?"--accent-ring":"--accent"),n="slidetake-"+e+"-"+t.slice(1);return To.has(n)||(Or(n,Tr[e],t),To.add(n)),n}function Or(e,t,n){let o={axisLine:{lineStyle:{color:t.line}},axisTick:{lineStyle:{color:t.line}},axisLabel:{color:t.muted},splitLine:{lineStyle:{color:t.split}},nameTextStyle:{color:t.muted}};echarts.registerTheme(e,{color:[n,...t.palette],backgroundColor:"transparent",textStyle:{color:t.text,fontFamily:"'IBM Plex Sans', sans-serif"},title:{textStyle:{color:t.text},subtextStyle:{color:t.muted}},legend:{textStyle:{color:t.text}},tooltip:{backgroundColor:t.tip,borderColor:t.line,textStyle:{color:t.text}},categoryAxis:o,valueAxis:o,logAxis:o,timeAxis:o,line:{symbolSize:6,lineStyle:{width:2.5}}})}function zr(){let e=zt()==="light"?"light":"dark",t=Ge("--node-bg"),n=Ge(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],a={...Ir[e],N7:t,B1:Ge("--accent")};return o.forEach((r,i)=>{a["B"+(i+2)]=sr(n,t,r)}),a}function dn(e){return nn[e]||(nn[e]=new Promise((t,n)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete nn[e],n(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Pr(){let e=ve,t=[...W.querySelectorAll(".node pre > code.language-dot")];W.querySelectorAll(".node pre > code.language-echarts").forEach(r=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=r.textContent,r.parentElement.replaceWith(i)});let n=[...W.querySelectorAll(".node .echarts-container[data-chart]")],o=[...W.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!n.length&&!o.length)return;let a=[];if(t.length)try{if(await dn(Lr),on=on||await Viz.instance(),e!==ve)return;t.forEach(r=>{let i=document.createElement("div");i.className="diagram";try{i.appendChild(on.renderSVGElement(r.textContent))}catch(s){i.className="diagram err",i.textContent="Diagram error: "+s.message}r.parentElement.replaceWith(i)})}catch{a.push("diagrams")}if(o.length)try{if(!bt){let i=await import(Br);bt=new i.D2}if(e!==ve)return;let r=zr();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await bt.compile(Ar(i.textContent));s.innerHTML=await bt.render(l.diagram,{...l.renderOptions||{},themeOverrides:r,darkThemeOverrides:r})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==ve)return;i.parentElement.replaceWith(s)}}catch{a.push("D2 diagrams")}if(n.length)try{if(await dn(Cr),e!==ve)return;let r=Mr();n.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}echarts.init(i,r,{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!je},s))})}catch{a.push("charts")}e===ve&&(a.length&&(Ze.textContent="Could not load the "+a.join(" and ")+" renderer (offline?)"),d.forEach(At),nt(),oe(!0))}function Rr(){let e=[];return h.forEach(t=>{let n=et(t),o=e[e.length-1];o&&o.sec===n?o.ids.push(t):e.push({sec:n,ids:[t]})}),e}function Dr(){let n=0,o=0,a=0;Rr().forEach((r,i)=>{let s=Math.max(...r.ids.map(f=>d.get(f)._h));i&&(n+=a/2+120+s/2);let l=o,c=o;r.ids.forEach((f,N)=>{let O=d.get(f);N&&(l+=90+O._w/2),O.cx=l,O.cy=n,c=l,l+=O._w/2}),o=c,a=s})}function jr(){d.forEach(e=>{e.cx=0,e.cy=0})}function Xo(){ve++,window.echarts&&W.querySelectorAll(".echarts-container").forEach(n=>{let o=echarts.getInstanceByDom(n);o&&o.dispose()}),W.querySelectorAll("div.node").forEach(n=>n.remove());let e=Go(),t=0;d.forEach(n=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=n.id;let a=n.parent?Pt(n.id).slice(0,-1).map(i=>d.get(i).title).join(" / "):"";o.innerHTML=(a?'<div class="crumb">'+C(a)+"</div>":"")+'<div class="body">'+n.html+"</div>"+(n.err?'<div class="err-badge">!</div>':"");let r=o.querySelector(".body");gr(r),xr(r),vr(o,r),r.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Sr(r),n.frags=wr(r),r.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Er,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));d.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),u.active||P(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{u.active||P(n.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&P(n.id)}),W.appendChild(o),n.el=o,wn(n,n.frags.length)}),t&&!Ze.textContent&&(Ze.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),d.forEach(At),nt(e),Pr()}function nt(e){e===void 0&&(e=Go()),A==="radial"?fr(e):A==="path"?Dr():A==="focus"?jr():mr(),W.classList.toggle("focus",A==="focus"),d.forEach(t=>{let n=t.el.style;n.setProperty("--cx",t.cx),n.setProperty("--cy",t.cy)}),_r(),_e(),Ln()}function _r(){let e="";if(A==="focus"){Qt.innerHTML="";return}if(A==="path"){for(let t=1;t<h.length;t++){let n=d.get(h[t-1]),o=d.get(h[t]);e+='<path data-from="'+n.id+'" data-to="'+o.id+'" d="M '+n.cx+" "+n.cy+" L "+o.cx+" "+o.cy+'"/>'}Qt.innerHTML=e;return}d.forEach(t=>{if(!t.parent)return;let n=d.get(t.parent);if(A==="radial")e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+n.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=n.cy+n._h/2,a=t.cy-t._h/2,r=o+(a-o)/2;e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+o+" L "+n.cx+" "+r+" L "+t.cx+" "+r+" L "+t.cx+" "+a+'"/>'}}),Qt.innerHTML=e}function Pt(e){let t=[],n=e;for(;n;)t.unshift(n),n=d.get(n).parent;return t}function Pe(){let e=M.clientWidth,t=M.clientHeight;W.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+E.zoom+") translate("+-E.x+"px,"+-E.y+"px)",aa()}function kn(){Xe&&(Xe.kill(),Xe=null)}function Jo(e,t){if(kn(),t||je||!window.gsap){Object.assign(E,e),Pe();return}let n=M.clientWidth,o=Math.hypot(e.x-E.x,e.y-E.y),a=e.zoom,r=gsap.timeline({onUpdate:Pe,onComplete:()=>{Xe=null}}),{zoom:i,...s}=e,l=o*Math.min(E.zoom,a),c=Math.max(.55,Math.min(1.3,.55+l/n*.3));if(r.to(E,{...s,duration:c,ease:"power2.inOut"},0),l>n*1.2){let f=Math.max(.06,Math.min(E.zoom,a,n*.9/(o+ze)));r.to(E,{zoom:f,duration:c/2,ease:"sine.out"},0).to(E,{zoom:a,duration:c/2,ease:"sine.in"},c/2)}else r.to(E,{zoom:a,duration:c,ease:"power2.inOut"},0);Xe=r}function Nr(){let e=M.getBoundingClientRect(),t=14,n=[];if(!de.hidden&&de.offsetWidth){let a=de.getBoundingClientRect();n.push({x0:a.left-e.left-t,y0:a.top-e.top-t,x1:a.right-e.left+t,y1:a.bottom-e.top+t})}let o=pr();return o&&n.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),n}function Hr(){let e=M.clientWidth,t=M.clientHeight,n=[{x0:16,y0:R?20:56,x1:e-16,y1:t-(R?20:74)}];return Nr().forEach(o=>{let a=[];n.forEach(r=>{if(o.x1<=r.x0||o.x0>=r.x1||o.y1<=r.y0||o.y0>=r.y1){a.push(r);return}[{...r,x1:Math.min(r.x1,o.x0)},{...r,x0:Math.max(r.x0,o.x1)},{...r,y1:Math.min(r.y1,o.y0)},{...r,y0:Math.max(r.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&a.push(i)})}),a.length&&(n=a)}),n}function pn(e,t,n){let o=M.clientWidth,a=M.clientHeight,r=null;return Hr().forEach(i=>{let s=n*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!r||s>r.zoom)&&(r={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-a/2})}),r}function Zo(e,t,n,o){return{x:e-n.sx/o,y:t-n.sy/o}}function Le(e,t){let n=d.get(e);if(!n)return;let o=pn(n._w,n._h,Qe),a=et(e),r=h.filter(l=>et(l)===a&&!d.get(l).visual).map(l=>{let c=d.get(l);return pn(c._w,c._h,Qe).zoom}).sort((l,c)=>l-c),i=r.length?r[Math.floor((r.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));Jo(Object.assign(Zo(n.cx,n.cy,o,s),{zoom:s}),t)}function ot(e){let t=[...d.values()];if(!t.length)return;let n=M.clientWidth,o=M.clientHeight,a=Math.min(...t.map(f=>f.cx-f._w/2)),r=Math.max(...t.map(f=>f.cx+f._w/2)),i=Math.min(...t.map(f=>f.cy-f._h/2)),s=Math.max(...t.map(f=>f.cy+f._h/2)),l=pn(r-a,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));Jo(Object.assign(Zo((a+r)/2,(i+s)/2,l,c),{zoom:c}),e)}function oe(e){p&&d.has(p)?Le(p,e):ot(e)}function _e(){let e=p?Pt(p):[];d.forEach(t=>{let n=t.el;n.classList.toggle("current",t.id===p),n.classList.toggle("active-path",e.includes(t.id))}),W.querySelectorAll("#connectors path").forEach(t=>{let n=A==="path"?!!p&&h.indexOf(t.dataset.to)<=h.indexOf(p):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",n)}),qr(e),ea()}function Qo(){return Vn(new URLSearchParams(location.search).get("duration")??x.duration)}function Fr(){return R&&Qo()>0&&(!u.active||/^always$/i.test(x.timer||""))}function kt(){let e=Fr()&&ue.start>0;if(we.classList.toggle("timed",e),!e){we.classList.remove("over");return}let n=(u.active&&u.t0?Ct():performance.now()-ue.start)/Qo();we.firstChild.style.width=Math.min(100,n*100)+"%",we.classList.toggle("over",n>=1)}function Wr(){ue.start=performance.now(),clearInterval(ue.timer),ue.timer=setInterval(kt,1e3),kt()}function Ur(){clearInterval(ue.timer),ue.timer=null,ue.start=0,kt()}function ea(){let e=R&&h.length>1&&!/^(off|no|false)$/i.test(x.progress||"");if(we.classList.toggle("show",e),!e)return;kt();let t=h.indexOf(p),n=0,o=0;h.forEach((a,r)=>{let i=Ce(d.get(a)).length;n+=i,r<t?o+=i:r===t&&(o+=Math.min(ne,i-1)+1)}),we.lastChild.style.width=(n?o/n*100:0)+"%"}function qr(e){ko.innerHTML=e.map((t,n)=>(n>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===p?" here":"")+'" data-id="'+C(t)+'">'+C(d.get(t).title)+"</button>").join(""),ko.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{u.active||P(t.dataset.id)}))}function at(e){let t=d.get(p);t&&(wn(t,$o().frag,e),xn(),(I.hidden||!Ae||!Ae.full)&&Gr(t),En(t))}function Yr(e){return!h.length||e.id!==h[0]&&e.id!==h[h.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function Gr(e){if(e._played||!window.gsap||je)return;e._played=!0;let t=Yr(e);if(t&&t.length){e._auto=t;let[n,...o]=t;/^H[1-3]$/.test(n.tagName)&&!n.children.length?(n.classList.add("auto-scramble"),Mo(n)):o.unshift(n),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(n=>{let o;try{o=JSON.parse(n.dataset.gsap)}catch{return}let a={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(n,o.from||{},Object.assign({},o.to,a)):o.from&&gsap.from(n,Object.assign({},o.from,a))}),e.el.querySelectorAll(".title-scramble").forEach(Mo)}function Sn(e){!e||!e._played||(e._played=!1,window.gsap&&(e._auto&&(e._auto.forEach(t=>{gsap.killTweensOf(t),gsap.set(t,{clearProps:"opacity,transform"})}),e._auto=null),e.el.querySelectorAll("[data-gsap]").forEach(t=>{gsap.killTweensOf(t);let n={};try{n=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},n.from,n.to)).map(a=>$r.includes(a)?"transform":a));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble, .auto-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function Mo(e){let t=e.dataset.text||(e.dataset.text=e.textContent),n=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",a={p:0};e._scramble=gsap.to(a,{p:1,duration:1.4,ease:"none",onUpdate(){let r=Math.floor(a.p*n.length);e.textContent=n.map((i,s)=>s<r||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function En(e){clearTimeout(Re),!(!R||!e||!e.autoslide||u.active&&(!u.t0||u.paused))&&(Re=setTimeout(()=>{p===e.id&&De(1)},e.autoslide))}function ta(e){let t=e&&e!==h[0]?e:"";try{y&&y.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Xt(y.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function P(e,t,n){if(!d.has(e))return;if(e!==p){J=null,pe=-1,ne=n?Ce(d.get(e)).length-1:0;let r=d.get(p);r&&A==="focus"&&!t&&(r.el.classList.add("leaving"),setTimeout(()=>r.el.classList.remove("leaving"),600)),na()}let o=e!==p;if(p=e,clearTimeout(X),X=null,o&&A==="focus"&&!t&&!je){let r=d.get(e).el;r.classList.add("entering"),r.offsetWidth,r.classList.remove("entering")}at(o),o&&Bn("slide",e);let a=d.get(e);o&&a.mapFirst&&!n&&!t&&A!=="focus"?(ot(),X=setTimeout(()=>{X=null,p===e&&Le(e)},1900)):Le(e,t),_e(),Ln(),ta(e)}function na(){let e=d.get(p);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>Vo(t,"pauseVideo")),wn(e,e.frags.length,!0),Sn(e))}function Kr(){if(!p&&ke&&d.has(ke)){oa();return}p&&(ke=p),A==="focus"&&Se("path"),na(),clearTimeout(Re),p=null,_e(),Ln(),ot(),ta(null)}function oa(){if(X)return clearTimeout(X),X=null,Le(p),!0;if(!p&&ke&&d.has(ke)){let e=ke;return ke=null,P(e),!0}return!1}function De(e){if(!p){h.length&&P(h[e>0?0:h.length-1]);return}if(X&&e>0){clearTimeout(X),X=null,Le(p);return}let t=Ce(d.get(p)),n=Math.min(ne,t.length-1)+e;if(n>=0&&n<t.length){ne=n,J=null,pe=-1,at(),!U&&!I.hidden&&Ae.used?it():oe(),_e();return}let o=h.indexOf(p)+e;o>=0&&o<h.length&&P(h[o],!1,e<0)}function Vr(){let e=d.get(p);e&&e.parent&&P(e.parent)}function Xr(){let e=d.get(p);e&&e.children.length?P(e.children[0]):!p&&h.length&&P(h[0])}function Ln(){let e=[...d.values()];if(!e.length){sn.innerHTML="",ie=null;return}Va.textContent="map";let t=g=>g.cx,n=g=>g.cy,o=Math.min(...e.map(t))-ze/2,a=Math.max(...e.map(t))+ze/2,r=Math.min(...e.map(n))-ln/2,i=Math.max(...e.map(n))+ln/2,s=16,l=180,c=130,f=Math.min((l-2*s)/Math.max(1,a-o),(c-2*s-6)/Math.max(1,i-r)),N=l/2-(o+a)/2*f,O=c/2+5-(r+i)/2*f,b=p?Pt(p):[],S="";e.forEach(g=>{if(!g.parent)return;let B=d.get(g.parent);S+='<line x1="'+(t(B)*f+N)+'" y1="'+(n(B)*f+O)+'" x2="'+(t(g)*f+N)+'" y2="'+(n(g)*f+O)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(g=>{let B=g.id===p?"var(--accent)":b.includes(g.id)?"var(--accent-teal)":"var(--node-border)";S+='<circle data-id="'+C(g.id)+'" cx="'+(t(g)*f+N)+'" cy="'+(n(g)*f+O)+'" r="'+(g.id===p?4:3)+'" fill="'+B+'"><title>'+C(g.title)+"</title></circle>"}),S+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',sn.innerHTML=S,ie={s:f,ox:N,oy:O},aa()}function aa(){let e=document.getElementById("mm-viewport");if(!e||!ie)return;let t=M.clientWidth/E.zoom,n=M.clientHeight/E.zoom;e.setAttribute("x",(E.x-t/2)*ie.s+ie.ox),e.setAttribute("y",(E.y-n/2)*ie.s+ie.oy),e.setAttribute("width",Math.max(2,t*ie.s)),e.setAttribute("height",Math.max(2,n*ie.s))}function Rt(e){Yo(Q.value),p&&!d.has(p)&&(p=null),Xo(),p?P(p,e):h.length?P(h[0],e):(p=null,ot(!0))}function Se(e,t){A=e,te("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(n=>n.classList.toggle("active",n.dataset.mode===e)),d.size&&(!t&&!je&&(W.classList.add("morph"),setTimeout(()=>W.classList.remove("morph"),700)),nt(),Pe(),p?Le(p,t):ot(t))}function ra(e){return Math.max(.04,Math.min(5,e))}function Jr(e){Qe=Math.round(Math.max(tr,Math.min(nr,e))*100)/100,te("slidetake:slideSize",Qe),p&&Le(p)}function Bo(e){p?Jr(Qe+e*.1):ia(e>0?1.2:1/1.2)}function ia(e,t,n){kn();let o=ra(E.zoom*e);if(t!==void 0){let a=M.getBoundingClientRect(),r=t-a.left-a.width/2,i=n-a.top-a.height/2;E.x+=r/E.zoom-r/o,E.y+=i/E.zoom-i/o}E.zoom=o,Pe()}function Dt(){T||(fe.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!fe.classList.contains("collapsed")))}function ge(e){R=e,document.body.classList.toggle("presenting",e),Sa();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!p&&h.length&&P(h[0]);let n=x.camera||[...d.values()].some(o=>o.camera);e&&n&&!U&&!q&&it(),e?En(d.get(p)):clearTimeout(Re),e?Wr():Ur(),ea()}function Ct(){return(u.paused?u.pauseAt:performance.now())-u.t0-u.pausedMs}function jt(e){e.classList.add("open")}function Mn(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function ti(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,n,...o]=e.split(":");return St.value=t||"localhost",Et.value=n||"4455",Lt.value=o.join(":"),!0}try{let t=JSON.parse(ee("slidetake:obs")||"null");t&&(St.value=t.host||"localhost",Et.value=t.port||"4455",Lt.value=t.password||"",Cn.checked=!0)}catch{}return!1}function ca(){if(Cn.checked)te("slidetake:obs",JSON.stringify({host:St.value.trim(),port:Et.value.trim(),password:Lt.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Ye(e,t){Ro.textContent=e,Ro.className=t||""}function oi(e){return location.protocol==="https:"&&!ni(e)}async function da(){let e=St.value.trim()||"localhost",t="ws://"+e+":"+(Et.value.trim()||"4455");if(oi(e)){xe=!1,Je.disabled=!0,Ye(ai,"err");return}Ye("Connecting to "+t+"\u2026");try{await dn(Zr);let n=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(F)try{await F.disconnect()}catch{}F=new n,F.on("ConnectionClosed",()=>{xe=!1,Ye("Disconnected from OBS","err"),Je.disabled=!0}),F.on("RecordStateChanged",a=>{a.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ee&&(Ee(),Ee=null),a.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&u.active&&u.withObs&&!u.finishing&&_t("Stopped in OBS")});let o=await F.connect(t,Lt.value||void 0);xe=!0;try{let a=await F.call("GetVideoSettings");a&&a.fpsNumerator&&a.fpsDenominator&&(sa=a.fpsNumerator/a.fpsDenominator)}catch{}Ye("Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),"ok"),ca()}catch(n){xe=!1,Ye("Could not connect ("+(n&&n.message||n)+"). Is OBS running with its WebSocket server on, and is the password right?","err")}Je.disabled=!xe}function ri(){let e=document.getElementById("rec-screen"),t=screen.width,n=screen.height;if(Math.abs(t/n-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+n+"), right for YouTube.</span>";return}let o=[["16:10",1.6],["3:2",1.5],["4:3",4/3],["21:9",21/9],["16:9",16/9]],[a,r]=o.reduce((s,l)=>Math.abs(l[1]-t/n)<Math.abs(s[1]-t/n)?l:s),i=Math.abs(r-t/n)<.005?a:"about "+a;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+n+"), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>"}function hn(){if(!tt)return;let e=h.reduce((n,o)=>n+Ce(d.get(o)).length,0),t=x.camera||[...d.values()].some(n=>n.camera);document.getElementById("rec-deck-info").innerHTML=C(x.title||(le[0]?d.get(le[0]).title:"This deck"))+" \xB7 "+h.length+" slides \xB7 "+e+" presses"+(t&&q?'<br><span class="warn">The camera is off. Press C first if this take should include your webcam.</span>':""),Je.disabled=!xe,di(),ri(),jt(Qr)}async function pa(e){if(u.active||!h.length)return;Mn(),Object.assign(u,{active:!0,withObs:e,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null}),document.body.classList.add("recording"),wa();let t=document.getElementById("rec-layout").value;t!=="current"&&t!==A&&Se(t,!0),R||ge(!0),p===h[0]&&(ne=0,J=null,pe=-1),P(h[0],!0);for(let o=3;o>0;o--)if(yt.querySelector(".num").textContent=o,yt.classList.add("show"),await Tn(1e3),!u.active)return;if(yt.classList.remove("show"),await la(),e){let o=new Promise(a=>{Ee=a,setTimeout(()=>{Ee&&(Ee(),Ee=null)},2500)});try{await F.call("StartRecord")}catch(a){On("OBS could not start recording: "+(a&&a.message||a));return}if(await o,!u.active)return}u.counting=!1,u.t0=performance.now();let n=d.get(p);Sn(n),at(!0),Bn("slide",p)}function On(e){u.active=!1,u.counting=!1,yt.classList.remove("show"),document.body.classList.remove("recording"),R&&ge(!1),Be(e)}function Bn(e,t){if(!u.active||!u.t0||u.finishing)return;let n=d.get(t),o={id:t,title:n?n.title:t,retake:e==="retake",t:Math.round(Ct()),obsT:null};u.events.push(o),u.withObs&&xe&&(F.call("GetRecordStatus").then(a=>{a&&typeof a.outputDuration=="number"&&(o.obsT=a.outputDuration)}).catch(()=>{}),n&&F.call("CreateRecordChapter",{chapterName:(o.retake?"RETAKE \xB7 ":"")+n.title}).catch(()=>{}))}function ii(e){let t=e.key;if((zo.includes(t)||Ao.includes(t)||Po.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){u.counting?On("Take cancelled"):_t("Stopped early");return}if(!(u.counting||u.finishing)){if(Po.includes(t)){ci();return}u.paused||(zo.includes(t)?si():Ao.includes(t)&&li())}}function si(){let e=Ce(d.get(p));Math.min(ne,e.length-1)>=e.length-1&&h.indexOf(p)===h.length-1?_t():De(1)}function li(){let e=d.get(p);e&&(Bn("retake",p),ne=0,J=null,pe=-1,Sn(e),at(!0),!U&&!I.hidden&&Ae.used?it():oe(),_e())}async function ci(){u.t0&&(u.paused?(un.classList.remove("show"),await la(),u.withObs&&await F.call("ResumeRecord").catch(()=>{}),u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,En(d.get(p))):(u.paused=!0,u.pauseAt=performance.now(),clearTimeout(Re),u.withObs&&await F.call("PauseRecord").catch(()=>{}),un.classList.add("show")))}async function _t(e){if(!u.active||u.finishing)return;if(u.counting){On("Take cancelled");return}u.finishing=!0,clearTimeout(Re),u.paused&&(u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,un.classList.remove("show"));let t=Math.round(Ct()),n=null;if(u.withObs){await Tn(1200),t=Math.round(Ct());try{let a=await F.call("GetRecordStatus");a&&typeof a.outputDuration=="number"&&(n=a.outputDuration)}catch{}try{let a=await F.call("StopRecord");u.outputPath=a&&a.outputPath}catch(a){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(a&&a.message||a)+")"}}u.active=!1,u.finishing=!1,document.body.classList.remove("recording"),R&&ge(!1);let o={key:Nt(),deckTitle:x.title||d.get(h[0]).title,date:new Date().toISOString(),withObs:u.withObs,outputPath:u.outputPath,reason:e||"",total:t,totalObs:n,fps:sa,events:u.events.map(a=>({id:a.id,title:a.title,retake:a.retake,t:a.t,obsT:a.obsT})),picks:{}};In(o),ya(o)}function Nt(){return Te(x.title||(h[0]?d.get(h[0]).title:"deck"))}function ua(){try{return JSON.parse(ee("slidetake:sessions")||"[]")}catch{return[]}}function In(e){let t=ua().filter(n=>n.date!==e.date);t.unshift(e),te("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function di(){let e=document.getElementById("rec-sessions"),t=ua().filter(n=>n.key===Nt());e.innerHTML=t.length?"<h3>Earlier takes of this deck</h3>"+t.map((n,o)=>'<div class="row"><button class="btn small" data-session="'+o+'">Review</button><span>'+C(new Date(n.date).toLocaleString())+" \xB7 "+K(n.totalObs??n.total)+(n.withObs?"":" \xB7 rehearsal")+(n.outputPath?" \xB7 "+C(Me(n.outputPath)):"")+"</span></div>").join(""):"",e.querySelectorAll("[data-session]").forEach(n=>n.onclick=()=>{Mn(),ya(t[+n.dataset.session])})}function et(e){let t=d.has(e)?Pt(e):[e];return t[Math.min(1,t.length-1)]}function ha(e,t){let n=et(e);return{sec:n,title:d.has(n)?d.get(n).title:t}}function ga(){let e=Object.keys(x).filter(t=>t==="tags"||/_tags$/.test(t)).flatMap(t=>[].concat(x[t])).filter(t=>typeof t=="string");return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function pi(){return[].concat(x.related||[]).map(e=>{let t=String(e).match(/^\[([^\]]+)\]\(([^)]+)\)$/),n=String(e).split("|");return t?t[1]+": "+t[2]:n.length===2?n[0].trim()+": "+n[1].trim():String(e)})}function ui(){if(x.permalink||x.url)return x.permalink||x.url;let e=x.site||ee("slidetake:site");if(!e||!Z)return"";try{let t=new URL(Z).pathname.replace(/\/index\.md$/i,"/").replace(/\.md$/i,"/");return new URL(t,e).href}catch{return""}}function ba(e){let t=ma(e),n=document.getElementById("rv-link").value.trim(),o=pi(),a=ga(),r=[];x.summary&&r.push(x.summary),n&&r.push("\u{1F4D1} Slides: "+n),t.lines.length>=3&&r.push(`Chapters
|
|
618
|
+
`+N+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+M+" -c copy -movflags +faststart "+mt(i)}let b=ft(e),S=m=>(m/b).toFixed(6),g=m=>((m-.5)/b).toFixed(6),B=r.map(m=>"gte(t,"+g(m.f0)+")*lt(t,"+g(m.f1)+")").join("+"),G=r.map(m=>"gte(t,"+S(m.f0)+")*lt(t,"+S(m.f1)+")").join("+"),w=t==="mac"?"-c:v h264_videotoolbox -b:v 12M":"-c:v libx264 -crf 18 -preset medium";return N+"ffmpeg -i "+mt(n)+" -i /tmp/slidetake-chapters.txt"+M+` -vf "select='`+B+`',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='`+G+`',asetpts=N/SR/TB" `+w+" -c:a aac -b:a 192k -movflags +faststart "+mt(i)}var go,ft,bo,Me,Ga,mt,yo,wo=j(()=>{"use strict";lt();go=e=>e.obsT??e.t,ft=e=>e.fps||60,bo=(e,t)=>Math.round(e*t/1e3);Me=e=>String(e||"").split(/[\\/]/).pop()||"",Ga=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},mt=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",yo=e=>(e/1e3).toFixed(3)});var Li={};function ee(e){try{let t=localStorage.getItem(e);if(t!==null||!e.startsWith("slidetake:"))return t;let n=e.slice(10);return localStorage.getItem("slidetake:"+n)??localStorage.getItem("traverse:"+n)}catch{return null}}function te(e,t){try{localStorage.setItem(e,t)}catch{}}function ar(e){try{return{html:window.marked?window.marked.parse(e):"<pre>"+C(e)+"</pre>",err:null}}catch{return{html:"<p>(could not render)</p>",err:"render error"}}}function wt(){let e=x.brand||"",t=x.logo||"",n=/^chip$/i.test(x.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+Wo+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+C(t)+'">':"")+(e?"<span"+(n?' class="chip"':"")+">"+C(e)+"</span>":"");if(de.dataset.html!==o){de.dataset.html=o,de.innerHTML=o;let a=de.querySelector("img");a&&(a.onload=a.onerror=()=>oe(!0))}de.hidden=!o,xn(),document.title=x.title||"Slidetake",ir(),Uo()}function rr(){let e=String(x.accent||"").trim();if(!e||!window.CSS||!CSS.supports("color",e))return null;if(!CSS.supports("color","oklch(from red l c h)"))return{accent:e,line:e};let t=n=>"oklch(from "+e+" "+n+" c h)";return{dark:{accent:t(.8),accentSoft:t(.87),line:t(.5)},light:{accent:t(.45),accentSoft:t(.4),line:t(.75),ring:t(.7)}}}function ir(){let e="",t=(o,a)=>{let r=Object.entries(a||{}).filter(([i,s])=>So[i]&&s&&typeof s!="object").map(([i,s])=>So[i]+":"+String(s).replace(/[;{}<>]/g,"")).join(";");r&&(e+=o+"{"+r+`}
|
|
619
|
+
`)};[O&&O.colors,rr()].filter(Boolean).forEach(o=>{["dark","light"].forEach(a=>{let r={...o,...o[a]||{}},i=a==="dark";r.accent&&typeof r.accent=="string"&&(r.accentSoft=r.accentSoft||r.accent,r.line=r.line||"color-mix(in srgb, "+r.accent+(i?" 45%, #09090b)":" 55%, #fff)"),r.ring=r.ring||(i?r.accent:r.line),r.onAccent=r.onAccent||(i?"color-mix(in srgb, "+r.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',r)})});let n=document.getElementById("st-colors");n||(n=document.createElement("style"),n.id="st-colors",document.head.appendChild(n)),n.textContent!==e&&(n.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Ge(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let n=getComputedStyle(t).color;return t.remove(),ye=ye||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),ye.clearRect(0,0,1,1),ye.fillStyle="#000",ye.fillStyle=n,ye.fillRect(0,0,1,1),"#"+[...ye.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function sr(e,t,n){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),a=o(e),r=o(t);return"#"+a.map((i,s)=>Math.round(i*n+r[s]*(1-n)).toString(16).padStart(2,"0")).join("")}function It(){if(O&&O.themeKey&&!Eo){let t=ee(O.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Eo||ee("slidetake:mode")||x.mode||"dark").toLowerCase()==="light"?"light":"dark"}function Uo(){let e=It()==="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 qo(){let e=It()==="light"?"dark":"light";O&&O.themeKey?(te(O.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):te("slidetake:mode",e),Uo(),W.querySelector(".echarts-container, .diagram.d2")&&Rt(!0)}function lr(){let t=(x.camera||"").replace(/^\[|\]$/g,"").split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function cn(e){return!q&&e?to(e.camera):[]}function Ce(e){return no(cn(e),e&&e.frags?e.frags.length:0)}function $o(){let e=Ce(d.get(p));return e[Math.min(ne,e.length-1)]||{cam:0,frag:0}}function cr(){if(!p)return null;let e=d.get(p),t=cn(e);if(t.length)return t[Math.min($o().cam,t.length-1)];if(e&&e.el.classList.contains("card-full"))return"off";for(let n=h.indexOf(p)-1;n>=0;n--){let o=cn(d.get(h[n]));if(o.length)return o[o.length-1]}return null}function dr(){let e={corner:(x.pip||"none").toLowerCase(),size:$t(parseFloat(x.pip_size)||24),circle:(x.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(x.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return ct(e,cr()),J&&!/\b(off|hide)\b/i.test(J)&&(e.off=!1),ct(e,J),!Ue.includes(e.corner)&&(U||e.used)&&(e.corner="bottom-right"),e.flip&&Ue.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function xn(){let e=!z.hidden&&z.offsetWidth?z.getBoundingClientRect():null,t=Ae=dr(),n=Ue.includes(t.corner);if(z.className=n?[t.corner,t.circle&&"circle",U&&"live",t.mirror&&"mirror",t.full&&"full"].filter(Boolean).join(" "):"",z.style.width=t.size+"%",z.hidden=!n||q||t.off,or.dataset.pip=z.hidden||t.full?"none":t.corner,z.hidden||je||!z.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){z.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let a=z.getBoundingClientRect();Math.abs(e.left-a.left)+Math.abs(e.top-a.top)+Math.abs(e.width-a.width)+Math.abs(e.height-a.height)<2||z.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-a.left)+"px,"+(e.top-a.top)+"px) scale("+e.width/a.width+","+e.height/a.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function pr(){let e=Ae;if(!e||z.hidden||e.full)return null;let t=T.clientWidth,n=T.clientHeight,o=16,a=t*e.size/100,r=e.circle?a:a*9/16,i=e.corner.includes("left")?o:t-o-a,s=e.corner.includes("top")?o:n-o-r;return{x0:i,y0:s,x1:i+a,y1:s+r}}function ur(){if(!tt)return;if(q){An(!0);return}let e=lr();pe=(pe+1)%e.length,J=e[pe],xn(),R||Be("Camera: "+J),!U&&!z.hidden?it():oe()}function Yo(e){let t=Qn(e,{render:ar});x=t.deck,d=t.nodes,wt();let n={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Ka.textContent=d.size+(d.size===1?" card":" cards")+" \xB7 "+n,Ze.textContent=t.errCount?t.errCount+" card(s) had errors":""}function Go(){le=[...d.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,a){let r=d.get(o);if(r.depth=a,r.children.length===0)r._slot=e++;else{r.children.forEach(s=>t(s,a+1));let i=r.children.map(s=>d.get(s)._slot);r._slot=(Math.min(...i)+Math.max(...i))/2}}le.forEach(o=>t(o,0)),h=[];function n(o){h.push(o),d.get(o).children.forEach(n)}return le.forEach(n),Math.max(1,e)}function hr(){let e=[],t=[],n=[];return d.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),n[o.depth]=(n[o.depth]||0)+1}),{maxH:e,maxW:t,count:n,maxDepth:e.length-1}}function Ko(e){e.x!==null&&!isNaN(e.x)&&(e.cx=e.x+e._w/2),e.y!==null&&!isNaN(e.y)&&(e.cy=e.y+e._h/2)}function mr(){let{maxH:e,maxDepth:t}=hr(),n=[0];for(let l=1;l<=t;l++)n[l]=n[l-1]+e[l-1]+Za;let o=Ja-Ie,a=[],r=(l,c)=>{let f=d.get(l);f.cx+=c,f.children.forEach(N=>r(N,c))},i=l=>{let c=d.get(l);a[c.depth]=Math.max(a[c.depth]??-1/0,c.cx+c._w/2),c.children.forEach(i)};function s(l){let c=d.get(l),f=a[c.depth]!==void 0?a[c.depth]+o:-1/0;c.children.length?(c.children.forEach(s),c.cx=(d.get(c.children[0]).cx+d.get(c.children[c.children.length-1]).cx)/2,c.cx-c._w/2<f&&r(l,f-(c.cx-c._w/2))):c.cx=(f===-1/0?0:f)+c._w/2,i(l)}le.forEach(s),d.forEach(l=>{l.cy=n[l.depth]+l._h/2,Ko(l)})}function fr(e){let t=Math.PI*2/e,n=32,o=[],a=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+n&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+n,r=Math.max(0,...[...d.values()].map(s=>s.depth)),i=0;for(let s=0;s<=r;s++){let l=[...d.values()].filter(f=>f.depth===s);if(!l.length)continue;let c=s===0?le.length>1?er*.5:0:i+Qa;for(let f=0;f<400&&(l.forEach(M=>{let b=(M._slot+.5)*t-Math.PI/2;M.cx=c*Math.cos(b),M.cy=c*Math.sin(b),Ko(M)}),!!l.some((M,b)=>l.some((S,g)=>g>b&&a(M,S))||o.some(S=>a(M,S))));f++)c=c*1.02+10;i=c,o.push(...l)}}function gr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);n.forEach(o=>{let a=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!a)return;let r=o.previousSibling;for(;r&&r.nodeType===3&&!r.data.trim();)r=r.previousSibling;let i=r&&r.nodeType===1?r:o.parentElement;i&&Object.entries(He(a[1])).forEach(([s,l])=>{s==="class"?i.classList.add(...l.split(/\s+/).filter(Boolean)):s==="style"?i.style.cssText+=";"+l:i.setAttribute(s,l)})})}function tn(e){let t=document.createElement("figure");t.className="media",e.replaceWith(t),t.appendChild(e);let n=e.getAttribute("alt");return n&&t.insertAdjacentHTML("beforeend","<figcaption>"+C(n)+"</figcaption>"),t}function br(e,t){let n=document.createElement("figure");return n.className="media yt fragment yt-play"+(e.portrait?" portrait":""),n.innerHTML='<div class="frame"><iframe src="'+mo(e)+'" title="'+C(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+C(t)+"</figcaption>":""),n}function Lo(e,t){let n=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",n),e.style.setProperty("--rows",Math.ceil(t/n))}function vr(e,t){t.querySelectorAll("pre > code.language-svg").forEach(r=>{let i=document.createElement("img");i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(r.textContent.trim()),i.alt="";let s=document.createElement("p");s.appendChild(i),r.parentElement.replaceWith(s)}),t.querySelectorAll(":scope > p").forEach(r=>{let i=r.children.length===1?r.children[0]:null;if(!i)return;let s=i.tagName==="A"&&r.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&ho(s);l&&r.replaceWith(br(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(r=>{let i=[...r.children];!i.length||!i.every(s=>s.querySelector("img")&&!s.textContent.trim())||(r.classList.add("gallery"),i.forEach(s=>{let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),tn(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(r.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let c=s.querySelector("figcaption");c&&(c.dataset.count=l+1+" / "+i.length)})):Lo(r,i.length))}),t.querySelectorAll(":scope > p").forEach(r=>{if(!yr(r))return;let i=[...r.querySelectorAll("img")];if(i.length===1){r.replaceWith(i[0]),tn(i[0]);return}let s=document.createElement("div");s.className="gallery grid",r.replaceWith(s),i.forEach(l=>{s.appendChild(l),tn(l)}),Lo(s,i.length)});let n=[...t.children].filter(r=>!/^H[1-6]$/.test(r.tagName)&&!(r.nodeType===1&&r.tagName==="HR")),o=n.filter(r=>r.matches("figure.media"));o.length===1&&n.length===1&&e.classList.add("card-media"),n.length===1&&(n[0].matches("figure.media:not(.yt)")||n[0].matches(".gallery.carousel"))&&e.classList.add("card-bleed");let a=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;a.nextNode();)if(/^\s*view\s*:\s*full\s*$/i.test(a.currentNode.data))e.classList.add("card-full");else if(o.length===1){e.classList.add("card-split",n.indexOf(o[0])===0?"media-first":"media-last");let r=document.createElement("div");r.className="split-text",n.filter(i=>i!==o[0]).forEach(i=>r.appendChild(i)),o[0].after(r),n.indexOf(o[0])!==0&&r.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function Vo(e,t){let n=e.querySelector("iframe");n&&n.contentWindow&&n.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function xr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&n.push(t.currentNode);n.forEach(o=>{let a=o.nextSibling;for(;a&&a.nodeType!==1;)a=a.nextSibling;a&&/^(UL|OL)$/.test(a.tagName)&&a.querySelectorAll(":scope > li").forEach(r=>r.classList.add("fragment","fade-up"))})}function wr(e){let t=[...e.querySelectorAll(".fragment")].map((a,r)=>({e:a,i:r,k:a.dataset.fragmentIndex}));if(t.every(a=>a.k===void 0))return t.map(a=>[a.e]);let n=0;t.forEach(a=>{a.k=a.k===void 0?n:parseFloat(a.k),n=Math.max(n,a.k)+1}),t.sort((a,r)=>a.k-r.k||a.i-r.i);let o=[];return t.forEach((a,r)=>{r&&t[r-1].k===a.k?o[o.length-1].push(a.e):o.push([a.e])}),o}function wn(e,t,n){!e||!e.frags||(n&&e.el.classList.add("snap"),e.frags.forEach((o,a)=>o.forEach(r=>{let i=r.classList.contains("visible");r.classList.toggle("visible",a<t),r.classList.toggle("current-fragment",a===t-1),r.classList.contains("yt-play")&&i!==a<t&&!n&&Vo(r,a<t?"playVideo":"pauseVideo")})),n&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function kr(){try{return x.base?new URL(x.base,Z||location.href):Z?new URL(Z):null}catch{return null}}function Sr(e){let t=kr(),n=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let a=o.hasAttribute("src")?"src":"href",r=o.getAttribute(a);if(!r||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(r))return;if(!t){a==="src"&&n++;return}let i=t;try{x.site&&(i=new URL(x.site,t))}catch{}o.setAttribute(a,new URL(r,r.startsWith("/")?i:t).href)}),n}function At(e){let t=e.el,n=t.querySelector(".body");t.classList.add("measuring"),n.style.zoom="";let o=Ie;e.visual=!!n.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=V);let a=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay"),a&&(o=V),t.classList.contains("card-bleed")){let s=Math.max(0,...[...n.querySelectorAll("img")].map(c=>c.naturalWidth&&c.naturalHeight?c.naturalWidth/c.naturalHeight:0))||1.7777777777777777,l=V-gt*s>=260;if(a&&l)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(gt*s)+"px"),o=V;else if(a||Math.abs(s-16/9)<.08)t.classList.add("img-overlay"),o=V;else if(s<1.3){let c=Math.min(Math.round(gt*s),V-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",c+"px"),o=Math.min(V,Math.max(en,c*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(Ie,Math.min(V,(gt-Xa)*s))),t.style.setProperty("--img-h",Math.round(o/s)+"px")}else(n.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||n.querySelectorAll("img").length>=4)&&(o=en);let r=n.querySelectorAll("table");if(r.length){t.style.width=V+"px";let s=t.offsetWidth-n.clientWidth;r.forEach(l=>{o=Math.max(o,Math.min(en,Math.ceil(l.offsetWidth)+s+12))})}let i=n.querySelectorAll(".fragment.grow");if(i.length){t.style.width=o+"px";let s=t.offsetWidth-n.clientWidth;i.forEach(l=>{o=Math.max(o,Math.min(V,Math.ceil(l.offsetWidth*1.3)+s))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(V,t.scrollWidth+24))+"px"),n.scrollWidth>n.clientWidth+2&&(n.style.zoom=(n.clientWidth/n.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||ln,t.classList.remove("measuring")}function Er(){clearTimeout(Co),Co=setTimeout(()=>{d.forEach(At),nt(),oe(!0)},200)}function Mr(){let e=It()==="light"?"light":"dark",t=Ge(e==="light"?"--accent-ring":"--accent"),n="slidetake-"+e+"-"+t.slice(1);return To.has(n)||(Or(n,Tr[e],t),To.add(n)),n}function Or(e,t,n){let o={axisLine:{lineStyle:{color:t.line}},axisTick:{lineStyle:{color:t.line}},axisLabel:{color:t.muted},splitLine:{lineStyle:{color:t.split}},nameTextStyle:{color:t.muted}};echarts.registerTheme(e,{color:[n,...t.palette],backgroundColor:"transparent",textStyle:{color:t.text,fontFamily:"'IBM Plex Sans', sans-serif"},title:{textStyle:{color:t.text},subtextStyle:{color:t.muted}},legend:{textStyle:{color:t.text}},tooltip:{backgroundColor:t.tip,borderColor:t.line,textStyle:{color:t.text}},categoryAxis:o,valueAxis:o,logAxis:o,timeAxis:o,line:{symbolSize:6,lineStyle:{width:2.5}}})}function Ir(){let e=It()==="light"?"light":"dark",t=Ge("--node-bg"),n=Ge(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],a={...zr[e],N7:t,B1:Ge("--accent")};return o.forEach((r,i)=>{a["B"+(i+2)]=sr(n,t,r)}),a}function dn(e){return nn[e]||(nn[e]=new Promise((t,n)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete nn[e],n(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Pr(){let e=ve,t=[...W.querySelectorAll(".node pre > code.language-dot")];W.querySelectorAll(".node pre > code.language-echarts").forEach(r=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=r.textContent,r.parentElement.replaceWith(i)});let n=[...W.querySelectorAll(".node .echarts-container[data-chart]")],o=[...W.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!n.length&&!o.length)return;let a=[];if(t.length)try{if(await dn(Lr),on=on||await Viz.instance(),e!==ve)return;t.forEach(r=>{let i=document.createElement("div");i.className="diagram";try{i.appendChild(on.renderSVGElement(r.textContent))}catch(s){i.className="diagram err",i.textContent="Diagram error: "+s.message}r.parentElement.replaceWith(i)})}catch{a.push("diagrams")}if(o.length)try{if(!bt){let i=await import(Br);bt=new i.D2}if(e!==ve)return;let r=Ir();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await bt.compile(Ar(i.textContent));s.innerHTML=await bt.render(l.diagram,{...l.renderOptions||{},themeOverrides:r,darkThemeOverrides:r})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==ve)return;i.parentElement.replaceWith(s)}}catch{a.push("D2 diagrams")}if(n.length)try{if(await dn(Cr),e!==ve)return;let r=Mr();n.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}echarts.init(i,r,{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!je},s))})}catch{a.push("charts")}e===ve&&(a.length&&(Ze.textContent="Could not load the "+a.join(" and ")+" renderer (offline?)"),d.forEach(At),nt(),oe(!0))}function Rr(){let e=[];return h.forEach(t=>{let n=et(t),o=e[e.length-1];o&&o.sec===n?o.ids.push(t):e.push({sec:n,ids:[t]})}),e}function Dr(){let n=0,o=0,a=0;Rr().forEach((r,i)=>{let s=Math.max(...r.ids.map(f=>d.get(f)._h));i&&(n+=a/2+120+s/2);let l=o,c=o;r.ids.forEach((f,N)=>{let M=d.get(f);N&&(l+=90+M._w/2),M.cx=l,M.cy=n,c=l,l+=M._w/2}),o=c,a=s})}function jr(){d.forEach(e=>{e.cx=0,e.cy=0})}function Xo(){ve++,window.echarts&&W.querySelectorAll(".echarts-container").forEach(n=>{let o=echarts.getInstanceByDom(n);o&&o.dispose()}),W.querySelectorAll("div.node").forEach(n=>n.remove());let e=Go(),t=0;d.forEach(n=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=n.id;let a=n.parent?Pt(n.id).slice(0,-1).map(i=>d.get(i).title).join(" / "):"";o.innerHTML=(a?'<div class="crumb">'+C(a)+"</div>":"")+'<div class="body">'+n.html+"</div>"+(n.err?'<div class="err-badge">!</div>':"");let r=o.querySelector(".body");gr(r),xr(r),vr(o,r),r.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=Sr(r),n.frags=wr(r),r.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Er,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));d.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),u.active||P(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{u.active||P(n.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&P(n.id)}),W.appendChild(o),n.el=o,wn(n,n.frags.length)}),t&&!Ze.textContent&&(Ze.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),d.forEach(At),nt(e),Pr()}function nt(e){e===void 0&&(e=Go()),A==="radial"?fr(e):A==="path"?Dr():A==="focus"?jr():mr(),W.classList.toggle("focus",A==="focus"),d.forEach(t=>{let n=t.el.style;n.setProperty("--cx",t.cx),n.setProperty("--cy",t.cy)}),_r(),_e(),Ln()}function _r(){let e="";if(A==="focus"){Qt.innerHTML="";return}if(A==="path"){for(let t=1;t<h.length;t++){let n=d.get(h[t-1]),o=d.get(h[t]);e+='<path data-from="'+n.id+'" data-to="'+o.id+'" d="M '+n.cx+" "+n.cy+" L "+o.cx+" "+o.cy+'"/>'}Qt.innerHTML=e;return}d.forEach(t=>{if(!t.parent)return;let n=d.get(t.parent);if(A==="radial")e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+n.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=n.cy+n._h/2,a=t.cy-t._h/2,r=o+(a-o)/2;e+='<path data-from="'+n.id+'" data-to="'+t.id+'" d="M '+n.cx+" "+o+" L "+n.cx+" "+r+" L "+t.cx+" "+r+" L "+t.cx+" "+a+'"/>'}}),Qt.innerHTML=e}function Pt(e){let t=[],n=e;for(;n;)t.unshift(n),n=d.get(n).parent;return t}function Pe(){let e=T.clientWidth,t=T.clientHeight;W.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+E.zoom+") translate("+-E.x+"px,"+-E.y+"px)",aa()}function kn(){Xe&&(Xe.kill(),Xe=null)}function Jo(e,t){if(kn(),t||je||!window.gsap){Object.assign(E,e),Pe();return}let n=T.clientWidth,o=Math.hypot(e.x-E.x,e.y-E.y),a=e.zoom,r=gsap.timeline({onUpdate:Pe,onComplete:()=>{Xe=null}}),{zoom:i,...s}=e,l=o*Math.min(E.zoom,a),c=Math.max(.55,Math.min(1.3,.55+l/n*.3));if(r.to(E,{...s,duration:c,ease:"power2.inOut"},0),l>n*1.2){let f=Math.max(.06,Math.min(E.zoom,a,n*.9/(o+Ie)));r.to(E,{zoom:f,duration:c/2,ease:"sine.out"},0).to(E,{zoom:a,duration:c/2,ease:"sine.in"},c/2)}else r.to(E,{zoom:a,duration:c,ease:"power2.inOut"},0);Xe=r}function Nr(){let e=T.getBoundingClientRect(),t=14,n=[];if(!de.hidden&&de.offsetWidth){let a=de.getBoundingClientRect();n.push({x0:a.left-e.left-t,y0:a.top-e.top-t,x1:a.right-e.left+t,y1:a.bottom-e.top+t})}let o=pr();return o&&n.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),n}function Fr(){let e=T.clientWidth,t=T.clientHeight,n=[{x0:16,y0:R?20:56,x1:e-16,y1:t-(R?20:74)}];return Nr().forEach(o=>{let a=[];n.forEach(r=>{if(o.x1<=r.x0||o.x0>=r.x1||o.y1<=r.y0||o.y0>=r.y1){a.push(r);return}[{...r,x1:Math.min(r.x1,o.x0)},{...r,x0:Math.max(r.x0,o.x1)},{...r,y1:Math.min(r.y1,o.y0)},{...r,y0:Math.max(r.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&a.push(i)})}),a.length&&(n=a)}),n}function pn(e,t,n){let o=T.clientWidth,a=T.clientHeight,r=null;return Fr().forEach(i=>{let s=n*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!r||s>r.zoom)&&(r={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-a/2})}),r}function Zo(e,t,n,o){return{x:e-n.sx/o,y:t-n.sy/o}}function Le(e,t){let n=d.get(e);if(!n)return;let o=pn(n._w,n._h,Qe),a=et(e),r=h.filter(l=>et(l)===a&&!d.get(l).visual).map(l=>{let c=d.get(l);return pn(c._w,c._h,Qe).zoom}).sort((l,c)=>l-c),i=r.length?r[Math.floor((r.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));Jo(Object.assign(Zo(n.cx,n.cy,o,s),{zoom:s}),t)}function ot(e){let t=[...d.values()];if(!t.length)return;let n=T.clientWidth,o=T.clientHeight,a=Math.min(...t.map(f=>f.cx-f._w/2)),r=Math.max(...t.map(f=>f.cx+f._w/2)),i=Math.min(...t.map(f=>f.cy-f._h/2)),s=Math.max(...t.map(f=>f.cy+f._h/2)),l=pn(r-a,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));Jo(Object.assign(Zo((a+r)/2,(i+s)/2,l,c),{zoom:c}),e)}function oe(e){p&&d.has(p)?Le(p,e):ot(e)}function _e(){let e=p?Pt(p):[];d.forEach(t=>{let n=t.el;n.classList.toggle("current",t.id===p),n.classList.toggle("active-path",e.includes(t.id))}),W.querySelectorAll("#connectors path").forEach(t=>{let n=A==="path"?!!p&&h.indexOf(t.dataset.to)<=h.indexOf(p):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",n)}),qr(e),ea()}function Qo(){return Vn(new URLSearchParams(location.search).get("duration")??x.duration)}function Hr(){return R&&Qo()>0&&(!u.active||/^always$/i.test(x.timer||""))}function kt(){let e=Hr()&&ue.start>0;if(we.classList.toggle("timed",e),!e){we.classList.remove("over");return}let n=(u.active&&u.t0?Ct():performance.now()-ue.start)/Qo();we.firstChild.style.width=Math.min(100,n*100)+"%",we.classList.toggle("over",n>=1)}function Wr(){ue.start=performance.now(),clearInterval(ue.timer),ue.timer=setInterval(kt,1e3),kt()}function Ur(){clearInterval(ue.timer),ue.timer=null,ue.start=0,kt()}function ea(){let e=R&&h.length>1&&!/^(off|no|false)$/i.test(x.progress||"");if(we.classList.toggle("show",e),!e)return;kt();let t=h.indexOf(p),n=0,o=0;h.forEach((a,r)=>{let i=Ce(d.get(a)).length;n+=i,r<t?o+=i:r===t&&(o+=Math.min(ne,i-1)+1)}),we.lastChild.style.width=(n?o/n*100:0)+"%"}function qr(e){ko.innerHTML=e.map((t,n)=>(n>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===p?" here":"")+'" data-id="'+C(t)+'">'+C(d.get(t).title)+"</button>").join(""),ko.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{u.active||P(t.dataset.id)}))}function at(e){let t=d.get(p);t&&(wn(t,$o().frag,e),xn(),(z.hidden||!Ae||!Ae.full)&&Gr(t),En(t))}function Yr(e){return!h.length||e.id!==h[0]&&e.id!==h[h.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function Gr(e){if(e._played||!window.gsap||je)return;e._played=!0;let t=Yr(e);if(t&&t.length){e._auto=t;let[n,...o]=t;/^H[1-3]$/.test(n.tagName)&&!n.children.length?(n.classList.add("auto-scramble"),Mo(n)):o.unshift(n),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(n=>{let o;try{o=JSON.parse(n.dataset.gsap)}catch{return}let a={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(n,o.from||{},Object.assign({},o.to,a)):o.from&&gsap.from(n,Object.assign({},o.from,a))}),e.el.querySelectorAll(".title-scramble").forEach(Mo)}function Sn(e){!e||!e._played||(e._played=!1,window.gsap&&(e._auto&&(e._auto.forEach(t=>{gsap.killTweensOf(t),gsap.set(t,{clearProps:"opacity,transform"})}),e._auto=null),e.el.querySelectorAll("[data-gsap]").forEach(t=>{gsap.killTweensOf(t);let n={};try{n=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},n.from,n.to)).map(a=>$r.includes(a)?"transform":a));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble, .auto-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function Mo(e){let t=e.dataset.text||(e.dataset.text=e.textContent),n=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",a={p:0};e._scramble=gsap.to(a,{p:1,duration:1.4,ease:"none",onUpdate(){let r=Math.floor(a.p*n.length);e.textContent=n.map((i,s)=>s<r||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function En(e){clearTimeout(Re),!(!R||!e||!e.autoslide||u.active&&(!u.t0||u.paused))&&(Re=setTimeout(()=>{p===e.id&&De(1)},e.autoslide))}function ta(e){let t=e&&e!==h[0]?e:"";try{y&&y.kind==="share"?history.replaceState(null,"",location.pathname+location.search+Xt(y.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function P(e,t,n){if(!d.has(e))return;if(e!==p){J=null,pe=-1,ne=n?Ce(d.get(e)).length-1:0;let r=d.get(p);r&&A==="focus"&&!t&&(r.el.classList.add("leaving"),setTimeout(()=>r.el.classList.remove("leaving"),600)),na()}let o=e!==p;if(p=e,clearTimeout(X),X=null,o&&A==="focus"&&!t&&!je){let r=d.get(e).el;r.classList.add("entering"),r.offsetWidth,r.classList.remove("entering")}at(o),o&&Bn("slide",e);let a=d.get(e);o&&a.mapFirst&&!n&&!t&&A!=="focus"?(ot(),X=setTimeout(()=>{X=null,p===e&&Le(e)},1900)):Le(e,t),_e(),Ln(),ta(e)}function na(){let e=d.get(p);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>Vo(t,"pauseVideo")),wn(e,e.frags.length,!0),Sn(e))}function Kr(){if(!p&&ke&&d.has(ke)){oa();return}p&&(ke=p),A==="focus"&&Se("path"),na(),clearTimeout(Re),p=null,_e(),Ln(),ot(),ta(null)}function oa(){if(X)return clearTimeout(X),X=null,Le(p),!0;if(!p&&ke&&d.has(ke)){let e=ke;return ke=null,P(e),!0}return!1}function De(e){if(!p){h.length&&P(h[e>0?0:h.length-1]);return}if(X&&e>0){clearTimeout(X),X=null,Le(p);return}let t=Ce(d.get(p)),n=Math.min(ne,t.length-1)+e;if(n>=0&&n<t.length){ne=n,J=null,pe=-1,at(),!U&&!z.hidden&&Ae.used?it():oe(),_e();return}let o=h.indexOf(p)+e;o>=0&&o<h.length&&P(h[o],!1,e<0)}function Vr(){let e=d.get(p);e&&e.parent&&P(e.parent)}function Xr(){let e=d.get(p);e&&e.children.length?P(e.children[0]):!p&&h.length&&P(h[0])}function Ln(){let e=[...d.values()];if(!e.length){sn.innerHTML="",ie=null;return}Va.textContent="map";let t=g=>g.cx,n=g=>g.cy,o=Math.min(...e.map(t))-Ie/2,a=Math.max(...e.map(t))+Ie/2,r=Math.min(...e.map(n))-ln/2,i=Math.max(...e.map(n))+ln/2,s=16,l=180,c=130,f=Math.min((l-2*s)/Math.max(1,a-o),(c-2*s-6)/Math.max(1,i-r)),N=l/2-(o+a)/2*f,M=c/2+5-(r+i)/2*f,b=p?Pt(p):[],S="";e.forEach(g=>{if(!g.parent)return;let B=d.get(g.parent);S+='<line x1="'+(t(B)*f+N)+'" y1="'+(n(B)*f+M)+'" x2="'+(t(g)*f+N)+'" y2="'+(n(g)*f+M)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(g=>{let B=g.id===p?"var(--accent)":b.includes(g.id)?"var(--accent-teal)":"var(--node-border)";S+='<circle data-id="'+C(g.id)+'" cx="'+(t(g)*f+N)+'" cy="'+(n(g)*f+M)+'" r="'+(g.id===p?4:3)+'" fill="'+B+'"><title>'+C(g.title)+"</title></circle>"}),S+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',sn.innerHTML=S,ie={s:f,ox:N,oy:M},aa()}function aa(){let e=document.getElementById("mm-viewport");if(!e||!ie)return;let t=T.clientWidth/E.zoom,n=T.clientHeight/E.zoom;e.setAttribute("x",(E.x-t/2)*ie.s+ie.ox),e.setAttribute("y",(E.y-n/2)*ie.s+ie.oy),e.setAttribute("width",Math.max(2,t*ie.s)),e.setAttribute("height",Math.max(2,n*ie.s))}function Rt(e){Yo(Q.value),p&&!d.has(p)&&(p=null),Xo(),p?P(p,e):h.length?P(h[0],e):(p=null,ot(!0))}function Se(e,t){A=e,te("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(n=>n.classList.toggle("active",n.dataset.mode===e)),d.size&&(!t&&!je&&(W.classList.add("morph"),setTimeout(()=>W.classList.remove("morph"),700)),nt(),Pe(),p?Le(p,t):ot(t))}function ra(e){return Math.max(.04,Math.min(5,e))}function Jr(e){Qe=Math.round(Math.max(tr,Math.min(nr,e))*100)/100,te("slidetake:slideSize",Qe),p&&Le(p)}function Bo(e){p?Jr(Qe+e*.1):ia(e>0?1.2:1/1.2)}function ia(e,t,n){kn();let o=ra(E.zoom*e);if(t!==void 0){let a=T.getBoundingClientRect(),r=t-a.left-a.width/2,i=n-a.top-a.height/2;E.x+=r/E.zoom-r/o,E.y+=i/E.zoom-i/o}E.zoom=o,Pe()}function Dt(){O||(fe.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!fe.classList.contains("collapsed")))}function ge(e){R=e,document.body.classList.toggle("presenting",e),Sa();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!p&&h.length&&P(h[0]);let n=x.camera||[...d.values()].some(o=>o.camera);e&&n&&!U&&!q&&it(),e?En(d.get(p)):clearTimeout(Re),e?Wr():Ur(),ea()}function Ct(){return(u.paused?u.pauseAt:performance.now())-u.t0-u.pausedMs}function jt(e){e.classList.add("open")}function Mn(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function ti(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,n,...o]=e.split(":");return St.value=t||"localhost",Et.value=n||"4455",Lt.value=o.join(":"),!0}try{let t=JSON.parse(ee("slidetake:obs")||"null");t&&(St.value=t.host||"localhost",Et.value=t.port||"4455",Lt.value=t.password||"",Cn.checked=!0)}catch{}return!1}function ca(){if(Cn.checked)te("slidetake:obs",JSON.stringify({host:St.value.trim(),port:Et.value.trim(),password:Lt.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function Ye(e,t){Ro.textContent=e,Ro.className=t||""}function oi(e){return location.protocol==="https:"&&!ni(e)}async function da(){let e=St.value.trim()||"localhost",t="ws://"+e+":"+(Et.value.trim()||"4455");if(oi(e)){xe=!1,Je.disabled=!0,Ye(ai,"err");return}Ye("Connecting to "+t+"\u2026");try{await dn(Zr);let n=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(H)try{await H.disconnect()}catch{}H=new n,H.on("ConnectionClosed",()=>{xe=!1,Ye("Disconnected from OBS","err"),Je.disabled=!0}),H.on("RecordStateChanged",a=>{a.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ee&&(Ee(),Ee=null),a.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&u.active&&u.withObs&&!u.finishing&&_t("Stopped in OBS")});let o=await H.connect(t,Lt.value||void 0);xe=!0;try{let a=await H.call("GetVideoSettings");a&&a.fpsNumerator&&a.fpsDenominator&&(sa=a.fpsNumerator/a.fpsDenominator)}catch{}Ye("Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),"ok"),ca()}catch(n){xe=!1,Ye("Could not connect ("+(n&&n.message||n)+"). Is OBS running with its WebSocket server on, and is the password right?","err")}Je.disabled=!xe}function ri(){let e=document.getElementById("rec-screen"),t=screen.width,n=screen.height;if(Math.abs(t/n-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+n+"), right for YouTube.</span>";return}let o=[["16:10",1.6],["3:2",1.5],["4:3",4/3],["21:9",21/9],["16:9",16/9]],[a,r]=o.reduce((s,l)=>Math.abs(l[1]-t/n)<Math.abs(s[1]-t/n)?l:s),i=Math.abs(r-t/n)<.005?a:"about "+a;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+n+"), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>"}function hn(){if(!tt)return;let e=h.reduce((n,o)=>n+Ce(d.get(o)).length,0),t=x.camera||[...d.values()].some(n=>n.camera);document.getElementById("rec-deck-info").innerHTML=C(x.title||(le[0]?d.get(le[0]).title:"This deck"))+" \xB7 "+h.length+" slides \xB7 "+e+" presses"+(t&&q?'<br><span class="warn">The camera is off. Press C first if this take should include your webcam.</span>':""),Je.disabled=!xe,di(),ri(),jt(Qr)}async function pa(e){if(u.active||!h.length)return;Mn(),Object.assign(u,{active:!0,withObs:e,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null}),document.body.classList.add("recording"),wa();let t=document.getElementById("rec-layout").value;t!=="current"&&t!==A&&Se(t,!0),R||ge(!0),p===h[0]&&(ne=0,J=null,pe=-1),P(h[0],!0);for(let o=3;o>0;o--)if(yt.querySelector(".num").textContent=o,yt.classList.add("show"),await Tn(1e3),!u.active)return;if(yt.classList.remove("show"),await la(),e){let o=new Promise(a=>{Ee=a,setTimeout(()=>{Ee&&(Ee(),Ee=null)},2500)});try{await H.call("StartRecord")}catch(a){On("OBS could not start recording: "+(a&&a.message||a));return}if(await o,!u.active)return}u.counting=!1,u.t0=performance.now();let n=d.get(p);Sn(n),at(!0),Bn("slide",p)}function On(e){u.active=!1,u.counting=!1,yt.classList.remove("show"),document.body.classList.remove("recording"),R&&ge(!1),Be(e)}function Bn(e,t){if(!u.active||!u.t0||u.finishing)return;let n=d.get(t),o={id:t,title:n?n.title:t,retake:e==="retake",t:Math.round(Ct()),obsT:null};u.events.push(o),u.withObs&&xe&&(H.call("GetRecordStatus").then(a=>{a&&typeof a.outputDuration=="number"&&(o.obsT=a.outputDuration)}).catch(()=>{}),n&&H.call("CreateRecordChapter",{chapterName:(o.retake?"RETAKE \xB7 ":"")+n.title}).catch(()=>{}))}function ii(e){let t=e.key;if((Io.includes(t)||Ao.includes(t)||Po.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){u.counting?On("Take cancelled"):_t("Stopped early");return}if(!(u.counting||u.finishing)){if(Po.includes(t)){ci();return}u.paused||(Io.includes(t)?si():Ao.includes(t)&&li())}}function si(){let e=Ce(d.get(p));Math.min(ne,e.length-1)>=e.length-1&&h.indexOf(p)===h.length-1?_t():De(1)}function li(){let e=d.get(p);e&&(Bn("retake",p),ne=0,J=null,pe=-1,Sn(e),at(!0),!U&&!z.hidden&&Ae.used?it():oe(),_e())}async function ci(){u.t0&&(u.paused?(un.classList.remove("show"),await la(),u.withObs&&await H.call("ResumeRecord").catch(()=>{}),u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,En(d.get(p))):(u.paused=!0,u.pauseAt=performance.now(),clearTimeout(Re),u.withObs&&await H.call("PauseRecord").catch(()=>{}),un.classList.add("show")))}async function _t(e){if(!u.active||u.finishing)return;if(u.counting){On("Take cancelled");return}u.finishing=!0,clearTimeout(Re),u.paused&&(u.pausedMs+=performance.now()-u.pauseAt,u.paused=!1,un.classList.remove("show"));let t=Math.round(Ct()),n=null;if(u.withObs){await Tn(1200),t=Math.round(Ct());try{let a=await H.call("GetRecordStatus");a&&typeof a.outputDuration=="number"&&(n=a.outputDuration)}catch{}try{let a=await H.call("StopRecord");u.outputPath=a&&a.outputPath}catch(a){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(a&&a.message||a)+")"}}u.active=!1,u.finishing=!1,document.body.classList.remove("recording"),R&&ge(!1);let o={key:Nt(),deckTitle:x.title||d.get(h[0]).title,date:new Date().toISOString(),withObs:u.withObs,outputPath:u.outputPath,reason:e||"",total:t,totalObs:n,fps:sa,events:u.events.map(a=>({id:a.id,title:a.title,retake:a.retake,t:a.t,obsT:a.obsT})),picks:{}};zn(o),ya(o)}function Nt(){return Te(x.title||(h[0]?d.get(h[0]).title:"deck"))}function ua(){try{return JSON.parse(ee("slidetake:sessions")||"[]")}catch{return[]}}function zn(e){let t=ua().filter(n=>n.date!==e.date);t.unshift(e),te("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function di(){let e=document.getElementById("rec-sessions"),t=ua().filter(n=>n.key===Nt());e.innerHTML=t.length?"<h3>Earlier takes of this deck</h3>"+t.map((n,o)=>'<div class="row"><button class="btn small" data-session="'+o+'">Review</button><span>'+C(new Date(n.date).toLocaleString())+" \xB7 "+K(n.totalObs??n.total)+(n.withObs?"":" \xB7 rehearsal")+(n.outputPath?" \xB7 "+C(Me(n.outputPath)):"")+"</span></div>").join(""):"",e.querySelectorAll("[data-session]").forEach(n=>n.onclick=()=>{Mn(),ya(t[+n.dataset.session])})}function et(e){let t=d.has(e)?Pt(e):[e];return t[Math.min(1,t.length-1)]}function ha(e,t){let n=et(e);return{sec:n,title:d.has(n)?d.get(n).title:t}}function ga(){let e=Object.keys(x).filter(t=>t==="tags"||/_tags$/.test(t)).flatMap(t=>[].concat(x[t])).filter(t=>typeof t=="string");return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function pi(){return[].concat(x.related||[]).map(e=>{let t=String(e).match(/^\[([^\]]+)\]\(([^)]+)\)$/),n=String(e).split("|");return t?t[1]+": "+t[2]:n.length===2?n[0].trim()+": "+n[1].trim():String(e)})}function ui(){if(x.permalink||x.url)return x.permalink||x.url;let e=x.site||ee("slidetake:site");if(!e||!Z)return"";try{let t=new URL(Z).pathname.replace(/\/index\.md$/i,"/").replace(/\.md$/i,"/");return new URL(t,e).href}catch{return""}}function ba(e){let t=ma(e),n=document.getElementById("rv-link").value.trim(),o=pi(),a=ga(),r=[];x.summary&&r.push(x.summary),n&&r.push("\u{1F4D1} Slides: "+n),t.lines.length>=3&&r.push(`Chapters
|
|
620
620
|
`+t.lines.join(`
|
|
621
621
|
`)),o.length&&r.push(`Related
|
|
622
622
|
`+o.map(i=>"\u2022 "+i).join(`
|
|
623
623
|
`)),a.length&&r.push(a.slice(0,3).map(i=>"#"+i.replace(/[^\p{L}\p{N}]+/gu,"")).join(" ")),document.getElementById("rv-yt-desc").value=r.join(`
|
|
624
624
|
|
|
625
|
-
`),document.getElementById("rv-chapters-note").textContent=(t.dropped?t.dropped+" section"+(t.dropped>1?"s were":" was")+" under 10 seconds and folded into the chapter before, as YouTube requires. ":"")+(t.lines.length<3?"YouTube needs at least three chapters, so none are listed. ":"")+"Final length "+K(t.length)+"."}function ya(e){_=e,H=null;let t=qe(e),n=e.events.filter(a=>a.retake).length;document.getElementById("rv-title").textContent=(e.withObs?"Review the take \xB7 ":"Rehearsal \xB7 ")+e.deckTitle,document.getElementById("rv-info").textContent=[e.reason,new Date(e.date).toLocaleString(),(e.withObs?"recorded ":"ran ")+K(e.totalObs??e.total),t.size+" slides",n?n+" retake"+(n>1?"s":""):"no retakes",e.outputPath?"saved to "+e.outputPath:e.withObs?"":"nothing was recorded"].filter(Boolean).join(" \xB7 "),document.getElementById("rv-file").textContent=e.outputPath?" ("+Me(e.outputPath)+")":"",document.getElementById("rv-yt-title").value=e.deckTitle;let o=ft(e);Tt.value=[...Tt.options].reduce((a,r)=>Math.abs(r.value-o)<Math.abs(a.value-o)?r:a).value,document.getElementById("rv-yt-tags").value=ga().join(", "),document.getElementById("rv-link").value=ui(),z.src&&he!==Me(e.outputPath)&&e.outputPath&&(z.removeAttribute("src"),z.load(),he=""),document.getElementById("rv-novideo").hidden=!!z.src,Ht(),jt(ei),gi(e)}function Ht(){let e=_,t=document.getElementById("rv-list"),n=null;t.innerHTML=[...qe(e).values()].map(o=>{let a=e.picks[o.id]??o.takes.length,r=et(o.id),i=r!==n;n=r;let s=o.takes.map(l=>'<button class="rv-chip'+(a===l.no?" on":"")+'" data-id="'+C(o.id)+'" data-take="'+l.no+'">'+(o.takes.length>1?"Take "+l.no+" \xB7 ":"")+K(l.end-l.start)+"</button>").join("")+'<button class="rv-chip skip'+(a===0?" on":"")+'" data-id="'+C(o.id)+'" data-take="0">Leave out</button>';return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+C(o.title)+"<small>"+K(o.takes[0].start)+'</small></div><div class="rv-chips">'+s+"</div></div>"}).join(""),t.querySelectorAll(".rv-chip").forEach(o=>o.onclick=()=>{e.picks[o.dataset.id]=+o.dataset.take,In(e),Ht();let a=qe(e).get(o.dataset.id),r=a&&a.takes[+o.dataset.take-1];r&&Ot([{start:r.start,end:r.end,title:a.title+(a.takes.length>1?" \xB7 take "+r.no:"")}])}),document.getElementById("rv-ffmpeg").value=fa(e,document.getElementById("rv-mode").value),ba(e)}function Ot(e){if(!z.src){Mt=e,$.textContent=fn?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.";return}Mt=null,H={ranges:e,i:0},$.textContent="\u25B6 "+e[0].title;let t=()=>{z.currentTime=e[0].start/1e3,z.play().catch(n=>{n&&n.name!=="AbortError"&&($.textContent="Could not play: "+n.message)})};z.readyState>=1?t():z.addEventListener("loadedmetadata",t,{once:!0})}function va(e){return new Promise((t,n)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>n(o.error)})}async function hi(e){let t=async n=>{let o=await va(n);return await new Promise(a=>{let r=o.transaction("kv").objectStore("kv").get(e);r.onsuccess=()=>a(r.result),r.onerror=()=>a(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function mi(e,t){try{(await va()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function Ft(e){fn=!0;try{return await fi(e)}finally{fn=!1}}async function fi(e){let t=await e.getFile();for(let n=0;n<10;n++){await new Promise(a=>setTimeout(a,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function rt(e,t,n){z.src&&URL.revokeObjectURL(z.src),Ke=t||null,n||(mn=0),z.src=URL.createObjectURL(e),he=e.name,document.getElementById("rv-novideo").hidden=!0,$.textContent="Loaded "+e.name+". Click a take to preview it.",Mt?Ot(Mt):n&&H&&Ot(H.ranges.slice(H.i)),_&&(document.getElementById("rv-ffmpeg").value=fa(_,document.getElementById("rv-mode").value))}async function gi(e){let t=Me(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(he===t&&z.src))try{let n=await hi("obs-folder");if(!n||await n.queryPermission({mode:"read"})!=="granted")return;let o=await n.getFileHandle(t);$.textContent="Opening "+t+"\u2026",rt(await Ft(o),o)}catch{}}function Be(e,t){u.active||(vt.textContent=e,vt.classList.add("show"),clearTimeout(gn),t||(gn=setTimeout(()=>vt.classList.remove("show"),9e3)))}function wa(){clearTimeout(gn),vt.classList.remove("show")}function rn(){let e=!1;try{e=window.top!==window.self}catch{e=!0}return e?" This page is running inside a preview frame that may not allow cameras. Open Slidetake directly in Chrome (from localhost or as a file).":window.isSecureContext?" Allow camera access for this page in the browser\u2019s site settings (the icon at the left of the address bar), then try again.":" Browsers only allow cameras on secure pages. Open it from http://localhost or as a local file in Chrome."}function ka(){U&&U.getTracks().forEach(t=>t.stop()),U=null;let e=I.querySelector("video");e&&e.remove()}async function it(){if(!(U||q)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Be("Camera not available on this page."+rn());return}if(se.disabled)return;se.disabled=!0,Be("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{U=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),wa()}catch(t){let n=t&&t.name;Be(n==="NotAllowedError"||n==="SecurityError"?"Camera access was blocked."+rn():n==="NotFoundError"||n==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":n==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(n?" ("+n+")":"")+"."+rn());return}finally{se.disabled=!1,zn()}U.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{ka(),wt(),oe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=U,I.appendChild(e)}wt(),oe()}}function zn(){se.querySelector("svg")||(se.innerHTML=bi+'<span class="lbl"> Camera</span>'),se.classList.toggle("on",!q),se.setAttribute("aria-pressed",String(!q)),se.title=q?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function An(e){e&&!tt||(q=!e,q&&ka(),J=null,pe=-1,ne=Math.min(ne,Math.max(0,Ce(d.get(p)).length-1)),zn(),wt(),at(),_e(),oe(),R||Be(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&it())}function Sa(){document.body.classList.remove("idle"),clearTimeout(Do),R&&(Do=setTimeout(()=>document.body.classList.add("idle"),2e3))}function Bt(e,t){Ie.textContent=e,Ie.classList.add("show"),clearTimeout(_o),_o=setTimeout(()=>Ie.classList.remove("show"),t||2500)}function bn(e,{keepObs:t=!0,keepEdit:n=!0,slide:o=""}={}){let a=new URL(ro(e),location.origin);return new URLSearchParams(location.search).forEach((r,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!n||a.searchParams.set(i,r)}),o&&(a.hash=o),a.href.replace(a.pathname,a.pathname.replace(/%40/g,"@"))}async function vi(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(y.kind==="source")return{link:bn(y.source,t),inside:!1};if(y.kind==="copy"&&ht(k)&&["url","gist","builtin"].includes(k.origin.kind))return{link:bn(k.origin,t),inside:!1};let o=y.kind==="share"?y.data:await so(Q.value),a=new URLSearchParams(location.search);return["src","obs","edit"].forEach(r=>a.delete(r)),{link:location.origin+"/share"+(a.toString()?"?"+a:"")+Xt(o,e),inside:!0}}function xi(){let e=ee("slidetake:draft");if(!e||e===Wt)return null;let t=pt(e,{kind:"file",name:"your earlier draft"},{exported:!0});te("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function st(){te("slidetake:copy",JSON.stringify(k))}function Ne(){if(T)return;let e;if(y.kind==="copy")e='<span class="mine">Your copy of '+C(re(k.origin))+"</span>"+(ut(k)?' <span class="edited">\xB7 edited</span>':"");else{let n=y.kind==="share"?"a shared deck":re(y.source);e='<span class="mine">'+C(n.charAt(0).toUpperCase()+n.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,fe.classList.toggle("unsaved",y.kind==="copy"&&ut(k)),document.getElementById("btn-reset").hidden=!(y.kind==="copy"&&!ht(k));let t=document.getElementById("continue");t.hidden=y.kind==="copy"||!k,k&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+re(k.origin))}function Ea(e){return!k||!ut(k)?!0:confirm("Your copy of "+re(k.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function La(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function wi(){let e=y.kind==="share"?{kind:"shared"}:y.source;return Ea("a copy of "+re(e))?(k=pt(y.text,e),y={kind:"copy"},history.pushState(null,"",La()+(p&&p!==h[0]?"#"+encodeURIComponent(p):"")),Bt("Editing your own copy of "+re(e)+". The original is unchanged.",4e3),!0):(Q.value=y.text,!1)}function ki(){y={kind:"copy"},history.pushState(null,"",La()),fe.classList.contains("collapsed")&&Dt(),Q.value=k.text,Rt(!0),Ne()}async function Si(e){if(e.kind==="builtin")return xt[e.id]??xt.home;if(e.kind==="gist"){let n=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!n.ok)throw new Error(n.status===404?"no such gist":n.status+" "+n.statusText);let o=Object.values((await n.json()).files||{}),a=o.find(r=>r.filename===e.file)||o.find(r=>/\.(md|markdown)$/i.test(r.filename))||o[0];if(!a)throw new Error("the gist has no files");return Z=a.raw_url,a.truncated?await(await fetch(a.raw_url)).text():a.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return Z=new URL(e.url,location.href).href,await t.text()}function Fo(){return y={kind:"source",source:{kind:"builtin",id:"home"},text:xt.home},y.text}async function Ei(){if(T)return Z=T.base||location.href,y={kind:"source",source:{kind:"url",url:Z},text:Zn(T.settings||{})+String(T.markdown||"")},y.text;if(Y.page==="edit"){if(k)return y={kind:"copy"},k.text;history.replaceState(null,"","/new"+location.search),Y.page="pick"}if(Y.page==="pick")return jt(document.getElementById("new-dialog")),y={kind:"source",source:{kind:"builtin",id:"template:blank"},text:xt["template:blank"]},y.text;if(Y.page==="share")try{let e=await lo(Y.data);return y={kind:"share",data:Y.data,text:e},e}catch{return Bt("This link's deck is damaged or cut short, so it could not be opened.",6e3),Fo()}try{let e=await Si(Y.source);return y={kind:"source",source:Y.source,text:e},e}catch(e){return Ze.textContent="Could not load the deck ("+e.message+")",Bt("Could not load "+re(Y.source)+": "+e.message,6e3),Fo()}}var T,Wo,tt,je,xt,Q,M,W,Qt,ko,Ka,Ze,sn,Va,fe,gt,Xa,ze,en,V,ln,Ja,Za,Qa,er,tr,nr,Qe,d,h,le,p,A,R,x,q,U,de,I,or,E,Xe,So,ye,Eo,ne,J,pe,Ae,yr,Z,Co,Lr,Cr,Tr,To,Br,bt,Ir,Ar,nn,ve,on,we,ue,$r,Re,X,ke,ie,Oo,an,Oe,Io,Zr,zo,Ao,Po,Qr,ei,yt,un,St,Et,Lt,Cn,Ro,Je,F,xe,Ee,sa,u,Tn,la,ni,ai,he,ma,fa,_,H,z,$,Tt,Mt,Ke,mn,fn,Ve,xa,se,vt,gn,bi,Do,me,jo,Ie,_o,yi,yn,vn,No,It,Y,Ho,y,k,Ca=j(()=>{"use strict";jn();_n();Hn();Wn();qn();Yn();lt();eo();oo();Kt();Jt();uo();fo();wo();T=window.SLIDETAKE||null,Wo=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!T);tt=!T||T.recording===!0||new URLSearchParams(location.search).has("obs");document.documentElement.classList.toggle("no-record",!tt);je=window.matchMedia("(prefers-reduced-motion: reduce)").matches,xt={home:Wt,help:Nn,showcase:Gn,"template:blank":Fn,"template:talk":Un,"template:recording":$n},Q=document.getElementById("editor"),M=document.getElementById("stage"),W=document.getElementById("world"),Qt=document.getElementById("connectors"),ko=document.getElementById("breadcrumbs"),Ka=document.getElementById("status-count"),Ze=document.getElementById("status-err"),sn=document.getElementById("mm-svg"),Va=document.getElementById("mm-label"),fe=document.getElementById("editor-pane"),gt=540,Xa=96,ze=440,en=720,V=960,ln=180,Ja=540,Za=100,Qa=110,er=420,tr=.35,nr=1,Qe=parseFloat(ee("slidetake:slideSize"))||.92,d=new Map,h=[],le=[],p=null,A="tree",R=!1,x={},q=!0,U=null,de=document.getElementById("brand"),I=document.getElementById("pip"),or=document.getElementById("stage-wrap"),E={x:0,y:0,zoom:.6},Xe=null;So={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};ye=null;Eo=new URLSearchParams(location.search).get("mode");ne=0;J=null,pe=-1,Ae=null;yr=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));Z=null;Co=null;Lr="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Cr="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Tr={dark:{palette:["#60a5fa","#f472b6","#a78bfa","#fb923c","#facc15","#a1a1aa"],text:"#e4e4e7",muted:"#a1a1aa",line:"#3f3f46",split:"#27272a",tip:"#18181b"},light:{palette:["#2563eb","#db2777","#7c3aed","#ea580c","#ca8a04","#71717a"],text:"#27272a",muted:"#71717a",line:"#d4d4d8",split:"#e4e4e7",tip:"#ffffff"}};To=new Set;Br="https://esm.sh/@terrastruct/d2@0.1.33",bt=null,Ir={dark:{N1:"#e4e4e7",N2:"#a1a1aa",N3:"#a1a1aa",N4:"#323238",N5:"#27272a",N6:"#18181b",N7:"#09090b"},light:{N1:"#27272a",N2:"#71717a",N3:"#71717a",N4:"#e4e4e7",N5:"#e4e4e7",N6:"#f4f4f5",N7:"#ffffff"}};Ar=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
625
|
+
`),document.getElementById("rv-chapters-note").textContent=(t.dropped?t.dropped+" section"+(t.dropped>1?"s were":" was")+" under 10 seconds and folded into the chapter before, as YouTube requires. ":"")+(t.lines.length<3?"YouTube needs at least three chapters, so none are listed. ":"")+"Final length "+K(t.length)+"."}function ya(e){_=e,F=null;let t=qe(e),n=e.events.filter(a=>a.retake).length;document.getElementById("rv-title").textContent=(e.withObs?"Review the take \xB7 ":"Rehearsal \xB7 ")+e.deckTitle,document.getElementById("rv-info").textContent=[e.reason,new Date(e.date).toLocaleString(),(e.withObs?"recorded ":"ran ")+K(e.totalObs??e.total),t.size+" slides",n?n+" retake"+(n>1?"s":""):"no retakes",e.outputPath?"saved to "+e.outputPath:e.withObs?"":"nothing was recorded"].filter(Boolean).join(" \xB7 "),document.getElementById("rv-file").textContent=e.outputPath?" ("+Me(e.outputPath)+")":"",document.getElementById("rv-yt-title").value=e.deckTitle;let o=ft(e);Tt.value=[...Tt.options].reduce((a,r)=>Math.abs(r.value-o)<Math.abs(a.value-o)?r:a).value,document.getElementById("rv-yt-tags").value=ga().join(", "),document.getElementById("rv-link").value=ui(),I.src&&he!==Me(e.outputPath)&&e.outputPath&&(I.removeAttribute("src"),I.load(),he=""),document.getElementById("rv-novideo").hidden=!!I.src,Ft(),jt(ei),gi(e)}function Ft(){let e=_,t=document.getElementById("rv-list"),n=null;t.innerHTML=[...qe(e).values()].map(o=>{let a=e.picks[o.id]??o.takes.length,r=et(o.id),i=r!==n;n=r;let s=o.takes.map(l=>'<button class="rv-chip'+(a===l.no?" on":"")+'" data-id="'+C(o.id)+'" data-take="'+l.no+'">'+(o.takes.length>1?"Take "+l.no+" \xB7 ":"")+K(l.end-l.start)+"</button>").join("")+'<button class="rv-chip skip'+(a===0?" on":"")+'" data-id="'+C(o.id)+'" data-take="0">Leave out</button>';return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+C(o.title)+"<small>"+K(o.takes[0].start)+'</small></div><div class="rv-chips">'+s+"</div></div>"}).join(""),t.querySelectorAll(".rv-chip").forEach(o=>o.onclick=()=>{e.picks[o.dataset.id]=+o.dataset.take,zn(e),Ft();let a=qe(e).get(o.dataset.id),r=a&&a.takes[+o.dataset.take-1];r&&Ot([{start:r.start,end:r.end,title:a.title+(a.takes.length>1?" \xB7 take "+r.no:"")}])}),document.getElementById("rv-ffmpeg").value=fa(e,document.getElementById("rv-mode").value),ba(e)}function Ot(e){if(!I.src){Mt=e,$.textContent=fn?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.";return}Mt=null,F={ranges:e,i:0},$.textContent="\u25B6 "+e[0].title;let t=()=>{I.currentTime=e[0].start/1e3,I.play().catch(n=>{n&&n.name!=="AbortError"&&($.textContent="Could not play: "+n.message)})};I.readyState>=1?t():I.addEventListener("loadedmetadata",t,{once:!0})}function va(e){return new Promise((t,n)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>n(o.error)})}async function hi(e){let t=async n=>{let o=await va(n);return await new Promise(a=>{let r=o.transaction("kv").objectStore("kv").get(e);r.onsuccess=()=>a(r.result),r.onerror=()=>a(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function mi(e,t){try{(await va()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function Ht(e){fn=!0;try{return await fi(e)}finally{fn=!1}}async function fi(e){let t=await e.getFile();for(let n=0;n<10;n++){await new Promise(a=>setTimeout(a,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function rt(e,t,n){I.src&&URL.revokeObjectURL(I.src),Ke=t||null,n||(mn=0),I.src=URL.createObjectURL(e),he=e.name,document.getElementById("rv-novideo").hidden=!0,$.textContent="Loaded "+e.name+". Click a take to preview it.",Mt?Ot(Mt):n&&F&&Ot(F.ranges.slice(F.i)),_&&(document.getElementById("rv-ffmpeg").value=fa(_,document.getElementById("rv-mode").value))}async function gi(e){let t=Me(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(he===t&&I.src))try{let n=await hi("obs-folder");if(!n||await n.queryPermission({mode:"read"})!=="granted")return;let o=await n.getFileHandle(t);$.textContent="Opening "+t+"\u2026",rt(await Ht(o),o)}catch{}}function Be(e,t){u.active||(vt.textContent=e,vt.classList.add("show"),clearTimeout(gn),t||(gn=setTimeout(()=>vt.classList.remove("show"),9e3)))}function wa(){clearTimeout(gn),vt.classList.remove("show")}function rn(){let e=!1;try{e=window.top!==window.self}catch{e=!0}return e?" This page is running inside a preview frame that may not allow cameras. Open Slidetake directly in Chrome (from localhost or as a file).":window.isSecureContext?" Allow camera access for this page in the browser\u2019s site settings (the icon at the left of the address bar), then try again.":" Browsers only allow cameras on secure pages. Open it from http://localhost or as a local file in Chrome."}function ka(){U&&U.getTracks().forEach(t=>t.stop()),U=null;let e=z.querySelector("video");e&&e.remove()}async function it(){if(!(U||q)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){Be("Camera not available on this page."+rn());return}if(se.disabled)return;se.disabled=!0,Be("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{U=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),wa()}catch(t){let n=t&&t.name;Be(n==="NotAllowedError"||n==="SecurityError"?"Camera access was blocked."+rn():n==="NotFoundError"||n==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":n==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(n?" ("+n+")":"")+"."+rn());return}finally{se.disabled=!1,In()}U.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{ka(),wt(),oe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=U,z.appendChild(e)}wt(),oe()}}function In(){se.querySelector("svg")||(se.innerHTML=bi+'<span class="lbl"> Camera</span>'),se.classList.toggle("on",!q),se.setAttribute("aria-pressed",String(!q)),se.title=q?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function An(e){e&&!tt||(q=!e,q&&ka(),J=null,pe=-1,ne=Math.min(ne,Math.max(0,Ce(d.get(p)).length-1)),In(),wt(),at(),_e(),oe(),R||Be(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&it())}function Sa(){document.body.classList.remove("idle"),clearTimeout(Do),R&&(Do=setTimeout(()=>document.body.classList.add("idle"),2e3))}function Bt(e,t){ze.textContent=e,ze.classList.add("show"),clearTimeout(_o),_o=setTimeout(()=>ze.classList.remove("show"),t||2500)}function bn(e,{keepObs:t=!0,keepEdit:n=!0,slide:o=""}={}){let a=new URL(ro(e),location.origin);return new URLSearchParams(location.search).forEach((r,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!n||a.searchParams.set(i,r)}),o&&(a.hash=o),a.href.replace(a.pathname,a.pathname.replace(/%40/g,"@"))}async function vi(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(y.kind==="source")return{link:bn(y.source,t),inside:!1};if(y.kind==="copy"&&ht(k)&&["url","gist","builtin"].includes(k.origin.kind))return{link:bn(k.origin,t),inside:!1};let o=y.kind==="share"?y.data:await so(Q.value),a=new URLSearchParams(location.search);return["src","obs","edit"].forEach(r=>a.delete(r)),{link:location.origin+"/share"+(a.toString()?"?"+a:"")+Xt(o,e),inside:!0}}function xi(){let e=ee("slidetake:draft");if(!e||e===Wt)return null;let t=pt(e,{kind:"file",name:"your earlier draft"},{exported:!0});te("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function st(){te("slidetake:copy",JSON.stringify(k))}function Ne(){if(O)return;let e;if(y.kind==="copy")e='<span class="mine">Your copy of '+C(re(k.origin))+"</span>"+(ut(k)?' <span class="edited">\xB7 edited</span>':"");else{let n=y.kind==="share"?"a shared deck":re(y.source);e='<span class="mine">'+C(n.charAt(0).toUpperCase()+n.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,fe.classList.toggle("unsaved",y.kind==="copy"&&ut(k)),document.getElementById("btn-reset").hidden=!(y.kind==="copy"&&!ht(k));let t=document.getElementById("continue");t.hidden=y.kind==="copy"||!k,k&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+re(k.origin))}function Ea(e){return!k||!ut(k)?!0:confirm("Your copy of "+re(k.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function La(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function wi(){let e=y.kind==="share"?{kind:"shared"}:y.source;return Ea("a copy of "+re(e))?(k=pt(y.text,e),y={kind:"copy"},history.pushState(null,"",La()+(p&&p!==h[0]?"#"+encodeURIComponent(p):"")),Bt("Editing your own copy of "+re(e)+". The original is unchanged.",4e3),!0):(Q.value=y.text,!1)}function ki(){y={kind:"copy"},history.pushState(null,"",La()),fe.classList.contains("collapsed")&&Dt(),Q.value=k.text,Rt(!0),Ne()}async function Si(e){if(e.kind==="builtin")return xt[e.id]??xt.home;if(e.kind==="gist"){let n=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!n.ok)throw new Error(n.status===404?"no such gist":n.status+" "+n.statusText);let o=Object.values((await n.json()).files||{}),a=o.find(r=>r.filename===e.file)||o.find(r=>/\.(md|markdown)$/i.test(r.filename))||o[0];if(!a)throw new Error("the gist has no files");return Z=a.raw_url,a.truncated?await(await fetch(a.raw_url)).text():a.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return Z=new URL(e.url,location.href).href,await t.text()}function Ho(){return y={kind:"source",source:{kind:"builtin",id:"home"},text:xt.home},y.text}async function Ei(){if(O)return Z=O.base||location.href,y={kind:"source",source:{kind:"url",url:Z},text:Zn(O.settings||{})+String(O.markdown||"")},y.text;if(Y.page==="edit"){if(k)return y={kind:"copy"},k.text;history.replaceState(null,"","/new"+location.search),Y.page="pick"}if(Y.page==="pick")return jt(document.getElementById("new-dialog")),y={kind:"source",source:{kind:"builtin",id:"template:blank"},text:xt["template:blank"]},y.text;if(Y.page==="share")try{let e=await lo(Y.data);return y={kind:"share",data:Y.data,text:e},e}catch{return Bt("This link's deck is damaged or cut short, so it could not be opened.",6e3),Ho()}try{let e=await Si(Y.source);return y={kind:"source",source:Y.source,text:e},e}catch(e){return Ze.textContent="Could not load the deck ("+e.message+")",Bt("Could not load "+re(Y.source)+": "+e.message,6e3),Ho()}}var O,Wo,tt,je,xt,Q,T,W,Qt,ko,Ka,Ze,sn,Va,fe,gt,Xa,Ie,en,V,ln,Ja,Za,Qa,er,tr,nr,Qe,d,h,le,p,A,R,x,q,U,de,z,or,E,Xe,So,ye,Eo,ne,J,pe,Ae,yr,Z,Co,Lr,Cr,Tr,To,Br,bt,zr,Ar,nn,ve,on,we,ue,$r,Re,X,ke,ie,Oo,an,Oe,zo,Zr,Io,Ao,Po,Qr,ei,yt,un,St,Et,Lt,Cn,Ro,Je,H,xe,Ee,sa,u,Tn,la,ni,ai,he,ma,fa,_,F,I,$,Tt,Mt,Ke,mn,fn,Ve,xa,se,vt,gn,bi,Do,me,jo,ze,_o,yi,yn,vn,No,zt,Y,Fo,y,k,Ca=j(()=>{"use strict";jn();_n();Fn();Wn();qn();Yn();lt();eo();oo();Kt();Jt();uo();fo();wo();O=window.SLIDETAKE||null,Wo=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!O);tt=!O||O.recording===!0||new URLSearchParams(location.search).has("obs");document.documentElement.classList.toggle("no-record",!tt);je=window.matchMedia("(prefers-reduced-motion: reduce)").matches,xt={home:Wt,help:Nn,showcase:Gn,"template:blank":Hn,"template:talk":Un,"template:recording":$n},Q=document.getElementById("editor"),T=document.getElementById("stage"),W=document.getElementById("world"),Qt=document.getElementById("connectors"),ko=document.getElementById("breadcrumbs"),Ka=document.getElementById("status-count"),Ze=document.getElementById("status-err"),sn=document.getElementById("mm-svg"),Va=document.getElementById("mm-label"),fe=document.getElementById("editor-pane"),gt=540,Xa=96,Ie=440,en=720,V=960,ln=180,Ja=540,Za=100,Qa=110,er=420,tr=.35,nr=1,Qe=parseFloat(ee("slidetake:slideSize"))||.92,d=new Map,h=[],le=[],p=null,A="tree",R=!1,x={},q=!0,U=null,de=document.getElementById("brand"),z=document.getElementById("pip"),or=document.getElementById("stage-wrap"),E={x:0,y:0,zoom:.6},Xe=null;So={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};ye=null;Eo=new URLSearchParams(location.search).get("mode");ne=0;J=null,pe=-1,Ae=null;yr=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));Z=null;Co=null;Lr="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Cr="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Tr={dark:{palette:["#60a5fa","#f472b6","#a78bfa","#fb923c","#facc15","#a1a1aa"],text:"#e4e4e7",muted:"#a1a1aa",line:"#3f3f46",split:"#27272a",tip:"#18181b"},light:{palette:["#2563eb","#db2777","#7c3aed","#ea580c","#ca8a04","#71717a"],text:"#27272a",muted:"#71717a",line:"#d4d4d8",split:"#e4e4e7",tip:"#ffffff"}};To=new Set;Br="https://esm.sh/@terrastruct/d2@0.1.33",bt=null,zr={dark:{N1:"#e4e4e7",N2:"#a1a1aa",N3:"#a1a1aa",N4:"#323238",N5:"#27272a",N6:"#18181b",N7:"#09090b"},light:{N1:"#27272a",N2:"#71717a",N3:"#71717a",N4:"#e4e4e7",N5:"#e4e4e7",N6:"#f4f4f5",N7:"#ffffff"}};Ar=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
626
626
|
d2-config: {
|
|
627
627
|
layout-engine: elk
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
`+e,nn={};ve=0,on=null;we=document.getElementById("progress");we.innerHTML="<b></b><i></i>";ue={start:0,timer:null};$r=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];Re=null;X=null;ke=null;ie=null;sn.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!u.active&&P(t.dataset.id)});Oo=null;Q.addEventListener("input",()=>{y.kind!=="copy"&&!wi()||(k.text=Q.value,Ne(),clearTimeout(Oo),Oo=setTimeout(()=>{st(),Rt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==A&&Se(e.dataset.mode)})});(function(){let e=new Map,t=0,n=!1,o=null,a=()=>{let[i,s]=[...e.values()];return Math.hypot(i.x-s.x,i.y-s.y)||1};
|
|
630
|
+
`+e,nn={};ve=0,on=null;we=document.getElementById("progress");we.innerHTML="<b></b><i></i>";ue={start:0,timer:null};$r=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];Re=null;X=null;ke=null;ie=null;sn.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!u.active&&P(t.dataset.id)});Oo=null;Q.addEventListener("input",()=>{y.kind!=="copy"&&!wi()||(k.text=Q.value,Ne(),clearTimeout(Oo),Oo=setTimeout(()=>{st(),Rt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==A&&Se(e.dataset.mode)})});(function(){let e=new Map,t=0,n=!1,o=null,a=()=>{let[i,s]=[...e.values()];return Math.hypot(i.x-s.x,i.y-s.y)||1};T.addEventListener("pointerdown",i=>{i.pointerType==="mouse"&&i.button!==0||u.active||i.target.closest("a, pre, code, input, textarea")||(e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t=0,n=!1,e.size===2&&(o={d:a(),zoom:E.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),!n&&t>5&&(n=!0,kn(),T.classList.add("dragging")),n&&(e.size===2&&o?E.zoom=ra(o.zoom*a()/o.d):(E.x-=l/E.zoom,E.y-=c/E.zoom),Pe())});let r=i=>{e.delete(i.pointerId),e.size<2&&(o=null),e.size||T.classList.remove("dragging")};window.addEventListener("pointerup",r),window.addEventListener("pointercancel",r),T.addEventListener("click",i=>{n&&(i.stopPropagation(),i.preventDefault(),n=!1)},!0)})();T.addEventListener("wheel",e=>{e.preventDefault(),!u.active&&ia(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>De(-1);document.getElementById("nav-next").onclick=()=>De(1);document.getElementById("btn-open").onclick=()=>document.getElementById("file-input").click();document.getElementById("file-input").addEventListener("change",e=>{let t=e.target.files[0];if(!t)return;let n=new FileReader;n.onload=()=>{Ea("a copy of "+t.name)&&(k=pt(String(n.result),{kind:"file",name:t.name},{exported:!0}),st(),Z=null,p=null,ki())},n.readAsText(t),e.target.value=""});document.getElementById("btn-save").onclick=()=>{let e=new Blob([Q.value],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=(le[0]?Te(d.get(le[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),y.kind==="copy"&&(k.exported=k.text,st(),Ne())};document.getElementById("btn-reset").onclick=()=>{y.kind!=="copy"||ht(k)||confirm("Discard your edits and go back to "+re(k.origin)+" as it was?")&&(k.text=k.originText,st(),Q.value=k.text,p=null,Rt(!0),Ne())};document.getElementById("btn-edit-toggle").onclick=Dt;an=document.querySelector("main"),Oe=document.getElementById("editor-resizer"),zo=parseFloat(ee("slidetake:editorWidth"));zo&&fe.style.setProperty("--editor-w",zo+"px");Oe.addEventListener("pointerdown",e=>{e.preventDefault(),Oe.setPointerCapture(e.pointerId),an.classList.add("resizing");let t=an.getBoundingClientRect().right,n=a=>{let r=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-a.clientX)));fe.style.setProperty("--editor-w",r+"px")},o=()=>{an.classList.remove("resizing"),Oe.removeEventListener("pointermove",n),te("slidetake:editorWidth",String(fe.getBoundingClientRect().width))};Oe.addEventListener("pointermove",n),Oe.addEventListener("pointerup",o,{once:!0})});Oe.addEventListener("dblclick",()=>{fe.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=qo;document.getElementById("btn-present").onclick=()=>ge(!R);Zr="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",Io=["ArrowRight","PageDown"," ","ArrowDown","Enter"],Ao=["ArrowLeft","PageUp","ArrowUp","r","R"],Po=["b","B","."],Qr=document.getElementById("rec-dialog"),ei=document.getElementById("review"),yt=document.getElementById("rec-countdown"),un=document.getElementById("rec-paused"),St=document.getElementById("obs-host"),Et=document.getElementById("obs-port"),Lt=document.getElementById("obs-pass"),Cn=document.getElementById("obs-remember"),Ro=document.getElementById("obs-status"),Je=document.getElementById("rec-start"),H=null,xe=!1,Ee=null,sa=null,u={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null},Tn=e=>new Promise(t=>setTimeout(t,e)),la=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),Tn(100)]);document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});document.querySelectorAll("[data-copy]").forEach(e=>e.addEventListener("click",()=>{let t=document.getElementById(e.dataset.copy);t.select(),(navigator.clipboard?navigator.clipboard.writeText(t.value):Promise.reject()).catch(()=>document.execCommand("copy")),e.textContent="Copied",setTimeout(()=>{e.textContent="Copy"},1500)}));ni=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);ai="This page is served over https, and browsers block it from reaching OBS on another computer (OBS only offers plain ws://). Run OBS on this computer and use localhost, or open Slidetake from a local copy: download dist/index.html from github.com/slidetake/slidetake and serve it with python3 -m http.server.";document.getElementById("obs-connect").onclick=da;Cn.addEventListener("change",ca);document.getElementById("btn-record").onclick=hn;Je.onclick=()=>pa(!0);document.getElementById("rec-rehearse").onclick=()=>pa(!1);he="";ma=e=>vo(e,ha),fa=(e,t)=>xo(e,t,{input:e.outputPath||he||"recording.mov",outputName:Nt()+"-final.mp4",sectionOf:ha});_=null,F=null,I=document.getElementById("rv-video"),$=document.getElementById("rv-now");document.getElementById("rv-mode").onchange=()=>Ft();Tt=document.getElementById("rv-fps");Tt.onchange=()=>{_&&(_.fps=parseFloat(Tt.value),zn(_),Ft())};document.getElementById("rv-link").addEventListener("input",e=>{try{te("slidetake:site",new URL(e.target.value.trim()).origin)}catch{}_&&ba(_)});Mt=null;I.addEventListener("timeupdate",()=>{if(!F)return;let e=F.ranges[F.i];if(I.currentTime*1e3<e.end)return;if(F.i++,F.i>=F.ranges.length){I.pause(),F=null,$.textContent="";return}let t=F.ranges[F.i];I.currentTime=t.start/1e3,$.textContent="\u25B6 "+t.title});document.getElementById("rv-play-final").onclick=()=>{_&&Ot($e(_).map(e=>({start:e.start,end:e.end,title:e.title})))};Ke=null,mn=0,fn=!1;I.addEventListener("error",async()=>{if(I.getAttribute("src")){if(Ke&&mn<5){mn++,$.textContent="Reloading "+he+" (OBS was still finishing it)\u2026",await new Promise(e=>setTimeout(e,1500));try{rt(await Ht(Ke),Ke,!0);return}catch{}}$.textContent=Ke?"Chrome cannot play "+he+". 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 "+(he||"this file")+". If OBS was still finishing it when you opened it, open it again; if it still fails, set OBS to Hybrid MP4 (or MP4) with H.264 video."}});Ve=document.getElementById("rv-file-input");Ve.addEventListener("change",()=>{Ve.files[0]&&rt(Ve.files[0]),Ve.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Ve.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});$.textContent="Opening "+e.name+"\u2026",rt(await Ht(e),e)}catch(e){(!e||e.name!=="AbortError")&&($.textContent="Could not open that file.")}};xa=document.getElementById("rv-folder");xa.hidden=!window.showDirectoryPicker;xa.onclick=async()=>{let e=_&&Me(_.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(mi("obs-folder",t),!e){$.textContent="Folder remembered. This session has no file name from OBS; open the file instead.";return}let n=await t.getFileHandle(e);rt(await Ht(n),n)}catch(t){if(t&&t.name==="AbortError")return;$.textContent=(e?e+" is not in that folder":"Could not read that folder")+". Use \u201COpen the recording file\u2026\u201D instead."}};document.getElementById("rv-download").onclick=()=>{if(!_)return;let e=_,t=ma(e),n="# "+document.getElementById("rv-yt-title").value+`
|
|
631
631
|
|
|
632
632
|
Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath:"")+" \xB7 final length "+K(t.length)+`
|
|
633
633
|
|
|
@@ -653,7 +653,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
|
|
|
653
653
|
|
|
654
654
|
`+$e(e).map(a=>"- "+K(a.start)+"\u2013"+K(a.end)+" "+a.title).join(`
|
|
655
655
|
`)+`
|
|
656
|
-
`,o=document.createElement("a");o.href=URL.createObjectURL(new Blob([n],{type:"text/markdown"})),o.download=Nt()+"-publish.md",o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e3)};ti()&&new URLSearchParams(location.search).get("obs")&&da();se=document.getElementById("btn-camera"),vt=document.getElementById("pip-msg"),gn=null;bi='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';se.onclick=()=>An(q);
|
|
656
|
+
`,o=document.createElement("a");o.href=URL.createObjectURL(new Blob([n],{type:"text/markdown"})),o.download=Nt()+"-publish.md",o.click(),setTimeout(()=>URL.revokeObjectURL(o.href),1e3)};ti()&&new URLSearchParams(location.search).get("obs")&&da();se=document.getElementById("btn-camera"),vt=document.getElementById("pip-msg"),gn=null;bi='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';se.onclick=()=>An(q);In();Do=null;window.addEventListener("pointermove",Sa);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(u.active?_t("Stopped: the browser left fullscreen"):R&&ge(!1))});me=document.getElementById("help");document.getElementById("btn-keys").onclick=()=>me.classList.add("open");document.getElementById("help-close").onclick=()=>me.classList.remove("open");me.addEventListener("click",e=>{e.target===me&&me.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),u.active||hn();return}if(u.active){ii(e);return}if(document.querySelector(".modal.open")){e.key==="Escape"&&Mn();return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(me.classList.contains("open")){/^(Escape|k|K|\?)$/.test(e.key)&&me.classList.remove("open");return}let n=e.key;n==="ArrowRight"||n===" "||n==="PageDown"?(e.preventDefault(),De(1)):n==="ArrowLeft"||n==="PageUp"?(e.preventDefault(),De(-1)):n==="ArrowDown"?(e.preventDefault(),Xr()):n==="ArrowUp"?(e.preventDefault(),Vr()):n==="Home"?h.length&&P(h[0]):n==="End"?h.length&&P(h[h.length-1]):n==="o"||n==="O"?Kr():n==="e"||n==="E"?Dt():n==="f"||n==="F"||n==="p"||n==="P"?ge(!R):n==="r"||n==="R"?hn():n==="1"?Se("tree"):n==="2"?Se("radial"):n==="3"?Se("path"):n==="4"?Se("focus"):n==="c"||n==="C"?An(q):n==="v"||n==="V"?ur():n==="l"||n==="L"?qo():n==="+"||n==="="?Bo(1):n==="-"||n==="_"?Bo(-1):n==="?"||n==="k"||n==="K"?me.classList.add("open"):n==="Escape"&&!oa()&&R&&ge(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=dt(location.hash);if(e&&!(y&&y.kind==="share"&&e===y.data)){location.reload();return}t&&t!==p&&d.has(t)&&P(t)});jo="";new ResizeObserver(()=>{let e=T.clientWidth+"x"+T.clientHeight;e!==jo&&(jo=e,Pe(),oe(!0))}).observe(T);ze=document.createElement("div");ze.id="toast";ze.setAttribute("role","status");document.body.appendChild(ze);_o=null;yi=document.getElementById("open-dialog"),yn=document.getElementById("open-url"),vn=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{vn.hidden=!0,jt(yi),yn.focus(),yn.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=ao(yn.value);if(!t){vn.textContent="That doesn't look like a link.",vn.hidden=!1;return}location.href=bn(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await vi(p&&p!==h[0]?p:""),n=t?"Link copied, with the whole deck inside it ("+(e.length/1024).toFixed(1)+" KB)"+(e.length>8e3?". Some chat apps cut long links short: a GitHub file or gist makes a shorter one.":"."):"Link copied.";try{await navigator.clipboard.writeText(e),Bt(n,5e3)}catch{prompt("Copy this link:",e)}y.kind==="copy"&&(k.exported=k.text,st(),Ne())};No=ee("slidetake:layout");A=["tree","radial","path","focus"].includes(No)?No:"tree";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===A));zt=new URLSearchParams(location.search);["tree","radial","path","focus"].includes(zt.get("layout"))&&(A=zt.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===A)));if(O){let e=(Array.isArray(O.trail)?O.trail:O.back?[O.back]:[]).filter(a=>a&&a.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((a,r)=>(r?'<span class="sep" aria-hidden="true">|</span>':"")+(a.url?'<a href="'+C(a.url)+'">'+C(a.label)+"</a>":"<span>"+C(a.label)+"</span>")).join("")+"</nav>");let n=document.createElement("a");n.id="credit",n.href="https://slidetake.com",n.target="_blank",n.rel="noopener",n.title="Made with Slidetake",n.setAttribute("aria-label","Made with Slidetake"),n.innerHTML=Wo+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(n,o.firstChild),tt||(o.insertAdjacentHTML("beforeend",'<button class="btn" id="hdr-keys" title="Keyboard shortcuts (K)">\u2328 Keys</button><button class="btn" id="hdr-full" title="Fullscreen (F)">\u26F6 Fullscreen</button>'),document.getElementById("hdr-keys").onclick=()=>document.getElementById("help").classList.add("open"),document.getElementById("hdr-full").onclick=()=>ge(!R))}Y=co(location.pathname,location.search,location.hash),Fo=Y.page==="pick"?"":Y.slide,y=null,k=po(ee("slidetake:copy"))||xi();window.addEventListener("popstate",()=>location.reload());(zt.get("edit")==="1"||Y.page==="edit"&&k&&zt.get("edit")!=="0")&&Dt();Ei().then(e=>(Q.value=e,Ne(),Yo(Q.value),Xo(),document.fonts?document.fonts.ready:null)).then(()=>{d.forEach(At),nt(),P(d.has(Fo)?Fo:h[0],!0)})});var Pn=` /* Every colour comes from these tokens. Slidetake's own is terminal green: bright on zinc in dark mode,
|
|
657
657
|
deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
|
|
658
658
|
its own (accent: in its top block); see applyColors in app.js. */
|
|
659
659
|
:root{
|
|
@@ -1158,7 +1158,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
|
|
|
1158
1158
|
#credit .logo{width:18px;height:18px;fill:var(--accent);}
|
|
1159
1159
|
#credit .word > span{color:var(--accent);}
|
|
1160
1160
|
#credit:hover{opacity:.85;}
|
|
1161
|
-
html.embed #btn-
|
|
1161
|
+
html.embed #btn-docs, html.embed #btn-github{display:none !important;}
|
|
1162
1162
|
/* a reader's page (embedded, not recording): no bottom bar, except the arrows on touch screens */
|
|
1163
1163
|
html.embed.no-record #navbar{display:none;}
|
|
1164
1164
|
@media (pointer:coarse){
|
|
@@ -1252,7 +1252,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
|
|
|
1252
1252
|
<header>
|
|
1253
1253
|
<div class="brand">
|
|
1254
1254
|
<a class="mark" href="/" title="Slidetake home"><svg class="logo" viewBox="0 0 64 64" aria-hidden="true"><path d="M 10 8 H 38 C 41.3 8 44 10.7 44 14 V 18 H 22 C 16.5 18 12 22.5 12 28 V 36 H 10 C 6.7 36 4 33.3 4 30 V 14 C 4 10.7 6.7 8 10 8 Z" opacity="0.4"/><path fill-rule="evenodd" d="M 22 22 H 54 C 57.3 22 60 24.7 60 28 V 50 C 60 53.3 57.3 56 54 56 H 22 C 18.7 56 16 53.3 16 50 V 28 C 16 24.7 18.7 22 22 22 Z M 26 34 C 28.2 34 30 32.2 30 30 C 30 27.8 28.2 26 26 26 C 23.8 26 22 27.8 22 30 C 22 32.2 23.8 34 26 34 Z M 38 40 C 36.9 40 36 40.9 36 42 V 48 C 36 49.1 36.9 50 38 50 H 50 C 51.1 50 52 49.1 52 48 V 42 C 52 40.9 51.1 40 50 40 H 38 Z"/></svg><span class="word">Slide<span>take</span></span></a>
|
|
1255
|
-
<div class="tagline">plain markdown \u2192 spatial deck \u2192 video</div>
|
|
1255
|
+
<div class="tagline">plain markdown \u2192 spatial deck \u2192 video, no timeline editing</div>
|
|
1256
1256
|
</div>
|
|
1257
1257
|
<div class="hdr-actions">
|
|
1258
1258
|
<input type="file" id="file-input" accept=".md,.markdown,.txt,text/markdown" hidden>
|
|
@@ -1262,11 +1262,10 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
|
|
|
1262
1262
|
<button class="seg-btn" data-mode="path" title="Path: slides in presenting order (3)">path</button>
|
|
1263
1263
|
<button class="seg-btn" data-mode="focus" title="Focus: one slide at a time, no travel (4)">focus</button>
|
|
1264
1264
|
</div>
|
|
1265
|
-
<a class="btn" id="
|
|
1265
|
+
<a class="btn" id="btn-docs" href="/help" target="_blank" rel="noopener" title="Docs: the full guide, itself a deck">Docs</a>
|
|
1266
1266
|
<button class="btn" id="btn-edit-toggle" title="Editor: write, open, share (E)">\u270E Editor</button>
|
|
1267
|
-
<button class="btn icon" id="btn-mode" title="Light / dark (L)" aria-label="Light / dark"></button>
|
|
1268
1267
|
<a class="btn icon" id="btn-github" href="https://github.com/slidetake/slidetake" target="_blank" rel="noopener noreferrer" title="GitHub repository"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"/><path d="M9 18c-4.51 2-5-2-7-2"/></svg><span class="sr-only">GitHub repository</span></a>
|
|
1269
|
-
<button class="btn icon" id="btn-
|
|
1268
|
+
<button class="btn icon" id="btn-mode" title="Light / dark (L)" aria-label="Light / dark"></button>
|
|
1270
1269
|
</div>
|
|
1271
1270
|
</header>
|
|
1272
1271
|
|
|
@@ -1298,6 +1297,7 @@ Recorded `+new Date(e.date).toLocaleString()+(e.outputPath?" \xB7 "+e.outputPath
|
|
|
1298
1297
|
<div class="pane-bar">
|
|
1299
1298
|
<span class="pane-label" id="doc-state" aria-live="polite"></span>
|
|
1300
1299
|
<span class="pane-actions">
|
|
1300
|
+
<a class="btn small" id="continue" href="/edit" hidden></a>
|
|
1301
1301
|
<a class="btn small" id="btn-new" href="/new" title="Start from a template">New</a>
|
|
1302
1302
|
<button class="btn small" id="btn-load" title="Load a deck from a link: GitHub, a gist or any URL">\u21E3 Load</button>
|
|
1303
1303
|
<button class="btn small" id="btn-open" title="Open a markdown file from this computer">Open</button>
|