wicked-studio 0.14.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/assets/KnowledgeGraph-Cpm46tEp.js +1 -0
- package/dist/assets/WickedSansA-Regular-CGPJLyb8.woff2 +0 -0
- package/dist/assets/WickedSansA-SemiBold-Bk9KXUaV.woff2 +0 -0
- package/dist/assets/favicon-BJA6hF2f.svg +1 -0
- package/dist/assets/index-BRBwWQMH.css +32 -0
- package/dist/assets/index-CVrWDGRP.js +1097 -0
- package/dist/assets/wicked-studio-lettering-small-CBwSGqop.svg +2 -0
- package/dist/assets/wicked-studio-wordmark-small-gF5xn6IC.svg +2 -0
- package/dist/editors/wicked-apps/editor.json +45 -0
- package/dist/editors/wicked-apps/icon.svg +1 -0
- package/dist/editors/wicked-apps/index.html +151 -0
- package/dist/editors/wicked-deck/editor.json +1 -1
- package/dist/editors/wicked-deck/index.html +12 -8
- package/dist/editors/wicked-doc/editor.json +1 -1
- package/dist/editors/wicked-doc/index.html +12 -8
- package/dist/editors/wicked-insights/editor.json +1 -1
- package/dist/editors/wicked-insights/index.html +1 -1
- package/dist/editors/wicked-page/editor.json +1 -1
- package/dist/editors/wicked-page/index.html +12 -8
- package/dist/editors/wicked-video/editor.json +1 -1
- package/dist/editors/wicked-video/index.html +1 -1
- package/dist/fonts/LICENSE-WickedSans.txt +97 -0
- package/dist/index.html +3 -2
- package/dist/testid-inventory.json +10850 -6700
- package/package.json +2 -2
- package/dist/assets/WickedSans-Regular-fb698rcD.woff2 +0 -0
- package/dist/assets/WickedSans-SemiBold-CD53n1AC.woff2 +0 -0
- package/dist/assets/index-BUZ_-Syk.css +0 -32
- package/dist/assets/index-u4O_7N-b.js +0 -986
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="wicked-editor" content="wicked-deck">
|
|
6
|
-
<meta name="wicked-editor-version" content="0.
|
|
6
|
+
<meta name="wicked-editor-version" content="0.15.0">
|
|
7
7
|
<title>Slides</title>
|
|
8
8
|
<style>
|
|
9
9
|
/* The editor's own chrome takes the host's tokens (`host.hello.theme` / `host.theme`), with plain
|
|
@@ -84,14 +84,14 @@
|
|
|
84
84
|
</style>
|
|
85
85
|
</head>
|
|
86
86
|
<body data-size="pane">
|
|
87
|
-
<script>var wickedEditor=(function(
|
|
87
|
+
<script>var wickedEditor=(function(H){"use strict";var eo=Object.defineProperty;var to=(H,te,Te)=>te in H?eo(H,te,{enumerable:!0,configurable:!0,writable:!0,value:Te}):H[te]=Te;var Ht=(H,te,Te)=>to(H,typeof te!="symbol"?te+"":te,Te);const Jt={card:{interactive:!0,aspect:"16:9",actions:[{id:"prev",label:"Previous slide",verb:"plugin"},{id:"next",label:"Next slide",verb:"plugin",primary:!0},{id:"ask",label:"Ask about this",verb:"host:ask"},{id:"export",label:"Export",verb:"host:export"}]},options:{tabs:[{id:"style",label:"Style",render:"plugin"},{id:"notes",label:"Speaker notes",render:"plugin"}]},full:{}},Vt={"Alt+J":{verb:"navigate",what:"next card or row"},"Alt+K":{verb:"navigate",what:"previous card or row"},"Alt+/":{verb:"navigate",what:"the keyboard shortcuts overlay"},"Alt+P":{verb:"navigate",what:"peek at the top item that needs you"},"Alt+G":{verb:"navigate",what:"jump to the top item that needs you"},"Alt+B":{verb:"navigate",what:"back to where you were"},"Alt+T":{verb:"navigate",what:"the run’s evidence timeline"},"Alt+U":{verb:"navigate",what:"the run’s unit list"},"Alt+A":{verb:"approve",what:"approve the open gate"},"Alt+R":{verb:"decide",what:"reject the open gate"},"Alt+X":{verb:"decide",what:"select a gate for batch resolution"},"Alt+N":{verb:"compose",what:"compose a steer note"}},Gt=new Set(["Escape","Mod+K","Tab","Shift+Tab"]);function pt(t){if(Gt.has(t))return!0;const o=Vt[Zt(t)];return o!==void 0&&o.verb==="navigate"}function Zt(t){const o=/^alt\+(.)$/i.exec(t);return o===null?t:`Alt+${o[1].toUpperCase()}`}const $e="wicked.editor",Le=1,ht=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Qt=["card","options","full"];function en(t){return t==="inline"?"card":t==="pane"?"options":"full"}function yt(t){return t==="card"?"inline":t==="options"?"pane":"full"}function tn(t){const o=ht(t)?t:{},i=o.size==="inline"||o.size==="full"?o.size:"pane",s=o.protocol===2?2:1,a=s===2&&typeof o.tab=="string"?o.tab:null,l=s===2&&Qt.includes(o.surface)?o.surface:en(i),f=l==="options"&&a===null?"full":l,p=s===2&&(o.mode==="simple"||o.mode==="advanced")?o.mode:null;return{protocol:s,surface:f,tab:a,mode:p,size:i}}function nn(t,o,i){return{editor:t,version:o,protocol:[1,2],surfaces:i}}function on(t,o){const i=document.querySelector('meta[name="wicked-editor-version"]')?.getAttribute("content")??"0.0.0";parent.postMessage({p:$e,v:Le,type:"plugin.ready",payload:nn(t,i,o)},"*")}function mt(t,o,i){const s=t.metaKey||t.ctrlKey;let a=null;if(t.key==="Escape")a="Escape";else if(s&&!t.altKey&&t.key.toLowerCase()==="k")a="Mod+K";else if(t.altKey&&!s&&/^Key[A-Z]$/.test(t.code)&&pt(`Alt+${t.code.slice(3)}`))a=`Alt+${t.code.slice(3)}`;else if(t.key==="Tab"){const l=Array.from(o.querySelectorAll("button, input, select, textarea, [tabindex]")).filter(p=>p.tabIndex>=0&&!p.matches(":disabled")&&p.closest("[hidden]")===null),f=l.indexOf(t.target);(t.shiftKey?f<=0:f===-1||f===l.length-1)&&(a=t.shiftKey?"Shift+Tab":"Tab")}return a===null?!1:(t.preventDefault(),t.stopPropagation(),i(a),!0)}class rn{constructor(o,i){Ht(this,"revs",new Map);this.port=o,this.h=i}reply(o,i){this.port.postMessage({p:$e,v:Le,re:o,ok:!0,payload:i})}refuse(o,i,s){this.port.postMessage({p:$e,v:Le,re:o,ok:!1,error:{code:i,message:s}})}bump(o){const i=(this.revs.get(o)??0)+1;return this.revs.set(o,i),i}values(o,i){this.port.postMessage({p:$e,v:Le,type:"options.values",payload:{tab:o,rev:this.bump(o),values:i}})}height(o){this.port.postMessage({p:$e,v:Le,type:"ui.height",payload:{px:Math.round(o)}})}dispatch(o){const i=ht(o.payload)?o.payload:{},s=typeof o.id=="string"?o.id:null;switch(o.type){case"host.surface":{const a=i.surface;return(a==="card"||a==="options"||a==="full")&&this.h.surface?.(a,i.mode==="simple"||i.mode==="advanced"?i.mode:null),!0}case"host.mode":{if(s===null)return!0;const a=i.mode;return a!=="simple"&&a!=="advanced"?(this.refuse(s,"bad_request","mode is simple or advanced"),!0):(this.reply(s,{mode:this.h.mode?.(a)??a}),!0)}case"host.action":{if(s===null)return!0;const a=i.id;return typeof a!="string"||this.h.action===void 0?(this.reply(s,{handled:!1}),!0):(Promise.resolve(this.h.action(a)).then(l=>this.reply(s,{handled:l.handled===!0,...typeof l.status=="string"?{status:l.status.slice(0,120)}:{}}),()=>this.reply(s,{handled:!1})),!0)}case"host.tab":return typeof i.tab=="string"&&this.h.tab?.(i.tab),!0;case"host.selection":return Array.isArray(i.anchors)&&this.h.selection?.(i.anchors),!0;case"options.changed":{if(s===null)return!0;const a=i.tab,l=i.id;return typeof a!="string"||typeof l!="string"||this.h.optionsChanged===void 0?(this.refuse(s,"unsupported","no controls here"),!0):(Promise.resolve(this.h.optionsChanged(a,l,i.value)).then(f=>this.reply(s,{applied:f.applied,rev:this.bump(a),values:f.values,...f.reason!==void 0?{reason:f.reason.slice(0,120)}:{}}),f=>this.refuse(s,"unavailable",f instanceof Error?f.message.slice(0,120):"failed")),!0)}default:return!1}}}const Be=[{name:"corporate-light",display_name:"Corporate Light",colors:{background:"#FFFFFF",surface:"#F8FAFC",primary:"#1E3A5F",secondary:"#2563EB",accent:"#0891B2",text_primary:"#1E293B",text_secondary:"#64748B",text_muted:"#94A3B8",border:"#E2E8F0"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"midnight-purple",display_name:"Midnight Purple",colors:{background:"#0A0A0F",surface:"#13091D",primary:"#A100FF",secondary:"#6B2FA0",accent:"#F59E0B",text_primary:"#FFFFFF",text_secondary:"#A0A0B0",text_muted:"#6B6B80",border:"#2A2A3D"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}},{name:"warm-dark",display_name:"Warm Dark",colors:{background:"#1A1A2E",surface:"#16213E",primary:"#FF6B6B",secondary:"#C44569",accent:"#FFD93D",text_primary:"#F8F8F2",text_secondary:"#B0B0C0",text_muted:"#6B6B80",border:"#2D2D44"},fonts:{heading:"Calibri",body:"Calibri",mono:"Consolas"}}],vt=["Inter","Roboto","Source Sans 3","IBM Plex Sans","Calibri","Georgia","system-ui"],sn=[["background","Background"],["surface","Surface"],["primary","Primary"],["accent","Accent"],["text_primary","Text"]],Fe=t=>({name:t.name,colors:{...t.colors},fonts:{...t.fonts}});function ln(t,o){t.replaceChildren(),t.classList.add("plugin-style"),t.onkeydown=h=>{o.key!==void 0&&mt(h,t,o.key)};const i=document.createElement("style");i.textContent=`.plugin-style{padding:16px;box-sizing:border-box;color:var(--ink-high);background:var(--surface-base);font:13px var(--font-sans,system-ui)}
|
|
88
88
|
.plugin-style h2{font-size:16px;margin:0 0 12px}.plugin-style .theme-cards{display:grid;gap:8px;margin-bottom:18px}
|
|
89
89
|
.plugin-style button,.plugin-style input,.plugin-style select{font:inherit;color:var(--ink-high);background:var(--surface-card);border:1px solid var(--border);border-radius:4px}
|
|
90
90
|
.plugin-style button{padding:8px;text-align:left;cursor:pointer}.plugin-style button:focus-visible,.plugin-style input:focus-visible,.plugin-style select:focus-visible{outline:2px solid var(--accent)}
|
|
91
91
|
.plugin-style .ps-swatches{display:flex;width:100%;height:16px;margin-bottom:6px;border:1px solid var(--border)}.plugin-style .ps-swatches span{flex:1}
|
|
92
92
|
.plugin-style label{display:flex;align-items:center;gap:8px;margin:10px 0}.plugin-style label>span:first-child{flex:1}.plugin-style input[type=color]{width:36px;height:30px;padding:2px}.plugin-style input[type=text]{width:80px;padding:5px}.plugin-style select{max-width:170px;padding:5px}
|
|
93
|
-
.plugin-style p{line-height:1.5;color:var(--ink-body)}.plugin-style [role=status]{min-height:1.5em}.plugin-style :disabled{opacity:.6;cursor:default}`,
|
|
94
|
-
`),
|
|
93
|
+
.plugin-style p{line-height:1.5;color:var(--ink-body)}.plugin-style [role=status]{min-height:1.5em}.plugin-style :disabled{opacity:.6;cursor:default}`,t.append(i);const s=document.createElement("h2");s.textContent="Style",t.append(s);const a=document.createElement("div");a.className="theme-cards",t.append(a);const l=document.createElement("p");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let f=!1;const p=[],x=()=>Fe(o.tokens()??Be[0]),$=[],b=[],L=()=>{const h=x();for(const{key:y,picker:A,hex:D}of $)D.value=h.colors[y],A.value=/^#[0-9a-f]{6}$/i.test(h.colors[y])?h.colors[y]:"";for(const{key:y,select:A}of b)A.value=vt.includes(h.fonts[y])?h.fonts[y]:"system-ui";for(const y of Array.from(a.querySelectorAll("button")))y.setAttribute("aria-pressed",String(y.dataset.theme===h.name))},B=async h=>{if(!f){f=!0,p.forEach(y=>{y.disabled=!0}),l.textContent="Applying theme…";try{const y=await o.apply(h);l.textContent=y.ok?"Theme applied.":`Theme was not applied: ${y.reason}`}catch(y){l.textContent=`Theme was not applied: ${y instanceof Error?y.message:"unavailable"}`}finally{f=!1,p.forEach(y=>{y.disabled=!1}),L()}}};for(const h of Be){const y=document.createElement("button");y.type="button",y.dataset.theme=h.name;const A=document.createElement("span");A.className="ps-swatches",A.setAttribute("aria-hidden","true");for(const m of["background","surface","primary","secondary","accent"]){const S=document.createElement("span");S.style.backgroundColor=h.colors[m],A.append(S)}const D=document.createElement("span");D.textContent=h.display_name,y.append(A,D),y.addEventListener("click",()=>{B(Fe(h))}),a.append(y),p.push(y)}for(const[h,y]of sn){const A=document.createElement("label"),D=document.createElement("span");D.textContent=y;const m=document.createElement("input");m.type="color",m.setAttribute("aria-label",y);const S=document.createElement("input");S.type="text",S.maxLength=7,S.setAttribute("aria-label",`${y} hex`);const Z=ge=>{if(!/^#[0-9a-f]{6}$/i.test(ge)){l.textContent="Enter a six-digit hex colour: a # and six digits or letters a to f.",L();return}const de=x();de.name="custom",de.colors[h]=ge,B(de)};m.addEventListener("change",()=>Z(m.value)),S.addEventListener("change",()=>Z(S.value)),A.append(D,m,S),t.append(A),p.push(m,S),$.push({key:h,picker:m,hex:S})}for(const h of["heading","body"]){const y=document.createElement("label"),A=document.createElement("span");A.textContent=h==="heading"?"Heading font":"Body font";const D=document.createElement("select");D.setAttribute("aria-label",A.textContent);for(const m of vt){const S=document.createElement("option");S.value=m,S.textContent=m,D.append(S)}D.addEventListener("change",()=>{const m=x();m.name="custom",m.fonts[h]=D.value,B(m)}),y.append(A,D),t.append(y),p.push(D),b.push({key:h,select:D})}const P=document.createElement("p");return P.textContent="Match a website or a PDF: the host's Match button under this tab",t.append(P,l),L(),{refresh:L}}function an(t){const o=new DOMParser().parseFromString(t,"text/html"),i=Array.from(o.querySelectorAll("style")).map(p=>p.textContent??"").join(`
|
|
94
|
+
`),s=new Map;for(const p of i.matchAll(/(--wi-[a-z-]+)\s*:\s*([^;}{]+)/gi))s.set(p[1].toLowerCase(),p[2].trim());if(s.size===0)return null;const a=Fe(Be[0]),l={background:"--wi-bg",surface:"--wi-surface",primary:"--wi-primary",secondary:"--wi-secondary",accent:"--wi-accent",text_primary:"--wi-text",text_secondary:"--wi-text-secondary",text_muted:"--wi-muted",border:"--wi-border"};for(const p of Object.keys(l)){const x=s.get(l[p]);x!==void 0&&/^(#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})|(?:rgb|hsl)a?\([0-9.,%\s]+\))$/i.test(x)&&(a.colors[p]=x)}for(const p of["heading","body","mono"]){const x=s.get(`--wi-font-${p}`);x!==void 0&&(a.fonts[p]=x.split(",")[0].trim().replace(/^['"]|['"]$/g,""))}const f=Be.find(p=>JSON.stringify(p.colors)===JSON.stringify(a.colors)&&JSON.stringify(p.fonts)===JSON.stringify(a.fonts));return a.name=f?.name??"custom",a}const Xe="section, [data-slide], .slide",cn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),qe="aside[data-notes-for]",bt=80,gt=t=>{const o=t.tagName.toLowerCase();return!cn.has(o)&&!(o==="aside"&&t.hasAttribute("data-notes-for"))};function wt(t){return Array.from(t.querySelectorAll(Xe)).filter(o=>{if(!gt(o)||o.closest(qe)!==null)return!1;for(let i=o.parentElement;i!==null;i=i.parentElement)if(i.matches(Xe)&>(i))return!1;return!0})}const Ye=t=>t.replace(/\s+/g," ").trim(),dn=t=>t.length>bt?`${t.slice(0,bt-1).trimEnd()}…`:t;function un(t){const o=Array.from(t.querySelectorAll(qe)).find(i=>i.parentElement?.closest(Xe)===t);return o===void 0?"":(o.textContent??"").trim()}function fn(t){const o=t.cloneNode(!0);for(const i of Array.from(o.querySelectorAll(qe)))i.remove();for(const i of Array.from(o.querySelectorAll("h1,h2,h3,h4,h5,h6,p,li,td,th,div,section,figcaption,blockquote,br")))i.append(" ");return Ye(o.textContent??"")}function pn(t){const o=new DOMParser().parseFromString(t,"text/html");return wt(o).map((i,s)=>{const a=Array.from(i.querySelectorAll("h1,h2,h3,h4,h5,h6")).find(f=>f.closest(qe)===null&&Ye(f.textContent??"")!==""),l=fn(i);return{id:i.getAttribute("data-slide-id"),wid:i.getAttribute("data-wid"),n:s+1,title:dn(a!==void 0?Ye(a.textContent??""):l),notes:un(i),text:l}})}function hn(t,o,i){return{left:t.left-(i.scrollX-o.scrollX),top:t.top-(i.scrollY-o.scrollY),width:t.width,height:t.height}}const yn=/^[A-Za-z0-9_.:-]{1,100}$/;function K(t){return typeof t=="number"&&isFinite(t)}function mn(t){if(typeof t!="object"||t===null)return!1;const o=t;return o.section!==void 0&&(typeof o.section!="string"||!yn.test(o.section))?!1:typeof o.text=="string"&&typeof o.composite=="boolean"}function vn(t){if(typeof t!="object"||t===null)return!1;const o=t;return K(o.x)&&K(o.y)&&K(o.width)&&K(o.height)&&K(o.top)&&K(o.left)&&K(o.right)&&K(o.bottom)}function bn(t){if(typeof t!="object"||t===null)return null;const o=t;if(o.v!==1)return null;const i=o.type;if(i==="wid-inventory"){const s=o.widMap,a=o.scrollX,l=o.scrollY;if(typeof s!="object"||s===null||!K(a)||!K(l))return null;const f={};for(const[$,b]of Object.entries(s)){if(!vn(b))return null;f[$]=b}const p=o.blocks;if(p===void 0)return{v:1,type:"wid-inventory",widMap:f,scrollX:a,scrollY:l};if(typeof p!="object"||p===null)return null;const x={};for(const[$,b]of Object.entries(p)){if(!mn(b))return null;x[$]={text:b.text,composite:b.composite,...b.cut===!0?{cut:!0}:{},...b.section!==void 0?{section:b.section}:{}}}return{v:1,type:"wid-inventory",widMap:f,scrollX:a,scrollY:l,blocks:x}}if(i==="scroll-state"){const s=o.scrollX,a=o.scrollY;return!K(s)||!K(a)?null:{v:1,type:"scroll-state",scrollX:s,scrollY:a}}if(i==="scroll-ack"){const s=o.wid;if(typeof s!="string"||s==="")return null;const a=o.scrollX,l=o.scrollY,f=o.seq;return{v:1,type:"scroll-ack",wid:s,...K(a)&&K(l)?{scrollX:a,scrollY:l}:{},...typeof f=="number"&&Number.isInteger(f)&&f>0?{seq:f}:{}}}if(i==="wid-click"){const s=o.wid;return typeof s!="string"||s===""?null:{v:1,type:"wid-click",wid:s}}if(i==="wid-hover"){const s=o.wid;return s!==null&&(typeof s!="string"||s==="")?null:{v:1,type:"wid-hover",wid:s}}return null}const gn=Object.freeze({v:1,type:"request-inventory"}),wn="request-inventory";function kn(t){return t.includes(wn)}const xn=`
|
|
95
95
|
(function () {
|
|
96
96
|
if (window.__wickedInstrumentBridge) return;
|
|
97
97
|
window.__wickedInstrumentBridge = 1;
|
|
@@ -169,7 +169,11 @@
|
|
|
169
169
|
post(inventory());
|
|
170
170
|
}
|
|
171
171
|
})();
|
|
172
|
-
`;function
|
|
172
|
+
`;function En(t){const o=`<script>${xn}<\/script>`;return/<\/body>/i.test(t)?t.replace(/<\/body>/i,()=>`${o}</body>`):`${t}${o}`}const An=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),J=(t,o)=>t>>>o|t<<32-o;function kt(t){const o=new TextEncoder().encode(t),i=o.length*8,s=new Uint8Array(Math.ceil((o.length+9)/64)*64);s.set(o),s[o.length]=128;const a=new DataView(s.buffer);a.setUint32(s.length-8,Math.floor(i/4294967296)),a.setUint32(s.length-4,i>>>0);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint32Array(64);for(let $=0;$<s.length;$+=64){for(let m=0;m<16;m++)f[m]=a.getUint32($+m*4);for(let m=16;m<64;m++){const S=J(f[m-15],7)^J(f[m-15],18)^f[m-15]>>>3,Z=J(f[m-2],17)^J(f[m-2],19)^f[m-2]>>>10;f[m]=f[m-16]+S+f[m-7]+Z>>>0}let[b,L,B,P,h,y,A,D]=[l[0],l[1],l[2],l[3],l[4],l[5],l[6],l[7]];for(let m=0;m<64;m++){const S=D+(J(h,6)^J(h,11)^J(h,25))+(h&y^~h&A)+An[m]+f[m]>>>0,Z=(J(b,2)^J(b,13)^J(b,22))+(b&L^b&B^L&B)>>>0;D=A,A=y,y=h,h=P+S>>>0,P=B,B=L,L=b,b=S+Z>>>0}l[0]=l[0]+b>>>0,l[1]=l[1]+L>>>0,l[2]=l[2]+B>>>0,l[3]=l[3]+P>>>0,l[4]=l[4]+h>>>0,l[5]=l[5]+y>>>0,l[6]=l[6]+A>>>0,l[7]=l[7]+D>>>0}const p=new DataView(new ArrayBuffer(32));l.forEach(($,b)=>p.setUint32(b*4,$));let x="";for(let $=0;$<32;$++)x+=String.fromCharCode(p.getUint8($));return btoa(x)}const xt="WebRTC is not available in an editor frame",Sn=["RTCPeerConnection","webkitRTCPeerConnection","mozRTCPeerConnection","RTCDataChannel","RTCIceTransport","RTCDtlsTransport","RTCSctpTransport","RTCRtpSender","RTCRtpReceiver","RTCRtpTransceiver","RTCIceCandidate","RTCSessionDescription","RTCCertificate"],We='(function(w,o){if(typeof w!=="object"||w===null||w.window!==w)throw '+JSON.stringify(xt)+";var n="+JSON.stringify(Sn)+",k=o.getOwnPropertyNames(w),i,d;for(i=0;i!==k.length;i++)if(/^(webkit|moz)?RTC/.test(k[i])&&(d=o.getOwnPropertyDescriptor(w,k[i]))&&d.configurable)n.push(k[i]);for(i=0;i!==n.length;i++){o.defineProperty(w,n[i],{value:void 0,writable:false,configurable:false});if(w[n[i]]!==void 0)throw "+JSON.stringify(xt)+`}})(window,({}).constructor);
|
|
173
|
+
`,De=/[\n\r\u2028\u2029]/,Et=/\s/,At=/[\w$\\\u0080-\uFFFF]/;function Cn(t,o){if(o>=t.length)return!0;const i=t[o];if(i==='"'||i==="'"||i==="{"||i==="~"||/[0-9]/.test(i))return!0;if(i==="!")return t[o+1]!=="=";if(i===".")return/[0-9]/.test(t[o+1]??"");if(i==="\\")return!0;if(i==="+"||i==="-")return t[o+1]===i;if(!At.test(i))return!1;let s=o;for(;s<t.length&&At.test(t[s])&&!Et.test(t[s]);)s++;const a=t.slice(o,s);return a!=="in"&&a!=="instanceof"}function Tn(t){const o=t.length;let i=0,s=0,a=!1,l=!1;if(t.startsWith("#!")){for(;i<o&&!De.test(t[i]);)i++;s=i,a=!0}let f=!1,p=!0,x=!0;const $=()=>{for(;;){for(;i<o&&Et.test(t[i]);)De.test(t[i])&&(f=!0,p=!0),i++;if(x&&p&&t.startsWith("-->",i)){for(;i<o&&!De.test(t[i]);)i++;continue}if(t.startsWith("/*",i)){const b=t.indexOf("*/",i+2);if(b<0)return!1;De.test(t.slice(i,b))&&(f=!0,p=!0),i=b+2}else if(t.startsWith("//",i)||x&&t.startsWith("<!--",i))for(;i<o&&!De.test(t[i]);)i++;else return!0}};for(;$();){const b=t[i];if(b!=='"'&&b!=="'")break;x=!1;let L=i+1,B=!1;for(;L<o;){const h=t[L];if(h==="\\"){L+=2;continue}if(h===b){B=!0,L+=1;break}if(h===`
|
|
174
|
+
`||h==="\r")break;L+=1}if(!B)break;p=!1;const P=L;if(i=L,f=!1,!$())break;if(t[i]===";")i+=1,p=!1,s=i,l=!1;else if(t.startsWith("<!--",i)){s=P,l=!0,a=!1;break}else if((f||i>=o)&&Cn(t,i))s=P,l=!0;else break;a=!1}return{at:s,afterHashbang:a,semicolon:l}}function $n(t){const{at:o,afterHashbang:i,semicolon:s}=Tn(t);return t.slice(0,o)+(s?";":"")+(i?`
|
|
175
|
+
`:"")+We+t.slice(o)}const Ln=new Set(["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"]),St="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml";function Dn(t){if(t.namespaceURI===St?t.hasAttribute("href")||t.hasAttribute("xlink:href"):t.hasAttribute("src"))return!1;const o=t.namespaceURI===St?null:t.getAttribute("language"),i=t.hasAttribute("type")?t.getAttribute("type"):o!==null&&o!==""?`text/${o}`:"";return i===""||i.toLowerCase()==="module"?!0:Ln.has(i.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g,"").toLowerCase())}function Tt(t){const o=Array.from(t.querySelectorAll("script"));for(const i of Array.from(t.querySelectorAll("template")))i.namespaceURI===Ct&&o.push(...Tt(i.content));return o}function $t(t){const o=Array.from(t.querySelectorAll("meta[http-equiv]")).filter(i=>i.getAttribute("http-equiv").trim().toLowerCase()==="content-security-policy");for(const i of Array.from(t.querySelectorAll("template")))i.namespaceURI===Ct&&o.push(...$t(i.content));return o}function Mn(t){return t.doctype===null?"":new XMLSerializer().serializeToString(t.doctype)}function On(t){const o=new DOMParser().parseFromString(t,"text/html"),i=new Set([kt(We)]);for(const f of Tt(o)){if(!Dn(f))continue;const p=$n((f.textContent??"").replace(/\r\n?/g,`
|
|
176
|
+
`));f.textContent=p,i.add(kt(p))}for(const f of $t(o)){const p=(f.getAttribute("content")??"").split(";").map(x=>x.trim()).filter(x=>x!==""&&!/^script-src(-elem|-attr)?(\s|$)/i.test(x));f.setAttribute("content",[...p,"script-src 'unsafe-inline'"].join("; "))}const s=o.createElement("meta");s.setAttribute("http-equiv","Content-Security-Policy"),s.setAttribute("content",`script-src ${[...i].map(f=>`'sha256-${f}'`).join(" ")}; frame-src 'none'; child-src 'none'; worker-src 'none'; object-src 'none'`);const a=o.createElement("meta");a.setAttribute("http-equiv","Content-Security-Policy"),a.setAttribute("content","script-src 'unsafe-inline'");const l=o.createElement("script");return l.textContent=We,o.head.prepend(s,a,l),`${Mn(o)}${o.documentElement.outerHTML}`}const Me="wicked.editor",Ne=1,Rn="wicked-deck",ne=1280,oe=720,Bn=[0,250,750,1500],Fn=1500,qn=`
|
|
173
177
|
<div data-testid="deck-editor" id="deck" class="deck" data-kind="deck" data-head="" data-current="" data-count="0" data-size="pane" data-present="false" data-selected="" tabindex="0" role="application" aria-label="The deck">
|
|
174
178
|
<nav id="strip" class="strip" aria-label="Slides" data-testid="deck-strip"><ol id="thumbs"></ol></nav>
|
|
175
179
|
<div class="main">
|
|
@@ -208,7 +212,7 @@
|
|
|
208
212
|
</div>
|
|
209
213
|
</div>
|
|
210
214
|
<div data-testid="deck-handle" id="handle" class="handle" tabindex="-1"></div>
|
|
211
|
-
</div>`;function
|
|
215
|
+
</div>`;function w(t){const o=document.getElementById(t);if(o===null)throw new Error(`wicked-deck: no #${t}`);return o}const T=t=>t.id??`#${t.n}`;function He(t,o,i){const s=new DOMParser().parseFromString(t,"text/html");wt(s).forEach((l,f)=>{f!==o?l.setAttribute("data-wi-deck-off",""):l.setAttribute("data-wi-deck-current","")});const a=s.createElement("style");if(a.textContent="[data-wi-deck-off]{display:none!important}html,body{margin:0!important;padding:0!important;width:1280px!important;height:720px!important;overflow:hidden!important}[data-wi-deck-current]{position:absolute!important;left:0!important;top:0!important;width:1280px!important;height:720px!important;min-height:0!important;max-width:none!important;margin:0!important;box-sizing:border-box!important;overflow:hidden!important}",s.head.append(a),i.thumbnail)for(const l of Array.from(s.querySelectorAll("script")))l.remove();else{const l=s.createElement("script");l.textContent=`(function(){
|
|
212
216
|
function report(){
|
|
213
217
|
var slide=document.querySelector('[data-wi-deck-current]');
|
|
214
218
|
if(!slide)return;
|
|
@@ -223,8 +227,8 @@
|
|
|
223
227
|
if(slide&&typeof MutationObserver==='function')new MutationObserver(report).observe(slide,{childList:true,subtree:true,characterData:true,attributes:true});
|
|
224
228
|
if(document.fonts)document.fonts.ready.then(report);
|
|
225
229
|
});
|
|
226
|
-
})();`,d.body.append(u)}return`<!doctype html>${d.documentElement.outerHTML}`}function bt(){document.body.insertAdjacentHTML("afterbegin",mn);const o=v("deck"),r=v("strip"),i=v("thumbs"),d=v("count"),c=v("tools"),u=v("add"),h=v("dup"),m=v("up"),F=v("down"),U=v("del"),K=v("present"),te=v("notes-toggle");let G=!1;const Y=v("menu"),b=v("stage"),p=v("slide-box"),C=v("cutoff-bottom"),L=v("cutoff-right"),S=v("fit"),M=v("zoom-100"),Me=v("fullscreen"),ve=v("style-panel"),ae=v("notes-box"),vn=v("hover"),gt=v("selected"),q=v("input"),wt=v("badge"),kt=v("present-bar"),be=v("hint"),He=v("note"),B=v("notes"),bn=v("notes-label"),ne=v("handle");let oe=null,de=[],k="pane",D=1,T="options",De="style",xt=null,ze="fit",_e=null,ge=null,gn=0;const We=new Map,N=(e,t)=>{oe?.postMessage({p:Le,v:Ke,type:e,payload:t})},we=(e,t)=>new Promise(n=>{if(oe===null){n({ok:!1,error:{code:"unavailable",message:"no host yet"}});return}const s=`wd-${++gn}`;We.set(s,n),oe.postMessage({p:Le,v:Ke,type:e,id:s,payload:t})}),ce=e=>N("ui.status",{line:e.slice(0,120)}),Ue=()=>de.includes("artifact.write");let O=null,re="",f=[],P=null,ue=null,g=!1,fe=!1,Ge=!1,ke=null,J=!1,pe="",Je=null,he=null,R=null,Ve=0,Et=-1,Ze=[],z=null,qe=null,xe={scrollX:0,scrollY:0},Ne=null,$=null,H=null;const I=()=>{const e=f.findIndex(t=>x(t)===P);return e<0?0:e},j=()=>f[I()]??null,Qe=()=>{const e=b.clientWidth,t=b.clientHeight;if(e===0||t===0)return{x:0,y:0,s:1};const n=ze==="100"&&k!=="inline"&&!g?1:Math.min(e/Q,t/ee);return{x:Math.max(0,(e-Q*n)/2),y:Math.max(0,(t-ee*n)/2),s:n}},W=()=>{const e=ze==="fit"||k==="inline"||g;if(b.dataset.zoom=e?"fit":"100",S.setAttribute("aria-pressed",String(e)),M.setAttribute("aria-pressed",String(!e)),e&&(b.scrollLeft=0,b.scrollTop=0),R===null)return;const t=Qe();p.style.cssText=`left:${t.x}px;top:${t.y}px;width:${Q*t.s}px;height:${ee*t.s}px`,R.style.cssText=`width:${Q}px;height:${ee}px;transform:scale(${t.s})`,At()},At=()=>{const e=Object.values(z?.widMap??{}).filter(a=>a.width>0&&a.height>0),t=e.reduce((a,y)=>Math.max(a,y.bottom+(z?.measured.scrollY??0)),Math.max(ee+xe.scrollY,qe?.height??0)),n=e.reduce((a,y)=>Math.max(a,y.right+(z?.measured.scrollX??0)),Math.max(Q+xe.scrollX,qe?.width??0)),s=Qe(),l=D===2&&T==="full"&&!g;C.hidden=!l||t<=ee,L.hidden=!l||n<=Q,C.style.cssText=`left:${s.x}px;top:${s.y+ee*s.s-1}px;width:${Q*s.s}px`,L.style.cssText=`left:${s.x+Q*s.s-1}px;top:${s.y}px;height:${ee*s.s}px`},et=e=>{if(e===null||z===null)return null;const t=z.widMap[e];if(t===void 0||t.width===0&&t.height===0)return null;const n=nn(t,z.measured,xe),s=Qe();return{left:s.x+n.left*s.s,top:s.y+n.top*s.s,width:n.width*s.s,height:n.height*s.s}},tt=(e,t,n=0,s=0)=>{if(t===null){e.hidden=!0;return}e.hidden=!1,e.style.left=`${t.left}px`,e.style.top=`${t.top}px`,e.style.width=`${Math.max(t.width,n)}px`,e.style.height=`${Math.max(t.height,s)}px`},St=e=>{const t=z?.blocks[e];return z===null||t===void 0||z.widMap[e]===void 0?"unmeasured":t.composite?"container":t.cut===!0?"cut":"yes"},w=()=>{const e=j(),t=f.length;o.dataset.head=O===null?"":String(O),o.dataset.current=e?.id??"",o.dataset.currentN=e===null?"":String(e.n),o.dataset.count=String(t),o.dataset.size=k,o.dataset.surface=T,o.dataset.tab=De;const n=D===2&&T==="options";r.hidden=k==="inline"||g||n,b.hidden=n,ve.hidden=!n||De!=="style";const s=D===2&&T==="full"&&!G&&!g;ae.hidden=k==="inline"||g||n&&De!=="notes"||s,te.hidden=!(D===2&&T==="full"),te.setAttribute("aria-pressed",String(G)),At(),o.dataset.present=String(g),o.dataset.selected=$??"",document.body.dataset.present=String(g),d.textContent=t===0?"No slides yet":`${e?.n??1} of ${t}`,d.title=t===0?"":`Slide ${e?.n??1} of ${t}`;const l=Ue()&&!fe&&e!==null;for(const E of[u,h,U])E.disabled=!l||e?.id===null;m.disabled=!l||I()===0||e?.id===null,F.disabled=!l||I()>=t-1||e?.id===null,K.disabled=t===0,u.setAttribute("aria-expanded",String(J)),Y.hidden=!J||k==="inline",wt.hidden=D===2||k!=="inline"||t===0,wt.textContent=`${t} slide${t===1?"":"s"}`,kt.hidden=!g,kt.textContent=`${e?.n??0} / ${t} · ← → · Esc leaves`;for(const E of Array.from(i.children)){const V=E.querySelector("button");V!==null&&V.setAttribute("aria-current",String(V.dataset.key===P))}bn.textContent=e===null?"Speaker notes":`Speaker notes · slide ${e.n}`,document.activeElement!==B&&(B.value=ie!==null&&ie.key===P?ie.text:e?.notes??""),B.readOnly=!l;const a=k!=="inline"&&!g&&z!==null;if(tt(vn,a&&Ne!==$&&H===null?et(Ne):null),gt.dataset.wid=$??"",tt(gt,a&&H===null?et($):null),H!==null?tt(q,et(H.wid),160,30):q.hidden=!0,c.hidden=k==="inline"||g||n,Me.hidden=!de.includes("ui.fullscreen"),k==="inline"||g||n||H!==null||D===2&&T==="full"){be.hidden=!0;return}if(be.hidden=!1,$===null){be.removeAttribute("data-editable"),be.textContent=t===0?"":"← → to move between slides · click a line to point at it · type on it to change it";return}const y=St($);be.dataset.editable=String(y==="yes"),be.textContent=y==="yes"?"Type to change it · Enter to edit its text · Esc to let go":y==="container"?"This part holds other parts: click a line inside it to change the words · Esc to let go":"This can’t be changed by typing: say what to change in the message box · Esc to let go"},Pe=new Map,wn=()=>{const e=new Set,t=[];f.forEach((n,s)=>{const l=x(n);e.add(l);const a=Ye(re,s,{thumbnail:!0});let y=Pe.get(l);if(y===void 0){const V=document.createElement("li"),A=document.createElement("button");A.type="button",A.className="thumb";for(const[le,me]of Object.entries({"data-testid":"deck-thumb"}))A.setAttribute(le,me);A.innerHTML='<span class="n"></span><span class="mini"><iframe sandbox="" tabindex="-1" aria-hidden="true"></iframe></span><span class="t"></span>',A.addEventListener("click",()=>{Ee(A.dataset.key??null,!1),ot(),ne.focus()}),A.draggable=!0,A.addEventListener("dragstart",le=>{he=A.dataset.key??null,le.dataTransfer?.setData("text/plain",he??"")}),A.addEventListener("dragover",le=>{if(he===null||he===A.dataset.key)return;le.preventDefault();const me=A.getBoundingClientRect();A.dataset.drop=le.clientY<me.top+me.height/2?"before":"after"}),A.addEventListener("dragleave",()=>{delete A.dataset.drop}),A.addEventListener("drop",le=>{le.preventDefault();const me=A.dataset.drop;delete A.dataset.drop;const Ft=he;if(he=null,Ft===null||me===void 0)return;const Kt=f.findIndex(Bn=>x(Bn)===A.dataset.key),zt=f[Kt];if(zt?.id==null)return;const On=me==="after"?zt.id:f[Kt-1]?.id??null;rt(Ft,On)}),A.addEventListener("dragend",()=>{he=null}),V.appendChild(A),y={li:V,srcdoc:""},Pe.set(l,y)}const E=y.li.querySelector("button");E.dataset.key=l,E.dataset.slideId=n.id??"",E.dataset.n=String(n.n),E.setAttribute("aria-label",n.title===""?`Slide ${n.n}`:`Slide ${n.n}: ${n.title}`),E.querySelector(".n").textContent=String(n.n),E.querySelector(".t").textContent=n.title===""?`Slide ${n.n}`:n.title,y.srcdoc!==a&&(y.srcdoc=a,E.querySelector("iframe").srcdoc=a),t.push(y.li)});for(const[n,s]of Pe)e.has(n)||(s.li.remove(),Pe.delete(n));i.replaceChildren(...t)},kn=e=>{if(e===R){Et=Ve;for(const t of Ze)clearTimeout(t);Ze=hn.map(t=>setTimeout(()=>R?.contentWindow?.postMessage(an,"*"),t))}},nt=()=>{Ve+=1,z=null,qe=null,xe={scrollX:0,scrollY:0},Ne=null,$=null,se();const e=D===1&&k==="inline"?0:I();if(f.length===0){p.replaceChildren(),R=null,W(),w();return}const t=Ye(re,e,{thumbnail:!1}),n=document.createElement("iframe");for(const[l,a]of Object.entries({"data-testid":"deck-frame",sandbox:"allow-scripts",title:`Slide ${e+1}`}))n.setAttribute(l,a);R=n;const s=()=>{for(const l of Array.from(p.querySelectorAll("iframe")))l!==R&&l.remove()};n.addEventListener("load",()=>{kn(n),R===n&&s()}),n.srcdoc=cn(re)?t:fn(t),p.prepend(n),W(),setTimeout(()=>{R===n&&s()},2e3),w()},Ee=(e,t=!0)=>{if(e===null||e===P||!f.some(n=>x(n)===e)){w();return}lt(),P=e,nt(),t&&D===2&&T!=="options"&&ot()},Te=e=>{const t=Math.max(0,Math.min(f.length-1,I()+e)),n=f[t];n!==void 0&&Ee(x(n))},ot=()=>{const e=j()?.wid;e!=null&&de.includes("selection.chip")&&N("selection.set",{anchors:[{kind:"element",id:e}]})},xn=(e,t)=>e.version===void 0||t.version===void 0?{}:e.version>=t.version?e:t,$t=e=>{const t=e.version;if(typeof t=="number"&&O!==null&&t<O)return;He.hidden=!0;const n=e.content;if(re=typeof n?.html=="string"?n.html:"",O=typeof t=="number"?t:O,En(re),Lt.refresh(),f=tn(re),ue!==null){const l=f[Math.max(0,Math.min(f.length-1,ue))];P=l===void 0?null:x(l),ue=null}else f.some(l=>x(l)===P)||(P=f[0]===void 0?null:x(f[0]));const s=ge===null?void 0:f.find(l=>l.id===ge||l.wid===ge)??Ct(ge);T==="options"&&s!==void 0&&(ge=x(s),P=x(s)),wn(),nt()},Ae=async e=>{if(!(e!==void 0&&O!==null&&e<=O)){if(Ge){const t=e===void 0?{}:{version:e};ke=ke===null?t:xn(ke,t);return}Ge=!0;try{const t=await we("artifact.read",e===void 0?{}:{version:e});if(!t.ok){He.hidden=!1,He.textContent=t.error.code==="not_granted"?"This editor may not read the deck here.":`The deck could not be read (${t.error.code}).`;return}$t(t.payload)}finally{if(Ge=!1,ke!==null){const t=ke;ke=null,(t.version===void 0||O===null||t.version>O)&&Ae(t.version)}}}},Ct=e=>{if(re===""||!/^[A-Za-z0-9_.:-]{1,100}$/.test(e))return;const s=new DOMParser().parseFromString(re,"text/html").querySelector(`[data-wid="${e}"]`)?.closest("[data-slide-id]")?.getAttribute("data-slide-id")??null;return s===null?void 0:f.find(l=>l.id===s)},En=e=>{_e=Jt(e)??_e},Lt=Gt(ve,{tokens:()=>_e,key:e=>N("ui.key",{key:e}),apply:async e=>{if(D!==2||!de.includes("artifact.theme"))return{ok:!1,reason:"Theme changes are not granted here."};if(O===null)return{ok:!1,reason:"The deck has not loaded yet."};for(let t=0;t<2;t+=1){const n=await we("theme.set",{base:O,tokens:e});if(n.ok)return _e=Be(e),await Ae(typeof n.payload.version=="number"?n.payload.version:void 0),{ok:!0};if(n.error.code!=="head_moved")return{ok:!1,reason:n.error.message||n.error.code};const s=await we("artifact.read",{});if(!s.ok)return{ok:!1,reason:s.error.message||s.error.code};const l=s.payload.version;if(typeof l!="number"||O!==null&&l<O)return{ok:!1,reason:"The current deck version could not be read."};if($t(s.payload),t===1)return{ok:!1,reason:n.error.message||n.error.code}}return{ok:!1,reason:"The deck changed meanwhile."}}});window.addEventListener("message",e=>{if(R===null||R.contentWindow===null||e.source!==R.contentWindow||Et!==Ve)return;const t=e.data;if(t!==null&&typeof t=="object"&&t.v===1&&t.type==="deck-extents"){typeof t.width=="number"&&Number.isFinite(t.width)&&t.width>=0&&typeof t.height=="number"&&Number.isFinite(t.height)&&t.height>=0&&(qe={width:t.width,height:t.height},w());return}const n=ln(e.data);if(n!==null){if(n.type==="wid-inventory"){for(const s of Ze)clearTimeout(s);z={widMap:n.widMap,blocks:n.blocks??{},measured:{scrollX:n.scrollX,scrollY:n.scrollY}},xe={scrollX:n.scrollX,scrollY:n.scrollY},w()}else if(n.type==="scroll-state"||n.type==="scroll-ack")n.scrollX!==void 0&&n.scrollY!==void 0&&(xe={scrollX:n.scrollX,scrollY:n.scrollY},w());else if(n.type==="wid-hover")Ne=n.wid,w();else if(n.type==="wid-click"){if(k==="inline"){D===2&&Re(n.wid);return}if(g){Te(1);return}Re(n.wid===j()?.wid?null:n.wid),n.wid===j()?.wid&&ot()}}});const Re=e=>{$=e,se(),w(),e!==null&&(de.includes("selection.chip")&&N("selection.set",{anchors:[{kind:"element",id:e}]}),ne.focus())},ye=async(e,t,n,s=O,l)=>{if(s===null||fe||!Ue())return!1;fe=!0,J=!1,w(),ce(n);try{const a=await we("version.write",{base:s,ops:e,summary:t});if(a.ok)return await Ae(typeof a.payload.version=="number"?a.payload.version:void 0),!0;if(ue=null,a.error.code==="stale"||a.error.code==="head_moved"){l!==void 0?l():ce(a.error.code==="stale"&&a.error.message?a.error.message:"Not changed: the deck changed meanwhile");const y=a.payload?.head;typeof y=="number"&&y!==O&&await Ae(y)}else a.error.code==="timeout"||ce(a.error.message?a.error.code==="refused"||a.error.message.startsWith("Not changed")?a.error.message:`Not changed: ${a.error.message}`:"Nothing changed");return!1}finally{fe=!1,w()}},rt=async(e,t)=>{if(k==="inline"||g)return;const n=f.find(a=>x(a)===e);if(n?.id==null)return;const s=f.indexOf(n),l=t===null?-1:f.findIndex(a=>a.id===t);t===n.id||l===s-1||(P=x(n),await ye([{op:"slide-move",slide:n.id,after:t}],`slide ${n.n}`,`Moving slide ${n.n}…`))},it=e=>{const t=I(),n=f[t];n?.id!=null&&(e===-1&&t>0&&rt(x(n),f[t-2]?.id??null),e===1&&t<f.length-1&&rt(x(n),f[t+1]?.id??null))},Mt=()=>{if(k==="inline"||g)return;const e=j();e?.id!=null&&(ue=I()+1,ye([{op:"slide-duplicate",slide:e.id}],`slide ${e.n}`,`Duplicating slide ${e.n}…`))},Dt=e=>{if(k==="inline"||g)return;const t=j();e.id===null||t?.id==null||(ue=I()+1,ye([{op:"slide-insert",slide:e.id,after:t.id}],`a slide after slide ${t.n}`,`Adding a slide after slide ${t.n}…`))},Tt=()=>{if(k==="inline"||g)return;const e=j();e?.wid==null||f.length===0||(ue=Math.max(0,I()-(I()===f.length-1?1:0)),ye([{op:"remove",anchor:e.wid}],`slide ${e.n}`,`Deleting slide ${e.n}…`))},An=e=>{k==="inline"||g||z?.widMap[e]!==void 0&&ye([{op:"remove",anchor:e}],"part of the slide","Removing it…")};let Ie=null,st=null,ie=null;const lt=()=>{const e=f.find(y=>x(y)===Ie),t=st;if(Ie=null,st=null,e?.id==null||B.readOnly)return;const n=B.value.replace(/\r\n/g,`
|
|
227
|
-
`),
|
|
230
|
+
})();`,s.body.append(l)}return`<!doctype html>${s.documentElement.outerHTML}`}function Lt(){document.body.insertAdjacentHTML("afterbegin",qn);const t=w("deck"),o=w("strip"),i=w("thumbs"),s=w("count"),a=w("tools"),l=w("add"),f=w("dup"),p=w("up"),x=w("down"),$=w("del"),b=w("present"),L=w("notes-toggle");let B=!1;const P=w("menu"),h=w("stage"),y=w("slide-box"),A=w("cutoff-bottom"),D=w("cutoff-right"),m=w("fit"),S=w("zoom-100"),Z=w("fullscreen"),ge=w("style-panel"),de=w("notes-box"),Nn=w("hover"),Dt=w("selected"),z=w("input"),Mt=w("badge"),Ot=w("present-bar"),we=w("hint"),Je=w("note"),_=w("notes"),Pn=w("notes-label"),re=w("handle");let ie=null,ue=[],C="pane",F=1,q="options",Oe="style",Rt=null,Pe="fit",_e=null,ke=null,_n=0;const Ve=new Map,I=(e,n)=>{ie?.postMessage({p:Me,v:Ne,type:e,payload:n})},xe=(e,n)=>new Promise(r=>{if(ie===null){r({ok:!1,error:{code:"unavailable",message:"no host yet"}});return}const c=`wd-${++_n}`;Ve.set(c,r),ie.postMessage({p:Me,v:Ne,type:e,id:c,payload:n})}),fe=e=>I("ui.status",{line:e.slice(0,120)}),Ge=()=>ue.includes("artifact.write");let N=null,se="",v=[],U=null,pe=null,k=!1,he=!1,Ze=!1,Ee=null,Q=!1,ye="",Qe=null,me=null,X=null,et=0,Bt=-1,tt=[],j=null,je=null,Ae={scrollX:0,scrollY:0},Ke=null,R=null,V=null;const Y=()=>{const e=v.findIndex(n=>T(n)===U);return e<0?0:e},W=()=>v[Y()]??null,nt=()=>{const e=h.clientWidth,n=h.clientHeight;if(e===0||n===0)return{x:0,y:0,s:1};const r=Pe==="100"&&C!=="inline"&&!k?1:Math.min(e/ne,n/oe);return{x:Math.max(0,(e-ne*r)/2),y:Math.max(0,(n-oe*r)/2),s:r}},G=()=>{const e=Pe==="fit"||C==="inline"||k;if(h.dataset.zoom=e?"fit":"100",m.setAttribute("aria-pressed",String(e)),S.setAttribute("aria-pressed",String(!e)),e&&(h.scrollLeft=0,h.scrollTop=0),X===null)return;const n=nt();y.style.cssText=`left:${n.x}px;top:${n.y}px;width:${ne*n.s}px;height:${oe*n.s}px`,X.style.cssText=`width:${ne}px;height:${oe}px;transform:scale(${n.s})`,Ft()},Ft=()=>{const e=Object.values(j?.widMap??{}).filter(u=>u.width>0&&u.height>0),n=e.reduce((u,g)=>Math.max(u,g.bottom+(j?.measured.scrollY??0)),Math.max(oe+Ae.scrollY,je?.height??0)),r=e.reduce((u,g)=>Math.max(u,g.right+(j?.measured.scrollX??0)),Math.max(ne+Ae.scrollX,je?.width??0)),c=nt(),d=F===2&&q==="full"&&!k;A.hidden=!d||n<=oe,D.hidden=!d||r<=ne,A.style.cssText=`left:${c.x}px;top:${c.y+oe*c.s-1}px;width:${ne*c.s}px`,D.style.cssText=`left:${c.x+ne*c.s-1}px;top:${c.y}px;height:${oe*c.s}px`},ot=e=>{if(e===null||j===null)return null;const n=j.widMap[e];if(n===void 0||n.width===0&&n.height===0)return null;const r=hn(n,j.measured,Ae),c=nt();return{left:c.x+r.left*c.s,top:c.y+r.top*c.s,width:r.width*c.s,height:r.height*c.s}},rt=(e,n,r=0,c=0)=>{if(n===null){e.hidden=!0;return}e.hidden=!1,e.style.left=`${n.left}px`,e.style.top=`${n.top}px`,e.style.width=`${Math.max(n.width,r)}px`,e.style.height=`${Math.max(n.height,c)}px`},qt=e=>{const n=j?.blocks[e];return j===null||n===void 0||j.widMap[e]===void 0?"unmeasured":n.composite?"container":n.cut===!0?"cut":"yes"},E=()=>{const e=W(),n=v.length;t.dataset.head=N===null?"":String(N),t.dataset.current=e?.id??"",t.dataset.currentN=e===null?"":String(e.n),t.dataset.count=String(n),t.dataset.size=C,t.dataset.surface=q,t.dataset.tab=Oe;const r=F===2&&q==="options";o.hidden=C==="inline"||k||r,h.hidden=r,ge.hidden=!r||Oe!=="style";const c=F===2&&q==="full"&&!B&&!k;de.hidden=C==="inline"||k||r&&Oe!=="notes"||c,L.hidden=!(F===2&&q==="full"),L.setAttribute("aria-pressed",String(B)),Ft(),t.dataset.present=String(k),t.dataset.selected=R??"",document.body.dataset.present=String(k),s.textContent=n===0?"No slides yet":`${e?.n??1} of ${n}`,s.title=n===0?"":`Slide ${e?.n??1} of ${n}`;const d=Ge()&&!he&&e!==null;for(const M of[l,f,$])M.disabled=!d||e?.id===null;p.disabled=!d||Y()===0||e?.id===null,x.disabled=!d||Y()>=n-1||e?.id===null,b.disabled=n===0,l.setAttribute("aria-expanded",String(Q)),P.hidden=!Q||C==="inline",Mt.hidden=F===2||C!=="inline"||n===0,Mt.textContent=`${n} slide${n===1?"":"s"}`,Ot.hidden=!k,Ot.textContent=`${e?.n??0} / ${n} · ← → · Esc leaves`;for(const M of Array.from(i.children)){const ee=M.querySelector("button");ee!==null&&ee.setAttribute("aria-current",String(ee.dataset.key===U))}Pn.textContent=e===null?"Speaker notes":`Speaker notes · slide ${e.n}`,document.activeElement!==_&&(_.value=le!==null&&le.key===U?le.text:e?.notes??""),_.readOnly=!d;const u=C!=="inline"&&!k&&j!==null;if(rt(Nn,u&&Ke!==R&&V===null?ot(Ke):null),Dt.dataset.wid=R??"",rt(Dt,u&&V===null?ot(R):null),V!==null?rt(z,ot(V.wid),160,30):z.hidden=!0,a.hidden=C==="inline"||k||r,Z.hidden=!ue.includes("ui.fullscreen"),C==="inline"||k||r||V!==null||F===2&&q==="full"){we.hidden=!0;return}if(we.hidden=!1,R===null){we.removeAttribute("data-editable"),we.textContent=n===0?"":"← → to move between slides · click a line to point at it · type on it to change it";return}const g=qt(R);we.dataset.editable=String(g==="yes"),we.textContent=g==="yes"?"Type to change it · Enter to edit its text · Esc to let go":g==="container"?"This part holds other parts: click a line inside it to change the words · Esc to let go":"This can’t be changed by typing: say what to change in the message box · Esc to let go"},ze=new Map,jn=()=>{const e=new Set,n=[];v.forEach((r,c)=>{const d=T(r);e.add(d);const u=He(se,c,{thumbnail:!0});let g=ze.get(d);if(g===void 0){const ee=document.createElement("li"),O=document.createElement("button");O.type="button",O.className="thumb";for(const[ce,be]of Object.entries({"data-testid":"deck-thumb"}))O.setAttribute(ce,be);O.innerHTML='<span class="n"></span><span class="mini"><iframe sandbox="" tabindex="-1" aria-hidden="true"></iframe></span><span class="t"></span>',O.addEventListener("click",()=>{Se(O.dataset.key??null,!1),st(),re.focus()}),O.draggable=!0,O.addEventListener("dragstart",ce=>{me=O.dataset.key??null,ce.dataTransfer?.setData("text/plain",me??"")}),O.addEventListener("dragover",ce=>{if(me===null||me===O.dataset.key)return;ce.preventDefault();const be=O.getBoundingClientRect();O.dataset.drop=ce.clientY<be.top+be.height/2?"before":"after"}),O.addEventListener("dragleave",()=>{delete O.dataset.drop}),O.addEventListener("drop",ce=>{ce.preventDefault();const be=O.dataset.drop;delete O.dataset.drop;const Xt=me;if(me=null,Xt===null||be===void 0)return;const Yt=v.findIndex(Qn=>T(Qn)===O.dataset.key),Wt=v[Yt];if(Wt?.id==null)return;const Zn=be==="after"?Wt.id:v[Yt-1]?.id??null;lt(Xt,Zn)}),O.addEventListener("dragend",()=>{me=null}),ee.appendChild(O),g={li:ee,srcdoc:""},ze.set(d,g)}const M=g.li.querySelector("button");M.dataset.key=d,M.dataset.slideId=r.id??"",M.dataset.n=String(r.n),M.setAttribute("aria-label",r.title===""?`Slide ${r.n}`:`Slide ${r.n}: ${r.title}`),M.querySelector(".n").textContent=String(r.n),M.querySelector(".t").textContent=r.title===""?`Slide ${r.n}`:r.title,g.srcdoc!==u&&(g.srcdoc=u,M.querySelector("iframe").srcdoc=u),n.push(g.li)});for(const[r,c]of ze)e.has(r)||(c.li.remove(),ze.delete(r));i.replaceChildren(...n)},Kn=e=>{if(e===X){Bt=et;for(const n of tt)clearTimeout(n);tt=Bn.map(n=>setTimeout(()=>X?.contentWindow?.postMessage(gn,"*"),n))}},it=()=>{et+=1,j=null,je=null,Ae={scrollX:0,scrollY:0},Ke=null,R=null,ae();const e=F===1&&C==="inline"?0:Y();if(v.length===0){y.replaceChildren(),X=null,G(),E();return}const n=He(se,e,{thumbnail:!1}),r=document.createElement("iframe");for(const[d,u]of Object.entries({"data-testid":"deck-frame",sandbox:"allow-scripts",title:`Slide ${e+1}`}))r.setAttribute(d,u);X=r;const c=()=>{for(const d of Array.from(y.querySelectorAll("iframe")))d!==X&&d.remove()};r.addEventListener("load",()=>{Kn(r),X===r&&c()}),r.srcdoc=On(kn(se)?n:En(n)),y.prepend(r),G(),setTimeout(()=>{X===r&&c()},2e3),E()},Se=(e,n=!0)=>{if(e===null||e===U||!v.some(r=>T(r)===e)){E();return}dt(),U=e,it(),n&&F===2&&q!=="options"&&st()},Re=e=>{const n=Math.max(0,Math.min(v.length-1,Y()+e)),r=v[n];r!==void 0&&Se(T(r))},st=()=>{const e=W()?.wid;e!=null&&ue.includes("selection.chip")&&I("selection.set",{anchors:[{kind:"element",id:e}]})},zn=(e,n)=>e.version===void 0||n.version===void 0?{}:e.version>=n.version?e:n,Nt=e=>{const n=e.version;if(typeof n=="number"&&N!==null&&n<N)return;Je.hidden=!0;const r=e.content;if(se=typeof r?.html=="string"?r.html:"",N=typeof n=="number"?n:N,In(se),_t.refresh(),v=pn(se),pe!==null){const d=v[Math.max(0,Math.min(v.length-1,pe))];U=d===void 0?null:T(d),pe=null}else v.some(d=>T(d)===U)||(U=v[0]===void 0?null:T(v[0]));const c=ke===null?void 0:v.find(d=>d.id===ke||d.wid===ke)??Pt(ke);q==="options"&&c!==void 0&&(ke=T(c),U=T(c)),jn(),it()},Ce=async e=>{if(!(e!==void 0&&N!==null&&e<=N)){if(Ze){const n=e===void 0?{}:{version:e};Ee=Ee===null?n:zn(Ee,n);return}Ze=!0;try{const n=await xe("artifact.read",e===void 0?{}:{version:e});if(!n.ok){Je.hidden=!1,Je.textContent=n.error.code==="not_granted"?"This editor may not read the deck here.":`The deck could not be read (${n.error.code}).`;return}Nt(n.payload)}finally{if(Ze=!1,Ee!==null){const n=Ee;Ee=null,(n.version===void 0||N===null||n.version>N)&&Ce(n.version)}}}},Pt=e=>{if(se===""||!/^[A-Za-z0-9_.:-]{1,100}$/.test(e))return;const c=new DOMParser().parseFromString(se,"text/html").querySelector(`[data-wid="${e}"]`)?.closest("[data-slide-id]")?.getAttribute("data-slide-id")??null;return c===null?void 0:v.find(d=>d.id===c)},In=e=>{_e=an(e)??_e},_t=ln(ge,{tokens:()=>_e,key:e=>I("ui.key",{key:e}),apply:async e=>{if(F!==2||!ue.includes("artifact.theme"))return{ok:!1,reason:"Theme changes are not granted here."};if(N===null)return{ok:!1,reason:"The deck has not loaded yet."};for(let n=0;n<2;n+=1){const r=await xe("theme.set",{base:N,tokens:e});if(r.ok)return _e=Fe(e),await Ce(typeof r.payload.version=="number"?r.payload.version:void 0),{ok:!0};if(r.error.code!=="head_moved")return{ok:!1,reason:r.error.message||r.error.code};const c=await xe("artifact.read",{});if(!c.ok)return{ok:!1,reason:c.error.message||c.error.code};const d=c.payload.version;if(typeof d!="number"||N!==null&&d<N)return{ok:!1,reason:"The current deck version could not be read."};if(Nt(c.payload),n===1)return{ok:!1,reason:r.error.message||r.error.code}}return{ok:!1,reason:"The deck changed meanwhile."}}});window.addEventListener("message",e=>{if(X===null||X.contentWindow===null||e.source!==X.contentWindow||Bt!==et)return;const n=e.data;if(n!==null&&typeof n=="object"&&n.v===1&&n.type==="deck-extents"){typeof n.width=="number"&&Number.isFinite(n.width)&&n.width>=0&&typeof n.height=="number"&&Number.isFinite(n.height)&&n.height>=0&&(je={width:n.width,height:n.height},E());return}const r=bn(e.data);if(r!==null){if(r.type==="wid-inventory"){for(const c of tt)clearTimeout(c);j={widMap:r.widMap,blocks:r.blocks??{},measured:{scrollX:r.scrollX,scrollY:r.scrollY}},Ae={scrollX:r.scrollX,scrollY:r.scrollY},E()}else if(r.type==="scroll-state"||r.type==="scroll-ack")r.scrollX!==void 0&&r.scrollY!==void 0&&(Ae={scrollX:r.scrollX,scrollY:r.scrollY},E());else if(r.type==="wid-hover")Ke=r.wid,E();else if(r.type==="wid-click"){if(C==="inline"){F===2&&Ie(r.wid);return}if(k){Re(1);return}Ie(r.wid===W()?.wid?null:r.wid),r.wid===W()?.wid&&st()}}});const Ie=e=>{R=e,ae(),E(),e!==null&&(ue.includes("selection.chip")&&I("selection.set",{anchors:[{kind:"element",id:e}]}),re.focus())},ve=async(e,n,r,c=N,d)=>{if(c===null||he||!Ge())return!1;he=!0,Q=!1,E(),fe(r);try{const u=await xe("version.write",{base:c,ops:e,summary:n});if(u.ok)return await Ce(typeof u.payload.version=="number"?u.payload.version:void 0),!0;if(pe=null,u.error.code==="stale"||u.error.code==="head_moved"){d!==void 0?d():fe(u.error.code==="stale"&&u.error.message?u.error.message:"Not changed: the deck changed meanwhile");const g=u.payload?.head;typeof g=="number"&&g!==N&&await Ce(g)}else u.error.code==="timeout"||fe(u.error.message?u.error.code==="refused"||u.error.message.startsWith("Not changed")?u.error.message:`Not changed: ${u.error.message}`:"Nothing changed");return!1}finally{he=!1,E()}},lt=async(e,n)=>{if(C==="inline"||k)return;const r=v.find(u=>T(u)===e);if(r?.id==null)return;const c=v.indexOf(r),d=n===null?-1:v.findIndex(u=>u.id===n);n===r.id||d===c-1||(U=T(r),await ve([{op:"slide-move",slide:r.id,after:n}],`slide ${r.n}`,`Moving slide ${r.n}…`))},at=e=>{const n=Y(),r=v[n];r?.id!=null&&(e===-1&&n>0&<(T(r),v[n-2]?.id??null),e===1&&n<v.length-1&<(T(r),v[n+1]?.id??null))},jt=()=>{if(C==="inline"||k)return;const e=W();e?.id!=null&&(pe=Y()+1,ve([{op:"slide-duplicate",slide:e.id}],`slide ${e.n}`,`Duplicating slide ${e.n}…`))},Kt=e=>{if(C==="inline"||k)return;const n=W();e.id===null||n?.id==null||(pe=Y()+1,ve([{op:"slide-insert",slide:e.id,after:n.id}],`a slide after slide ${n.n}`,`Adding a slide after slide ${n.n}…`))},zt=()=>{if(C==="inline"||k)return;const e=W();e?.wid==null||v.length===0||(pe=Math.max(0,Y()-(Y()===v.length-1?1:0)),ve([{op:"remove",anchor:e.wid}],`slide ${e.n}`,`Deleting slide ${e.n}…`))},Un=e=>{C==="inline"||k||j?.widMap[e]!==void 0&&ve([{op:"remove",anchor:e}],"part of the slide","Removing it…")};let Ue=null,ct=null,le=null;const dt=()=>{const e=v.find(g=>T(g)===Ue),n=ct;if(Ue=null,ct=null,e?.id==null||_.readOnly)return;const r=_.value.replace(/\r\n/g,`
|
|
231
|
+
`),c=e.notes,d=T(e),u=()=>{le?.key===d&&(le=null)};if(r.trim()===c.trim()){u();return}ve([{op:"notes-set",slide:e.id,text:r}],`slide ${e.n}’s notes`,`Saving slide ${e.n}’s notes…`,n,()=>{le={key:d,text:r},fe(`Not saved: the deck changed while you typed slide ${e.n}’s notes. They are still in the field; leave it again to save them over the change.`),E()}).then(g=>{g&&u()})};_.addEventListener("focus",()=>{Ue=U,ct=N}),_.addEventListener("blur",()=>dt()),_.addEventListener("keydown",e=>{if(e.stopPropagation(),!(F===2&&q==="options"&&mt(e,de,n=>{(n==="Tab"||n==="Shift+Tab")&&_.blur(),I("ui.key",{key:n})}))){if(e.altKey&&!e.metaKey&&!e.ctrlKey&&/^Key[A-Z]$/.test(e.code)&&pt(`Alt+${e.code.slice(3)}`)){e.preventDefault(),I("ui.key",{key:`Alt+${e.code.slice(3)}`});return}if(e.key==="Escape"){e.preventDefault(),le?.key===U&&(le=null),_.value=W()?.notes??"",Ue=null,re.focus();return}if(e.key==="Enter"&&(e.metaKey||e.ctrlKey)){e.preventDefault(),F===2&&q==="options"?_.blur():re.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),I("ui.key",{key:"Mod+K"});return}if(e.key==="Tab"&&!e.shiftKey){e.preventDefault(),_.blur(),I("ui.key",{key:"Tab"});return}e.key==="Tab"&&e.shiftKey&&(e.preventDefault(),re.focus())}});const ae=()=>{V!==null&&(V=null,z.hidden=!0,z.value="",E())},It=(e,n)=>{if(C==="inline"||k||he||!Ge()||j===null||qt(e)!=="yes")return;const r=j.blocks[e]?.text??"";V={wid:e,before:r},z.value=n??r,E(),z.focus(),n===null?z.select():z.setSelectionRange(z.value.length,z.value.length)},Xn=async()=>{if(V===null)return;const{wid:e,before:n}=V,r=z.value.replace(/\s*\n\s*/g," ");ae(),re.focus(),r!==n&&await ve([{op:"text",anchor:e,value:r,before:n}],`slide ${W()?.n??""}`,"Changing the text…")};z.addEventListener("keydown",e=>{if(e.stopPropagation(),(e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),ae(),I("ui.key",{key:"Mod+K"});return}e.key==="Enter"?(e.preventDefault(),Xn()):e.key==="Escape"&&(e.preventDefault(),ae(),re.focus())}),z.addEventListener("blur",()=>ae());const Yn=()=>{P.replaceChildren();const e=document.createElement("span");e.className="word",e.textContent="A blank slide laid out like",P.appendChild(e);for(const n of v){if(n.id===null)continue;const r=document.createElement("button");r.type="button";for(const[c,d]of Object.entries({role:"menuitem","data-testid":"deck-add-like"}))r.setAttribute(c,d);r.dataset.slideId=n.id,r.textContent=n.title===""?`Slide ${n.n}`:`Slide ${n.n} — ${n.title}`,r.addEventListener("click",()=>Kt(n)),P.appendChild(r)}Q=!0,E(),P.querySelector("button")?.focus()},ut=()=>{Q&&(Q=!1,E(),l.focus())};P.addEventListener("keydown",e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),ut();return}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),e.stopPropagation();const n=Array.from(P.querySelectorAll("button")),r=n.indexOf(document.activeElement);n[(r+(e.key==="ArrowDown"?1:n.length-1)+n.length)%n.length]?.focus()}),l.addEventListener("click",()=>Q?ut():Yn()),f.addEventListener("click",()=>jt()),p.addEventListener("click",()=>at(-1)),x.addEventListener("click",()=>at(1)),$.addEventListener("click",()=>zt()),b.addEventListener("click",()=>void Wn()),L.addEventListener("click",()=>{B=!B,E(),G(),B&&_.focus()}),Z.addEventListener("click",()=>{xe("ui.fullscreen",{}).then(e=>{e.ok||fe(e.error.message)})}),m.addEventListener("click",()=>{Pe="fit",G(),E()}),S.addEventListener("click",()=>{Pe="100",G(),E()});const Wn=async()=>{v.length!==0&&(dt(),k=!0,Ie(null),ue.includes("ui.fullscreen")&&await xe("ui.fullscreen",{}),E(),G(),t.focus())},Hn=()=>{k=!1,E(),G(),t.focus()};window.addEventListener("resize",()=>{G(),E()}),typeof ResizeObserver=="function"&&new ResizeObserver(()=>{G(),E()}).observe(h);const Jn=()=>[...Array.from(i.querySelectorAll("button")).filter(()=>C!=="inline"&&!k),...Array.from(a.querySelectorAll("button")).filter(e=>!a.hidden&&!e.hidden&&!e.disabled),re,...C==="inline"||k||de.hidden?[]:[_]],Vn=e=>{ye=`${ye}${e}`.slice(-3),Qe!==null&&clearTimeout(Qe),Qe=setTimeout(()=>{ye=""},Fn),fe(`Go to slide ${ye} — Enter`)};t.addEventListener("keydown",e=>{if(e.target===z||e.target===_||ge.contains(e.target)||F===2&&q==="options")return;const n=e.target?.tagName==="BUTTON",r=e.target?.dataset?.testid==="deck-thumb",c=e.key==="Enter"&&r&&ye!=="";if(n&&!c&&(e.key==="Enter"||e.key===" "))return;const d=e.metaKey||e.ctrlKey;if(e.key==="Escape"){if(e.preventDefault(),Q){ut();return}if(k){Hn();return}if(R!==null){Ie(null);return}I("ui.key",{key:"Escape"});return}if(d&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),I("ui.key",{key:"Mod+K"});return}if(d&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="n"){e.preventDefault();const u=W();u!==null&&Kt(u);return}if(d&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()==="d"){e.preventDefault(),jt();return}if(d&&!e.altKey&&(e.key==="Backspace"||e.key==="Delete")){e.preventDefault(),R!==null&&R!==W()?.wid?Un(R):zt();return}if(e.altKey&&!d&&(e.key==="ArrowUp"||e.key==="ArrowDown")){e.preventDefault(),at(e.key==="ArrowUp"?-1:1);return}if(e.altKey&&!d&&/^Key[A-Z]$/.test(e.code)){e.preventDefault(),I("ui.key",{key:`Alt+${e.code.slice(3)}`});return}if(e.key==="Tab"){e.preventDefault();const u=Jn(),g=u.indexOf(document.activeElement),M=g===-1&&document.activeElement===t&&!e.shiftKey?0:g+(e.shiftKey?-1:1);if(g===-1&&M!==0||M<0||M>=u.length){I("ui.key",{key:e.shiftKey?"Shift+Tab":"Tab"});return}u[M].focus();return}if(!(d||e.altKey)){if(e.key==="ArrowRight"||e.key==="PageDown"||e.key==="ArrowDown"&&!n){e.preventDefault(),Re(1);return}if(e.key==="ArrowLeft"||e.key==="PageUp"||e.key==="ArrowUp"&&!n){e.preventDefault(),Re(-1);return}if(e.key==="Home"){e.preventDefault();const u=v[0];u!==void 0&&Se(T(u));return}if(e.key==="End"){e.preventDefault();const u=v[v.length-1];u!==void 0&&Se(T(u));return}if(k&&e.key===" "){e.preventDefault(),Re(1);return}if(c){e.preventDefault();const u=v[Number(ye)-1];ye="",u!==void 0&&(Se(T(u)),i.querySelector(`[data-key="${CSS.escape(T(u))}"]`)?.focus()),fe(u===void 0?"There is no such slide":`Slide ${u.n}`);return}if(!(n&&e.key.length!==1)){if(e.key==="Enter"){R!==null&&!he&&(e.preventDefault(),It(R,null));return}if(e.key.length===1){if(e.preventDefault(),C!=="inline"&&!k&&R!==null&&!he){It(R,e.key);return}if(/^[0-9]$/.test(e.key)&&r){Vn(e.key);return}I("ui.typed",{grapheme:e.key})}}}});const ft=e=>{const n=C;C=e,document.body.dataset.size=e,e==="inline"&&(k=!1,ae(),R=null,Q=!1,document.activeElement?.blur?.()),e!=="full"&&k&&(k=!1),F===1&&n==="inline"!=(e==="inline")&&v.length>0&&it(),G(),E()},Ut=e=>{if(!(typeof e!="object"||e===null))for(const[n,r]of Object.entries(e))/^--[a-z0-9-]+$/.test(n)&&typeof r=="string"&&r.length<=200&&!/url\(/i.test(r)&&document.documentElement.style.setProperty(n,r)},Gn=e=>{const n=e.data;try{if(n===null||typeof n!="object"||n.p!==Me||n.v!==Ne)return;if(typeof n.re=="string"){const c=Ve.get(n.re);if(c===void 0)return;Ve.delete(n.re);const d=typeof n.payload=="object"&&n.payload!==null?n.payload:{};n.ok===!0?c({ok:!0,payload:d}):c({ok:!1,error:n.error??{code:"unavailable",message:"no answer"},payload:d});return}if(F===2&&Rt?.dispatch(n))return;const r=typeof n.payload=="object"&&n.payload!==null?n.payload:{};switch(n.type){case"host.ping":typeof n.id=="string"&&ie?.postMessage({p:Me,v:Ne,re:n.id,ok:!0,payload:{}});return;case"host.size":(r.size==="inline"||r.size==="pane"||r.size==="full")&&ft(r.size);return;case"host.theme":Ut(r.theme);return;case"artifact.changed":{const c=r.version;typeof c=="number"&&c!==N&&Ce(c);return}case"selection.cleared":R!==null&&(R=null,ae(),E());return;default:return}}catch{}};window.addEventListener("message",e=>{const n=e.data;if(ie!==null||n===null||typeof n!="object"||n.p!==Me||n.type!=="host.hello"||e.ports[0]===void 0)return;ie=e.ports[0],ie.onmessage=Gn;const r=typeof n.payload=="object"&&n.payload!==null?n.payload:{};ue=Array.isArray(r.grants)?r.grants.filter(d=>typeof d=="string"):[];const c=tn(r);F=c.protocol,q=c.surface,Oe=c.tab??"style",document.body.dataset.protocol=String(F),document.body.dataset.surface=q,Rt=new rn(ie,{surface:d=>{d!=="options"&&(q=d,document.body.dataset.surface=d,ft(yt(d)))},action:d=>{if(q==="options"||d!=="prev"&&d!=="next")return{handled:!1};const u=Y()+(d==="next"?1:-1);return u<0||u>=v.length?{handled:!1}:(Re(d==="next"?1:-1),{handled:!0,status:`Slide ${Y()+1} of ${v.length}`})},tab:d=>{q!=="options"||d!=="style"&&d!=="notes"||(_.blur(),Oe=d,_t.refresh(),E())},selection:d=>{if(q==="options")for(const u of d){if(typeof u!="object"||u===null)continue;const g=u;if(g.kind!=="element"||typeof g.id!="string")continue;const M=v.find(ee=>ee.id===g.id||ee.wid===g.id)??Pt(g.id);if((v.length===0||M!==void 0)&&(ke=M===void 0?g.id:T(M)),M!==void 0){_.blur(),Se(T(M),!1);break}}}}),Ut(r.theme),ft(F===2?yt(q):c.size),Ce()}),on(Rn,Jt)}return Lt(),H.oneSlideHtml=He,H.start=Lt,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),H})({});
|
|
228
232
|
</script>
|
|
229
233
|
</body>
|
|
230
234
|
</html>
|