decklight 0.2.0 → 0.3.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 +69 -31
- package/SPEC.md +855 -80
- package/cli/agents.mjs +113 -9
- package/cli/associate.mjs +279 -0
- package/cli/audit.mjs +424 -0
- package/cli/bundle.mjs +174 -46
- package/cli/deckfile.mjs +233 -0
- package/cli/decklight.mjs +201 -8
- package/cli/dev.mjs +244 -55
- package/cli/edit.mjs +564 -107
- package/cli/extension.mjs +108 -0
- package/cli/git.mjs +141 -0
- package/cli/import.mjs +398 -0
- package/cli/init.mjs +421 -116
- package/cli/loader.mjs +263 -0
- package/cli/marketplace.mjs +730 -0
- package/cli/pdf.mjs +156 -0
- package/cli/pkg.mjs +69 -0
- package/cli/plugin.mjs +646 -0
- package/cli/port-conflict.mjs +94 -0
- package/cli/present.mjs +560 -0
- package/cli/publish.mjs +342 -0
- package/cli/qr.mjs +334 -0
- package/cli/rec.mjs +5 -8
- package/cli/remote.mjs +149 -0
- package/cli/report-bug.mjs +97 -0
- package/cli/restore.mjs +174 -0
- package/cli/serve.mjs +247 -0
- package/cli/sign.mjs +216 -0
- package/cli/skill-content.mjs +222 -0
- package/cli/skills.mjs +338 -0
- package/cli/supervise.mjs +57 -0
- package/cli/theme.mjs +201 -0
- package/cli/units.mjs +488 -0
- package/cli/upgrade.mjs +250 -0
- package/cli/util.mjs +90 -0
- package/cli/wizard.mjs +432 -0
- package/cli/zip.mjs +121 -0
- package/dist/decklight.css +716 -29
- package/dist/decklight.js +198 -125
- package/dist/decklight.js.map +4 -4
- package/docs/architecture.svg +1 -1
- package/package.json +5 -4
- package/themes/README.md +6 -4
- package/themes/aurora.css +1 -1
- package/themes/berry.css +1 -1
- package/themes/carbon.css +1 -1
- package/themes/citrus.css +1 -1
- package/themes/coastal.css +1 -1
- package/themes/cosmos.css +1 -1
- package/themes/dune.css +1 -1
- package/themes/eclipse.css +1 -1
- package/themes/ember.css +1 -1
- package/themes/fjord.css +1 -1
- package/themes/gallery.html +3 -11
- package/themes/glacier.css +1 -1
- package/themes/graphite.css +1 -1
- package/themes/harvest.css +1 -1
- package/themes/ibm-modern.css +1 -1
- package/themes/ink.css +1 -1
- package/themes/latte.css +1 -1
- package/themes/linen.css +1 -1
- package/themes/meadow.css +1 -1
- package/themes/metropolis.css +1 -1
- package/themes/midnight.css +1 -1
- package/themes/mint.css +1 -1
- package/themes/moss.css +1 -1
- package/themes/obsidian.css +1 -1
- package/themes/orchid.css +1 -1
- package/themes/packs.json +2 -30
- package/themes/paper.css +1 -1
- package/themes/peony.css +1 -1
- package/themes/porcelain.css +1 -1
- package/themes/reveal-beige.css +1 -1
- package/themes/reveal-black.css +1 -1
- package/themes/reveal-blood.css +1 -1
- package/themes/reveal-dracula.css +1 -1
- package/themes/reveal-league.css +1 -1
- package/themes/reveal-moon.css +1 -1
- package/themes/reveal-night.css +1 -1
- package/themes/reveal-serif.css +1 -1
- package/themes/reveal-simple.css +1 -1
- package/themes/reveal-sky.css +1 -1
- package/themes/reveal-solarized.css +1 -1
- package/themes/reveal-white.css +1 -1
- package/themes/sepia.css +1 -1
- package/themes/seriph.css +1 -1
- package/themes/slate.css +1 -1
- package/themes/storm.css +1 -1
- package/themes/synthwave.css +1 -1
- package/themes/velvet.css +1 -1
- package/themes/yamabuki.css +1 -1
- package/tools/args.mjs +32 -0
- package/tools/bridge.mjs +30 -0
- package/tools/chrome.mjs +11 -2
- package/tools/color.mjs +110 -0
- package/tools/deck-html.mjs +138 -0
- package/tools/elevenlabs-tts.mjs +248 -0
- package/tools/escape.mjs +40 -0
- package/tools/extension-check-runner.mjs +41 -0
- package/tools/extension-check.mjs +266 -0
- package/tools/gemini-tts.mjs +25 -3
- package/tools/lipsync-engines.mjs +81 -0
- package/tools/lipsync-server.mjs +78 -37
- package/tools/lipsync.mjs +36 -21
- package/tools/local-voice.mjs +209 -0
- package/tools/ooxml.mjs +151 -0
- package/tools/pptx.mjs +320 -0
- package/tools/publish-site-voices.mjs +2 -1
- package/tools/publish-targets.mjs +143 -0
- package/tools/publish-voices.mjs +230 -0
- package/tools/shot.mjs +91 -47
- package/tools/theme-check.mjs +139 -0
- package/tools/tts-engines.mjs +270 -41
- package/tools/tts-setup.mjs +257 -0
- package/tools/veo.mjs +204 -0
- package/tools/video.mjs +316 -0
- package/tools/voiceover-server.mjs +163 -54
- package/tools/voiceover.mjs +24 -7
- package/tools/zip.mjs +143 -0
- package/docs/demo.svg +0 -124
- package/themes/aliens.css +0 -87
- package/themes/apple2.css +0 -129
- package/themes/blade-runner.css +0 -86
- package/themes/c64.css +0 -88
- package/themes/friends.css +0 -85
- package/themes/gameboy.css +0 -121
- package/themes/genesis.css +0 -87
- package/themes/godfather.css +0 -85
- package/themes/ibm-oldschool.css +0 -87
- package/themes/miami-vice.css +0 -87
- package/themes/pulp-fiction.css +0 -87
- package/themes/severance.css +0 -85
- package/themes/snes.css +0 -85
- package/themes/star-wars.css +0 -88
- package/themes/stranger-things.css +0 -87
- package/themes/terminator.css +0 -87
package/dist/decklight.js
CHANGED
|
@@ -1,74 +1,117 @@
|
|
|
1
|
-
/*! Decklight — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
|
|
2
|
-
var Decklight=(()=>{var yl=Object.create;var cs=Object.defineProperty;var kl=Object.getOwnPropertyDescriptor;var vl=Object.getOwnPropertyNames;var wl=Object.getPrototypeOf,El=Object.prototype.hasOwnProperty;var Ji=(t,e)=>()=>(t&&(e=t(t=0)),e);var _l=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xl=(t,e)=>{for(var n in e)cs(t,n,{get:e[n],enumerable:!0})},ea=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vl(e))!El.call(t,i)&&i!==n&&cs(t,i,{get:()=>e[i],enumerable:!(r=kl(e,i))||r.enumerable});return t};var Sl=(t,e,n)=>(n=t!=null?yl(wl(t)):{},ea(e||!t||!t.__esModule?cs(n,"default",{value:t,enumerable:!0}):n,t)),Tl=t=>ea(cs({},"__esModule",{value:!0}),t);var le,I=Ji(()=>{le={order:["default","classics","oldmachines","tvseries","movies"],labels:{default:"Default",classics:"Classics",oldmachines:"Old Machines",tvseries:"TV Series",movies:"Movies"},packs:{default:["aurora","eclipse","midnight","fjord","cosmos","ink","storm","carbon","synthwave","obsidian","graphite","ember","moss","velvet","porcelain","paper","linen","sepia","glacier","mint","latte","dune","coastal","harvest","meadow","orchid","peony","slate","berry","citrus","ibm-modern","yamabuki"],classics:["reveal-black","reveal-white","reveal-league","reveal-beige","reveal-sky","reveal-night","reveal-serif","reveal-simple","reveal-solarized","reveal-moon","reveal-blood","reveal-dracula","metropolis","seriph"],oldmachines:["apple2","c64","gameboy","snes","genesis","ibm-oldschool"],tvseries:["miami-vice","friends","severance","stranger-things"],movies:["aliens","blade-runner","star-wars","terminator","godfather","pulp-fiction"]}}});var re,D=Ji(()=>{re=["aliens","apple2","aurora","berry","blade-runner","c64","carbon","citrus","coastal","cosmos","dune","eclipse","ember","fjord","friends","gameboy","genesis","glacier","godfather","graphite","harvest","ibm-modern","ibm-oldschool","ink","latte","linen","meadow","metropolis","miami-vice","midnight","mint","moss","obsidian","orchid","paper","peony","porcelain","pulp-fiction","reveal-beige","reveal-black","reveal-blood","reveal-dracula","reveal-league","reveal-moon","reveal-night","reveal-serif","reveal-simple","reveal-sky","reveal-solarized","reveal-white","sepia","seriph","severance","slate","snes","star-wars","storm","stranger-things","synthwave","terminator","velvet","yamabuki"]});var ja=_l((Wu,Wa)=>{I();D();function Oa(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Oa(n)}),t}var vs=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Ia(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ct(t,...e){let n=Object.create(null);for(let r in t)n[r]=t[r];return e.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var Ac="</span>",Ca=t=>!!t.scope,Cc=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`},Ur=class{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=Ia(e)}openNode(e){if(!Ca(e))return;let n=Cc(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Ca(e)&&(this.buffer+=Ac)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},Na=(t={})=>{let e={children:[]};return Object.assign(e,t),e},Hr=class t{constructor(){this.rootNode=Na(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let n=Na({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{t._collapse(n)}))}},zr=class extends Hr{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){let r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Ur(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function In(t){return t?typeof t=="string"?t:t.source:null}function Da(t){return zt("(?=",t,")")}function Nc(t){return zt("(?:",t,")*")}function Rc(t){return zt("(?:",t,")?")}function zt(...t){return t.map(n=>In(n)).join("")}function Mc(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function qr(...t){return"("+(Mc(t).capture?"":"?:")+t.map(r=>In(r)).join("|")+")"}function Pa(t){return new RegExp(t.toString()+"|").exec("").length-1}function Lc(t,e){let n=t&&t.exec(e);return n&&n.index===0}var $c=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Gr(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;let i=n,a=In(r),o="";for(;a.length>0;){let c=$c.exec(a);if(!c){o+=a;break}o+=a.substring(0,c.index),a=a.substring(c.index+c[0].length),c[0][0]==="\\"&&c[1]?o+="\\"+String(Number(c[1])+i):(o+=c[0],c[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}var Oc=/\b\B/,Ba="[a-zA-Z]\\w*",Kr="[a-zA-Z_]\\w*",Ua="\\b\\d+(\\.\\d+)?",Ha="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",za="\\b(0b[01]+)",Ic="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Dc=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=zt(e,/.*\b/,t.binary,/\b.*/)),Ct({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Dn={begin:"\\\\[\\s\\S]",relevance:0},Pc={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Dn]},Bc={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Dn]},Uc={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Es=function(t,e,n={}){let r=Ct({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=qr("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:zt(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Hc=Es("//","$"),zc=Es("/\\*","\\*/"),Fc=Es("#","$"),qc={scope:"number",begin:Ua,relevance:0},Gc={scope:"number",begin:Ha,relevance:0},Kc={scope:"number",begin:za,relevance:0},Wc={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Dn,{begin:/\[/,end:/\]/,relevance:0,contains:[Dn]}]},jc={scope:"title",begin:Ba,relevance:0},Zc={scope:"title",begin:Kr,relevance:0},Vc={begin:"\\.\\s*"+Kr,relevance:0},Yc=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},ks=Object.freeze({__proto__:null,APOS_STRING_MODE:Pc,BACKSLASH_ESCAPE:Dn,BINARY_NUMBER_MODE:Kc,BINARY_NUMBER_RE:za,COMMENT:Es,C_BLOCK_COMMENT_MODE:zc,C_LINE_COMMENT_MODE:Hc,C_NUMBER_MODE:Gc,C_NUMBER_RE:Ha,END_SAME_AS_BEGIN:Yc,HASH_COMMENT_MODE:Fc,IDENT_RE:Ba,MATCH_NOTHING_RE:Oc,METHOD_GUARD:Vc,NUMBER_MODE:qc,NUMBER_RE:Ua,PHRASAL_WORDS_MODE:Uc,QUOTE_STRING_MODE:Bc,REGEXP_MODE:Wc,RE_STARTERS_RE:Ic,SHEBANG:Dc,TITLE_MODE:jc,UNDERSCORE_IDENT_RE:Kr,UNDERSCORE_TITLE_MODE:Zc});function Xc(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function Qc(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function Jc(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=Xc,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function ed(t,e){Array.isArray(t.illegal)&&(t.illegal=qr(...t.illegal))}function td(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function nd(t,e){t.relevance===void 0&&(t.relevance=1)}var sd=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=zt(n.beforeMatch,Da(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},rd=["of","and","for","in","not","or","if","then","parent","list","value"],id="keyword";function Fa(t,e,n=id){let r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(a){Object.assign(r,Fa(t[a],e,a))}),r;function i(a,o){e&&(o=o.map(c=>c.toLowerCase())),o.forEach(function(c){let d=c.split("|");r[d[0]]=[a,ad(d[0],d[1])]})}}function ad(t,e){return e?Number(e):od(t)?0:1}function od(t){return rd.includes(t.toLowerCase())}var Ra={},Ht=t=>{console.error(t)},Ma=(t,...e)=>{console.log(`WARN: ${t}`,...e)},nn=(t,e)=>{Ra[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),Ra[`${t}/${e}`]=!0)},ws=new Error;function qa(t,e,{key:n}){let r=0,i=t[n],a={},o={};for(let c=1;c<=e.length;c++)o[c+r]=i[c],a[c+r]=!0,r+=Pa(e[c-1]);t[n]=o,t[n]._emit=a,t[n]._multi=!0}function ld(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw Ht("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ws;if(typeof t.beginScope!="object"||t.beginScope===null)throw Ht("beginScope must be object"),ws;qa(t,t.begin,{key:"beginScope"}),t.begin=Gr(t.begin,{joinWith:""})}}function cd(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw Ht("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ws;if(typeof t.endScope!="object"||t.endScope===null)throw Ht("endScope must be object"),ws;qa(t,t.end,{key:"endScope"}),t.end=Gr(t.end,{joinWith:""})}}function dd(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function ud(t){dd(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),ld(t),cd(t)}function pd(t){function e(o,c){return new RegExp(In(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(c?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(c,d){d.position=this.position++,this.matchIndexes[this.matchAt]=d,this.regexes.push([d,c]),this.matchAt+=Pa(c)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let c=this.regexes.map(d=>d[1]);this.matcherRe=e(Gr(c,{joinWith:"|"}),!0),this.lastIndex=0}exec(c){this.matcherRe.lastIndex=this.lastIndex;let d=this.matcherRe.exec(c);if(!d)return null;let p=d.findIndex((_,y)=>y>0&&_!==void 0),m=this.matchIndexes[p];return d.splice(0,p),Object.assign(d,m)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(c){if(this.multiRegexes[c])return this.multiRegexes[c];let d=new n;return this.rules.slice(c).forEach(([p,m])=>d.addRule(p,m)),d.compile(),this.multiRegexes[c]=d,d}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(c,d){this.rules.push([c,d]),d.type==="begin"&&this.count++}exec(c){let d=this.getMatcher(this.regexIndex);d.lastIndex=this.lastIndex;let p=d.exec(c);if(this.resumingScanAtSamePosition()&&!(p&&p.index===this.lastIndex)){let m=this.getMatcher(0);m.lastIndex=this.lastIndex+1,p=m.exec(c)}return p&&(this.regexIndex+=p.position+1,this.regexIndex===this.count&&this.considerAll()),p}}function i(o){let c=new r;return o.contains.forEach(d=>c.addRule(d.begin,{rule:d,type:"begin"})),o.terminatorEnd&&c.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&c.addRule(o.illegal,{type:"illegal"}),c}function a(o,c){let d=o;if(o.isCompiled)return d;[Qc,td,ud,sd].forEach(m=>m(o,c)),t.compilerExtensions.forEach(m=>m(o,c)),o.__beforeBegin=null,[Jc,ed,nd].forEach(m=>m(o,c)),o.isCompiled=!0;let p=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),p=o.keywords.$pattern,delete o.keywords.$pattern),p=p||/\w+/,o.keywords&&(o.keywords=Fa(o.keywords,t.case_insensitive)),d.keywordPatternRe=e(p,!0),c&&(o.begin||(o.begin=/\B|\b/),d.beginRe=e(d.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(d.endRe=e(d.end)),d.terminatorEnd=In(d.end)||"",o.endsWithParent&&c.terminatorEnd&&(d.terminatorEnd+=(o.end?"|":"")+c.terminatorEnd)),o.illegal&&(d.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(m){return hd(m==="self"?o:m)})),o.contains.forEach(function(m){a(m,d)}),o.starts&&a(o.starts,c),d.matcher=i(d),d}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ct(t.classNameAliases||{}),a(t)}function Ga(t){return t?t.endsWithParent||Ga(t.starts):!1}function hd(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ct(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:Ga(t)?Ct(t,{starts:t.starts?Ct(t.starts):null}):Object.isFrozen(t)?Ct(t):t}var fd="11.11.1",Fr=class extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}},Br=Ia,La=Ct,$a=Symbol("nomatch"),gd=7,Ka=function(t){let e=Object.create(null),n=Object.create(null),r=[],i=!0,a="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]},c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:zr};function d(x){return c.noHighlightRe.test(x)}function p(x){let R=x.className+" ";R+=x.parentNode?x.parentNode.className:"";let C=c.languageDetectRe.exec(R);if(C){let P=W(C[1]);return P||(Ma(a.replace("{}",C[1])),Ma("Falling back to no-highlight mode for this block.",x)),P?C[1]:"no-highlight"}return R.split(/\s+/).find(P=>d(P)||W(P))}function m(x,R,C){let P="",B="";typeof R=="object"?(P=x,C=R.ignoreIllegals,B=R.language):(nn("10.7.0","highlight(lang, code, ...args) has been deprecated."),nn("10.7.0",`Please use highlight(code, options) instead.
|
|
3
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),
|
|
4
|
-
`,1;if(me>1e5&&me>O.index*3)throw new Error("potential infinite loop, way more iterations than matches");return U+=j,j.length}let V=W(x);if(!V)throw Ht(a.replace("{}",x)),new Error('Unknown language: "'+x+'"');let Te=pd(V),L="",$=P||Te,ne={},Y=new c.__emitter(c);T();let U="",Ne=0,He=0,me=0,$e=!1;try{if(V.__emitTokens)V.__emitTokens(R,Y);else{for($.matcher.considerAll();;){me++,$e?$e=!1:$.matcher.considerAll(),$.matcher.lastIndex=He;let S=$.matcher.exec(R);if(!S)break;let O=R.substring(He,S.index),j=q(O,S);He=S.index+j}q(R.substring(He))}return Y.finalize(),L=Y.toHTML(),{language:x,value:L,relevance:Ne,illegal:!1,_emitter:Y,_top:$}}catch(S){if(S.message&&S.message.includes("Illegal"))return{language:x,value:Br(R),illegal:!0,relevance:0,_illegalBy:{message:S.message,index:He,context:R.slice(He-100,He+100),mode:S.mode,resultSoFar:L},_emitter:Y};if(i)return{language:x,value:Br(R),illegal:!1,relevance:0,errorRaised:S,_emitter:Y,_top:$};throw S}}function y(x){let R={value:Br(x),illegal:!1,relevance:0,_top:o,_emitter:new c.__emitter(c)};return R._emitter.addText(x),R}function k(x,R){R=R||c.languages||Object.keys(e);let C=y(x),P=R.filter(W).filter(X).map(te=>_(te,x,!1));P.unshift(C);let B=P.sort((te,we)=>{if(te.relevance!==we.relevance)return we.relevance-te.relevance;if(te.language&&we.language){if(W(te.language).supersetOf===we.language)return 1;if(W(we.language).supersetOf===te.language)return-1}return 0}),[he,M]=B,fe=he;return fe.secondBest=M,fe}function A(x,R,C){let P=R&&n[R]||C;x.classList.add("hljs"),x.classList.add(`language-${P}`)}function E(x){let R=null,C=p(x);if(d(C))return;if(Ce("before:highlightElement",{el:x,language:C}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),c.throwUnescapedHTML))throw new Fr("One of your code blocks includes unescaped HTML.",x.innerHTML);R=x;let P=R.textContent,B=C?m(P,{language:C,ignoreIllegals:!0}):k(P);x.innerHTML=B.value,x.dataset.highlighted="yes",A(x,C,B.language),x.result={language:B.language,re:B.relevance,relevance:B.relevance},B.secondBest&&(x.secondBest={language:B.secondBest.language,relevance:B.secondBest.relevance}),Ce("after:highlightElement",{el:x,result:B,text:P})}function H(x){c=La(c,x)}let z=()=>{Z(),nn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function G(){Z(),nn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let F=!1;function Z(){function x(){Z()}if(document.readyState==="loading"){F||window.addEventListener("DOMContentLoaded",x,!1),F=!0;return}document.querySelectorAll(c.cssSelector).forEach(E)}function J(x,R){let C=null;try{C=R(t)}catch(P){if(Ht("Language definition for '{}' could not be registered.".replace("{}",x)),i)Ht(P);else throw P;C=o}C.name||(C.name=x),e[x]=C,C.rawDefinition=R.bind(null,t),C.aliases&&ce(C.aliases,{languageName:x})}function K(x){delete e[x];for(let R of Object.keys(n))n[R]===x&&delete n[R]}function ae(){return Object.keys(e)}function W(x){return x=(x||"").toLowerCase(),e[x]||e[n[x]]}function ce(x,{languageName:R}){typeof x=="string"&&(x=[x]),x.forEach(C=>{n[C.toLowerCase()]=R})}function X(x){let R=W(x);return R&&!R.disableAutodetect}function Le(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=R=>{x["before:highlightBlock"](Object.assign({block:R.el},R))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=R=>{x["after:highlightBlock"](Object.assign({block:R.el},R))})}function Pe(x){Le(x),r.push(x)}function Se(x){let R=r.indexOf(x);R!==-1&&r.splice(R,1)}function Ce(x,R){let C=x;r.forEach(function(P){P[C]&&P[C](R)})}function ge(x){return nn("10.7.0","highlightBlock will be removed entirely in v12.0"),nn("10.7.0","Please use highlightElement now."),E(x)}Object.assign(t,{highlight:m,highlightAuto:k,highlightAll:Z,highlightElement:E,highlightBlock:ge,configure:H,initHighlighting:z,initHighlightingOnLoad:G,registerLanguage:J,unregisterLanguage:K,listLanguages:ae,getLanguage:W,registerAliases:ce,autoDetection:X,inherit:La,addPlugin:Pe,removePlugin:Se}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=fd,t.regex={concat:zt,lookahead:Da,either:qr,optional:Rc,anyNumberOfTimes:Nc};for(let x in ks)typeof ks[x]=="object"&&Oa(ks[x]);return Object.assign(t,ks),t},sn=Ka({});sn.newInstance=()=>Ka({});Wa.exports=sn;sn.HighlightJS=sn;sn.default=sn});var fu={};xl(fu,{init:()=>pu,initTerminals:()=>hu,registerBuildProvider:()=>Pn,version:()=>uu});I();D();I();D();I();D();var Nl=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),Rl=new Set(["defs","title","desc","style","metadata"]),sa=new Map;function ra(t,e){sa.set(t,e)}function us(t){return[...t.children].filter(e=>{let n=e.tagName.toLowerCase();return!(Rl.has(n)||n==="aside"&&e.classList.contains("notes")||e.hasAttribute("data-build-stay"))})}function Ml(t){if(t.hasAttribute("data-build-self"))return!1;let e=t.tagName.toUpperCase();return Nl.has(e)?!0:e==="DIV"||e==="G"?us(t).length>=2:!1}function Ll(t){if(t.tagName.toUpperCase()==="TABLE"){let n=t.querySelector(":scope > tbody");return n?us(n):us(t).filter(r=>r.tagName==="TR")}return us(t)}function $l(t){let e=t.map((o,c)=>({...o,i:c}));e.sort((o,c)=>o.key-c.key||o.i-c.i);let n=[],r=null,i=null,a=!1;for(let o of e){if(r&&o.explicit&&a&&o.key===i){r.push(o.i);continue}r=[o.i],i=o.key,a=o.explicit,n.push(r)}return n}function ta(t,e){t.classList.add("build-step"),t.setAttribute("data-build-style",e),t.setAttribute("data-build-state","pending"),e==="draw"&&Ol(t)}var na="path, line, polyline, polygon, circle, ellipse, rect";function Ol(t){let e=t.matches?.(na)?[t]:[...t.querySelectorAll(na)],n=!1;for(let i of e){let a=i.getAttribute("stroke")??getComputedStyle(i).stroke;if(!a||a==="none")continue;let o=0;try{o=i.getTotalLength()}catch{continue}if(!o)continue;n=!0;let c=i.getAttribute("stroke-dasharray")||i.style.strokeDasharray;c&&(i.dataset.drawOrig=c);for(let[d,p]of _r){let m=i.getAttribute(d);m&&(i.dataset[p]=m)}i.classList.add("draw-stroke"),i.style.setProperty("--draw-len",String(Math.ceil(o)))}t.querySelectorAll("text, tspan").forEach(i=>i.classList.add("draw-fade")),n||t.setAttribute("data-build-style","fade")}var _r=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function ds(t,e){for(let[n,r]of _r)r in t.dataset&&(e?t.setAttribute(n,t.dataset[r]):t.removeAttribute(n))}function Il(t,e){for(let n of t.querySelectorAll(".draw-stroke")){let r=n.dataset.drawOrig,i=_r.some(([,a])=>a in n.dataset);if(!(!r&&!i))if(e==="done")r&&(n.style.strokeDasharray=r,n.style.strokeDashoffset="0"),ds(n,!0);else if(e==="pending")n.style.removeProperty("stroke-dasharray"),n.style.removeProperty("stroke-dashoffset"),ds(n,!1);else{n.style.removeProperty("stroke-dasharray"),n.style.removeProperty("stroke-dashoffset"),ds(n,!1);let a=()=>{t.getAttribute("data-build-state")!=="pending"&&(r&&(n.style.strokeDasharray=r,n.style.strokeDashoffset="0"),ds(n,!0))},o=parseFloat(getComputedStyle(n).transitionDuration)||0;o===0?a():(n.addEventListener("transitionend",a,{once:!0}),setTimeout(a,o*1e3+150))}}}function xr(t){let e=[],n=[],r=new Set,i=0,a=(m,_)=>{let y=_!=null&&_!=="",k=y?parseInt(_,10):i;e.push(m),n.push({key:Number.isFinite(k)?k:i,explicit:y}),i++},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let m=o.nextNode();m;m=o.nextNode()){if(r.has(m))continue;let _=sa.get(m);if(_){for(let k=0;k<_.count;k++)a({kind:"provider",provider:_,el:m,sub:k},null);m.querySelectorAll("*").forEach(k=>r.add(k));continue}if(!m.hasAttribute("data-build"))continue;let y=m.getAttribute("data-build")||"fade";if(Ml(m)){for(let k of Ll(m)){r.add(k),k.querySelectorAll("[data-build]").forEach(E=>r.add(E));let A=k.getAttribute("data-build")||y;ta(k,A),a({kind:"dom",el:k,container:m},k.getAttribute("data-build-order"))}m.setAttribute("data-build-container","")}else ta(m,y),a({kind:"dom",el:m,container:null},m.getAttribute("data-build-order"))}let c=$l(n),d=[],p=new Map;return e.forEach((m,_)=>{if(m.kind==="provider"){if(!p.has(m.provider)){let y={el:m.el,provider:m.provider,stepIdxs:[]};p.set(m.provider,y),d.push(y)}p.get(m.provider).stepIdxs.push(_)}}),{steps:e,groups:c,providers:d}}function At(t,e){let n=new Set;t.groups.forEach((o,c)=>{for(let d of o)c<e&&n.add(d)});let r=e>0?t.groups[e-1]??[]:[],i=new Set(r),a=new Set;t.steps.forEach((o,c)=>{if(o.kind!=="dom")return;let d=i.has(c)?"current":n.has(c)?"done":"pending";o.el.setAttribute("data-build-state",d),o.el.getAttribute("data-build-style")==="draw"&&Il(o.el,d),o.container&&a.add(o.container)});for(let o of a){let c=!!o.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');o.classList.toggle("has-current-highlight",c)}for(let o of t.providers){let c=o.stepIdxs.filter(d=>n.has(d)||i.has(d)).length;o._last!==c&&(o._last=c,o.provider.apply(c))}}function ia(t){return t.groups.map(e=>{let n=t.steps[e[0]];if(n.kind==="provider"){let i=n.sub;return n.provider.label?n.provider.label(i+1):"step"}return n.el.textContent.trim().replace(/\s+/g," ").slice(0,60)||n.el.tagName.toLowerCase()})}I();D();var aa="rect, circle, ellipse, polygon, polyline, path";function Dl(t){let e=5381;for(let n of String(t))e=(e*33^n.charCodeAt(0))>>>0;return 1+e%6}function Pl(t,e={}){let n=e[t];return typeof n=="number"?`var(--d-fill-${n})`:typeof n=="string"?n:`var(--d-fill-${Dl(t)})`}function oa(t,e={}){let n=new Map;t.querySelectorAll("svg [data-concept]").forEach(r=>{let i=r.getAttribute("data-concept");if(!i)return;let a=Pl(i,e),o=a.match(/--d-fill-(\d)/);if(o){let d=n.get(o[1]);d&&d!==i?console.warn(`Decklight: concepts "${d}" and "${i}" share fill slot ${o[1]} \u2014 pin one explicitly via init({ concepts: { ${i}: <1-6> } })`):n.set(o[1],i)}let c=r.matches(aa)?[r]:[...r.children].filter(d=>d.matches(aa));for(let d of c)d.style.setProperty("fill",a)})}var Bl=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function la(t){t.querySelectorAll("svg").forEach((e,n)=>{let r=`svg${n}-`,i=new Map;if(e.querySelectorAll("[id]").forEach(o=>{let c=o.id;i.set(c,r+c),o.id=r+c}),i.size===0)return;let a=o=>o.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(c,d)=>i.has(d)?`url(#${i.get(d)})`:c);e.querySelectorAll("*").forEach(o=>{for(let c of Bl){let d=o.getAttribute(c);d&&d.includes("url(#")&&o.setAttribute(c,a(d))}for(let c of["href","xlink:href"]){let d=o.getAttribute(c);d&&d.startsWith("#")&&i.has(d.slice(1))&&o.setAttribute(c,"#"+i.get(d.slice(1)))}})})}I();D();var Sr=["opacity","color","backgroundColor","borderRadius","fontSize"];function ca(t){let e=getComputedStyle(t),n={rect:t.getBoundingClientRect()};for(let r of Sr)n[r]=e[r];return n}function Ul(t,e){if(t.ownerSVGElement){let n=t.getScreenCTM?.();if(n&&n.a&&n.d)return{x:n.a,y:n.d}}return{x:e,y:e}}function da(t,e,n){let r=getComputedStyle(e).getPropertyValue("--auto-animate-duration").trim(),i=(r.endsWith("ms")?parseFloat(r):r.endsWith("s")?parseFloat(r)*1e3:parseFloat(r))||500,a=new Map;t.querySelectorAll("[data-id]").forEach(d=>{a.set(d.getAttribute("data-id"),ca(d))});let o=[];e.querySelectorAll("[data-id]").forEach(d=>{let p=a.get(d.getAttribute("data-id"));p&&o.push({el:d,o:p})});for(let{el:d,o:p}of o){let m=ca(d),_=Ul(d,n),y=(p.rect.left-m.rect.left)/_.x,k=(p.rect.top-m.rect.top)/_.y,A=d.children.length===0&&p.fontSize!==m.fontSize,E=A?1:m.rect.width?p.rect.width/m.rect.width:1,H=A?1:m.rect.height?p.rect.height/m.rect.height:1,z=d.getAttribute("style")??"";d.style.transition="none",d.ownerSVGElement&&(d.style.transformBox="fill-box"),d.style.transformOrigin="0 0",d.style.transform=`translate(${y}px, ${k}px) scale(${E}, ${H})`;for(let F of Sr)d.style[F]=p[F];d.offsetWidth,d.style.transition=`transform ${i}ms ease, opacity ${i}ms ease, color ${i}ms ease, background-color ${i}ms ease, border-radius ${i}ms ease, font-size ${i}ms ease`,d.style.transform="";for(let F of Sr)d.style[F]=m[F];let G=()=>{z?d.setAttribute("style",z):d.removeAttribute("style"),d.removeEventListener("transitionend",G)};d.addEventListener("transitionend",G),setTimeout(G,i+80)}let c=new Set(o.map(d=>d.el));return[...e.children].forEach(d=>{d.matches("aside.notes")||c.has(d)||[...c].some(m=>d.contains(m))||(d.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>d.classList.add("aa-in"))),setTimeout(()=>d.classList.remove("aa-fresh","aa-in"),i+120))}),i}I();D();I();D();function Nr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ut=Nr();function ma(t){Ut=t}var $n={exec:()=>null};function de(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(De.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var De={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Hl=/^(?:[ \t]*(?:\n|$))+/,zl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,On=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ql=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Rr=/(?:[*+-]|\d{1,9}[.)])/,ba=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ya=de(ba).replace(/bull/g,Rr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Gl=de(ba).replace(/bull/g,Rr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Mr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kl=/^[^\n]+/,Lr=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Wl=de(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Lr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),jl=de(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Rr).getRegex(),bs="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",$r=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zl=de("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",$r).replace("tag",bs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ka=de(Mr).replace("hr",On).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bs).getRegex(),Vl=de(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ka).getRegex(),Or={blockquote:Vl,code:zl,def:Wl,fences:Fl,heading:ql,hr:On,html:Zl,lheading:ya,list:jl,newline:Hl,paragraph:ka,table:$n,text:Kl},ua=de("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",On).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bs).getRegex(),Yl={...Or,lheading:Gl,table:ua,paragraph:de(Mr).replace("hr",On).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ua).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",bs).getRegex()},Xl={...Or,html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$r).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$n,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:de(Mr).replace("hr",On).replace("heading",` *#{1,6} *[^
|
|
5
|
-
]`).replace("lheading",ya).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ql=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Jl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,va=/^( {2,}|\\)\n(?!\s*$)/,ec=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ys=/[\p{P}\p{S}]/u,Ir=/[\s\p{P}\p{S}]/u,wa=/[^\s\p{P}\p{S}]/u,tc=de(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ir).getRegex(),Ea=/(?!~)[\p{P}\p{S}]/u,nc=/(?!~)[\s\p{P}\p{S}]/u,sc=/(?:[^\s\p{P}\p{S}]|~)/u,rc=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,_a=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ic=de(_a,"u").replace(/punct/g,ys).getRegex(),ac=de(_a,"u").replace(/punct/g,Ea).getRegex(),xa="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",oc=de(xa,"gu").replace(/notPunctSpace/g,wa).replace(/punctSpace/g,Ir).replace(/punct/g,ys).getRegex(),lc=de(xa,"gu").replace(/notPunctSpace/g,sc).replace(/punctSpace/g,nc).replace(/punct/g,Ea).getRegex(),cc=de("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wa).replace(/punctSpace/g,Ir).replace(/punct/g,ys).getRegex(),dc=de(/\\(punct)/,"gu").replace(/punct/g,ys).getRegex(),uc=de(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),pc=de($r).replace("(?:-->|$)","-->").getRegex(),hc=de("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",pc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fs=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fc=de(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",fs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Sa=de(/^!?\[(label)\]\[(ref)\]/).replace("label",fs).replace("ref",Lr).getRegex(),Ta=de(/^!?\[(ref)\](?:\[\])?/).replace("ref",Lr).getRegex(),gc=de("reflink|nolink(?!\\()","g").replace("reflink",Sa).replace("nolink",Ta).getRegex(),Dr={_backpedal:$n,anyPunctuation:dc,autolink:uc,blockSkip:rc,br:va,code:Jl,del:$n,emStrongLDelim:ic,emStrongRDelimAst:oc,emStrongRDelimUnd:cc,escape:Ql,link:fc,nolink:Ta,punctuation:tc,reflink:Sa,reflinkSearch:gc,tag:hc,text:ec,url:$n},mc={...Dr,link:de(/^!?\[(label)\]\((.*?)\)/).replace("label",fs).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fs).getRegex()},Tr={...Dr,emStrongRDelimAst:lc,emStrongLDelim:ac,url:de(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},bc={...Tr,br:de(va).replace("{2,}","*").getRegex(),text:de(Tr.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ps={normal:Or,gfm:Yl,pedantic:Xl},Mn={normal:Dr,gfm:Tr,breaks:bc,pedantic:mc},yc={"&":"&","<":"<",">":">",'"':""","'":"'"},pa=t=>yc[t];function at(t,e){if(e){if(De.escapeTest.test(t))return t.replace(De.escapeReplace,pa)}else if(De.escapeTestNoEncode.test(t))return t.replace(De.escapeReplaceNoEncode,pa);return t}function ha(t){try{t=encodeURI(t).replace(De.percentDecode,"%")}catch{return null}return t}function fa(t,e){let n=t.replace(De.findPipe,(a,o,c)=>{let d=!1,p=o;for(;--p>=0&&c[p]==="\\";)d=!d;return d?"|":" |"}),r=n.split(De.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(De.slashPipe,"|");return r}function Ln(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r;){let a=t.charAt(r-i-1);if(a===e&&!n)i++;else if(a!==e&&n)i++;else break}return t.slice(0,r-i)}function kc(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function ga(t,e,n,r,i){let a=e.href,o=e.title||null,c=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:o,text:c,tokens:r.inlineTokens(c)};return r.state.inLink=!1,d}function vc(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
6
|
-
`)
|
|
7
|
-
`)}var gs=class{options;rules;lexer;constructor(t){this.options=t||Ut}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ln(n,`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</div>`)}function Sc(t){t.querySelectorAll("div[data-build]").forEach(e=>{let n=[...e.children];if(n.length!==1)return;let r=n[0];if(!/^(UL|OL|TABLE|DL)$/.test(r.tagName))return;let i=e.getAttribute("data-build");r.hasAttribute("data-build")||r.setAttribute("data-build",i||""),e.removeAttribute("data-build")})}function Tc(t){let{body:e,notes:n,rehearse:r}=_c(Ec(t)),i=ie.parse(xc(e)),a=n?ie.parse(n):null,o=r?ie.parse(r):null;return{html:i,notesHtml:a,rehearseHtml:o}}function Aa(t){t.querySelectorAll("section[data-markdown]").forEach(e=>{let n=e.querySelector('script[type="text/template"]'),r=n?n.textContent:e.textContent,{html:i,notesHtml:a,rehearseHtml:o}=Tc(r);e.innerHTML=i,Sc(e);for(let[c,d]of[["notes",a],["rehearse",o]]){if(!d)continue;let p=document.createElement("aside");p.className=c,p.innerHTML=d,e.appendChild(p)}e.removeAttribute("data-markdown"),e.setAttribute("data-was-markdown","")})}I();D();I();D();var Za=Sl(ja(),1);var ke=Za.default;I();D();function Va(t){let e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],c=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],p=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],m=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],_=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],y=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],k=m,A=[...p,...d].filter(J=>!m.includes(J)),E={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},H={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},z={match:e.concat(/\b/,e.either(...k),/\s*\(/),relevance:0,keywords:{built_in:k}};function G(J){return e.concat(/\b/,e.either(...J.map(K=>K.replace(/\s+/,"\\s+"))),/\b/)}let F={scope:"keyword",match:G(y),relevance:0};function Z(J,{exceptions:K,when:ae}={}){let W=ae;return K=K||[],J.map(ce=>ce.match(/\|\d+$/)||K.includes(ce)?ce:W(ce)?`${ce}|0`:ce)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:Z(A,{when:J=>J.length<3}),literal:a,type:c,built_in:_},contains:[{scope:"type",match:G(o)},F,z,E,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,H]}}I();D();var Ya="[A-Za-z$_][0-9A-Za-z$_]*",md=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],bd=["true","false","null","undefined","NaN","Infinity"],Xa=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Qa=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ja=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],yd=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],kd=[].concat(Ja,Xa,Qa);function eo(t){let e=t.regex,n=(C,{after:P})=>{let B="</"+C[0].slice(1);return C.input.indexOf(B,P)!==-1},r=Ya,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,P)=>{let B=C[0].length+C.index,he=C.input[B];if(he==="<"||he===","){P.ignoreMatch();return}he===">"&&(n(C,{after:B})||P.ignoreMatch());let M,fe=C.input.substring(B);if(M=fe.match(/^\s*=/)){P.ignoreMatch();return}if((M=fe.match(/^\s+extends\s+/))&&M.index===0){P.ignoreMatch();return}}},c={$pattern:Ya,keyword:md,literal:bd,built_in:kd,"variable.language":yd},d="[0-9](_?[0-9])*",p=`\\.(${d})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${p})|\\.)?|(${p}))[eE][+-]?(${d})\\b`},{begin:`\\b(${m})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},k={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},A={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,y],subLanguage:"css"}},E={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},H={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,y]},G={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},F=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,k,A,E,H,{match:/\$\d+/},_];y.contains=F.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(F)});let Z=[].concat(G,y.contains),J=Z.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(Z)}]),K={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:J},ae={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},W={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Xa,...Qa]}},ce={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[K],illegal:/%/},Le={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Pe(C){return e.concat("(?!",C.join("|"),")")}let Se={match:e.concat(/\b/,Pe([...Ja,"super","import"].map(C=>`${C}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ge={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},K]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",R={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[K]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:J,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),ce,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,k,A,E,H,G,{match:/\$\d+/},_,W,{scope:"attr",match:r+e.lookahead(":"),relevance:0},R,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[G,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:J}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[K,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[K]},Se,Le,ae,ge,{match:/\$[(.]/}]}}I();D();var _s="[A-Za-z$_][0-9A-Za-z$_]*",to=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],no=["true","false","null","undefined","NaN","Infinity"],so=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ro=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],io=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],ao=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],oo=[].concat(io,so,ro);function vd(t){let e=t.regex,n=(C,{after:P})=>{let B="</"+C[0].slice(1);return C.input.indexOf(B,P)!==-1},r=_s,i={begin:"<>",end:"</>"},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,P)=>{let B=C[0].length+C.index,he=C.input[B];if(he==="<"||he===","){P.ignoreMatch();return}he===">"&&(n(C,{after:B})||P.ignoreMatch());let M,fe=C.input.substring(B);if(M=fe.match(/^\s*=/)){P.ignoreMatch();return}if((M=fe.match(/^\s+extends\s+/))&&M.index===0){P.ignoreMatch();return}}},c={$pattern:_s,keyword:to,literal:no,built_in:oo,"variable.language":ao},d="[0-9](_?[0-9])*",p=`\\.(${d})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${m})((${p})|\\.)?|(${p}))[eE][+-]?(${d})\\b`},{begin:`\\b(${m})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},y={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},k={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,y],subLanguage:"xml"}},A={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,y],subLanguage:"css"}},E={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,y],subLanguage:"graphql"}},H={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,y]},G={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},F=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,k,A,E,H,{match:/\$\d+/},_];y.contains=F.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(F)});let Z=[].concat(G,y.contains),J=Z.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(Z)}]),K={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:J},ae={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},W={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...so,...ro]}},ce={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[K],illegal:/%/},Le={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Pe(C){return e.concat("(?!",C.join("|"),")")}let Se={match:e.concat(/\b/,Pe([...io,"super","import"].map(C=>`${C}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Ce={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ge={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},K]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",R={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[K]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:J,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),ce,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,k,A,E,H,G,{match:/\$\d+/},_,W,{scope:"attr",match:r+e.lookahead(":"),relevance:0},R,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[G,t.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:J}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[K,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ce,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[K]},Se,Le,ae,ge,{match:/\$[(.]/}]}}function lo(t){let e=t.regex,n=vd(t),r=_s,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},d=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],p={$pattern:_s,keyword:to.concat(d),literal:no,built_in:oo.concat(i),"variable.language":ao},m={className:"meta",begin:"@"+r},_=(E,H,z)=>{let G=E.contains.findIndex(F=>F.label===H);if(G===-1)throw new Error("can not find mode to replace");E.contains.splice(G,1,z)};Object.assign(n.keywords,p),n.exports.PARAMS_CONTAINS.push(m);let y=n.contains.find(E=>E.scope==="attr"),k=Object.assign({},y,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,y,k]),n.contains=n.contains.concat([m,a,o,k]),_(n,"shebang",t.SHEBANG()),_(n,"use_strict",c);let A=n.contains.find(E=>E.label==="func.def");return A.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}I();D();function co(t){let e=t.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},m={begin:/\{\{/,relevance:0},_={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d,m,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d,m,p]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,m,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,m,p]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},y="[0-9](_?[0-9])*",k=`(\\b(${y}))?\\.(${y})|\\b(${y})\\.`,A=`\\b|${r.join("|")}`,E={className:"number",relevance:0,variants:[{begin:`(\\b(${y})|(${k}))[eE][+-]?(${y})[jJ]?(?=${A})`},{begin:`(${k})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${A})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${A})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${A})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${A})`},{begin:`\\b(${y})[jJ](?=${A})`}]},H={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},z={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",d,E,_,t.HASH_COMMENT_MODE]}]};return p.contains=[_,E,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[d,E,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},_,H,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[z]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[E,z,_]}]}}I();D();function uo(t){let e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},a=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(c);let d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},m={match:/\\'/},_={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},y=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],k=t.SHEBANG({binary:`(${y.join("|")})`,relevance:10}),A={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},E=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],H=["true","false"],z={match:/(\/[a-z._-]+)+/},G=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],F=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],Z=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],J=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:E,literal:H,built_in:[...G,...F,"set","shopt",...Z,...J]},contains:[k,t.SHEBANG(),A,_,a,o,z,c,d,p,m,n]}}I();D();function po(t){let e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},c=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),y={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},k={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},A={begin:/\{/,end:/\}/,contains:[k],illegal:"\\n",relevance:0},E={begin:"\\[",end:"\\]",contains:[k],illegal:"\\n",relevance:0},H=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},y,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},A,E,a,o],z=[...H];return z.pop(),z.push(c),k.contains=z,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:H}}I();D();function ho(t){let e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}I();D();var rn="[0-9](_*[0-9])*",xs=`\\.(${rn})`,Ss="[0-9a-fA-F](_*[0-9a-fA-F])*",fo={className:"number",variants:[{begin:`(\\b(${rn})((${xs})|\\.)?|(${xs}))[eE][+-]?(${rn})[fFdD]?\\b`},{begin:`\\b(${rn})((${xs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${xs})[fFdD]?\\b`},{begin:`\\b(${rn})[fFdD]\\b`},{begin:`\\b0[xX]((${Ss})\\.?|(${Ss})?\\.(${Ss}))[pP][+-]?(${rn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Ss})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function go(t,e,n){return n===-1?"":t.replace(e,r=>go(t,e,n-1))}function mo(t){let e=t.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+go("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),d={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},p={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},m={className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:d,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[m,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:d,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:d,relevance:0,contains:[p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,fo,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},fo,p]}}I();D();function bo(t){let a={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:a,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:a,illegal:/["']/}]}]}}I();D();function yo(t){let e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),i=e.concat(n,t.IDENT_RE),a={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",c=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],p=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],m=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:m,keyword:c,literal:d,built_in:p},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:p,type:m}},{className:"punctuation",begin:"->"},a]}}I();D();function ko(t){let e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(a,{begin:/\(/,end:/\)/}),c=t.inherit(t.APOS_STRING_MODE,{className:"string"}),d=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),p={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,d,c,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[a,o,d,c]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[p],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[p],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:p}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}I();D();var wd=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Ed=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],_d=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],xd=[...Ed,..._d],Sd=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Td=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Ad=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Cd=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function vo(t){let e=t.regex,n=wd(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",a=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",c=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Td.join("|")+")"},{begin:":(:)?("+Ad.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Cd.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:Sd.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+xd.join("|")+")\\b"}]}}I();D();function wo(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}ke.registerLanguage("sql",Va);ke.registerLanguage("javascript",eo);ke.registerLanguage("typescript",lo);ke.registerLanguage("python",co);ke.registerLanguage("bash",uo);ke.registerLanguage("yaml",po);ke.registerLanguage("json",ho);ke.registerLanguage("java",mo);ke.registerLanguage("go",bo);ke.registerLanguage("rust",yo);ke.registerLanguage("xml",ko);ke.registerLanguage("css",vo);ke.registerLanguage("plaintext",wo);ke.registerAliases(["js"],{languageName:"javascript"});ke.registerAliases(["ts"],{languageName:"typescript"});ke.registerAliases(["shell","sh","zsh"],{languageName:"bash"});ke.registerAliases(["html"],{languageName:"xml"});ke.registerAliases(["text","plain"],{languageName:"plaintext"});function Nd(t,e){return t.split("|").map(n=>{if(n=n.trim(),n===""||n==="all")return Array.from({length:e},(i,a)=>a+1);let r=[];for(let i of n.split(",")){let a=i.trim().match(/^(\d+)(?:-(\d+))?$/);if(!a)continue;let o=parseInt(a[1],10),c=a[2]?parseInt(a[2],10):o;for(let d=o;d<=Math.min(c,e);d++)r.push(d)}return r})}function Rd(t){let e=[[]];for(function n(r,i){for(let a of r.childNodes)a.nodeType===Node.TEXT_NODE?a.nodeValue.split(`
|
|
66
|
-
|
|
1
|
+
/*! Decklight v0.3.0 — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
|
|
2
|
+
var Decklight=(()=>{var Ra=Object.create;var tr=Object.defineProperty;var Ia=Object.getOwnPropertyDescriptor;var Ba=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var zs=(r,a)=>()=>(r&&(a=r(r=0)),a);var qa=(r,a)=>()=>(a||r((a={exports:{}}).exports,a),a.exports),Fa=(r,a)=>{for(var l in a)tr(r,l,{get:a[l],enumerable:!0})},Us=(r,a,l,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of Ba(a))!Da.call(r,u)&&u!==l&&tr(r,u,{get:()=>a[u],enumerable:!(d=Ia(a,u))||d.enumerable});return r};var za=(r,a,l)=>(l=r!=null?Ra(Pa(r)):{},Us(a||!r||!r.__esModule?tr(l,"default",{value:r,enumerable:!0}):l,r)),Ua=r=>Us(tr({},"__esModule",{value:!0}),r);var Ve,ae=zs(()=>{Ve={order:["default","classics"],labels:{default:"Default",classics:"Classics"},packs:{default:["aurora","eclipse","midnight","fjord","cosmos","ink","storm","carbon","synthwave","obsidian","graphite","ember","moss","velvet","porcelain","paper","linen","sepia","glacier","mint","latte","dune","coastal","harvest","meadow","orchid","peony","slate","berry","citrus","ibm-modern","yamabuki"],classics:["reveal-black","reveal-white","reveal-league","reveal-beige","reveal-sky","reveal-night","reveal-serif","reveal-simple","reveal-solarized","reveal-moon","reveal-blood","reveal-dracula","metropolis","seriph"]}}});var Ke,le=zs(()=>{Ke=["aurora","berry","carbon","citrus","coastal","cosmos","dune","eclipse","ember","fjord","glacier","graphite","harvest","ibm-modern","ink","latte","linen","meadow","metropolis","midnight","mint","moss","obsidian","orchid","paper","peony","porcelain","reveal-beige","reveal-black","reveal-blood","reveal-dracula","reveal-league","reveal-moon","reveal-night","reveal-serif","reveal-simple","reveal-sky","reveal-solarized","reveal-white","sepia","seriph","slate","storm","synthwave","velvet","yamabuki"]});var _o=qa((eu,Ao)=>{ae();le();function ho(r){return r instanceof Map?r.clear=r.delete=r.set=function(){throw new Error("map is read-only")}:r instanceof Set&&(r.add=r.clear=r.delete=function(){throw new Error("set is read-only")}),Object.freeze(r),Object.getOwnPropertyNames(r).forEach(a=>{let l=r[a],d=typeof l;(d==="object"||d==="function")&&!Object.isFrozen(l)&&ho(l)}),r}var ir=class{constructor(a){a.data===void 0&&(a.data={}),this.data=a.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function mo(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dn(r,...a){let l=Object.create(null);for(let d in r)l[d]=r[d];return a.forEach(function(d){for(let u in d)l[u]=d[u]}),l}var wl="</span>",io=r=>!!r.scope,xl=(r,{prefix:a})=>{if(r.startsWith("language:"))return r.replace("language:","language-");if(r.includes(".")){let l=r.split(".");return[`${a}${l.shift()}`,...l.map((d,u)=>`${d}${"_".repeat(u+1)}`)].join(" ")}return`${a}${r}`},qr=class{constructor(a,l){this.buffer="",this.classPrefix=l.classPrefix,a.walk(this)}addText(a){this.buffer+=mo(a)}openNode(a){if(!io(a))return;let l=xl(a.scope,{prefix:this.classPrefix});this.span(l)}closeNode(a){io(a)&&(this.buffer+=wl)}value(){return this.buffer}span(a){this.buffer+=`<span class="${a}">`}},ao=(r={})=>{let a={children:[]};return Object.assign(a,r),a},Fr=class r{constructor(){this.rootNode=ao(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(a){this.top.children.push(a)}openNode(a){let l=ao({scope:a});this.add(l),this.stack.push(l)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(a){return this.constructor._walk(a,this.rootNode)}static _walk(a,l){return typeof l=="string"?a.addText(l):l.children&&(a.openNode(l),l.children.forEach(d=>this._walk(a,d)),a.closeNode(l)),a}static _collapse(a){typeof a!="string"&&a.children&&(a.children.every(l=>typeof l=="string")?a.children=[a.children.join("")]:a.children.forEach(l=>{r._collapse(l)}))}},zr=class extends Fr{constructor(a){super(),this.options=a}addText(a){a!==""&&this.add(a)}startScope(a){this.openNode(a)}endScope(){this.closeNode()}__addSublanguage(a,l){let d=a.root;l&&(d.scope=`language:${l}`),this.add(d)}toHTML(){return new qr(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Un(r){return r?typeof r=="string"?r:r.source:null}function fo(r){return bn("(?=",r,")")}function vl(r){return bn("(?:",r,")*")}function kl(r){return bn("(?:",r,")?")}function bn(...r){return r.map(l=>Un(l)).join("")}function El(r){let a=r[r.length-1];return typeof a=="object"&&a.constructor===Object?(r.splice(r.length-1,1),a):{}}function Hr(...r){return"("+(El(r).capture?"":"?:")+r.map(d=>Un(d)).join("|")+")"}function go(r){return new RegExp(r.toString()+"|").exec("").length-1}function Sl(r,a){let l=r&&r.exec(a);return l&&l.index===0}var Al=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Gr(r,{joinWith:a}){let l=0;return r.map(d=>{l+=1;let u=l,h=Un(d),f="";for(;h.length>0;){let m=Al.exec(h);if(!m){f+=h;break}f+=h.substring(0,m.index),h=h.substring(m.index+m[0].length),m[0][0]==="\\"&&m[1]?f+="\\"+String(Number(m[1])+u):(f+=m[0],m[0]==="("&&l++)}return f}).map(d=>`(${d})`).join(a)}var _l=/\b\B/,bo="[a-zA-Z]\\w*",jr="[a-zA-Z_]\\w*",yo="\\b\\d+(\\.\\d+)?",wo="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",xo="\\b(0b[01]+)",Tl="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Cl=(r={})=>{let a=/^#![ ]*\//;return r.binary&&(r.begin=bn(a,/.*\b/,r.binary,/\b.*/)),dn({scope:"meta",begin:a,end:/$/,relevance:0,"on:begin":(l,d)=>{l.index!==0&&d.ignoreMatch()}},r)},Hn={begin:"\\\\[\\s\\S]",relevance:0},Nl={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Hn]},$l={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Hn]},Ol={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},lr=function(r,a,l={}){let d=dn({scope:"comment",begin:r,end:a,contains:[]},l);d.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let u=Hr("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return d.contains.push({begin:bn(/[ ]+/,"(",u,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),d},Ml=lr("//","$"),Ll=lr("/\\*","\\*/"),Rl=lr("#","$"),Il={scope:"number",begin:yo,relevance:0},Bl={scope:"number",begin:wo,relevance:0},Pl={scope:"number",begin:xo,relevance:0},Dl={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Hn,{begin:/\[/,end:/\]/,relevance:0,contains:[Hn]}]},ql={scope:"title",begin:bo,relevance:0},Fl={scope:"title",begin:jr,relevance:0},zl={begin:"\\.\\s*"+jr,relevance:0},Ul=function(r){return Object.assign(r,{"on:begin":(a,l)=>{l.data._beginMatch=a[1]},"on:end":(a,l)=>{l.data._beginMatch!==a[1]&&l.ignoreMatch()}})},or=Object.freeze({__proto__:null,APOS_STRING_MODE:Nl,BACKSLASH_ESCAPE:Hn,BINARY_NUMBER_MODE:Pl,BINARY_NUMBER_RE:xo,COMMENT:lr,C_BLOCK_COMMENT_MODE:Ll,C_LINE_COMMENT_MODE:Ml,C_NUMBER_MODE:Bl,C_NUMBER_RE:wo,END_SAME_AS_BEGIN:Ul,HASH_COMMENT_MODE:Rl,IDENT_RE:bo,MATCH_NOTHING_RE:_l,METHOD_GUARD:zl,NUMBER_MODE:Il,NUMBER_RE:yo,PHRASAL_WORDS_MODE:Ol,QUOTE_STRING_MODE:$l,REGEXP_MODE:Dl,RE_STARTERS_RE:Tl,SHEBANG:Cl,TITLE_MODE:ql,UNDERSCORE_IDENT_RE:jr,UNDERSCORE_TITLE_MODE:Fl});function Hl(r,a){r.input[r.index-1]==="."&&a.ignoreMatch()}function Gl(r,a){r.className!==void 0&&(r.scope=r.className,delete r.className)}function jl(r,a){a&&r.beginKeywords&&(r.begin="\\b("+r.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",r.__beforeBegin=Hl,r.keywords=r.keywords||r.beginKeywords,delete r.beginKeywords,r.relevance===void 0&&(r.relevance=0))}function Kl(r,a){Array.isArray(r.illegal)&&(r.illegal=Hr(...r.illegal))}function Wl(r,a){if(r.match){if(r.begin||r.end)throw new Error("begin & end are not supported with match");r.begin=r.match,delete r.match}}function Vl(r,a){r.relevance===void 0&&(r.relevance=1)}var Zl=(r,a)=>{if(!r.beforeMatch)return;if(r.starts)throw new Error("beforeMatch cannot be used with starts");let l=Object.assign({},r);Object.keys(r).forEach(d=>{delete r[d]}),r.keywords=l.keywords,r.begin=bn(l.beforeMatch,fo(l.begin)),r.starts={relevance:0,contains:[Object.assign(l,{endsParent:!0})]},r.relevance=0,delete l.beforeMatch},Xl=["of","and","for","in","not","or","if","then","parent","list","value"],Yl="keyword";function vo(r,a,l=Yl){let d=Object.create(null);return typeof r=="string"?u(l,r.split(" ")):Array.isArray(r)?u(l,r):Object.keys(r).forEach(function(h){Object.assign(d,vo(r[h],a,h))}),d;function u(h,f){a&&(f=f.map(m=>m.toLowerCase())),f.forEach(function(m){let b=m.split("|");d[b[0]]=[h,Jl(b[0],b[1])]})}}function Jl(r,a){return a?Number(a):Ql(r)?0:1}function Ql(r){return Xl.includes(r.toLowerCase())}var lo={},gn=r=>{console.error(r)},co=(r,...a)=>{console.log(`WARN: ${r}`,...a)},Cn=(r,a)=>{lo[`${r}/${a}`]||(console.log(`Deprecated as of ${r}. ${a}`),lo[`${r}/${a}`]=!0)},ar=new Error;function ko(r,a,{key:l}){let d=0,u=r[l],h={},f={};for(let m=1;m<=a.length;m++)f[m+d]=u[m],h[m+d]=!0,d+=go(a[m-1]);r[l]=f,r[l]._emit=h,r[l]._multi=!0}function ec(r){if(Array.isArray(r.begin)){if(r.skip||r.excludeBegin||r.returnBegin)throw gn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ar;if(typeof r.beginScope!="object"||r.beginScope===null)throw gn("beginScope must be object"),ar;ko(r,r.begin,{key:"beginScope"}),r.begin=Gr(r.begin,{joinWith:""})}}function tc(r){if(Array.isArray(r.end)){if(r.skip||r.excludeEnd||r.returnEnd)throw gn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ar;if(typeof r.endScope!="object"||r.endScope===null)throw gn("endScope must be object"),ar;ko(r,r.end,{key:"endScope"}),r.end=Gr(r.end,{joinWith:""})}}function nc(r){r.scope&&typeof r.scope=="object"&&r.scope!==null&&(r.beginScope=r.scope,delete r.scope)}function rc(r){nc(r),typeof r.beginScope=="string"&&(r.beginScope={_wrap:r.beginScope}),typeof r.endScope=="string"&&(r.endScope={_wrap:r.endScope}),ec(r),tc(r)}function sc(r){function a(f,m){return new RegExp(Un(f),"m"+(r.case_insensitive?"i":"")+(r.unicodeRegex?"u":"")+(m?"g":""))}class l{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(m,b){b.position=this.position++,this.matchIndexes[this.matchAt]=b,this.regexes.push([b,m]),this.matchAt+=go(m)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let m=this.regexes.map(b=>b[1]);this.matcherRe=a(Gr(m,{joinWith:"|"}),!0),this.lastIndex=0}exec(m){this.matcherRe.lastIndex=this.lastIndex;let b=this.matcherRe.exec(m);if(!b)return null;let k=b.findIndex((I,M)=>M>0&&I!==void 0),S=this.matchIndexes[k];return b.splice(0,k),Object.assign(b,S)}}class d{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(m){if(this.multiRegexes[m])return this.multiRegexes[m];let b=new l;return this.rules.slice(m).forEach(([k,S])=>b.addRule(k,S)),b.compile(),this.multiRegexes[m]=b,b}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(m,b){this.rules.push([m,b]),b.type==="begin"&&this.count++}exec(m){let b=this.getMatcher(this.regexIndex);b.lastIndex=this.lastIndex;let k=b.exec(m);if(this.resumingScanAtSamePosition()&&!(k&&k.index===this.lastIndex)){let S=this.getMatcher(0);S.lastIndex=this.lastIndex+1,k=S.exec(m)}return k&&(this.regexIndex+=k.position+1,this.regexIndex===this.count&&this.considerAll()),k}}function u(f){let m=new d;return f.contains.forEach(b=>m.addRule(b.begin,{rule:b,type:"begin"})),f.terminatorEnd&&m.addRule(f.terminatorEnd,{type:"end"}),f.illegal&&m.addRule(f.illegal,{type:"illegal"}),m}function h(f,m){let b=f;if(f.isCompiled)return b;[Gl,Wl,rc,Zl].forEach(S=>S(f,m)),r.compilerExtensions.forEach(S=>S(f,m)),f.__beforeBegin=null,[jl,Kl,Vl].forEach(S=>S(f,m)),f.isCompiled=!0;let k=null;return typeof f.keywords=="object"&&f.keywords.$pattern&&(f.keywords=Object.assign({},f.keywords),k=f.keywords.$pattern,delete f.keywords.$pattern),k=k||/\w+/,f.keywords&&(f.keywords=vo(f.keywords,r.case_insensitive)),b.keywordPatternRe=a(k,!0),m&&(f.begin||(f.begin=/\B|\b/),b.beginRe=a(b.begin),!f.end&&!f.endsWithParent&&(f.end=/\B|\b/),f.end&&(b.endRe=a(b.end)),b.terminatorEnd=Un(b.end)||"",f.endsWithParent&&m.terminatorEnd&&(b.terminatorEnd+=(f.end?"|":"")+m.terminatorEnd)),f.illegal&&(b.illegalRe=a(f.illegal)),f.contains||(f.contains=[]),f.contains=[].concat(...f.contains.map(function(S){return oc(S==="self"?f:S)})),f.contains.forEach(function(S){h(S,b)}),f.starts&&h(f.starts,m),b.matcher=u(b),b}if(r.compilerExtensions||(r.compilerExtensions=[]),r.contains&&r.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return r.classNameAliases=dn(r.classNameAliases||{}),h(r)}function Eo(r){return r?r.endsWithParent||Eo(r.starts):!1}function oc(r){return r.variants&&!r.cachedVariants&&(r.cachedVariants=r.variants.map(function(a){return dn(r,{variants:null},a)})),r.cachedVariants?r.cachedVariants:Eo(r)?dn(r,{starts:r.starts?dn(r.starts):null}):Object.isFrozen(r)?dn(r):r}var ic="11.11.1",Ur=class extends Error{constructor(a,l){super(a),this.name="HTMLInjectionError",this.html=l}},Dr=mo,uo=dn,po=Symbol("nomatch"),ac=7,So=function(r){let a=Object.create(null),l=Object.create(null),d=[],u=!0,h="Could not find the language '{}', did you forget to load/include a language module?",f={disableAutodetect:!0,name:"Plain text",contains:[]},m={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:zr};function b(F){return m.noHighlightRe.test(F)}function k(F){let J=F.className+" ";J+=F.parentNode?F.parentNode.className:"";let H=m.languageDetectRe.exec(J);if(H){let fe=be(H[1]);return fe||(co(h.replace("{}",H[1])),co("Falling back to no-highlight mode for this block.",F)),fe?H[1]:"no-highlight"}return J.split(/\s+/).find(fe=>b(fe)||be(fe))}function S(F,J,H){let fe="",Ee="";typeof J=="object"?(fe=F,H=J.ignoreIllegals,Ee=J.language):(Cn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Cn("10.7.0",`Please use highlight(code, options) instead.
|
|
3
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Ee=F,fe=J),H===void 0&&(H=!0);let ze={code:fe,language:Ee};qe("before:highlight",ze);let Ne=ze.result?ze.result:I(ze.language,ze.code,H);return Ne.code=ze.code,qe("after:highlight",Ne),Ne}function I(F,J,H,fe){let Ee=Object.create(null);function ze(re,ke){return re.keywords[ke]}function Ne(){if(!B.keywords){Y.addText(ge);return}let re=0;B.keywordPatternRe.lastIndex=0;let ke=B.keywordPatternRe.exec(ge),He="";for(;ke;){He+=ge.substring(re,ke.index);let _e=we.case_insensitive?ke[0].toLowerCase():ke[0],Le=ze(B,_e);if(Le){let[Qe,Oe]=Le;if(Y.addText(He),He="",Ee[_e]=(Ee[_e]||0)+1,Ee[_e]<=ac&&(V+=Oe),Qe.startsWith("_"))He+=ke[0];else{let Ye=we.classNameAliases[Qe]||Qe;O(ke[0],Ye)}}else He+=ke[0];re=B.keywordPatternRe.lastIndex,ke=B.keywordPatternRe.exec(ge)}He+=ge.substring(re),Y.addText(He)}function s(){if(ge==="")return;let re=null;if(typeof B.subLanguage=="string"){if(!a[B.subLanguage]){Y.addText(ge);return}re=I(B.subLanguage,ge,!0,X[B.subLanguage]),X[B.subLanguage]=re._top}else re=C(ge,B.subLanguage.length?B.subLanguage:null);B.relevance>0&&(V+=re.relevance),Y.__addSublanguage(re._emitter,re.language)}function o(){B.subLanguage!=null?s():Ne(),ge=""}function O(re,ke){re!==""&&(Y.startScope(ke),Y.addText(re),Y.endScope())}function Be(re,ke){let He=1,_e=ke.length-1;for(;He<=_e;){if(!re._emit[He]){He++;continue}let Le=we.classNameAliases[re[He]]||re[He],Qe=ke[He];Le?O(Qe,Le):(ge=Qe,Ne(),ge=""),He++}}function P(re,ke){return re.scope&&typeof re.scope=="string"&&Y.openNode(we.classNameAliases[re.scope]||re.scope),re.beginScope&&(re.beginScope._wrap?(O(ge,we.classNameAliases[re.beginScope._wrap]||re.beginScope._wrap),ge=""):re.beginScope._multi&&(Be(re.beginScope,ke),ge="")),B=Object.create(re,{parent:{value:B}}),B}function Ue(re,ke,He){let _e=Sl(re.endRe,He);if(_e){if(re["on:end"]){let Le=new ir(re);re["on:end"](ke,Le),Le.isMatchIgnored&&(_e=!1)}if(_e){for(;re.endsParent&&re.parent;)re=re.parent;return re}}if(re.endsWithParent)return Ue(re.parent,ke,He)}function nt(re){return B.matcher.regexIndex===0?(ge+=re[0],1):(Je=!0,0)}function W(re){let ke=re[0],He=re.rule,_e=new ir(He),Le=[He.__beforeBegin,He["on:begin"]];for(let Qe of Le)if(Qe&&(Qe(re,_e),_e.isMatchIgnored))return nt(ke);return He.skip?ge+=ke:(He.excludeBegin&&(ge+=ke),o(),!He.returnBegin&&!He.excludeBegin&&(ge=ke)),P(He,re),He.returnBegin?0:ke.length}function Ae(re){let ke=re[0],He=J.substring(re.index),_e=Ue(B,re,He);if(!_e)return po;let Le=B;B.endScope&&B.endScope._wrap?(o(),O(ke,B.endScope._wrap)):B.endScope&&B.endScope._multi?(o(),Be(B.endScope,re)):Le.skip?ge+=ke:(Le.returnEnd||Le.excludeEnd||(ge+=ke),o(),Le.excludeEnd&&(ge=ke));do B.scope&&Y.closeNode(),!B.skip&&!B.subLanguage&&(V+=B.relevance),B=B.parent;while(B!==_e.parent);return _e.starts&&P(_e.starts,re),Le.returnEnd?0:ke.length}function Q(){let re=[];for(let ke=B;ke!==we;ke=ke.parent)ke.scope&&re.unshift(ke.scope);re.forEach(ke=>Y.openNode(ke))}let ye={};function x(re,ke){let He=ke&&ke[0];if(ge+=re,He==null)return o(),0;if(ye.type==="begin"&&ke.type==="end"&&ye.index===ke.index&&He===""){if(ge+=J.slice(ke.index,ke.index+1),!u){let _e=new Error(`0 width match regex (${F})`);throw _e.languageName=F,_e.badRule=ye.rule,_e}return 1}if(ye=ke,ke.type==="begin")return W(ke);if(ke.type==="illegal"&&!H){let _e=new Error('Illegal lexeme "'+He+'" for mode "'+(B.scope||"<unnamed>")+'"');throw _e.mode=B,_e}else if(ke.type==="end"){let _e=Ae(ke);if(_e!==po)return _e}if(ke.type==="illegal"&&He==="")return ge+=`
|
|
4
|
+
`,1;if(Fe>1e5&&Fe>ke.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ge+=He,He.length}let we=be(F);if(!we)throw gn(h.replace("{}",F)),new Error('Unknown language: "'+F+'"');let g=sc(we),j="",B=fe||g,X={},Y=new m.__emitter(m);Q();let ge="",V=0,ne=0,Fe=0,Je=!1;try{if(we.__emitTokens)we.__emitTokens(J,Y);else{for(B.matcher.considerAll();;){Fe++,Je?Je=!1:B.matcher.considerAll(),B.matcher.lastIndex=ne;let re=B.matcher.exec(J);if(!re)break;let ke=J.substring(ne,re.index),He=x(ke,re);ne=re.index+He}x(J.substring(ne))}return Y.finalize(),j=Y.toHTML(),{language:F,value:j,relevance:V,illegal:!1,_emitter:Y,_top:B}}catch(re){if(re.message&&re.message.includes("Illegal"))return{language:F,value:Dr(J),illegal:!0,relevance:0,_illegalBy:{message:re.message,index:ne,context:J.slice(ne-100,ne+100),mode:re.mode,resultSoFar:j},_emitter:Y};if(u)return{language:F,value:Dr(J),illegal:!1,relevance:0,errorRaised:re,_emitter:Y,_top:B};throw re}}function M(F){let J={value:Dr(F),illegal:!1,relevance:0,_top:f,_emitter:new m.__emitter(m)};return J._emitter.addText(F),J}function C(F,J){J=J||m.languages||Object.keys(a);let H=M(F),fe=J.filter(be).filter(Xe).map(o=>I(o,F,!1));fe.unshift(H);let Ee=fe.sort((o,O)=>{if(o.relevance!==O.relevance)return O.relevance-o.relevance;if(o.language&&O.language){if(be(o.language).supersetOf===O.language)return 1;if(be(O.language).supersetOf===o.language)return-1}return 0}),[ze,Ne]=Ee,s=ze;return s.secondBest=Ne,s}function $(F,J,H){let fe=J&&l[J]||H;F.classList.add("hljs"),F.classList.add(`language-${fe}`)}function q(F){let J=null,H=k(F);if(b(H))return;if(qe("before:highlightElement",{el:F,language:H}),F.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",F);return}if(F.children.length>0&&(m.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(F)),m.throwUnescapedHTML))throw new Ur("One of your code blocks includes unescaped HTML.",F.innerHTML);J=F;let fe=J.textContent,Ee=H?S(fe,{language:H,ignoreIllegals:!0}):C(fe);F.innerHTML=Ee.value,F.dataset.highlighted="yes",$(F,H,Ee.language),F.result={language:Ee.language,re:Ee.relevance,relevance:Ee.relevance},Ee.secondBest&&(F.secondBest={language:Ee.secondBest.language,relevance:Ee.secondBest.relevance}),qe("after:highlightElement",{el:F,result:Ee,text:fe})}function he(F){m=uo(m,F)}let se=()=>{me(),Cn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ce(){me(),Cn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let U=!1;function me(){function F(){me()}if(document.readyState==="loading"){U||window.addEventListener("DOMContentLoaded",F,!1),U=!0;return}document.querySelectorAll(m.cssSelector).forEach(q)}function Te(F,J){let H=null;try{H=J(r)}catch(fe){if(gn("Language definition for '{}' could not be registered.".replace("{}",F)),u)gn(fe);else throw fe;H=f}H.name||(H.name=F),a[F]=H,H.rawDefinition=J.bind(null,r),H.aliases&&Ce(H.aliases,{languageName:F})}function $e(F){delete a[F];for(let J of Object.keys(l))l[J]===F&&delete l[J]}function Re(){return Object.keys(a)}function be(F){return F=(F||"").toLowerCase(),a[F]||a[l[F]]}function Ce(F,{languageName:J}){typeof F=="string"&&(F=[F]),F.forEach(H=>{l[H.toLowerCase()]=J})}function Xe(F){let J=be(F);return J&&!J.disableAutodetect}function xe(F){F["before:highlightBlock"]&&!F["before:highlightElement"]&&(F["before:highlightElement"]=J=>{F["before:highlightBlock"](Object.assign({block:J.el},J))}),F["after:highlightBlock"]&&!F["after:highlightElement"]&&(F["after:highlightElement"]=J=>{F["after:highlightBlock"](Object.assign({block:J.el},J))})}function E(F){xe(F),d.push(F)}function Ie(F){let J=d.indexOf(F);J!==-1&&d.splice(J,1)}function qe(F,J){let H=F;d.forEach(function(fe){fe[H]&&fe[H](J)})}function De(F){return Cn("10.7.0","highlightBlock will be removed entirely in v12.0"),Cn("10.7.0","Please use highlightElement now."),q(F)}Object.assign(r,{highlight:S,highlightAuto:C,highlightAll:me,highlightElement:q,highlightBlock:De,configure:he,initHighlighting:se,initHighlightingOnLoad:ce,registerLanguage:Te,unregisterLanguage:$e,listLanguages:Re,getLanguage:be,registerAliases:Ce,autoDetection:Xe,inherit:uo,addPlugin:E,removePlugin:Ie}),r.debugMode=function(){u=!1},r.safeMode=function(){u=!0},r.versionString=ic,r.regex={concat:bn,lookahead:fo,either:Hr,optional:kl,anyNumberOfTimes:vl};for(let F in or)typeof or[F]=="object"&&ho(or[F]);return Object.assign(r,or),r},Nn=So({});Nn.newInstance=()=>So({});Ao.exports=Nn;Nn.HighlightJS=Nn;Nn.default=Nn});var _d={};Fa(_d,{init:()=>Sd,initTerminals:()=>Ad,registerBuildProvider:()=>jn,version:()=>Ed});ae();le();ae();le();ae();le();var ja=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),Ka=new Set(["defs","title","desc","style","metadata"]),js=new Map;function Ks(r,a){js.set(r,a)}function rr(r){return[...r.children].filter(a=>{let l=a.tagName.toLowerCase();return!(Ka.has(l)||l==="aside"&&a.classList.contains("notes")||a.hasAttribute("data-build-stay"))})}function Wa(r){if(r.hasAttribute("data-build-self"))return!1;let a=r.tagName.toUpperCase();return ja.has(a)?!0:a==="DIV"||a==="G"?rr(r).length>=2:!1}function Va(r){if(r.tagName.toUpperCase()==="TABLE"){let l=r.querySelector(":scope > tbody");return l?rr(l):rr(r).filter(d=>d.tagName==="TR")}return rr(r)}function Za(r){let a=r.map((f,m)=>({...f,i:m}));a.sort((f,m)=>f.key-m.key||f.i-m.i);let l=[],d=null,u=null,h=!1;for(let f of a){if(d&&f.explicit&&h&&f.key===u){d.push(f.i);continue}d=[f.i],u=f.key,h=f.explicit,l.push(d)}return l}function Hs(r,a){r.classList.add("build-step"),r.setAttribute("data-build-style",a),r.setAttribute("data-build-state","pending"),a==="draw"&&Xa(r)}var Gs="path, line, polyline, polygon, circle, ellipse, rect";function Xa(r){let a=r.matches?.(Gs)?[r]:[...r.querySelectorAll(Gs)],l=!1;for(let u of a){let h=u.getAttribute("stroke")??getComputedStyle(u).stroke;if(!h||h==="none")continue;let f=0;try{f=u.getTotalLength()}catch{continue}if(!f)continue;l=!0;let m=u.getAttribute("stroke-dasharray")||u.style.strokeDasharray;m&&(u.dataset.drawOrig=m);for(let[b,k]of Ir){let S=u.getAttribute(b);S&&(u.dataset[k]=S)}u.classList.add("draw-stroke"),u.style.setProperty("--draw-len",String(Math.ceil(f)))}r.querySelectorAll("text, tspan").forEach(u=>u.classList.add("draw-fade")),l||r.setAttribute("data-build-style","fade")}var Ir=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function nr(r,a){for(let[l,d]of Ir)d in r.dataset&&(a?r.setAttribute(l,r.dataset[d]):r.removeAttribute(l))}function Ya(r,a){for(let l of r.querySelectorAll(".draw-stroke")){let d=l.dataset.drawOrig,u=Ir.some(([,h])=>h in l.dataset);if(!(!d&&!u))if(a==="done")d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),nr(l,!0);else if(a==="pending")l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),nr(l,!1);else{l.style.removeProperty("stroke-dasharray"),l.style.removeProperty("stroke-dashoffset"),nr(l,!1);let h=()=>{r.getAttribute("data-build-state")!=="pending"&&(d&&(l.style.strokeDasharray=d,l.style.strokeDashoffset="0"),nr(l,!0))},f=parseFloat(getComputedStyle(l).transitionDuration)||0;f===0?h():(l.addEventListener("transitionend",h,{once:!0}),setTimeout(h,f*1e3+150))}}}function Br(r){let a=[],l=[],d=new Set,u=0,h=(S,I)=>{let M=I!=null&&I!=="",C=M?parseInt(I,10):u;a.push(S),l.push({key:Number.isFinite(C)?C:u,explicit:M}),u++},f=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT);for(let S=f.nextNode();S;S=f.nextNode()){if(d.has(S))continue;let I=js.get(S);if(I){for(let C=0;C<I.count;C++)h({kind:"provider",provider:I,el:S,sub:C},null);S.querySelectorAll("*").forEach(C=>d.add(C));continue}if(!S.hasAttribute("data-build"))continue;let M=S.getAttribute("data-build")||"fade";if(Wa(S)){for(let C of Va(S)){d.add(C),C.querySelectorAll("[data-build]").forEach(q=>d.add(q));let $=C.getAttribute("data-build")||M;Hs(C,$),h({kind:"dom",el:C,container:S},C.getAttribute("data-build-order"))}S.setAttribute("data-build-container","")}else Hs(S,M),h({kind:"dom",el:S,container:null},S.getAttribute("data-build-order"))}let m=Za(l),b=[],k=new Map;return a.forEach((S,I)=>{if(S.kind==="provider"){if(!k.has(S.provider)){let M={el:S.el,provider:S.provider,stepIdxs:[]};k.set(S.provider,M),b.push(M)}k.get(S.provider).stepIdxs.push(I)}}),{steps:a,groups:m,providers:b}}function cn(r,a){let l=new Set;r.groups.forEach((f,m)=>{for(let b of f)m<a&&l.add(b)});let d=a>0?r.groups[a-1]??[]:[],u=new Set(d),h=new Set;r.steps.forEach((f,m)=>{if(f.kind!=="dom")return;let b=u.has(m)?"current":l.has(m)?"done":"pending";f.el.setAttribute("data-build-state",b),f.el.getAttribute("data-build-style")==="draw"&&Ya(f.el,b),f.container&&h.add(f.container)});for(let f of h){let m=!!f.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');f.classList.toggle("has-current-highlight",m)}for(let f of r.providers){let m=f.stepIdxs.filter(b=>l.has(b)||u.has(b)).length;f._last!==m&&(f._last=m,f.provider.apply(m))}}function Ws(r){return r.groups.map(a=>{let l=r.steps[a[0]];if(l.kind==="provider"){let u=l.sub;return l.provider.label?l.provider.label(u+1):"step"}return l.el.textContent.trim().replace(/\s+/g," ").slice(0,60)||l.el.tagName.toLowerCase()})}ae();le();var Vs="rect, circle, ellipse, polygon, polyline, path";function Ja(r){let a=5381;for(let l of String(r))a=(a*33^l.charCodeAt(0))>>>0;return 1+a%6}function Qa(r,a={}){let l=a[r];return typeof l=="number"?`var(--d-fill-${l})`:typeof l=="string"?l:`var(--d-fill-${Ja(r)})`}function Zs(r,a={}){let l=new Map;r.querySelectorAll("svg [data-concept]").forEach(d=>{let u=d.getAttribute("data-concept");if(!u)return;let h=Qa(u,a),f=h.match(/--d-fill-(\d)/);if(f){let b=l.get(f[1]);b&&b!==u?console.warn(`Decklight: concepts "${b}" and "${u}" share fill slot ${f[1]} \u2014 pin one explicitly via init({ concepts: { ${u}: <1-6> } })`):l.set(f[1],u)}let m=d.matches(Vs)?[d]:[...d.children].filter(b=>b.matches(Vs));for(let b of m){let k=b.getAttribute("fill")==="none"||b.style.fill==="none";b.style.setProperty(k?"stroke":"fill",h)}})}var el=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function Xs(r){r.querySelectorAll("svg").forEach((a,l)=>{let d=`svg${l}-`,u=new Map;if(a.querySelectorAll("[id]").forEach(f=>{let m=f.id;u.set(m,d+m),f.id=d+m}),u.size===0)return;let h=f=>f.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(m,b)=>u.has(b)?`url(#${u.get(b)})`:m);a.querySelectorAll("*").forEach(f=>{for(let m of el){let b=f.getAttribute(m);b&&b.includes("url(#")&&f.setAttribute(m,h(b))}for(let m of["href","xlink:href"]){let b=f.getAttribute(m);b&&b.startsWith("#")&&u.has(b.slice(1))&&f.setAttribute(m,"#"+u.get(b.slice(1)))}})})}ae();le();ae();le();var vt=r=>String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");var Ys=640,tl=360,Js=["bar","line","area","pie","donut"],ve=r=>{let a=Math.round(r*100)/100;return Object.is(a,-0)?"0":String(a)},_n=r=>`var(--d-fill-${r%6+1})`;function nl(r,a={}){let l;if(typeof r=="string")try{l=JSON.parse(r)}catch(k){throw new Error(`invalid JSON \u2014 ${k.message}`)}else if(r&&typeof r=="object")l=r;else throw new Error('no data \u2014 expected a <script type="application/json"> child (or the fence body)');let d=String(a.type||l.type||"").toLowerCase();if(!Js.includes(d))throw new Error(`unknown type "${d}" \u2014 use ${Js.join(" | ")}`);if(!Array.isArray(l.labels)||l.labels.length===0)throw new Error('"labels" must be a non-empty array');if(!Array.isArray(l.series)||l.series.length===0)throw new Error('"series" must be a non-empty array');let u=l.labels.map(String),h=l.series.map((k,S)=>{if(!k||!Array.isArray(k.data))throw new Error(`series ${S+1}: "data" must be an array of numbers`);return{name:k.name!=null?String(k.name):`series ${S+1}`,concept:k.concept!=null?String(k.concept):null,data:u.map((I,M)=>{let C=Number(k.data[M]);return Number.isFinite(C)?C:null})}}),f=d==="pie"||d==="donut";if(f&&h.length>1)throw new Error("pie takes exactly one series (labels are the slices)");if(f&&!h[0].data.some(k=>k>0))throw new Error("pie needs at least one positive value");let m=tl,b=a.aspect??l.aspect??null;if(b!=null){let k=String(b).match(/^\s*(\d+(?:\.\d+)?)\s*[:x]\s*(\d+(?:\.\d+)?)\s*$/i);if(!k||+k[1]==0)throw new Error(`bad aspect "${b}" \u2014 use "w:h", e.g. "4:3"`);m=Math.round(Ys*+k[2]/+k[1])}return{type:f?"pie":d,donut:d==="donut"||l.donut===!0,title:a.title??(l.title!=null?String(l.title):null),labels:u,series:h,legend:l.legend,width:Ys,height:m,build:l.build}}function rl(r,a,l=5){if(!Number.isFinite(r)||!Number.isFinite(a))throw new Error("niceTicks: non-finite range");if(r>a&&([r,a]=[a,r]),r===a){let I=r===0?1:Math.abs(r)/2;r-=r===0?0:I,a+=I}let d=(a-r)/Math.max(1,l-1),u=10**Math.floor(Math.log10(d)),h=d/u,f=(h<=1?1:h<=2?2:h<=2.5?2.5:h<=5?5:10)*u,m=Math.floor(r/f+1e-9)*f,b=Math.ceil(a/f-1e-9)*f,k=Math.max(1,Math.round((b-m)/f)),S=Array.from({length:k+1},(I,M)=>+(m+M*f).toPrecision(12));return{min:S[0],max:S[k],step:f,ticks:S}}function sl(r,a){let l=0;for(;l<6&&Math.abs(Math.round(a*10**l)-a*10**l)>1e-9;)l++;return r.toFixed(l)}function ol(r,a,l,d){let u=d.max-d.min||1,h=S=>l.y+l.h*(1-(S-d.min)/u),f=h(Math.max(d.min,Math.min(d.max,0))),m=l.w/a,b=m*.72,k=b/r.length;return r.map((S,I)=>Array.from({length:a},(M,C)=>{let $=S.data[C];if($==null||!Number.isFinite($))return null;let q=h($);return{x:l.x+C*m+(m-b)/2+I*k+1,y:Math.min(q,f),w:Math.max(1,k-2),h:Math.abs(f-q),value:$}}))}function il(r){let a="",l=!1;for(let d of r){if(!d){l=!1;continue}a+=`${l?"L":"M"}${ve(d.x)} ${ve(d.y)}`,l=!0}return a}function al(r,a){let l=r.filter(Boolean);if(!l.length)return"";let d=`M${ve(l[0].x)} ${ve(a)}`;for(let u of l)d+=`L${ve(u.x)} ${ve(u.y)}`;return d+=`L${ve(l[l.length-1].x)} ${ve(a)}Z`,d}function ll(r,a,l,d,u=0){let h=r.map(k=>Math.max(0,Number(k)||0)),f=h.reduce((k,S)=>k+S,0);if(f<=0)throw new Error("pie needs at least one positive value");let m=(k,S)=>[a+S*Math.cos(k),l+S*Math.sin(k)],b=-Math.PI/2;return h.map(k=>{let S=k/f,I=b,M=b+S*2*Math.PI;b=M;let C=(I+M)/2,$=u>0?(d+u)/2:d*.66,[q,he]=m(C,$),[se,ce]=m(C,d+14),U={value:k,frac:S,mid:C,labelX:q,labelY:he,outX:se,outY:ce,anchor:Math.cos(C)<-1e-6?"end":Math.cos(C)>1e-6?"start":"middle"};if(S===0)return{...U,d:""};let me;if(S>=.9999){let[Te,$e]=m(I,d),[Re,be]=m(I+Math.PI,d);if(me=`M${ve(Te)} ${ve($e)}A${ve(d)} ${ve(d)} 0 1 1 ${ve(Re)} ${ve(be)}A${ve(d)} ${ve(d)} 0 1 1 ${ve(Te)} ${ve($e)}Z`,u>0){let[Ce,Xe]=m(I,u),[xe,E]=m(I+Math.PI,u);me+=`M${ve(Ce)} ${ve(Xe)}A${ve(u)} ${ve(u)} 0 1 0 ${ve(xe)} ${ve(E)}A${ve(u)} ${ve(u)} 0 1 0 ${ve(Ce)} ${ve(Xe)}Z`}}else{let Te=M-I>Math.PI?1:0,[$e,Re]=m(I,d),[be,Ce]=m(M,d);if(u>0){let[Xe,xe]=m(M,u),[E,Ie]=m(I,u);me=`M${ve($e)} ${ve(Re)}A${ve(d)} ${ve(d)} 0 ${Te} 1 ${ve(be)} ${ve(Ce)}L${ve(Xe)} ${ve(xe)}A${ve(u)} ${ve(u)} 0 ${Te} 0 ${ve(E)} ${ve(Ie)}Z`}else me=`M${ve(a)} ${ve(l)}L${ve($e)} ${ve(Re)}A${ve(d)} ${ve(d)} 0 ${Te} 1 ${ve(be)} ${ve(Ce)}Z`}return{...U,d:me}})}var Tn='fill="var(--d-text)"';function Pr(r,a){return`<g class="chart-series" data-series="${a+1}" data-name="${vt(r.name)}"`+(r.concept?` data-concept="${vt(r.concept)}"`:"")+">"}function cl(r,a,l){let d=r.series.flatMap($=>$.data).filter($=>$!=null),u=Math.min(0,...d),h=Math.max(0,...d),f=rl(u,h===u?u+1:h,5),m=f.ticks.map($=>sl($,f.step)),b=14+Math.max(...m.map($=>$.length))*6.6+8,k={x:b,y:r.title||Qs(r)?40:18,w:r.width-b-14,h:0};k.h=r.height-k.y-34;let S=f.max-f.min||1,I=$=>k.y+k.h*(1-($-f.min)/S);f.ticks.forEach(($,q)=>{let he=I($);a.push(`<line class="chart-grid" x1="${ve(k.x)}" y1="${ve(he)}" x2="${ve(k.x+k.w)}" y2="${ve(he)}" stroke="var(--d-muted)" stroke-opacity="0.35" stroke-width="1"/>`),a.push(`<text class="chart-tick" x="${ve(k.x-8)}" y="${ve(he+4)}" text-anchor="end" font-size="11" ${Tn}>${vt(m[q])}</text>`)}),a.push(`<line class="chart-axis" x1="${ve(k.x)}" y1="${ve(k.y)}" x2="${ve(k.x)}" y2="${ve(k.y+k.h)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let M=I(Math.max(f.min,Math.min(f.max,0)));a.push(`<line class="chart-axis" x1="${ve(k.x)}" y1="${ve(M)}" x2="${ve(k.x+k.w)}" y2="${ve(M)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let C=k.w/r.labels.length;if(r.labels.forEach(($,q)=>{a.push(`<text class="chart-cat" x="${ve(k.x+(q+.5)*C)}" y="${ve(k.y+k.h+20)}" text-anchor="middle" font-size="12" ${Tn}>${vt($)}</text>`)}),r.type==="bar"){let $=ol(r.series,r.labels.length,k,f);r.series.forEach((q,he)=>{l.push(Pr(q,he)),$[he].forEach(se=>{se&&l.push(`<rect class="chart-bar draw-fade" x="${ve(se.x)}" y="${ve(se.y)}" width="${ve(se.w)}" height="${ve(se.h)}" rx="2" fill="${_n(he)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`)}),l.push("</g>")})}else r.series.forEach(($,q)=>{let he=$.data.map((U,me)=>U==null?null:{x:k.x+(me+.5)*C,y:I(U)}),se=il(he),ce='stroke-linejoin="round" stroke-linecap="round"';if(l.push(Pr($,q)),r.type==="area"&&l.push(`<path class="chart-area draw-fade" d="${al(he,M)}" fill="${_n(q)}" fill-opacity="0.35"/>`),l.push(`<g class="chart-casing"><path d="${se}" fill="none" stroke="var(--d-stroke)" stroke-width="4.5" ${ce}/></g>`),l.push(`<path class="chart-line" d="${se}" fill="none" stroke="${_n(q)}" stroke-width="2.5" ${ce}/>`),r.type==="line")for(let U of he)U&&l.push(`<circle class="chart-dot draw-fade" cx="${ve(U.x)}" cy="${ve(U.y)}" r="4" fill="${_n(q)}" stroke="var(--d-stroke)" stroke-width="1"/>`);l.push("</g>")})}function dl(r,a){let l=r.title?40:16,d=r.width/2,u=l+(r.height-l-12)/2,h=Math.max(24,Math.min((r.height-l-12)/2-26,r.width/2-110)),f=ll(r.series[0].data.map(m=>m??0),d,u,h,r.donut?h*.55:0);a.push(Pr(r.series[0],0)),f.forEach((m,b)=>{m.d&&(a.push(`<path class="chart-slice draw-fade" d="${m.d}" fill="${_n(b)}" fill-rule="evenodd" stroke="var(--d-stroke)" stroke-width="1.5" stroke-linejoin="round"/>`),a.push(`<text class="chart-cat draw-fade" x="${ve(m.outX)}" y="${ve(m.outY+4)}" text-anchor="${m.anchor}" font-size="12" ${Tn}>${vt(r.labels[b])}</text>`),m.frac>=.05&&a.push(`<text class="chart-value draw-fade" x="${ve(m.labelX)}" y="${ve(m.labelY+4)}" text-anchor="middle" font-size="12" font-weight="600" ${Tn}>${Math.round(m.frac*100)}%</text>`))}),a.push("</g>")}function Qs(r){return r.legend===!0?!0:r.legend===!1?!1:r.type!=="pie"&&r.series.length>1}function ul(r){let a=[],l=[];if(r.title&&a.push(`<text class="chart-title" x="14" y="24" font-size="15" font-weight="600" ${Tn}>${vt(r.title)}</text>`),Qs(r)){let u=r.series.map(f=>({name:f.name,w:f.name.length*6.6+24})),h=r.width-14-u.reduce((f,m)=>f+m.w,0);r.series.forEach((f,m)=>{a.push(`<rect class="chart-swatch" x="${ve(h)}" y="14" width="11" height="11" rx="2" fill="${_n(m)}" stroke="var(--d-stroke)" stroke-width="1"/>`),a.push(`<text class="chart-legend" x="${ve(h+16)}" y="24" font-size="12" ${Tn}>${vt(f.name)}</text>`),h+=u[m].w})}r.type==="pie"?dl(r,l):cl(r,a,l);let d=r.title?`${r.title} \u2014 ${r.type} chart`:`${r.type} chart`;return`<svg class="chart-svg" viewBox="0 0 ${r.width} ${r.height}" role="img" aria-label="${vt(d)}" preserveAspectRatio="xMidYMid meet"><g class="chart-chrome" data-build-stay>${a.join("")}</g>`+l.join("")+"</svg>"}function eo(r){r.querySelectorAll("[data-chart]").forEach(a=>{if(a.querySelector(":scope > svg.chart-svg, :scope > .chart-broken"))return;a.classList.add("chart");let l=a.querySelector('script[type="application/json"]');try{let d=nl(l?l.textContent:null,{type:a.getAttribute("data-chart")||void 0,title:a.getAttribute("data-title")||void 0,aspect:a.getAttribute("data-aspect")||void 0}),u=document.createElement("template");u.innerHTML=ul(d);let h=u.content.firstElementChild;a.hasAttribute("data-build")?(h.setAttribute("data-build",a.getAttribute("data-build")),a.removeAttribute("data-build")):d.build!=null&&d.build!==!1&&h.setAttribute("data-build",d.build===!0?"":String(d.build)),a.getAttribute("data-chart")||a.setAttribute("data-chart",d.donut?"donut":d.type),a.insertBefore(h,l)}catch(d){let u=document.createElement("div");u.className="chart-broken",u.textContent=`chart: ${d.message||d}`,a.insertBefore(u,l)}})}ae();le();var sr=["opacity","color","backgroundColor","borderRadius","fontSize"],pl=["transform",...sr.map(r=>r.replace(/[A-Z]/g,a=>"-"+a.toLowerCase()))];function to(r){let a=getComputedStyle(r),l={rect:r.getBoundingClientRect()};for(let d of sr)l[d]=a[d];return l}function hl(r,a){if(r.ownerSVGElement){let l=r.getScreenCTM?.();if(l&&l.a&&l.d)return{x:l.a,y:l.d}}return{x:a,y:a}}function no(r,a,l){let d=getComputedStyle(a).getPropertyValue("--auto-animate-duration").trim(),u=(d.endsWith("ms")?parseFloat(d):d.endsWith("s")?parseFloat(d)*1e3:parseFloat(d))||500,h=new Map;r.querySelectorAll("[data-id]").forEach(b=>{h.set(b.getAttribute("data-id"),to(b))});let f=[];a.querySelectorAll("[data-id]").forEach(b=>{let k=h.get(b.getAttribute("data-id"));k&&f.push({el:b,o:k})});for(let{el:b,o:k}of f){let S=to(b),I=hl(b,l),M=(k.rect.left-S.rect.left)/I.x,C=(k.rect.top-S.rect.top)/I.y,$=b.children.length===0&&k.fontSize!==S.fontSize,q=$?1:S.rect.width?k.rect.width/S.rect.width:1,he=$?1:S.rect.height?k.rect.height/S.rect.height:1,se=b.getAttribute("style")??"";b.style.transition="none",b.ownerSVGElement&&(b.style.transformBox="fill-box"),b.style.transformOrigin="0 0",b.style.transform=`translate(${M}px, ${C}px) scale(${q}, ${he})`;for(let U of sr)b.style[U]=k[U];b.offsetWidth,b.style.transition=pl.map(U=>`${U} ${u}ms ease`).join(", "),b.style.transform="";for(let U of sr)b.style[U]=S[U];let ce=()=>{se?b.setAttribute("style",se):b.removeAttribute("style"),b.removeEventListener("transitionend",ce)};b.addEventListener("transitionend",ce),setTimeout(ce,u+80)}let m=new Set(f.map(b=>b.el));return[...a.children].forEach(b=>{b.matches("aside.notes")||m.has(b)||[...m].some(S=>b.contains(S))||(b.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>b.classList.add("aa-in"))),setTimeout(()=>b.classList.remove("aa-fresh","aa-in"),u+120))}),u}ae();le();ae();le();var ro=function(){"use strict";class r{constructor(t,n){let i,c=" "+t,p=n&&n.loc;if(p&&p.start<=p.end){let v=p.lexer.input;i=p.start;let D=p.end;i===v.length?c+=" at end of input: ":c+=" at position "+(i+1)+`:
|
|
5
|
+
`;let z=v.slice(i,D).replace(/[^]/g,"$&\u0332"),oe,de;oe=i>15?"\u2026"+v.slice(i-15,i):v.slice(0,i),de=D+15<v.length?v.slice(D,D+15)+"\u2026":v.slice(D),c+=oe+z+de}let y=new Error(c);return y.name="ParseError",y.__proto__=r.prototype,y.position=i,y}}r.prototype.__proto__=Error.prototype;let a=function(e,t){return e===void 0?t:e},l=/([A-Z])/g,d=function(e){return e.replace(l,"-$1").toLowerCase()},u={"&":"&",">":">","<":"<",'"':""","'":"'"},h=/[&><"']/g;function f(e){return String(e).replace(h,t=>u[t])}let m=function(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?m(e.body[0]):e:e.type==="font"?m(e.body):e},b=function(e){let t=m(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},k=function(e){return+e.toFixed(4)},S="aceg\u0131\u0237mnopqrsuvwxyz\u03B1\u03B3\u03B5\u03B7\u03B9\u03BA\u03BC\u03BD\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C7\u03C9\u03D5\u{1D41A}\u{1D41C}\u{1D41E}\u{1D420}\u{1D426}\u{1D427}\u{1D428}\u{1D429}\u{1D42A}\u{1D42B}\u{1D42C}\u{1D42E}\u{1D42F}\u{1D430}\u{1D431}\u{1D432}\u{1D433}";class I{constructor(t){t=t||{},this.displayMode=a(t.displayMode,!1),this.annotate=a(t.annotate,!1),this.leqno=a(t.leqno,!1),this.throwOnError=a(t.throwOnError,!1),this.errorColor=a(t.errorColor,"#b22222"),this.macros=t.macros||{},this.wrap=a(t.wrap,"none"),this.xml=a(t.xml,!1),this.colorIsTextColor=a(t.colorIsTextColor,!1),this.strict=a(t.strict,!1),this.trust=a(t.trust,!1),this.maxSize=t.maxSize===void 0?[1/0,1/0]:Array.isArray(t.maxSize)?t.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,a(t.maxExpand,1e3)),this.wrapDelimiterPairs=!0}isTrusted(t){if(t.url&&!t.protocol){let i=function(c){let p=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(c);return p?p[2]!==":"?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(p[1])?p[1].toLowerCase():null:"_relative"}(t.url);if(i==null)return!1;t.protocol=i}return!!(typeof this.trust=="function"?this.trust(t):this.trust)}}let M={},C={};function $({type:e,names:t,props:n,handler:i,mathmlBuilder:c}){let p={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0||n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i};for(let y=0;y<t.length;++y)M[t[y]]=p;e&&c&&(C[e]=c)}function q({type:e,mathmlBuilder:t}){$({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}let he=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},se=function(e){return e.type==="ordgroup"?e.body:[e]};class ce{constructor(t){this.children=t,this.classes=[],this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createDocumentFragment();for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>t.toText()).join("")}}let U=function(e){return e.filter(t=>t).join(" ")},me=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},Te=function(e){let t=document.createElement(e);t.className=U(this.classes);for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t},$e=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${f(U(this.classes))}"`);let n="";for(let i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&(n+=`${d(i)}:${this.style[i]};`);n&&(t+=` style="${n}"`);for(let i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&(t+=` ${i}="${f(this.attributes[i])}"`);t+=">";for(let i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+=`</${e}>`,t};class Re{constructor(t,n,i){me.call(this,t,i),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}toNode(){return Te.call(this,"span")}toMarkup(){return $e.call(this,"span")}}let be=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.text)}};class Ce{constructor(t,n,i){this.href=t,this.classes=n,this.children=i||[]}toNode(){let t=document.createElement("a");t.setAttribute("href",this.href),this.classes.length>0&&(t.className=U(this.classes));for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t=`<a href='${f(this.href)}'`;this.classes.length>0&&(t+=` class="${f(U(this.classes))}"`),t+=">";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</a>",t}}class Xe{constructor(t,n,i){this.alt=n,this.src=t,this.classes=["mord"],this.style=i}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);return t}toMarkup(){let t=`<img src='${this.src}' alt='${this.alt}'`,n="";for(let i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&(n+=`${d(i)}:${this.style[i]};`);return n&&(t+=` style="${f(n)}"`),t+=">",t}}function xe(e){return new ce(e)}class E{constructor(t,n,i,c){this.type=t,this.attributes={},this.children=n||[],this.classes=i||[],this.style=c||{},this.label=""}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}setLabel(t){this.label=t}toNode(){let t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=U(this.classes));for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="<"+this.type;for(let i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&(t+=" "+i+'="',t+=f(this.attributes[i]),t+='"');this.classes.length>0&&(t+=` class="${f(U(this.classes))}"`);let n="";for(let i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&(n+=`${d(i)}:${this.style[i]};`);n&&(t+=` style="${n}"`),t+=">";for(let i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}class Ie{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.toText())}toText(){return this.text}}let qe=e=>{let t;return e.length===1&&e[0].type==="mrow"?(t=e.pop(),t.type="mstyle"):t=new E("mstyle",e),t},De=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(let n of e.body)t+=De(n);else if(e.body)t+=De(e.body);else if(e.type==="supsub")t+=De(e.base),e.sub&&(t+=.7*De(e.sub)),e.sup&&(t+=.7*De(e.sup));else if(e.type==="mathord"||e.type==="textord")for(let n of e.text.split("")){let i=n.codePointAt(0);t+=96<i&&i<123||944<i&&i<970?.56:47<i&&i<58?.5:.92}else t+=1;return t},F={widehat:"^",widecheck:"\u02C7",widetilde:"~",wideparen:"\u23DC",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overbracket:"\u23B4",underbracket:"\u23B5",overgroup:"\u23E0",overparen:"\u23DC",undergroup:"\u23E1",underparen:"\u23DD",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xrightleftarrows:"\u21C4",xtofrom:"\u21C4",xleftrightharpoons:"\u21CB",xrightleftharpoons:"\u21CC",yields:"\u2192",yieldsLeft:"\u2190",mesomerism:"\u2194",longrightharpoonup:"\u21C0",longleftharpoondown:"\u21BD",eqrightharpoonup:"\u21C0",eqleftharpoondown:"\u21BD","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"=",yieldsLeftRight:"\u21C4",chemequilibrium:"\u21CC"},J=function(e){let t=new Ie(F[e.slice(1)]),n=new E("mo",[t]);return n.setAttribute("stretchy","true"),n},H=["\\widetilde","\\widehat","\\widecheck","\\utilde"],fe=e=>{let t=J(e.label);if(H.includes(e.label)){let n=De(e.base);1<n&&n<1.6?t.classes.push("tml-crooked-2"):1.6<=n&&n<2.5?t.classes.push("tml-crooked-3"):2.5<=n&&t.classes.push("tml-crooked-4")}return t},Ee={bin:1,close:1,inner:1,open:1,punct:1,rel:1},ze={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ne={math:{},text:{}};function s(e,t,n,i,c){Ne[e][i]={group:t,replace:n},c&&n&&(Ne[e][n]=Ne[e][i])}let o="math",O="text",Be="accent-token",P="bin",Ue="close",nt="inner",W="mathord",Ae="op-token",Q="open",ye="punct",x="rel",we="spacing",g="textord";s(o,x,"\u2261","\\equiv",!0),s(o,x,"\u227A","\\prec",!0),s(o,x,"\u227B","\\succ",!0),s(o,x,"\u223C","\\sim",!0),s(o,x,"\u27C2","\\perp",!0),s(o,x,"\u2AAF","\\preceq",!0),s(o,x,"\u2AB0","\\succeq",!0),s(o,x,"\u2243","\\simeq",!0),s(o,x,"\u224C","\\backcong",!0),s(o,x,"|","\\mid",!0),s(o,x,"\u226A","\\ll",!0),s(o,x,"\u226B","\\gg",!0),s(o,x,"\u224D","\\asymp",!0),s(o,x,"\u2225","\\parallel"),s(o,x,"\u2323","\\smile",!0),s(o,x,"\u2291","\\sqsubseteq",!0),s(o,x,"\u2292","\\sqsupseteq",!0),s(o,x,"\u2250","\\doteq",!0),s(o,x,"\u2322","\\frown",!0),s(o,x,"\u220B","\\ni",!0),s(o,x,"\u220C","\\notni",!0),s(o,x,"\u221D","\\propto",!0),s(o,x,"\u22A2","\\vdash",!0),s(o,x,"\u22A3","\\dashv",!0),s(o,x,"\u220B","\\owns"),s(o,x,"\u2258","\\arceq",!0),s(o,x,"\u2259","\\wedgeq",!0),s(o,x,"\u225A","\\veeeq",!0),s(o,x,"\u225B","\\stareq",!0),s(o,x,"\u225D","\\eqdef",!0),s(o,x,"\u225E","\\measeq",!0),s(o,x,"\u225F","\\questeq",!0),s(o,x,"\u2260","\\ne",!0),s(o,x,"\u2260","\\neq"),s(o,x,"\u2A75","\\eqeq",!0),s(o,x,"\u2A76","\\eqeqeq",!0),s(o,x,"\u2237","\\dblcolon",!0),s(o,x,"\u2254","\\coloneqq",!0),s(o,x,"\u2255","\\eqqcolon",!0),s(o,x,"\u2239","\\eqcolon",!0),s(o,x,"\u2A74","\\Coloneqq",!0),s(o,ye,".","\\ldotp"),s(o,ye,"\xB7","\\cdotp"),s(o,g,"#","\\#"),s(O,g,"#","\\#"),s(o,g,"&","\\&"),s(O,g,"&","\\&"),s(o,g,"\u2135","\\aleph",!0),s(o,g,"\u2200","\\forall",!0),s(o,g,"\u210F","\\hbar",!0),s(o,g,"\u2203","\\exists",!0),s(o,Q,"\u2207","\\nabla",!0),s(o,g,"\u266D","\\flat",!0),s(o,g,"\u2113","\\ell",!0),s(o,g,"\u266E","\\natural",!0),s(o,g,"\u212B","\\Angstrom",!0),s(O,g,"\u212B","\\Angstrom",!0),s(o,g,"\u2663","\\clubsuit",!0),s(o,g,"\u2667","\\varclubsuit",!0),s(o,g,"\u2118","\\wp",!0),s(o,g,"\u266F","\\sharp",!0),s(o,g,"\u2662","\\diamondsuit",!0),s(o,g,"\u2666","\\vardiamondsuit",!0),s(o,g,"\u211C","\\Re",!0),s(o,g,"\u2661","\\heartsuit",!0),s(o,g,"\u2665","\\varheartsuit",!0),s(o,g,"\u2111","\\Im",!0),s(o,g,"\u2660","\\spadesuit",!0),s(o,g,"\u2664","\\varspadesuit",!0),s(o,g,"\u2640","\\female",!0),s(o,g,"\u2642","\\male",!0),s(o,g,"\xA7","\\S",!0),s(O,g,"\xA7","\\S"),s(o,g,"\xB6","\\P",!0),s(O,g,"\xB6","\\P"),s(O,g,"\u263A","\\smiley",!0),s(o,g,"\u263A","\\smiley",!0),s(o,g,"\u2020","\\dag"),s(O,g,"\u2020","\\dag"),s(O,g,"\u2020","\\textdagger"),s(o,g,"\u2021","\\ddag"),s(O,g,"\u2021","\\ddag"),s(O,g,"\u2021","\\textdaggerdbl"),s(o,Ue,"\u23B1","\\rmoustache",!0),s(o,Q,"\u23B0","\\lmoustache",!0),s(o,Ue,"\u27EF","\\rgroup",!0),s(o,Q,"\u27EE","\\lgroup",!0),s(o,P,"\u2213","\\mp",!0),s(o,P,"\u2296","\\ominus",!0),s(o,P,"\u228E","\\uplus",!0),s(o,P,"\u2293","\\sqcap",!0),s(o,P,"\u2217","\\ast"),s(o,P,"\u2294","\\sqcup",!0),s(o,P,"\u25EF","\\bigcirc",!0),s(o,P,"\u2219","\\bullet",!0),s(o,P,"\u2021","\\ddagger"),s(o,P,"\u2240","\\wr",!0),s(o,P,"\u2A3F","\\amalg"),s(o,P,"&","\\And"),s(o,P,"\u2AFD","\\sslash",!0),s(o,x,"\u27F5","\\longleftarrow",!0),s(o,x,"\u21D0","\\Leftarrow",!0),s(o,x,"\u27F8","\\Longleftarrow",!0),s(o,x,"\u27F6","\\longrightarrow",!0),s(o,x,"\u21D2","\\Rightarrow",!0),s(o,x,"\u27F9","\\Longrightarrow",!0),s(o,x,"\u2194","\\leftrightarrow",!0),s(o,x,"\u27F7","\\longleftrightarrow",!0),s(o,x,"\u21D4","\\Leftrightarrow",!0),s(o,x,"\u27FA","\\Longleftrightarrow",!0),s(o,x,"\u21A4","\\mapsfrom",!0),s(o,x,"\u21A6","\\mapsto",!0),s(o,x,"\u27FC","\\longmapsto",!0),s(o,x,"\u2197","\\nearrow",!0),s(o,x,"\u21A9","\\hookleftarrow",!0),s(o,x,"\u21AA","\\hookrightarrow",!0),s(o,x,"\u2198","\\searrow",!0),s(o,x,"\u21BC","\\leftharpoonup",!0),s(o,x,"\u21C0","\\rightharpoonup",!0),s(o,x,"\u2199","\\swarrow",!0),s(o,x,"\u21BD","\\leftharpoondown",!0),s(o,x,"\u21C1","\\rightharpoondown",!0),s(o,x,"\u2196","\\nwarrow",!0),s(o,x,"\u21CC","\\rightleftharpoons",!0),s(o,W,"\u21AF","\\lightning",!0),s(o,W,"\u220E","\\QED",!0),s(o,W,"\u2030","\\permil",!0),s(O,g,"\u2030","\\permil"),s(o,W,"\u2609","\\astrosun",!0),s(o,W,"\u263C","\\sun",!0),s(o,W,"\u263E","\\leftmoon",!0),s(o,W,"\u263D","\\rightmoon",!0),s(o,W,"\u2295","\\Earth"),s(o,x,"\u226E","\\nless",!0),s(o,x,"\u2A87","\\lneq",!0),s(o,x,"\u2268","\\lneqq",!0),s(o,x,"\u2268\uFE00","\\lvertneqq"),s(o,x,"\u22E6","\\lnsim",!0),s(o,x,"\u2A89","\\lnapprox",!0),s(o,x,"\u2280","\\nprec",!0),s(o,x,"\u22E0","\\npreceq",!0),s(o,x,"\u22E8","\\precnsim",!0),s(o,x,"\u2AB9","\\precnapprox",!0),s(o,x,"\u2241","\\nsim",!0),s(o,x,"\u2224","\\nmid",!0),s(o,x,"\u2224","\\nshortmid"),s(o,x,"\u22AC","\\nvdash",!0),s(o,x,"\u22AD","\\nvDash",!0),s(o,x,"\u22EA","\\ntriangleleft"),s(o,x,"\u22EC","\\ntrianglelefteq",!0),s(o,x,"\u2284","\\nsubset",!0),s(o,x,"\u2285","\\nsupset",!0),s(o,x,"\u228A","\\subsetneq",!0),s(o,x,"\u228A\uFE00","\\varsubsetneq"),s(o,x,"\u2ACB","\\subsetneqq",!0),s(o,x,"\u2ACB\uFE00","\\varsubsetneqq"),s(o,x,"\u226F","\\ngtr",!0),s(o,x,"\u2A88","\\gneq",!0),s(o,x,"\u2269","\\gneqq",!0),s(o,x,"\u2269\uFE00","\\gvertneqq"),s(o,x,"\u22E7","\\gnsim",!0),s(o,x,"\u2A8A","\\gnapprox",!0),s(o,x,"\u2281","\\nsucc",!0),s(o,x,"\u22E1","\\nsucceq",!0),s(o,x,"\u22E9","\\succnsim",!0),s(o,x,"\u2ABA","\\succnapprox",!0),s(o,x,"\u2246","\\ncong",!0),s(o,x,"\u2226","\\nparallel",!0),s(o,x,"\u2226","\\nshortparallel"),s(o,x,"\u22AF","\\nVDash",!0),s(o,x,"\u22EB","\\ntriangleright"),s(o,x,"\u22ED","\\ntrianglerighteq",!0),s(o,x,"\u228B","\\supsetneq",!0),s(o,x,"\u228B","\\varsupsetneq"),s(o,x,"\u2ACC","\\supsetneqq",!0),s(o,x,"\u2ACC\uFE00","\\varsupsetneqq"),s(o,x,"\u22AE","\\nVdash",!0),s(o,x,"\u2AB5","\\precneqq",!0),s(o,x,"\u2AB6","\\succneqq",!0),s(o,P,"\u22B4","\\unlhd"),s(o,P,"\u22B5","\\unrhd"),s(o,x,"\u219A","\\nleftarrow",!0),s(o,x,"\u219B","\\nrightarrow",!0),s(o,x,"\u21CD","\\nLeftarrow",!0),s(o,x,"\u21CF","\\nRightarrow",!0),s(o,x,"\u21AE","\\nleftrightarrow",!0),s(o,x,"\u21CE","\\nLeftrightarrow",!0),s(o,x,"\u25B3","\\vartriangle"),s(o,g,"\u210F","\\hslash"),s(o,g,"\u25BD","\\triangledown"),s(o,g,"\u25CA","\\lozenge"),s(o,g,"\u24C8","\\circledS"),s(o,g,"\xAE","\\circledR",!0),s(O,g,"\xAE","\\circledR"),s(O,g,"\xAE","\\textregistered"),s(o,g,"\u2221","\\measuredangle",!0),s(o,g,"\u2204","\\nexists"),s(o,g,"\u2127","\\mho"),s(o,g,"\u2132","\\Finv",!0),s(o,g,"\u2141","\\Game",!0),s(o,g,"\u2035","\\backprime"),s(o,g,"\u2036","\\backdprime"),s(o,g,"\u2037","\\backtrprime"),s(o,g,"\u25B2","\\blacktriangle"),s(o,g,"\u25BC","\\blacktriangledown"),s(o,g,"\u25A0","\\blacksquare"),s(o,g,"\u29EB","\\blacklozenge"),s(o,g,"\u2605","\\bigstar"),s(o,g,"\u2222","\\sphericalangle",!0),s(o,g,"\u2201","\\complement",!0),s(o,g,"\u2571","\\diagup"),s(o,g,"\u2572","\\diagdown"),s(o,g,"\u25A1","\\square"),s(o,g,"\u25A1","\\Box"),s(o,g,"\u25CA","\\Diamond"),s(o,g,"\xA5","\\yen",!0),s(O,g,"\xA5","\\yen",!0),s(o,g,"\u2713","\\checkmark",!0),s(O,g,"\u2713","\\checkmark"),s(o,g,"\u2717","\\ballotx",!0),s(O,g,"\u2717","\\ballotx"),s(O,g,"\u2022","\\textbullet"),s(o,g,"\u2136","\\beth",!0),s(o,g,"\u2138","\\daleth",!0),s(o,g,"\u2137","\\gimel",!0),s(o,g,"\u03DD","\\digamma",!0),s(o,g,"\u03F0","\\varkappa"),s(o,Q,"\u231C","\\ulcorner",!0),s(o,Ue,"\u231D","\\urcorner",!0),s(o,Q,"\u231E","\\llcorner",!0),s(o,Ue,"\u231F","\\lrcorner",!0),s(o,x,"\u2266","\\leqq",!0),s(o,x,"\u2A7D","\\leqslant",!0),s(o,x,"\u2A95","\\eqslantless",!0),s(o,x,"\u2272","\\lesssim",!0),s(o,x,"\u2A85","\\lessapprox",!0),s(o,x,"\u224A","\\approxeq",!0),s(o,P,"\u22D6","\\lessdot"),s(o,x,"\u22D8","\\lll",!0),s(o,x,"\u2276","\\lessgtr",!0),s(o,x,"\u22DA","\\lesseqgtr",!0),s(o,x,"\u2A8B","\\lesseqqgtr",!0),s(o,x,"\u2251","\\doteqdot"),s(o,x,"\u2253","\\risingdotseq",!0),s(o,x,"\u2252","\\fallingdotseq",!0),s(o,x,"\u223D","\\backsim",!0),s(o,x,"\u22CD","\\backsimeq",!0),s(o,x,"\u2AC5","\\subseteqq",!0),s(o,x,"\u22D0","\\Subset",!0),s(o,x,"\u228F","\\sqsubset",!0),s(o,x,"\u227C","\\preccurlyeq",!0),s(o,x,"\u22DE","\\curlyeqprec",!0),s(o,x,"\u227E","\\precsim",!0),s(o,x,"\u2AB7","\\precapprox",!0),s(o,x,"\u22B2","\\vartriangleleft"),s(o,x,"\u22B4","\\trianglelefteq"),s(o,x,"\u22A8","\\vDash",!0),s(o,x,"\u22AB","\\VDash",!0),s(o,x,"\u22AA","\\Vvdash",!0),s(o,x,"\u2323","\\smallsmile"),s(o,x,"\u2322","\\smallfrown"),s(o,x,"\u224F","\\bumpeq",!0),s(o,x,"\u224E","\\Bumpeq",!0),s(o,x,"\u2267","\\geqq",!0),s(o,x,"\u2A7E","\\geqslant",!0),s(o,x,"\u2A96","\\eqslantgtr",!0),s(o,x,"\u2273","\\gtrsim",!0),s(o,x,"\u2A86","\\gtrapprox",!0),s(o,P,"\u22D7","\\gtrdot"),s(o,x,"\u22D9","\\ggg",!0),s(o,x,"\u2277","\\gtrless",!0),s(o,x,"\u22DB","\\gtreqless",!0),s(o,x,"\u2A8C","\\gtreqqless",!0),s(o,x,"\u2256","\\eqcirc",!0),s(o,x,"\u2257","\\circeq",!0),s(o,x,"\u225C","\\triangleq",!0),s(o,x,"\u223C","\\thicksim"),s(o,x,"\u2248","\\thickapprox"),s(o,x,"\u2AC6","\\supseteqq",!0),s(o,x,"\u22D1","\\Supset",!0),s(o,x,"\u2290","\\sqsupset",!0),s(o,x,"\u227D","\\succcurlyeq",!0),s(o,x,"\u22DF","\\curlyeqsucc",!0),s(o,x,"\u227F","\\succsim",!0),s(o,x,"\u2AB8","\\succapprox",!0),s(o,x,"\u22B3","\\vartriangleright"),s(o,x,"\u22B5","\\trianglerighteq"),s(o,x,"\u22A9","\\Vdash",!0),s(o,x,"\u2223","\\shortmid"),s(o,x,"\u2225","\\shortparallel"),s(o,x,"\u226C","\\between",!0),s(o,x,"\u22D4","\\pitchfork",!0),s(o,x,"\u221D","\\varpropto"),s(o,x,"\u25C0","\\blacktriangleleft"),s(o,x,"\u2234","\\therefore",!0),s(o,x,"\u220D","\\backepsilon"),s(o,x,"\u25B6","\\blacktriangleright"),s(o,x,"\u2235","\\because",!0),s(o,x,"\u22D8","\\llless"),s(o,x,"\u22D9","\\gggtr"),s(o,P,"\u22B2","\\lhd"),s(o,P,"\u22B3","\\rhd"),s(o,x,"\u2242","\\eqsim",!0),s(o,x,"\u2251","\\Doteq",!0),s(o,x,"\u297D","\\strictif",!0),s(o,x,"\u297C","\\strictfi",!0),s(o,P,"\u2214","\\dotplus",!0),s(o,P,"\u2216","\\smallsetminus"),s(o,P,"\u22D2","\\Cap",!0),s(o,P,"\u22D3","\\Cup",!0),s(o,P,"\u2A5E","\\doublebarwedge",!0),s(o,P,"\u229F","\\boxminus",!0),s(o,P,"\u229E","\\boxplus",!0),s(o,P,"\u29C4","\\boxslash",!0),s(o,P,"\u22C7","\\divideontimes",!0),s(o,P,"\u22C9","\\ltimes",!0),s(o,P,"\u22CA","\\rtimes",!0),s(o,P,"\u22CB","\\leftthreetimes",!0),s(o,P,"\u22CC","\\rightthreetimes",!0),s(o,P,"\u22CF","\\curlywedge",!0),s(o,P,"\u22CE","\\curlyvee",!0),s(o,P,"\u229D","\\circleddash",!0),s(o,P,"\u229B","\\circledast",!0),s(o,P,"\u22BA","\\intercal",!0),s(o,P,"\u22D2","\\doublecap"),s(o,P,"\u22D3","\\doublecup"),s(o,P,"\u22A0","\\boxtimes",!0),s(o,P,"\u22C8","\\bowtie",!0),s(o,P,"\u22C8","\\Join"),s(o,P,"\u27D5","\\leftouterjoin",!0),s(o,P,"\u27D6","\\rightouterjoin",!0),s(o,P,"\u27D7","\\fullouterjoin",!0),s(o,P,"\u2238","\\dotminus",!0),s(o,P,"\u27D1","\\wedgedot",!0),s(o,P,"\u27C7","\\veedot",!0),s(o,P,"\u2A62","\\doublebarvee",!0),s(o,P,"\u2A63","\\veedoublebar",!0),s(o,P,"\u2A5F","\\wedgebar",!0),s(o,P,"\u2A60","\\wedgedoublebar",!0),s(o,P,"\u2A54","\\Vee",!0),s(o,P,"\u2A53","\\Wedge",!0),s(o,P,"\u2A43","\\barcap",!0),s(o,P,"\u2A42","\\barcup",!0),s(o,P,"\u2A48","\\capbarcup",!0),s(o,P,"\u2A40","\\capdot",!0),s(o,P,"\u2A47","\\capovercup",!0),s(o,P,"\u2A46","\\cupovercap",!0),s(o,P,"\u2A4D","\\closedvarcap",!0),s(o,P,"\u2A4C","\\closedvarcup",!0),s(o,P,"\u2A2A","\\minusdot",!0),s(o,P,"\u2A2B","\\minusfdots",!0),s(o,P,"\u2A2C","\\minusrdots",!0),s(o,P,"\u22BB","\\Xor",!0),s(o,P,"\u22BC","\\Nand",!0),s(o,P,"\u22BD","\\Nor",!0),s(o,P,"\u22BD","\\barvee"),s(o,P,"\u2AF4","\\interleave",!0),s(o,P,"\u29E2","\\shuffle",!0),s(o,P,"\u2AF6","\\threedotcolon",!0),s(o,P,"\u2982","\\typecolon",!0),s(o,P,"\u223E","\\invlazys",!0),s(o,P,"\u2A4B","\\twocaps",!0),s(o,P,"\u2A4A","\\twocups",!0),s(o,P,"\u2A4E","\\Sqcap",!0),s(o,P,"\u2A4F","\\Sqcup",!0),s(o,P,"\u2A56","\\veeonvee",!0),s(o,P,"\u2A55","\\wedgeonwedge",!0),s(o,P,"\u29D7","\\blackhourglass",!0),s(o,P,"\u29C6","\\boxast",!0),s(o,P,"\u29C8","\\boxbox",!0),s(o,P,"\u29C7","\\boxcircle",!0),s(o,P,"\u229C","\\circledequal",!0),s(o,P,"\u29B7","\\circledparallel",!0),s(o,P,"\u29B6","\\circledvert",!0),s(o,P,"\u29B5","\\circlehbar",!0),s(o,P,"\u27E1","\\concavediamond",!0),s(o,P,"\u27E2","\\concavediamondtickleft",!0),s(o,P,"\u27E3","\\concavediamondtickright",!0),s(o,P,"\u22C4","\\diamond",!0),s(o,P,"\u29D6","\\hourglass",!0),s(o,P,"\u27E0","\\lozengeminus",!0),s(o,P,"\u233D","\\obar",!0),s(o,P,"\u29B8","\\obslash",!0),s(o,P,"\u2A38","\\odiv",!0),s(o,P,"\u29C1","\\ogreaterthan",!0),s(o,P,"\u29C0","\\olessthan",!0),s(o,P,"\u29B9","\\operp",!0),s(o,P,"\u2A37","\\Otimes",!0),s(o,P,"\u2A36","\\otimeshat",!0),s(o,P,"\u22C6","\\star",!0),s(o,P,"\u25B3","\\triangle",!0),s(o,P,"\u2A3A","\\triangleminus",!0),s(o,P,"\u2A39","\\triangleplus",!0),s(o,P,"\u2A3B","\\triangletimes",!0),s(o,P,"\u27E4","\\whitesquaretickleft",!0),s(o,P,"\u27E5","\\whitesquaretickright",!0),s(o,P,"\u2A33","\\smashtimes",!0),s(o,x,"\u21E2","\\dashrightarrow",!0),s(o,x,"\u21E0","\\dashleftarrow",!0),s(o,x,"\u21C7","\\leftleftarrows",!0),s(o,x,"\u21C6","\\leftrightarrows",!0),s(o,x,"\u21DA","\\Lleftarrow",!0),s(o,x,"\u219E","\\twoheadleftarrow",!0),s(o,x,"\u21A2","\\leftarrowtail",!0),s(o,x,"\u21AB","\\looparrowleft",!0),s(o,x,"\u21CB","\\leftrightharpoons",!0),s(o,x,"\u21B6","\\curvearrowleft",!0),s(o,x,"\u21BA","\\circlearrowleft",!0),s(o,x,"\u21B0","\\Lsh",!0),s(o,x,"\u21C8","\\upuparrows",!0),s(o,x,"\u21BF","\\upharpoonleft",!0),s(o,x,"\u21C3","\\downharpoonleft",!0),s(o,x,"\u22B6","\\origof",!0),s(o,x,"\u22B7","\\imageof",!0),s(o,x,"\u22B8","\\multimap",!0),s(o,x,"\u21AD","\\leftrightsquigarrow",!0),s(o,x,"\u21C9","\\rightrightarrows",!0),s(o,x,"\u21C4","\\rightleftarrows",!0),s(o,x,"\u21A0","\\twoheadrightarrow",!0),s(o,x,"\u21A3","\\rightarrowtail",!0),s(o,x,"\u21AC","\\looparrowright",!0),s(o,x,"\u21B7","\\curvearrowright",!0),s(o,x,"\u21BB","\\circlearrowright",!0),s(o,x,"\u21B1","\\Rsh",!0),s(o,x,"\u21CA","\\downdownarrows",!0),s(o,x,"\u21BE","\\upharpoonright",!0),s(o,x,"\u21C2","\\downharpoonright",!0),s(o,x,"\u21DD","\\rightsquigarrow",!0),s(o,x,"\u21DD","\\leadsto"),s(o,x,"\u21DB","\\Rrightarrow",!0),s(o,x,"\u21BE","\\restriction"),s(o,g,"\u2018","`"),s(o,g,"$","\\$"),s(O,g,"$","\\$"),s(O,g,"$","\\textdollar"),s(o,g,"\xA2","\\cent"),s(O,g,"\xA2","\\cent"),s(o,g,"%","\\%"),s(O,g,"%","\\%"),s(o,g,"_","\\_"),s(O,g,"_","\\_"),s(O,g,"_","\\textunderscore"),s(O,g,"\u2423","\\textvisiblespace",!0),s(o,g,"\u2220","\\angle",!0),s(o,g,"\u221E","\\infty",!0),s(o,g,"\u2032","\\prime"),s(o,g,"\u2033","\\dprime"),s(o,g,"\u2034","\\trprime"),s(o,g,"\u2057","\\qprime"),s(o,g,"\u25B3","\\triangle"),s(O,g,"\u0391","\\Alpha",!0),s(O,g,"\u0392","\\Beta",!0),s(O,g,"\u0393","\\Gamma",!0),s(O,g,"\u0394","\\Delta",!0),s(O,g,"\u0395","\\Epsilon",!0),s(O,g,"\u0396","\\Zeta",!0),s(O,g,"\u0397","\\Eta",!0),s(O,g,"\u0398","\\Theta",!0),s(O,g,"\u0399","\\Iota",!0),s(O,g,"\u039A","\\Kappa",!0),s(O,g,"\u039B","\\Lambda",!0),s(O,g,"\u039C","\\Mu",!0),s(O,g,"\u039D","\\Nu",!0),s(O,g,"\u039E","\\Xi",!0),s(O,g,"\u039F","\\Omicron",!0),s(O,g,"\u03A0","\\Pi",!0),s(O,g,"\u03A1","\\Rho",!0),s(O,g,"\u03A3","\\Sigma",!0),s(O,g,"\u03A4","\\Tau",!0),s(O,g,"\u03A5","\\Upsilon",!0),s(O,g,"\u03A6","\\Phi",!0),s(O,g,"\u03A7","\\Chi",!0),s(O,g,"\u03A8","\\Psi",!0),s(O,g,"\u03A9","\\Omega",!0),s(o,W,"\u0391","\\Alpha",!0),s(o,W,"\u0392","\\Beta",!0),s(o,W,"\u0393","\\Gamma",!0),s(o,W,"\u0394","\\Delta",!0),s(o,W,"\u0395","\\Epsilon",!0),s(o,W,"\u0396","\\Zeta",!0),s(o,W,"\u0397","\\Eta",!0),s(o,W,"\u0398","\\Theta",!0),s(o,W,"\u0399","\\Iota",!0),s(o,W,"\u039A","\\Kappa",!0),s(o,W,"\u039B","\\Lambda",!0),s(o,W,"\u039C","\\Mu",!0),s(o,W,"\u039D","\\Nu",!0),s(o,W,"\u039E","\\Xi",!0),s(o,W,"\u039F","\\Omicron",!0),s(o,W,"\u03A0","\\Pi",!0),s(o,W,"\u03A1","\\Rho",!0),s(o,W,"\u03A3","\\Sigma",!0),s(o,W,"\u03A4","\\Tau",!0),s(o,W,"\u03A5","\\Upsilon",!0),s(o,W,"\u03A6","\\Phi",!0),s(o,W,"\u03A7","\\Chi",!0),s(o,W,"\u03A8","\\Psi",!0),s(o,W,"\u03A9","\\Omega",!0),s(o,Q,"\xAC","\\neg",!0),s(o,Q,"\xAC","\\lnot"),s(o,g,"\u22A4","\\top"),s(o,g,"\u22A5","\\bot"),s(o,g,"\u2205","\\emptyset"),s(o,g,"\u2300","\\varnothing"),s(o,W,"\u03B1","\\alpha",!0),s(o,W,"\u03B2","\\beta",!0),s(o,W,"\u03B3","\\gamma",!0),s(o,W,"\u03B4","\\delta",!0),s(o,W,"\u03F5","\\epsilon",!0),s(o,W,"\u03B6","\\zeta",!0),s(o,W,"\u03B7","\\eta",!0),s(o,W,"\u03B8","\\theta",!0),s(o,W,"\u03B9","\\iota",!0),s(o,W,"\u03BA","\\kappa",!0),s(o,W,"\u03BB","\\lambda",!0),s(o,W,"\u03BC","\\mu",!0),s(o,W,"\u03BD","\\nu",!0),s(o,W,"\u03BE","\\xi",!0),s(o,W,"\u03BF","\\omicron",!0),s(o,W,"\u03C0","\\pi",!0),s(o,W,"\u03C1","\\rho",!0),s(o,W,"\u03C3","\\sigma",!0),s(o,W,"\u03C4","\\tau",!0),s(o,W,"\u03C5","\\upsilon",!0),s(o,W,"\u03D5","\\phi",!0),s(o,W,"\u03C7","\\chi",!0),s(o,W,"\u03C8","\\psi",!0),s(o,W,"\u03C9","\\omega",!0),s(o,W,"\u03B5","\\varepsilon",!0),s(o,W,"\u03D1","\\vartheta",!0),s(o,W,"\u03D6","\\varpi",!0),s(o,W,"\u03F1","\\varrho",!0),s(o,W,"\u03C2","\\varsigma",!0),s(o,W,"\u03C6","\\varphi",!0),s(o,W,"\u03D8","\\Coppa",!0),s(o,W,"\u03D9","\\coppa",!0),s(o,W,"\u03D9","\\varcoppa",!0),s(o,W,"\u03DE","\\Koppa",!0),s(o,W,"\u03DF","\\koppa",!0),s(o,W,"\u03E0","\\Sampi",!0),s(o,W,"\u03E1","\\sampi",!0),s(o,W,"\u03DA","\\Stigma",!0),s(o,W,"\u03DB","\\stigma",!0),s(o,W,"\u2AEB","\\Bot"),s(o,g,"\xF0","\\eth",!0),s(O,g,"\xF0","\xF0"),s(o,g,"\xC5","\\AA"),s(O,g,"\xC5","\\AA",!0),s(o,g,"\xC6","\\AE",!0),s(O,g,"\xC6","\\AE",!0),s(o,g,"\xD0","\\DH",!0),s(O,g,"\xD0","\\DH",!0),s(o,g,"\xDE","\\TH",!0),s(O,g,"\xDE","\\TH",!0),s(o,g,"\xDF","\\ss",!0),s(O,g,"\xDF","\\ss",!0),s(o,g,"\xE5","\\aa"),s(O,g,"\xE5","\\aa",!0),s(o,g,"\xE6","\\ae",!0),s(O,g,"\xE6","\\ae",!0),s(o,g,"\xF0","\\dh"),s(O,g,"\xF0","\\dh",!0),s(o,g,"\xFE","\\th",!0),s(O,g,"\xFE","\\th",!0),s(o,g,"\u0110","\\DJ",!0),s(O,g,"\u0110","\\DJ",!0),s(o,g,"\u0111","\\dj",!0),s(O,g,"\u0111","\\dj",!0),s(o,g,"\u0141","\\L",!0),s(O,g,"\u0141","\\L",!0),s(o,g,"\u0141","\\l",!0),s(O,g,"\u0141","\\l",!0),s(o,g,"\u014A","\\NG",!0),s(O,g,"\u014A","\\NG",!0),s(o,g,"\u014B","\\ng",!0),s(O,g,"\u014B","\\ng",!0),s(o,g,"\u0152","\\OE",!0),s(O,g,"\u0152","\\OE",!0),s(o,g,"\u0153","\\oe",!0),s(O,g,"\u0153","\\oe",!0),s(o,P,"\u2217","\u2217",!0),s(o,P,"+","+"),s(o,P,"\u2217","*"),s(o,P,"\u2044","/",!0),s(o,P,"\u2044","\u2044"),s(o,P,"\u2212","-",!0),s(o,P,"\u22C5","\\cdot",!0),s(o,P,"\u2218","\\circ",!0),s(o,P,"\xF7","\\div",!0),s(o,P,"\xB1","\\pm",!0),s(o,P,"\xD7","\\times",!0),s(o,P,"\u2229","\\cap",!0),s(o,P,"\u222A","\\cup",!0),s(o,P,"\u2216","\\setminus",!0),s(o,P,"\u2227","\\land"),s(o,P,"\u2228","\\lor"),s(o,P,"\u2227","\\wedge",!0),s(o,P,"\u2228","\\vee",!0),s(o,Q,"\u27E6","\\llbracket",!0),s(o,Ue,"\u27E7","\\rrbracket",!0),s(o,Q,"\u27E8","\\langle",!0),s(o,Q,"\u27EA","\\lAngle",!0),s(o,Q,"\u2989","\\llangle",!0),s(o,Q,"|","\\lvert"),s(o,Q,"\u2016","\\lVert",!0),s(o,g,"!","\\oc"),s(o,g,"?","\\wn"),s(o,g,"\u2193","\\shpos"),s(o,g,"\u2195","\\shift"),s(o,g,"\u2191","\\shneg"),s(o,Ue,"?","?"),s(o,Ue,"!","!"),s(o,Ue,"\u203C","\u203C"),s(o,Ue,"\u27E9","\\rangle",!0),s(o,Ue,"\u27EB","\\rAngle",!0),s(o,Ue,"\u298A","\\rrangle",!0),s(o,Ue,"|","\\rvert"),s(o,Ue,"\u2016","\\rVert"),s(o,Q,"\u2983","\\lBrace",!0),s(o,Ue,"\u2984","\\rBrace",!0),s(o,x,"=","\\equal",!0),s(o,x,":",":"),s(o,x,"\u2248","\\approx",!0),s(o,x,"\u2245","\\cong",!0),s(o,x,"\u2265","\\ge"),s(o,x,"\u2265","\\geq",!0),s(o,x,"\u2190","\\gets"),s(o,x,">","\\gt",!0),s(o,x,"\u2208","\\in",!0),s(o,x,"\u2209","\\notin",!0),s(o,x,"\uE020","\\@not"),s(o,x,"\u2282","\\subset",!0),s(o,x,"\u2283","\\supset",!0),s(o,x,"\u2286","\\subseteq",!0),s(o,x,"\u2287","\\supseteq",!0),s(o,x,"\u2288","\\nsubseteq",!0),s(o,x,"\u2288","\\nsubseteqq"),s(o,x,"\u2289","\\nsupseteq",!0),s(o,x,"\u2289","\\nsupseteqq"),s(o,x,"\u22A8","\\models"),s(o,x,"\u2190","\\leftarrow",!0),s(o,x,"\u2264","\\le"),s(o,x,"\u2264","\\leq",!0),s(o,x,"<","\\lt",!0),s(o,x,"\u2192","\\rightarrow",!0),s(o,x,"\u2192","\\to"),s(o,x,"\u2271","\\ngeq",!0),s(o,x,"\u2271","\\ngeqq"),s(o,x,"\u2271","\\ngeqslant"),s(o,x,"\u2270","\\nleq",!0),s(o,x,"\u2270","\\nleqq"),s(o,x,"\u2270","\\nleqslant"),s(o,x,"\u2AEB","\\Perp",!0),s(o,we,"\xA0","\\ "),s(o,we,"\xA0","\\space"),s(o,we,"\xA0","\\nobreakspace"),s(O,we,"\xA0","\\ "),s(O,we,"\xA0"," "),s(O,we,"\xA0","\\space"),s(O,we,"\xA0","\\nobreakspace"),s(o,we,null,"\\nobreak"),s(o,we,null,"\\allowbreak"),s(o,ye,",",","),s(O,ye,":",":"),s(o,ye,";",";"),s(o,P,"\u22BC","\\barwedge"),s(o,P,"\u22BB","\\veebar"),s(o,P,"\u2299","\\odot",!0),s(o,P,"\u2295\uFE0E","\\oplus"),s(o,P,"\u2297","\\otimes",!0),s(o,g,"\u2202","\\partial",!0),s(o,P,"\u2298","\\oslash",!0),s(o,P,"\u229A","\\circledcirc",!0),s(o,P,"\u22A1","\\boxdot",!0),s(o,P,"\u25B3","\\bigtriangleup"),s(o,P,"\u25BD","\\bigtriangledown"),s(o,P,"\u2020","\\dagger"),s(o,P,"\u22C4","\\diamond"),s(o,P,"\u25C3","\\triangleleft"),s(o,P,"\u25B9","\\triangleright"),s(o,Q,"{","\\{"),s(O,g,"{","\\{"),s(O,g,"{","\\textbraceleft"),s(o,Ue,"}","\\}"),s(O,g,"}","\\}"),s(O,g,"}","\\textbraceright"),s(o,Q,"{","\\lbrace"),s(o,Ue,"}","\\rbrace"),s(o,Q,"[","\\lbrack",!0),s(O,g,"[","\\lbrack",!0),s(o,Ue,"]","\\rbrack",!0),s(O,g,"]","\\rbrack",!0),s(o,Q,"(","\\lparen",!0),s(o,Ue,")","\\rparen",!0),s(o,Q,"\u2987","\\llparenthesis",!0),s(o,Ue,"\u2988","\\rrparenthesis",!0),s(O,g,"<","\\textless",!0),s(O,g,">","\\textgreater",!0),s(o,Q,"\u230A","\\lfloor",!0),s(o,Ue,"\u230B","\\rfloor",!0),s(o,Q,"\u2308","\\lceil",!0),s(o,Ue,"\u2309","\\rceil",!0),s(o,g,"\\","\\backslash"),s(o,g,"|","|"),s(o,g,"|","\\vert"),s(O,g,"|","\\textbar",!0),s(o,g,"\u2016","\\|"),s(o,g,"\u2016","\\Vert"),s(O,g,"\u2016","\\textbardbl"),s(O,g,"~","\\textasciitilde"),s(O,g,"\\","\\textbackslash"),s(O,g,"^","\\textasciicircum"),s(o,x,"\u2191","\\uparrow",!0),s(o,x,"\u21D1","\\Uparrow",!0),s(o,x,"\u2193","\\downarrow",!0),s(o,x,"\u21D3","\\Downarrow",!0),s(o,x,"\u2195","\\updownarrow",!0),s(o,x,"\u21D5","\\Updownarrow",!0),s(o,Ae,"\u2210","\\coprod"),s(o,Ae,"\u22C1","\\bigvee"),s(o,Ae,"\u22C0","\\bigwedge"),s(o,Ae,"\u2A04","\\biguplus"),s(o,Ae,"\u2A04","\\bigcupplus"),s(o,Ae,"\u2A03","\\bigcupdot"),s(o,Ae,"\u2A07","\\bigdoublevee"),s(o,Ae,"\u2A08","\\bigdoublewedge"),s(o,Ae,"\u22C2","\\bigcap"),s(o,Ae,"\u22C3","\\bigcup"),s(o,Ae,"\u222B","\\int"),s(o,Ae,"\u222B","\\intop"),s(o,Ae,"\u222C","\\iint"),s(o,Ae,"\u222D","\\iiint"),s(o,Ae,"\u220F","\\prod"),s(o,Ae,"\u2211","\\sum"),s(o,Ae,"\u2A02","\\bigotimes"),s(o,Ae,"\u2A01","\\bigoplus"),s(o,Ae,"\u2A00","\\bigodot"),s(o,Ae,"\u2A09","\\bigtimes"),s(o,Ae,"\u222E","\\oint"),s(o,Ae,"\u222F","\\oiint"),s(o,Ae,"\u2230","\\oiiint"),s(o,Ae,"\u2231","\\intclockwise"),s(o,Ae,"\u2232","\\varointclockwise"),s(o,Ae,"\u2A0C","\\iiiint"),s(o,Ae,"\u2A0D","\\intbar"),s(o,Ae,"\u2A0E","\\intBar"),s(o,Ae,"\u2A0F","\\fint"),s(o,Ae,"\u2A12","\\rppolint"),s(o,Ae,"\u2A13","\\scpolint"),s(o,Ae,"\u2A15","\\pointint"),s(o,Ae,"\u2A16","\\sqint"),s(o,Ae,"\u2A17","\\intlarhk"),s(o,Ae,"\u2A18","\\intx"),s(o,Ae,"\u2A19","\\intcap"),s(o,Ae,"\u2A1A","\\intcup"),s(o,Ae,"\u2A05","\\bigsqcap"),s(o,Ae,"\u2A06","\\bigsqcup"),s(o,Ae,"\u222B","\\smallint"),s(O,nt,"\u2026","\\textellipsis"),s(o,nt,"\u2026","\\mathellipsis"),s(O,nt,"\u2026","\\ldots",!0),s(o,nt,"\u2026","\\ldots",!0),s(o,nt,"\u22F0","\\iddots",!0),s(o,nt,"\u22EF","\\@cdots",!0),s(o,nt,"\u22F1","\\ddots",!0),s(o,g,"\u22EE","\\varvdots"),s(O,g,"\u22EE","\\varvdots"),s(o,Be,"\xB4","\\acute"),s(o,Be,"`","\\grave"),s(o,Be,"\xA8","\\ddot"),s(o,Be,"\u2026","\\dddot"),s(o,Be,"\u2026.","\\ddddot"),s(o,Be,"~","\\tilde"),s(o,Be,"\u203E","\\bar"),s(o,Be,"\u02D8","\\breve"),s(o,Be,"\u02C7","\\check"),s(o,Be,"^","\\hat"),s(o,Be,"\u2192","\\vec"),s(o,Be,"\u02D9","\\dot"),s(o,Be,"\u02DA","\\mathring"),s(o,W,"\u0131","\\imath",!0),s(o,W,"\u0237","\\jmath",!0),s(o,g,"\u0131","\u0131"),s(o,g,"\u0237","\u0237"),s(O,g,"\u0131","\\i",!0),s(O,g,"\u0237","\\j",!0),s(O,g,"\xF8","\\o",!0),s(o,W,"\xF8","\\o",!0),s(O,g,"\xD8","\\O",!0),s(o,W,"\xD8","\\O",!0),s(O,Be,"\u02CA","\\'"),s(O,Be,"\u02CB","\\`"),s(O,Be,"\u02C6","\\^"),s(O,Be,"~","\\~"),s(O,Be,"\u02C9","\\="),s(O,Be,"\u02D8","\\u"),s(O,Be,"\u02D9","\\."),s(O,Be,"\xB8","\\c"),s(O,Be,"\u02DA","\\r"),s(O,Be,"\u02C7","\\v"),s(O,Be,"\xA8",'\\"'),s(O,Be,"\u02DD","\\H"),s(o,Be,"\u02CA","\\'"),s(o,Be,"\u02CB","\\`"),s(o,Be,"\u02C6","\\^"),s(o,Be,"~","\\~"),s(o,Be,"\u02C9","\\="),s(o,Be,"\u02D8","\\u"),s(o,Be,"\u02D9","\\."),s(o,Be,"\xB8","\\c"),s(o,Be,"\u02DA","\\r"),s(o,Be,"\u02C7","\\v"),s(o,Be,"\xA8",'\\"'),s(o,Be,"\u02DD","\\H");let j={"--":!0,"---":!0,"``":!0,"''":!0};s(O,g,"\u2013","--",!0),s(O,g,"\u2013","\\textendash"),s(O,g,"\u2014","---",!0),s(O,g,"\u2014","\\textemdash"),s(O,g,"\u2018","`",!0),s(O,g,"\u2018","\\textquoteleft"),s(O,g,"\u2019","'",!0),s(O,g,"\u2019","\\textquoteright"),s(O,g,"\u201C","``",!0),s(O,g,"\u201C","\\textquotedblleft"),s(O,g,"\u201D","''",!0),s(O,g,"\u201D","\\textquotedblright"),s(o,g,"\xB0","\\degree",!0),s(O,g,"\xB0","\\degree"),s(O,g,"\xB0","\\textdegree",!0),s(o,g,"\xA3","\\pounds"),s(o,g,"\xA3","\\mathsterling",!0),s(O,g,"\xA3","\\pounds"),s(O,g,"\xA3","\\textsterling",!0),s(o,g,"\u2720","\\maltese"),s(O,g,"\u2720","\\maltese"),s(o,g,"\u20AC","\\euro",!0),s(O,g,"\u20AC","\\euro",!0),s(O,g,"\u20AC","\\texteuro"),s(o,g,"\xA9","\\copyright",!0),s(O,g,"\xA9","\\textcopyright"),s(o,g,"\u2300","\\diameter",!0),s(O,g,"\u2300","\\diameter"),s(o,g,"\u{1D6E4}","\\varGamma"),s(o,g,"\u{1D6E5}","\\varDelta"),s(o,g,"\u{1D6E9}","\\varTheta"),s(o,g,"\u{1D6EC}","\\varLambda"),s(o,g,"\u{1D6EF}","\\varXi"),s(o,g,"\u{1D6F1}","\\varPi"),s(o,g,"\u{1D6F4}","\\varSigma"),s(o,g,"\u{1D6F6}","\\varUpsilon"),s(o,g,"\u{1D6F7}","\\varPhi"),s(o,g,"\u{1D6F9}","\\varPsi"),s(o,g,"\u{1D6FA}","\\varOmega"),s(O,g,"\u{1D6E4}","\\varGamma"),s(O,g,"\u{1D6E5}","\\varDelta"),s(O,g,"\u{1D6E9}","\\varTheta"),s(O,g,"\u{1D6EC}","\\varLambda"),s(O,g,"\u{1D6EF}","\\varXi"),s(O,g,"\u{1D6F1}","\\varPi"),s(O,g,"\u{1D6F4}","\\varSigma"),s(O,g,"\u{1D6F6}","\\varUpsilon"),s(O,g,"\u{1D6F7}","\\varPhi"),s(O,g,"\u{1D6F9}","\\varPsi"),s(O,g,"\u{1D6FA}","\\varOmega");let B='0123456789/@."';for(let e=0;e<14;e++){let t=B.charAt(e);s(o,g,t,t)}let X='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){let t=X.charAt(e);s(O,g,t,t)}let Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){let t=Y.charAt(e);s(o,W,t,t),s(O,g,t,t)}let ge="\xC7\xD0\xDE\xE7\xFE\u2102\u210D\u2115\u2119\u211A\u211D\u2124\u210E\u210F\u210A\u210B\u210C\u2110\u2111\u2112\u2113\u2118\u211B\u211C\u212C\u2130\u2131\u2133\u212D\u2128";for(let e=0;e<30;e++){let t=ge.charAt(e);s(o,W,t,t),s(O,g,t,t)}let V="";for(let e=0;e<52;e++){V=String.fromCharCode(55349,56320+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56372+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56424+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56580+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56736+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56788+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56840+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56944+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,56632+e),s(o,W,V,V),s(O,g,V,V);let t=Y.charAt(e);V=String.fromCharCode(55349,56476+e),s(o,W,t,V),s(O,g,t,V)}for(let e=0;e<10;e++)V=String.fromCharCode(55349,57294+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,57314+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,57324+e),s(o,W,V,V),s(O,g,V,V),V=String.fromCharCode(55349,57334+e),s(o,W,V,V),s(O,g,V,V);let ne=function(e,t,n){return!Ne[t][e]||!Ne[t][e].replace||e.charCodeAt(0)===55349||Object.prototype.hasOwnProperty.call(j,e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt")||(e=Ne[t][e].replace),new Ie(e)},Fe=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){let n=new E("mtext",[new Ie(t.children[0].text)]);e.children.push(n)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},Je=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;let t=new E("mrow");for(let n=0;n<e.children.length;n++){let i=e.children[n];if(i.type==="mtext"&&Object.keys(i.attributes).length===0)Fe(t,i);else if(i.type==="mrow"){let c=!0;for(let p=0;p<i.children.length;p++)if(i.children[p].type!=="mtext"||Object.keys(i.attributes).length!==0){c=!1;break}if(c)for(let p=0;p<i.children.length;p++){let y=i.children[p];Fe(t,y)}else t.children.push(i)}else t.children.push(i)}for(let n=0;n<t.children.length;n++)if(t.children[n].type==="mtext"){let i=t.children[n];i.children[0].text.charAt(0)===" "&&(i.children[0].text="\xA0"+i.children[0].text.slice(1));let c=i.children[0].text.length;c>0&&i.children[0].text.charAt(c-1)===" "&&(i.children[0].text=i.children[0].text.slice(0,-1)+"\xA0");for(let[p,y]of Object.entries(e.attributes))i.attributes[p]=y}return t.children.length===1&&t.children[0].type==="mtext"?t.children[0]:t},re=function(e,t=!1){if(!(e.length!==1||e[0]instanceof ce))return e[0];if(!t){e[0]instanceof E&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");let n=e.length-1;e[n]instanceof E&&e[n].type==="mo"&&!e[n].attributes.fence&&(e[n].attributes.lspace="0em",e[n].attributes.rspace="0em")}return new E("mrow",e)};function ke(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){let t=e.children[0];return t instanceof Ie&&t.text==="."}if(e.type==="mtext"&&e.children.length===1){let t=e.children[0];return t instanceof Ie&&t.text==="\u2008"}if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){let t=e.children[0];return t instanceof Ie&&t.text===","}return!1}let He=(e,t)=>{let n=e[t],i=e[t+1];return n.type==="atom"&&n.text===","&&n.loc&&i.loc&&n.loc.end===i.loc.start},_e=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",Le=function(e,t,n=!1){if(!n&&e.length===1){let y=Oe(e[0],t);return y instanceof E&&y.type==="mo"&&(y.setAttribute("lspace","0em"),y.setAttribute("rspace","0em")),[y]}let i=[],c=[],p;for(let y=0;y<e.length;y++)c.push(Oe(e[y],t));for(let y=0;y<c.length;y++){let v=c[y];if(y<e.length-1&&_e(e[y])&&_e(e[y+1])&&v.setAttribute("rspace","0em"),y>0&&_e(e[y])&&_e(e[y-1])&&v.setAttribute("lspace","0em"),v.type==="mn"&&p&&p.type==="mn")p.children.push(...v.children);else if(ke(v)&&p&&p.type==="mn")p.children.push(...v.children);else if(p&&p.type==="mn"&&y<c.length-1&&c[y+1].type==="mn"&&He(e,y))p.children.push(...v.children);else{if(v.type==="mn"&&ke(p))v.children=[...p.children,...v.children],i.pop();else if((v.type==="msup"||v.type==="msub")&&v.children.length>=1&&p&&(p.type==="mn"||ke(p))){let D=v.children[0];D instanceof E&&D.type==="mn"&&p&&(D.children=[...p.children,...D.children],i.pop())}i.push(v),p=v}}return i},Qe=function(e,t,n=!1){return re(Le(e,t,n),n)},Oe=function(e,t){if(!e)return new E("mrow");if(C[e.type])return C[e.type](e,t);throw new r("Got group of unknown type: '"+e.type+"'")},Ye=e=>new E("mtd",[],[],{padding:"0",width:"50%"}),ct=["mrow","mtd","mtable","mtr"],_t=e=>{for(let t of e.children)if(t.type&&ct.includes(t.type)){if(t.classes&&t.classes[0]==="tml-label")return t.label;{let n=_t(t);if(n)return n}}else if(!t.type){let n=_t(t);if(n)return n}};function Pt(e,t,n,i){let c=null;e.length===1&&e[0].type==="tag"&&(c=e[0].tag,e=e[0].body);let p=Le(e,n);if(p.length===1&&p[0]instanceof Ce)return p[0];let y=i.displayMode||i.annotate?"none":i.wrap,v=p.length===0?null:p[0],D=p.length===1&&c===null&&v instanceof E?p[0]:function(oe,de,ee){let et=[],Ge=[],tt=[],lt=0,je=0;for(;je<oe.length;){for(;oe[je]instanceof ce;)oe.splice(je,1,...oe[je].children);let Ze=oe[je];if(Ze.attributes&&Ze.attributes.linebreak&&Ze.attributes.linebreak==="newline"){tt.length>0&&Ge.push(new E("mrow",tt)),Ge.push(Ze),tt=[];let Ut=new E("mtd",Ge);Ut.style.textAlign="left",et.push(new E("mtr",[Ut])),Ge=[],je+=1;continue}if(tt.push(Ze),Ze.type&&Ze.type==="mo"&&Ze.children.length===1&&(!Ze.attributes.form||Ze.attributes.form!=="prefix")&&!Object.prototype.hasOwnProperty.call(Ze.attributes,"movablelimits")){let Ut=Ze.children[0].text;if(de==="="&&Ut==="="){if(lt+=1,lt>1){tt.pop();let Tt=new E("mrow",tt);Ge.push(Tt),tt=[Ze]}}else if(de==="tex"){let Tt=je<oe.length-1?oe[je+1]:null,An=!0;if(!Tt||Tt.type!=="mtext"||!Tt.attributes.linebreak||Tt.attributes.linebreak!=="nobreak")for(let en=je+1;en<oe.length;en++){let ln=oe[en];if(!ln.type||ln.type!=="mspace"||ln.attributes.linebreak&&ln.attributes.linebreak==="newline")break;tt.push(ln),je+=1,ln.attributes&&ln.attributes.linebreak&&ln.attributes.linebreak==="nobreak"&&(An=!1)}if(An){let en=new E("mrow",tt);Ge.push(en),tt=[]}}}je+=1}if(tt.length>0){let Ze=new E("mrow",tt);Ge.push(Ze)}if(et.length>0){let Ze=new E("mtd",Ge);Ze.style.textAlign="left";let Ut=new E("mtr",[Ze]);et.push(Ut);let Tt=new E("mtable",et);return ee||(Tt.setAttribute("columnalign","left"),Tt.setAttribute("rowspacing","0em")),Tt}return xe(Ge)}(p,y,i.displayMode);if(c&&(D=((oe,de,ee,et)=>{de=Qe(de[0].body,ee),(de=Je(de)).classes.push("tml-tag");let Ge=_t(oe);oe=new E("mtd",[oe]);let tt=[Ye(),oe,Ye()];tt[et?0:2].children.push(de);let lt=new E("mtr",tt,["tml-tageqn"]);Ge&<.setAttribute("id",Ge);let je=new E("mtable",[lt]);return je.style.width="100%",je.setAttribute("displaystyle","true"),je})(D,c,n,i.leqno)),i.annotate){let oe=new E("annotation",[new Ie(t)]);oe.setAttribute("encoding","application/x-tex"),D=new E("semantics",[D,oe])}let z=new E("math",[D]);return i.xml&&z.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),i.displayMode&&(z.setAttribute("display","block"),z.style.display="block math",z.classes=["tml-display"]),z}let Kt=(e,t)=>{let n=e.isStretchy?fe(e):new E("mo",[ne(e.label,e.mode)]);e.isStretchy||n.setAttribute("stretchy","false"),e.label!=="\\vec"&&(n.style.mathDepth="0");let i=e.label==="\\c"?"munder":"mover",c=nn.has(e.label);if(i==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let p=e.base.text,y=e.label==="\\vec",v=y==="\\vec"?"-vec":"";y&&n.classes.push("tml-vec");let D=y?"-vec":c?"-acc":"";"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(p)>-1?(n.classes.push(`chr-sml${v}`),n.classes.push(`wbk-sml${D}`)):"BCEGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(p)>-1?(n.classes.push(`chr-med${v}`),n.classes.push(`wbk-med${D}`)):"AFJdf\u0394\u039B".indexOf(p)>-1?(n.classes.push(`chr-lrg${v}`),n.classes.push(`wbk-lrg${D}`)):y?n.classes.push("wbk-vec"):c&&n.classes.push("wbk-acc")}else c&&n.classes.push("wbk-acc");return new E(i,[Oe(e.base,t),n])},te=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),nn=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),Dt={"\\`":"\u0300","\\'":"\u0301","\\^":"\u0302","\\~":"\u0303","\\=":"\u0304","\\u":"\u0306","\\.":"\u0307",'\\"':"\u0308","\\r":"\u030A","\\H":"\u030B","\\v":"\u030C","\\c":"\u0327"};$({type:"accent",names:["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\overparen","\\widecheck","\\widehat","\\wideparen","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{let n=he(t[0]),i=!te.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:i,base:n}},mathmlBuilder:Kt}),$({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{let n=he(t[0]),i=e.parser.mode;return i==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),i==="text"&&n.text&&n.text.length===1&&e.funcName in Dt&&S.indexOf(n.text)>-1?{type:"textord",mode:"text",text:n.text+Dt[e.funcName]}:e.funcName==="\\c"&&i==="text"&&n.text&&n.text.length===1?{type:"textord",mode:"text",text:n.text+"\u0327"}:{type:"accent",mode:i,label:e.funcName,isStretchy:!1,base:n}},mathmlBuilder:Kt}),$({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>{let i=n[0];return{type:"accentUnder",mode:e.mode,label:t,base:i}},mathmlBuilder:(e,t)=>{let n=fe(e);return n.style["math-depth"]=0,new E("munder",[Oe(e.base,t),n])}});let qt={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:12.792133216944668,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},Xt=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Ct=function(e){return typeof e!="string"&&(e=e.unit),Xt.indexOf(e)>-1},ft=e=>[1,.7,.5][Math.max(e-1,0)],it=function(e,t){let n=e.number;if(t.maxSize[0]<0&&n>0)return{number:0,unit:"em"};let i=e.unit;switch(i){case"mm":case"cm":case"in":case"px":return n*qt[i]>t.maxSize[1]?{number:t.maxSize[1],unit:"pt"}:{number:n,unit:i};case"em":case"ex":return i==="ex"&&(n*=.431),n=Math.min(n/ft(t.level),t.maxSize[0]),{number:k(n),unit:"em"};case"bp":return n>t.maxSize[1]&&(n=t.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*qt[i],t.maxSize[1]),{number:k(n),unit:"pt"};case"mu":return n=Math.min(n/18,t.maxSize[0]),{number:k(n),unit:"em"};default:throw new r("Invalid unit: '"+i+"'")}},st=e=>{let t=new E("mspace");return t.setAttribute("width",e+"em"),t},N=(e,t=.3,n=0,i=!1)=>{if(e==null&&n===0)return st(t);let c=e?[e]:[];if(t!==0&&c.unshift(st(t)),n>0&&c.push(st(n)),i){let p=new E("mpadded",c);return p.setAttribute("height","0.1px"),p}return new E("mrow",c)},G=(e,t)=>Number(e)/ft(t),ie=(e,t,n,i)=>{let c=J(e),p=e.slice(1,3)==="eq",y=e.charAt(1)==="x"?"1.75":e.slice(2,4)==="cd"?"3.0":p?"1.0":"2.0";c.setAttribute("lspace","0"),c.setAttribute("rspace",p?"0.5em":"0");let v=i.withLevel(i.level<2?2:3),D=G(y,v.level),z=G(y,3),oe=N(null,D.toFixed(4),0),de=N(null,z.toFixed(4),0),ee=G(p?0:.3,v.level).toFixed(4),et,Ge,tt=t&&t.body&&(t.body.body||t.body.length>0);if(tt){let Ze=Oe(t,v);Ze=N(Ze,ee,ee,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),et=new E("mover",[Ze,de])}let lt=n&&n.body&&(n.body.body||n.body.length>0);if(lt){let Ze=Oe(n,v);Ze=N(Ze,ee,ee),Ge=new E("munder",[Ze,de])}let je;return je=tt||lt?tt&<?new E("munderover",[c,Ge,et]):tt?new E("mover",[c,et]):new E("munder",[c,Ge]):new E("mover",[c,oe]),y==="3.0"&&(je.style.height="1em"),je.setAttribute("accent","false"),je};$({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\yieldsLeftRight","\\chemequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:({parser:e,funcName:t},n,i)=>({type:"xArrow",mode:e.mode,name:t,body:n[0],below:i[0]}),mathmlBuilder(e,t){let n=[ie(e.name,e.body,e.below,t)];return n.unshift(st(.2778)),n.push(st(.2778)),new E("mrow",n)}});let pe={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};$({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,i){let c=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null,p=i[0]?{type:"hphantom",mode:e.mode,body:i[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:n[0],upperArrowBelow:p,lowerArrowBody:c,below:i[0]}},mathmlBuilder(e,t){let n=pe[e.name][0],i=pe[e.name][1],c=ie(n,e.body,e.upperArrowBelow,t),p=ie(i,e.lowerArrowBody,e.below,t),y,v=new E("mpadded",[c]);if(v.setAttribute("voffset","0.3em"),v.setAttribute("height","+0.3em"),v.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){let D=new E("mpadded",[p]);D.setAttribute("width","0.5em"),y=new E("mpadded",[st(.2778),D,v,st(.2778)])}else v.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),y=new E("mpadded",[st(.2778),v,p,st(.2778)]);return y.setAttribute("voffset","-0.18em"),y.setAttribute("height","-0.18em"),y.setAttribute("depth","+0.18em"),y}});let Pe={};function Se({type:e,names:t,props:n,handler:i,mathmlBuilder:c}){let p={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i};for(let y=0;y<t.length;++y)Pe[t[y]]=p;c&&(C[e]=c)}function Me(e,t){if(!e||e.type!==t)throw new Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function rt(e){let t=at(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return t}function at(e){return e&&(e.type==="atom"||e.type==="delimiter"||Object.prototype.hasOwnProperty.call(ze,e.type))?e:null}let Et={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Nt=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),Yt=e=>e.type==="textord"&&e.text==="@",Rt=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function wn(e,t,n){let i=Et[e];switch(i){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(i,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{let c={type:"atom",text:i,mode:"math",family:"rel"},p={type:"ordgroup",mode:"math",body:[n.callFunction("\\\\cdleft",[t[0]],[]),n.callFunction("\\Big",[c],[]),n.callFunction("\\\\cdright",[t[1]],[])],semisimple:!0};return n.callFunction("\\\\cdparent",[p],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{let c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}$({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>({type:"cdlabel",mode:e.mode,side:t.slice(4),label:n[0]}),mathmlBuilder(e,t){if(e.label.body.length===0)return new E("mrow",t);let n=Oe(e.label,t);e.side==="left"&&n.classes.push("tml-shift-left");let i=new E("mtd",[n]);i.style.padding="0";let c=new E("mtr",[i]),p=new E("mtable",[c]),y=new E("mpadded",[p]);return y.setAttribute("width","0.1px"),y.setAttribute("displaystyle","false"),y.setAttribute("scriptlevel","1"),y}}),$({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},t)=>({type:"cdlabelparent",mode:e.mode,fragment:t[0]}),mathmlBuilder:(e,t)=>new E("mrow",[Oe(e.fragment,t)])});let Ht=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),It=(e,t)=>({type:t,mode:"math",body:Ht(e)});class dt{constructor(t,n,i){this.lexer=t,this.start=n,this.end=i}static range(t,n){return n?t&&t.loc&&n.loc&&t.loc.lexer===n.loc.lexer?new dt(t.loc.lexer,t.loc.start,n.loc.end):null:t&&t.loc}}class St{constructor(t,n){this.text=t,this.loc=n}range(t,n){return new St(n,dt.range(this,t))}}let ut=0,Ot=1,Gt=2,xn=3,Wt={};function L(e,t){Wt[e]=t}let vn=Wt;L("\\noexpand",function(e){let t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),L("\\expandafter",function(e){let t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),L("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),L("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),L("\\@ifnextchar",function(e){let t=e.consumeArgs(3);e.consumeSpaces();let n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),L("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),L("\\TextOrMath",function(e){let t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});let Vt=e=>{let t="";for(let n=e.length-1;n>-1;n--)t+=e[n].text;return t},pt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},At=e=>{let t=e.future().text;return t==="EOF"?[null,""]:[pt[t.charAt(0)],t]},rn=(e,t,n)=>{for(let i=1;i<t.length;i++)e*=n,e+=pt[t.charAt(i)];return e};function wt(e){let t=e.consumeArgs(1)[0],n="",i=t[t.length-1].loc.start;for(let c=t.length-1;c>=0;c--){let p=t[c].loc.start;p>i&&(n+=" ",i=p),n+=t[c].text,i+=t[c].text.length}return n}L("\\char",function(e){let t,n=e.popToken(),i="";if(n.text==="'")t=8,n=e.popToken();else if(n.text==='"')t=16,n=e.popToken();else if(n.text==="`")if(n=e.popToken(),n.text[0]==="\\")i=n.text.charCodeAt(1);else{if(n.text==="EOF")throw new r("\\char` missing argument");i=n.text.charCodeAt(0)}else t=10;if(t){let c,p=n.text;if(i=pt[p.charAt(0)],i==null||i>=t)throw new r(`Invalid base-${t} digit ${n.text}`);for(i=rn(i,p,t),[c,p]=At(e);c!=null&&c<t;)i*=t,i+=c,i=rn(i,p,t),e.popToken(),[c,p]=At(e)}return`\\@char{${i}}`}),L("\\surd","\\sqrt{\\vphantom{|}}"),L("\u2295","\\oplus"),L("\\long",""),L("\\bgroup","{"),L("\\egroup","}"),L("~","\\nobreakspace"),L("\\lq","`"),L("\\rq","'"),L("\\aa","\\r a"),L("\\Bbbk","\\Bbb{k}"),L("\\mathstrut","\\vphantom{(}"),L("\\underbar","\\underline{\\text{#1}}"),L("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),L("\u22EE","\\vdots"),L("\\arraystretch","1"),L("\\arraycolsep","6pt"),L("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),L("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),L("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),L("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");let $t={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcap":"\\dotsb","\\bigsqcup":"\\dotsb","\\bigtimes":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\DOTSX":"\\dotsx"};L("\\dots",function(e){let t="\\dotso",n=e.expandAfterFuture().text;return n in $t?t=$t[n]:(n.slice(0,4)==="\\not"||n in Ne.math&&["bin","rel"].includes(Ne.math[n].group))&&(t="\\dotsb"),t});let Ft={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};L("\\dotso",function(e){return e.future().text in Ft?"\\ldots\\,":"\\ldots"}),L("\\dotsc",function(e){let t=e.future().text;return t in Ft&&t!==","?"\\ldots\\,":"\\ldots"}),L("\\cdots",function(e){return e.future().text in Ft?"\\@cdots\\,":"\\@cdots"}),L("\\dotsb","\\cdots"),L("\\dotsm","\\cdots"),L("\\dotsi","\\!\\cdots"),L("\\idotsint","\\int\\!\\cdots\\!\\int"),L("\\dotsx","\\ldots\\,"),L("\\DOTSI","\\relax"),L("\\DOTSB","\\relax"),L("\\DOTSX","\\relax"),L("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),L("\\,","{\\tmspace+{3mu}{.1667em}}"),L("\\thinspace","\\,"),L("\\>","\\mskip{4mu}"),L("\\:","{\\tmspace+{4mu}{.2222em}}"),L("\\medspace","\\:"),L("\\;","{\\tmspace+{5mu}{.2777em}}"),L("\\thickspace","\\;"),L("\\!","{\\tmspace-{3mu}{.1667em}}"),L("\\negthinspace","\\!"),L("\\negmedspace","{\\tmspace-{4mu}{.2222em}}"),L("\\negthickspace","{\\tmspace-{5mu}{.277em}}"),L("\\enspace","\\kern.5em "),L("\\enskip","\\hskip.5em\\relax"),L("\\quad","\\hskip1em\\relax"),L("\\qquad","\\hskip2em\\relax"),L("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax"),L("\\tag","\\@ifstar\\tag@literal\\tag@paren"),L("\\tag@paren","\\tag@literal{({#1})}"),L("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new r("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),L("\\notag","\\nonumber"),L("\\nonumber","\\gdef\\@eqnsw{0}"),L("\\bmod","\\mathbin{\\text{mod}}"),L("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),L("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),L("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),L("\\newline","\\\\\\relax"),L("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}"),L("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX"),L("\\Temml","\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}"),L("\\hspace","\\@ifstar\\@hspacer\\@hspace"),L("\\@hspace","\\hskip #1\\relax"),L("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),L("\\colon",'\\mathpunct{\\char"3a}'),L("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}"),L("\\ordinarycolon",'\\char"3a'),L("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}"),L("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}'),L("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}'),L("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}'),L("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}'),L("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}'),L("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}'),L("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),L("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),L("\\ratio","\\vcentcolon"),L("\\coloncolon","\\dblcolon"),L("\\colonequals","\\coloneqq"),L("\\coloncolonequals","\\Coloneqq"),L("\\equalscolon","\\eqqcolon"),L("\\equalscoloncolon","\\Eqqcolon"),L("\\colonminus","\\coloneq"),L("\\coloncolonminus","\\Coloneq"),L("\\minuscolon","\\eqcolon"),L("\\minuscoloncolon","\\Eqcolon"),L("\\coloncolonapprox","\\Colonapprox"),L("\\coloncolonsim","\\Colonsim"),L("\\notni","\\mathrel{\\char`\u220C}"),L("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),L("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),L("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),L("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),L("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}"),L("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}"),L("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}"),L("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}"),L("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}"),L("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),L("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),L("\\plim","\\DOTSB\\operatorname*{plim}"),L("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}"),L("\\bra","\\mathinner{\\langle{#1}|}"),L("\\ket","\\mathinner{|{#1}\\rangle}"),L("\\braket","\\mathinner{\\langle{#1}\\rangle}"),L("\\Bra","\\left\\langle#1\\right|"),L("\\Ket","\\left|#1\\right\\rangle");let Mt=(e,t)=>{let n=`}\\,\\middle${t[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+n+e.slice(t.index+t[0].length)};L("\\Braket",function(e){let t=wt(e),n=/\|\||\||\\\|/g,i;for(;(i=n.exec(t))!==null;)t=Mt(t,i);return"\\left\\langle{"+t+"}\\right\\rangle"}),L("\\Set",function(e){let t=wt(e),n=/\|\||\||\\\|/.exec(t);return n&&(t=Mt(t,n)),"\\left\\{\\:{"+t+"}\\:\\right\\}"}),L("\\set",function(e){return"\\{{"+wt(e).replace(/\|/,"}\\mid{")+"}\\}"}),L("\\angln","{\\angl n}"),L("\\odv","\\@ifstar\\odv@next\\odv@numerator"),L("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}"),L("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1"),L("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");let sn=e=>{let t=e[0][0].text,n=Vt(e[1]).split(","),i=String(n.length),c=i==="1"?"\\partial":`\\partial^${i}`,p="";return n.map(y=>{p+="\\partial "+y.trim()+"\\,"}),[t,c,p.replace(/\\,$/,"")]};function hn(e){let t=[];e.consumeSpaces();let n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}L("\\pdv@numerator",function(e){let[t,n,i]=sn(e.consumeArgs(2));return`\\frac{${n} ${t}}{${i}}`}),L("\\pdv@next",function(e){let[t,n,i]=sn(e.consumeArgs(2));return`\\frac{${n}}{${i}} ${t}`}),L("\\upalpha","\\up@greek{\\alpha}"),L("\\upbeta","\\up@greek{\\beta}"),L("\\upgamma","\\up@greek{\\gamma}"),L("\\updelta","\\up@greek{\\delta}"),L("\\upepsilon","\\up@greek{\\epsilon}"),L("\\upzeta","\\up@greek{\\zeta}"),L("\\upeta","\\up@greek{\\eta}"),L("\\uptheta","\\up@greek{\\theta}"),L("\\upiota","\\up@greek{\\iota}"),L("\\upkappa","\\up@greek{\\kappa}"),L("\\uplambda","\\up@greek{\\lambda}"),L("\\upmu","\\up@greek{\\mu}"),L("\\upnu","\\up@greek{\\nu}"),L("\\upxi","\\up@greek{\\xi}"),L("\\upomicron","\\up@greek{\\omicron}"),L("\\uppi","\\up@greek{\\pi}"),L("\\upalpha","\\up@greek{\\alpha}"),L("\\uprho","\\up@greek{\\rho}"),L("\\upsigma","\\up@greek{\\sigma}"),L("\\uptau","\\up@greek{\\tau}"),L("\\upupsilon","\\up@greek{\\upsilon}"),L("\\upphi","\\up@greek{\\phi}"),L("\\upchi","\\up@greek{\\chi}"),L("\\uppsi","\\up@greek{\\psi}"),L("\\upomega","\\up@greek{\\omega}"),L("\\invamp",'\\mathbin{\\char"214b}'),L("\\parr",'\\mathbin{\\char"214b}'),L("\\upand",'\\mathbin{\\char"214b}'),L("\\with",'\\mathbin{\\char"26}'),L("\\multimapinv",'\\mathrel{\\char"27dc}'),L("\\multimapboth",'\\mathrel{\\char"29df}'),L("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}'),L("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}'),L("\\coh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
|
|
6
|
+
{\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`),L("\\incoh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
|
|
7
|
+
{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`),L("\\standardstate","\\text{\\tiny\\char`\u29B5}");let Lt=e=>{if(!e.parser.settings.displayMode)throw new r(`{${e.envName}} can be used only in display mode.`)},zt=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Jt=e=>{let t=e.get("\\arraystretch");typeof t!="string"&&(t=Vt(t.tokens)),t=isNaN(t)?null:Number(t);let n=e.get("\\arraycolsep");typeof n!="string"&&(n=Vt(n.tokens));let i=zt.exec(n);return[t,i?{number:+(i[1]+i[2]),unit:i[3]}:null]},on=e=>{let t="";for(let n=0;n<e.length;n++)if(e[n].type==="label"){if(t)throw new r("Multiple \\labels in one row");t=e[n].string}return t};function Qt(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bt(e,{cols:t,envClasses:n,autoTag:i,singleRow:c,emptySingleRow:p,maxNumCols:y,leqno:v,arraystretch:D,arraycolsep:z},oe){let de=n&&n.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let ee=[],et=[ee],Ge=[],tt=[],lt=[],je=i!=null?[]:void 0;function Ze(){i&&e.gullet.macros.set("\\@eqnsw","1",!0)}function Ut(){je&&(e.gullet.macros.get("\\df@tag")?(je.push(e.subparse([new St("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):je.push(!!i&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(Ze(),lt.push(hn(e));;){let Tt=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),Tt={type:"ordgroup",mode:e.mode,body:Tt,semisimple:!0},ee.push(Tt);let An=e.fetch().text;if(An==="&"){if(y&&ee.length===y){if(!n.includes("array"))throw new r(y===2?"The split environment accepts no more than two columns":"The equation environment accepts only one column",e.nextToken);if(e.settings.strict)throw new r("Too few columns specified in the {array} column argument.",e.nextToken)}e.consume()}else{if(An===de){Ut(),ee.length===1&&Tt.body.length===0&&(et.length>1||!p)&&et.pop(),tt.push(on(Tt.body)),lt.length<et.length+1&<.push([]);break}if(An!=="\\\\")throw new r("Expected & or \\\\ or \\cr or "+de,e.nextToken);{let en;e.consume(),e.gullet.future().text!==" "&&(en=e.parseSizeGroup(!0)),Ge.push(en?en.value:null),Ut(),tt.push(on(Tt.body)),lt.push(hn(e)),ee=[],et.push(ee),Ze()}}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:et,cols:t,rowGaps:Ge,hLinesBeforeRow:lt,envClasses:n,autoTag:i,scriptLevel:oe,tags:je,labels:tt,leqno:v,arraystretch:D,arraycolsep:z}}function xt(e){return e.slice(0,1)==="d"?"display":"text"}let an={c:"center ",l:"left ",r:"right "},kn=e=>{let t=new E("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},gt=function(e,t){let n=[],i=e.body.length,c=e.hLinesBeforeRow,p=e.tags&&e.tags.some(z=>z);for(let z=0;z<i;z++){let oe=e.body[z],de=[],ee=e.scriptLevel==="text"?Ot:e.scriptLevel==="script"?Gt:ut;for(let je=0;je<oe.length;je++){let Ze=new E("mtd",[Oe(oe[je],t.withLevel(ee))]);if(e.envClasses.includes("multline")){let Ut=z===0?"left":z===i-1?"right":"center";Ut!=="center"&&Ze.classes.push("tml-"+Ut)}de.push(Ze)}let et=e.body[0].length;for(let je=0;je<et-oe.length;je++)de.push(new E("mtd",[],[],t));if(p){let je=e.tags[z],Ze;je===!0?Ze=new E("mtext",[new Re(["tml-eqn"])]):je===!1?Ze=new E("mtext",[],[]):(Ze=Qe(je[0].body,t.withLevel(ee),!0),Ze=Je(Ze),Ze.classes=["tml-tag"]),Ze&&(de.unshift(kn(e)),de.push(kn(e)),e.leqno?de[0].children.push(Ze):de[de.length-1].children.push(Ze))}let Ge=new E("mtr",de,[]),tt=e.labels.shift();tt&&e.tags&&e.tags[z]&&(Ge.setAttribute("id",tt),Array.isArray(e.tags[z])&&Ge.classes.push("tml-tageqn")),z===0&&c[0].length>0&&(c[0].length===2?Ge.children.forEach(je=>{je.style.borderTop="0.15em double"}):Ge.children.forEach(je=>{je.style.borderTop=c[0][0]?"0.06em dashed":"0.06em solid"})),c[z+1].length>0&&(c[z+1].length===2?Ge.children.forEach(je=>{je.style.borderBottom="0.15em double"}):Ge.children.forEach(je=>{je.style.borderBottom=c[z+1][0]?"0.06em dashed":"0.06em solid"}));let lt=!0;for(let je=0;je<Ge.children.length;je++){let Ze=Ge.children[je].children[0];if(!Ze||Ze.type!=="mpadded"||Ze.attributes.height!=="0px"){lt=!1;break}}if(lt){Ge.classes.push("ff-squash");for(let je=0;je<Ge.children.length;je++)Ge.children[je].style.paddingTop="0",Ge.children[je].style.paddingBottom="0"}n.push(Ge)}if(e.arraystretch&&e.arraystretch!==1){let z=String(1.4*e.arraystretch-.8)+"ex";for(let oe=0;oe<n.length;oe++)for(let de=0;de<n[oe].children.length;de++)n[oe].children[de].style.paddingTop=z,n[oe].children[de].style.paddingBottom=z}let y,v;if(e.envClasses.length>0&&(y=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",v="em"),e.arraycolsep){let z=it(e.arraycolsep,t);y=z.number.toFixed(4),v=z.unit}if(y){let z=n.length===0?0:n[0].children.length,oe=(de,ee)=>de===0&&ee===0||de===z-1&&ee===1?"0":e.envClasses[0]!=="align"?y:ee===1?"0":p?de%2?"1":"0":de%2?"0":"1";for(let de=0;de<n.length;de++)for(let ee=0;ee<n[de].children.length;ee++)n[de].children[ee].style.paddingLeft=`${oe(ee,0)}${v}`,n[de].children[ee].style.paddingRight=`${oe(ee,1)}${v}`}if(e.envClasses.length===0)for(let z=0;z<n.length;z++)n[z].children[0].style.paddingLeft="0em",n[z].children.length===n[0].children.length&&(n[z].children[n[z].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){let z=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let oe=0;oe<n.length;oe++){let de=n[oe];if(z){for(let ee=0;ee<de.children.length;ee++)de.children[ee].classes=["tml-"+(ee%2?"left":"right")];if(p){let ee=e.leqno?0:de.children.length-1;de.children[ee].classes=[]}}if(de.children.length>1&&e.envClasses.includes("cases")&&(de.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let ee of de.children)ee.classes.push("tml-left")}}let D=new E("mtable",n);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?D.classes.push("tml-jot"):e.envClasses.includes("small")&&D.classes.push("tml-small")),e.scriptLevel==="display"&&D.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(D.style.width="100%"),e.cols&&e.cols.length>0){let z=e.cols,oe=!1,de=0,ee=z.length;for(;z[de].type==="separator";)de+=1;for(;z[ee-1].type==="separator";)ee-=1;if(z[0].type==="separator"){let Ge=z[1].type==="separator"?"0.15em double":z[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(let tt of D.children)tt.children[0].style.borderLeft=Ge}let et=p?0:-1;for(let Ge=de;Ge<ee;Ge++)if(z[Ge].type==="align"){let tt=an[z[Ge].align];et+=1;for(let lt of D.children)tt.trim()!=="center"&&et<lt.children.length&&(lt.children[et].classes=["tml-"+tt.trim()]);oe=!0}else if(z[Ge].type==="separator"){if(oe){let tt=z[Ge+1].type==="separator"?"0.15em double":z[Ge].separator==="|"?"0.06em solid":"0.06em dashed";for(let lt of D.children)et<lt.children.length&&(lt.children[et].style.borderRight=tt)}oe=!1}if(z[z.length-1].type==="separator"){let Ge=z[z.length-2].type==="separator"?"0.15em double":z[z.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(let tt of D.children)tt.children[tt.children.length-1].style.borderRight=Ge,tt.children[tt.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(D=new E("mstyle",[D]),D.setAttribute("scriptlevel","1")),D},T=function(e,t){e.envName.indexOf("ed")===-1&&Lt(e);let n=e.envName==="split",i=[],c=Bt(e.parser,{cols:i,emptySingleRow:!0,autoTag:n?void 0:Qt(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display"),p,y=0,v=e.envName.indexOf("at")>-1;if(t[0]&&v){let D="";for(let z=0;z<t[0].body.length;z++)D+=Me(t[0].body[z],"textord").text;if(isNaN(D))throw new r("The alignat enviroment requires a numeric first argument.");p=Number(D),y=2*p}c.body.forEach(function(D){if(v){let z=D.length/2;if(p<z)throw new r(`Too many math in a row: expected ${p}, but got ${z}`,D[0])}else y<D.length&&(y=D.length)});for(let D=0;D<y;++D){let z="r";D%2==1&&(z="l"),i[D]={type:"align",align:z}}return e.envName==="split"||(v?c.envClasses.push("alignat"):c.envClasses[0]="align"),c};Se({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){let n=(at(t[0])?[t[0]]:Me(t[0],"ordgroup").body).map(function(y){let v=rt(y).text;if("lcr".indexOf(v)!==-1)return{type:"align",align:v};if(v==="|")return{type:"separator",separator:"|"};if(v===":")return{type:"separator",separator:":"};throw new r("Unknown column alignment: "+v,y)}),[i,c]=Jt(e.parser.gullet.macros),p={cols:n,envClasses:["array"],maxNumCols:n.length,arraystretch:i,arraycolsep:c};return Bt(e.parser,p,xt(e.envName))},mathmlBuilder:gt}),Se({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){let t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",i={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){let v=e.parser;if(v.consumeSpaces(),v.fetch().text==="["){if(v.consume(),v.consumeSpaces(),n=v.fetch().text,"lcr".indexOf(n)===-1)throw new r("Expected l or c or r",v.nextToken);v.consume(),v.consumeSpaces(),v.expect("]"),v.consume(),i.cols=[]}}let c=Bt(e.parser,i,"text");c.cols=c.body.length>0?new Array(c.body[0].length).fill({type:"align",align:n}):[];let[p,y]=Jt(e.parser.gullet.macros);return c.arraystretch=p,!y||y===6&&y==="pt"||(c.arraycolsep=y),t?{type:"leftright",mode:e.mode,body:[c],left:t[0],right:t[1],rightColor:void 0}:c},mathmlBuilder:gt}),Se({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){let t=Bt(e.parser,{cols:[],envClasses:["bordermatrix"]},"text");return t.cols=t.body.length>0?new Array(t.body[0].length).fill({type:"align",align:"c"}):[],t.envClasses=[],t.arraystretch=1,e.envName==="matrix"?t:((n,i)=>{let c=n.body;c[0].shift();let p=new Array(c.length-1).fill().map(()=>[]);for(let oe=1;oe<c.length;oe++){p[oe-1].push(c[oe].shift());let de=[];for(let ee=0;ee<c[oe].length;ee++)de.push(c[oe][ee]);p[oe-1].push(It(de,"vphantom"))}let y=new Array(c.length).fill().map(()=>[]);for(let oe=0;oe<c[0].length;oe++)y[0].push(c[0][oe]);for(let oe=1;oe<c.length;oe++)for(let de=0;de<c[0].length;de++)y[oe].push(It(c[oe][de].body,"hphantom"));for(let oe=0;oe<c[0].length;oe++)c[0][oe]=It(c[0][oe].body,"hphantom");let v={type:"array",mode:"math",body:p,cols:[{type:"align",align:"c"}],rowGaps:new Array(p.length-1).fill(null),hLinesBeforeRow:new Array(p.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(p.length).fill(""),arraycolsep:{number:.04,unit:"em"}},D={type:"styling",mode:"math",scriptLevel:"text",body:[{type:"array",mode:"math",body:y,cols:new Array(y.length).fill({type:"align",align:"c"}),rowGaps:new Array(y.length-1).fill(null),hLinesBeforeRow:new Array(y.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(y.length).fill(""),arraycolsep:null}]},z={type:"leftright",mode:"math",body:[n],left:i?i[0]:"(",right:i?i[1]:")",rightColor:void 0};return Ht([v,{type:"supsub",mode:"math",stack:!0,base:{type:"op",mode:"math",limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[z]},sup:D,sub:null}])})(t,e.delimiters)},mathmlBuilder:gt}),Se({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:e=>Bt(e.parser,{envClasses:["small"]},"script"),mathmlBuilder:gt}),Se({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){let n=(at(t[0])?[t[0]]:Me(t[0],"ordgroup").body).map(function(c){let p=rt(c).text;if("lc".indexOf(p)!==-1)return{type:"align",align:p};throw new r("Unknown column alignment: "+p,c)});if(n.length>1)throw new r("{subarray} can contain only one column");let i={cols:n,envClasses:["small"]};if(i=Bt(e.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new r("{subarray} can contain only one column");return i},mathmlBuilder:gt}),Se({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){let t=Bt(e.parser,{cols:[],envClasses:["cases"]},xt(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:gt}),Se({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:T,mathmlBuilder:gt}),Se({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:T,mathmlBuilder:gt}),Se({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&Lt(e);let t={cols:[],envClasses:["abut","jot"],autoTag:Qt(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},mathmlBuilder:gt}),Se({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Lt(e);let t={autoTag:Qt(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},mathmlBuilder:gt}),Se({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){Lt(e);let t={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},mathmlBuilder:gt}),Se({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(Lt(e),function(t){let n=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){n.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();let p=t.fetch().text;if(p!=="&"&&p!=="\\\\"){if(p==="\\end"){n[n.length-1].length===0&&n.pop();break}throw new r("Expected \\\\ or \\cr or \\end",t.nextToken)}t.consume()}let i=[],c=[i];for(let p=0;p<n.length;p++){let y=n[p],v=Nt();for(let D=0;D<y.length;D++)if(Yt(y[D])){i.push(v),D+=1;let z=rt(y[D]).text,oe=new Array(2);if(oe[0]={type:"ordgroup",mode:"math",body:[]},oe[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(z)>-1)){if(!("<>AV".indexOf(z)>-1))throw new r('Expected one of "<>AV=|." after @.');for(let ee=0;ee<2;ee++){let et=!0;for(let Ge=D+1;Ge<y.length;Ge++){if(Rt(y[Ge],z)){et=!1,D=Ge;break}if(Yt(y[Ge]))throw new r("Missing a "+z+" character to complete a CD arrow.",y[Ge]);oe[ee].body.push(y[Ge])}if(et)throw new r("Missing a "+z+" character to complete a CD arrow.",y[D])}}let de=wn(z,oe,t);i.push(de),v=Nt()}else v.body.push(y[D]);p%2==0?i.push(v):i.shift(),i=[],c.push(i)}return c.pop(),t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:"math",body:c,tags:null,labels:new Array(c.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(c.length+1).fill([])}}(e.parser)),mathmlBuilder:gt}),$({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new r(`${e.funcName} valid only within array environment`)}});let K=Pe;$({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},n,i)=>{let c=["(",")"];if(t==="\\bordermatrix"&&i[0]&&i[0].body){let D=i[0].body;D.length===1&&D[0].type==="delimiter"&&(c=[D[0].left,D[0].right])}e.consumeSpaces(),e.consume();let p=K.bordermatrix,y={mode:e.mode,envName:t.slice(1),delimiters:c,parser:e},v=p.handler(y);return e.expect("}",!0),v}}),$({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},t){let n=t[0],i=t[1];return{type:"cancelto",mode:e.mode,body:i,to:n,isCharacterBox:b(i)}},mathmlBuilder(e,t){let n=new E("mrow",[Oe(e.body,t)],["ff-narrow"]),i=new E("mphantom",[Oe(e.body,t)]),c=new E("mrow",[i],["tml-cancelto"]);c.style.color=t.color,e.isCharacterBox&&S.indexOf(e.body.body[0].text)>-1&&(c.style.left="0.1em",c.style.width="90%");let p=new E("mrow",[n,c],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))i.style.paddingRight="0.2em";else{i.style.padding="0.5ex 0.1em 0 0";let de=new E("mspace",[]);de.setAttribute("height","0.85em"),n.children.push(de)}let y;if(e.isCharacterBox)y=new E("mspace",[]),y.setAttribute("height","1em");else{let de=Oe(e.body,t),ee=new E("mpadded",[de]);ee.setAttribute("width","0.1px"),y=new E("mphantom",[ee])}let v=Oe(e.to,t);v.style.color=t.color;let D=new E("mpadded",[v]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let de=new E("mspace",[]);de.setAttribute("width","0.2em"),D.children.unshift(de)}D.setAttribute("width","0.1px");let z=new E("mover",[y,D]),oe=new E("mrow",[],["ff-nudge-left"]);return xe([re([p,z]),oe])}}),$({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},n){let i=Me(n[0],"ordgroup").body,c="";for(let y=0;y<i.length;y++)c+=Me(i[y],"textord").text;let p=parseInt(c);if(isNaN(p))throw new r(`\\@char has non-numeric argument ${c}`,t);return{type:"textord",mode:e.mode,text:String.fromCodePoint(p)}}});let w=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,_=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,A=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,R=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Z=/^[a-f0-9]{6}$/i,ue=e=>{let t=e.toString(16);return t.length===1&&(t="0"+t),t},We=JSON.parse(`{
|
|
8
|
+
"Apricot": "#ffb484",
|
|
9
|
+
"Aquamarine": "#08b4bc",
|
|
10
|
+
"Bittersweet": "#c84c14",
|
|
11
|
+
"blue": "#0000FF",
|
|
12
|
+
"Blue": "#303494",
|
|
13
|
+
"BlueGreen": "#08b4bc",
|
|
14
|
+
"BlueViolet": "#503c94",
|
|
15
|
+
"BrickRed": "#b8341c",
|
|
16
|
+
"brown": "#BF8040",
|
|
17
|
+
"Brown": "#802404",
|
|
18
|
+
"BurntOrange": "#f8941c",
|
|
19
|
+
"CadetBlue": "#78749c",
|
|
20
|
+
"CarnationPink": "#f884b4",
|
|
21
|
+
"Cerulean": "#08a4e4",
|
|
22
|
+
"CornflowerBlue": "#40ace4",
|
|
23
|
+
"cyan": "#00FFFF",
|
|
24
|
+
"Cyan": "#08acec",
|
|
25
|
+
"Dandelion": "#ffbc44",
|
|
26
|
+
"darkgray": "#404040",
|
|
27
|
+
"DarkOrchid": "#a8548c",
|
|
28
|
+
"Emerald": "#08ac9c",
|
|
29
|
+
"ForestGreen": "#089c54",
|
|
30
|
+
"Fuchsia": "#90348c",
|
|
31
|
+
"Goldenrod": "#ffdc44",
|
|
32
|
+
"gray": "#808080",
|
|
33
|
+
"Gray": "#98949c",
|
|
34
|
+
"green": "#00FF00",
|
|
35
|
+
"Green": "#08a44c",
|
|
36
|
+
"GreenYellow": "#e0e474",
|
|
37
|
+
"JungleGreen": "#08ac9c",
|
|
38
|
+
"Lavender": "#f89cc4",
|
|
39
|
+
"lightgray": "#c0c0c0",
|
|
40
|
+
"lime": "#BFFF00",
|
|
41
|
+
"LimeGreen": "#90c43c",
|
|
42
|
+
"magenta": "#FF00FF",
|
|
43
|
+
"Magenta": "#f0048c",
|
|
44
|
+
"Mahogany": "#b0341c",
|
|
45
|
+
"Maroon": "#b03434",
|
|
46
|
+
"Melon": "#f89c7c",
|
|
47
|
+
"MidnightBlue": "#086494",
|
|
48
|
+
"Mulberry": "#b03c94",
|
|
49
|
+
"NavyBlue": "#086cbc",
|
|
50
|
+
"olive": "#7F7F00",
|
|
51
|
+
"OliveGreen": "#407c34",
|
|
52
|
+
"orange": "#FF8000",
|
|
53
|
+
"Orange": "#f8843c",
|
|
54
|
+
"OrangeRed": "#f0145c",
|
|
55
|
+
"Orchid": "#b074ac",
|
|
56
|
+
"Peach": "#f8945c",
|
|
57
|
+
"Periwinkle": "#8074bc",
|
|
58
|
+
"PineGreen": "#088c74",
|
|
59
|
+
"pink": "#ff7f7f",
|
|
60
|
+
"Plum": "#98248c",
|
|
61
|
+
"ProcessBlue": "#08b4ec",
|
|
62
|
+
"purple": "#BF0040",
|
|
63
|
+
"Purple": "#a0449c",
|
|
64
|
+
"RawSienna": "#983c04",
|
|
65
|
+
"red": "#ff0000",
|
|
66
|
+
"Red": "#f01c24",
|
|
67
|
+
"RedOrange": "#f86434",
|
|
68
|
+
"RedViolet": "#a0246c",
|
|
69
|
+
"Rhodamine": "#f0549c",
|
|
70
|
+
"Royallue": "#0874bc",
|
|
71
|
+
"RoyalPurple": "#683c9c",
|
|
72
|
+
"RubineRed": "#f0047c",
|
|
73
|
+
"Salmon": "#f8948c",
|
|
74
|
+
"SeaGreen": "#30bc9c",
|
|
75
|
+
"Sepia": "#701404",
|
|
76
|
+
"SkyBlue": "#48c4dc",
|
|
77
|
+
"SpringGreen": "#c8dc64",
|
|
78
|
+
"Tan": "#e09c74",
|
|
79
|
+
"teal": "#007F7F",
|
|
80
|
+
"TealBlue": "#08acb4",
|
|
81
|
+
"Thistle": "#d884b4",
|
|
82
|
+
"Turquoise": "#08b4cc",
|
|
83
|
+
"violet": "#800080",
|
|
84
|
+
"Violet": "#60449c",
|
|
85
|
+
"VioletRed": "#f054a4",
|
|
86
|
+
"WildStrawberry": "#f0246c",
|
|
87
|
+
"yellow": "#FFFF00",
|
|
88
|
+
"Yellow": "#fff404",
|
|
89
|
+
"YellowGreen": "#98cc6c",
|
|
90
|
+
"YellowOrange": "#ffa41c"
|
|
91
|
+
}`),ot=(e,t)=>{let n="";if(e==="HTML"){if(!w.test(t))throw new r("Invalid HTML input.");n=t}else if(e==="RGB"){if(!A.test(t))throw new r("Invalid RGB input.");t.split(",").map(i=>{n+=ue(Number(i.trim()))})}else{if(!R.test(t))throw new r("Invalid rbg input.");t.split(",").map(i=>{let c=Number(i.trim());if(c>1)throw new r("Color rgb input must be < 1.");n+=ue(Number((255*c).toFixed(0)))})}return n.charAt(0)!=="#"&&(n="#"+n),n},bt=(e,t,n)=>{let i=`\\\\color@${e}`;if(!_.exec(e))throw new r("Invalid color: '"+e+"'",n);return Z.test(e)?"#"+e:(e.charAt(0)==="#"||(t.has(i)?e=t.get(i).tokens[0].text:We[e]&&(e=We[e])),e)},mn=(e,t)=>{let n=Le(e.body,t.withColor(e.color));return n.length===0&&n.push(new E("mrow")),n=n.map(i=>(i.style.color=e.color,i)),xe(n)};$({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},n,i){let c=i[0]&&Me(i[0],"raw").string,p="";if(c){let v=Me(n[0],"raw").string;p=ot(c,v)}else p=bt(Me(n[0],"raw").string,e.gullet.macros,t);let y=n[1];return{type:"color",mode:e.mode,color:p,isTextColor:!0,body:se(y)}},mathmlBuilder:mn}),$({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:n},i,c){let p=c[0]&&Me(c[0],"raw").string,y="";if(p){let D=Me(i[0],"raw").string;y=ot(p,D)}else y=bt(Me(i[0],"raw").string,e.gullet.macros,n);let v=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:y,isTextColor:!1,body:v}},mathmlBuilder:mn}),$({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:t,token:n},i){let c=Me(i[0],"raw").string;if(!/^[A-Za-z]+$/.test(c))throw new r("Color name must be latin letters.",n);let p=Me(i[1],"raw").string;if(!["HTML","RGB","rgb"].includes(p))throw new r("Color model must be HTML, RGB, or rgb.",n);let y=Me(i[2],"raw").string,v=ot(p,y);return e.gullet.macros.set(`\\\\color@${c}`,{tokens:[{text:v}],numArgs:0}),{type:"internal",mode:e.mode}}}),$({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,n){let i=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,c=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:c,size:i&&Me(i,"size").value}},mathmlBuilder(e,t){let n=new E("mo");if(e.newLine&&(n.setAttribute("linebreak","newline"),e.size)){let i=it(e.size,t);n.setAttribute("height",i.number+i.unit)}return n}});let Dn={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Zn=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new r("Expected a control sequence",e);return t},is=(e,t,n,i)=>{let c=e.gullet.macros.get(n.text);c==null&&(n.noexpand=!0,c={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,c,i)};$({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();let n=e.fetch();if(Dn[n.text])return t!=="\\global"&&t!=="\\\\globallong"||(n.text=Dn[n.text]),Me(e.parseFunction(),"internal");throw new r("Invalid token after macro prefix",n)}}),$({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new r("Expected a control sequence",n);let c,p=0,y=[[]];for(;e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){c=e.gullet.future(),y[p].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new r(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==p+1)throw new r(`Argument number "${n.text}" out of order`);p++,y.push([])}else{if(n.text==="EOF")throw new r("Expected a macro definition");y[p].push(n.text)}let{tokens:v}=e.gullet.consumeArg();if(c&&v.unshift(c),t==="\\edef"||t==="\\xdef"){if(v=e.gullet.expandTokens(v),v.length>e.gullet.settings.maxExpand)throw new r("Too many expansions in an "+t);v.reverse()}return e.gullet.macros.set(i,{tokens:v,numArgs:p,delimiters:y},t===Dn[t]),{type:"internal",mode:e.mode}}}),$({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=Zn(e.gullet.popToken());e.gullet.consumeSpaces();let i=(c=>{let p=c.gullet.popToken();return p.text==="="&&(p=c.gullet.popToken(),p.text===" "&&(p=c.gullet.popToken())),p})(e);return is(e,n,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),$({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=Zn(e.gullet.popToken()),i=e.gullet.popToken(),c=e.gullet.popToken();return is(e,n,c,t==="\\\\globalfuture"),e.gullet.pushToken(c),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}}),$({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n="",i=e.gullet.popToken();i.text==="{"?(n=Zn(e.gullet.popToken()),e.gullet.popToken()):n=Zn(i);let c=e.gullet.isDefined(n);if(c&&t==="\\newcommand")throw new r(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!c&&t==="\\renewcommand")throw new r(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let p=0;if(e.gullet.future().text==="["){let v=e.gullet.popToken();if(v=e.gullet.popToken(),!/^[0-9]$/.test(v.text))throw new r(`Invalid number of arguments: "${v.text}"`);if(p=parseInt(v.text),v=e.gullet.popToken(),v.text!=="]")throw new r(`Invalid argument "${v.text}"`)}let{tokens:y}=e.gullet.consumeArg();return t==="\\providecommand"&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:y,numArgs:p}),{type:"internal",mode:e.mode}}});let Ar={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},_r={"(":")","\\lparen":"\\rparen","[":"]","\\lbrack":"\\rbrack","\\{":"\\}","\\lbrace":"\\rbrace","\u2987":"\u2988","\\llparenthesis":"\\rrparenthesis","\\lfloor":"\\rfloor","\u230A":"\u230B","\\lceil":"\\rceil","\u2308":"\u2309","\\langle":"\\rangle","\u27E8":"\u27E9","\\lAngle":"\\rAngle","\u27EA":"\u27EB","\\llangle":"\\rrangle","\u2989":"\u298A","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lgroup":"\\rgroup","\u27EE":"\u27EF","\\lmoustache":"\\rmoustache","\u23B0":"\u23B1","\\llbracket":"\\rrbracket","\u27E6":"\u27E7","\\lBrace":"\\rBrace","\u2983":"\u2984"},Gi=new Set(Object.keys(_r));new Set(Object.values(_r));let as=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\u2987","\\llparenthesis","\u2988","\\rrparenthesis","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lAngle","\u27EA","\\rAngle","\u27EB","\\llangle","\u2989","\\rrangle","\u298A","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","\\llbracket","\\rrbracket","\u27E6","\u27E7","\\lBrace","\\rBrace","\u2983","\u2984","/","\\backslash","|","\\vert","\\|","\\Vert","\u2016","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]),ji=new Set(["}","\\left","\\middle","\\right"]),Xn=e=>e.length>0&&(as.has(e)||Ar[e]||ji.has(e)),ls=[0,1.2,1.8,2.4,3];function qn(e,t){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);let n=at(e);if(n&&as.has(n.text))return n.text!=="<"&&n.text!=="\\lt"||(n.text="\u27E8"),n.text!==">"&&n.text!=="\\gt"||(n.text="\u27E9"),n;throw new r(n?`Invalid delimiter '${n.text}' after '${t.funcName}'`:`Invalid delimiter type '${e.type}'`,e)}let Ki=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),Yn=(e,t,n,i)=>{let c=new E("mo",[ne(e==="."?"":e,t)]);return c.setAttribute("fence","true"),c.setAttribute("form",n),c.setAttribute("stretchy",i?"true":"false"),c};function cs(e){if(!e.body)throw new Error("Bug: The delim ParseNode wasn't fully parsed.")}$({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qn(t[0],e),i={type:"delimsizing",mode:e.parser.mode,size:Ar[e.funcName].size,mclass:Ar[e.funcName].mclass,delim:n.text},c=e.parser.fetch().text;return c!=="^"&&c!=="_"?i:{type:"ordgroup",mode:"math",body:[i,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{let t=[],n=e.delim==="."?"":e.delim;t.push(ne(n,e.mode));let i=new E("mo",t);return e.mclass==="mopen"||e.mclass==="mclose"?i.setAttribute("fence","true"):i.setAttribute("fence","false"),(Ki.has(n)||n.indexOf("arrow")>-1)&&i.setAttribute("stretchy","true"),i.setAttribute("symmetric","true"),i.setAttribute("minsize",ls[e.size]+"em"),i.setAttribute("maxsize",ls[e.size]+"em"),i}}),$({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:qn(t[0],e).text})}),$({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qn(t[0],e),i=e.parser;++i.leftrightDepth;let c=i.parseExpression(!1,"\\right",!0),p=i.fetch();for(;p.text==="\\middle";){i.consume();let v=i.fetch().text;if(!Ne.math[v])throw new r(`Invalid delimiter '${v}' after '\\middle'`);qn({type:"atom",mode:"math",text:v},{funcName:"\\middle"}),c.push({type:"middle",mode:"math",delim:v}),i.consume(),c=c.concat(i.parseExpression(!1,"\\right",!0)),p=i.fetch()}--i.leftrightDepth,i.expect("\\right",!1);let y=Me(i.parseFunction(),"leftright-right");return{type:"leftright",mode:i.mode,body:c,left:n.text,right:y.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{cs(e);let n=Le(e.body,t),i=Yn(e.left,e.mode,"prefix",!0);n.unshift(i);let c=Yn(e.right,e.mode,"postfix",!0);if(e.body.length>0){let p=e.body[e.body.length-1];p.type!=="color"||p.isTextColor||c.setAttribute("mathcolor",p.color)}return n.push(c),re(n)}}),$({type:"delimiter",names:Array.from(Gi),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:t,token:n})=>{if(e.mode==="text")return{type:"textord",mode:"text",text:t,loc:n.loc};if(!e.settings.wrapDelimiterPairs)return{type:"atom",mode:"math",family:"open",loc:n.loc,text:t};let i=_r[t],c=e.parseExpression(!1,i,!1);if(e.fetch().text!==i)throw new r("Unmatched delimiter");return e.consume(),{type:"delimiter",mode:e.mode,body:c,left:t,right:i}},mathmlBuilder:(e,t)=>{cs(e);let n=Le(e.body,t),i=Yn(e.left,e.mode,"prefix",!1);n.unshift(i);let c=Yn(e.right,e.mode,"postfix",!1);if(e.body.length>0){let p=e.body[e.body.length-1];p.type!=="color"||p.isTextColor||c.setAttribute("mathcolor",p.color)}return n.push(c),re(n)}}),$({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qn(t[0],e);if(!e.parser.leftrightDepth)throw new r("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},mathmlBuilder:e=>{let t=ne(e.delim,e.mode),n=new E("mo",[t]);return n.setAttribute("stretchy","true"),n.setAttribute("form","infix"),t.text!=="/"&&(n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em")),n}});let Wi=["\\boxed","\\fcolorbox","\\colorbox"],En=(e,t)=>{let n=Wi.includes(e.label)?"mrow":"menclose",i=new E(n,[Oe(e.body,t)]);switch(e.label){case"\\overline":i.setAttribute("notation","top"),i.classes.push("tml-overline");break;case"\\underline":i.setAttribute("notation","bottom"),i.classes.push("tml-underline");break;case"\\cancel":i.setAttribute("notation","updiagonalstrike"),i.children.push(new E("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":i.setAttribute("notation","downdiagonalstrike"),i.children.push(new E("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":i.setAttribute("notation","horizontalstrike"),i.children.push(new E("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":i.setAttribute("notation","updiagonalstrike downdiagonalstrike"),i.children.push(new E("mrow",[],["tml-cancel","tml-xcancel"]));break;case"\\longdiv":i.setAttribute("notation","longdiv"),i.classes.push("longdiv-top"),i.children.push(new E("mrow",[],["longdiv-arc"]));break;case"\\phase":i.setAttribute("notation","phasorangle"),i.classes.push("phasor-bottom"),i.children.push(new E("mrow",[],["phasor-angle"]));break;case"\\textcircled":i.setAttribute("notation","circle"),i.classes.push("circle-pad"),i.children.push(new E("mrow",[],["textcircle"]));break;case"\\angl":i.setAttribute("notation","actuarial"),i.classes.push("actuarial");break;case"\\boxed":i.style.padding="3pt",i.style.border="1px solid",i.setAttribute("scriptlevel","0"),i.setAttribute("displaystyle","true");break;case"\\fbox":i.setAttribute("notation","box"),i.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":i.style.padding="0.3em",e.label==="\\fcolorbox"&&(i.style.border="0.0667em solid "+String(e.borderColor))}return e.backgroundColor&&i.setAttribute("mathbackground",e.backgroundColor),i};$({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},n,i){let c=i[0]&&Me(i[0],"raw").string,p="";if(c){let v=Me(n[0],"raw").string;p=ot(c,v)}else p=bt(Me(n[0],"raw").string,e.gullet.macros);let y=n[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,body:y}},mathmlBuilder:En}),$({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},n,i){let c=i[0]&&Me(i[0],"raw").string,p,y="";if(c){let D=Me(n[0],"raw").string,z=Me(n[0],"raw").string;y=ot(c,D),p=ot(c,z)}else y=bt(Me(n[0],"raw").string,e.gullet.macros),p=bt(Me(n[1],"raw").string,e.gullet.macros);let v=n[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:p,borderColor:y,body:v}},mathmlBuilder:En}),$({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]})}),$({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"enclose",mode:e.mode,label:t,body:i}},mathmlBuilder:En}),$({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:t},n){let i=n[0];if(i.type!=="ordgroup")throw new r("Invalid environment name",i);let c="";for(let p=0;p<i.body.length;++p)c+=Me(i.body[p],"textord").text;if(t==="\\begin"){if(!Object.prototype.hasOwnProperty.call(K,c))throw new r("No such environment: "+c,i);let p=K[c],{args:y,optArgs:v}=e.parseArguments("\\begin{"+c+"}",p),D={mode:e.mode,envName:c,parser:e},z=p.handler(D,y,v);e.expect("\\end",!1);let oe=e.nextToken,de=Me(e.parseFunction(),"environment");if(de.name!==c)throw new r(`Mismatch: \\begin{${c}} matched by \\end{${de.name}}`,oe);return z}return{type:"environment",mode:e.mode,name:c,nameGroup:i}}}),$({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},t)=>({type:"envTag",mode:e.mode,body:t[0]}),mathmlBuilder:(e,t)=>new E("mrow")}),$({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,t)=>new E("mrow")});let ds=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),Vi=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),Zi=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),us=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),Xi=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),ps=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),Yi=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),Ji=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>ds[e]||119899,"script-bold":e=>119951,fraktur:e=>Vi[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>Zi[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>e==="h"?8358:119789,"bold-italic":e=>119841,script:e=>ds[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>e==="\u03D5"?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>us[e]||-51,italic:e=>0,"bold-italic":e=>Xi[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>ps[e]||116,"sans-serif-bold":e=>ps[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Yi[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),Sn=(e,t)=>{let n=e.codePointAt(0),i=64<n&&n<91?"upperCaseLatin":96<n&&n<123?"lowerCaseLatin":912<n&&n<938?"upperCaseGreek":944<n&&n<970||e==="\u03D5"?"lowerCaseGreek":120545<n&&n<120572||us[e]?"varGreek":47<n&&n<58?"numeral":"other";return i==="other"?e:String.fromCodePoint(n+Ji[i][t](e))},Qi=Object.freeze({a:"\u1D00",b:"\u0299",c:"\u1D04",d:"\u1D05",e:"\u1D07",f:"\uA730",g:"\u0262",h:"\u029C",i:"\u026A",j:"\u1D0A",k:"\u1D0B",l:"\u029F",m:"\u1D0D",n:"\u0274",o:"\u1D0F",p:"\u1D18",q:"\u01EB",r:"\u0280",s:"s",t:"\u1D1B",u:"\u1D1C",v:"\u1D20",w:"\u1D21",x:"x",y:"\u028F",z:"\u1D22"}),ea=["mathrm","mathit"],hs=(e,t)=>{let n=e.font,i=t.withFont(n),c=Oe(e.body,i);if(c.children.length===0)return c;if(n==="boldsymbol"&&["mo","mpadded","mrow"].includes(c.type))return c.style.fontWeight="bold",c;if(((v,D)=>{if(!ea.includes(D)||!v.body||v.body.type!=="ordgroup"||v.body.body.length===1||v.body.body[0].type!=="mathord")return!1;for(let z=1;z<v.body.body.length;z++){let oe=v.body.body[z].type;if(oe!=="mathord"&&(oe!=="textord"||isNaN(v.body.body[z].text)))return!1}return!0})(e,n)){let v=c.children[0].children[0].children?c.children[0].children[0]:c.children[0];delete v.attributes.mathvariant;for(let z=1;z<c.children.length;z++)v.children[0].text+=c.children[z].children[0].children?c.children[z].children[0].children[0].text:c.children[z].children[0].text;if(n==="mathit")return v.children[0].text=v.children[0].text.split("").map(z=>Sn(z,"italic")).join(""),v;let D=new E("mpadded",[v]);return D.setAttribute("lspace","0"),D}let p=c.children[0].type==="mo";for(let v=1;v<c.children.length;v++)c.children[v].type==="mo"&&n==="boldsymbol"&&(c.children[v].style.fontWeight="bold"),c.children[v].type!=="mi"&&(p=!1),(c.children[v].attributes&&c.children[v].attributes.mathvariant||"")!=="normal"&&(p=!1);if(!p)return c;let y=c.children[0];for(let v=1;v<c.children.length;v++)y.children.push(c.children[v].children[0]);if(y.attributes.mathvariant&&y.attributes.mathvariant==="normal"){let v=new E("mtext",new Ie("\u200B"));return new E("mrow",[v,y])}return y},ms={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};$({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\up@greek","\\boldsymbol","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathsfit","\\mathtt","\\Bbb","\\bm","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let i=he(n[0]),c=t;return c in ms&&(c=ms[c]),{type:"font",mode:e.mode,font:c.slice(1),body:i}},mathmlBuilder:hs}),$({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:n},i)=>{let{mode:c}=e,p=e.parseExpression(!0,n,!0);return{type:"font",mode:c,font:`math${t.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:p}}},mathmlBuilder:hs});let fs=["display","text","script","scriptscript"],ta={auto:-1,display:0,text:0,script:1,scriptscript:2},Tr=(e,t)=>{t=((p,y)=>{let v=y;if(p==="display"){let D=v.level>=Gt?Ot:ut;v=v.withLevel(D)}else p==="text"&&v.level===ut?v=v.withLevel(Ot):p==="auto"?v=v.incrementLevel():p==="script"?v=v.withLevel(Gt):p==="scriptscript"&&(v=v.withLevel(xn));return v})(e.scriptLevel,t);let n=Oe(e.numer,t),i=Oe(e.denom,t);t.level===3&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),i.style.mathDepth="2",i.setAttribute("scriptlevel","2"));let c=new E("mfrac",[n,i]);if(e.hasBarLine){if(e.barSize){let p=it(e.barSize,t);c.setAttribute("linethickness",p.number+p.unit)}}else c.setAttribute("linethickness","0px");if(e.leftDelim!=null||e.rightDelim!=null){let p=[];if(e.leftDelim!=null){let y=new E("mo",[new Ie(e.leftDelim.replace("\\",""))]);y.setAttribute("fence","true"),p.push(y)}if(p.push(c),e.rightDelim!=null){let y=new E("mo",[new Ie(e.rightDelim.replace("\\",""))]);y.setAttribute("fence","true"),p.push(y)}c=re(p)}return e.scriptLevel!=="auto"&&(c=new E("mstyle",[c]),c.setAttribute("displaystyle",String(e.scriptLevel==="display")),c.setAttribute("scriptlevel",ta[e.scriptLevel])),c};$({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let i=n[0],c=n[1],p=!1,y=null,v=null,D="auto";switch(t){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":p=!0;break;case"\\\\atopfrac":p=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":y="(",v=")";break;case"\\\\bracefrac":y="\\{",v="\\}";break;case"\\\\brackfrac":y="[",v="]";break;default:throw new Error("Unrecognized genfrac command")}return t==="\\cfrac"||t.startsWith("\\d")?D="display":t.startsWith("\\t")&&(D="text"),{type:"genfrac",mode:e.mode,continued:!1,numer:i,denom:c,hasBarLine:p,leftDelim:y,rightDelim:v,scriptLevel:D,barSize:null}},mathmlBuilder:Tr}),$({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:n}){let i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});let gs=function(e){let t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};$({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){let n=t[4],i=t[5],c=he(t[0]),p=c.type==="atom"&&c.family==="open"?gs(c.text):null,y=he(t[1]),v=y.type==="atom"&&y.family==="close"?gs(y.text):null,D=Me(t[2],"size"),z,oe=null;D.isBlank?z=!0:(oe=D.value,z=oe.number>0);let de="auto",ee=t[3];if(ee.type==="ordgroup"){if(ee.body.length>0){let et=Me(ee.body[0],"textord");de=fs[Number(et.text)]}}else ee=Me(ee,"textord"),de=fs[Number(ee.text)];return{type:"genfrac",mode:e.mode,numer:n,denom:i,continued:!1,hasBarLine:z,barSize:oe,leftDelim:p,rightDelim:v,scriptLevel:de}},mathmlBuilder:Tr}),$({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:t,token:n},i)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:Me(i[0],"size").value,token:n})}),$({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},n)=>{let i=n[0],c=function(v){if(!v)throw new Error("Expected non-null, but got "+String(v));return v}(Me(n[1],"infix").barSize),p=n[2],y=c.number>0;return{type:"genfrac",mode:e.mode,numer:i,denom:p,continued:!1,hasBarLine:y,barSize:c,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Tr}),$({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:se(t[0])}),mathmlBuilder(e,t){let n=t.withLevel(Ot),i=Qe(e.body,n);return Je(i)}}),$({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>({type:"horizBracket",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:n[0]}),mathmlBuilder:(e,t)=>{let n=J(e.label);return n.style["math-depth"]=0,new E(e.isOver?"mover":"munder",[Oe(e.base,t),n])}}),$({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:t,token:n},i)=>{let c=Me(i[0],"raw").string,p=i[1];if(e.settings.strict)throw new r(`Function "${t}" is disabled in strict mode`,n);let y,v={};switch(t){case"\\class":v.class=c,y={command:"\\class",class:c};break;case"\\id":v.id=c,y={command:"\\id",id:c};break;case"\\style":v.style=c,y={command:"\\style",style:c};break;case"\\data":{let D=c.split(",");for(let z=0;z<D.length;z++){let oe=D[z].split("=");if(oe.length!==2)throw new r("Error parsing key-value for \\data");v["data-"+oe[0].trim()]=oe[1].trim()}y={command:"\\data",attributes:v};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(y))throw new r(`Function "${t}" is not trusted`,n);return{type:"html",mode:e.mode,attributes:v,body:se(p)}},mathmlBuilder:(e,t)=>{let n=Qe(e.body,t),i=[];e.attributes.class&&i.push(...e.attributes.class.trim().split(/\s+/)),n.classes=i;for(let c in e.attributes)c!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,c)&&n.setAttribute(c,e.attributes[c]);return n}});let Cr=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{let t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new r("Invalid size: '"+e+"' in \\includegraphics");let n={number:+(t[1]+t[2]),unit:t[3]};if(!Ct(n))throw new r("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};$({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:t},n,i)=>{let c={number:0,unit:"em"},p={number:.9,unit:"em"},y={number:0,unit:"em"},v="";if(i[0]){let z=Me(i[0],"raw").string.split(",");for(let oe=0;oe<z.length;oe++){let de=z[oe].split("=");if(de.length===2){let ee=de[1].trim();switch(de[0].trim()){case"alt":v=ee;break;case"width":c=Cr(ee);break;case"height":p=Cr(ee);break;case"totalheight":y=Cr(ee);break;default:throw new r("Invalid key: '"+de[0]+"' in \\includegraphics.")}}}}let D=Me(n[0],"url").url;if(v===""&&(v=D,v=v.replace(/^.*[\\/]/,""),v=v.substring(0,v.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:D}))throw new r('Function "\\includegraphics" is not trusted',t);return{type:"includegraphics",mode:e.mode,alt:v,width:c,height:p,totalheight:y,src:D}},mathmlBuilder:(e,t)=>{let n=it(e.height,t),i={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===n.unit&&e.totalheight.number>n.number&&(i.number=e.totalheight.number-n.number,i.unit=n.unit);let c=0;e.width.number>0&&(c=it(e.width,t));let p={height:n.number+i.number+"em"};c.number>0&&(p.width=c.number+c.unit),i.number>0&&(p.verticalAlign=-i.number+i.unit);let y=new Xe(e.src,e.alt,p);return y.height=n,y.depth=i,new E("mtext",[y])}}),$({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:n},i){let c=Me(i[0],"size");if(e.settings.strict){let p=t[1]==="m",y=c.value.unit==="mu";if(p){if(!y)throw new r(`LaTeX's ${t} supports only mu units, not ${c.value.unit} units`,n);if(e.mode!=="math")throw new r(`LaTeX's ${t} works only in math mode`,n)}else if(y)throw new r(`LaTeX's ${t} doesn't support mu units`,n)}return{type:"kern",mode:e.mode,dimension:c.value}},mathmlBuilder(e,t){let n=it(e.dimension,t),i=n.number>0&&n.unit==="em"?bs(n.number):"";if(e.mode==="text"&&i.length>0){let c=new Ie(i);return new E("mtext",[c])}if(n.number>=0){let c=new E("mspace");return c.setAttribute("width",n.number+n.unit),c}{let c=new E("mrow");return c.style.marginLeft=n.number+n.unit,c}}});let bs=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},ys=/[^A-Za-z_0-9-]/g;$({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},t)=>({type:"label",mode:e.mode,string:t[0].string.replace(ys,"")}),mathmlBuilder(e,t){let n=new E("mrow",[],["tml-label"]);return e.string.length>0&&n.setLabel(e.string),n}});let na=["\\clap","\\llap","\\rlap"];$({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:n},i)=>{if(na.includes(t)){if(e.settings.strict&&e.mode!=="text")throw new r(`{${t}} can be used only in text mode.
|
|
92
|
+
Try \\math${t.slice(1)}`,n);t=t.slice(1)}else t=t.slice(5);let c=i[0];return{type:"lap",mode:e.mode,alignment:t,body:c}},mathmlBuilder:(e,t)=>{let n;if(e.alignment==="llap"){let p=Le(se(e.body),t),y=new E("mphantom",p);n=new E("mpadded",[y]),n.setAttribute("width","0.1px")}let i=Oe(e.body,t),c;if(e.alignment==="llap"?(i.style.position="absolute",i.style.right="0",i.style.bottom="0",c=new E("mpadded",[n,i])):c=new E("mpadded",[i]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&c.setAttribute("lspace","0.16667em");else{let p=e.alignment==="llap"?"-1":"-0.5";c.setAttribute("lspace",p+"width"),e.alignment==="llap"?c.style.position="relative":(c.style.display="flex",c.style.justifyContent="center")}return c.setAttribute("width","0.1px"),c}}),$({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},n){let i=t.mode;t.switchMode("math");let c=e==="\\("?"\\)":"$",p=t.parseExpression(!1,c);return t.expect(c),t.switchMode(i),{type:"ordgroup",mode:t.mode,body:p}}}),$({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new r(`Mismatched ${e.funcName}`,t)}}),$({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:se(t[0]),text:se(t[1]),script:se(t[2]),scriptscript:se(t[3])}),mathmlBuilder:(e,t)=>{let n=((i,c)=>{switch(c.level){case ut:return i.display;case Ot:return i.text;case Gt:return i.script;case xn:return i.scriptscript;default:return i.text}})(e,t);return Qe(n,t)}});let ra=["text","textord","mathord","atom"];function ws(e,t){let n,i=Le(e.body,t);if(e.mclass==="minner")n=new E("mpadded",i);else if(e.mclass==="mord")e.isCharacterBox||i[0].type==="mathord"?(n=i[0],n.type="mi",n.children.length===1&&n.children[0].text&&n.children[0].text==="\u2207"&&n.setAttribute("mathvariant","normal")):n=new E("mi",i);else{n=new E("mrow",i),e.mustPromote?(n=i[0],n.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&n.setAttribute("mathvariant","italic")):n=new E("mrow",i);let c=t.level<2;n.type==="mrow"?c&&(e.mclass==="mbin"?(n.children.unshift(st(.2222)),n.children.push(st(.2222))):e.mclass==="mrel"?(n.children.unshift(st(.2778)),n.children.push(st(.2778))):e.mclass==="mpunct"?n.children.push(st(.1667)):e.mclass==="minner"&&(n.children.unshift(st(.0556)),n.children.push(st(.0556)))):e.mclass==="mbin"?(n.attributes.lspace=c?"0.2222em":"0",n.attributes.rspace=c?"0.2222em":"0"):e.mclass==="mrel"?(n.attributes.lspace=c?"0.2778em":"0",n.attributes.rspace=c?"0.2778em":"0"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace=c?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&c&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em"),e.mclass!=="mopen"&&e.mclass!=="mclose"&&(delete n.attributes.stretchy,delete n.attributes.form)}return n}$({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},n){let i=n[0],c=b(i),p=!0,y={type:"mathord",text:"",mode:e.mode},v=i.body?i.body:[i];for(let D of v){if(!ra.includes(D.type)){p=!1;break}Ne[e.mode][D.text]?y.text+=Ne[e.mode][D.text].replace:D.text?y.text+=D.text:D.body&&D.body.map(z=>{y.text+=z.text})}return p&&t==="\\mathord"&&y.type==="mathord"&&y.text.length>1?y:{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:se(p?y:i),isCharacterBox:c,mustPromote:p}},mathmlBuilder:ws});let xs=e=>{let t=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;if(t.type==="atom"){let n=e.body.length>0&&e.body[0].text&&Ne.math[e.body[0].text]?Ne.math[e.body[0].text].group:t.family;return n==="bin"||n==="rel"?"m"+n:"mord"}return"mord"};$({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},t)=>({type:"mclass",mode:e.mode,mclass:xs(t[0]),body:se(t[1]),isCharacterBox:b(t[1])})}),$({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},n){let i=n[1],c=n[0],p;p=t!=="\\stackrel"?xs(i):"mrel";let y={type:p==="mrel"||p==="mbin"?"op":"ordgroup",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!=="\\stackrel",body:se(i)};return{type:"supsub",mode:c.mode,stack:!0,base:y,sup:t==="\\underset"?null:c,sub:t==="\\underset"?c:null}},mathmlBuilder:ws});let Jn=(e,t,n)=>{if(!e)return n;let i=Oe(e,t);return i.type==="mrow"&&i.children.length===0?n:i};$({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:t,token:n},i){if(i[2].body.length===0)throw new r(t+"cannot parse an empty base.");let c=i[2].body[0];if(e.settings.strict&&t==="\\sideset"&&!c.symbol)throw new r("The base of \\sideset must be a big operator. Try \\prescript.");if(i[0].body.length>0&&i[0].body[0].type!=="supsub"||i[1].body.length>0&&i[1].body[0].type!=="supsub")throw new r("\\sideset can parse only subscripts and superscripts in its first two arguments",n);let p=i[0].body.length>0?i[0].body[0]:null,y=i[1].body.length>0?i[1].body[0]:null;return p||y?p?{type:"multiscript",mode:e.mode,isSideset:t==="\\sideset",prescripts:p,postscripts:y,base:c}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:c,sup:y.sup,sub:y.sub}]}:c},mathmlBuilder(e,t){let n=Oe(e.base,t),i=new E("mprescripts"),c=new E("none"),p=[],y=Jn(e.prescripts.sub,t,c),v=Jn(e.prescripts.sup,t,c);return e.isSideset&&(y.setAttribute("style","text-align: left;"),v.setAttribute("style","text-align: left;")),e.postscripts?p=[n,Jn(e.postscripts.sub,t,c),Jn(e.postscripts.sup,t,c),i,y,v]:p=[n,i,y,v],new E("mmultiscripts",p)}}),$({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=b(t[0]),i;return n?(i=se(t[0]),i[0].text.charAt(0)==="\\"&&(i[0].text=Ne.math[i[0].text].replace),i[0].text=i[0].text.slice(0,1)+"\u0338"+i[0].text.slice(1)):i=[{type:"textord",mode:"math",text:"\u0338"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]],{type:"not",mode:e.mode,body:i,isCharacterBox:n}},mathmlBuilder(e,t){return e.isCharacterBox?Le(e.body,t,!0)[0]:Qe(e.body,t)}});let sa=["textord","mathord","atom"],oa=["\\smallint"],Nr=["textord","mathord","ordgroup","close","leftright","font"],vs=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},Fn=(e,t)=>{let n;if(e.symbol)n=new E("mo",[ne(e.name,e.mode)]),oa.includes(e.name)?n.setAttribute("largeop","false"):n.setAttribute("movablelimits","false"),e.fromMathOp&&vs(n);else if(e.body)n=new E("mo",Le(e.body,t)),e.fromMathOp&&vs(n);else if(n=new E("mi",[new Ie(e.name.slice(1))]),!e.parentIsSupSub){let i=[n,new E("mo",[ne("\u2061","text")])];if(e.needsLeadingSpace){let c=new E("mspace");c.setAttribute("width","0.1667em"),i.unshift(c)}if(!e.isFollowedByDelimiter){let c=new E("mspace");c.setAttribute("width","0.1667em"),i.push(c)}n=new E("mrow",i)}return n},ia={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A05":"\\bigsqcap","\u2A06":"\\bigsqcup","\u2A03":"\\bigcupdot","\u2A07":"\\bigdoublevee","\u2A08":"\\bigdoublewedge","\u2A09":"\\bigtimes"};$({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A03","\u2A04","\u2A05","\u2A06","\u2A07","\u2A08","\u2A09"],props:{numArgs:0},handler:({parser:e,funcName:t},n)=>{let i=t;return i.length===1&&(i=ia[i]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:i}},mathmlBuilder:Fn}),$({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{let n=t[0],i=n.body?n.body:[n],c=i.length===1&&sa.includes(i[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:c,fromMathOp:!0,stack:!1,name:c?i[0].text:null,body:c?null:se(n)}},mathmlBuilder:Fn});let aa={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint","\u2231":"\\intclockwise","\u2232":"\\varointclockwise","\u2A0C":"\\iiiint","\u2A0D":"\\intbar","\u2A0E":"\\intBar","\u2A0F":"\\fint","\u2A12":"\\rppolint","\u2A13":"\\scpolint","\u2A15":"\\pointint","\u2A16":"\\sqint","\u2A17":"\\intlarhk","\u2A18":"\\intx","\u2A19":"\\intcap","\u2A1A":"\\intcup"};$({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\sgn","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,i=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Xn(i),needsLeadingSpace:n.length>0&&Nr.includes(n),name:t}},mathmlBuilder:Fn}),$({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,i=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Xn(i),needsLeadingSpace:n.length>0&&Nr.includes(n),name:t}},mathmlBuilder:Fn}),$({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u2231","\u2232","\u2A0C","\u2A0D","\u2A0E","\u2A0F","\u2A12","\u2A13","\u2A15","\u2A16","\u2A17","\u2A18","\u2A19","\u2A1A"],props:{numArgs:0,allowedInArgument:!0},handler({parser:e,funcName:t}){let n=t;return n.length===1&&(n=aa[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:Fn}),$({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let i=n[0],c=e.prevAtomType,p=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:se(i),alwaysHandleSupSub:t==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:Xn(p),needsLeadingSpace:c.length>0&&Nr.includes(c)}},mathmlBuilder:(e,t)=>{let n,i=Le(e.body,t.withFont("mathrm")),c=!0;for(let p=0;p<i.length;p++){let y=i[p];if(y instanceof E)switch(((y.type==="mrow"||y.type==="mpadded")&&y.children.length===1&&y.children[0]instanceof E||y.type==="mrow"&&y.children.length===2&&y.children[0]instanceof E&&y.children[1]instanceof E&&y.children[1].type==="mspace"&&!y.children[1].attributes.width&&y.children[1].children.length===0)&&(y=y.children[0]),y.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(y.attributes.width){let v=y.attributes.width.replace("em",""),D=bs(Number(v));D===""?c=!1:i[p]=new E("mtext",[new Ie(D)])}break;case"mo":{let v=y.children[0];y.children.length===1&&v instanceof Ie?v.text=v.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):c=!1;break}default:c=!1}else c=!1}if(c){let p=i.map(y=>y.toText()).join("");i=[new Ie(p)]}else if(i.length===1&&["mover","munder"].includes(i[0].type)&&(i[0].children[0].type==="mi"||i[0].children[0].type==="mtext")){if(i[0].children[0].type="mi",e.parentIsSupSub)return new E("mrow",i);{let p=new E("mo",[ne("\u2061","text")]);return xe([i[0],p])}}if(c?(n=new E("mi",i),i[0].text.length===1&&n.setAttribute("mathvariant","normal")):n=new E("mrow",i),!e.parentIsSupSub){let p=[n,new E("mo",[ne("\u2061","text")])];if(e.needsLeadingSpace){let y=new E("mspace");y.setAttribute("width","0.1667em"),p.unshift(y)}if(!e.isFollowedByDelimiter){let y=new E("mspace");y.setAttribute("width","0.1667em"),p.push(y)}return xe(p)}return n}}),L("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),q({type:"ordgroup",mathmlBuilder:(e,t)=>Qe(e.body,t,e.semisimple)}),$({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"phantom",mode:e.mode,body:se(n)}},mathmlBuilder:(e,t)=>{let n=Le(e.body,t);return new E("mphantom",n)}}),$({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"hphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=Le(se(e.body),t),i=new E("mphantom",n),c=new E("mpadded",[i]);return c.setAttribute("height","0px"),c.setAttribute("depth","0px"),c}}),$({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"vphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=Le(se(e.body),t),i=new E("mphantom",n),c=new E("mpadded",[i]);return c.setAttribute("width","0.1px"),c}}),$({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>({type:"pmb",mode:e.mode,body:se(t[0])}),mathmlBuilder(e,t){let n=Le(e.body,t),i=qe(n);return i.setAttribute("style","font-weight:bold"),i}});let ks=(e,t)=>{let n=t.withLevel(Ot),i=new E("mpadded",[Oe(e.body,n)]),c=it(e.dy,t);return i.setAttribute("voffset",c.number+c.unit),c.number>0?i.style.padding=c.number+c.unit+" 0 0 0":i.style.padding="0 0 "+Math.abs(c.number)+c.unit+" 0",i};$({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},n){let i=Me(n[0],"size").value;t==="\\lower"&&(i.number*=-1);let c=n[1];return{type:"raise",mode:e.mode,dy:i,body:c}},mathmlBuilder:ks}),$({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},n){let i=Me(n[0],"size").value,c=n[1];return{type:"raise",mode:e.mode,dy:i,body:c}},mathmlBuilder:ks}),$({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:t},n)=>({type:"ref",mode:e.mode,funcName:t,string:n[0].string.replace(ys,"")}),mathmlBuilder(e,t){let n=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new Ce("#"+e.string,n,null)}}),$({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"reflect",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){let n=Oe(e.body,t);return n.style.transform="scaleX(-1)",n}}),$({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),$({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,n){let i=n[0],c=Me(t[0],"size"),p=Me(t[1],"size");return{type:"rule",mode:e.mode,shift:i&&Me(i,"size").value,width:c.value,height:p.value}},mathmlBuilder(e,t){let n=it(e.width,t),i=it(e.height,t),c=e.shift?it(e.shift,t):{number:0,unit:"em"},p=t.color&&t.getColor()||"black",y=new E("mspace");if(n.number>0&&i.number>0&&y.setAttribute("mathbackground",p),y.setAttribute("width",n.number+n.unit),y.setAttribute("height",i.number+i.unit),c.number===0)return y;let v=new E("mpadded",[y]);return c.number>=0?v.setAttribute("height","+"+c.number+c.unit):(v.setAttribute("height",c.number+c.unit),v.setAttribute("depth","+"+-c.number+c.unit)),v.setAttribute("voffset",c.number+c.unit),v}});let Es=/^[0-9]$/,la={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},ca={0:"\u2070",1:"\xB9",2:"\xB2",3:"\xB3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079"};$({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let n="";for(let c of t[0].body){if(c.type!=="textord"||!Es.test(c.text))throw new r("Numerator must be an integer.",c);n+=c.text}let i="";for(let c of t[1].body){if(c.type!=="textord"||!Es.test(c.text))throw new r("Denominator must be an integer.",c);i+=c.text}return{type:"sfrac",mode:e.mode,numerator:n,denominator:i}},mathmlBuilder(e,t){let n=e.numerator.split("").map(p=>ca[p]).join(""),i=e.denominator.split("").map(p=>la[p]).join(""),c=new Ie(n+"\u2044"+i,e.mode,t);return new E("mn",[c],["special-fraction"])}});let Ss={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};$({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:n},i)=>{n.settings.strict&&n.mode==="math"&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);let c=n.parseExpression(!1,e,!0);return{type:"sizing",mode:n.mode,funcName:t,body:c}},mathmlBuilder:(e,t)=>{let n=t.withFontSize(Ss[e.funcName]),i=Le(e.body,n),c=qe(i),p=(Ss[e.funcName]/t.fontSize).toFixed(4);return c.setAttribute("mathsize",p+"em"),c}}),$({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,n)=>{let i=!1,c=!1,p=n[0]&&Me(n[0],"ordgroup");if(p){let v="";for(let D=0;D<p.body.length;++D)if(v=p.body[D].text,v==="t")i=!0;else{if(v!=="b"){i=!1,c=!1;break}c=!0}}else i=!0,c=!0;let y=t[0];return{type:"smash",mode:e.mode,body:y,smashHeight:i,smashDepth:c}},mathmlBuilder:(e,t)=>{let n=new E("mpadded",[Oe(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});let da=["a","c","e","\u0131","m","n","o","r","s","u","v","w","x","z","\u03B1","\u03B5","\u03B9","\u03BA","\u03BD","\u03BF","\u03C0","\u03C3","\u03C4","\u03C5","\u03C9","\\alpha","\\epsilon","\\iota","\\kappa","\\nu","\\omega","\\pi","\\tau","\\omega"];$({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,n){let i=n[0],c=t[0];return c.body&&c.body.length===1&&c.body[0].text&&da.includes(c.body[0].text)&&c.body.push({type:"rule",mode:"math",shift:null,width:{number:0,unit:"pt"},height:{number:.5,unit:"em"}}),{type:"sqrt",mode:e.mode,body:c,index:i}},mathmlBuilder(e,t){let{body:n,index:i}=e;return i?new E("mroot",[Oe(n,t),Oe(i,t.incrementLevel())]):new E("msqrt",[Oe(n,t)])}});let ua={display:0,text:1,script:2,scriptscript:3},pa={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};$({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:n},i){let c=n.parseExpression(!0,e,!0),p=t.slice(1,t.length-5);return{type:"styling",mode:n.mode,scriptLevel:p,body:c}},mathmlBuilder(e,t){let n=t.withLevel(ua[e.scriptLevel]),i=Le(e.body,n),c=qe(i),p=pa[e.scriptLevel];return c.setAttribute("scriptlevel",p[0]),c.setAttribute("displaystyle",p[1]),c}});let ha=/^m(over|under|underover)$/;q({type:"supsub",mathmlBuilder(e,t){let n,i,c=!1,p=!1,y=!1,v=!1;e.base&&e.base.type==="horizBracket"&&(i=!!e.sup,i===e.base.isOver&&(c=!0,n=e.base.isOver)),!e.base||e.stack||e.base.type!=="op"&&e.base.type!=="operatorname"||(e.base.parentIsSupSub=!0,p=!e.base.symbol,y=p&&!e.isFollowedByDelimiter,v=e.base.needsLeadingSpace);let D=e.stack&&e.base.body.length===1?[Oe(e.base.body[0],t)]:[Oe(e.base,t)],z=t.inSubOrSup();if(e.sub){let ee=Oe(e.sub,z);t.level===3&&ee.setAttribute("scriptlevel","2"),D.push(ee)}if(e.sup){let ee=Oe(e.sup,z);if(t.level===3&&ee.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){let et=e.base.text;"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(et)>-1?ee.classes.push("tml-sml-pad"):"BCEFGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(et)>-1?ee.classes.push("tml-med-pad"):"AJdf\u0394\u039B".indexOf(et)>-1&&ee.classes.push("tml-lrg-pad")}D.push(ee)}let oe;if(c)oe=n?"mover":"munder";else if(e.sub)if(e.sup){let ee=e.base;oe=ee&&(ee.type==="op"&&ee.limits||ee.type==="multiscript")&&(t.level===ut||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(t.level===ut||ee.limits)?"munderover":"msubsup"}else{let ee=e.base;oe=e.stack||ee&&ee.type==="op"&&ee.limits&&(t.level===ut||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(ee.limits||t.level===ut)?"munder":"msub"}else{let ee=e.base;oe=ee&&ee.type==="op"&&ee.limits&&(t.level===ut||ee.alwaysHandleSupSub)||ee&&ee.type==="operatorname"&&ee.alwaysHandleSupSub&&(ee.limits||t.level===ut)?"mover":"msup"}let de=new E(oe,D);if(p){let ee=new E("mo",[ne("\u2061","text")]);if(v){let et=new E("mspace");et.setAttribute("width","0.1667em"),de=xe([et,de,ee])}else de=xe([de,ee]);if(y){let et=new E("mspace");et.setAttribute("width","0.1667em"),de.children.push(et)}}else ha.test(oe)&&(de=new E("mrow",[de]));return de}});let ma=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],fa=["\\Rsh","\\Lsh","\\restriction"];q({type:"atom",mathmlBuilder(e,t){let n=new E("mo",[ne(e.text,e.mode)]);if(e.family==="punct")n.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(n.setAttribute("form","prefix"),n.setAttribute("stretchy","false")):e.family==="close"&&(n.setAttribute("form","postfix"),n.setAttribute("stretchy","false"));else if(e.text==="\\mid")n.setAttribute("lspace","0.22em"),n.setAttribute("rspace","0.22em"),n.setAttribute("stretchy","false");else if(e.family==="rel"&&(i=>{if(i.length===1){let c=i.codePointAt(0);return 8591<c&&c<8704}return i.indexOf("arrow")>-1||i.indexOf("harpoon")>-1||fa.includes(i)})(e.text))n.setAttribute("stretchy","false");else if(ma.includes(e.text))n.setAttribute("mathsize","70%");else if(e.text===":")n.attributes.lspace="0.2222em",n.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new E("mrow",[st(.222),n,st(.222)]):new E("mrow",[st(.2778),n,st(.2778)]);return n}});let As={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},_s=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsc")return"normal";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"sans-serif-bold":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";let n=t.font;if(!n||n==="mathnormal")return null;let i=e.mode;switch(n){case"mathit":case"greekItalic":return"italic";case"mathrm":{let p=e.text.codePointAt(0);return 939<p&&p<975?"italic":"normal"}case"up@greek":return"normal";case"boldsymbol":case"mathboldsymbol":return"bold-italic";case"mathbf":return"bold";case"mathbb":return"double-struck";case"mathfrak":return"fraktur";case"mathscr":case"mathcal":return"script";case"mathsf":return"sans-serif";case"mathsfit":return"sans-serif-italic";case"mathtt":return"monospace"}let c=e.text;return Ne[i][c]&&Ne[i][c].replace&&(c=Ne[i][c].replace),Object.prototype.hasOwnProperty.call(As,n)?As[n]:null},ga=/^\d(?:[\d,.]*\d)?$/,ba=/[A-Ba-z]/,ya=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);q({type:"mathord",mathmlBuilder(e,t){let n=ne(e.text,e.mode,t),i=n.text.codePointAt(0),c=912<i&&i<938?"normal":"italic",p=_s(e,t)||c;if(p==="script")return n.text=Sn(n.text,p),new E("mi",[n],[t.font]);p!=="italic"&&(n.text=Sn(n.text,p));let y=new E("mi",[n]);if(p==="normal"&&(y.setAttribute("mathvariant","normal"),n.text.length===1)){let v=new E("mspace",[]);y=new E("mrow",[y,v])}return y}}),q({type:"textord",mathmlBuilder(e,t){let n=e.text,i=n.codePointAt(0);t.fontFamily==="textsc"&&96<i&&i<123&&(n=Qi[n]);let c=ne(n,e.mode,t),p=_s(e,t)||"normal",y;if(ga.test(e.text)){let v=e.mode==="text"?"mtext":"mn";if(p==="italic"||p==="bold-italic")return((D,z,oe)=>{let de=new E(oe,[D]),ee=new E("mstyle",[de]);return ee.style["font-style"]="italic",ee.style["font-family"]="Cambria, 'Times New Roman', serif",z==="bold-italic"&&(ee.style["font-weight"]="bold"),ee})(c,p,v);p!=="normal"&&(c.text=c.text.split("").map(D=>Sn(D,p)).join("")),y=new E(v,[c])}else if(e.mode==="text")p!=="normal"&&(c.text=Sn(c.text,p)),y=new E("mtext",[c]);else if(ya.has(e.text))y=new E("mo",[c]),y.classes.push("tml-prime");else{let v=c.text;p!=="italic"&&(c.text=Sn(c.text,p)),y=new E("mi",[c]),c.text===v&&ba.test(v)&&y.setAttribute("mathvariant","italic")}return y}});let wa={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},xa={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};q({type:"spacing",mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call(xa,e.text))n=new E("mtext",[new Ie("\xA0")]);else{if(!Object.prototype.hasOwnProperty.call(wa,e.text))throw new r(`Unknown type of space "${e.text}"`);n=new E("mo"),e.text==="\\nobreak"&&n.setAttribute("linebreak","nobreak")}return n}}),q({type:"tag"});let Ts={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Cs={"\\textbf":"textbf","\\textmd":"textmd"},va={"\\textit":"textit","\\textup":"textup"};$({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textsc","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let i=n[0];return{type:"text",mode:e.mode,body:se(i),font:t}},mathmlBuilder(e,t){let n=((c,p)=>{let y=c.font;return y?Ts[y]?p.withTextFontFamily(Ts[y]):Cs[y]?p.withTextFontWeight(Cs[y]):y==="\\emph"?p.fontShape==="textit"?p.withTextFontShape("textup"):p.withTextFontShape("textit"):p.withTextFontShape(va[y]):p})(e,t),i=Qe(e.body,n);return Je(i)}}),$({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},t)=>({type:"vcenter",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){let n=new E("mtd",[Oe(e.body,t)]);n.style.padding="0";let i=new E("mtr",[n]);return new E("mtable",[i])}}),$({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new r("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){let n=new Ie(ka(e)),i=new E("mtext",[n]);return i.setAttribute("mathvariant","monospace"),i}});let ka=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),fn=M,Ns=`[ \r
|
|
93
|
+
]`,Ea=`(\\\\[a-zA-Z@]+)${Ns}*`,$r="[\u0300-\u036F]",$s=new RegExp(`${$r}+$`),Sa=`(${Ns}+)|\\\\(
|
|
94
|
+
|[ \r ]+
|
|
95
|
+
?)[ \r ]*|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${$r}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${$r}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Ea}|\\\\[^\uD800-\uDFFF])`;class Os{constructor(t,n){this.input=t,this.settings=n,this.tokenRegex=new RegExp(Sa,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){let t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new St("EOF",new dt(this,n,n));let i=this.tokenRegex.exec(t);if(i===null||i.index!==n)throw new r(`Unexpected character: '${t[n]}'`,new St(t[n],new dt(this,n,n+1)));let c=i[6]||i[3]||(i[2]?"\\ ":" ");if(this.catcodes[c]===14){let p=t.indexOf(`
|
|
96
|
+
`,this.tokenRegex.lastIndex);if(p===-1){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new r("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=p+1;return this.lex()}return new St(c,new dt(this,n,this.tokenRegex.lastIndex))}}class Aa{constructor(t={},n={}){this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new r("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");let t=this.undefStack.pop();for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]===void 0?delete this.current[n]:this.current[n]=t[n])}has(t){return Object.prototype.hasOwnProperty.call(this.current,t)||Object.prototype.hasOwnProperty.call(this.builtins,t)}get(t){return Object.prototype.hasOwnProperty.call(this.current,t)?this.current[t]:this.builtins[t]}set(t,n,i=!1){if(i){for(let c=0;c<this.undefStack.length;c++)delete this.undefStack[c][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{let c=this.undefStack[this.undefStack.length-1];c&&!Object.prototype.hasOwnProperty.call(c,t)&&(c[t]=this.current[t])}this.current[t]=n}}let Ms={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class _a{constructor(t,n,i){this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new Aa(vn,n.macros),this.mode=i,this.stack=[]}feed(t){this.lexer=new Os(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){let n,i,c;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:c,end:i}=this.consumeArg(["]"])}else({tokens:c,start:n,end:i}=this.consumeArg());return this.pushToken(new St("EOF",i.loc)),this.pushTokens(c),new St("",dt.range(n,i))}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(t){let n=[],i=t&&t.length>0;i||this.consumeSpaces();let c=this.future(),p,y=0,v=0;do{if(p=this.popToken(),n.push(p),p.text==="{")++y;else if(p.text==="}"){if(--y,y===-1)throw new r("Extra }",p)}else if(p.text==="EOF")throw new r("Unexpected end of input in a macro argument, expected '"+(t&&i?t[v]:"}")+"'",p);if(t&&i)if((y===0||y===1&&t[v]==="{")&&p.text===t[v]){if(++v,v===t.length){n.splice(-v,v);break}}else v=0}while(y!==0||i);return c.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:c,end:p}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new r("The length of delimiters doesn't match the number of args!");let c=n[0];for(let p=0;p<c.length;p++){let y=this.popToken();if(c[p]!==y.text)throw new r("Use of the macro doesn't match its definition",y)}}let i=[];for(let c=0;c<t;c++)i.push(this.consumeArg(n&&n[c+1]).tokens);return i}expandOnce(t){let n=this.popToken(),i=n.text,c=n.noexpand?null:this._getExpansion(i);if(c==null||t&&c.unexpandable){if(t&&c==null&&i[0]==="\\"&&!this.isDefined(i))throw new r("Undefined control sequence: "+i);return this.pushToken(n),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new r("Too many expansions: infinite loop or need to increase maxExpand setting");let p=c.tokens,y=this.consumeArgs(c.numArgs,c.delimiters);if(c.numArgs){p=p.slice();for(let v=p.length-1;v>=0;--v){let D=p[v];if(D.text==="#"){if(v===0)throw new r("Incomplete placeholder at end of macro body",D);if(D=p[--v],D.text==="#")p.splice(v+1,1);else{if(!/^[1-9]$/.test(D.text))throw new r("Not a valid argument number",D);p.splice(v,2,...y[+D.text-1])}}}}return this.pushTokens(p),p.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new St(t)]):void 0}expandTokens(t){let n=[],i=this.stack.length;for(this.pushTokens(t);this.stack.length>i;)if(this.expandOnce(!0)===!1){let c=this.stack.pop();c.treatAsRelax&&(c.noexpand=!1,c.treatAsRelax=!1),n.push(c)}return n}expandMacroAsText(t){let n=this.expandMacro(t);return n&&n.map(i=>i.text).join("")}_getExpansion(t){let n=this.macros.get(t);if(n==null)return n;if(t.length===1){let c=this.lexer.catcodes[t];if(c!=null&&c!==13)return}let i=typeof n=="function"?n(this):n;if(typeof i=="string"){let c=0;if(i.indexOf("#")!==-1){let D=i.replace(/##/g,"");for(;D.indexOf("#"+(c+1))!==-1;)++c}let p=new Os(i,this.settings),y=[],v=p.lex();for(;v.text!=="EOF";)y.push(v),v=p.lex();return y.reverse(),{tokens:y,numArgs:c}}return i}isDefined(t){return this.macros.has(t)||Object.prototype.hasOwnProperty.call(fn,t)||Object.prototype.hasOwnProperty.call(Ne.math,t)||Object.prototype.hasOwnProperty.call(Ne.text,t)||Object.prototype.hasOwnProperty.call(Ms,t)}isExpandable(t){let n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Object.prototype.hasOwnProperty.call(fn,t)&&!fn[t].primitive}}let Ls=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Qn=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),Rs=Object.freeze({"\u{1D49C}":"A",\u212C:"B","\u{1D49E}":"C","\u{1D49F}":"D",\u2130:"E",\u2131:"F","\u{1D4A2}":"G",\u210B:"H",\u2110:"I","\u{1D4A5}":"J","\u{1D4A6}":"K",\u2112:"L",\u2133:"M","\u{1D4A9}":"N","\u{1D4AA}":"O","\u{1D4AB}":"P","\u{1D4AC}":"Q",\u211B:"R","\u{1D4AE}":"S","\u{1D4AF}":"T","\u{1D4B0}":"U","\u{1D4B1}":"V","\u{1D4B2}":"W","\u{1D4B3}":"X","\u{1D4B4}":"Y","\u{1D4B5}":"Z"});var Or={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Is={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u010F:"d\u030C",\u1E0B:"d\u0307",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u013A:"l\u0301",\u013E:"l\u030C",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u010E:"D\u030C",\u1E0A:"D\u0307",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0139:"L\u0301",\u013D:"L\u030C",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u0164:"T\u030C",\u1E6A:"T\u0307",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"};let Ta=["bin","op","open","punct","rel"],Ca=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Na=/^ *\\text/;class zn{constructor(t,n,i=!1){this.mode="math",this.gullet=new _a(t,n,this.mode),this.settings=n,this.isPreamble=i,this.leftrightDepth=0,this.prevAtomType=""}expect(t,n=!0){if(this.fetch().text!==t)throw new r(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");let t=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){let i=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([c,p])=>{i[c]=p}),this.gullet.endGroup(),i}let n=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),n&&(this.gullet.macros.current["\\df@tag"]=n),t}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(t){let n=this.nextToken;this.consume(),this.gullet.pushToken(new St("}")),this.gullet.pushTokens(t);let i=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,i}parseExpression(t,n,i){let c=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();let p=this.fetch();if(zn.endOfExpression.indexOf(p.text)!==-1||n&&p.text===n||i&&p.text==="\\middle"||t&&fn[p.text]&&fn[p.text].infix)break;let y=this.parseAtom(n);if(!y)break;y.type!=="internal"&&(c.push(y),this.prevAtomType=y.type==="atom"?y.family:y.type)}return this.mode==="text"&&this.formLigatures(c),this.handleInfixNodes(c)}handleInfixNodes(t){let n,i=-1;for(let c=0;c<t.length;c++)if(t[c].type==="infix"){if(i!==-1)throw new r("only one infix operator per group",t[c].token);i=c,n=t[c].replaceWith}if(i!==-1&&n){let c,p,y=t.slice(0,i),v=t.slice(i+1),D;return c=y.length===1&&y[0].type==="ordgroup"?y[0]:{type:"ordgroup",mode:this.mode,body:y},p=v.length===1&&v[0].type==="ordgroup"?v[0]:{type:"ordgroup",mode:this.mode,body:v},D=n==="\\\\abovefrac"?this.callFunction(n,[c,t[i],p],[]):this.callFunction(n,[c,p],[]),[D]}return t}handleSupSubscript(t){let n=this.fetch(),i=n.text,c;this.consume(),this.consumeSpaces();do c=this.parseGroup(t);while(c.type&&c.type==="internal");if(!c)throw new r("Expected group after '"+i+"'",n);return c}formatUnsupportedCmd(t){let n=[];for(let c=0;c<t.length;c++)n.push({type:"textord",mode:"text",text:t[c]});let i={type:"text",mode:this.mode,body:n};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]}}parseAtom(t){let n=this.parseGroup("atom",t);if(n&&n.type==="internal"||this.mode==="text")return n;let i,c;for(;;){this.consumeSpaces();let p=this.fetch();if(p.text==="\\limits"||p.text==="\\nolimits"){if(n&&n.type==="op"){let y=p.text==="\\limits";n.limits=y,n.alwaysHandleSupSub=!0}else{if(!n||n.type!=="operatorname")throw new r("Limit controls must follow a math operator",p);n.alwaysHandleSupSub&&(n.limits=p.text==="\\limits")}this.consume()}else if(p.text==="^"){if(i)throw new r("Double superscript",p);i=this.handleSupSubscript("superscript")}else if(p.text==="_"){if(c)throw new r("Double subscript",p);c=this.handleSupSubscript("subscript")}else if(p.text==="'"){if(i)throw new r("Double superscript",p);let y={type:"textord",mode:this.mode,text:"\\prime"},v=[y];for(this.consume();this.fetch().text==="'";)v.push(y),this.consume();this.fetch().text==="^"&&v.push(this.handleSupSubscript("superscript")),i={type:"ordgroup",mode:this.mode,body:v}}else{if(!Qn[p.text])break;{let y=Ls.test(p.text),v=[];for(v.push(new St(Qn[p.text])),this.consume();;){let z=this.fetch().text;if(!Qn[z]||Ls.test(z)!==y)break;v.unshift(new St(Qn[z])),this.consume()}let D=this.subparse(v);y?c={type:"ordgroup",mode:"math",body:D}:i={type:"ordgroup",mode:"math",body:D}}}}if(i||c){if(n&&n.type==="multiscript"&&!n.postscripts)return n.postscripts={sup:i,sub:c},n;{let p=!n||n.type!=="op"&&n.type!=="operatorname"?void 0:Xn(this.nextToken.text);return{type:"supsub",mode:this.mode,base:n,sup:i,sub:c,isFollowedByDelimiter:p}}}return n}parseFunction(t,n){let i=this.fetch(),c=i.text,p=fn[c];if(!p)return null;if(this.consume(),n&&n!=="atom"&&!p.allowedInArgument)throw new r("Got function '"+c+"' with no arguments"+(n?" as "+n:""),i);if(this.mode==="text"&&!p.allowedInText)throw new r("Can't use function '"+c+"' in text mode",i);if(this.mode==="math"&&p.allowedInMath===!1)throw new r("Can't use function '"+c+"' in math mode",i);let y=this.prevAtomType,{args:v,optArgs:D}=this.parseArguments(c,p);return this.prevAtomType=y,this.callFunction(c,v,D,i,t)}callFunction(t,n,i,c,p){let y={funcName:t,parser:this,token:c,breakOnTokenText:p},v=fn[t];if(v&&v.handler)return v.handler(y,n,i);throw new r(`No function handler for ${t}`)}parseArguments(t,n){let i=n.numArgs+n.numOptionalArgs;if(i===0)return{args:[],optArgs:[]};let c=[],p=[];for(let y=0;y<i;y++){let v=n.argTypes&&n.argTypes[y],D=y<n.numOptionalArgs;(n.primitive&&v==null||n.type==="sqrt"&&y===1&&p[0]==null)&&(v="primitive");let z=this.parseGroupOfType(`argument to '${t}'`,v,D);if(D)p.push(z);else{if(z==null)throw new r("Null argument, please report this as a bug");c.push(z)}}return{args:c,optArgs:p}}parseGroupOfType(t,n,i){switch(n){case"size":return this.parseSizeGroup(i);case"url":return this.parseUrlGroup(i);case"math":case"text":return this.parseArgumentGroup(i,n);case"hbox":{let c=this.parseArgumentGroup(i,"text");return c!=null?{type:"styling",mode:c.mode,body:[c],scriptLevel:"text"}:null}case"raw":{let c=this.parseStringGroup("raw",i);return c!=null?{type:"raw",mode:"text",string:c.text}:null}case"primitive":{if(i)throw new r("A primitive argument cannot be optional");let c=this.parseGroup(t);if(c==null)throw new r("Expected group as "+t,this.fetch());return c}case"original":case null:case void 0:return this.parseArgumentGroup(i);default:throw new r("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){let t=this.fetch().text;if(t!==" "&&t!=="\xA0"&&t!=="\uFE0E")break;this.consume()}}parseStringGroup(t,n){let i=this.gullet.scanArgument(n);if(i==null)return null;let c,p="";for(;(c=this.fetch()).text!=="EOF";)p+=c.text,this.consume();return this.consume(),i.text=p,i}parseRegexGroup(t,n){let i=this.fetch(),c,p=i,y="";for(;(c=this.fetch()).text!=="EOF"&&t.test(y+c.text);)p=c,y+=p.text,this.consume();if(y==="")throw new r("Invalid "+n+": '"+i.text+"'",i);return i.range(p,y)}parseSizeGroup(t){let n,i=!1;if(this.gullet.consumeSpaces(),n=t||this.gullet.future().text==="{"?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!n)return null;t||n.text.length!==0||(n.text="0pt",i=!0);let c=Ca.exec(n.text);if(!c)throw new r("Invalid size: '"+n.text+"'",n);let p={number:+(c[1]+c[2]),unit:c[3]};if(!Ct(p))throw new r("Invalid unit: '"+p.unit+"'",n);return{type:"size",mode:this.mode,value:p,isBlank:i}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);let n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;let i=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return i=n.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:i}}parseArgumentGroup(t,n){let i=this.gullet.scanArgument(t);if(i==null)return null;let c=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();let p=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();let y={type:"ordgroup",mode:this.mode,loc:i.loc,body:p};return n&&this.switchMode(c),y}parseGroup(t,n){let i=this.fetch(),c=i.text;if(t==="argument to '\\left'")return this.parseSymbol();let p;if(c==="{"||c==="\\begingroup"||c==="\\toggle"){this.consume();let y=c==="{"?"}":c==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let v=this.parseExpression(!1,y),D=this.fetch();this.expect(y),this.gullet.endGroup(),p={type:D.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:dt.range(i,D),body:v,semisimple:c==="\\begingroup"||void 0}}else if(p=this.parseFunction(n,t)||this.parseSymbol(),p==null&&c[0]==="\\"&&!Object.prototype.hasOwnProperty.call(Ms,c)){if(this.settings.throwOnError)throw new r("Unsupported function name: "+c,i);p=this.formatUnsupportedCmd(c),this.consume()}return p}formLigatures(t){let n=t.length-1;for(let i=0;i<n;++i){let c=t[i],p=c.text;p==="-"&&t[i+1].text==="-"&&(i+1<n&&t[i+2].text==="-"?(t.splice(i,3,{type:"textord",mode:"text",loc:dt.range(c,t[i+2]),text:"---"}),n-=2):(t.splice(i,2,{type:"textord",mode:"text",loc:dt.range(c,t[i+1]),text:"--"}),n-=1)),p!=="'"&&p!=="`"||t[i+1].text!==p||(t.splice(i,2,{type:"textord",mode:"text",loc:dt.range(c,t[i+1]),text:p+p}),n-=1)}}parseSymbol(){let t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();let p=n.slice(5),y=p.charAt(0)==="*";if(y&&(p=p.slice(1)),p.length<2||p.charAt(0)!==p.slice(-1))throw new r(`\\verb assertion failed --
|
|
97
|
+
please report what input caused this bug`);return p=p.slice(1,-1),{type:"verb",mode:"text",body:p,star:y}}if(Object.prototype.hasOwnProperty.call(Is,n[0])&&this.mode==="math"&&!Ne[this.mode][n[0]]){if(this.settings.strict&&this.mode==="math")throw new r(`Accented Unicode text character "${n[0]}" used in math mode`,t);n=Is[n[0]]+n.slice(1)}let i=this.mode==="math"?$s.exec(n):null,c;if(i&&(n=n.substring(0,i.index),n==="i"?n="\u0131":n==="j"&&(n="\u0237")),Ne[this.mode][n]){let p=Ne[this.mode][n].group;p!=="bin"||!Ta.includes(this.prevAtomType)&&this.prevAtomType!==""||(p="open");let y=dt.range(t),v;if(Object.prototype.hasOwnProperty.call(Ee,p)){let D=p;v={type:"atom",mode:this.mode,family:D,loc:y,text:n},D!=="rel"&&D!=="bin"||this.prevAtomType!=="text"||Na.test(y.lexer.input.slice(y.end))&&(v.needsSpacing=!0)}else{if(Rs[n]){this.consume();let D=this.fetch().text.charCodeAt(0),z=D===65025?"mathscr":"mathcal";return D!==65024&&D!==65025||this.consume(),{type:"font",mode:"math",font:z,body:{type:"mathord",mode:"math",loc:y,text:Rs[n]}}}v={type:p,mode:this.mode,loc:y,text:n}}c=v}else{if(!(n.charCodeAt(0)>=128||$s.exec(n)))return null;if(this.settings.strict&&this.mode==="math")throw new r(`Unicode text character "${n[0]}" used in math mode`,t);c={type:"textord",mode:"text",loc:dt.range(t),text:n}}if(this.consume(),i)for(let p=0;p<i[0].length;p++){let y=i[0][p];if(!Or[y])throw new r(`Unknown accent ' ${y}'`,t);let v=Or[y][this.mode]||Or[y].text;if(!v)throw new r(`Accent ${y} unsupported in ${this.mode} mode`,t);c={type:"accent",mode:this.mode,loc:dt.range(t),label:v,isStretchy:!1,base:c}}return c}}let Bs=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let n,i;try{i=new zn(e,t),delete i.gullet.macros.current["\\df@tag"],n=i.parse()}catch(c){if(c.toString()!=="ParseError: Unmatched delimiter")throw c;t.wrapDelimiterPairs=!1,i=new zn(e,t),delete i.gullet.macros.current["\\df@tag"],n=i.parse()}if(!(n.length>0&&n[0].type&&n[0].type==="array"&&n[0].addEqnNum)&&i.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new r("\\tag works only in display mode");i.gullet.feed("\\df@tag"),n=[{type:"tag",mode:"text",body:n,tag:i.parse()}]}return n},$a=[2,2,3,3];class Mr{constructor(t){this.level=t.level,this.color=t.color,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontSize=t.fontSize||1,this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.maxSize=t.maxSize}extend(t){let n={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return new Mr(n)}withLevel(t){return this.extend({level:t})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:$a[this.level]})}withColor(t){return this.extend({color:t})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withFontSize(t){return this.extend({fontSize:t})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}getColor(){return this.color}}function Ps(e){let t={},n=0,i=document.getElementsByClassName("tml-eqn");for(let p of i)for(n+=1,p.setAttribute("id","tml-eqn-"+String(n));p.tagName!=="mtable";){if(p.getElementsByClassName("tml-label").length>0){let y=p.attributes.id.value;t[y]=String(n);break}p=p.parentElement}let c=document.getElementsByClassName("tml-tageqn");for(let p of c)if(p.getElementsByClassName("tml-label").length>0){let y=p.getElementsByClassName("tml-tag");if(y.length>0){let v=p.attributes.id.value;t[v]=y[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(p=>{let y=p.getAttribute("href"),v=t[y.slice(1)];p.className.indexOf("tml-eqref")===-1?(v=v.replace(/^\(/,""),v=v.replace(/\)$/,"")):(v.charAt(0)!=="("&&(v="("+v),v.slice(-1)!==")"&&(v+=")"));let D=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");D.appendChild(document.createTextNode(v));let z=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");z.appendChild(D),p.textContent="",p.appendChild(z)})}let Oa=function(e,t,n){let i=n,c=0,p=e.length;for(;i<t.length;){let y=t[i];if(c<=0&&t.slice(i,i+p)===e)return i;y==="\\"?i++:y==="{"?c++:y==="}"&&c--,i++}return-1},Ma=/^\\(?:begin|(?:eq)?ref){/,Ds=[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1},{left:"\\[",right:"\\]",display:!0}],er={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},Lr=[{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1}],La=function(e,t){let n=function(c,p){let y,v=[],D=new RegExp("("+p.map(z=>z.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;y=c.search(D),y!==-1;){y>0&&(v.push({type:"text",data:c.slice(0,y)}),c=c.slice(y));let z=p.findIndex(ee=>c.startsWith(ee.left));if(y=Oa(p[z].right,c,p[z].left.length),y===-1)break;let oe=c.slice(0,y+p[z].right.length),de=Ma.test(oe)?oe:c.slice(p[z].left.length,y);v.push({type:"math",data:de,rawData:oe,display:p[z].display}),c=c.slice(y+p[z].right.length)}return c!==""&&v.push({type:"text",data:c}),v}(e,t.delimiters);if(n.length===1&&n[0].type==="text")return null;let i=document.createDocumentFragment();for(let c=0;c<n.length;c++)if(n[c].type==="text")i.appendChild(document.createTextNode(n[c].data));else{let p=document.createElement("span"),y=n[c].data;t.displayMode=n[c].display;try{t.preProcess&&(y=t.preProcess(y)),ro.render(y,p,t)}catch(v){if(!(v instanceof r))throw v;t.errorCallback("Temml auto-render: Failed to parse `"+n[c].data+"` with ",v),i.appendChild(document.createTextNode(n[c].rawData));continue}i.appendChild(p)}return i},qs=function(e,t){for(let n=0;n<e.childNodes.length;n++){let i=e.childNodes[n];if(i.nodeType===3){let c=La(i.textContent,t);c&&(n+=c.childNodes.length-1,e.replaceChild(c,i))}else if(i.nodeType===1){let c=" "+i.className+" ";t.ignoredTags.indexOf(i.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(p=>c.indexOf(" "+p+" ")===-1)&&qs(i,t)}}},Fs=function(e,t,n={}){t.textContent="";let i=t.tagName.toLowerCase()==="math";i&&(n.wrap="none");let c=Rr(e,n);i||c.children.length>1?(t.textContent="",c.children.forEach(p=>{t.appendChild(p.toNode())})):t.appendChild(c.toNode())};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),Fs=function(){throw new r("Temml doesn't work in quirks mode.")});let Rr=function(e,t){let n=new I(t);try{let i=Bs(e,n);return Pt(i,e,new Mr({level:n.displayMode?ut:Ot,maxSize:n.maxSize}),n)}catch(i){return function(c,p,y){if(y.throwOnError||!(c instanceof r))throw c;let v=new Re(["temml-error"],[new be(p+`
|
|
98
|
+
|
|
99
|
+
`+c.toString())]);return v.style.color=y.errorColor,v.style.whiteSpace="pre-line",v}(i,e,n)}};return{version:"0.13.3",render:Fs,renderToString:function(e,t){return Rr(e,t).toMarkup()},renderMathInElement:function(e,t){if(!e)throw new Error("No element provided to render");let n={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);n.fences?n.delimiters=(i=>i==="$"||i==="("?er[i]:i==="$+"||i==="(+"?er[i.slice(0,1)].concat(Lr):i==="ams"?Lr:i==="all"?er["("].concat(er.$).concat(Lr):Ds)(n.fences):n.delimiters=n.delimiters||Ds,n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},qs(e,n),Ps(e)},postProcess:Ps,ParseError:r,definePreamble:function(e,t){let n=new I(t);if(n.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let i=new zn(e,n,!0);return delete i.gullet.macros.current["\\df@tag"],i.parse()},__parse:function(e,t){let n=new I(t);return Bs(e,n)},__renderToMathMLTree:Rr,__defineSymbol:s,__defineMacro:L}}(),so=ro;function ml(r,a){return so.renderToString(r,{displayMode:a,throwOnError:!1})}function fl(r,a){let l=a;for(;(l=r.indexOf("$$",l))!==-1;){if(r[l-1]!=="\\")return l;l+=1}return-1}function gl(r){let a=[],l="",d=()=>{l&&(a.push({type:"text",value:l}),l="")},u=0;for(;u<r.length;){let h=r[u];if(h==="\\"){let f=r[u+1];if(f==="$"){l+="$",u+=2;continue}if(f==="("){let m=r.indexOf("\\)",u+2);if(m!==-1){d(),a.push({type:"math",tex:r.slice(u+2,m),display:!1}),u=m+2;continue}}l+=f===void 0?h:h+f,u+=f===void 0?1:2;continue}if(h==="$"&&r[u+1]==="$"){let f=fl(r,u+2);if(f!==-1){d(),a.push({type:"math",tex:r.slice(u+2,f),display:!0}),u=f+2;continue}}l+=h,u+=1}return d(),a}var bl="code, pre, script, style, svg, aside, math";function yl(r){let a=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:d=>d.parentElement&&d.parentElement.closest(bl)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),l=[];for(let d=a.nextNode();d;d=a.nextNode())(d.nodeValue.includes("$")||d.nodeValue.includes("\\("))&&l.push(d);for(let d of l){let u=gl(d.nodeValue);if(u.length===1&&u[0].type==="text"&&u[0].value===d.nodeValue)continue;let h=document.createDocumentFragment();for(let f of u)if(f.type==="text")h.appendChild(document.createTextNode(f.value));else{let m=document.createElement("span");m.innerHTML=ml(f.tex,f.display),h.appendChild(m.firstElementChild??document.createTextNode(""))}d.parentNode.replaceChild(h,d)}}function oo(r){r.querySelectorAll("section[data-math]").forEach(a=>yl(a))}ae();le();ae();le();var To=za(_o(),1);var ht=To.default;ae();le();function Co(r){let a=r.regex,l=r.COMMENT("--","$"),d={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},u={begin:/"/,end:/"/,contains:[{match:/""/}]},h=["true","false","unknown"],f=["double precision","large object","with timezone","without timezone"],m=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],b=["add","asc","collation","desc","final","first","last","view"],k=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],S=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],I=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],M=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],C=S,$=[...k,...b].filter(Te=>!S.includes(Te)),q={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},he={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},se={match:a.concat(/\b/,a.either(...C),/\s*\(/),relevance:0,keywords:{built_in:C}};function ce(Te){return a.concat(/\b/,a.either(...Te.map($e=>$e.replace(/\s+/,"\\s+"))),/\b/)}let U={scope:"keyword",match:ce(M),relevance:0};function me(Te,{exceptions:$e,when:Re}={}){let be=Re;return $e=$e||[],Te.map(Ce=>Ce.match(/\|\d+$/)||$e.includes(Ce)?Ce:be(Ce)?`${Ce}|0`:Ce)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:me($,{when:Te=>Te.length<3}),literal:h,type:m,built_in:I},contains:[{scope:"type",match:ce(f)},U,se,q,d,u,r.C_NUMBER_MODE,r.C_BLOCK_COMMENT_MODE,l,he]}}ae();le();var No="[A-Za-z$_][0-9A-Za-z$_]*",lc=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],cc=["true","false","null","undefined","NaN","Infinity"],$o=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Oo=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Mo=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],dc=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],uc=[].concat(Mo,$o,Oo);function Lo(r){let a=r.regex,l=(H,{after:fe})=>{let Ee="</"+H[0].slice(1);return H.input.indexOf(Ee,fe)!==-1},d=No,u={begin:"<>",end:"</>"},h=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,fe)=>{let Ee=H[0].length+H.index,ze=H.input[Ee];if(ze==="<"||ze===","){fe.ignoreMatch();return}ze===">"&&(l(H,{after:Ee})||fe.ignoreMatch());let Ne,s=H.input.substring(Ee);if(Ne=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Ne=s.match(/^\s+extends\s+/))&&Ne.index===0){fe.ignoreMatch();return}}},m={$pattern:No,keyword:lc,literal:cc,built_in:uc,"variable.language":dc},b="[0-9](_?[0-9])*",k=`\\.(${b})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",I={className:"number",variants:[{begin:`(\\b(${S})((${k})|\\.)?|(${k}))[eE][+-]?(${b})\\b`},{begin:`\\b(${S})\\b((${k})\\b|\\.)?|(${k})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:m,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},$={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"css"}},q={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},he={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,M]},ce={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:d+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},U=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,{match:/\$\d+/},I];M.contains=U.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(U)});let me=[].concat(ce,M.contains),Te=me.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(me)}]),$e={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Te},Re={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,a.concat(d,"(",a.concat(/\./,d),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,d],scope:{1:"keyword",3:"title.class"}}]},be={relevance:0,match:a.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$o,...Oo]}},Ce={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Xe={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[$e],illegal:/%/},xe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function E(H){return a.concat("(?!",H.join("|"),")")}let Ie={match:a.concat(/\b/,E([...Mo,"super","import"].map(H=>`${H}\\s*\\(`)),d,a.lookahead(/\s*\(/)),className:"title.function",relevance:0},qe={begin:a.concat(/\./,a.lookahead(a.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},De={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},$e]},F="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,a.lookahead(F)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[$e]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:m,exports:{PARAMS_CONTAINS:Te,CLASS_REFERENCE:be},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Ce,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,ce,{match:/\$\d+/},I,be,{scope:"attr",match:d+a.lookahead(":"),relevance:0},J,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[ce,r.REGEXP_MODE,{className:"function",begin:F,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Te}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:h},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},Xe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[$e,r.inherit(r.TITLE_MODE,{begin:d,className:"title.function"})]},{match:/\.\.\./,relevance:0},qe,{match:"\\$"+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[$e]},Ie,xe,Re,De,{match:/\$[(.]/}]}}ae();le();var cr="[A-Za-z$_][0-9A-Za-z$_]*",Ro=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Io=["true","false","null","undefined","NaN","Infinity"],Bo=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Po=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Do=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],qo=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Fo=[].concat(Do,Bo,Po);function pc(r){let a=r.regex,l=(H,{after:fe})=>{let Ee="</"+H[0].slice(1);return H.input.indexOf(Ee,fe)!==-1},d=cr,u={begin:"<>",end:"</>"},h=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,fe)=>{let Ee=H[0].length+H.index,ze=H.input[Ee];if(ze==="<"||ze===","){fe.ignoreMatch();return}ze===">"&&(l(H,{after:Ee})||fe.ignoreMatch());let Ne,s=H.input.substring(Ee);if(Ne=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Ne=s.match(/^\s+extends\s+/))&&Ne.index===0){fe.ignoreMatch();return}}},m={$pattern:cr,keyword:Ro,literal:Io,built_in:Fo,"variable.language":qo},b="[0-9](_?[0-9])*",k=`\\.(${b})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",I={className:"number",variants:[{begin:`(\\b(${S})((${k})|\\.)?|(${k}))[eE][+-]?(${b})\\b`},{begin:`\\b(${S})\\b((${k})\\b|\\.)?|(${k})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:m,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},$={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"css"}},q={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[r.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},he={className:"string",begin:"`",end:"`",contains:[r.BACKSLASH_ESCAPE,M]},ce={className:"comment",variants:[r.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:d+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),r.C_BLOCK_COMMENT_MODE,r.C_LINE_COMMENT_MODE]},U=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,{match:/\$\d+/},I];M.contains=U.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(U)});let me=[].concat(ce,M.contains),Te=me.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(me)}]),$e={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Te},Re={variants:[{match:[/class/,/\s+/,d,/\s+/,/extends/,/\s+/,a.concat(d,"(",a.concat(/\./,d),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,d],scope:{1:"keyword",3:"title.class"}}]},be={relevance:0,match:a.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Bo,...Po]}},Ce={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Xe={variants:[{match:[/function/,/\s+/,d,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[$e],illegal:/%/},xe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function E(H){return a.concat("(?!",H.join("|"),")")}let Ie={match:a.concat(/\b/,E([...Do,"super","import"].map(H=>`${H}\\s*\\(`)),d,a.lookahead(/\s*\(/)),className:"title.function",relevance:0},qe={begin:a.concat(/\./,a.lookahead(a.concat(d,/(?![0-9A-Za-z$_(])/))),end:d,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},De={match:[/get|set/,/\s+/,d,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},$e]},F="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+r.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,d,/\s*/,/=\s*/,/(async\s*)?/,a.lookahead(F)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[$e]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:m,exports:{PARAMS_CONTAINS:Te,CLASS_REFERENCE:be},illegal:/#(?![$_A-z])/,contains:[r.SHEBANG({label:"shebang",binary:"node",relevance:5}),Ce,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,C,$,q,he,ce,{match:/\$\d+/},I,be,{scope:"attr",match:d+a.lookahead(":"),relevance:0},J,{begin:"("+r.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[ce,r.REGEXP_MODE,{className:"function",begin:F,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:r.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Te}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:u.begin,end:u.end},{match:h},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},Xe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+r.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[$e,r.inherit(r.TITLE_MODE,{begin:d,className:"title.function"})]},{match:/\.\.\./,relevance:0},qe,{match:"\\$"+d,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[$e]},Ie,xe,Re,De,{match:/\$[(.]/}]}}function zo(r){let a=r.regex,l=pc(r),d=cr,u=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],h={begin:[/namespace/,/\s+/,r.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},f={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:u},contains:[l.exports.CLASS_REFERENCE]},m={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},b=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],k={$pattern:cr,keyword:Ro.concat(b),literal:Io,built_in:Fo.concat(u),"variable.language":qo},S={className:"meta",begin:"@"+d},I=(q,he,se)=>{let ce=q.contains.findIndex(U=>U.label===he);if(ce===-1)throw new Error("can not find mode to replace");q.contains.splice(ce,1,se)};Object.assign(l.keywords,k),l.exports.PARAMS_CONTAINS.push(S);let M=l.contains.find(q=>q.scope==="attr"),C=Object.assign({},M,{match:a.concat(d,a.lookahead(/\s*\?:/))});l.exports.PARAMS_CONTAINS.push([l.exports.CLASS_REFERENCE,M,C]),l.contains=l.contains.concat([S,h,f,C]),I(l,"shebang",r.SHEBANG()),I(l,"use_strict",m);let $=l.contains.find(q=>q.label==="func.def");return $.relevance=0,Object.assign(l,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),l}ae();le();function Uo(r){let a=r.regex,l=/[\p{XID_Start}_]\p{XID_Continue}*/u,d=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],m={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:d,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},b={className:"meta",begin:/^(>>>|\.\.\.) /},k={className:"subst",begin:/\{/,end:/\}/,keywords:m,illegal:/#/},S={begin:/\{\{/,relevance:0},I={className:"string",contains:[r.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[r.BACKSLASH_ESCAPE,b],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,b],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[r.BACKSLASH_ESCAPE,b,S,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[r.BACKSLASH_ESCAPE,b,S,k]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[r.BACKSLASH_ESCAPE,S,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,S,k]},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE]},M="[0-9](_?[0-9])*",C=`(\\b(${M}))?\\.(${M})|\\b(${M})\\.`,$=`\\b|${d.join("|")}`,q={className:"number",relevance:0,variants:[{begin:`(\\b(${M})|(${C}))[eE][+-]?(${M})[jJ]?(?=${$})`},{begin:`(${C})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${$})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${$})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${$})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${$})`},{begin:`\\b(${M})[jJ](?=${$})`}]},he={className:"comment",begin:a.lookahead(/# type:/),end:/$/,keywords:m,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},se={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:["self",b,q,I,r.HASH_COMMENT_MODE]}]};return k.contains=[I,q,b],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[b,q,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},I,he,r.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,l],scope:{1:"keyword",3:"title.function"},contains:[se]},{variants:[{match:[/\bclass/,/\s+/,l,/\s*/,/\(\s*/,l,/\s*\)/]},{match:[/\bclass/,/\s+/,l]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[q,se,I]}]}}ae();le();function Ho(r){let a=r.regex,l={},d={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[l]}]};Object.assign(l,{className:"variable",variants:[{begin:a.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},d]});let u={className:"subst",begin:/\$\(/,end:/\)/,contains:[r.BACKSLASH_ESCAPE]},h=r.inherit(r.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),f={begin:/<<-?\s*(?=\w+)/,starts:{contains:[r.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},m={className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE,l,u]};u.contains.push(m);let b={match:/\\"/},k={className:"string",begin:/'/,end:/'/},S={match:/\\'/},I={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},r.NUMBER_MODE,l]},M=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],C=r.SHEBANG({binary:`(${M.join("|")})`,relevance:10}),$={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[r.inherit(r.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},q=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],he=["true","false"],se={match:/(\/[a-z._-]+)+/},ce=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],U=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],me=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],Te=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:q,literal:he,built_in:[...ce,...U,"set","shopt",...me,...Te]},contains:[C,r.SHEBANG(),$,I,h,f,se,m,b,k,S,l]}}ae();le();function Go(r){let a="true false yes no null",l="[\\w#;/?:@&=+$,.~*'()[\\]]+",d={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},u={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},h={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},f={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[r.BACKSLASH_ESCAPE,u]},m=r.inherit(f,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),M={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},C={end:",",endsWithParent:!0,excludeEnd:!0,keywords:a,relevance:0},$={begin:/\{/,end:/\}/,contains:[C],illegal:"\\n",relevance:0},q={begin:"\\[",end:"\\]",contains:[C],illegal:"\\n",relevance:0},he=[d,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+l},{className:"type",begin:"!<"+l+">"},{className:"type",begin:"!"+l},{className:"type",begin:"!!"+l},{className:"meta",begin:"&"+r.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+r.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},r.HASH_COMMENT_MODE,{beginKeywords:a,keywords:{literal:a}},M,{className:"number",begin:r.C_NUMBER_RE+"\\b",relevance:0},$,q,h,f],se=[...he];return se.pop(),se.push(m),C.contains=se,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:he}}ae();le();function jo(r){let a={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},l={match:/[{}[\],:]/,className:"punctuation",relevance:0},d=["true","false","null"],u={scope:"literal",beginKeywords:d.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:d},contains:[a,l,r.QUOTE_STRING_MODE,u,r.C_NUMBER_MODE,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}ae();le();var $n="[0-9](_*[0-9])*",dr=`\\.(${$n})`,ur="[0-9a-fA-F](_*[0-9a-fA-F])*",Ko={className:"number",variants:[{begin:`(\\b(${$n})((${dr})|\\.)?|(${dr}))[eE][+-]?(${$n})[fFdD]?\\b`},{begin:`\\b(${$n})((${dr})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${dr})[fFdD]?\\b`},{begin:`\\b(${$n})[fFdD]\\b`},{begin:`\\b0[xX]((${ur})\\.?|(${ur})?\\.(${ur}))[pP][+-]?(${$n})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ur})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Wo(r,a,l){return l===-1?"":r.replace(a,d=>Wo(r,a,l-1))}function Vo(r){let a=r.regex,l="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",d=l+Wo("(?:<"+l+"~~~(?:\\s*,\\s*"+l+"~~~)*>)?",/~~~/g,2),b={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},k={className:"meta",begin:"@"+l,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},S={className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[r.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:b,illegal:/<\/|#/,contains:[r.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[r.BACKSLASH_ESCAPE]},r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,l],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[a.concat(/(?!else)/,l),/\s+/,l,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,l],className:{1:"keyword",3:"title.class"},contains:[S,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",r.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:b,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[k,r.APOS_STRING_MODE,r.QUOTE_STRING_MODE,Ko,r.C_BLOCK_COMMENT_MODE]},r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE]},Ko,k]}}ae();le();function Zo(r){let h={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:h,illegal:"</",contains:[r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE,{className:"string",variants:[r.QUOTE_STRING_MODE,r.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[r.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:h,illegal:/["']/}]}]}}ae();le();function Xo(r){let a=r.regex,l=/(r#)?/,d=a.concat(l,r.UNDERSCORE_IDENT_RE),u=a.concat(l,r.IDENT_RE),h={className:"title.function.invoke",relevance:0,begin:a.concat(/\b/,/(?!let|for|while|if|else|match\b)/,u,a.lookahead(/\s*\(/))},f="([ui](8|16|32|64|128|size)|f(32|64))?",m=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],b=["true","false","Some","None","Ok","Err"],k=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],S=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:r.IDENT_RE+"!?",type:S,keyword:m,literal:b,built_in:k},illegal:"</",contains:[r.C_LINE_COMMENT_MODE,r.COMMENT("/\\*","\\*/",{contains:["self"]}),r.inherit(r.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+f},{begin:"\\b0o([0-7_]+)"+f},{begin:"\\b0x([A-Fa-f0-9_]+)"+f},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+f}],relevance:0},{begin:[/fn/,/\s+/,d],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[r.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,d],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,d,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,d],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,d],className:{1:"keyword",3:"title.class"}},{begin:r.IDENT_RE+"::",keywords:{keyword:"Self",built_in:k,type:S}},{className:"punctuation",begin:"->"},h]}}ae();le();function Yo(r){let a=r.regex,l=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),d=/[\p{L}0-9._:-]+/u,u={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},h={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},f=r.inherit(h,{begin:/\(/,end:/\)/}),m=r.inherit(r.APOS_STRING_MODE,{className:"string"}),b=r.inherit(r.QUOTE_STRING_MODE,{className:"string"}),k={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:d,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[u]},{begin:/'/,end:/'/,contains:[u]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[h,b,m,f,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[h,f,b,m]}]}]},r.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},u,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[b]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[k],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[k],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:a.concat(/</,a.lookahead(a.concat(l,a.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:l,relevance:0,starts:k}]},{className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(l,/>/))),contains:[{className:"name",begin:l,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}ae();le();var hc=r=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:r.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:r.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),mc=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],fc=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],gc=[...mc,...fc],bc=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),yc=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),wc=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),xc=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Jo(r){let a=r.regex,l=hc(r),d={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},u="and or not only",h=/@-?\w[\w]*(-\w+)*/,f="[a-zA-Z-][a-zA-Z0-9_-]*",m=[r.APOS_STRING_MODE,r.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[l.BLOCK_COMMENT,d,l.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+f,relevance:0},l.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+yc.join("|")+")"},{begin:":(:)?("+wc.join("|")+")"}]},l.CSS_VARIABLE,{className:"attribute",begin:"\\b("+xc.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[l.BLOCK_COMMENT,l.HEXCOLOR,l.IMPORTANT,l.CSS_NUMBER_MODE,...m,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...m,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},l.FUNCTION_DISPATCH]},{begin:a.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:h},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:u,attribute:bc.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...m,l.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gc.join("|")+")\\b"}]}}ae();le();function Qo(r){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}ht.registerLanguage("sql",Co);ht.registerLanguage("javascript",Lo);ht.registerLanguage("typescript",zo);ht.registerLanguage("python",Uo);ht.registerLanguage("bash",Ho);ht.registerLanguage("yaml",Go);ht.registerLanguage("json",jo);ht.registerLanguage("java",Vo);ht.registerLanguage("go",Zo);ht.registerLanguage("rust",Xo);ht.registerLanguage("xml",Yo);ht.registerLanguage("css",Jo);ht.registerLanguage("plaintext",Qo);ht.registerAliases(["js"],{languageName:"javascript"});ht.registerAliases(["ts"],{languageName:"typescript"});ht.registerAliases(["shell","sh","zsh"],{languageName:"bash"});ht.registerAliases(["html"],{languageName:"xml"});ht.registerAliases(["text","plain"],{languageName:"plaintext"});function vc(r,a){return r.split("|").map(l=>{if(l=l.trim(),l===""||l==="all")return Array.from({length:a},(u,h)=>h+1);let d=[];for(let u of l.split(",")){let h=u.trim().match(/^(\d+)(?:-(\d+))?$/);if(!h)continue;let f=parseInt(h[1],10),m=h[2]?parseInt(h[2],10):f;for(let b=f;b<=Math.min(m,a);b++)d.push(b)}return d})}function kc(r){let a=[[]];for(function l(d,u){for(let h of d.childNodes)h.nodeType===Node.TEXT_NODE?h.nodeValue.split(`
|
|
100
|
+
`).forEach((m,b)=>{b>0&&a.push([]),m&&a[a.length-1].push({path:u,text:m})}):h.nodeType===Node.ELEMENT_NODE&&l(h,[...u,h])}(r,[]);a.length&&a[a.length-1].length===0;)a.pop();r.textContent="";for(let l of a){let d=document.createElement("span");d.className="code-line";for(let{path:u,text:h}of l){let f=d;for(let m of u){let b=f.lastChild;b&&b.__orig===m||(b=m.cloneNode(!1),b.__orig=m,f.appendChild(b)),f=b}f.appendChild(document.createTextNode(h))}r.appendChild(d)}return r.querySelectorAll(":scope > .code-line")}function Ec(r,a){if(r.length===a)return"all lines";let l=[...r],d=[],u=l[0],h=l[0];for(let f of l.slice(1)){if(f===h+1){h=f;continue}d.push(u===h?`${u}`:`${u}-${h}`),u=h=f}return d.push(u===h?`${u}`:`${u}-${h}`),`lines ${d.join(",")}`}function ei(r,a){r.querySelectorAll("pre > code").forEach(l=>{let d=[...l.classList].find(S=>S.startsWith("language-")),u=d?d.slice(9):null,h=l.textContent.replace(/^\n/,"").replace(/\s+$/,"");u&&ht.getLanguage(u)?l.innerHTML=ht.highlight(h,{language:u}).value:l.textContent=h,l.classList.add("hljs");let f=l.parentElement,m=kc(l);f.hasAttribute("data-lines-numbers")&&f.classList.add("line-numbers");let b=f.getAttribute("data-lines");if(!b)return;let k=vc(b,m.length);f.classList.add("stepping"),a(f,{count:k.length,label:S=>S===0?"code":Ec(k[S-1],m.length),apply(S){if(m.forEach(C=>C.classList.remove("line-hl","line-dim")),S===0)return;let I=new Set(k[S-1]),M=I.size===m.length;m.forEach((C,$)=>{I.has($+1)?C.classList.add("line-hl"):M||C.classList.add("line-dim")})}})})}ae();le();var Sc=/⟨CLICK⟩|<CLICK>|<click(?:\s[^>]*)?>(?:<\/click>)?/gi;function ti(r){return(r||"").split(Sc)}function Kr(r){let a="width=1100,height=700",l=window.open("","decklight-speaker",a);if(!l)return null;let d=!1;try{d=l.document.body?l.document.body.childNodes.length>0:!1}catch{d=!0}if(d){try{l.close()}catch{}if(l=window.open("","decklight-speaker",a),!l)return null;try{l.document}catch{return null}}let u=()=>{let f=new URL(location.href);return f.searchParams.set("embedded",""),f.hash="",f.href};window.__decklightBridge={subscribe(f){r.__speakerCb=f},getState:()=>ni(r,u()),next:()=>r.next(),prev:()=>r.prev()},r.__notifySpeaker=()=>{r.__speakerCb&&!l.closed&&r.__speakerCb(ni(r,u()))};let h=`${r.config.width} / ${r.config.height}`;return l.document.write(`<!doctype html><html><head><meta charset="utf-8">
|
|
67
101
|
<title>Decklight \u2014 speaker view</title>
|
|
68
102
|
<style>
|
|
69
103
|
body { margin:0; background:#111; color:#eee; font:14px/1.5 -apple-system, system-ui, sans-serif;
|
|
70
104
|
display:grid; grid-template-columns: 1.4fr 1fr; grid-template-rows:auto auto 1fr auto; gap:10px; padding:10px; height:100vh; box-sizing:border-box; }
|
|
71
105
|
header { grid-column:1/3; display:flex; gap:16px; align-items:center; }
|
|
106
|
+
/* the phone-remote QR (#39): parked at the end of the header, out of the
|
|
107
|
+
way, and click-to-enlarge because a 72px code is hard to scan across a
|
|
108
|
+
lectern. Enlarging dims the room with a giant box-shadow rather than
|
|
109
|
+
adding a backdrop element. */
|
|
110
|
+
#qr { margin-left:auto; width:72px; height:72px; background:#fff; padding:3px;
|
|
111
|
+
border-radius:6px; cursor:zoom-in; image-rendering:pixelated; }
|
|
112
|
+
#qr.big { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
|
|
113
|
+
width:min(70vw,70vh); height:min(70vw,70vh); z-index:10; cursor:zoom-out;
|
|
114
|
+
box-shadow:0 0 0 100vmax rgba(0,0,0,.8); }
|
|
72
115
|
#timer { font-size:22px; font-variant-numeric:tabular-nums; }
|
|
73
116
|
#pos { color:#999; }
|
|
74
117
|
button { background:#333; color:#eee; border:0; border-radius:6px; padding:6px 12px; cursor:pointer; }
|
|
@@ -80,7 +123,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
80
123
|
.thumbs { display:flex; flex-direction:column; gap:10px; min-height:0; align-items:start; }
|
|
81
124
|
/* Panes keep the presentation's aspect ratio: width-driven, capped so a
|
|
82
125
|
short window can't push the notes off screen. */
|
|
83
|
-
.thumb { width:min(100%, calc(42vh * (${
|
|
126
|
+
.thumb { width:min(100%, calc(42vh * (${h}))); aspect-ratio:${h}; border:1px solid #333; border-radius:8px; overflow:hidden; position:relative; }
|
|
84
127
|
.thumb .tag { position:absolute; top:6px; left:8px; z-index:2; background:#0009; padding:1px 8px; border-radius:4px; font-size:11px; }
|
|
85
128
|
iframe { width:100%; height:100%; border:0; background:#000; }
|
|
86
129
|
aside { grid-column:1/3; overflow:auto; background:#1b1b1b; border-radius:8px; padding:14px 16px; font-size:16px; line-height:1.65; }
|
|
@@ -98,6 +141,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
98
141
|
<button id="prev">\u25C0 prev</button>
|
|
99
142
|
<button id="next">next \u25B6</button>
|
|
100
143
|
<button id="mode" title="S toggles rehearse mode (cue cards instead of prose)">speak</button>
|
|
144
|
+
<img id="qr" alt="scan to use your phone as a remote" title="scan to use your phone as a remote \u2014 click to enlarge" hidden>
|
|
101
145
|
</header>
|
|
102
146
|
<div class="thumbs">
|
|
103
147
|
<div class="thumb"><span class="tag">current</span><iframe id="cur"></iframe></div>
|
|
@@ -132,6 +176,7 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
132
176
|
if (lastSt) render(lastSt);
|
|
133
177
|
};
|
|
134
178
|
$('#mode').onclick = window.__decklightSpeakerToggle;
|
|
179
|
+
$('#qr').onclick = () => $('#qr').classList.toggle('big');
|
|
135
180
|
document.addEventListener('keydown', (e) => {
|
|
136
181
|
if (e.key === 'ArrowRight' || e.key === ' ') api && api.next();
|
|
137
182
|
if (e.key === 'ArrowLeft') api && api.prev();
|
|
@@ -158,6 +203,16 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
158
203
|
// be out of view.
|
|
159
204
|
const now = $('#notes .seg.now');
|
|
160
205
|
if (now) now.scrollIntoView({ block: mode === 'rehearse' ? 'center' : 'nearest', behavior: 'smooth' });
|
|
206
|
+
// Only set src once: reassigning it every render would refetch the QR on
|
|
207
|
+
// every build step, and a flickering code is one nobody can scan.
|
|
208
|
+
const qr = $('#qr');
|
|
209
|
+
if (st.qr) {
|
|
210
|
+
if (qr.getAttribute('src') !== st.qr) qr.setAttribute('src', st.qr);
|
|
211
|
+
qr.hidden = false;
|
|
212
|
+
} else {
|
|
213
|
+
qr.hidden = true;
|
|
214
|
+
qr.classList.remove('big');
|
|
215
|
+
}
|
|
161
216
|
$('#steps').innerHTML = st.labels.map((l, i) =>
|
|
162
217
|
'<span class="step ' + (i === st.step - 1 ? 'now' : '') + '">' + (i + 1) + '. ' + l + '</span>').join('');
|
|
163
218
|
}
|
|
@@ -172,30 +227,30 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
172
227
|
}
|
|
173
228
|
connect(30);
|
|
174
229
|
<\/script>
|
|
175
|
-
</body></html>`),
|
|
176
|
-
Decklight theme \xB7 ${
|
|
177
|
-
generated by Decklight (\u2303T) \u2014 token contract: SPEC.md
|
|
230
|
+
</body></html>`),l.document.close(),l}function ni(r,a){let{slide:l,step:d,totalSlides:u}=r.state,h=r._records[l-1],f=h?h.groups.length:0,m=d<f?`/${l}/${d+1}`:l<u?`/${l+1}/0`:`/${l}/${d}`,b=r._sections[l-1]?.querySelector("aside.notes"),k=r._sections[l-1]?.querySelector("aside.rehearse");return{slide:l,step:d,totalSlides:u,totalSteps:f,url:a,nextHash:m,notesSegments:ti(b?b.innerHTML:""),rehearseSegments:k?ti(k.innerHTML):null,labels:r._stepLabels(l-1),qr:r.__remoteQr??null}}ae();le();function kt(r,a){r.addEventListener("click",l=>{l.target===r&&a()})}function jt(r,a,l,{scroll:d=!0}={}){let u=(a+r.length)%r.length;return r.forEach((h,f)=>h.classList.toggle(l,f===u)),d&&r[u]?.scrollIntoView({block:"nearest"}),u}function pr(r,{query:a="",onMove:l,onCommit:d,onType:u,onBackspace:h,onClear:f,onClose:m}){switch(r.key){case"ArrowDown":return l?.(1),!0;case"ArrowUp":return l?.(-1),!0;case"Enter":return d?.(),!0;case"Backspace":return h?(h(),!0):!1;case"Escape":return a&&f?f():m?.(),!0;default:return r.key.length===1&&u?(u(r.key),!0):!1}}function ri(){let r=[];return{register(a){return r.push(a),a},active:()=>r.find(a=>a.isOpen()),closeOthers(a){for(let l of r)l!==a&&l.isOpen()&&l.close()}}}ae();le();ae();le();function Ac(r){return function(){r|=0,r=r+1831565813|0;let a=Math.imul(r^r>>>15,1|r);return a=a+Math.imul(a^a>>>7,61|a)^a,((a^a>>>14)>>>0)/4294967296}}function Zt(r,a,l){r=(r%360+360)%360,a=Math.max(0,Math.min(100,a))/100,l=Math.max(0,Math.min(100,l))/100;let d=(1-Math.abs(2*l-1))*a,u=d*(1-Math.abs(r/60%2-1)),h=l-d/2,f=Math.floor(r/60)%6;return[[d,u,0],[u,d,0],[0,d,u],[0,u,d],[u,0,d],[d,0,u]][f].map(b=>Math.round((b+h)*255))}function un([r,a,l]){return"#"+[r,a,l].map(d=>d.toString(16).padStart(2,"0")).join("")}function Mn([r,a,l]){let d=[r,a,l].map(u=>(u/=255,u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)));return .2126*d[0]+.7152*d[1]+.0722*d[2]}function _c(r,a){let[l,d]=[Mn(r),Mn(a)].sort((u,h)=>h-u);return(l+.05)/(d+.05)}var On=(r,a)=>Math.min(...a.map(l=>_c(r,l)));function mt(r,a,l,d,u){let f=d.reduce((S,I)=>S+Mn(I),0)/d.length<.5?1:-1,m=[];for(let S=a;S>0;S-=15)m.push(S);m.push(0);for(let S of[f,-f])for(let I of m)for(let M=l;M>=2&&M<=98;M+=S){let C=Zt(r,I,M);if(On(C,d)>=u)return C}let b=[253,253,254],k=[8,9,10];return On(b,d)>=On(k,d)?b:k}var Tc=["amber","boreal","cinder","coral","drift","ember","fable","fjord","gale","harbor","iris","juniper","kelp","lumen","mesa","nectar","onyx","pluma","quartz","reef","sable","tundra","umbra","verdant","wisp","yonder","zephyr"],Wr='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Cc='ui-rounded, "SF Pro Rounded", "Segoe UI", Roboto, Helvetica, Arial, sans-serif',Nc='"Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif',$c='"SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", Menlo, Consolas, monospace',Oc=[Wr,Wr,Cc,Nc],Mc=[600,650,700,750,800],Lc=["4px","6px","8px","10px","12px","14px","18px"],si={analogous:[30,-30,60,15,-15],complementary:[180,150,210,30,-30],split:[150,210,30,180,-30],triadic:[120,240,60,180,300]},yn={bgSatMax:{dark:18,light:12},accentSat:[42,68],hlSat:[36,58],ansiSat:[46,66],gradientChance:.15,gradientHueDrift:[8,20]};function hr(r){r=(r??Math.floor(Math.random()*4294967295))>>>0;let a=Ac(r),l=X=>X[Math.floor(a()*X.length)],d=(X,Y)=>X+a()*(Y-X),u=a()<.5,h=Math.floor(a()*360),f=l(Object.keys(si)),m=si[f],b=h+m[0],k=a()*a(),S=(X,Y)=>X+k*(Y-X),I=S(5,yn.bgSatMax[u?"dark":"light"]),M=u?d(6,13):d(94,97.5),C=Zt(h,I,M),$=un(C),q=[C];if(a()<yn.gradientChance){let X=Zt(h+d(...yn.gradientHueDrift),I+d(0,8),M+(u?d(2.5,5):-d(2,4)));$=`linear-gradient(${Math.round(d(120,210))}deg, ${un(C)} 0%, ${un(X)} 100%)`,q=[C,X]}let he=Zt(h,Math.min(I+4,35),u?M+4:M-4),se=mt(h,12,u?86:18,q,4.6),ce=mt(h,10,u?64:44,q,3.1),me=a()<.5?mt(b,S(20,55),u?80:26,q,3.2):mt(h,8,u?92:12,q,4.6),Te=S(...yn.accentSat),$e=u?d(55,68):d(34,48),Re=Zt(b,Te,$e);for(;Math.max(On([253,253,254],[Re]),On([8,9,10],[Re]))<4.7;)$e+=u?1:-1,Re=Zt(b,Te,$e);let be=mt(b,18,Mn(Re)<.4?96:10,[Re],4.6),Ce=mt(a()<.5?b:h+(m[1]??30),S(35,60),u?70:34,q,3.2),Xe=un(he),xe=`1px solid ${un(Zt(h,Math.min(I+6,40),u?M+10:M-10))}`,E=l(Lc),Ie=u?`0 ${Math.round(d(4,10))}px ${Math.round(d(18,30))}px rgba(0, 0, 0, 0.${Math.round(d(35,55))})`:`0 ${Math.round(d(3,6))}px ${Math.round(d(12,20))}px rgba(30, 30, 40, 0.${String(Math.round(d(8,14))).padStart(2,"0")})`,qe=Zt(h,Math.min(I+2,28),u?Math.max(M-3,3):Math.min(M-3,93)),De=[qe],F=mt(h,8,u?85:20,De,4.6),J={keyword:m[0],string:m[3]??120,number:m[2]??60,function:m[1]??210,type:m[4]??280},H=S(...yn.hlSat),fe=u?68:36,Ee={};for(let[X,Y]of Object.entries(J))Ee[X]=mt(h+Y,H,fe,De,4.6);Ee.comment=mt(h,12,u?60:46,De,3.2),Ee.punct=mt(h,10,u?74:32,De,4.6);let Ne=[0,m[0],m[1]??40,m[2]??90,m[3]??160,m[4]??230].map((X,Y)=>Zt(h+X,S(14,34),u?M+8+Y%3*2:M-6-Y%3*2)),s=[...q,...Ne],o=mt(h,14,u?60:42,q,2.2),O=mt(h,10,u?84:20,s,3.4),Be=mt(h,10,u?62:46,s,2.7),P=mt(b,Te,u?68:38,s,2.7),Ue=Ne.map(un),nt=Zt(h,Math.min(I+4,30),u?Math.max(M-4,3):d(12,18)),W=[nt],Ae=mt(h,8,82,W,4.6),Q=mt(b,S(...yn.ansiSat),66,W,3.2),ye={red:8,green:125,yellow:45,blue:215,magenta:290,cyan:175},x={black:mt(h,10,58,W,3.1),white:mt(h,6,88,W,4.6)};for(let[X,Y]of Object.entries(ye))x[X]=mt(Y+h%16-8,S(...yn.ansiSat),66,W,3.1);let we=X=>{let[Y,ge,V]=X.map(ne=>Math.min(255,Math.round(ne+(255-ne)*.35)));return On([Y,ge,V],W)>=3?[Y,ge,V]:mt(h,8,90,W,3.1)},g=`gen-${l(Tc)}-${(r%65535).toString(16).padStart(4,"0")}`,j=un,B={"--bg":$,"--bg-accent":un(he),"--fg":j(se),"--muted":j(ce),"--font-body":Wr,"--font-heading":l(Oc),"--font-mono":$c,"--heading-color":j(me),"--heading-weight":String(l(Mc)),"--link":j(Ce),"--accent":j(Re),"--accent-contrast":j(be),"--block-bg":Xe,"--block-border":xe,"--block-radius":E,"--shadow":Ie,"--code-bg":j(qe),"--code-fg":j(F),"--hl-keyword":j(Ee.keyword),"--hl-string":j(Ee.string),"--hl-number":j(Ee.number),"--hl-comment":j(Ee.comment),"--hl-function":j(Ee.function),"--hl-type":j(Ee.type),"--hl-punct":j(Ee.punct),"--d-stroke":j(o),"--d-text":j(O),"--d-muted":j(Be),"--d-accent":j(P),"--d-fill-1":Ue[0],"--d-fill-2":Ue[1],"--d-fill-3":Ue[2],"--d-fill-4":Ue[3],"--d-fill-5":Ue[4],"--d-fill-6":Ue[5],"--term-bg":j(nt),"--term-fg":j(Ae),"--term-prompt":j(Q),"--term-cursor":j(Q),"--term-selection":`rgba(${Re[0]}, ${Re[1]}, ${Re[2]}, 0.30)`,"--ansi-black":j(x.black),"--ansi-red":j(x.red),"--ansi-green":j(x.green),"--ansi-yellow":j(x.yellow),"--ansi-blue":j(x.blue),"--ansi-magenta":j(x.magenta),"--ansi-cyan":j(x.cyan),"--ansi-white":j(x.white),"--ansi-bright-black":j(we(x.black)),"--ansi-bright-red":j(we(x.red)),"--ansi-bright-green":j(we(x.green)),"--ansi-bright-yellow":j(we(x.yellow)),"--ansi-bright-blue":j(we(x.blue)),"--ansi-bright-magenta":j(we(x.magenta)),"--ansi-bright-cyan":j(we(x.cyan)),"--ansi-bright-white":j(mt(h,6,97,W,3.1)),"--dim-opacity":(.25+Math.round(a()*15)/100).toFixed(2)};return{name:g,seed:r,dark:u,harmony:f,tokens:B}}var oi=[["canvas",["--bg","--bg-accent","--fg","--muted"]],["type",["--font-body","--font-heading","--font-mono","--heading-color","--heading-weight","--link"]],["accent",["--accent","--accent-contrast"]],["blocks",["--block-bg","--block-border","--block-radius","--shadow"]],["code",["--code-bg","--code-fg","--hl-keyword","--hl-string","--hl-number","--hl-comment","--hl-function","--hl-type","--hl-punct"]],["diagram",["--d-stroke","--d-text","--d-muted","--d-accent","--d-fill-1","--d-fill-2","--d-fill-3","--d-fill-4","--d-fill-5","--d-fill-6"]],["terminal",["--term-bg","--term-fg","--term-prompt","--term-cursor","--term-selection","--ansi-black","--ansi-red","--ansi-green","--ansi-yellow","--ansi-blue","--ansi-magenta","--ansi-cyan","--ansi-white","--ansi-bright-black","--ansi-bright-red","--ansi-bright-green","--ansi-bright-yellow","--ansi-bright-blue","--ansi-bright-magenta","--ansi-bright-cyan","--ansi-bright-white"]],["builds",["--dim-opacity"]]];function Vr(r,a){let l=`/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
231
|
+
Decklight theme \xB7 ${r}
|
|
232
|
+
generated by Decklight (\u2303T) \u2014 token contract: SPEC.md THEMING
|
|
178
233
|
All values derived with WCAG luminance math; passes test/contrast.mjs
|
|
179
234
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
180
235
|
|
|
181
236
|
.decklight {
|
|
182
|
-
`;for(let[
|
|
183
|
-
`;for(let
|
|
184
|
-
`;
|
|
185
|
-
`}}let
|
|
186
|
-
`);return
|
|
187
|
-
`}I();D();I();D();var Vr=["A","B","C","D","E","F","G","H","X"],ln="#edb58e",Ao="#c98f6d",Fd="#43302a",cn="#b96b58",dn="#57262c",As="#f6f1ea",Co="#d17a70",Yr=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
|
|
237
|
+
`;for(let[u,h]of oi){let f=h.filter(m=>a[m]!==void 0);if(f.length){l+=` /* \u2500\u2500 ${u} ${"\u2500".repeat(Math.max(1,26-u.length))} */
|
|
238
|
+
`;for(let m of f)l+=` ${m}: ${a[m]};
|
|
239
|
+
`;l+=`
|
|
240
|
+
`}}let d=new Set(oi.flatMap(([,u])=>u));for(let[u,h]of Object.entries(a))d.has(u)||(l+=` ${u}: ${h};
|
|
241
|
+
`);return l.replace(/\n$/,"")+`}
|
|
242
|
+
`}function ii({root:r,config:a,params:l,toast:d,debugLog:u,overlays:h,deck:f,editmode:m}){let b=[...document.querySelectorAll("style[data-theme]:not([data-theme-added])")],k=[...document.querySelectorAll("style[data-theme][data-theme-added]")],S=new Set(k.map(N=>N.dataset.theme).filter(Boolean)),I=b.length>0,M=I?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if(I){let N=b.find(G=>!G.hasAttribute("disabled")&&G.media!=="not all");N=N||b[0],b.forEach(G=>{G.removeAttribute("disabled"),G.media=G===N?"all":"not all"})}let C=I||!!M,$=N=>(N.match(/themes\/([\w-]+)\.css/)||[])[1],q="decklight-theme:"+location.pathname,he="decklight-custom-themes",se={};try{se=JSON.parse(localStorage.getItem(he)||"{}")||{}}catch{}let ce=null,U=null,me={};function Te(N,G,ie){let pe=ie==="generated"?ce:me[N];return pe||(pe=document.createElement("style"),pe.media="not all",ie==="generated"?pe.dataset.generated="":pe.dataset.custom=""),pe.dataset.theme=N,pe.textContent=Vr(N,G),document.head.appendChild(pe),ie==="generated"?ce=pe:me[N]=pe,pe}let $e=()=>[ce,...Object.values(me),...k];function Re(N){for(let G of $e())G&&G!==N&&(G.media="not all")}let be=()=>$e().find(N=>N&&N.media!=="not all")||null,Ce=()=>{let N=be();return N?N.dataset.theme:I?b.find(G=>G.media!=="not all")?.dataset.theme:M?$(M.href):void 0};function Xe(){let N=getComputedStyle(r),G=Pe=>Pe?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),ie=G(N.backgroundColor);(!ie||ie[4]!==void 0&&+ie[4]==0)&&(ie=G(N.backgroundImage));let pe=ie?Mn([+ie[1],+ie[2],+ie[3]])<.5:!1;r.setAttribute("data-canvas",pe?"dark":"light")}M?.addEventListener("load",Xe);function xe(N,G=!1){if(!N||!/^[\w-]+$/.test(N))return;let ie=!1;if(U&&ce&&N===U.name)ce.media="all",Re(ce),ie=!se[N];else if(se[N]){let pe=Te(N,se[N],"custom");pe.media="all",Re(pe)}else if(S.has(N)){let pe=k.find(Pe=>Pe.dataset.theme===N);pe.media="all",Re(pe)}else{if(!C)return;if(Re(null),I){let pe=b.find(Pe=>Pe.dataset.theme===N);if(!pe)return;b.forEach(Pe=>{Pe.media=Pe===pe?"all":"not all"})}else M.href=M.href.replace(/themes\/[\w-]+\.css(\?.*)?$/,`themes/${N}.css`)}if(!l.has("embedded")&&!ie)try{localStorage.setItem(q,N)}catch{}G||d(N),u("theme",N),Xe()}let E=typeof Ve<"u"?Ve:null,Ie={added:"Added",custom:"Custom",generated:"Generated"},qe=N=>E?.labels?.[N]??Ie[N]??N;function De(N){if(se[N])return"custom";if(U&&N===U.name)return"generated";if(S.has(N))return"added";if(E){for(let[G,ie]of Object.entries(E.packs))if(ie.includes(N))return G}return"other"}let F=()=>{let N;if(I){let ie=b.map(pe=>pe.dataset.theme);N=a.themes?.length?a.themes.filter(pe=>ie.includes(pe)):ie}else N=a.themes?.length?a.themes:typeof Ke<"u"?Ke:[];let G=[...S,...Object.keys(se)];if(U&&!se[U.name]&&G.push(U.name),N=[...N,...G.filter(ie=>!N.includes(ie))],E){let ie=new Map,pe=0;for(let Pe of E.order)for(let Se of E.packs[Pe]??[])ie.set(Se,pe++);N=[...N].sort((Pe,Se)=>(ie.get(Pe)??1e9)-(ie.get(Se)??1e9))}return N};function J(N){let G=[];for(let ie of E.order){let pe=(E.packs[ie]??[]).filter(Pe=>N.includes(Pe));pe.length&&G.push([ie,pe])}for(let ie of["added","custom","generated"]){let pe=N.filter(Pe=>De(Pe)===ie);pe.length&&G.push([ie,pe])}return G}let H=N=>btoa(unescape(encodeURIComponent(JSON.stringify(N)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),fe=N=>JSON.parse(decodeURIComponent(escape(atob(N.replace(/-/g,"+").replace(/_/g,"/")))));function Ee(N,G=!1){U={name:N.name,tokens:N.tokens};let ie=Te(N.name,N.tokens,"generated");return ie.media="all",Re(ie),G||d(`\u2728 ${N.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),Xe(),N.name}function ze(){return Ee(hr())}function Ne(N){if(!U||!ce||ce.media==="not all")return d("no generated theme to save \u2014 \u2303T to generate one"),null;let G=N??(window.prompt?.("Save theme as:",U.name.replace(/^gen-/,""))||"");if(G=String(G).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!G)return null;((typeof Ke<"u"?Ke:[]).includes(G)||b.some(Pe=>Pe.dataset.theme===G))&&(G="custom-"+G),se[G]=U.tokens;try{localStorage.setItem(he,JSON.stringify(se))}catch{}let pe=Te(G,se[G],"custom");if(pe.media="all",ce?.remove(),ce=null,U=null,Re(pe),!l.has("embedded"))try{localStorage.setItem(q,G)}catch{}try{let Pe=new Blob([Vr(G,se[G])],{type:"text/css"}),Se=document.createElement("a");Se.href=URL.createObjectURL(Pe),Se.download=`${G}.css`,Se.click(),setTimeout(()=>URL.revokeObjectURL(Se.href),5e3)}catch{}return d(`saved ${G} \u2014 ${G}.css downloaded`,2200),G}let s=null;function o(N=!1){return s?(clearTimeout(s.timer),s=null,N||d("theme cycle cancelled"),!0):!1}function O(N){let G=F();if(!C||G.length<2)return;if(s){let Se=s;clearTimeout(Se.timer),s=null,Se.dir===N?xe(Se.name):d("theme cycle cancelled");return}let ie=Ce(),pe=Math.max(0,G.indexOf(ie)),Pe=G[(pe+N+G.length)%G.length];if(E&&De(Pe)!==De(ie)){let Se=N>0?".":",",Me=N>0?",":".";s={dir:N,name:Pe,timer:setTimeout(()=>{s=null},4e3)},d(`\u2933 ${qe(De(Pe))} pack next (${Pe}) \u2014 ${Se} confirms \xB7 ${Me} or Esc cancels`,4e3);return}xe(Pe)}l.has("embedded")&&window.addEventListener("message",N=>{let G=N.data&&N.data.__decklightPreview;!G||N.source!==window.parent||(G.gen?Ee(G.gen,!0):G.theme?xe(G.theme,!0):G.goto&&f().goto(G.goto[0],G.goto[1]??0))});function Be(){let N=Ce(),G=se[N]?{name:N,tokens:se[N]}:U&&N===U.name?U:null;return G?"?embedded&gen="+H(G):N?"?embedded&theme="+encodeURIComponent(N):"?embedded"}function P(){let N=l.get("gen");if(N)try{let pe=fe(N);if(pe&&pe.tokens){Ee({name:pe.name||"gen-preview",tokens:pe.tokens},!0);return}}catch{}let G=null;try{G=localStorage.getItem(q)}catch{}let ie=l.get("theme")||G;ie&&xe(ie,!0)}let Ue="\0generate",nt="pack:",W="back",Ae="all",Q="browse",ye="",x=N=>N.charCodeAt(0)<32,we=null,g=0,j,B=[],X=null,Y="",ge="packs",V=()=>E?"packs":"all",ne=()=>m?.()?.available()===!0,Fe=()=>m?.()?.base()??"",Je=()=>ne()?[Q]:[],re=null,ke=N=>(re?.themes??[]).find(G=>G.qualified===N);async function He(){re={loading:!0,themes:[],stale:[]},_t("browse");let N;try{let G=await fetch(Fe()+"/edit/theme/browse"),ie=await G.json().catch(()=>({}));N=G.ok&&ie.ok?{themes:ie.themes??[],stale:ie.stale??[],cacheOnly:ie.cacheOnly!==!1}:{themes:[],stale:[],error:ie.error||`the author server said ${G.status}`}}catch{N={themes:[],stale:[],error:"the author server did not answer"}}!we||ge!=="browse"||(re=N,_t("browse"))}async function _e(N){let G=we?.querySelector(".tp-caption");G&&(G.textContent=`installing ${N}\u2026`);try{let ie=await fetch(Fe()+"/edit/theme/add",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:N})}),pe=await ie.json().catch(()=>({}));if(!ie.ok){let Pe=[pe.error,...pe.problems??[]].filter(Boolean).join(" \xB7 ");G&&(G.textContent=Pe||`install failed (${ie.status})`),d(`${N}: ${pe.error||"install refused"}`,3600);return}it(),d(`installed ${pe.name}${pe.replaced?" (replaced)":""} \u2014 Z takes it back`,2800),u("theme",`${N} installed from a marketplace`)}catch{G&&(G.textContent="the author server did not answer")}}function Le(N){let G=f().state,ie="#/"+G.slide+"/"+G.step;if(N===Ue||se[N]||U&&N===U.name){let pe=N===Ue?X:se[N]?{name:N,tokens:se[N]}:U;return location.pathname+"?embedded&gen="+H(pe)+ie}return location.pathname+"?embedded&theme="+encodeURIComponent(N)+ie}function Qe(N){N.textContent=X?`\u2728 ${X.name} \u2014 \u2303T re-rolls`:"\u2728 Generate new\u2026"}function Oe(){X=hr();let N=B.indexOf(Ue);N<0||(Qe(we.querySelectorAll(".tp-row")[N]),te(N,!0))}function Ye(){let N=we.querySelector(".tp-list"),G=Ce(),ie=F();if(ge==="browse"){let Se=(re?.themes??[]).filter(Me=>!Y||Me.qualified.includes(Y));B=[W,...Se.map(Me=>ye+Me.qualified)]}else if(Y)B=ie.filter(Se=>Se.includes(Y));else if(!E||ge==="all")B=E?[Ue,W,...ie]:[Ue,...ie,...Je()];else if(ge==="packs")B=[Ue,...J(ie).map(([Se])=>nt+Se),Ae,...Je()];else{let Se=ge.slice(5);B=[W,...J(ie).find(([Me])=>Me===Se)?.[1]??[]]}N.textContent="";let pe=(Se,Me)=>{let rt=document.createElement("span");rt.className="tp-tag",rt.textContent=Me,Se.appendChild(rt)};if(B.forEach((Se,Me)=>{let rt=document.createElement("div");if(rt.setAttribute("role","option"),Se===Ue)rt.className="tp-row tp-gen",Qe(rt);else if(Se===W)rt.className="tp-row tp-back",rt.textContent=V()==="packs"?"\u2190 packs":"\u2190 themes";else if(Se===Q)rt.className="tp-row tp-browse",rt.textContent="\u2315 Browse marketplaces\u2026";else if(Se.startsWith(ye)){let at=ke(Se.slice(ye.length));rt.className="tp-row tp-mkt",rt.textContent=at?.name??Se.slice(ye.length);let Et=S.has(at?.name)?"installed":at?.marketplace;Et&&pe(rt,Et)}else if(Se===Ae)rt.className="tp-row tp-all",rt.textContent="\u2733 all themes",pe(rt,String(ie.length));else if(Se.startsWith(nt)){let at=Se.slice(nt.length),Et=J(ie).find(([Nt])=>Nt===at)?.[1]??[];rt.className="tp-row tp-pack"+(Et.includes(G)?" tp-current":""),rt.textContent=`\u25B8 ${qe(at)}`,pe(rt,String(Et.length))}else{rt.className="tp-row"+(Se===G?" tp-current":""),rt.textContent=Se;let at=se[Se]?"custom":U&&Se===U.name?"generated":S.has(Se)?"added":Y&&E?qe(De(Se)):null;at&&pe(rt,at)}rt.addEventListener("mouseenter",()=>te(Me,!1)),rt.addEventListener("click",()=>{te(Me,!0),ft()}),N.appendChild(rt)}),!B.length){let Se=document.createElement("div");Se.className="tp-none",Se.textContent="no themes match",N.appendChild(Se)}if(ge==="browse"){let Se=document.createElement("div");Se.className="tp-none",Se.textContent=re?.loading?"reading the catalogs\u2026":re?.error?re.error:B.some(Me=>Me.startsWith(ye))?re.stale?.length?`from the cache \xB7 never fetched: ${re.stale.join(", ")} \u2014 marketplace update`:"from the cache \u2014 listing never goes to the network":Y?"no marketplace theme matches":"no themes in the marketplaces you have registered",N.appendChild(Se)}let Pe=we.querySelector(".tp-filter");Pe.textContent=Y||"type to filter\u2026",Pe.classList.toggle("tp-active",!!Y)}function ct(){let N=Ce(),G=B.indexOf(N);if(G>=0)return G;let ie=B.indexOf(nt+De(N));return ie>=0?ie:Math.min(1,B.length-1)}function _t(N,G=!1){ge=N,Ye(),B.length&&te(ct(),G)}function Pt(N){Y=N.toLowerCase(),Ye(),B.length?te(Y?0:ct(),!1):we.querySelector(".tp-caption").textContent="no match"}function Kt(){if(we)return it();h.closeOthers(st);let N=F();if(!C&&!N.length)return;Y="",ge=V(),re=null,we=document.createElement("div"),we.className="decklight-theme-picker",we.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Themes"></div></div><div class="tp-preview"><iframe title="Theme preview"></iframe><div class="tp-caption"></div></div></div>',Ye(),kt(we,it),r.appendChild(we);let G=Ce();G&&Ct(we.querySelector("iframe"),G),te(ct(),!G)}function te(N,G){if(!B.length)return;g=(N+B.length)%B.length;let ie=B[g];ie===Ue&&!X&&(X=hr(),Qe(we.querySelectorAll(".tp-row")[g])),jt(we.querySelectorAll(".tp-row"),g,"tp-selected");let pe=F(),Pe=ie===Ue?X?`\u2728 ${X.name}`:"generate new":ie===W?V()==="packs"?"back to packs":"back to the theme list":ie===Q?"themes from the marketplaces you have registered":ie.startsWith(ye)?nn(ie.slice(ye.length)):ie===Ae?`all ${pe.length} themes, flattened`:ie.startsWith(nt)?`${qe(ie.slice(nt.length))} \xB7 ${J(pe).find(([Me])=>Me===ie.slice(nt.length))?.[1].length??0} themes`:E?`${qe(De(ie))} \xB7 ${ie}`:ie;if(we.querySelector(".tp-caption").textContent=Pe,clearTimeout(j),ie!==Ue&&x(ie))return;let Se=we.querySelector("iframe");G?Ct(Se,ie):j=setTimeout(()=>Ct(Se,ie),60)}function nn(N){let G=ke(N);return G?[G.qualified,G.description,S.has(G.name)?"installed \u2014 \u23CE re-installs it":"\u23CE installs it"].filter(Boolean).join(" \xB7 "):N}let Dt=!1,qt=null;function Xt(N){return N===Ue||se[N]||U&&N===U.name?{gen:N===Ue?X:se[N]?{name:N,tokens:se[N]}:U}:{theme:N}}function Ct(N,G){if(!N.dataset.booted){N.dataset.booted="1",Dt=!1,N.addEventListener("load",()=>{if(Dt=!0,qt!==null&&we){let ie=qt;qt=null,Ct(N,ie)}},{once:!0}),N.src=Le(G);return}if(!Dt){qt=G;return}N.contentWindow?.postMessage({__decklightPreview:Xt(G)},"*")}function ft(){let N=B[g];if(N!==void 0){if(N===Ue){X&&Ee(X),it();return}if(N===W){_t(V());return}if(N===Ae){_t("all");return}if(N===Q){He();return}if(N.startsWith(ye)){_e(N.slice(ye.length));return}if(N.startsWith(nt)){_t("pack:"+N.slice(nt.length),!0);return}xe(N),it()}}function it(){clearTimeout(j),we?.remove(),we=null}let st=h.register({isOpen:()=>!!we,close:it,keydown(N){switch(N.key){case"ArrowDown":te(g+1,!1);break;case"ArrowUp":te(g-1,!1);break;case"Enter":ft();break;case"Backspace":Pt(Y.slice(0,-1));break;case"Escape":Y?Pt(""):ge!==V()?_t(V()):it();break;default:if(N.key.length===1&&/[a-z0-9-]/i.test(N.key)){Pt(Y+N.key);break}return!1}return!0}});return{applyTheme:xe,currentTheme:Ce,themeList:F,cycleTheme:O,cancelCyclePending:o,rollTheme:ze,saveGeneratedTheme:Ne,adoptGenerated:Ee,updateCanvas:Xe,restoreSaved:P,previewQuery:Be,openPicker:Kt,closePicker:it,browse(){we||Kt(),we&&He()},hasGenerated:()=>!!U,rollFromPicker(){return we&&B[g]===Ue?(Oe(),!0):!1}}}ae();le();ae();le();ae();le();var Zr=["A","B","C","D","E","F","G","H","X"],Ln="#edb58e",ai="#c98f6d",Rc="#43302a",Rn="#b96b58",In="#57262c",mr="#f6f1ea",li="#d17a70",Xr=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
|
|
188
243
|
<circle cx="120" cy="120" r="116" fill="var(--block-bg, rgba(128,128,128,.14))" stroke="var(--accent, #6b7f9e)" stroke-opacity=".35" stroke-width="2"/>
|
|
189
244
|
<clipPath id="dlc-bust"><circle cx="120" cy="120" r="114"/></clipPath>
|
|
190
245
|
<g clip-path="url(#dlc-bust)">
|
|
191
246
|
<path d="M120 164 C 94 164 71 178 61 198 L 56 240 L 184 240 L 179 198 C 169 178 146 164 120 164 Z" fill="var(--accent, #4f6fae)"/>
|
|
192
|
-
<path d="M106 142 L 106 176 C 106 185 134 185 134 176 L 134 142 Z" fill="${
|
|
193
|
-
<path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${
|
|
247
|
+
<path d="M106 142 L 106 176 C 106 185 134 185 134 176 L 134 142 Z" fill="${Ln}"/>
|
|
248
|
+
<path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${ai}"/>
|
|
194
249
|
<g data-idle>
|
|
195
|
-
<circle cx="75" cy="98" r="9" fill="${
|
|
196
|
-
<circle cx="165" cy="98" r="9" fill="${
|
|
197
|
-
<path d="M120 38 C 91 38 76 62 76 93 C 76 123 96 149 120 149 C 144 149 164 123 164 93 C 164 62 149 38 120 38 Z" fill="${
|
|
198
|
-
<path d="M120 28 C 87 28 69 51 72 90 C 80 60 96 50 120 50 C 144 50 160 60 168 90 C 171 51 153 28 120 28 Z" fill="${
|
|
250
|
+
<circle cx="75" cy="98" r="9" fill="${Ln}"/>
|
|
251
|
+
<circle cx="165" cy="98" r="9" fill="${Ln}"/>
|
|
252
|
+
<path d="M120 38 C 91 38 76 62 76 93 C 76 123 96 149 120 149 C 144 149 164 123 164 93 C 164 62 149 38 120 38 Z" fill="${Ln}"/>
|
|
253
|
+
<path d="M120 28 C 87 28 69 51 72 90 C 80 60 96 50 120 50 C 144 50 160 60 168 90 C 171 51 153 28 120 28 Z" fill="${Rc}"/>
|
|
199
254
|
<path d="M92 84 Q 103 78 114 83" stroke="#4a352c" stroke-width="4" fill="none" stroke-linecap="round"/>
|
|
200
255
|
<path d="M126 83 Q 137 78 148 84" stroke="#4a352c" stroke-width="4" fill="none" stroke-linecap="round"/>
|
|
201
256
|
<ellipse cx="103" cy="97" rx="7" ry="5.5" fill="#fbf7f2"/>
|
|
@@ -206,25 +261,54 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
206
261
|
<circle cx="137" cy="97" r="3.2" fill="#5a4030"/>
|
|
207
262
|
<circle cx="137" cy="97" r="1.5" fill="#241a14"/>
|
|
208
263
|
<circle cx="138.3" cy="95.6" r=".8" fill="#fff"/>
|
|
209
|
-
<g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${
|
|
210
|
-
<g data-eyelid><rect x="129" y="90.5" width="16" height="12" rx="6" fill="${
|
|
211
|
-
<path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${
|
|
264
|
+
<g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${Ln}"/></g>
|
|
265
|
+
<g data-eyelid><rect x="129" y="90.5" width="16" height="12" rx="6" fill="${Ln}"/></g>
|
|
266
|
+
<path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${ai}" stroke-width="3" fill="none" stroke-linecap="round"/>
|
|
212
267
|
<ellipse cx="96" cy="115" rx="6.5" ry="4" fill="#e59e7d" opacity=".4"/>
|
|
213
268
|
<ellipse cx="144" cy="115" rx="6.5" ry="4" fill="#e59e7d" opacity=".4"/>
|
|
214
|
-
<g data-mouth="X"><path d="M106 130 Q 120 136 134 130" stroke="${
|
|
215
|
-
<g data-mouth="A"><path d="M105 130 Q 120 124 135 130 Q 120 137 105 130 Z" fill="${
|
|
216
|
-
<g data-mouth="B"><path d="M104 129 Q 120 122 136 129 Q 120 141 104 129 Z" fill="${
|
|
217
|
-
<g data-mouth="C"><ellipse cx="120" cy="131" rx="13" ry="8.5" fill="${
|
|
218
|
-
<g data-mouth="D"><ellipse cx="120" cy="132" rx="16" ry="12" fill="${
|
|
219
|
-
<g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${
|
|
220
|
-
<g data-mouth="F"><ellipse cx="120" cy="131" rx="6" ry="5.5" fill="${
|
|
221
|
-
<g data-mouth="G"><path d="M105 128 Q 120 123 135 128 Q 120 134 105 128 Z" fill="${
|
|
222
|
-
<g data-mouth="H"><ellipse cx="120" cy="131" rx="12" ry="9" fill="${
|
|
269
|
+
<g data-mouth="X"><path d="M106 130 Q 120 136 134 130" stroke="${Rn}" stroke-width="4" fill="none" stroke-linecap="round"/></g>
|
|
270
|
+
<g data-mouth="A"><path d="M105 130 Q 120 124 135 130 Q 120 137 105 130 Z" fill="${Rn}"/></g>
|
|
271
|
+
<g data-mouth="B"><path d="M104 129 Q 120 122 136 129 Q 120 141 104 129 Z" fill="${In}"/><rect x="110" y="126" width="20" height="5" rx="2" fill="${mr}"/></g>
|
|
272
|
+
<g data-mouth="C"><ellipse cx="120" cy="131" rx="13" ry="8.5" fill="${In}"/><rect x="109" y="124.5" width="22" height="4.5" rx="2" fill="${mr}"/></g>
|
|
273
|
+
<g data-mouth="D"><ellipse cx="120" cy="132" rx="16" ry="12" fill="${In}"/><rect x="106" y="122" width="28" height="6" rx="2.5" fill="${mr}"/><ellipse cx="120" cy="140" rx="9" ry="4.5" fill="${li}"/></g>
|
|
274
|
+
<g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${In}" stroke="${Rn}" stroke-width="3"/></g>
|
|
275
|
+
<g data-mouth="F"><ellipse cx="120" cy="131" rx="6" ry="5.5" fill="${In}" stroke="${Rn}" stroke-width="3.5"/></g>
|
|
276
|
+
<g data-mouth="G"><path d="M105 128 Q 120 123 135 128 Q 120 134 105 128 Z" fill="${Rn}"/><rect x="110" y="127" width="20" height="5" rx="2" fill="${mr}"/><path d="M108 134 Q 120 139 132 134" stroke="${Rn}" stroke-width="3" fill="none" stroke-linecap="round"/></g>
|
|
277
|
+
<g data-mouth="H"><ellipse cx="120" cy="131" rx="12" ry="9" fill="${In}"/><path d="M113 125 Q 120 122 127 125 Q 127 132 120 133 Q 113 132 113 125 Z" fill="${li}"/></g>
|
|
223
278
|
</g>
|
|
224
279
|
</g>
|
|
225
|
-
</svg>`;function qd(t,e){let n=t?.cues;if(!n?.length||!(e>=0)||t.duration&&e>=t.duration)return"X";let r=0,i=n.length-1,a=-1;for(;r<=i;){let c=r+i>>1;n[c].t<=e?(a=c,r=c+1):i=c-1}if(a<0)return"X";let o=n[a].v;return Vr.includes(o)?o:"X"}function No(t){let e=a=>Math.round(a*1e3)/1e3,n=[],r=(a,o)=>{n.length&&n[n.length-1].v===o||n.push({t:e(a),v:o})},i=0;for(let{timeline:a,gap:o=0}of t){o>0&&(r(i,"X"),i+=o);for(let c of a?.cues??[])r(i+c.t,c.v);i+=a?.duration??0}return{v:1,kind:"visemes",duration:e(i),source:"stitch",cues:n}}function Ro({root:t,config:e,debugLog:n,toast:r}){let i=e.narration?.character??{},a=i.bridgeUrl??"http://127.0.0.1:8789",o=i.fallback??"amplitude",c="decklight-character:"+location.pathname,d=i.mode??"off",p=i.engine??"wav2lip",m=i.portrait??"default",_=i.solo??!1;try{let T=JSON.parse(localStorage.getItem(c));T?.mode&&(d=T.mode,p=T.engine??p,m=T.portrait??m),typeof T?.solo=="boolean"&&(_=T.solo)}catch{}let y=null,k=null,A=null,E=null,H=null,z=null,G=null,F=0,Z=!1,J,K=new Map,ae=new Map,W=T=>`${T}|${p}|${m}`;function ce(){try{localStorage.setItem(c,JSON.stringify({mode:d,engine:p,portrait:m,solo:_}))}catch{}}function X(){t.classList.toggle("decklight-solo",_&&d!=="off"&&!!y?.classList.contains("show"))}function Le(){Z||(Z=!0,r("lipsync bridge unreachable \u2014 run: decklight lipsync"),n("lipsync","bridge unreachable \u2014 amplitude fallback"))}function Pe(){if(y||(y=document.createElement("div"),y.className="decklight-character pos-"+(i.position??"br"),y.setAttribute("aria-hidden","true"),i.size&&y.style.setProperty("--character-size",i.size+"px"),t.appendChild(y)),A!==d)if(A=d,y.classList.toggle("mode-video",d==="video"),k=null,d==="video")y.innerHTML="",k=document.createElement("video"),k.muted=!0,k.playsInline=!0,k.preload="auto",y.appendChild(k);else if(i.sprites){y.innerHTML="";for(let T of Vr){if(!i.sprites[T])continue;let Q=document.createElement("img");Q.src=i.sprites[T],Q.setAttribute("data-mouth",T),Q.alt="",y.appendChild(Q)}}else if(typeof i.svg=="string"&&i.svg.startsWith("#")){y.innerHTML="";let T=document.querySelector(i.svg);T&&y.appendChild(T.cloneNode(!0))}else typeof i.svg=="string"&&/^\s*</.test(i.svg)?y.innerHTML=i.svg:i.svg?(y.innerHTML=Yr,fetch(i.svg).then(T=>T.text()).then(T=>{y&&A==="viseme"&&(y.innerHTML=T)}).catch(()=>{})):y.innerHTML=Yr}function Se(){Pe(),y.classList.add("show"),F||(F=setInterval(M,33)),X()}function Ce(){F&&(clearInterval(F),F=0),y?.classList.remove("show"),k?.pause(),H=null,z=null,ge("X"),X()}function ge(T){T===G||!y||(G=T,y.setAttribute("data-viseme",T))}let x=null,R=null,C=null,P=null;function B(){if(o!=="amplitude"||!E)return!1;if(C===E)return!!R;C=E;try{x??=new(window.AudioContext||window.webkitAudioContext);let T=x.createMediaElementSource(E);R=x.createAnalyser(),R.fftSize=512,T.connect(R),R.connect(x.destination),P=new Uint8Array(R.fftSize)}catch{R=null}return!!R}function he(){R.getByteTimeDomainData(P);let T=0;for(let q=0;q<P.length;q++){let V=(P[q]-128)/128;T+=V*V}let Q=Math.sqrt(T/P.length);return Q<.02?"X":Q<.06?"B":Q<.12?"C":"D"}function M(){if(y?.classList.contains("show")){if(d==="video"){k&&E&&k.readyState>=2&&!E.paused&&Math.abs(k.currentTime-E.currentTime)>.15&&(k.currentTime=E.currentTime);return}if(!E||E.paused||E.ended){ge("X");return}H?ge(qd(H,E.currentTime)):o==="hide"?ge("X"):B()?ge(he()):ge("X")}}function fe(T,Q,q){if(!K.has(T)){let V=(async()=>{let Te=await Q;if(!Te)return null;let L=Date.now(),$=await fetch(`${a}/viseme?text=${encodeURIComponent(q??"")}`,{method:"POST",headers:{"content-type":"audio/wav"},body:Te.blob});if(!$.ok)throw new Error(String($.status));let ne=await $.json();return n("lipsync",`visemes ${T} \xB7 ${ne.cues?.length??0} cues \u2192 ${((Date.now()-L)/1e3).toFixed(1)}s`),ne})();V.catch(()=>{K.get(T)===V&&K.delete(T)}),K.set(T,V)}return K.get(T)}function te(T,Q){let q=W(T);if(!ae.has(q)){let V=(async()=>{let Te=await Q;if(!Te)return null;let L=Date.now(),$=await fetch(`${a}/video?engine=${p}&portrait=${encodeURIComponent(m)}`,{method:"POST",headers:{"content-type":"audio/wav"},body:Te.blob});if(!$.ok)throw new Error(String($.status));let ne=await $.blob(),Y=$.headers?.get?.("x-lipsync-cached")==="1";return n("lipsync",`video ${T} \xB7 ${p} \u2192 ${((Date.now()-L)/1e3).toFixed(1)}s${Y?" (cached)":""}`),URL.createObjectURL(ne)})();V.catch(()=>{ae.get(q)===V&&ae.delete(q)}),ae.set(q,V)}return ae.get(q)}function we(T,Q,q){d==="viseme"?fe(T,Q,q).catch(()=>{}):d==="video"&&te(T,Q).catch(()=>{})}function Be(T,Q,q){d!=="off"&&(Se(),z=T,d==="viseme"?(H=null,fe(T,Promise.resolve(Q),q).then(V=>{z===T&&(H=V)}).catch(()=>Le())):te(T,Promise.resolve(Q)).then(V=>{z!==T||!V||!k||(k.src=V,k.playbackRate=E?.playbackRate??1,E&&!E.paused&&(k.currentTime=E.currentTime,k.play().catch(()=>{})))}).catch(()=>Le()))}function je(T,Q){if(d==="off"||!T||T.live)return;Se();let q=String(Q).padStart(2,"0"),V=`file|${T.dir}|${q}`;z=V,d==="viseme"?(H=null,(async()=>{let Te=document.querySelector(`script[data-decklight-visemes="slide-${q}"]`);if(Te)return JSON.parse(Te.textContent);let L=await fetch(`${T.dir}/slide-${q}.visemes.json`);if(!L.ok)throw new Error(String(L.status));return L.json()})().then(Te=>{z===V&&(H=Te)}).catch(()=>{})):k&&(k.src=`${T.dir}/slide-${q}.mp4`,k.playbackRate=E?.playbackRate??1,k.play().catch(()=>{}))}function Me(T){!T||E===T||(E=T,T.addEventListener("pause",()=>{d==="video"&&k?.pause()}),T.addEventListener("play",()=>{d==="video"&&k?.src&&k.play().catch(()=>{})}),T.addEventListener("ratechange",()=>{k&&(k.playbackRate=T.playbackRate)}))}async function lt(){try{let T=await fetch(a+"/ping");J=T.ok?await T.json():null}catch{J=null}return J}function Ue(T,Q={}){d=T,Q.engine&&(p=Q.engine),Q.portrait&&(m=Q.portrait),ce(),d==="off"?Ce():(Z=!1,Pe(),_&&Se()),X(),n("lipsync",d==="off"?"character off":`character ${d}${d==="video"?` \xB7 ${p} \xB7 ${m}`:""}`)}function Xe(T){_=!!T,ce();let Q=!!E&&!E.paused&&!E.ended;_&&d!=="off"?Se():!_&&!Q&&Ce(),X(),n("lipsync",`character solo ${_?"on":"off"}`)}return{get mode(){return d},get engine(){return p},get portrait(){return m},get solo(){return _},get bridgeInfo(){return J},setMode:Ue,setSolo:Xe,prefetchSentence:we,beginSentence:Be,beginSlide:je,attachAudio:Me,stop:Ce,probe:lt,ensureTimeline:fe}}var Gd={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},Rs=99,Kd=18,Mo=6,Wd="ul, ol, svg, pre, table, .terminal, img, .columns",un=null;function Pn(t,e){ra(t,e),un&&un._rescanFor(t)}function jd(t){for(let e of t.children)if(!e.matches("aside, script, style, .decklight-hero-logo"))return e.matches("h1, h2")?e:null;return null}function Zd(t,e){if(!e||t.getAttribute("data-subtitle")==="none")return null;let n=e.nextElementSibling;return n&&n.matches("p")&&!n.hasAttribute("data-build")?(n.classList.add("subtitle"),n):t.querySelector(":scope > p.subtitle")}function $o(t){return t.pinTitles===!0?Rs:typeof t.pinTitles=="number"&&isFinite(t.pinTitles)?t.pinTitles:null}function Oo(t,e){let n=$o(e),r=t.getAttribute("data-pin");if(r==="none")return null;if(r!==null&&r!==""){let a=parseFloat(r);return isFinite(a)?a:n??Rs}return r===""?n??Rs:n===null?null:[...t.querySelectorAll(Wd)].some(a=>!a.closest("aside")&&!a.closest(".decklight-hero-logo"))?n:null}function Cs(t,e){t.forEach(n=>{let r=jd(n),i=n.getAttribute("data-layout"),a;if(i==="pinned"){let p=parseFloat(n.getAttribute("data-pin"));a=isFinite(p)?p:$o(e)??Rs}else i==="centered"||i==="top"?a=null:a=Oo(n,e);let o=Zd(n,r);if(n.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),n.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),a===null||!r){n.removeAttribute("data-pinned"),n.style.removeProperty("--pin-y"),n.style.removeProperty("--pin-sub-y"),n.style.removeProperty("--pin-space");return}r.classList.add("pin-title"),n.setAttribute("data-pinned",""),n.style.setProperty("--pin-y",a+"px"),n.classList.add("pin-measure");let c=r.offsetHeight||0,d=a+c;o&&(o.classList.add("pin-subtitle"),n.style.setProperty("--pin-sub-y",Math.round(d+Mo)+"px"),d+=Mo+(o.offsetHeight||0)),n.classList.remove("pin-measure"),n.style.setProperty("--pin-space",Math.round(d+Kd)+"px")})}function Io(t){return[...t.children].filter(e=>!e.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo"))}function Lo(t){t.forEach(e=>{if(e.querySelectorAll(":scope > .split-columns").forEach(r=>r.classList.remove("split-columns")),!/^split/.test(e.getAttribute("data-layout")||""))return;let n=Io(e);n.length===1&&n[0].matches("ul, ol")&&n[0].classList.add("split-columns")})}function Ns(t,e){if(!t)return;let n=[t,...t.querySelectorAll("pre, table, svg, ul, ol, blockquote")].some(r=>r.scrollHeight>r.clientHeight+2&&getComputedStyle(r).overflowY!=="visible"&&!r.closest(".terminal")&&!r.hasAttribute("data-scroll-ok"));t.toggleAttribute("data-overflow",n),n&&console.warn(`Decklight: slide ${e} content overflows and is clipped \u2014 reduce content or font size`)}function Do(t={}){let e=new URLSearchParams(location.search),n={...Gd,...t};e.has("embedded")&&(n.controls=!1);let r=e.has("print"),i=Date.now(),a=[],o=null,c=0;function d(s,l){if(a.push({t:((Date.now()-i)/1e3).toFixed(3),kind:s,msg:l}),a.length>200&&a.shift(),o){ui(a[a.length-1]),Yt();let u=o.querySelector(".dbg-log");u.scrollTop=u.scrollHeight}}let p=document.querySelector(".decklight");if(!p)throw new Error("Decklight: no .decklight element found");let m=!e.has("embedded")&&n.playlist?.modules?.length?n.playlist:null,_=m?m.index??0:0;function y(s){if(!m)return!1;let l=m.modules[_+s];return l?(location.href=l.href+(s>0?"#/1/0":"#/999/999"),!0):!1}function k(s){let l=m?.modules[s];l&&(location.href=l.href+"#/1/0")}let A=!!p.querySelector("section[data-module]");function E(){let s=[];return(v._sections||[]).forEach((l,u)=>{l.hasAttribute("data-module")&&s.push({title:l.getAttribute("data-module"),slide:u+1})}),s}function H(s){let l=-1;return s.forEach((u,h)=>{u.slide<=v.state.slide&&(l=h)}),l}let z=[...document.querySelectorAll("style[data-theme]")],G=z.length>0,F=G?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if(G){let s=z.find(l=>!l.hasAttribute("disabled")&&l.media!=="not all");s=s||z[0],z.forEach(l=>{l.removeAttribute("disabled"),l.media=l===s?"all":"not all"})}let Z=G||!!F,J=s=>(s.match(/themes\/([\w-]+)\.css/)||[])[1],K="decklight-theme:"+location.pathname,ae="decklight-custom-themes",W={};try{W=JSON.parse(localStorage.getItem(ae)||"{}")||{}}catch{}let ce=null,X=null,Le={};function Pe(s,l,u){let h=u==="generated"?ce:Le[s];return h||(h=document.createElement("style"),h.media="not all",u==="generated"?h.dataset.generated="":h.dataset.custom=""),h.dataset.theme=s,h.textContent=Zr(s,l),document.head.appendChild(h),u==="generated"?ce=h:Le[s]=h,h}function Se(s){for(let l of[ce,...Object.values(Le)])l&&l!==s&&(l.media="not all")}let Ce=()=>[ce,...Object.values(Le)].find(s=>s&&s.media!=="not all")||null,ge=()=>{let s=Ce();return s?s.dataset.theme:G?z.find(l=>l.media!=="not all")?.dataset.theme:F?J(F.href):void 0},x=200,R=4,C=[],P=null,B=null;function he(){return C}function M(s,l=3200){if(C.push({at:new Date,text:String(s)}),C.length>x&&C.shift(),B&&hi(),r)return;P||(P=document.createElement("div"),P.className="decklight-messages",p.appendChild(P));let u=document.createElement("div");for(u.className="decklight-toast",u.textContent=s,P.appendChild(u),requestAnimationFrame(()=>u.classList.add("show"));P.children.length>R;)P.firstChild.remove();setTimeout(()=>{u.classList.remove("show"),setTimeout(()=>u.remove(),260)},l)}function fe(s,l=!1){if(!s||!/^[\w-]+$/.test(s))return;let u=!1;if(X&&ce&&s===X.name)ce.media="all",Se(ce),u=!W[s];else if(W[s]){let h=Pe(s,W[s],"custom");h.media="all",Se(h)}else{if(!Z)return;if(Se(null),G){let h=z.find(f=>f.dataset.theme===s);if(!h)return;z.forEach(f=>{f.media=f===h?"all":"not all"})}else F.href=F.href.replace(/themes\/[\w-]+\.css(\?.*)?$/,`themes/${s}.css`)}if(!e.has("embedded")&&!u)try{localStorage.setItem(K,s)}catch{}l||M(s),d("theme",s),Zn()}let te=typeof le<"u"?le:null,we=s=>te?.labels?.[s]??s;function Be(s){if(W[s])return"custom";if(X&&s===X.name)return"generated";if(te){for(let[l,u]of Object.entries(te.packs))if(u.includes(s))return l}return"other"}let je=()=>{let s;if(G){let u=z.map(h=>h.dataset.theme);s=n.themes?.length?n.themes.filter(h=>u.includes(h)):u}else s=n.themes?.length?n.themes:typeof re<"u"?re:[];let l=Object.keys(W);if(X&&!W[X.name]&&l.push(X.name),s=[...s,...l.filter(u=>!s.includes(u))],te){let u=new Map,h=0;for(let f of te.order)for(let g of te.packs[f]??[])u.set(g,h++);s=[...s].sort((f,g)=>(u.get(f)??1e9)-(u.get(g)??1e9))}return s};function Me(s){let l=[];for(let u of te.order){let h=(te.packs[u]??[]).filter(f=>s.includes(f));h.length&&l.push([u,h])}for(let u of["custom","generated"]){let h=s.filter(f=>Be(f)===u);h.length&&l.push([u,h])}return l}let lt=s=>btoa(unescape(encodeURIComponent(JSON.stringify(s)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Ue=s=>JSON.parse(decodeURIComponent(escape(atob(s.replace(/-/g,"+").replace(/_/g,"/")))));function Xe(s,l=!1){X={name:s.name,tokens:s.tokens};let u=Pe(s.name,s.tokens,"generated");return u.media="all",Se(u),l||M(`\u2728 ${s.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),Zn(),s.name}function T(){return Xe(Ts())}function Q(s){if(!X||!ce||ce.media==="not all")return M("no generated theme to save \u2014 \u2303T to generate one"),null;let l=s??(window.prompt?.("Save theme as:",X.name.replace(/^gen-/,""))||"");if(l=String(l).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!l)return null;((typeof re<"u"?re:[]).includes(l)||z.some(f=>f.dataset.theme===l))&&(l="custom-"+l),W[l]=X.tokens;try{localStorage.setItem(ae,JSON.stringify(W))}catch{}let h=Pe(l,W[l],"custom");if(h.media="all",ce?.remove(),ce=null,X=null,Se(h),!e.has("embedded"))try{localStorage.setItem(K,l)}catch{}try{let f=new Blob([Zr(l,W[l])],{type:"text/css"}),g=document.createElement("a");g.href=URL.createObjectURL(f),g.download=`${l}.css`,g.click(),setTimeout(()=>URL.revokeObjectURL(g.href),5e3)}catch{}return M(`saved ${l} \u2014 ${l}.css downloaded`,2200),l}let q=null;function V(s=!1){return q?(clearTimeout(q.timer),q=null,s||M("theme cycle cancelled"),!0):!1}function Te(s){let l=je();if(!Z||l.length<2)return;if(q){let g=q;clearTimeout(g.timer),q=null,g.dir===s?fe(g.name):M("theme cycle cancelled");return}let u=ge(),h=Math.max(0,l.indexOf(u)),f=l[(h+s+l.length)%l.length];if(te&&Be(f)!==Be(u)){let g=s>0?".":",",w=s>0?",":".";q={dir:s,name:f,timer:setTimeout(()=>{q=null},4e3)},M(`\u2933 ${we(Be(f))} pack next (${f}) \u2014 ${g} confirms \xB7 ${w} or Esc cancels`,4e3);return}fe(f)}e.has("embedded")&&window.addEventListener("message",s=>{let l=s.data&&s.data.__decklightPreview;!l||s.source!==window.parent||(l.gen?Xe(l.gen,!0):l.theme?fe(l.theme,!0):l.goto&&v.goto(l.goto[0],l.goto[1]??0))});let L="\0generate",$="pack:",ne="back",Y="all",U=null,Ne=0,He,me=[],$e=null,S="",O="packs";function j(s){let l=v.state,u="#/"+l.slide+"/"+l.step;if(s===L||W[s]||X&&s===X.name){let h=s===L?$e:W[s]?{name:s,tokens:W[s]}:X;return location.pathname+"?embedded&gen="+lt(h)+u}return location.pathname+"?embedded&theme="+encodeURIComponent(s)+u}function se(s){s.textContent=$e?`\u2728 ${$e.name} \u2014 \u2303T re-rolls`:"\u2728 Generate new\u2026"}function Ae(){$e=Ts();let s=me.indexOf(L);s<0||(se(U.querySelectorAll(".tp-row")[s]),Et(s,!0))}function Fe(){let s=U.querySelector(".tp-list"),l=ge(),u=je();if(S)me=u.filter(g=>g.includes(S));else if(!te||O==="all")me=te?[L,ne,...u]:[L,...u];else if(O==="packs")me=[L,...Me(u).map(([g])=>$+g),Y];else{let g=O.slice(5);me=[ne,...Me(u).find(([w])=>w===g)?.[1]??[]]}s.textContent="";let h=(g,w)=>{let b=document.createElement("span");b.className="tp-tag",b.textContent=w,g.appendChild(b)};if(me.forEach((g,w)=>{let b=document.createElement("div");if(b.setAttribute("role","option"),g===L)b.className="tp-row tp-gen",se(b);else if(g===ne)b.className="tp-row tp-back",b.textContent="\u2190 packs";else if(g===Y)b.className="tp-row tp-all",b.textContent="\u2733 all themes",h(b,String(u.length));else if(g.startsWith($)){let N=g.slice($.length),ee=Me(u).find(([Ke])=>Ke===N)?.[1]??[];b.className="tp-row tp-pack"+(ee.includes(l)?" tp-current":""),b.textContent=`\u25B8 ${we(N)}`,h(b,String(ee.length))}else{b.className="tp-row"+(g===l?" tp-current":""),b.textContent=g;let N=W[g]?"custom":X&&g===X.name?"generated":S&&te?we(Be(g)):null;N&&h(b,N)}b.addEventListener("mouseenter",()=>Et(w,!1)),b.addEventListener("click",()=>{Et(w,!0),ti()}),s.appendChild(b)}),!me.length){let g=document.createElement("div");g.className="tp-none",g.textContent="no themes match",s.appendChild(g)}let f=U.querySelector(".tp-filter");f.textContent=S||"type to filter\u2026",f.classList.toggle("tp-active",!!S)}function hn(){let s=ge(),l=me.indexOf(s);if(l>=0)return l;let u=me.indexOf($+Be(s));return u>=0?u:Math.min(1,me.length-1)}function qt(s,l=!1){O=s,Fe(),me.length&&Et(hn(),l)}function Ds(s){S=s.toLowerCase(),Fe(),me.length?Et(S?0:hn(),!1):U.querySelector(".tp-caption").textContent="no match"}function Ps(){if(U)return Mt();let s=je();if(!Z&&!s.length)return;S="",O=te?"packs":"all",U=document.createElement("div"),U.className="decklight-theme-picker",U.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Themes"></div></div><div class="tp-preview"><iframe title="Theme preview"></iframe><div class="tp-caption"></div></div></div>',Fe(),U.addEventListener("click",u=>{u.target===U&&Mt()}),p.appendChild(U);let l=ge();l&&Fn(U.querySelector("iframe"),l),Et(hn(),!l)}function Et(s,l){if(!me.length)return;Ne=(s+me.length)%me.length;let u=me[Ne];u===L&&!$e&&($e=Ts(),se(U.querySelectorAll(".tp-row")[Ne]));let h=U.querySelectorAll(".tp-row");h.forEach((b,N)=>b.classList.toggle("tp-selected",N===Ne)),h[Ne]?.scrollIntoView({block:"nearest"});let f=je(),g=u===L?$e?`\u2728 ${$e.name}`:"generate new":u===ne?"back to packs":u===Y?`all ${f.length} themes, flattened`:u.startsWith($)?`${we(u.slice($.length))} \xB7 ${Me(f).find(([b])=>b===u.slice($.length))?.[1].length??0} themes`:te?`${we(Be(u))} \xB7 ${u}`:u;if(U.querySelector(".tp-caption").textContent=g,clearTimeout(He),u!==L&&u.charCodeAt(0)===1)return;let w=U.querySelector("iframe");l?Fn(w,u):He=setTimeout(()=>Fn(w,u),60)}let Bs=!1,zn=null;function Wo(s){return s===L||W[s]||X&&s===X.name?{gen:s===L?$e:W[s]?{name:s,tokens:W[s]}:X}:{theme:s}}function Fn(s,l){if(!s.dataset.booted){s.dataset.booted="1",Bs=!1,s.addEventListener("load",()=>{if(Bs=!0,zn!==null&&U){let u=zn;zn=null,Fn(s,u)}},{once:!0}),s.src=j(l);return}if(!Bs){zn=l;return}s.contentWindow?.postMessage({__decklightPreview:Wo(l)},"*")}function ti(){let s=me[Ne];if(s!==void 0){if(s===L){$e&&Xe($e),Mt();return}if(s===ne){qt("packs");return}if(s===Y){qt("all");return}if(s.startsWith($)){qt("pack:"+s.slice($.length),!0);return}fe(s),Mt()}}function Mt(){clearTimeout(He),U?.remove(),U=null}let Ee=null,Lt=0,_t="",Qe=[],Us,Hs=!1,qn=null;function jo(){let s=v._sections.map((u,h)=>{let f=[...u.children].filter(N=>!N.matches("aside, script, style")),g=u.querySelector("h1, h2, h3"),w=f.map(N=>N.textContent).join(" ").replace(/\s+/g," ").trim(),b=(g?.textContent||"").replace(/\s+/g," ").trim()||w.slice(0,60)||`slide ${h+1}`;return{slide:h+1,title:b,haystack:w.toLowerCase()}}),l=(m?.modules??[]).map((u,h)=>({module:h,title:u.title,href:u.href,haystack:(u.title||"").toLowerCase()})).filter(u=>u.module!==_);return[...s,...l]}function ni(){let s=Ee.querySelector(".tp-list"),l=_t.split(/\s+/).filter(Boolean),u=[],h=[];for(let g of Ee.__index){let w=g.title.toLowerCase();l.every(b=>w.includes(b))?u.push(g):l.every(b=>g.haystack.includes(b))&&h.push(g)}if(Qe=[...u,...h],s.textContent="",Qe.forEach((g,w)=>{let b=document.createElement("div");b.className="tp-row"+(g.slide===v.state.slide?" tp-current":"")+(g.href?" tp-module":""),b.textContent=g.href?`\u25B8 ${g.title} \u2014 module`:`${g.slide} \xB7 ${g.title}`,b.addEventListener("mouseenter",()=>Gt(w,!1)),b.addEventListener("click",()=>{Gt(w,!0),si()}),s.appendChild(b)}),!Qe.length){let g=document.createElement("div");g.className="tp-none",g.textContent="no matches",s.appendChild(g)}let f=Ee.querySelector(".tp-filter");f.textContent=_t||(m?"type to find a slide or module\u2026":"type to find a slide\u2026"),f.classList.toggle("tp-active",!!_t)}function zs(s,l){let u=l.href??location.pathname,h=l.slide??1;if(s.dataset.doc!==u){s.dataset.doc=u,Hs=!1,s.addEventListener("load",()=>{if(Hs=!0,qn&&Ee){let b=qn;qn=null,zs(s,b)}},{once:!0});let f=ge(),g="#/"+h+"/0",w=W[f]?{name:f,tokens:W[f]}:X&&f===X.name?X:null;s.src=u+(w?"?embedded&gen="+lt(w):f?"?embedded&theme="+encodeURIComponent(f):"?embedded")+g;return}if(!Hs){qn=l;return}s.contentWindow?.postMessage({__decklightPreview:{goto:[h,0]}},"*")}function Gt(s,l){if(!Qe.length)return;Lt=(s+Qe.length)%Qe.length;let u=Ee.querySelectorAll(".tp-row");u.forEach((g,w)=>g.classList.toggle("tp-selected",w===Lt)),u[Lt]?.scrollIntoView({block:"nearest"});let h=Qe[Lt];Ee.querySelector(".tp-caption").textContent=h.href?`module \u2014 ${h.title} (${h.href})`:`slide ${h.slide} \u2014 ${h.title}`,clearTimeout(Us);let f=Ee.querySelector("iframe");l?zs(f,h):Us=setTimeout(()=>zs(f,h),60)}function fn(s){_t=s,ni(),Qe.length?Gt(0,!1):Ee.querySelector(".tp-caption").textContent="no match"}function si(){let s=Qe[Lt];if(gn(),!!s){if(s.href)return k(s.module);v.goto(s.slide,0)}}function Gn(){if(Ee)return gn();U&&Mt(),_t="",Ee=document.createElement("div"),Ee.className="decklight-theme-picker decklight-finder",Ee.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Slides"></div></div><div class="tp-preview"><iframe title="Slide preview"></iframe><div class="tp-caption"></div></div></div>',Ee.__index=jo(),ni(),Ee.addEventListener("click",s=>{s.target===Ee&&gn()}),p.appendChild(Ee),Gt(Math.max(0,Qe.findIndex(s=>s.slide===v.state.slide)),!0)}function gn(){clearTimeout(Us),Ee?.remove(),Ee=null}let qe=null,Kt=0,Oe="",Je=[];function Zo(){let s=u=>typeof u=="function";return[{label:"Find slide\u2026",hint:"G",alias:"search grep goto module chapter jump",run:()=>{Gn(),Oe&&fn(Oe)}},{label:"Go to slide\u2026",hint:"#",alias:"goto",keepOpen:!0,run:()=>{Oe="goto ",mn()}},{label:"Theme\u2026",hint:"T",run:Ps},{label:"Cycle theme",hint:", \xB7 .",run:()=>Te(1)},{label:"Generate a theme",hint:"\u2303T",run:T},X&&{label:"Save the generated theme\u2026",hint:"\u2303\u21E7T",run:()=>Q()},{label:"Font\u2026",hint:"[ \xB7 ]",run:Yo},{label:"Cycle slide layout (dev)",hint:"L",alias:"pin pinned centered top auto split columns two sides arrange",run:()=>Ks(1)},{label:"Undo deck edit (dev)",hint:"Z",alias:"revert back history",run:()=>pr("undo")},{label:"Redo deck edit (dev)",hint:"\u21E7Z",alias:"forward history repeat",run:()=>pr("redo")},{label:"Ask agent\u2026 (dev)",hint:"A",alias:"ai claude codex bob gemini prompt edit",run:Jt},{label:"Messages",hint:"`",alias:"log toast notifications warnings why voice stopped history",run:Yn},{label:`Narration ${be?"off":"on"}`,hint:"V",run:_n},{label:"Narration track\u2026",hint:"N",alias:"voice audio",run:()=>Rn("tracks")},{label:"Live voice\u2026",alias:"tts synthesize tone gemini",run:()=>Rn("voices")},{label:"Character\u2026",alias:"avatar lipsync face talking head visemes",run:()=>Rn("character")},{label:`Character solo ${oe.solo?"off":"on"}`,alias:"centre center stage narrator only fullscreen avatar",run:()=>Ui(!oe.solo)},{label:"Record offline narration\u2026",hint:"\u21E7V",alias:"export download batch wav tts",run:Xi},{label:"Voice faster",hint:">",alias:"speed rate playback",run:()=>Jn(.25)},{label:"Voice slower",hint:"<",alias:"speed rate playback",run:()=>Jn(-.25)},{label:"Speaker view",hint:"S",run:()=>{let u=v.__speakerWin;u&&!u.closed?u.__decklightSpeakerToggle?.():v.__speakerWin=Wr(v)}},{label:"Overview",hint:"O",run:Zt},{label:"Blackout",hint:"B",run:di},{label:"Debug log",hint:"D",alias:"console events state",run:pi},{label:`Captions ${ht?"off":"on"}`,hint:"C",alias:"cc subtitles closed caption",run:Ni},{label:`Clock ${ft?"off":"on"}`,hint:"K",alias:"time elapsed timer talk wall watch",run:cr},{label:`Progress bar ${mt?"off":"on"}`,hint:"H",alias:"bar bottom edge position how far through shape of the talk",run:dr},{label:"Transcript\u2026",alias:"notes script export text markdown spoken",run:xn},{label:`Narration ${tt?"resume":"pause"}`,hint:"P",alias:"pause resume voice",run:Si},{label:"Edit speaker notes\u2026",hint:"E",alias:"edit mode notes write",run:An},{label:"Fullscreen",hint:"F",run:()=>js()},{label:"Print view (all slides, new tab)",hint:"",run:()=>window.open(location.pathname+"?print")},{label:"First slide",hint:"Home",run:()=>v.goto(1,0)},{label:"Last slide",hint:"End",run:()=>v.goto(v.state.totalSlides,0)},{label:"Keyboard help",hint:"?",run:Ys}].filter(Boolean).filter(u=>s(u.run))}function mn(){let s=qe.querySelector(".narr-card");s.textContent="";let l=Oe.toLowerCase();Je=Zo().filter(f=>!l||(f.label+" "+(f.alias??"")).toLowerCase().includes(l));let u=Oe.trim().match(/^(?:goto\s*)?(\d+)$/i);if(u){let f=Math.max(1,Math.min(parseInt(u[1],10),v.state.totalSlides));Je.unshift({label:`Go to slide ${f} / ${v.state.totalSlides}`,hint:"\u23CE",run:()=>v.goto(f,0)})}l&&!u&&!Je.some(f=>f.label.toLowerCase().startsWith(l))&&Je.push({label:`Search slides for \u201C${Oe}\u201D`,hint:"",run:()=>{Gn(),fn(Oe)}});let h=document.createElement("div");if(h.className="pal-input"+(Oe?" tp-active":""),h.textContent=Oe||"type a command\u2026",s.appendChild(h),Je.forEach((f,g)=>{let w=document.createElement("div");w.className="narr-row pal-row";let b=document.createElement("span");if(b.textContent=f.label,w.appendChild(b),f.hint){let N=document.createElement("span");N.className="pal-kbd",N.textContent=f.hint,w.appendChild(N)}w.addEventListener("mouseenter",()=>bn(g)),w.addEventListener("click",()=>{bn(g),ri()}),s.appendChild(w)}),!Je.length){let f=document.createElement("div");f.className="tp-none",f.textContent="no matching command",s.appendChild(f)}bn(0)}function bn(s){Je.length&&(Kt=(s+Je.length)%Je.length,qe.querySelectorAll(".pal-row").forEach((l,u)=>l.classList.toggle("narr-sel",u===Kt)),qe.querySelectorAll(".pal-row")[Kt]?.scrollIntoView({block:"nearest"}))}function ri(){let s=Je[Kt];s&&(s.keepOpen||Kn(),s.run())}function Vo(){if(qe)return Kn();Ee&&gn(),Oe="",qe=document.createElement("div"),qe.className="decklight-narr decklight-palette",qe.innerHTML='<div class="narr-card" role="listbox" aria-label="Commands"></div>',qe.addEventListener("click",s=>{s.target===qe&&Kn()}),p.appendChild(qe),mn()}function Kn(){qe?.remove(),qe=null}let Ge=null,Wt=0;function Yo(){if(Ge)return yn();Ge=document.createElement("div"),Ge.className="decklight-narr decklight-font-picker",Ge.innerHTML='<div class="narr-card" role="listbox" aria-label="Fonts"></div>';let s=Ge.querySelector(".narr-card");ct.forEach(([l],u)=>{let h=document.createElement("div");h.className="narr-row"+(u===jt?" narr-cur":""),h.textContent=l,u>0&&(h.style.fontFamily=ct[u][1]),h.addEventListener("mouseenter",()=>Wn(u)),h.addEventListener("click",()=>{jn(u),yn()}),s.appendChild(h)}),Ge.addEventListener("click",l=>{l.target===Ge&&yn()}),p.appendChild(Ge),Wn(jt)}function Wn(s){Wt=(s+ct.length)%ct.length,Ge.querySelectorAll(".narr-row").forEach((l,u)=>l.classList.toggle("narr-sel",u===Wt)),Ge.querySelectorAll(".narr-row")[Wt]?.scrollIntoView({block:"nearest"})}function yn(){Ge?.remove(),Ge=null}{let s=e.get("gen"),l=!1;if(s)try{let u=Ue(s);u&&u.tokens&&(Xe({name:u.name||"gen-preview",tokens:u.tokens},!0),l=!0)}catch{}if(!l){let u=null;try{u=localStorage.getItem(K)}catch{}let h=e.get("theme")||u;h&&fe(h,!0)}}let ct=[["theme default",null],["system sans","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"],["rounded","ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, 'Arial Rounded MT Bold', Calibri, sans-serif"],["humanist","Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif"],["geometric","'Avenir Next', Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif"],["classical serif","'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif"],["transitional serif","Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif"],["slab serif","Rockwell, 'Rockwell Nova', 'Roboto Slab', 'DejaVu Serif', 'Sitka Small', serif"],["monospace","'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace"]],Fs="decklight-font:"+location.pathname,jt=0;function jn(s,{silent:l=!1,remeasure:u=!0}={}){jt=(s%ct.length+ct.length)%ct.length;let[h,f]=ct[jt];if(f?(p.style.setProperty("--font-body",f),p.style.setProperty("--font-heading",f)):(p.style.removeProperty("--font-body"),p.style.removeProperty("--font-heading")),!e.has("embedded"))try{f?localStorage.setItem(Fs,String(jt)):localStorage.removeItem(Fs)}catch{}u&&(Cs(v._sections,n),Ns(v._sections[v.state.slide-1],v.state.slide)),l||M(`font: ${h}`),d("font",h)}function qs(s){jn(jt+s)}try{let s=parseInt(localStorage.getItem(Fs),10);s>0&&s<ct.length&&jn(s,{silent:!0,remeasure:!1})}catch{}function Xo(s){if(!s)return null;if(s.startsWith("#")){let u=document.querySelector(s);if(!u)return null;let h=u.cloneNode(!0);return h.removeAttribute("id"),h.style.removeProperty("display"),h}if(s.trim().startsWith("<")){let u=document.createElement("div");return u.innerHTML=s,u.firstElementChild}let l=document.createElement("img");return l.src=s,l.alt="",l}let Ze=null;function Zn(){let s=getComputedStyle(p),l=f=>f?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),u=l(s.backgroundColor);(!u||u[4]!==void 0&&+u[4]==0)&&(u=l(s.backgroundImage));let h=u?on([+u[1],+u[2],+u[3]])<.5:!1;p.setAttribute("data-canvas",h?"dark":"light")}Zn(),F?.addEventListener("load",Zn);let ze=p.querySelector(":scope > .decklight-stage");if(!ze){for(ze=document.createElement("div"),ze.className="decklight-stage";p.firstChild;)ze.appendChild(p.firstChild);p.appendChild(ze)}if(ze.style.width=n.width+"px",ze.style.height=n.height+"px",n.logo&&(n.logo.src||n.logo.onLight||n.logo.onDark)){Ze=document.createElement("div"),Ze.className="decklight-logo",Ze.setAttribute("data-pos",n.logo.position||"bottom-left"),n.logo.height&&Ze.style.setProperty("--logo-h",n.logo.height+"px");for(let[s,l]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let u=Xo(n.logo[s]);if(!u)continue;let h=document.createElement("span");h.className=l,h.appendChild(u),Ze.appendChild(h)}p.appendChild(Ze)}function Qo(s){Ze&&s.forEach(l=>{if(!l.hasAttribute("data-logo")||l.querySelector(":scope > .decklight-hero-logo"))return;let u=document.createElement("div");u.className="decklight-hero-logo";let h=parseFloat(l.getAttribute("data-logo"));h&&u.style.setProperty("--hero-logo-h",h+"px"),u.innerHTML=Ze.innerHTML,l.prepend(u)})}Aa(ze),la(ze),Eo(ze,Pn);let Jo=["auto","centered","pinned","top","split","split-flip"],kn=null,Gs=null;function ii(){clearTimeout(Gs);let s=kn;kn=null,s&&fetch(Tn+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:s.slide,layout:s.name})}).then(l=>{if(!l.ok)throw new Error(l.status);d("layout",`slide ${s.slide}: ${s.name} \u2192 saved to file`)}).catch(()=>M("layout save failed \u2014 is the dev server still up?",2200))}function ai(s=v.state.slide){let l=v._sections[s-1];return l?Jo.filter(u=>(u!=="pinned"||Oo(l,n)===null)&&(u!=="split-flip"||Io(l).length>1)):[]}function Ks(s){if(!Sn){M("layout is a deck edit \u2014 it needs dev mode: decklight dev <deck.html>",2600);return}let l=v.state.slide,u=v._sections[l-1];if(!u)return;let h=ai(l),f=u.getAttribute("data-layout")||"auto",g=Math.max(0,h.indexOf(f)),w=h[(g+s+h.length)%h.length];w==="auto"?u.removeAttribute("data-layout"):u.setAttribute("data-layout",w),kn&&kn.slide!==l&&ii(),kn={slide:l,name:w},clearTimeout(Gs),Gs=setTimeout(ii,600),Cs(v._sections,n),Lo(v._sections),Ns(u,l),M(`layout: ${w}`),d("layout",`slide ${l}: ${w}`)}let v={root:p,stage:ze,config:n,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(s,l){return this._listeners.has(s)||this._listeners.set(s,new Set),this._listeners.get(s).add(l),this},_emit(s,l){(this._listeners.get(s)||[]).forEach(u=>u(l)),p.dispatchEvent(new CustomEvent("decklight:"+s,{detail:l}))},sync(){this._sections=[...ze.querySelectorAll(":scope > section")],this._sections.forEach((l,u)=>l.setAttribute("data-slide-index",String(u+1))),oa(ze,n.concepts),Qo(this._sections),Cs(this._sections,n),Lo(this._sections),this._records=this._sections.map(l=>xr(l)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let s=this._records[this.state.slide-1];s&&(this.state.step=Math.min(this.state.step,s.groups.length))},_rescanFor(s){let l=s.closest("section"),u=this._sections.indexOf(l);if(u!==-1){if(this._records[u]=xr(l),r){At(this._records[u],this._records[u].groups.length);return}u===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[u].groups.length),this._requestedStep=null,Ws(()=>At(this._records[u],this.state.step)),this._updateHash(!1)):Ws(()=>At(this._records[u],0)),this._notify()}},_stepLabels(s){let l=this._records[s];return l?ia(l):[]},next(){let s=this._records[this.state.slide-1];s&&this.state.step<s.groups.length?this.goto(this.state.slide,this.state.step+1,{direction:"fwd"}):this.state.slide<this.state.totalSlides?this.goto(this.state.slide+1,0,{direction:"fwd"}):y(1)},prev(){if(this.state.step>0)this.goto(this.state.slide,this.state.step-1,{direction:"back"});else if(this.state.slide>1){let s=this._records[this.state.slide-2];this.goto(this.state.slide-1,s.groups.length,{direction:"back"})}else y(-1)},goto(s,l=0,u={}){s=Math.max(1,Math.min(s,this.state.totalSlides));let h=this._records[s-1];this._requestedStep=l,l=Math.max(0,Math.min(l,h?h.groups.length:0));let f=s===this.state.slide;if(f&&l===this.state.step&&!u.force)return;let g=u.direction||(s>this.state.slide||f&&l>this.state.step?"fwd":"back");!f||u.force?(this._activateSlide(s,g,u),this.state.slide=s,this.state.step=l,Ws(()=>At(h,l)),this._emit("slide",{slide:s,total:this.state.totalSlides,direction:g}),requestAnimationFrame(()=>Ns(this._sections[s-1],s))):(this.state.step=l,At(h,l),this._emit("build",{slide:s,index:l,total:h.groups.length,direction:g})),this._updateChrome(),this._updateHash(!f),this._notify()},_activateSlide(s,l,u={}){let h=this._sections[this.state.slide-1],f=this._sections[s-1];if(p.classList.toggle("has-hero-logo",f?.hasAttribute("data-logo")??!1),h===f){f.classList.add("active");return}let g=!h||!h.classList.contains("active"),w=h&&f&&!g&&h.hasAttribute("data-auto-animate")&&f.hasAttribute("data-auto-animate")&&Math.abs(this._sections.indexOf(f)-this._sections.indexOf(h))===1;if(this._sections.forEach(Ke=>Ke.classList.remove("active","entering","leaving","dir-fwd","dir-back","tr-none","tr-fade","tr-slide","tr-scale","tr-flip")),f.classList.add("active"),g||r)return;if(w){h.classList.add("leaving"),h.style.visibility="hidden",f.style.visibility="hidden",f.offsetWidth,f.style.visibility="",da(h,f,this._scale),h.classList.remove("leaving"),h.style.visibility="";return}let b=f.getAttribute("data-transition")||this.config.transition;if(b==="none")return;let N="dir-"+l;f.classList.add("entering","tr-"+b,N),h.classList.add("leaving","tr-"+b,N,"active-out");let ee=parseFloat(getComputedStyle(f).getPropertyValue("--transition-duration"))*1e3||350;setTimeout(()=>{h.classList.remove("leaving","tr-"+b,N,"active-out"),f.classList.remove("entering","tr-"+b,N)},ee+60)},_updateChrome(){if(Vn){let s=this._records[this.state.slide-1],l=s?s.groups.length:0,u=this.state.totalSlides<=1?1:(this.state.slide-1+(l?this.state.step/(l+1):0))/(this.state.totalSlides-1);Vn.style.width=(Math.min(u,1)*100).toFixed(2)+"%"}if(dt){let s=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if(dt.textContent=s,A||m){let l=A?E():null,u=l?l[H(l)]?.title||"":m.modules[_]?.title||"",h=document.createElement("span");h.className="mod",h.textContent=u,dt.prepend(h)}}},_updateHash(s){if(!this.config.hash||r)return;let l=`#/${this.state.slide}/${this.state.step}`;"#"+oi(location.hash)!==l&&(Xs=!0,s?history.pushState(null,"",l):history.replaceState(null,"",l),setTimeout(()=>{Xs=!1}))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function Ws(s){p.classList.add("decklight-no-anim"),s(),p.offsetWidth,p.classList.remove("decklight-no-anim")}function oi(s){return(s||"").replace(/^#/,"")}function li(){let s=oi(location.hash).match(/^\/(\d+)(?:\/(\d+))?/);return s?{slide:parseInt(s[1],10),step:s[2]?parseInt(s[2],10):0}:null}let Vn=null,dt=null;if(n.controls&&!r){let s=document.createElement("div");s.className="decklight-controls",s.innerHTML=`
|
|
280
|
+
</svg>`;function Ic(r,a){let l=r?.cues;if(!l?.length||!(a>=0)||r.duration&&a>=r.duration)return"X";let d=0,u=l.length-1,h=-1;for(;d<=u;){let m=d+u>>1;l[m].t<=a?(h=m,d=m+1):u=m-1}if(h<0)return"X";let f=l[h].v;return Zr.includes(f)?f:"X"}function ci(r){let a=h=>Math.round(h*1e3)/1e3,l=[],d=(h,f)=>{l.length&&l[l.length-1].v===f||l.push({t:a(h),v:f})},u=0;for(let{timeline:h,gap:f=0}of r){f>0&&(d(u,"X"),u+=f);for(let m of h?.cues??[])d(u+m.t,m.v);u+=h?.duration??0}return{v:1,kind:"visemes",duration:a(u),source:"stitch",cues:l}}function di({root:r,config:a,debugLog:l,toast:d}){let u=a.narration?.character??{},h=u.bridgeUrl??"http://127.0.0.1:8789",f=u.fallback??"amplitude",m="decklight-character:"+location.pathname,b=u.mode??"off",k=u.engine??"wav2lip",S=u.portrait??"default",I=u.solo??!1;try{let Q=JSON.parse(localStorage.getItem(m));Q?.mode&&(b=Q.mode,k=Q.engine??k,S=Q.portrait??S),typeof Q?.solo=="boolean"&&(I=Q.solo)}catch{}let M=null,C=null,$=null,q=null,he=null,se=null,ce=null,U=0,me=!1,Te,$e=new Map,Re=new Map,be=Q=>`${Q}|${k}|${S}`;function Ce(){try{localStorage.setItem(m,JSON.stringify({mode:b,engine:k,portrait:S,solo:I}))}catch{}}function Xe(){r.classList.toggle("decklight-solo",I&&b!=="off"&&!!M?.classList.contains("show"))}function xe(){me||(me=!0,d("lipsync bridge unreachable \u2014 run: decklight lipsync"),l("lipsync","bridge unreachable \u2014 amplitude fallback"))}function E(){if(M||(M=document.createElement("div"),M.className="decklight-character pos-"+(u.position??"br"),M.setAttribute("aria-hidden","true"),u.size&&M.style.setProperty("--character-size",u.size+"px"),r.appendChild(M)),$!==b)if($=b,M.classList.toggle("mode-video",b==="video"),C=null,b==="video")M.innerHTML="",C=document.createElement("video"),C.muted=!0,C.playsInline=!0,C.preload="auto",M.appendChild(C);else if(u.sprites){M.innerHTML="";for(let Q of Zr){if(!u.sprites[Q])continue;let ye=document.createElement("img");ye.src=u.sprites[Q],ye.setAttribute("data-mouth",Q),ye.alt="",M.appendChild(ye)}}else if(typeof u.svg=="string"&&u.svg.startsWith("#")){M.innerHTML="";let Q=document.querySelector(u.svg);Q&&M.appendChild(Q.cloneNode(!0))}else typeof u.svg=="string"&&/^\s*</.test(u.svg)?M.innerHTML=u.svg:u.svg?(M.innerHTML=Xr,fetch(u.svg).then(Q=>Q.text()).then(Q=>{M&&$==="viseme"&&(M.innerHTML=Q)}).catch(()=>{})):M.innerHTML=Xr}function Ie(){E(),M.classList.add("show"),U||(U=setInterval(Ne,33)),Xe()}function qe(){U&&(clearInterval(U),U=0),M?.classList.remove("show"),C?.pause(),he=null,se=null,De("X"),Xe()}function De(Q){Q===ce||!M||(ce=Q,M.setAttribute("data-viseme",Q))}let F=null,J=null,H=null,fe=null;function Ee(){if(f!=="amplitude"||!q)return!1;if(H===q)return!!J;H=q;try{F??=new(window.AudioContext||window.webkitAudioContext);let Q=F.createMediaElementSource(q);J=F.createAnalyser(),J.fftSize=512,Q.connect(J),J.connect(F.destination),fe=new Uint8Array(J.fftSize)}catch{J=null}return!!J}function ze(){J.getByteTimeDomainData(fe);let Q=0;for(let x=0;x<fe.length;x++){let we=(fe[x]-128)/128;Q+=we*we}let ye=Math.sqrt(Q/fe.length);return ye<.02?"X":ye<.06?"B":ye<.12?"C":"D"}function Ne(){if(M?.classList.contains("show")){if(b==="video"){C&&q&&C.readyState>=2&&!q.paused&&Math.abs(C.currentTime-q.currentTime)>.15&&(C.currentTime=q.currentTime);return}if(!q||q.paused||q.ended){De("X");return}he?De(Ic(he,q.currentTime)):f==="hide"?De("X"):Ee()?De(ze()):De("X")}}function s(Q,ye,x){if(!$e.has(Q)){let we=(async()=>{let g=await ye;if(!g)return null;let j=Date.now(),B=await fetch(`${h}/viseme?text=${encodeURIComponent(x??"")}`,{method:"POST",headers:{"content-type":"audio/wav"},body:g.blob});if(!B.ok)throw new Error(String(B.status));let X=await B.json();return l("lipsync",`visemes ${Q} \xB7 ${X.cues?.length??0} cues \u2192 ${((Date.now()-j)/1e3).toFixed(1)}s`),X})();we.catch(()=>{$e.get(Q)===we&&$e.delete(Q)}),$e.set(Q,we)}return $e.get(Q)}function o(Q,ye){let x=be(Q);if(!Re.has(x)){let we=(async()=>{let g=await ye;if(!g)return null;let j=Date.now(),B=await fetch(`${h}/video?engine=${k}&portrait=${encodeURIComponent(S)}`,{method:"POST",headers:{"content-type":"audio/wav"},body:g.blob});if(!B.ok)throw new Error(String(B.status));let X=await B.blob(),Y=B.headers?.get?.("x-lipsync-cached")==="1";return l("lipsync",`video ${Q} \xB7 ${k} \u2192 ${((Date.now()-j)/1e3).toFixed(1)}s${Y?" (cached)":""}`),URL.createObjectURL(X)})();we.catch(()=>{Re.get(x)===we&&Re.delete(x)}),Re.set(x,we)}return Re.get(x)}function O(Q,ye,x){b==="viseme"?s(Q,ye,x).catch(()=>{}):b==="video"&&o(Q,ye).catch(()=>{})}function Be(Q,ye,x){b!=="off"&&(Ie(),se=Q,b==="viseme"?(he=null,s(Q,Promise.resolve(ye),x).then(we=>{se===Q&&(he=we)}).catch(()=>xe())):o(Q,Promise.resolve(ye)).then(we=>{se!==Q||!we||!C||(C.src=we,C.playbackRate=q?.playbackRate??1,q&&!q.paused&&(C.currentTime=q.currentTime,C.play().catch(()=>{})))}).catch(()=>xe()))}function P(Q,ye){if(b==="off"||!Q||Q.live)return;Ie();let x=String(ye).padStart(2,"0"),we=`file|${Q.dir}|${x}`;se=we,b==="viseme"?(he=null,(async()=>{let g=document.querySelector(`script[data-decklight-visemes="slide-${x}"]`);if(g)return JSON.parse(g.textContent);let j=await fetch(`${Q.dir}/slide-${x}.visemes.json`);if(!j.ok)throw new Error(String(j.status));return j.json()})().then(g=>{se===we&&(he=g)}).catch(()=>{})):C&&(C.src=`${Q.dir}/slide-${x}.mp4`,C.playbackRate=q?.playbackRate??1,C.play().catch(()=>{}))}function Ue(Q){!Q||q===Q||(q=Q,Q.addEventListener("pause",()=>{b==="video"&&C?.pause()}),Q.addEventListener("play",()=>{b==="video"&&C?.src&&C.play().catch(()=>{})}),Q.addEventListener("ratechange",()=>{C&&(C.playbackRate=Q.playbackRate)}))}async function nt(){try{let Q=await fetch(h+"/ping");Te=Q.ok?await Q.json():null}catch{Te=null}return Te}function W(Q,ye={}){b=Q,ye.engine&&(k=ye.engine),ye.portrait&&(S=ye.portrait),Ce(),b==="off"?qe():(me=!1,E(),I&&Ie()),Xe(),l("lipsync",b==="off"?"character off":`character ${b}${b==="video"?` \xB7 ${k} \xB7 ${S}`:""}`)}function Ae(Q){I=!!Q,Ce();let ye=!!q&&!q.paused&&!q.ended;I&&b!=="off"?Ie():!I&&!ye&&qe(),Xe(),l("lipsync",`character solo ${I?"on":"off"}`)}return{get mode(){return b},get engine(){return k},get portrait(){return S},get solo(){return I},get bridgeInfo(){return Te},setMode:W,setSolo:Ae,prefetchSentence:O,beginSentence:Be,beginSlide:P,attachAudio:Ue,stop:qe,probe:nt,ensureTimeline:s}}ae();le();function Bc(r){let a=String(r??"").replace(/[?#].*$/,"");return a.slice(0,a.lastIndexOf("/")+1)}var Pc=/^[a-z][a-z0-9+.-]*:|^\/\//i;function ui(r,a,l){let d=r?.slides?.[l-1];return d?d.url?d.url:d.file?Pc.test(d.file)?d.file:Bc(a)+d.file:null:null}function fr(r,a=Date.now()){let l=r?.expires;if(!l)return{at:null,msLeft:1/0,expired:!1};let d=new Date(l);if(Number.isNaN(d.getTime()))return{at:null,msLeft:1/0,expired:!1};let u=d.getTime()-a;return{at:d,msLeft:u,expired:u<=0}}function pi(r){if(!Number.isFinite(r))return"";if(r<=0)return"expired";let a=Math.floor(r/6e4),l=Math.floor(a/60),d=Math.floor(l/24);return d?`${d}d ${l%24}h left`:l?`${l}h ${a%60}m left`:`${Math.max(1,a)}m left`}var gr=r=>r.toISOString().slice(0,16).replace("T"," ")+"Z";function Yr(r){let a=r?.source??"<voice-dir>",l=r?.bucket??"gs://<bucket>/<prefix>",d=r?.signDuration??"7d";return`node tools/publish-voices.mjs ${a} --bucket ${l} --sign ${d}`}function Jr(r){return r?.manifest??r?.dir??null}function Dc({hasTracks:r,used:a,printMode:l,embedded:d,voiceover:u,captionsOn:h,narrating:f}={}){return!!r&&!a&&!l&&!d&&!u&&!h&&!f}function hi({root:r,stage:a,config:l,params:d,printMode:u,toast:h,logOnly:f,debugLog:m,overlays:b,instance:k,syncSoundBtn:S,updateDebugState:I,downloadFromUrl:M}){let C=0,$="decklight-narration:"+location.pathname,q=l.narration?.liveUrl??"http://127.0.0.1:8787/tts",he=[["Zephyr","bright"],["Puck","upbeat"],["Charon","informative"],["Kore","firm"],["Fenrir","excitable"],["Leda","youthful"],["Orus","firm"],["Aoede","breezy"],["Callirrhoe","easy-going"],["Autonoe","bright"],["Enceladus","breathy"],["Iapetus","clear"],["Umbriel","easy-going"],["Algieba","smooth"],["Despina","smooth"],["Erinome","clear"],["Algenib","gravelly"],["Rasalgethi","informative"],["Laomedeia","upbeat"],["Achernar","soft"],["Alnilam","firm"],["Schedar","even"],["Gacrux","mature"],["Pulcherrima","forward"],["Achird","friendly"],["Zubenelgenubi","casual"],["Vindemiatrix","gentle"],["Sadachbia","lively"],["Sadaltager","knowledgeable"],["Sulafat","warm"]],se=q.replace(/\/tts\/?$/,"/ping"),ce=he,U=!0,me=null,Te=null;function $e(){return Te??=fetch(se).then(T=>T.ok?T.json():null).then(T=>{if(!T)return null;if(me=T.engine??null,Array.isArray(T.voices)&&T.voices.length&&(ce=T.voices),U=T.stylable!==!1,m("tts",`bridge: ${T.engine} \xB7 ${T.model} \xB7 ${ce.length} voice(s)`+(U?"":" \xB7 no style")),ce.length&&!ce.some(([K])=>K===xe.voice)){let K=xe.voice;xe={...xe,voice:ce[0][0]},Me(),m("tts",`voice ${K} is not on this bridge \u2014 using ${xe.voice}`),E?.live&&h(`voice ${K} \u2192 ${xe.voice} (this bridge speaks its own roster)`,2600)}return T}).catch(()=>null),Te}let Re=[["Warm senior engineer","Read in a warm, welcoming tone, like a friendly battle-hardened senior engineer who is still curious about new technology.","warmly"],["Professional","Read in a clear, professional tone \u2014 measured, confident, and articulate.","professionally"],["Too serious","Read in an extremely grave, deadly serious tone, as if announcing news of the utmost importance.","serious"],["Joyful","Read in a joyful, light-hearted tone, smiling through every sentence.","joyfully"],["Super excited","Read in a super-excited, high-energy tone, barely containing your enthusiasm.","excited"],["Sad","Read in a somber, melancholic tone, on the verge of a sigh.","sad"]],be=([,T,K])=>me==="elevenlabs"?K:T,Ce=(()=>{let T=l.narration?.files;return T?Array.isArray(T)?T:[{label:"Narration",dir:T}]:[]})(),Xe={live:!0},xe={voice:"Alnilam",tone:Re[0][0],style:Re[0][1]},E=Ce[0]??null;try{let T=JSON.parse(localStorage.getItem($));if(T?.live?.voice)xe=T.live,E=Xe;else{let K=T?.track??T?.dir,w=Ce.find(_=>Jr(_)===K);w&&(E=w)}}catch{}let Ie=!1,qe=null,De="decklight-narr-rate:"+location.pathname,F=1;try{let T=parseFloat(localStorage.getItem(De)??"");T>=.25&&T<=2&&(F=T)}catch{}function J(T){F=Math.round(Math.min(2,Math.max(.25,F+T))*100)/100;try{localStorage.setItem(De,String(F))}catch{}qe&&(qe.playbackRate=F),h(`voice speed ${F}\xD7`),m("narr",`rate ${F}\xD7`),I()}let H=di({root:r,config:l,debugLog:m,toast:h}),fe=new Map;function Ee(T){return(k._sections?.[T-1]?.querySelector("aside.notes")?.textContent??"").replace(/⟨CLICK⟩/g," ").replace(/\s+/g," ").trim()}function ze(T){return(k._sections?.[T-1]?.querySelector("aside.notes")?.textContent??"").split("\u27E8CLICK\u27E9").map(w=>w.replace(/\s+/g," ").trim())}function Ne(T,K,w){if(!T)return Promise.resolve(null);if(!fe.has(K)){let _=(async()=>{let A=Date.now();try{let R=await fetch(q,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:T,voice:xe.voice,style:xe.style})});if(!R.ok)throw new Error(String(R.status));let Z=await R.blob(),ue=parseFloat(R.headers?.get?.("x-tts-cost")??"")||0;return ue&&(C+=ue),m("tts",`${w} \xB7 ${xe.voice} \xB7 ${T.length} chars \u2192 ${((Date.now()-A)/1e3).toFixed(1)}s`+(ue?` \xB7 ~$${ue.toFixed(4)}`:"")),{url:URL.createObjectURL(Z),blob:Z}}catch(R){throw m("tts",`${w} \xB7 ${xe.voice} FAILED after ${((Date.now()-A)/1e3).toFixed(1)}s (${String(R.message||R)})`),R}})();_.catch(()=>{fe.get(K)===_&&fe.delete(K)}),fe.set(K,_)}return fe.get(K)}function s(T){return((T??"").match(/[^.!?…]+[.!?…]+[”’"')\]]*|[^.!?…]+$/g)??[]).map(K=>K.trim()).filter(Boolean)}let o=(T,K,w)=>`${T}|s${K}|n${w}|${xe.voice}|${xe.style}`;function O(T,K,w){let _=s(ze(T)[K])[w]??"";return Ne(_,o(T,K,w),`slide ${T} seg ${K} #${w+1}`)}let Be=T=>k._sections[T-1]?.dataset.narration==="hold",P=10,Ue=3,nt=0;function W(T){let K=[],w=k.state.slide,_=k.state.step;for(;K.length<T&&w<=k.state.totalSlides;){let A=ze(w),R=k._records[w-1]?k._records[w-1].groups.length:0;for(;_<=R&&K.length<T;_++){let Z=s(A[_]).length;for(let ue=0;ue<Z&&K.length<T;ue++)K.push([w,_,ue])}w+=1,_=0}return K}async function Ae(){let T=++nt,K=async()=>{for(;T===nt&&Ie&&E?.live;){let w=W(P).find(([_,A,R])=>!fe.has(o(_,A,R)));if(!w)return;try{if(await O(w[0],w[1],w[2]),H.mode!=="off"){let[_,A,R]=w;H.prefetchSentence(o(_,A,R),fe.get(o(_,A,R)),s(ze(_)[A])[R]??"")}}catch{return}await new Promise(_=>setTimeout(_,30))}};await Promise.all(Array.from({length:Ue},K))}let Q=0,ye=!1,x=!1,we=0;function g(){if(!Ie){h("narration is off \u2014 V starts it");return}ye=!ye,ye?qe?.pause():qe?.src&&qe.paused&&!qe.ended&&qe.currentTime>0?qe.play().catch(()=>{}):x||B(),h(ye?"\u23F8 narration paused \u2014 P resumes":"\u25B6 narration resumed"),m("narr",ye?"paused":"resumed"),I()}function j(T,K){if(!Ie||ye||!E?.live||k.state.slide!==T||k.state.step!==K)return;let w=k._records[T-1];K<(w?w.groups.length:0)?k.next():!Be(T)&&T<k.state.totalSlides&&k.goto(T+1,0)}async function B(){let T=k.state.slide,K=k.state.step,w=++Q;if(Ae(),!Ee(T)){if(Be(T)){m("narr",`hold on slide ${T} \u2014 manual advance`);return}setTimeout(()=>{w!==Q||!Ie||!E?.live||k.state.slide===T&&T<k.state.totalSlides&&k.goto(T+1,0)},400);return}let _=ze(T);if(!_[K]){setTimeout(()=>{w===Q&&j(T,K)},600);return}let A=s(_[K]),R=()=>w!==Q||!Ie||k.state.slide!==T||k.state.step!==K;we=w,x=!0;let Z=0;try{for(let ue=0;ue<A.length;ue++){for(;ye;){if(R())return;await new Promise(bt=>setTimeout(bt,150))}if(R())return;let We;try{We=await O(T,K,ue)}catch(bt){m("narr",`sentence failed (slide ${T} seg ${K} #${ue+1}) \u2014 narration stopped`),Le(X(bt));return}if(R())return;if(!We)continue;_t(A[ue]),qe??=new Audio,H.mode!=="off"&&(H.attachAudio(qe),H.beginSentence(o(T,K,ue),We,A[ue])),qe.src=We.url,qe.playbackRate=F;let ot=!1;if(await new Promise(bt=>{qe.onended=bt,qe.play().catch(()=>{ot=!0,bt()})}),ot){Le("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}Z++}if(R())return;if(!Z&&A.length){Le("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}j(T,K)}finally{we===w&&(x=!1)}}function X(T){let K=String(T?.message??T);return K.startsWith("429")?"\u{1F507} voice quota exceeded (429) \u2014 auto-advance stopped \xB7 a free engine: decklight author --tts-engine chirp":/^\d{3}/.test(K)?`\u{1F507} voice bridge error ${K.slice(0,3)} \u2014 auto-advance stopped \xB7 press the key left of 1 for messages`:"\u{1F507} voice bridge unreachable \u2014 auto-advance stopped \xB7 start it with: decklight tts"}let Y=new Map,ge=new Map,V=new Set,ne=null;function Fe(T){for(let K of document.querySelectorAll('script[type="application/json"][data-decklight-voices]'))if(K.getAttribute("data-decklight-voices")===T)try{return JSON.parse(K.textContent)}catch{return null}return null}function Je(T){if(!Y.has(T)){let K=Fe(T);Y.set(T,K?Promise.resolve(K):fetch(T).then(w=>{if(!w.ok)throw new Error(`HTTP ${w.status}`);return w.json()}).catch(w=>{throw Y.delete(T),w})),Y.get(T).then(w=>ge.set(T,w)).catch(()=>{})}return Y.get(T)}function re(T){let K=ge.get(T.manifest);if(!K)return V.has(T.manifest)?"hosted \u2014 the voice list did not load":(Je(T.manifest).catch(()=>V.add(T.manifest)).then(()=>{G&&pe==="tracks"&&pt("tracks")}),"hosted \u2014 checking\u2026");let w=fr(K);return w.at?w.expired?`EXPIRED ${gr(w.at)} \u2014 re-sign to play`:`signed \xB7 ${pi(w.msLeft)}`:"hosted \xB7 no expiry"}async function ke(){if(!E||E.live||!E.manifest)return ne=null,!0;if(ne?.track!==E)try{ne={track:E,data:await Je(E.manifest)}}catch(K){return ne=null,Le(`\u{1F507} could not load the voice list for \u201C${E.label}\u201D (${E.manifest} \u2014 ${K.message}) \u2014 auto-advance stopped`),!1}let T=fr(ne.data);return T.expired?(Le(`\u{1F507} the signed voices for \u201C${E.label}\u201D expired ${gr(T.at)} \u2014 auto-advance stopped \xB7 re-sign: ${Yr(ne.data)}`),!1):!0}function He(T){return E.manifest?ui(ne?.data,E.manifest,T):`${E.dir}/slide-${String(T).padStart(2,"0")}.${E.ext??"m4a"}`}function _e(){if(!E)return;if(E.live)return B();if(!Ee(k.state.slide)){qe?.pause();return}let T=He(k.state.slide);if(!T){qe?.pause();return}qe??=new Audio,qe.src=T,qe.playbackRate=F,H.mode!=="off"&&(H.attachAudio(qe),H.beginSlide(E,k.state.slide)),qe.onerror=()=>{m("narr",`no audio: ${T}`);let K=E.manifest?fr(ne?.data):null;if(K?.at){m("narr","signed url failed \u2014 a media element cannot report the status"),Le(`\u{1F507} slide ${k.state.slide} of \u201C${E.label}\u201D would not load (signed until ${gr(K.at)}) \u2014 auto-advance stopped \xB7 re-sign: ${Yr(ne?.data)}`);return}h(`\u{1F507} no narration for slide ${k.state.slide} (${T}) \xB7 press the key left of 1 for messages`)},qe.play().catch(()=>{h("\u{1F507} the browser blocked audio \u2014 click the deck once, then V")})}function Le(T="narration off"){Ie=!1,Q++,nt++,ye=!1,qe?.pause(),H.stop(),h(T),m("narr",T),S()}async function Qe(){if(!E){rn(Ce.length?"tracks":"voices");return}if(Ie)return Le();if(st(),E.live&&await $e(),!await ke())return;Ie=!0;let T=E.live?`\u26A1 ${xe.voice} \xB7 ${xe.tone}`:E.label;h(`\u{1F50A} ${T} \u2014 V stops \xB7 N picks`),m("narr",`on \u2014 ${T}`),_e(),S()}k.on("slide",()=>{Ie&&_e()}),k.on("build",()=>{Ie&&E?.live&&B()});let Oe="decklight-captions:"+location.pathname,Ye=!1;try{Ye=localStorage.getItem(Oe)==="1"}catch{}let ct=null;function _t(T){ct&&(ct.textContent=T,ct.classList.toggle("show",!!T))}function Pt(){if(ct){if(Ie&&E?.live){_t("");return}_t(ze(k.state.slide)[k.state.step]??"")}}function Kt(){ct=document.createElement("div"),ct.className="decklight-captions",ct.setAttribute("aria-live","polite"),r.appendChild(ct),Pt()}function te(){Ye=!Ye;try{localStorage.setItem(Oe,Ye?"1":"0")}catch{}Ye?(Kt(),it()):(ct?.remove(),ct=null),h(`captions ${Ye?"on":"off"}`),m("narr",`captions ${Ye?"on":"off"}`)}k.on("slide",Pt),k.on("build",Pt),Ye&&!u&&Kt();let nn="\u{1F50A} this deck has a voice-over \u2014 V plays it",Dt=900,qt=12e3,Xt="decklight-narr-used:"+location.pathname,Ct=!1;try{Ct=localStorage.getItem(Xt)==="1"}catch{}let ft=null;function it(){if(!ft)return;let T=ft;ft=null,T.classList.remove("show"),setTimeout(()=>T.remove(),260)}function st(){if(it(),!Ct){Ct=!0;try{localStorage.setItem(Xt,"1")}catch{}}}function N(){let T=document.createElement("button");T.type="button",T.className="decklight-narr-hint",T.setAttribute("aria-label","Play this deck\u2019s voice-over");let K=document.createElement("kbd");K.textContent="V",T.append("\u{1F50A} this deck has a voice-over \u2014 ",K," plays it"),T.addEventListener("click",()=>{it(),Qe()}),ft=T,r.appendChild(T),T.offsetWidth,T.classList.add("show"),f?.(nn),m("narr","voice-over hint shown"),setTimeout(it,qt)}Dc({hasTracks:Ce.length>0,used:Ct,printMode:u,embedded:!!d?.has("embedded"),voiceover:!!d?.has("voiceover"),captionsOn:Ye})&&setTimeout(()=>{Ie||N()},Dt);let G=null,ie=0,pe="tracks",Pe=[],Se=null;function Me(){try{localStorage.setItem($,JSON.stringify(E?.live?{live:xe}:{track:Jr(E),dir:E?.dir}))}catch{}}function rt(T,K){xe={voice:Se??xe.voice,tone:T,style:K},E=Xe,Me(),wt(),Ie||(Ie=!0),h(`\u26A1 live voice: ${xe.voice} \xB7 ${xe.tone} \u2014 V stops`),m("narr",`live config \u2014 ${xe.voice} \xB7 ${xe.tone}`),_e()}function at(T){Pe.length&&(ie=jt(G.querySelectorAll(".narr-row"),T,"narr-sel",{scroll:!1}))}function Et(){Pe[ie]?.commit()}function Nt(){pe==="custom"?pt("tones"):pe==="tones"?pt("voices"):pe==="charvideo"?pt("character"):(pe==="voices"||pe==="character")&&Ce.length?pt("tracks"):wt()}let Yt=!1;function Rt(T,K){H.setMode(T,K),wt(),h(T==="off"?"character off":T==="viseme"?`\u{1F3AD} character on \u2014 lips follow the narration${Ie?"":" \xB7 V starts it"}`:`\u{1F3A5} character video \u2014 ${H.engine} \xB7 ${H.portrait}${Ie?"":" \xB7 V starts narration"}`)}function wn(T){if(H.mode==="off"){h("turn the character on first \u2014 N \xB7 Character\u2026");return}H.setSolo(T),wt(),h(T?"\u{1F3AD} solo \u2014 the narrator has the stage \xB7 N brings the slides back":"solo off \u2014 the slides are back")}let Ht="Hey, this is Decklight",It=Ht,dt=null,St=new Map,ut=new Map,Ot=null,Gt=new Set;function xn(T){if(T===Ht)return St;if(T!==Ot){for(let K of ut.values())K.then(w=>URL.revokeObjectURL(w)).catch(()=>{});ut=new Map,Ot=T}return ut}let Wt=(T,K)=>`${T}|${K||""}`;function L(T,K,w,_=""){let A=Wt(K,_);if(!T.has(A)){let R=(async()=>{let Z=Date.now(),ue=await fetch(q,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:w,voice:K,style:_})});if(!ue.ok)throw new Error(String(ue.status));let We=await ue.blob(),ot=parseFloat(ue.headers?.get?.("x-tts-cost")??"")||0;return ot&&(C+=ot),m("tts",`preview ${K}${_?" (styled)":""} \xB7 ${((Date.now()-Z)/1e3).toFixed(1)}s`+(ot?` \xB7 ~$${ot.toFixed(4)}`:"")),URL.createObjectURL(We)})();R.catch(()=>{T.get(A)===R&&T.delete(A)}),T.set(A,R)}return T.get(A)}async function vn(T,K,w){let _=`${w}|${T}`;if(Gt.has(_))return;Gt.add(_);let A=T===Ht,R=A?St:ut;try{m("narr",`preview prefetch ${w} (${A?"default":"custom"} sentence)`);for(let{voice:Z,style:ue}of K){if(!A&&Ot!==T)return;R.has(Wt(Z,ue))||await L(R,Z,T,ue).catch(()=>{})}m("narr",`preview prefetch ${w} complete`)}finally{Gt.delete(_)}}function Vt({voice:T,style:K="",prefetch:w},_){let A=It.trim();if(!A)return;let R=xn(A);_&&(_.textContent="\u2026"),L(R,T,A,K).then(Z=>{_?.isConnected&&(_.textContent="\u25B6"),dt??=new Audio,dt.src=Z,dt.play().catch(()=>{}),m("narr",`preview ${T}${K?" \xB7 styled":""}`),w==="voices"?vn(A,he.map(([ue])=>({voice:ue,style:""})),"voices"):w==="tones"&&vn(A,Re.map(ue=>({voice:T,style:be(ue)})),`tones:${T}`)}).catch(()=>{_?.isConnected&&(_.textContent="\u25B6"),h("live voice bridge unreachable \u2014 run: decklight tts"),m("narr",`preview ${T} failed`)})}function pt(T){pe=T;let K=G.querySelector(".narr-card");K.innerHTML="";let w=document.createElement("div");if(w.className="narr-head",K.appendChild(w),Pe=[],T==="tracks")w.textContent="narration",Ce.forEach(A=>Pe.push({text:A.manifest?`\u2601 ${A.label}`:`\u{1F50A} ${A.label} (${A.dir}/)`,flavor:A.manifest?re(A):"",cur:A===E,commit:()=>{E=A,Me(),wt(),h(`\u{1F50A} track: ${A.label}`),Ie&&ke().then(R=>{R&&_e()})}})),Pe.push({text:"\u26A1 Live voice \u2014 synthesize on the fly\u2026",cur:E?.live,commit:()=>pt("voices")}),Pe.push({text:"\u{1F9D1} Character \u2014 animated narrator\u2026",cur:H.mode!=="off",commit:()=>pt("character")});else if(T==="character"){w.textContent="character \u2014 an animated narrator lip-syncs the voice",Yt||(Yt=!0,H.probe().then(()=>{G&&pe==="character"&&pt("character")}));let A=H.bridgeInfo,R=A?.engines?.video??[];Pe.push({text:"Off",cur:H.mode==="off",commit:()=>Rt("off")}),Pe.push({text:"\u{1F3AD} 2D character \u2014 offline visemes",flavor:A?.engines?.viseme?"":"bridge offline \u2014 amplitude fallback",cur:H.mode==="viseme",commit:()=>Rt("viseme")}),Pe.push({text:`\u{1F3A5} Neural video \u2014 local GPU${R.length?"\u2026":""}`,flavor:R.length?"":"needs the bridge \u2014 run: decklight lipsync",cur:H.mode==="video",commit:()=>{R.length?pt("charvideo"):h("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),H.mode!=="off"&&Pe.push({text:`${H.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage`,flavor:"slide content steps aside",cur:H.solo,commit:()=>wn(!H.solo)})}else if(T==="charvideo"){w.textContent="neural video \u2014 pick engine \xB7 portrait";let A=H.bridgeInfo;for(let R of A?.engines?.video??[])for(let Z of A?.portraits?.length?A.portraits:["default"])Pe.push({text:`\u{1F3A5} ${R} \xB7 ${Z}`,cur:H.mode==="video"&&H.engine===R&&H.portrait===Z,commit:()=>Rt("video",{engine:R,portrait:Z})})}else if(T==="voices"){w.textContent="live voice \u2014 pick a voice \xB7 \u25B6 previews";let A=document.createElement("div");A.className="narr-preview-row";let R=document.createElement("input");R.className="narr-input narr-preview-text",R.value=It,R.placeholder="Preview sentence",R.setAttribute("aria-label","Preview sentence"),R.addEventListener("input",()=>{It=R.value}),R.addEventListener("keydown",ue=>{ue.key==="Escape"&&(Nt(),ue.preventDefault()),ue.stopPropagation()});let Z=document.createElement("button");Z.type="button",Z.className="narr-prev-btn narr-reset-btn",Z.textContent="\u21BA",Z.title="restore the default sentence",Z.setAttribute("aria-label","restore the default preview sentence"),Z.addEventListener("click",ue=>{ue.stopPropagation(),It=Ht,R.value=Ht}),A.append(R,Z),K.appendChild(A),ce.forEach(([ue,We])=>Pe.push({text:ue,flavor:We,preview:{voice:ue,style:"",prefetch:"voices"},cur:E?.live&&xe.voice===ue,commit:()=>{if(Se=ue,U)return pt("tones");rt(me??"plain","")}}))}else if(T==="tones")w.textContent=`live voice \xB7 ${Se??xe.voice} \u2014 pick a tone \xB7 \u25B6 previews`,Re.forEach(A=>{let[R]=A,Z=be(A);Pe.push({text:R,preview:{voice:Se??xe.voice,style:Z,prefetch:"tones"},cur:E?.live&&xe.tone===R,commit:()=>rt(R,Z)})}),Pe.push({text:"Custom\u2026",cur:E?.live&&xe.tone==="Custom",commit:()=>pt("custom")});else{w.textContent=`live voice \xB7 ${Se??xe.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let A=document.createElement("div");A.className="narr-preview-row";let R=document.createElement("input");R.className="narr-input",R.value=xe.style,R.placeholder="Read in a \u2026",R.addEventListener("keydown",ue=>{ue.key==="Enter"?(At(),ue.preventDefault()):ue.key==="Escape"&&(Nt(),ue.preventDefault()),ue.stopPropagation()});let Z=document.createElement("button");Z.type="button",Z.className="narr-prev-btn narr-reset-btn",Z.textContent="\u25B6",Z.title="preview this delivery instruction",Z.setAttribute("aria-label","preview this delivery instruction"),Z.addEventListener("click",ue=>{ue.stopPropagation();let We=R.value.trim();We&&Vt({voice:Se??xe.voice,style:We},Z)}),A.append(R,Z),K.appendChild(A),setTimeout(()=>{R.focus(),R.select()},0),Pe=[],ie=0;return}Pe.forEach((A,R)=>{let Z=document.createElement("div");Z.className="narr-row"+(A.cur?" narr-cur":"");let ue=document.createElement("span");if(ue.className="narr-row-label",ue.textContent=A.text,A.flavor){let We=document.createElement("span");We.className="narr-flavor",We.textContent=A.flavor,ue.appendChild(We)}if(Z.appendChild(ue),A.preview){let We=document.createElement("button");We.type="button",We.className="narr-prev-btn",We.textContent="\u25B6",We.title=`preview ${A.preview.voice}`,We.setAttribute("aria-label",`preview ${A.preview.voice}`),We.addEventListener("click",ot=>{ot.stopPropagation(),Vt(A.preview,We)}),Z.appendChild(We)}Z.addEventListener("mouseenter",()=>at(R)),Z.addEventListener("click",()=>{at(R),Et()}),K.appendChild(Z)});let _=Pe.findIndex(A=>A.cur);at(Math.max(0,_)),G.querySelector(".narr-sel")?.scrollIntoView({block:"nearest"})}function At(){let T=G?.querySelector(".narr-input")?.value.trim();T&&rt("Custom",T)}function rn(T){if(G&&T===void 0)return wt();G||(G=document.createElement("div"),G.className="decklight-narr",G.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',kt(G,wt),r.appendChild(G)),pt(T??(Ce.length?"tracks":"voices")),$e().then(K=>{K&&G&&pe==="voices"&&pt("voices")})}function wt(){G?.remove(),G=null,Yt=!1}let $t=null,Ft="confirm",Mt=0;function sn(){let T=[];for(let K=1;K<=k.state.totalSlides;K++)Ee(K)&&T.push(K);return T}function hn(T){let K=Math.round(T/1e3);return K<60?`${K}s`:`${Math.floor(K/60)}m${String(K%60).padStart(2,"0")}s`}function Lt(T,K={}){Ft=T;let w=$t.querySelector(".narr-card");if(T==="confirm"){let _=K.total;w.innerHTML=`<div class="narr-head">record offline narration</div>
|
|
281
|
+
<div class="rec-line">\u26A1 ${xe.voice} \xB7 ${xe.tone}</div>
|
|
282
|
+
<div class="rec-line">${_} slide${_===1?"":"s"} stitched from the sentence cache \u2014 only unheard sentences synthesize</div>
|
|
283
|
+
<div class="narr-row narr-sel">Start recording</div>
|
|
284
|
+
<div class="rec-hint">Enter to start \xB7 Esc to cancel</div>`,w.querySelector(".narr-row").addEventListener("click",an)}else if(T==="progress"){let{done:_,total:A,elapsedMs:R}=K,Z=A?Math.round(_/A*100):0,ue=_?hn(R/_*(A-_)):"\u2026";w.innerHTML=`<div class="narr-head">recording\u2026</div>
|
|
285
|
+
<div class="rec-bar"><div class="rec-bar-fill" style="width:${Z}%"></div></div>
|
|
286
|
+
<div class="rec-line">${_} / ${A} slides \xB7 ${hn(R)} elapsed \xB7 ~${ue} left</div>
|
|
287
|
+
<div class="rec-hint">Esc to cancel</div>`}else{let{saved:_,total:A,cancelled:R}=K;w.innerHTML=`<div class="narr-head">${R?"recording cancelled":"recording done"}</div>
|
|
288
|
+
<div class="rec-line">${_} / ${A} slide${A===1?"":"s"} saved as slide-NN.wav to your downloads</div>
|
|
289
|
+
<div class="rec-line">Point <code>narration.files</code> at that folder with <code>ext: 'wav'</code> to play them back without the bridge.</div>
|
|
290
|
+
<div class="rec-hint">Enter or Esc to close</div>`}}let zt=.15,Jt=.35;function on(T,K){let w=T.reduce((R,Z)=>R+Z.length,0),_=new DataView(new ArrayBuffer(44)),A=(R,Z)=>{for(let ue=0;ue<Z.length;ue++)_.setUint8(R+ue,Z.charCodeAt(ue))};return A(0,"RIFF"),_.setUint32(4,36+w,!0),A(8,"WAVE"),A(12,"fmt "),_.setUint32(16,16,!0),_.setUint16(20,1,!0),_.setUint16(22,1,!0),_.setUint32(24,K,!0),_.setUint32(28,K*2,!0),_.setUint16(32,2,!0),_.setUint16(34,16,!0),A(36,"data"),_.setUint32(40,w,!0),new Blob([_.buffer,...T],{type:"audio/wav"})}let Qt=(T,K)=>new Uint8Array(2*Math.round(T*K));async function Bt(T,K){let w=k._records[T-1],_=w?w.groups.length:0,A=ze(T),R=[],Z=24e3;for(let ue=0;ue<=_;ue++){let We=s(A[ue]);for(let ot=0;ot<We.length;ot++){let bt=await O(T,ue,ot);if(K!==Mt)return null;if(!bt)continue;let mn=await bt.blob.arrayBuffer();R.length===0?Z=new DataView(mn).getUint32(24,!0)||24e3:R.push(Qt(Z,ot===0?Jt:zt)),R.push(new Uint8Array(mn.slice(44)))}}return R.length?on(R,Z):null}async function xt(T,K){if(H.mode!=="viseme")return null;let w=k._records[T-1],_=w?w.groups.length:0,A=ze(T),R=[];try{for(let Z=0;Z<=_;Z++){let ue=s(A[Z]);for(let We=0;We<ue.length;We++){let ot=await H.ensureTimeline(o(T,Z,We),O(T,Z,We),ue[We]);if(K!==Mt)return null;ot&&R.push({timeline:ot,gap:R.length?We===0?Jt:zt:0})}}}catch{return m("lipsync",`slide ${T}: viseme sidecar skipped (bridge unreachable)`),null}return R.length?ci(R):null}async function an(){let T=sn(),K=++Mt,w=Date.now(),_=0,A=0;Lt("progress",{done:_,total:T.length,elapsedMs:0});for(let R of T){if(K!==Mt)return;try{let Z=await Bt(R,K);if(K!==Mt)return;if(Z){let ue=URL.createObjectURL(Z);M(ue,`slide-${String(R).padStart(2,"0")}.wav`),setTimeout(()=>URL.revokeObjectURL(ue),5e3),A++;let We=await xt(R,K);if(K!==Mt)return;if(We){let ot=URL.createObjectURL(new Blob([JSON.stringify(We)],{type:"application/json"}));M(ot,`slide-${String(R).padStart(2,"0")}.visemes.json`),setTimeout(()=>URL.revokeObjectURL(ot),5e3)}}}catch{h(`slide ${R}: recording failed`)}_++,K===Mt&&Lt("progress",{done:_,total:T.length,elapsedMs:Date.now()-w})}K===Mt&&Lt("done",{saved:A,total:T.length})}function kn(){if(!E?.live){h("live voice only \u2014 pick a voice with N first");return}$t||($t=document.createElement("div"),$t.className="decklight-narr decklight-record",$t.innerHTML='<div class="narr-card" role="dialog" aria-label="Record offline narration"></div>',kt($t,gt),r.appendChild($t),Lt("confirm",{total:sn().length}))}function gt(){Mt++,$t?.remove(),$t=null}return b.register({isOpen:()=>!!$t,close:gt,keydown(T){if(T.key==="Escape")gt();else if(T.key==="Enter")Ft==="confirm"?an():Ft!=="progress"&>();else return!1;return!0}}),b.register({isOpen:()=>!!G,close:wt,keydown(T){if(pe==="custom")return T.key==="Enter"?(At(),!0):T.key==="Escape"?(Nt(),!0):!1;switch(T.key){case"ArrowDown":at(ie+1);break;case"ArrowUp":at(ie-1);break;case"Enter":Et();break;case"Escape":Nt();break;case"n":case"N":wt();break;default:return!1}return!0}}),{character:H,toggleNarration:Qe,toggleNarrPause:g,changeNarrRate:J,toggleCaptions:te,openPicker:rn,openRecordDialog:kn,applySolo:wn,notesSegs:ze,status:()=>({narrating:Ie,paused:ye,rate:F,captionsOn:Ye,track:E,live:!!E?.live,voice:xe.voice,tone:xe.tone,hasTracks:Ce.length>0,spend:C})}}ae();le();function qc(r,a){let l=[];for(let d=0;d<r;d+=a){let u=[];for(let h=d;h<r&&h<d+a;h++)u.push(h);l.push(u)}return l}function mi(r,a,l){let d=r.ownerDocument,u=m=>{let b=d.createElement("div");return b.className=m,b},h=m=>{let b=u("print-slot"),k=u("decklight-stage print-slide");return k.appendChild(m),b.appendChild(k),b};if(l==="handout")for(let m of qc(a.length,3)){let b=u("print-page print-handout");for(let k of m){let S=u("print-row");S.appendChild(h(a[k])),S.appendChild(u("print-notelines")),b.appendChild(S)}r.appendChild(b)}else a.forEach(m=>{let b=u("print-page print-notes-page"),k=u("print-notes"),S=m.querySelector("aside.notes");S&&(k.innerHTML=S.innerHTML),b.appendChild(h(m)),b.appendChild(k),r.appendChild(b)});let f=d.createElement("style");f.textContent="@media print { @page { size: 816px 1056px; margin: 0; } html, body { margin: 0; padding: 0; } }",d.head.appendChild(f)}ae();le();ae();le();function Fc(r,a,l,d){let u=d||1;return{x:(r-l.left)/u,y:(a-l.top)/u}}function zc(r,a,l=300){return r.filter(d=>a-d.t<l)}function fi(r,a){let l=a.querySelector(":scope > .decklight-stage"),d=null,u=null,h=null,f=[],m=null,b=[],k=null,S=0,I=()=>getComputedStyle(a).getPropertyValue("--accent").trim()||"#fff",M=be=>Fc(be.clientX,be.clientY,l.getBoundingClientRect(),r._scale);function C(){if(!u)return;let be=window.devicePixelRatio||1,Ce=a.getBoundingClientRect(),Xe=l.getBoundingClientRect(),xe=r._scale||1;u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d.width,d.height),u.setTransform(be*xe,0,0,be*xe,(Xe.left-Ce.left)*be,(Xe.top-Ce.top)*be),u.lineCap=u.lineJoin="round",u.lineWidth=3.5;for(let E of m?[...f,m]:f)if(E.points.length){u.strokeStyle=E.color,u.beginPath(),u.moveTo(E.points[0].x,E.points[0].y);for(let Ie of E.points)u.lineTo(Ie.x,Ie.y);u.stroke()}if(h==="laser"&&k){let E=I(),Ie=performance.now();u.fillStyle=E;for(let qe of b){let De=1-(Ie-qe.t)/300;u.globalAlpha=De*.4,u.beginPath(),u.arc(qe.x,qe.y,3+4*De,0,Math.PI*2),u.fill()}u.globalAlpha=1,u.shadowColor=E,u.shadowBlur=22,u.beginPath(),u.arc(k.x,k.y,7,0,Math.PI*2),u.fill(),u.shadowBlur=0}}function $(){S=0,b=zc(b,performance.now()),C(),b.length&&(S=requestAnimationFrame($))}let q=()=>{S||(S=requestAnimationFrame($))};function he(be){if(!(h!=="pen"||be.button>0)){try{d.setPointerCapture(be.pointerId)}catch{}m={color:I(),points:[M(be)]},C(),be.preventDefault()}}function se(be){h==="pen"&&m?(m.points.push(M(be)),C()):h==="laser"&&(k=M(be),b.push({...k,t:performance.now()}),q())}function ce(){m&&(f.push(m),m=null)}function U(){let be=a.getBoundingClientRect(),Ce=window.devicePixelRatio||1;d.width=Math.max(1,Math.round(be.width*Ce)),d.height=Math.max(1,Math.round(be.height*Ce)),C()}function me(){d||(d=document.createElement("canvas"),d.className="decklight-annotate",d.setAttribute("aria-hidden","true"),a.appendChild(d),u=d.getContext("2d"),d.addEventListener("pointerdown",he),d.addEventListener("pointermove",se),d.addEventListener("pointerup",ce),d.addEventListener("pointercancel",ce),d.addEventListener("touchstart",be=>be.stopPropagation(),{passive:!0}),U(),new ResizeObserver(()=>{U(),requestAnimationFrame(C)}).observe(a))}function Te(be="pen"){return h=h===be?null:be,h&&me(),d&&(d.classList.toggle("tool-pen",h==="pen"),d.classList.toggle("tool-laser",h==="laser")),m&&(f.push(m),m=null),h!=="laser"&&(b=[],k=null,u&&C()),h}function $e(){f=[],m=null,b=[],k=null,u&&C()}function Re(be){me(),f.push({color:I(),points:be.map(Ce=>({x:Ce.x,y:Ce.y}))}),C()}return r.on("slide",$e),{toggle:Te,laser:()=>Te("laser"),clear:$e,stroke:Re,get tool(){return h},get active(){return h!==null}}}function gi({root:r,printMode:a,toast:l,debugLog:d,overlays:u,instance:h,narration:f,downloadFromUrl:m,setProgressBar:b}){let k="decklight-clock:"+location.pathname,S=!1;try{S=localStorage.getItem(k)==="1"}catch{}let I=null,M=null,C=null,$=!1,q=J=>String(J).padStart(2,"0");function he(J){let H=Math.floor(J/1e3),fe=Math.floor(H/3600);return(fe?fe+":":"")+q(Math.floor(H/60)%60)+":"+q(H%60)}function se(){if(!I)return;let J=new Date;I.querySelector(".clk-time").textContent=q(J.getHours())+":"+q(J.getMinutes()),I.querySelector(".clk-elapsed").textContent="+"+he(C==null?0:Date.now()-C)}function ce(){I=document.createElement("div"),I.className="decklight-clock",I.innerHTML='<span class="clk-time"></span><span class="clk-elapsed"></span>',r.appendChild(I),se(),M=setInterval(se,1e3)}function U(){S=!S;try{localStorage.setItem(k,S?"1":"0")}catch{}S?ce():(clearInterval(M),M=null,I?.remove(),I=null),l(`clock ${S?"on":"off"}`),d("nav",`clock ${S?"on":"off"}`)}h.on("ready",()=>{$=!0});let me=()=>{!$||C!=null||(C=Date.now(),se())};h.on("slide",me),h.on("build",me),h.toggleClock=U,S&&!a&&ce();let Te="decklight-progress:"+location.pathname,$e=!1;try{$e=localStorage.getItem(Te)==="1"}catch{}let Re=null;function be(){Re=document.createElement("div"),Re.className="decklight-progress",Re.innerHTML='<div class="bar"></div>',r.appendChild(Re),b(Re.querySelector(".bar")),h._updateChrome()}function Ce(){$e=!$e;try{localStorage.setItem(Te,$e?"1":"0")}catch{}$e?be():(Re?.remove(),Re=null,b(null)),l(`progress bar ${$e?"on":"off"}`),d("nav",`progress bar ${$e?"on":"off"}`)}h.toggleProgress=Ce,$e&&!a&&be();let Xe=null;a||(Xe=fi(h,r),h.annotate=Xe);function xe(J){if(!Xe)return;let H=J==="laser"?Xe.laser():Xe.toggle();l(H==="pen"?"pen on \u2014 drag to draw \xB7 \u232B clears \xB7 W off":H==="laser"?"laser on \u2014 \u21E7W off":"ink off"),d("nav",`ink ${H??"off"}`)}function E(){return(h._sections||[]).map((J,H)=>({n:H+1,title:J.querySelector("h1, h2, h3")?.textContent.trim()||`Slide ${H+1}`,segs:f.notesSegs(H+1).filter(Boolean)}))}function Ie(J){let H=(document.title||"Deck").trim(),fe=J?[`# ${H} \u2014 transcript`,""]:[`${H} \u2014 transcript`,""];for(let{n:Ee,title:ze,segs:Ne}of E())if(Ne.length){fe.push(J?`## ${Ee}. ${ze}`:`${Ee}. ${ze}`,"");for(let s of Ne)fe.push(s,"")}return fe.join(`
|
|
291
|
+
`)}function qe(J){let H=J==="md",fe=URL.createObjectURL(new Blob([Ie(H)],{type:H?"text/markdown":"text/plain"})),Ee=(location.pathname.split("/").pop()||"deck").replace(/\.html?$/i,"");m(fe,`${Ee}-transcript.${H?"md":"txt"}`),setTimeout(()=>URL.revokeObjectURL(fe),5e3),d("narr",`transcript exported (.${H?"md":"txt"})`)}let De=null;function F(){if(De){De.remove(),De=null;return}De=document.createElement("div"),De.className="decklight-narr decklight-transcript";let J=document.createElement("div");J.className="narr-card";let H=document.createElement("div");H.className="narr-head",H.textContent="transcript \u2014 the deck\u2019s spoken notes \xB7 Esc closes";let fe=document.createElement("div");fe.className="tr-actions";for(let[Ee,ze]of[["\u2B07 export .txt","txt"],["\u2B07 export .md","md"]]){let Ne=document.createElement("button");Ne.type="button",Ne.className="narr-prev-btn",Ne.textContent=Ee,Ne.addEventListener("click",()=>qe(ze)),fe.appendChild(Ne)}J.append(H,fe);for(let{n:Ee,title:ze,segs:Ne}of E()){if(!Ne.length)continue;let s=document.createElement("div");s.className="tr-slide";let o=document.createElement("div");o.className="tr-title",o.textContent=`${Ee} \xB7 ${ze}`,o.title="jump to this slide",o.addEventListener("click",()=>{F(),h.goto(Ee,0,{force:!0})}),s.appendChild(o);for(let O of Ne){let Be=document.createElement("p");Be.className="tr-seg",Be.textContent=O,s.appendChild(Be)}J.appendChild(s)}De.appendChild(J),kt(De,F),r.appendChild(De)}return h.transcript={open:F,text:()=>Ie(!1),markdown:()=>Ie(!0)},u.register({isOpen:()=>!!De,close:F,keydown:J=>J.key==="Escape"&&(F(),!0)}),{toggleClock:U,toggleProgress:Ce,toggleInk:xe,toggleTranscript:F,get annotator(){return Xe},status:()=>({clockOn:S,progressOn:$e})}}ae();le();var Uc=["data-background-image","data-background-video","data-background-poster","data-background-size","data-background-position","data-background-dim"];function Hc(r){let a=r["data-background-image"]||null,l=r["data-background-video"]||null;if(!a&&!l)return null;let d=parseFloat(r["data-background-dim"]);return{image:a,video:l,poster:r["data-background-poster"]||null,size:r["data-background-size"]==="contain"?"contain":"cover",position:r["data-background-position"]||"center",dim:Number.isFinite(d)?Math.min(Math.max(d,0),1):0}}var Gc=r=>`url("${String(r).replace(/["\\]/g,"\\$&")}")`;function jc(r){let a={};for(let l of Uc){let d=r.getAttribute(l);d!==null&&(a[l]=d)}return a}function bi(r,{printMode:a=!1}={}){r.forEach(l=>{let d=Hc(jc(l)),u=l.querySelector(":scope > .slide-bg");if(!d){u?.remove();return}let h=JSON.stringify(d)+(a?"\xB7print":"");if(u&&u.dataset.sig===h){u!==l.firstElementChild&&l.prepend(u);return}u||(u=document.createElement("div"),u.className="slide-bg",u.setAttribute("aria-hidden","true")),u.dataset.sig=h,u.textContent="",u.style.backgroundSize=d.size,u.style.backgroundPosition=d.position;let f=d.image||(a?d.poster:null);if(u.style.backgroundImage=f?Gc(f):"",d.video&&!a){let m=document.createElement("video");m.muted=!0,m.loop=!0,m.setAttribute("muted",""),m.setAttribute("loop",""),m.setAttribute("playsinline",""),m.preload="auto",d.poster&&(m.poster=d.poster),m.style.objectFit=d.size,m.style.objectPosition=d.position,m.src=d.video,u.appendChild(m)}if(d.dim>0){let m=document.createElement("div");m.className="slide-bg-dim",m.style.opacity=String(d.dim),u.appendChild(m)}l.prepend(u)})}ae();le();ae();le();var Kc="npx decklight author";function Wc(r){let a=r||"";try{a=decodeURIComponent(a)}catch{}/^\/[A-Za-z]:/.test(a)&&(a=a.slice(1));let l=a.lastIndexOf("/");return{dir:l>0?a.slice(0,l):"",file:l>=0?a.slice(l+1):a}}function tn(r,a={}){let{protocol:l="",pathname:d=""}=a,{dir:u,file:h}=Wc(d),f=/\.html?$/i.test(h)?h:"<deck.html>",m=l==="file:"&&u?`from ${u}, `:"";return`${r} needs author mode: ${m}run ${Kc} ${f}, then reopen the URL it prints`}function yi({root:r,config:a,params:l,printMode:d,toast:u,debugLog:h,overlays:f,instance:m,notesSegs:b,dismissOthers:k}){let S=!1,I="",M=[],C=null,$=[],q=null;if(!d&&!l.has("embedded")){let g=a.edit?.url?[a.edit.url]:/^https?:$/.test(location.protocol)?[""]:["http://127.0.0.1:8788"];(async()=>{for(let j of g)try{let B=await fetch(j+"/edit/ping");if(!B.ok)continue;let X=await B.json();if(!X?.ok)continue;let Y=decodeURIComponent(location.pathname.split("/").pop()||"");if(Y&&X.name&&Y!==X.name){h("edit",`server edits ${X.name}, this deck is ${Y} \u2014 not wiring up`);continue}I=j,S=!0,M=Array.isArray(X.agents)?X.agents:[],C=typeof X.preferredAgent=="string"?X.preferredAgent:null,$=Array.isArray(X.wizards)?X.wizards:[],q=X.agentBusy||null,q&&u(`${q.agent} is editing the deck\u2026`,2e3);let ge=new EventSource(j+"/edit/events");ge.onmessage=()=>location.reload(),ge.addEventListener("agent",V=>{try{let ne=JSON.parse(V.data);if(ne.state==="start")q=ne,u(`\u{1F916} ${ne.agent} is editing the deck\u2026`,2200),h("agent",`${ne.agent} start: ${(ne.prompt||"").slice(0,80)}`);else if(ne.state==="done"){q=null;let Fe=ne.ok?"":ne.error?` \u2014 ${ne.error}`:` (exit ${ne.code})`;u(ne.changed?`\u{1F916} ${ne.agent} edited the deck \u2014 Z undoes${Fe}`:`\u{1F916} ${ne.agent} finished \u2014 no changes${Fe}`,3e3),h("agent",`${ne.agent} done ok=${ne.ok} changed=${ne.changed}${Fe}`)}}catch{}}),h("edit",`live reload connected${j?` (${j})`:""}`+(M.length?` \xB7 agents: ${M.map(V=>V.name).join(", ")}`:""));return}catch{}await he()})()}async function he(){let g=/^https?:$/.test(location.protocol)?"":"http://127.0.0.1:8790";try{let j=await fetch(g+"/present/ping");if(!j.ok)return;let B=await j.json();if(!B?.ok||!B.present)return;let X=decodeURIComponent(location.pathname.split("/").pop()||"");if(X&&B.name&&X!==B.name){h("present",`server presents ${B.name}, this deck is ${X} \u2014 not wiring up`);return}m.__remoteQr=B.remote?`${g||location.origin}/remote/qr.svg`:null,new EventSource(g+"/present/events").addEventListener("remote",V=>{try{let{key:ne}=JSON.parse(V.data);ne==="next"?m.next():ne==="prev"&&m.prev()}catch{}});let ge=()=>{fetch(g+"/remote/pos",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({i:m.state.slide,n:m.state.totalSlides})}).catch(()=>{})};m.on("slide",ge),m.on("build",ge),ge(),h("present",`remote connected${g?` (${g})`:""} \u2014 no edit surface`)}catch{}}async function se(g){if(!S){u(tn(g,location),3200);return}try{let j=await fetch(I+"/edit/"+g,{method:"POST"}),B=await j.json().catch(()=>({}));if(!j.ok){u(B.error||`${g} failed`);return}u(`${g} \u2014 ${B.undo} back \xB7 ${B.redo} forward`),h("edit",`${g} \u2192 ${B.undo} back, ${B.redo} forward`)}catch{u(`${g} failed \u2014 is the dev server still up?`,2200)}}let ce=null;function U(){if(ce){ce.remove(),ce=null;return}if(!S){u(tn("asking an agent",location),3200);return}if(!M.length){u("no agent CLI detected on the dev machine (claude, codex, bob, \u2026)",2600);return}if(q){u(`${q.agent} is still working on the last ask`,2200);return}ce=document.createElement("div"),ce.className="decklight-narr decklight-editor";let g=document.createElement("div");g.className="narr-card";let j=document.createElement("div");j.className="narr-head",j.textContent="ask an agent \u2014 edits the deck file \xB7 \u2318\u23CE sends \xB7 Esc closes";let B=document.createElement("textarea");B.className="narr-input edit-notes",B.placeholder=`e.g. "make slide ${m.state.slide} a split layout with the diagram on the left"`,B.spellcheck=!1;let X=C&&M.some(ne=>ne.name===C)?C:M[0].name,Y=document.createElement("div");if(Y.className="tr-actions",M.length>1){let ne=document.createElement("select");ne.className="narr-prev-btn";for(let Fe of M){let Je=document.createElement("option");Je.value=Fe.name,Je.textContent=Fe.label,ne.appendChild(Je)}ne.value=X,ne.addEventListener("change",()=>{X=ne.value,C=ne.value,fetch(I+"/edit/agent/prefer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:ne.value})}).catch(()=>{}),h("agent",`preferred agent \u2192 ${ne.value}`)}),ne.addEventListener("keydown",Fe=>Fe.stopPropagation()),Y.appendChild(ne)}let ge=async()=>{let ne=B.value.trim();if(ne)try{let Fe=await fetch(I+"/edit/agent",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({prompt:ne,agent:X})}),Je=await Fe.json().catch(()=>({}));if(!Fe.ok)throw new Error(Je.error||Fe.status);U()}catch(Fe){u(`ask failed: ${String(Fe.message||Fe).slice(0,60)}`,2200)}};B.addEventListener("keydown",ne=>{ne.key==="Enter"&&(ne.metaKey||ne.ctrlKey)?(ge(),ne.preventDefault()):ne.key==="Escape"&&(U(),ne.preventDefault()),ne.stopPropagation()});let V=document.createElement("button");V.type="button",V.className="narr-prev-btn",V.textContent="\u{1F916} send to agent",V.addEventListener("click",ge),Y.appendChild(V),g.append(j,B,Y),ce.appendChild(g),kt(ce,U),r.appendChild(ce),setTimeout(()=>B.focus(),0)}let me=null;function Te(){if(me){me.remove(),me=null;return}let g=m.state.slide;if(!S){u(tn("editing notes",location),3200);return}me=document.createElement("div"),me.className="decklight-narr decklight-editor";let j=document.createElement("div");j.className="narr-card";let B=document.createElement("div");B.className="narr-head",B.textContent=`edit notes \u2014 slide ${g} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let X=document.createElement("textarea");X.className="narr-input edit-notes",X.value=b(g).filter((ne,Fe,Je)=>ne||Fe<Je.length).join(`
|
|
292
|
+
|
|
293
|
+
\u27E8CLICK\u27E9
|
|
294
|
+
|
|
295
|
+
`),X.spellcheck=!1;let Y=async()=>{try{let ne=await fetch(I+"/edit/notes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,text:X.value})});if(!ne.ok)throw new Error(await ne.text());h("edit",`notes saved \u2014 slide ${g}`),u("notes saved \u2014 reloading")}catch(ne){u(`save failed: ${String(ne.message||ne).slice(0,60)}`)}};X.addEventListener("keydown",ne=>{ne.key==="Enter"&&(ne.metaKey||ne.ctrlKey)?(Y(),ne.preventDefault()):ne.key==="Escape"&&(Te(),ne.preventDefault()),ne.stopPropagation()});let ge=document.createElement("div");ge.className="tr-actions";let V=document.createElement("button");V.type="button",V.className="narr-prev-btn",V.textContent="\u{1F4BE} save to file",V.addEventListener("click",Y),ge.appendChild(V),j.append(B,X,ge),me.appendChild(j),kt(me,Te),r.appendChild(me),setTimeout(()=>X.focus(),0)}let $e=["fade","fade-up","fade-down","zoom","pop","draw","highlight"],Re=!1,be=null,Ce=[],Xe=0,xe="main",E=null;function Ie(){if(!S){u(tn("editing an element",location),3200);return}Re=!Re,De(),u(Re?"element edit mode on \u2014 right-click a slide element":"element edit mode off",2200)}function qe(g,j){let B=j;for(;B&&B!==g&&B.parentElement!==g;)B=B.parentElement;return B&&B!==g?B:null}r.addEventListener("contextmenu",g=>{if(!Re)return;let j=g.target.closest("section"),B=j?m._sections.indexOf(j)+1:0;if(!j||!B)return;if(g.preventDefault(),j.hasAttribute("data-markdown-removed")){u("this slide has no per-element source mapping (data-markdown, removed in 0.3.0) \u2014 edit the file directly",3400);return}let X=qe(j,g.target),Y=X?[...j.children].indexOf(X):null;k?.(),H(g.clientX,g.clientY,{sec:j,slide:B,index:Y})});function De(){be?.remove(),be=null,xe="main"}function F(){let g=be.querySelector(".cm-list");g.textContent="";let j=[];if(xe==="effects"){j.push({label:"\u2190 back",back:!0,run:()=>{xe="main",F()}});for(let B of $e)j.push({label:B,run:()=>Ee(B)});j.push({label:"none (instant)",run:()=>Ee("none")}),j.push({label:"remove effect",run:()=>Ee(null)})}else E.index===null?j.push({label:"Edit speaker notes",run:()=>{De(),Te()}}):(j.push({label:"Edit speaker notes",run:()=>{De(),Te()}}),j.push({label:"Remove element",run:fe}),j.push({label:"Edit content (HTML)",run:()=>{De(),s(E)}}),j.push({label:"Add text effect \u25B8",run:()=>{xe="effects",F()}}));Ce=j,j.forEach((B,X)=>{let Y=document.createElement("div");Y.className="cm-row"+(B.back?" cm-back":""),Y.setAttribute("role","option"),Y.textContent=B.label,Y.addEventListener("mouseenter",()=>J(X,!1)),Y.addEventListener("click",B.run),g.appendChild(Y)}),J(0,!1)}function J(g,j){let B=be.querySelectorAll(".cm-row");B.length&&(Xe=jt(B,g,"cm-selected",{scroll:j}))}function H(g,j,B){E=B,xe="main",be=document.createElement("div"),be.className="decklight-ctxmenu";let X=document.createElement("div");X.className="cm-card";let Y=document.createElement("div");Y.className="cm-list",Y.setAttribute("role","listbox"),Y.setAttribute("aria-label","Element edit menu"),X.appendChild(Y),be.appendChild(X),r.appendChild(be),F();let ge=r.getBoundingClientRect(),V=Math.min(g-ge.left,ge.width-X.offsetWidth-4),ne=Math.min(j-ge.top,ge.height-X.offsetHeight-4);X.style.left=Math.max(4,V)+"px",X.style.top=Math.max(4,ne)+"px",kt(be,De)}async function fe(){let{slide:g,index:j}=E;De();try{let B=await fetch(I+"/edit/element/remove",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,index:j})}),X=await B.json().catch(()=>({}));if(!B.ok)throw new Error(X.error||B.status);u(X.changed?"element removed \u2014 reloading":"nothing to remove")}catch(B){u(`remove failed: ${String(B.message||B).slice(0,60)}`,2200)}}async function Ee(g){let{slide:j,index:B}=E;De();try{let X=await fetch(I+"/edit/element/effect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:j,index:B,effect:g})}),Y=await X.json().catch(()=>({}));if(!X.ok)throw new Error(Y.error||X.status);u(g===null?"effect removed \u2014 reloading":`effect: ${g} \u2014 reloading`)}catch(X){u(`effect save failed: ${String(X.message||X).slice(0,60)}`,2200)}}let ze=null;function Ne(){ze?.remove(),ze=null}function s({slide:g,index:j}){ze=document.createElement("div"),ze.className="decklight-narr decklight-editor";let B=document.createElement("div");B.className="narr-card";let X=document.createElement("div");X.className="narr-head",X.textContent=`edit content \u2014 slide ${g}, element ${j} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let Y=document.createElement("textarea");Y.className="narr-input edit-notes",Y.value="loading\u2026",Y.disabled=!0,Y.spellcheck=!1;let ge=async()=>{try{let Fe=await fetch(I+"/edit/element/content",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:g,index:j,html:Y.value})});if(!Fe.ok)throw new Error(await Fe.text());u("element content saved \u2014 reloading")}catch(Fe){u(`save failed: ${String(Fe.message||Fe).slice(0,60)}`)}};Y.addEventListener("keydown",Fe=>{Fe.key==="Enter"&&(Fe.metaKey||Fe.ctrlKey)?(ge(),Fe.preventDefault()):Fe.key==="Escape"&&(Ne(),Fe.preventDefault()),Fe.stopPropagation()});let V=document.createElement("div");V.className="tr-actions";let ne=document.createElement("button");ne.type="button",ne.className="narr-prev-btn",ne.textContent="\u{1F4BE} save to file",ne.addEventListener("click",ge),V.appendChild(ne),B.append(X,Y,V),ze.appendChild(B),kt(ze,Ne),r.appendChild(ze),(async()=>{try{let Fe=await fetch(`${I}/edit/element/source?slide=${g}&index=${j}`),Je=await Fe.json().catch(()=>({}));if(!Fe.ok||!Je.ok)throw new Error(Je.error||Fe.status);Y.value=Je.html,Y.disabled=!1,Y.focus()}catch(Fe){Y.value="",u(`could not read the element's source: ${String(Fe.message||Fe).slice(0,60)}`,2600)}})()}f.register({isOpen:()=>!!be,close:De,keydown(g){switch(g.key){case"ArrowDown":J(Xe+1,!0);break;case"ArrowUp":J(Xe-1,!0);break;case"Enter":Ce[Xe]?.run();break;case"Escape":De();break;default:return!1}return!0}}),f.register({isOpen:()=>!!ze,close:Ne,keydown:g=>g.key==="Escape"&&(Ne(),!0)});let o=null,O=[],Be=0,P=null;function Ue(g,j){j&&(g.src=`${I}/edit/at?ref=${encodeURIComponent(j.hash)}&embedded`)}function nt(g,j){let B=[...o.querySelectorAll(".tp-row")];if(!B.length)return;Be=jt(B,g,"tp-selected");let X=O[Be];o.querySelector(".tp-caption").textContent=X?`${X.hash} \xB7 ${X.when} \xB7 ${X.subject}`:"";let Y=o.querySelector("iframe");clearTimeout(P),j?Ue(Y,X):P=setTimeout(()=>Ue(Y,X),60)}async function W(){if(o)return Ae();if(!S)return u(tn("restoring a version",location),3200);let g=[];try{let X=await(await fetch(I+"/edit/history")).json();if(!X.ok)return u(`restore: ${X.error}`,3e3);g=X.entries||[]}catch{return u("restore: could not read the deck history",3e3)}if(!g.length)return u("restore: git has no record of this deck yet",3e3);k(),O=g,o=document.createElement("div"),o.className="decklight-theme-picker decklight-finder decklight-restore",o.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter">Restore a version \u2014 \u2191\u2193 to browse, \u23CE to restore</div><div class="tp-list" role="listbox" aria-label="Deck history"></div></div><div class="tp-preview"><iframe title="Version preview"></iframe><div class="tp-caption"></div></div></div>';let j=o.querySelector(".tp-list");O.forEach((B,X)=>{let Y=document.createElement("div");Y.className="tp-row",Y.setAttribute("role","option");let ge=document.createElement("span");ge.className="rs-hash",ge.textContent=B.hash;let V=document.createElement("span");V.className="rs-when",V.textContent=B.when,Y.append(ge,` ${B.subject} `,V),Y.addEventListener("click",()=>{nt(X,!0),Q()}),j.appendChild(Y)}),kt(o,Ae),r.appendChild(o),nt(0,!0)}function Ae(){clearTimeout(P),o?.remove(),o=null}async function Q(){let g=O[Be];if(g){Ae();try{let B=await(await fetch(I+"/edit/restore",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:g.hash})})).json();if(!B.ok)return u(`restore failed: ${B.error}`,3e3);if(!B.changed)return u(`already at ${g.hash}`,2e3);u(`restored ${g.hash} \u2014 Z takes it back`,2600)}catch{u("restore failed: the edit server did not answer",3e3)}}}f.register({isOpen:()=>!!me,close:Te,keydown:g=>g.key==="Escape"&&(Te(),!0)}),f.register({isOpen:()=>!!ce,close:U,keydown:g=>g.key==="Escape"&&(U(),!0)}),f.register({isOpen:()=>!!o,close:Ae,keydown(g){switch(g.key){case"ArrowDown":nt(Be+1,!1);break;case"ArrowUp":nt(Be-1,!1);break;case"Enter":Q();break;case"Escape":Ae();break;default:return!1}return!0}});let ye=null;function x(){ye?.remove(),ye=null}async function we(g){if(ye){x();return}if(!S){u(tn("configuring an engine",location),3200);return}let j,B;try{let _e=await fetch(`${I}/edit/wizard?engine=${encodeURIComponent(g)}`),Le=await _e.json().catch(()=>({}));if(!_e.ok||!Le?.schema){u(Le.error||`no wizard for ${g}`,3200);return}if(typeof Le.from!="string"||!Le.from||typeof Le.provenance?.askedBy!="string"||typeof Le.provenance?.sentTo!="string"){u("the server did not say who is asking for these answers \u2014 not prompting",3200);return}j=Le.schema,B=Le.provenance}catch{u("the author server did not answer",2600);return}k?.(),ye=document.createElement("div"),ye.className="decklight-narr decklight-editor";let X=document.createElement("div");X.className="narr-card";let Y=document.createElement("div");Y.className="narr-head",Y.textContent=`${j.title} \u2014 \u2318\u23CE saves \xB7 Esc closes`;let ge=document.createElement("div");ge.className="wiz-src";let V=document.createElement("div");V.textContent=B.askedBy;let ne=document.createElement("div");ne.textContent=B.sentTo,ge.append(V,ne),X.append(Y,ge);let Fe=new Map;for(let _e of j.fields){let Le=document.createElement("label");Le.className="tr-actions";let Qe=document.createElement("span");Qe.textContent=_e.required?`${_e.label} *`:_e.label;let Oe;if(_e.type==="choice"){Oe=document.createElement("select");for(let Ye of _e.options){let ct=document.createElement("option");ct.value=Ye,ct.textContent=Ye,Oe.append(ct)}_e.default&&(Oe.value=_e.default)}else _e.type==="boolean"?(Oe=document.createElement("input"),Oe.type="checkbox",Oe.checked=_e.default===!0):(Oe=document.createElement("input"),Oe.type=_e.type==="secret"?"password":"text",Oe.autocomplete=_e.type==="secret"?"off":"on",Oe.spellcheck=!1,_e.default!==void 0&&(Oe.value=String(_e.default)));Oe.className="narr-input",Fe.set(_e.name,{field:_e,input:Oe}),Le.append(Qe,Oe),X.append(Le)}let Je=document.createElement("div");Je.className="narr-head";let re=document.createElement("button");re.className="narr-prev-btn",re.textContent="save";let ke=document.createElement("div");ke.className="tr-actions",ke.append(re),X.append(ke,Je),ye.append(X),r.append(ye),Fe.values().next().value?.input.focus();async function He(){let _e={};for(let[Le,{field:Qe,input:Oe}]of Fe){let Ye=Qe.type==="boolean"?Oe.checked:Oe.value;Ye!==""&&Ye!==void 0&&(_e[Le]=Ye)}re.disabled=!0,Je.textContent="checking\u2026";try{let Le=await fetch(`${I}/edit/wizard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:j.engine,answers:_e})}),Qe=await Le.json().catch(()=>({}));if(!Le.ok){Je.textContent=Qe.state==="unreachable"?`could not reach it \u2014 ${Qe.error??"try again"}`:Qe.state==="prerequisite"?`not ready on this machine \u2014 ${Qe.error??"something it needs is missing"}`:`not accepted \u2014 ${Qe.error??"check the answers"}`,re.disabled=!1;return}h("wizard",`${j.engine} configured: ${JSON.stringify(Qe.stored)}`),x(),u(`${j.title} configured`,2200)}catch(Le){Je.textContent=`could not reach the author server \u2014 ${String(Le.message||Le).slice(0,50)}`,re.disabled=!1}}re.addEventListener("click",He),ye.addEventListener("keydown",_e=>{_e.key==="Enter"&&(_e.metaKey||_e.ctrlKey)&&(_e.preventDefault(),He())})}return f.register({isOpen:()=>!!ye,close:x,keydown:g=>g.key==="Escape"&&(x(),!0)}),{deckHistory:se,toggleEditor:Te,toggleAgentAsk:U,toggleElementEdit:Ie,elementEditOn:()=>Re,wizard:we,wizards:()=>$.slice(),restore:{open:W,close:Ae,list:()=>O.slice()},available:()=>S,base:()=>I}}ae();le();var Gn=[{id:"palette",text:"press / for the command palette \u2014 every command, type to filter"},{id:"help",text:"press ? for the keyboard shortcuts"},{id:"goto",text:"press G to jump to any slide by name"},{id:"theme",text:"press T to browse themes \u2014 the deck restyles live"},{id:"overview",text:"press O for the slide overview grid"},{id:"speaker",text:"press S for speaker view \u2014 notes, next slide and a timer"},{id:"narrate",text:"press V to have the deck narrate itself from its speaker notes"},{id:"messages",text:"press ` (left of 1) for the message log \u2014 every message the deck has shown"},{id:"fullscreen",text:"press F for fullscreen, B to black out the screen mid-talk"},{id:"author",text:"author mode (decklight author <deck.html>) turns this player into an editor \u2014 A asks an AI agent"}],wi="decklight-onboarded",Qr="decklight-tips-seen",xi="decklight-tips-off";function es(r){try{return localStorage.getItem(r)}catch{return null}}function br(r,a){try{localStorage.setItem(r,a)}catch{}}function vi({root:r,printMode:a,params:l,toast:d,debugLog:u,overlays:h,deck:f}){let m=l.has("embedded"),b=a||m,k=null;function S(){k&&(k.remove(),k=null,br(wi,"1"),u?.("nav","welcome dismissed"))}function I(){k||a||(k=document.createElement("div"),k.className="decklight-welcome",k.innerHTML=`<div class="wel-card">
|
|
296
|
+
<h3>Welcome to Decklight</h3>
|
|
297
|
+
<p class="wel-lead">This deck is a single HTML file \u2014 no build step, authored by you or an AI agent, and provable by a headless render.</p>
|
|
298
|
+
<table>
|
|
299
|
+
<tr><td>/</td><td><b>Command palette</b> \u2014 every command, type to filter. Start here.</td></tr>
|
|
300
|
+
<tr><td>?</td><td>All keyboard shortcuts.</td></tr>
|
|
301
|
+
<tr><td>T \xB7 \u2303T</td><td>Browse themes with a live preview; <b>\u2303T</b> generates a brand-new one.</td></tr>
|
|
302
|
+
<tr><td>S \xB7 V</td><td>Speaker view with notes & timer; <b>V</b> narrates the deck aloud.</td></tr>
|
|
303
|
+
<tr><td>A \xB7 E \xB7 Z</td><td><b>Author mode</b> (<code>decklight author <deck.html></code>): live-reload editing \u2014 ask an AI agent to change the deck, edit an element, undo.</td></tr>
|
|
304
|
+
</table>
|
|
305
|
+
<div class="wel-foot">
|
|
306
|
+
<span>Press any key to dismiss \u2014 reopen anytime from the <code>/</code> palette.</span>
|
|
307
|
+
<button type="button" class="wel-go">Got it</button>
|
|
308
|
+
</div>
|
|
309
|
+
</div>`,k.addEventListener("click",U=>{U.stopPropagation(),S()}),kt(k,S),r.appendChild(k),u?.("nav","welcome shown"))}h.register({isOpen:()=>!!k,close:S,keydown:()=>(S(),!0)});function M(){return es(xi)!=="1"}function C(){try{let U=JSON.parse(es(Qr)||"[]");return new Set(Array.isArray(U)?U:[])}catch{return new Set}}function $(){let U=C();return Gn.find(me=>!U.has(me.id))||null}function q(){let U=$();if(!U)return null;let me=C();return me.add(U.id),br(Qr,JSON.stringify([...me])),d(`tip \xB7 ${U.text}`,5200),U.id}function he(U){br(xi,U?"0":"1"),d(U?"tips on \u2014 one per deck you open":"tips off")}function se(){br(Qr,"[]"),d(`tips reset \u2014 all ${Gn.length} will show again, one per deck`)}function ce(U){if(!b&&(f().on("slide",S),f().on("build",S),!(U.slide!==1||U.step!==0))){if(es(wi)!=="1"){I();return}M()&&q()}}return{start:ce,showWelcome:I,dismissWelcome:S,showTip:q,setTips:he,resetTips:se,status:()=>({tipsOn:M(),tipsLeft:$()?Gn.length-C().size:0})}}ae();le();function ki({sectionsOf:r,checkOverflow:a,ResizeObs:l=typeof ResizeObserver=="function"?ResizeObserver:null,MutationObs:d=typeof MutationObserver=="function"?MutationObserver:null,schedule:u=h=>setTimeout(h)}){let h=[],f=0;function m(){f||(f=u(()=>{f=0;let M=r();for(let C of h)a(C,M.indexOf(C)+1)})||1)}let b=l?new l(m):null;function k(M){if(b)for(let C of[M,...M.querySelectorAll("*")])C.parentElement?.closest(".terminal")||b.observe(C)}let S=d?new d(M=>{let C=q=>!(q.nodeType===1?q:q.parentElement)?.closest(".terminal"),$=!1;for(let q of M)if(C(q.target)){$=!0;for(let he of q.addedNodes)he.nodeType===1&&he.isConnected&&k(he)}$&&m()}):null,I=M=>{M.target.closest?.(".terminal")||m()};return{watch(M){b?.disconnect(),S?.disconnect();for(let C of h)for(let $ of["load","error"])C.removeEventListener($,I,!0);h=M.filter(Boolean);for(let C of h){k(C),S?.observe(C,{childList:!0,subtree:!0,characterData:!0});for(let $ of["load","error"])C.addEventListener($,I,!0)}m()},get watched(){return h.slice()}}}ae();le();function Ei({config:r,root:a,embedded:l,sectionsOf:d,slideOf:u,navigate:h}){let f=!l&&r.playlist?.modules?.length?r.playlist:null,m=f?f.index??0:0,b=!!a.querySelector("section[data-module]");function k(){let I=[];return(d()||[]).forEach((M,C)=>{M.hasAttribute("data-module")&&I.push({title:M.getAttribute("data-module"),slide:C+1})}),I}function S(I=k()){let M=-1;return I.forEach((C,$)=>{C.slide<=u()&&(M=$)}),M}return{get playlist(){return f},get index(){return m},get hasMarkers(){return b},get any(){return b||!!f},markers:k,currentMarkerIndex:S,gotoModule(I){if(!f)return!1;let M=f.modules[m+I];return M?(h(M.href+(I>0?"#/1/0":"#/999/999")),!0):!1},navigateToModule(I){let M=f?.modules[I];M&&h(M.href+"#/1/0")},title(){if(b){let I=k();return I[S(I)]?.title||""}return f?.modules[m]?.title||""}}}ae();le();function Vc(r,a,l){return(r.querySelector("h1, h2, h3")?.textContent||"").replace(/\s+/g," ").trim()||l.slice(0,60)||`slide ${a+1}`}function Zc(r){return[...r.children].filter(l=>!l.matches("aside, script, style")).map(l=>l.textContent).join(" ").replace(/\s+/g," ").trim()}function Si({sections:r,modules:a=[],skipModule:l=-1}){let d=r.map((h,f)=>{let m=Zc(h);return{slide:f+1,title:Vc(h,f,m),haystack:m.toLowerCase()}}),u=a.map((h,f)=>({module:f,title:h.title,href:h.href,haystack:(h.title||"").toLowerCase()})).filter(h=>h.module!==l);return[...d,...u]}function Ai(r,a){let l=String(a??"").toLowerCase().split(/\s+/).filter(Boolean),d=[],u=[];for(let h of r){let f=h.title.toLowerCase();l.every(m=>f.includes(m))?d.push(h):l.every(m=>h.haystack.includes(m))&&u.push(h)}return[...d,...u]}ae();le();function _i({now:r=Date.now,keep:a=200}={}){let l=r(),d=[],u=null;function h(f,m){let b={t:((r()-l)/1e3).toFixed(3),kind:f,msg:m};return d.push(b),d.length>a&&d.shift(),u?.(b),b}return{log:h,get entries(){return d.slice()},onEntry(f){u=f}}}ae();le();var Xc=["auto","centered","pinned","top","split","split-flip"];function Yc({autoPins:r,hasSplitPair:a}){return Xc.filter(l=>(l!=="pinned"||!r)&&(l!=="split-flip"||a))}function Jc(r,a,l){if(!r.length)return null;let d=Math.max(0,r.indexOf(a));return r[(d+l+r.length)%r.length]}function Ti({slideOf:r,sectionAt:a,describe:l,available:d,unavailableMessage:u,apply:h,relayout:f,post:m,toast:b,debugLog:k,schedule:S=setTimeout,cancel:I=clearTimeout,delay:M=600}){let C=null,$=null;function q(){I($);let ce=C;C=null,ce&&m({slide:ce.slide,layout:ce.name}).then(()=>k("layout",`slide ${ce.slide}: ${ce.name} \u2192 saved to file`)).catch(()=>b("layout save failed \u2014 is the dev server still up?",2200))}function he(ce=r()){let U=a(ce);return U?Yc(l(U)):[]}function se(ce){if(!d()){b(u(),3200);return}let U=r(),me=a(U);if(!me)return;let Te=Jc(he(U),me.getAttribute("data-layout")||"auto",ce);if(!Te)return;h(me,Te),C&&C.slide!==U&&q(),C={slide:U,name:Te},I($),$=S(q,M);let $e=f(me,U);b($e?`layout: ${Te} \u2014 fights this slide's own column flexbox; pick one`:`layout: ${Te}`),k("layout",`slide ${U}: ${Te}`)}return{ring:he,cycle:se,flush:q}}ae();le();function Ci({commands:r,query:a="",totalSlides:l=0,makeGotoRow:d,makeSearchRow:u}){let h=String(a).toLowerCase(),f=r.filter(b=>!h||(b.label+" "+(b.alias??"")).toLowerCase().includes(h)),m=String(a).trim().match(/^(?:goto\s*)?(\d+)$/i);if(m&&d){let b=Math.max(1,Math.min(parseInt(m[1],10),l));f.unshift(d(b,l))}return h&&!m&&u&&!f.some(b=>b.label.toLowerCase().startsWith(h))&&f.push(u(a)),f}var Qc={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},wr=99,ed=18,Ni=6,td="ul, ol, svg, pre, table, .terminal, img, .columns",Bn=null;function jn(r,a){Ks(r,a),Bn&&Bn._rescanFor(r)}function nd(r){let a=getComputedStyle(r).position;return a==="absolute"||a==="fixed"}function rd(r){for(let a of r.children)if(!a.matches("aside, script, style, .decklight-hero-logo, .slide-bg")){if(a.matches("h1, h2"))return a;if(!nd(a))return null}return null}function sd(r,a){if(!a||r.getAttribute("data-subtitle")==="none")return null;let l=a.nextElementSibling;return l&&l.matches("p")&&!l.hasAttribute("data-build")?(l.classList.add("subtitle"),l):r.querySelector(":scope > p.subtitle")}function Oi(r){return r.pinTitles===!0?wr:typeof r.pinTitles=="number"&&isFinite(r.pinTitles)?r.pinTitles:null}function Mi(r,a){let l=Oi(a),d=r.getAttribute("data-pin");if(d==="none")return null;if(d!==null&&d!==""){let h=parseFloat(d);return isFinite(h)?h:l??wr}return d===""?l??wr:l===null?null:[...r.querySelectorAll(td)].some(h=>!h.closest("aside")&&!h.closest(".decklight-hero-logo"))?l:null}function yr(r,a){r.forEach(l=>{let d=rd(l),u=l.getAttribute("data-layout"),h;if(u==="pinned"){let k=parseFloat(l.getAttribute("data-pin"));h=isFinite(k)?k:Oi(a)??wr}else u==="centered"||u==="top"?h=null:h=Mi(l,a);let f=sd(l,d);if(l.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),l.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),h===null||!d){l.removeAttribute("data-pinned"),l.style.removeProperty("--pin-y"),l.style.removeProperty("--pin-sub-y"),l.style.removeProperty("--pin-space");return}d.classList.add("pin-title"),l.setAttribute("data-pinned",""),l.style.setProperty("--pin-y",h+"px"),l.classList.add("pin-measure");let m=d.offsetHeight||0,b=h+m;f&&(f.classList.add("pin-subtitle"),l.style.setProperty("--pin-sub-y",Math.round(b+Ni)+"px"),b+=Ni+(f.offsetHeight||0)),l.classList.remove("pin-measure"),l.style.setProperty("--pin-space",Math.round(b+ed)+"px")})}function Li(r){return[...r.children].filter(a=>!a.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo, .slide-bg"))}function $i(r){r.forEach((a,l)=>{if(a.querySelectorAll(":scope > .split-columns, :scope > .split-footer").forEach(u=>u.classList.remove("split-columns","split-footer")),!/^split/.test(a.getAttribute("data-layout")||"")){a.removeAttribute("data-split-conflict");return}let d=Li(a);if(od(a,d,l+1),d.length===1&&d[0].matches("ul, ol")){d[0].classList.add("split-columns");return}for(let u of d.slice(2))u.classList.add("split-footer")})}function od(r,a,l){let d=a.some(h=>{let f=getComputedStyle(h);return/flex$/.test(f.display)&&f.flexDirection.startsWith("row")}),u=r.hasAttribute("data-split-conflict");r.toggleAttribute("data-split-conflict",d),d&&!u&&console.warn(`Decklight: slide ${l} combines data-layout="split" with its own column flexbox \u2014 two layout systems fight; drop the data-layout or the flex shell (SPEC COMPARISON_SLIDES)`)}function ts(r,a){if(!r)return;let l=[r,...r.querySelectorAll("pre, table, svg, ul, ol, blockquote")].some(u=>u.scrollHeight>u.clientHeight+2&&getComputedStyle(u).overflowY!=="visible"&&!u.closest(".terminal")&&!u.hasAttribute("data-scroll-ok")),d=r.hasAttribute("data-overflow");r.toggleAttribute("data-overflow",l),l&&!d&&console.warn(`Decklight: slide ${a} content overflows and is clipped \u2014 reduce content or font size`)}function id(r){r.querySelectorAll("section[data-markdown]").forEach((a,l)=>{a.setAttribute("data-markdown-removed","");let d=[...r.children].indexOf(a)+1||l+1;console.warn(`Decklight: slide ${d} uses data-markdown, which was removed in 0.3.0 \u2014 its content is in a <script type="text/template"> the browser will not render. Author the slide in HTML (SPEC DECK_ANATOMY).`)})}function Ri(r={}){let a=new URLSearchParams(location.search),l={...Qc,...r};a.has("embedded")&&(l.controls=!1);let d=a.has("print"),u=a.get("print")||"",h=_i(),f=null,m=(w,_)=>h.log(w,_),b=document.querySelector(".decklight");if(!b)throw new Error("Decklight: no .decklight element found");let k=ri(),S=Ei({config:l,root:b,embedded:a.has("embedded"),sectionsOf:()=>te._sections,slideOf:()=>te.state.slide,navigate:w=>{location.href=w}}),I=S.playlist,M=S.index,C=S.hasMarkers,$=w=>S.gotoModule(w),q=w=>S.navigateToModule(w),he=200,se=4,ce=[],U=null,me=null;function Te(){return ce}function $e(w){ce.push({at:new Date,text:String(w)}),ce.length>he&&ce.shift(),me&&St()}function Re(w,_=3200){if($e(w),d)return;U||(U=document.createElement("div"),U.className="decklight-messages",b.appendChild(U));let A=document.createElement("div");for(A.className="decklight-toast",A.textContent=w,U.appendChild(A),requestAnimationFrame(()=>A.classList.add("show"));U.children.length>se;)U.firstChild.remove();setTimeout(()=>{A.classList.remove("show"),setTimeout(()=>A.remove(),260)},_)}let be=vi({root:b,printMode:d,params:a,toast:Re,debugLog:m,overlays:k,deck:()=>te}),Ce=ii({root:b,config:l,params:a,toast:Re,debugLog:m,overlays:k,deck:()=>te,editmode:()=>xt}),{applyTheme:Xe,currentTheme:xe,cycleTheme:E,cancelCyclePending:Ie,rollTheme:qe,saveGeneratedTheme:De}=Ce,F=null,J=0,H="",fe=[],Ee,ze=!1,Ne=null;function s(){return Si({sections:te._sections,modules:I?.modules??[],skipModule:M})}function o(){let w=F.querySelector(".tp-list");if(fe=Ai(F.__index,H),w.textContent="",fe.forEach((A,R)=>{let Z=document.createElement("div");Z.className="tp-row"+(A.slide===te.state.slide?" tp-current":"")+(A.href?" tp-module":""),Z.textContent=A.href?`\u25B8 ${A.title} \u2014 module`:`${A.slide} \xB7 ${A.title}`,Z.addEventListener("mouseenter",()=>Be(R,!1)),Z.addEventListener("click",()=>{Be(R,!0),Ue()}),w.appendChild(Z)}),!fe.length){let A=document.createElement("div");A.className="tp-none",A.textContent="no matches",w.appendChild(A)}let _=F.querySelector(".tp-filter");_.textContent=H||(I?"type to find a slide or module\u2026":"type to find a slide\u2026"),_.classList.toggle("tp-active",!!H)}function O(w,_){let A=_.href??location.pathname,R=_.slide??1;if(w.dataset.doc!==A){w.dataset.doc=A,ze=!1,w.addEventListener("load",()=>{if(ze=!0,Ne&&F){let Z=Ne;Ne=null,O(w,Z)}},{once:!0}),w.src=A+Ce.previewQuery()+"#/"+R+"/0";return}if(!ze){Ne=_;return}w.contentWindow?.postMessage({__decklightPreview:{goto:[R,0]}},"*")}function Be(w,_){if(!fe.length)return;J=jt(F.querySelectorAll(".tp-row"),w,"tp-selected");let A=fe[J];F.querySelector(".tp-caption").textContent=A.href?`module \u2014 ${A.title} (${A.href})`:`slide ${A.slide} \u2014 ${A.title}`,clearTimeout(Ee);let R=F.querySelector("iframe");_?O(R,A):Ee=setTimeout(()=>O(R,A),60)}function P(w){H=w,o(),fe.length?Be(0,!1):F.querySelector(".tp-caption").textContent="no match"}function Ue(){let w=fe[J];if(W(),!!w){if(w.href)return q(w.module);te.goto(w.slide,0)}}function nt(){if(F)return W();Ce.closePicker(),xt.restore.close(),H="",F=document.createElement("div"),F.className="decklight-theme-picker decklight-finder",F.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="tp-list" role="listbox" aria-label="Slides"></div></div><div class="tp-preview"><iframe title="Slide preview"></iframe><div class="tp-caption"></div></div></div>',F.__index=s(),o(),kt(F,W),b.appendChild(F),Be(Math.max(0,fe.findIndex(w=>w.slide===te.state.slide)),!0)}function W(){clearTimeout(Ee),F?.remove(),F=null}let Ae=null,Q=0,ye="",x=[];function we(){let w=A=>typeof A=="function";return[{label:"Find slide\u2026",hint:"G",alias:"search grep goto module chapter jump",run:()=>{nt(),ye&&P(ye)}},{label:"Restore a version\u2026",hint:"R",alias:"history git rollback undo revert commit",run:()=>xt.restore.open()},{label:"Go to slide\u2026",hint:"#",alias:"goto",keepOpen:!0,run:()=>{ye="goto ",g()}},{label:"Theme\u2026",hint:"T",run:Ce.openPicker},{label:"Cycle theme",hint:", \xB7 .",run:()=>E(1)},{label:"Generate a theme",hint:"\u2303T",run:qe},Ce.hasGenerated()&&{label:"Save the generated theme\u2026",hint:"\u2303\u21E7T",run:()=>De()},xt.available()&&{label:"Browse marketplace themes\u2026",alias:"marketplace install add third-party download catalog",run:Ce.browse},...xt.wizards().map(A=>({label:`Configure ${A.title}\u2026 (dev)`,alias:"engine wizard setup api key credential token marketplace",run:()=>xt.wizard(A.qualified)})),{label:"Font\u2026",hint:"[ \xB7 ]",run:ne},{label:"Cycle slide layout (dev)",hint:"L",alias:"pin pinned centered top auto split columns two sides arrange",run:()=>Pt(1)},{label:"Undo deck edit (dev)",hint:"Z",alias:"revert back history",run:()=>an("undo")},{label:"Redo deck edit (dev)",hint:"\u21E7Z",alias:"forward history repeat",run:()=>an("redo")},{label:"Ask agent\u2026 (dev)",hint:"A",alias:"ai claude codex bob gemini prompt edit",run:gt},{label:"Messages",hint:"`",alias:"log toast notifications warnings why voice stopped history",run:ut},{label:`Narration ${At.status().narrating?"off":"on"}`,hint:"V",run:wt},{label:"Narration track\u2026",hint:"N",alias:"voice audio",run:()=>Lt("tracks")},{label:"Live voice\u2026",alias:"tts synthesize tone gemini",run:()=>Lt("voices")},{label:"Character\u2026",alias:"avatar lipsync face talking head visemes",run:()=>Lt("character")},{label:`Character solo ${rn.solo?"off":"on"}`,alias:"centre center stage narrator only fullscreen avatar",run:()=>At.applySolo(!rn.solo)},{label:"Record offline narration\u2026",hint:"\u21E7V",alias:"export download batch wav tts",run:sn},{label:"Voice faster",hint:">",alias:"speed rate playback",run:()=>Ft(.25)},{label:"Voice slower",hint:"<",alias:"speed rate playback",run:()=>Ft(-.25)},{label:"Speaker view",hint:"S",run:()=>{let A=te.__speakerWin;A&&!A.closed?A.__decklightSpeakerToggle?.():te.__speakerWin=Kr(te)}},{label:"Overview",hint:"O",run:Et},{label:"Blackout",hint:"B",run:Yt},{label:`Pen ${zt.annotator?.tool==="pen"?"off":"on"} \u2014 draw on the slide`,hint:"W",alias:"ink annotate draw scribble marker highlight",run:()=>Qt("pen")},{label:`Laser pointer ${zt.annotator?.tool==="laser"?"off":"on"}`,hint:"\u21E7W",alias:"ink dot glow point at",run:()=>Qt("laser")},{label:"Debug log",hint:"D",alias:"console events state",run:dt},{label:`Captions ${At.status().captionsOn?"off":"on"}`,hint:"C",alias:"cc subtitles closed caption",run:Mt},{label:`Clock ${zt.status().clockOn?"off":"on"}`,hint:"K",alias:"time elapsed timer talk wall watch",run:Jt},{label:`Progress bar ${zt.status().progressOn?"off":"on"}`,hint:"H",alias:"bar bottom edge position how far through shape of the talk",run:on},{label:"Transcript\u2026",alias:"notes script export text markdown spoken",run:Bt},{label:`Narration ${At.status().paused?"resume":"pause"}`,hint:"P",alias:"pause resume voice",run:$t},{label:"Edit speaker notes\u2026",alias:"edit mode notes write right-click background",run:kn},{label:`Element edit mode ${xt.elementEditOn()?"off":"on"} (dev)`,hint:"E",alias:"right-click remove delete html content build animation entrance effect context menu",run:T},{label:"Fullscreen",hint:"F",run:()=>G()},{label:"Print view (all slides, new tab)",hint:"",run:()=>window.open(location.pathname+"?print")},{label:"First slide",hint:"Home",run:()=>te.goto(1,0)},{label:"Last slide",hint:"End",run:()=>te.goto(te.state.totalSlides,0)},{label:"Keyboard help",hint:"?",run:Ot},{label:"Welcome to Decklight",alias:"onboarding intro getting started first run tour what is this help me",run:be.showWelcome},{label:`Tips ${be.status().tipsOn?"off":"on"}`,alias:"hints teach shortcuts learn stop showing quiet",run:()=>be.setTips(!be.status().tipsOn)},be.status().tipsLeft<Gn.length&&{label:"Reset tips",alias:"hints again start over show all unsee replay",run:be.resetTips}].filter(Boolean).filter(A=>w(A.run))}function g(){let w=Ae.querySelector(".narr-card");w.textContent="",x=Ci({commands:we(),query:ye,totalSlides:te.state.totalSlides,makeGotoRow:(A,R)=>({label:`Go to slide ${A} / ${R}`,hint:"\u23CE",run:()=>te.goto(A,0)}),makeSearchRow:A=>({label:`Search slides for \u201C${A}\u201D`,hint:"",run:()=>{nt(),P(A)}})});let _=document.createElement("div");if(_.className="pal-input"+(ye?" tp-active":""),_.textContent=ye||"type a command\u2026",w.appendChild(_),x.forEach((A,R)=>{let Z=document.createElement("div");Z.className="narr-row pal-row";let ue=document.createElement("span");if(ue.textContent=A.label,Z.appendChild(ue),A.hint){let We=document.createElement("span");We.className="pal-kbd",We.textContent=A.hint,Z.appendChild(We)}Z.addEventListener("mouseenter",()=>j(R)),Z.addEventListener("click",()=>{j(R),B()}),w.appendChild(Z)}),!x.length){let A=document.createElement("div");A.className="tp-none",A.textContent="no matching command",w.appendChild(A)}j(0)}function j(w){x.length&&(Q=jt(Ae.querySelectorAll(".pal-row"),w,"narr-sel"))}function B(){let w=x[Q];w&&(w.keepOpen||Y(),w.run())}function X(){if(Ae)return Y();F&&W(),xt.restore.close(),ye="",Ae=document.createElement("div"),Ae.className="decklight-narr decklight-palette",Ae.innerHTML='<div class="narr-card" role="listbox" aria-label="Commands"></div>',kt(Ae,Y),b.appendChild(Ae),g()}function Y(){Ae?.remove(),Ae=null}let ge=null,V=0;function ne(){if(ge)return Je();ge=document.createElement("div"),ge.className="decklight-narr decklight-font-picker",ge.innerHTML='<div class="narr-card" role="listbox" aria-label="Fonts"></div>';let w=ge.querySelector(".narr-card");re.forEach(([_],A)=>{let R=document.createElement("div");R.className="narr-row"+(A===He?" narr-cur":""),R.textContent=_,A>0&&(R.style.fontFamily=re[A][1]),R.addEventListener("mouseenter",()=>Fe(A)),R.addEventListener("click",()=>{_e(A),Je()}),w.appendChild(R)}),kt(ge,Je),b.appendChild(ge),Fe(He)}function Fe(w){V=jt(ge.querySelectorAll(".narr-row"),w,"narr-sel")}function Je(){ge?.remove(),ge=null}Ce.restoreSaved();let re=[["theme default",null],["system sans","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"],["rounded","ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, 'Arial Rounded MT Bold', Calibri, sans-serif"],["humanist","Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif"],["geometric","'Avenir Next', Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif"],["classical serif","'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif"],["transitional serif","Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif"],["slab serif","Rockwell, 'Rockwell Nova', 'Roboto Slab', 'DejaVu Serif', 'Sitka Small', serif"],["monospace","'SF Mono', SFMono-Regular, ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace"]],ke="decklight-font:"+location.pathname,He=0;function _e(w,{silent:_=!1,remeasure:A=!0}={}){He=(w%re.length+re.length)%re.length;let[R,Z]=re[He];if(Z?(b.style.setProperty("--font-body",Z),b.style.setProperty("--font-heading",Z)):(b.style.removeProperty("--font-body"),b.style.removeProperty("--font-heading")),!a.has("embedded"))try{Z?localStorage.setItem(ke,String(He)):localStorage.removeItem(ke)}catch{}A&&(yr(te._sections,l),ts(te._sections[te.state.slide-1],te.state.slide)),_||Re(`font: ${R}`),m("font",R)}function Le(w){_e(He+w)}try{let w=parseInt(localStorage.getItem(ke),10);w>0&&w<re.length&&_e(w,{silent:!0,remeasure:!1})}catch{}function Qe(w){if(!w)return null;if(w.startsWith("#")){let A=document.querySelector(w);if(!A)return null;let R=A.cloneNode(!0);return R.removeAttribute("id"),R.style.removeProperty("display"),R}if(w.trim().startsWith("<")){let A=document.createElement("div");return A.innerHTML=w,A.firstElementChild}let _=document.createElement("img");return _.src=w,_.alt="",_}let Oe=null;Ce.updateCanvas();let Ye=b.querySelector(":scope > .decklight-stage");if(!Ye){for(Ye=document.createElement("div"),Ye.className="decklight-stage";b.firstChild;)Ye.appendChild(b.firstChild);b.appendChild(Ye)}if(Ye.style.width=l.width+"px",Ye.style.height=l.height+"px",l.logo&&(l.logo.src||l.logo.onLight||l.logo.onDark)){Oe=document.createElement("div"),Oe.className="decklight-logo",Oe.setAttribute("data-pos",l.logo.position||"bottom-left"),l.logo.height&&Oe.style.setProperty("--logo-h",l.logo.height+"px");for(let[w,_]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let A=Qe(l.logo[w]);if(!A)continue;let R=document.createElement("span");R.className=_,R.appendChild(A),Oe.appendChild(R)}b.appendChild(Oe)}function ct(w){Oe&&w.forEach(_=>{if(!_.hasAttribute("data-logo")||_.querySelector(":scope > .decklight-hero-logo"))return;let A=document.createElement("div");A.className="decklight-hero-logo";let R=parseFloat(_.getAttribute("data-logo"));R&&A.style.setProperty("--hero-logo-h",R+"px"),A.innerHTML=Oe.innerHTML,_.prepend(A)})}id(Ye),eo(Ye),oo(Ye),Xs(Ye),ei(Ye,jn);let _t=Ti({slideOf:()=>te.state.slide,sectionAt:w=>te._sections[w-1],describe:w=>({autoPins:Mi(w,l)!==null,hasSplitPair:Li(w).length>1}),available:()=>xt.available(),unavailableMessage:()=>tn("layout",location),apply:(w,_)=>{_==="auto"?w.removeAttribute("data-layout"):w.setAttribute("data-layout",_)},relayout:(w,_)=>(yr(te._sections,l),$i(te._sections),ts(w,_),w.hasAttribute("data-split-conflict")),post:w=>fetch(xt.base()+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(w)}).then(_=>{if(!_.ok)throw new Error(_.status)}),toast:Re,debugLog:m}),Pt=w=>_t.cycle(w),Kt=w=>_t.ring(w),te={root:b,stage:Ye,config:l,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(w,_){return this._listeners.has(w)||this._listeners.set(w,new Set),this._listeners.get(w).add(_),this},_emit(w,_){(this._listeners.get(w)||[]).forEach(A=>A(_)),b.dispatchEvent(new CustomEvent("decklight:"+w,{detail:_}))},sync(){this._sections=[...Ye.querySelectorAll(":scope > section")],this._sections.forEach((_,A)=>_.setAttribute("data-slide-index",String(A+1))),Zs(Ye,l.concepts),ct(this._sections),bi(this._sections,{printMode:d}),yr(this._sections,l),$i(this._sections),this._records=this._sections.map(_=>Br(_)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let w=this._records[this.state.slide-1];w&&(this.state.step=Math.min(this.state.step,w.groups.length)),Vt(d?this._sections:[this._sections[this.state.slide-1]])},_rescanFor(w){let _=w.closest("section"),A=this._sections.indexOf(_);if(A!==-1){if(this._records[A]=Br(_),d){cn(this._records[A],this._records[A].groups.length);return}A===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[A].groups.length),this._requestedStep=null,Dt(()=>cn(this._records[A],this.state.step)),this._updateHash(!1)):Dt(()=>cn(this._records[A],0)),this._notify()}},_stepLabels(w){let _=this._records[w];return _?Ws(_):[]},next(){let w=this._records[this.state.slide-1];w&&this.state.step<w.groups.length?this.goto(this.state.slide,this.state.step+1,{direction:"fwd"}):this.state.slide<this.state.totalSlides?this.goto(this.state.slide+1,0,{direction:"fwd"}):$(1)},prev(){if(this.state.step>0)this.goto(this.state.slide,this.state.step-1,{direction:"back"});else if(this.state.slide>1){let w=this._records[this.state.slide-2];this.goto(this.state.slide-1,w.groups.length,{direction:"back"})}else $(-1)},goto(w,_=0,A={}){w=Math.max(1,Math.min(w,this.state.totalSlides));let R=this._records[w-1];this._requestedStep=_,_=Math.max(0,Math.min(_,R?R.groups.length:0));let Z=w===this.state.slide;if(Z&&_===this.state.step&&!A.force)return;let ue=A.direction||(w>this.state.slide||Z&&_>this.state.step?"fwd":"back");!Z||A.force?(this._activateSlide(w,ue,A),this.state.slide=w,this.state.step=_,Dt(()=>cn(R,_)),this._emit("slide",{slide:w,total:this.state.totalSlides,direction:ue}),Vt([this._sections[w-1]])):(this.state.step=_,cn(R,_),this._emit("build",{slide:w,index:_,total:R.groups.length,direction:ue})),this._updateChrome(),this._updateHash(!Z),this._notify()},_activateSlide(w,_,A={}){let R=this._sections[this.state.slide-1],Z=this._sections[w-1];if(b.classList.toggle("has-hero-logo",Z?.hasAttribute("data-logo")??!1),R===Z){Z.classList.add("active");return}let ue=!R||!R.classList.contains("active"),We=R&&Z&&!ue&&R.hasAttribute("data-auto-animate")&&Z.hasAttribute("data-auto-animate")&&Math.abs(this._sections.indexOf(Z)-this._sections.indexOf(R))===1;if(this._sections.forEach(Dn=>Dn.classList.remove("active","entering","leaving","dir-fwd","dir-back","tr-none","tr-fade","tr-slide","tr-scale","tr-flip")),Z.classList.add("active"),ue||d)return;if(We){R.classList.add("leaving"),R.style.visibility="hidden",Z.style.visibility="hidden",Z.offsetWidth,Z.style.visibility="",no(R,Z,this._scale),R.classList.remove("leaving"),R.style.visibility="";return}let ot=Z.getAttribute("data-transition")||this.config.transition;if(ot==="none")return;let bt="dir-"+_;Z.classList.add("entering","tr-"+ot,bt),R.classList.add("leaving","tr-"+ot,bt,"active-out");let mn=parseFloat(getComputedStyle(Z).getPropertyValue("--transition-duration"))*1e3||350;setTimeout(()=>{R.classList.remove("leaving","tr-"+ot,bt,"active-out"),Z.classList.remove("entering","tr-"+ot,bt)},mn+60)},_updateChrome(){if(Ct){let w=this._records[this.state.slide-1],_=w?w.groups.length:0,A=this.state.totalSlides<=1?1:(this.state.slide-1+(_?this.state.step/(_+1):0))/(this.state.totalSlides-1);Ct.style.width=(Math.min(A,1)*100).toFixed(2)+"%"}if(ft){let w=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if(ft.textContent=w,S.any){let _=S.title(),A=document.createElement("span");A.className="mod",A.textContent=_,ft.prepend(A)}}},_updateHash(w){if(!this.config.hash||d)return;let _=`#/${this.state.slide}/${this.state.step}`;"#"+qt(location.hash)!==_&&(pt=!0,w?history.pushState(null,"",_):history.replaceState(null,"",_),setTimeout(()=>{pt=!1}))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function nn(w,_){let A=document.createElement("a");A.href=w,A.download=_,document.body.appendChild(A),A.click(),A.remove()}function Dt(w){b.classList.add("decklight-no-anim"),w(),b.offsetWidth,b.classList.remove("decklight-no-anim")}function qt(w){return(w||"").replace(/^#/,"")}function Xt(){let w=qt(location.hash).match(/^\/(\d+)(?:\/(\d+))?/);return w?{slide:parseInt(w[1],10),step:w[2]?parseInt(w[2],10):0}:null}let Ct=null,ft=null;if(l.controls&&!d){let w=document.createElement("div");w.className="decklight-controls",w.innerHTML=`
|
|
226
310
|
<button class="decklight-arrow prev" aria-label="Previous">\u2039</button>
|
|
227
|
-
<button class="decklight-arrow next" aria-label="Next">\u203A</button>`,
|
|
311
|
+
<button class="decklight-arrow next" aria-label="Next">\u203A</button>`,b.appendChild(w),w.querySelector(".prev").addEventListener("click",()=>te.prev()),w.querySelector(".next").addEventListener("click",()=>te.next())}let it={full:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>',unfull:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>',sound:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H3v6h3l5 4z"/><path d="M15.5 8.5a5 5 0 0 1 0 7"/><path d="M18.5 5.5a9 9 0 0 1 0 13"/></svg>',mute:'<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H3v6h3l5 4z"/><path d="M17 10l5 4M22 10l-5 4"/></svg>'},st=null,N=null;function G(){let w=b||document.documentElement;document.fullscreenElement?document.exitFullscreen?.():w.requestFullscreen?.()?.catch?.(()=>{})}document.addEventListener("fullscreenchange",()=>{st&&(st.innerHTML=document.fullscreenElement?it.unfull:it.full)});function ie(){if(!N)return;let w=At.status().narrating;N.innerHTML=w?it.sound:it.mute,N.setAttribute("aria-label",w?"Mute narration":"Play narration"),N.setAttribute("aria-pressed",String(w))}(l.slideNumber||I||C)&&!d&&(ft=document.createElement("div"),ft.className="decklight-slide-number",(I||C)&&(ft.title="G \u2014 find a slide or module",ft.style.cursor="pointer",ft.addEventListener("click",()=>nt())),b.appendChild(ft));let pe=null,Pe=0;function Se(){return getComputedStyle(pe).gridTemplateColumns.split(" ").length||1}function Me(w){let _=pe.querySelectorAll(".ov-cell");Pe=Math.max(0,Math.min(w,_.length-1)),_.forEach((A,R)=>A.classList.toggle("ov-selected",R===Pe)),_[Pe]?.scrollIntoView({block:"nearest"})}function rt(){let w=Pe+1;Et(),te.goto(w,0,{force:!0})}function at(){if(!pe)return;let w=pe.querySelector(".ov-cell");if(!w)return;pe.style.gridAutoRows=Math.round(w.clientWidth*l.height/l.width)+"px";let _=w.clientWidth/l.width;pe.querySelectorAll(".ov-frame").forEach(A=>{A.style.transform=`scale(${_})`})}function Et(){if(pe){window.removeEventListener("resize",at),pe.remove(),pe=null,b.classList.remove("decklight-overview");return}pe=document.createElement("div"),pe.className="decklight-overview-grid",te._sections.forEach((w,_)=>{let A=document.createElement("div");A.className="ov-cell"+(_===te.state.slide-1?" ov-current":"");let R=document.createElement("div");R.className="ov-frame",R.style.width=l.width+"px",R.style.height=l.height+"px";let Z=w.cloneNode(!0);Z.classList.add("active","ov-clone"),Z.querySelectorAll("aside.notes, aside.rehearse").forEach(We=>We.remove()),Z.querySelectorAll("input, button, select, textarea").forEach(We=>{We.removeAttribute("name"),We.disabled=!0}),R.appendChild(Z),A.appendChild(R);let ue=document.createElement("span");ue.className="ov-num",ue.textContent=String(_+1),A.appendChild(ue),A.addEventListener("click",()=>{Et(),te.goto(_+1,0,{force:!0})}),pe.appendChild(A)}),b.classList.add("decklight-overview"),b.appendChild(pe),at(),Me(te.state.slide-1),window.addEventListener("resize",at)}let Nt=null;function Yt(){if(Nt){Nt.remove(),Nt=null;return}Nt=document.createElement("div"),Nt.className="decklight-blackout",b.appendChild(Nt)}let Rt=null;function wn(){let w=te._records?.[te.state.slide-1],_=At.status(),A=_.live?`\u26A1 ${_.voice} \xB7 ${_.tone}`:_.track?`\u{1F50A} ${_.track.label}`:"none";return`slide ${te.state.slide}/${te.state.totalSlides} \xB7 step ${te.state.step}/${w?w.groups.length:0} \xB7 theme ${xe()??"\u2014"} \xB7 narration ${_.narrating?_.paused?"paused":"on":"off"} (${A})`+(_.rate!==1?` \xB7 ${_.rate}\xD7`:"")+(_.spend>0?` \xB7 tts ~$${_.spend.toFixed(4)}`:"")}function Ht(w){let _=document.createElement("div");_.className="dbg-row dbg-"+w.kind;for(let[A,R]of[["dbg-t",w.t],["dbg-k",w.kind],["dbg-m",w.msg]]){let Z=document.createElement("span");Z.className=A,Z.textContent=R,_.appendChild(Z)}f.querySelector(".dbg-log").appendChild(_)}function It(){let w=f?.querySelector(".dbg-state");w&&(w.textContent=wn())}function dt(){if(f){f.remove(),f=null,h.onEntry(null);return}f=document.createElement("div"),f.className="decklight-debug",f.innerHTML='<div class="dbg-head">debug log \u2014 D closes</div><div class="dbg-state"></div><div class="dbg-log"></div>',b.appendChild(f),h.entries.forEach(Ht),It();let w=f.querySelector(".dbg-log");w.scrollTop=w.scrollHeight,h.onEntry(_=>{Ht(_),It();let A=f.querySelector(".dbg-log");A.scrollTop=A.scrollHeight})}function St(){let w=me?.querySelector(".msg-log");if(w){if(w.innerHTML="",!ce.length){let _=document.createElement("div");_.className="msg-empty",_.textContent="no messages yet",w.appendChild(_);return}ce.forEach(({at:_,text:A})=>{let R=document.createElement("div");R.className="msg-row";let Z=document.createElement("span");Z.className="msg-time",Z.textContent=_.toLocaleTimeString([],{hour12:!1});let ue=document.createElement("span");ue.className="msg-text",ue.textContent=A,R.append(Z,ue),w.appendChild(R)}),w.scrollTop=w.scrollHeight}}function ut(){if(me){me.remove(),me=null;return}me=document.createElement("div"),me.className="decklight-msglog",me.innerHTML='<div class="msg-head">messages \u2014 the key left of 1 closes</div><div class="msg-log"></div>',b.appendChild(me),St()}te.on("ready",w=>m("ready",`${w.slides} slides${w.print?" \xB7 print":""}`)),te.on("slide",w=>{m("slide",`\u2192 ${w.slide}/${w.total} (${w.direction})`),It()}),te.on("build",w=>{m("build",`slide ${w.slide} step ${w.index}/${w.total} (${w.direction})`),It()}),window.addEventListener("error",w=>m("error",String(w.message)));function Ot(){if(Rt){Rt.remove(),Rt=null;return}Rt=document.createElement("div"),Rt.className="decklight-help",Rt.innerHTML=`<div class="help-card"><h3>Keyboard</h3><table>
|
|
228
312
|
<tr><td>\u2192 / Space</td><td>next build / slide</td></tr>
|
|
229
313
|
<tr><td>\u2190</td><td>previous</td></tr>
|
|
230
314
|
<tr><td>Home / End</td><td>first / last slide</td></tr>
|
|
@@ -238,6 +322,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
238
322
|
<tr><td>D</td><td>debug log</td></tr>
|
|
239
323
|
<tr><td>`</td><td>messages \u2014 the key left of 1 (\u2303` / \u2325` also works while editing notes)</td></tr>
|
|
240
324
|
<tr><td>C</td><td>captions (follow the voice)</td></tr>
|
|
325
|
+
<tr><td>W</td><td>pen \u2014 draw on the slide (\u232B clears)</td></tr>
|
|
326
|
+
<tr><td>\u21E7W</td><td>laser pointer</td></tr>
|
|
241
327
|
<tr><td>K</td><td>clock \u2014 wall time + elapsed talk</td></tr>
|
|
242
328
|
<tr><td>H</td><td>progress bar \u2014 position in the deck, bottom edge</td></tr>
|
|
243
329
|
<tr><td>P</td><td>pause / resume narration</td></tr>
|
|
@@ -245,39 +331,26 @@ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error
|
|
|
245
331
|
<tr><td>T</td><td>theme picker (type to filter)</td></tr>
|
|
246
332
|
<tr><td>/</td><td>command palette (find, themes, everything)</td></tr>
|
|
247
333
|
<tr><td>G</td><td>slide finder (live preview)</td></tr>
|
|
248
|
-
<tr><td>
|
|
334
|
+
<tr><td>R</td><td>restore a version (author mode \u2014 git history, live preview)</td></tr>
|
|
335
|
+
<tr><td>E</td><td>element edit mode \u2014 right-click a slide element (author mode)</td></tr>
|
|
249
336
|
<tr><td>, / .</td><td>cycle theme</td></tr>
|
|
250
337
|
<tr><td>[ / ]</td><td>cycle font</td></tr>
|
|
251
|
-
<tr><td>L / \u21E7L</td><td>slide layout \u2014 writes the file (
|
|
252
|
-
<tr><td>Z / \u21E7Z</td><td>undo / redo deck edits (
|
|
253
|
-
<tr><td>A</td><td>ask an AI agent to edit the deck (
|
|
338
|
+
<tr><td>L / \u21E7L</td><td>slide layout \u2014 writes the file (author mode)</td></tr>
|
|
339
|
+
<tr><td>Z / \u21E7Z</td><td>undo / redo deck edits (author mode)</td></tr>
|
|
340
|
+
<tr><td>A</td><td>ask an AI agent to edit the deck (author mode)</td></tr>
|
|
254
341
|
<tr><td>\u2303T</td><td>generate a theme (repeat to re-roll)</td></tr>
|
|
255
342
|
<tr><td>\u2303\u21E7T</td><td>save the generated theme</td></tr>
|
|
256
|
-
<tr><td>?</td><td>this help</td></tr></table></div>`,St.addEventListener("click",Ys),p.appendChild(St)}let fi=s=>s.code==="Backquote"||s.key==="`"||s.key==="~"||s.key==="\xB2";function nl(s){if(fi(s)&&(s.metaKey||s.ctrlKey||s.altKey)){Yn(),s.preventDefault();return}if(!/^(input|textarea|select)$/i.test(s.target.tagName)){if(s.ctrlKey&&!s.metaKey&&!s.altKey&&(s.key==="T"||s.key==="t")){s.shiftKey?Q():U&&me[Ne]===L?Ae():T(),s.preventDefault();return}if(!(s.metaKey||s.ctrlKey||s.altKey)){if(U){switch(s.key){case"ArrowDown":Et(Ne+1,!1);break;case"ArrowUp":Et(Ne-1,!1);break;case"Enter":ti();break;case"Backspace":Ds(S.slice(0,-1));break;case"Escape":S?Ds(""):te&&O!=="packs"?qt("packs"):Mt();break;default:if(s.key.length===1&&/[a-z0-9-]/i.test(s.key)){Ds(S+s.key);break}return}s.preventDefault();return}if(qe){switch(s.key){case"ArrowDown":bn(Kt+1);break;case"ArrowUp":bn(Kt-1);break;case"Enter":ri();break;case"Backspace":Oe=Oe.slice(0,-1),mn();break;case"Escape":Oe?(Oe="",mn()):Kn();break;default:if(s.key.length===1){Oe+=s.key,mn();break}return}s.preventDefault();return}if(Ge){switch(s.key){case"ArrowDown":Wn(Wt+1);break;case"ArrowUp":Wn(Wt-1);break;case"Enter":jn(Wt),yn();break;case"Escape":yn();break;default:return}s.preventDefault();return}if(st){s.key==="Escape"&&(xn(),s.preventDefault());return}if(it){s.key==="Escape"&&(An(),s.preventDefault());return}if(rt){s.key==="Escape"&&(Jt(),s.preventDefault());return}if(Ye){if(s.key==="Escape")wr();else if(s.key==="Enter")kr==="confirm"?Yi():kr!=="progress"&&wr();else return;s.preventDefault();return}if(Re){if(bt==="custom"){s.key==="Enter"?(Ki(),s.preventDefault()):s.key==="Escape"&&(is(),s.preventDefault());return}switch(s.key){case"ArrowDown":Cn(en+1);break;case"ArrowUp":Cn(en-1);break;case"Enter":Bi();break;case"Escape":is();break;case"n":case"N":Tt();break;default:return}s.preventDefault();return}if(Ee){switch(s.key){case"ArrowDown":Gt(Lt+1,!1);break;case"ArrowUp":Gt(Lt-1,!1);break;case"Enter":si();break;case"Backspace":fn(_t.slice(0,-1));break;case"Escape":_t?fn(""):gn();break;default:if(s.key.length===1){fn(_t+s.key);break}return}s.preventDefault();return}if(Ie){switch(s.key){case"ArrowRight":wn(xt+1);break;case"ArrowLeft":wn(xt-1);break;case"ArrowDown":wn(xt+ci());break;case"ArrowUp":wn(xt-ci());break;case"Enter":case" ":el();break;case"o":case"O":case"Escape":Zt();break;default:return}s.preventDefault();return}if(fi(s)){Yn(),s.preventDefault();return}switch(s.key){case"ArrowRight":case" ":case"PageDown":v.next();break;case"ArrowLeft":case"PageUp":v.prev();break;case"Home":v.goto(1,0);break;case"End":v.goto(v.state.totalSlides,0);break;case"o":case"O":Zt();break;case"b":case"B":di();break;case"d":case"D":pi();break;case"c":case"C":Ni();break;case"k":case"K":cr();break;case"h":case"H":dr();break;case"p":case"P":Si();break;case"g":case"G":Gn();break;case"e":case"E":An();break;case"f":case"F":js();break;case"v":case"V":s.shiftKey?Xi():_n();break;case"n":case"N":Rn();break;case"s":case"S":{let l=v.__speakerWin;l&&!l.closed?l.__decklightSpeakerToggle?.():v.__speakerWin=Wr(v);break}case"t":case"T":Ps();break;case"/":Vo();break;case".":Te(1);break;case",":Te(-1);break;case">":Jn(.25);break;case"<":Jn(-.25);break;case"]":qs(1);break;case"[":qs(-1);break;case"l":case"L":Ks(s.shiftKey?-1:1);break;case"z":case"Z":pr(s.shiftKey?"redo":"undo");break;case"a":case"A":Jt();break;case"?":Ys();break;case"Escape":if(V())break;Ie&&Zt();break;default:return}s.preventDefault()}}}r||document.addEventListener("keydown",nl);let Xn=null;p.addEventListener("touchstart",s=>{Xn=s.touches[0].clientX},{passive:!0}),p.addEventListener("touchend",s=>{if(Xn==null)return;let l=s.changedTouches[0].clientX-Xn;Math.abs(l)>40&&(l<0?v.next():v.prev()),Xn=null},{passive:!0});function gi(){let s=p.getBoundingClientRect(),l=Math.min(s.width/n.width,s.height/n.height)||1;v._scale=l,ze.style.transform=`translate(-50%, -50%) scale(${l})`}r||(new ResizeObserver(gi).observe(p),gi());let Xs=!1;n.hash&&!r&&window.addEventListener("hashchange",()=>{if(Xs)return;let s=li();s&&v.goto(s.slide,s.step,{force:!0})}),v.sync(),r&&Ze&&(v._sections.forEach(s=>{s.hasAttribute("data-logo")||s.appendChild(Ze.cloneNode(!0))}),Ze.remove()),document.fonts?.ready?.then(()=>{(un===v||!un)&&Cs(v._sections,n)}),v.theme=s=>fe(s),v.themePicker={open:Ps,close:Mt},v.generateTheme=T,v.cycleFont=qs,v.cycleLayout=Ks,v.layoutRing=ai,v.toggleNarration=_n,v.toggleMessages=Yn,v.messages=he;let mi="decklight-narration:"+location.pathname,Qs=n.narration?.liveUrl??"http://127.0.0.1:8787/tts",bi=[["Zephyr","bright"],["Puck","upbeat"],["Charon","informative"],["Kore","firm"],["Fenrir","excitable"],["Leda","youthful"],["Orus","firm"],["Aoede","breezy"],["Callirrhoe","easy-going"],["Autonoe","bright"],["Enceladus","breathy"],["Iapetus","clear"],["Umbriel","easy-going"],["Algieba","smooth"],["Despina","smooth"],["Erinome","clear"],["Algenib","gravelly"],["Rasalgethi","informative"],["Laomedeia","upbeat"],["Achernar","soft"],["Alnilam","firm"],["Schedar","even"],["Gacrux","mature"],["Pulcherrima","forward"],["Achird","friendly"],["Zubenelgenubi","casual"],["Vindemiatrix","gentle"],["Sadachbia","lively"],["Sadaltager","knowledgeable"],["Sulafat","warm"]],sl=Qs.replace(/\/tts\/?$/,"/ping"),Js=bi,er=!0,yi=null,ki=null;function rl(){return ki??=fetch(sl).then(s=>s.ok?s.json():null).then(s=>s?(yi=s.engine??null,Array.isArray(s.voices)&&s.voices.length&&(Js=s.voices),er=s.stylable!==!1,d("tts",`bridge: ${s.engine} \xB7 ${s.model} \xB7 ${Js.length} voice(s)`+(er?"":" \xB7 no style")),s):null).catch(()=>null),ki}let Qn=[["Warm senior engineer","Read in a warm, welcoming tone, like a friendly battle-hardened senior engineer who is still curious about new technology."],["Professional","Read in a clear, professional tone \u2014 measured, confident, and articulate."],["Too serious","Read in an extremely grave, deadly serious tone, as if announcing news of the utmost importance."],["Joyful","Read in a joyful, light-hearted tone, smiling through every sentence."],["Super excited","Read in a super-excited, high-energy tone, barely containing your enthusiasm."],["Sad","Read in a somber, melancholic tone, on the verge of a sigh."]],$t=(()=>{let s=n.narration?.files;return s?Array.isArray(s)?s:[{label:"Narration",dir:s}]:[]})(),vi={live:!0},pe={voice:"Alnilam",tone:Qn[0][0],style:Qn[0][1]},ue=$t[0]??null;try{let s=JSON.parse(localStorage.getItem(mi));if(s?.live?.voice)pe=s.live,ue=vi;else{let l=$t.find(u=>u.dir===s?.dir);l&&(ue=l)}}catch{}let be=!1,ye=null,wi=!1,Ei="decklight-narr-rate:"+location.pathname,Ve=1;try{let s=parseFloat(localStorage.getItem(Ei)??"");s>=.25&&s<=2&&(Ve=s)}catch{}function Jn(s){Ve=Math.round(Math.min(2,Math.max(.25,Ve+s))*100)/100;try{localStorage.setItem(Ei,String(Ve))}catch{}ye&&(ye.playbackRate=Ve),M(`voice speed ${Ve}\xD7`),d("narr",`rate ${Ve}\xD7`),Yt()}let oe=Ro({root:p,config:n,debugLog:d,toast:M}),Ot=new Map;function tr(s){return(v._sections?.[s-1]?.querySelector("aside.notes")?.textContent??"").replace(/⟨CLICK⟩/g," ").replace(/\s+/g," ").trim()}function pt(s){return(v._sections?.[s-1]?.querySelector("aside.notes")?.textContent??"").split("\u27E8CLICK\u27E9").map(u=>u.replace(/\s+/g," ").trim())}function il(s,l,u){if(!s)return Promise.resolve(null);if(!Ot.has(l)){let h=(async()=>{let f=Date.now();try{let g=await fetch(Qs,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:s,voice:pe.voice,style:pe.style})});if(!g.ok)throw new Error(String(g.status));let w=await g.blob(),b=parseFloat(g.headers?.get?.("x-tts-cost")??"")||0;return b&&(c+=b),d("tts",`${u} \xB7 ${pe.voice} \xB7 ${s.length} chars \u2192 ${((Date.now()-f)/1e3).toFixed(1)}s`+(b?` \xB7 ~$${b.toFixed(4)}`:"")),{url:URL.createObjectURL(w),blob:w}}catch(g){throw d("tts",`${u} \xB7 ${pe.voice} FAILED after ${((Date.now()-f)/1e3).toFixed(1)}s (${String(g.message||g)})`),g}})();h.catch(()=>{Ot.get(l)===h&&Ot.delete(l)}),Ot.set(l,h)}return Ot.get(l)}function Xt(s){return((s??"").match(/[^.!?…]+[.!?…]+[”’"')\]]*|[^.!?…]+$/g)??[]).map(l=>l.trim()).filter(Boolean)}let Qt=(s,l,u)=>`${s}|s${l}|n${u}|${pe.voice}|${pe.style}`;function es(s,l,u){let h=Xt(pt(s)[l])[u]??"";return il(h,Qt(s,l,u),`slide ${s} seg ${l} #${u+1}`)}let _i=s=>v._sections[s-1]?.dataset.narration==="hold",al=10,ol=3,nr=0;function ll(s){let l=[],u=v.state.slide,h=v.state.step;for(;l.length<s&&u<=v.state.totalSlides;){let f=pt(u),g=v._records[u-1]?v._records[u-1].groups.length:0;for(;h<=g&&l.length<s;h++){let w=Xt(f[h]).length;for(let b=0;b<w&&l.length<s;b++)l.push([u,h,b])}u+=1,h=0}return l}async function cl(){let s=++nr,l=async()=>{for(;s===nr&&be&&ue?.live;){let u=ll(al).find(([h,f,g])=>!Ot.has(Qt(h,f,g)));if(!u)return;try{if(await es(u[0],u[1],u[2]),oe.mode!=="off"){let[h,f,g]=u;oe.prefetchSentence(Qt(h,f,g),Ot.get(Qt(h,f,g)),Xt(pt(h)[f])[g]??"")}}catch{return}await new Promise(h=>setTimeout(h,30))}};await Promise.all(Array.from({length:ol},l))}let En=0,tt=!1,sr=!1,xi=0;function Si(){if(!be){M("narration is off \u2014 V starts it");return}tt=!tt,tt?ye?.pause():ye?.src&&ye.paused&&!ye.ended&&ye.currentTime>0?ye.play().catch(()=>{}):sr||rr(),M(tt?"\u23F8 narration paused \u2014 P resumes":"\u25B6 narration resumed"),d("narr",tt?"paused":"resumed"),Yt()}function Ti(s,l){if(!be||tt||!ue?.live||v.state.slide!==s||v.state.step!==l)return;let u=v._records[s-1];l<(u?u.groups.length:0)?v.next():!_i(s)&&s<v.state.totalSlides&&v.goto(s+1,0)}async function rr(){let s=v.state.slide,l=v.state.step,u=++En;if(cl(),!tr(s)){if(_i(s)){d("narr",`hold on slide ${s} \u2014 manual advance`);return}setTimeout(()=>{u!==En||!be||!ue?.live||v.state.slide===s&&s<v.state.totalSlides&&v.goto(s+1,0)},400);return}let h=pt(s);if(!h[l]){setTimeout(()=>{u===En&&Ti(s,l)},600);return}let f=Xt(h[l]),g=()=>u!==En||!be||v.state.slide!==s||v.state.step!==l;xi=u,sr=!0;let w=0;try{for(let b=0;b<f.length;b++){for(;tt;){if(g())return;await new Promise(Ke=>setTimeout(Ke,150))}if(g())return;let N;try{N=await es(s,l,b)}catch(Ke){d("narr",`sentence failed (slide ${s} seg ${l} #${b+1}) \u2014 narration stopped`),ns(dl(Ke));return}if(g())return;if(!N)continue;ir(f[b]),ye??=new Audio,oe.mode!=="off"&&(oe.attachAudio(ye),oe.beginSentence(Qt(s,l,b),N,f[b])),ye.src=N.url,ye.playbackRate=Ve;let ee=!1;if(await new Promise(Ke=>{ye.onended=Ke,ye.play().catch(()=>{ee=!0,Ke()})}),ee){ns("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}w++}if(g())return;if(!w&&f.length){ns("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}Ti(s,l)}finally{xi===u&&(sr=!1)}}function dl(s){let l=String(s?.message??s);return l.startsWith("429")?"\u{1F507} voice quota exceeded (429) \u2014 auto-advance stopped \xB7 a free engine: decklight dev --tts-engine chirp":/^\d{3}/.test(l)?`\u{1F507} voice bridge error ${l.slice(0,3)} \u2014 auto-advance stopped \xB7 press the key left of 1 for messages`:"\u{1F507} voice bridge unreachable \u2014 auto-advance stopped \xB7 start it with: decklight tts"}function ts(){if(!ue)return;if(ue.live)return rr();if(!tr(v.state.slide)){ye?.pause();return}ye??=new Audio;let s=`${ue.dir}/slide-${String(v.state.slide).padStart(2,"0")}.${ue.ext??"m4a"}`;ye.src=s,ye.playbackRate=Ve,oe.mode!=="off"&&(oe.attachAudio(ye),oe.beginSlide(ue,v.state.slide)),ye.onerror=()=>{d("narr",`no audio: ${s}`),M(`\u{1F507} no narration for slide ${v.state.slide} (${s}) \xB7 press the key left of 1 for messages`)},ye.play().catch(()=>{M("\u{1F507} the browser blocked audio \u2014 click the deck once, then V")})}function ns(s="narration off"){be=!1,En++,nr++,tt=!1,ye?.pause(),oe.stop(),M(s),d("narr",s),Zs()}function _n(){if(!ue){Rn($t.length?"tracks":"voices");return}if(be)return ns();be=!0,wi=!1;let s=ue.live?`\u26A1 ${pe.voice} \xB7 ${pe.tone}`:ue.label;M(`\u{1F50A} ${s} \u2014 V stops \xB7 N picks`),d("narr",`on \u2014 ${s}`),ts(),Zs()}v.on("slide",()=>{be&&ts()}),v.on("build",()=>{be&&ue?.live&&rr()});let Ai="decklight-captions:"+location.pathname,ht=!1;try{ht=localStorage.getItem(Ai)==="1"}catch{}let nt=null;function ir(s){nt&&(nt.textContent=s,nt.classList.toggle("show",!!s))}function ar(){if(nt){if(be&&ue?.live){ir("");return}ir(pt(v.state.slide)[v.state.step]??"")}}function Ci(){nt=document.createElement("div"),nt.className="decklight-captions",nt.setAttribute("aria-live","polite"),p.appendChild(nt),ar()}function Ni(){ht=!ht;try{localStorage.setItem(Ai,ht?"1":"0")}catch{}ht?Ci():(nt?.remove(),nt=null),M(`captions ${ht?"on":"off"}`),d("narr",`captions ${ht?"on":"off"}`)}v.on("slide",ar),v.on("build",ar),ht&&!r&&Ci();let Ri="decklight-clock:"+location.pathname,ft=!1;try{ft=localStorage.getItem(Ri)==="1"}catch{}let gt=null,or=null,ss=null,Mi=!1,rs=s=>String(s).padStart(2,"0");function ul(s){let l=Math.floor(s/1e3),u=Math.floor(l/3600);return(u?u+":":"")+rs(Math.floor(l/60)%60)+":"+rs(l%60)}function lr(){if(!gt)return;let s=new Date;gt.querySelector(".clk-time").textContent=rs(s.getHours())+":"+rs(s.getMinutes()),gt.querySelector(".clk-elapsed").textContent="+"+ul(ss==null?0:Date.now()-ss)}function Li(){gt=document.createElement("div"),gt.className="decklight-clock",gt.innerHTML='<span class="clk-time"></span><span class="clk-elapsed"></span>',p.appendChild(gt),lr(),or=setInterval(lr,1e3)}function cr(){ft=!ft;try{localStorage.setItem(Ri,ft?"1":"0")}catch{}ft?Li():(clearInterval(or),or=null,gt?.remove(),gt=null),M(`clock ${ft?"on":"off"}`),d("nav",`clock ${ft?"on":"off"}`)}v.on("ready",()=>{Mi=!0});let $i=()=>{!Mi||ss!=null||(ss=Date.now(),lr())};v.on("slide",$i),v.on("build",$i),v.toggleClock=cr,ft&&!r&&Li();let Oi="decklight-progress:"+location.pathname,mt=!1;try{mt=localStorage.getItem(Oi)==="1"}catch{}let It=null;function Ii(){It=document.createElement("div"),It.className="decklight-progress",It.innerHTML='<div class="bar"></div>',p.appendChild(It),Vn=It.querySelector(".bar"),v._updateChrome()}function dr(){mt=!mt;try{localStorage.setItem(Oi,mt?"1":"0")}catch{}mt?Ii():(It?.remove(),It=null,Vn=null),M(`progress bar ${mt?"on":"off"}`),d("nav",`progress bar ${mt?"on":"off"}`)}v.toggleProgress=dr,mt&&!r&&Ii();function Di(){return(v._sections||[]).map((s,l)=>({n:l+1,title:s.querySelector("h1, h2, h3")?.textContent.trim()||`Slide ${l+1}`,segs:pt(l+1).filter(Boolean)}))}function ur(s){let l=(document.title||"Deck").trim(),u=s?[`# ${l} \u2014 transcript`,""]:[`${l} \u2014 transcript`,""];for(let{n:h,title:f,segs:g}of Di())if(g.length){u.push(s?`## ${h}. ${f}`:`${h}. ${f}`,"");for(let w of g)u.push(w,"")}return u.join(`
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
`),h.spellcheck=!1;let f=async()=>{try{let b=await fetch(Tn+"/edit/notes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:s,text:h.value})});if(!b.ok)throw new Error(await b.text());d("edit",`notes saved \u2014 slide ${s}`),M("notes saved \u2014 reloading")}catch(b){M(`save failed: ${String(b.message||b).slice(0,60)}`)}};h.addEventListener("keydown",b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)?(f(),b.preventDefault()):b.key==="Escape"&&(An(),b.preventDefault()),b.stopPropagation()});let g=document.createElement("div");g.className="tr-actions";let w=document.createElement("button");w.type="button",w.className="narr-prev-btn",w.textContent="\u{1F4BE} save to file",w.addEventListener("click",f),g.appendChild(w),l.append(u,h,g),it.appendChild(l),it.addEventListener("click",b=>{b.target===it&&An()}),p.appendChild(it),setTimeout(()=>h.focus(),0)}if(e.has("voiceover")&&ue&&!r){let s=()=>{window.removeEventListener("pointerdown",s),window.removeEventListener("keydown",s),be||_n()};window.addEventListener("pointerdown",s,{once:!0}),window.addEventListener("keydown",s,{once:!0})}if(!r){let s=document.createElement("div");s.className="decklight-touch-controls",ut=document.createElement("button"),ut.type="button",ut.className="decklight-touch-btn",ut.setAttribute("aria-label","Fullscreen"),ut.innerHTML=vn.full,ut.addEventListener("click",js),s.appendChild(ut),$t.length&&(et=document.createElement("button"),et.type="button",et.className="decklight-touch-btn",et.addEventListener("pointerdown",l=>l.stopPropagation()),et.addEventListener("click",()=>_n()),s.appendChild(et),Zs()),p.appendChild(s)}let Re=null,en=0,bt="tracks",xe=[],tn=null;function Pi(){try{localStorage.setItem(mi,JSON.stringify(ue?.live?{live:pe}:{dir:ue?.dir}))}catch{}}function hr(s,l){pe={voice:tn??pe.voice,tone:s,style:l},ue=vi,wi=!1,Pi(),Tt(),be||(be=!0),M(`\u26A1 live voice: ${pe.voice} \xB7 ${pe.tone} \u2014 V stops`),d("narr",`live config \u2014 ${pe.voice} \xB7 ${pe.tone}`),ts()}function Cn(s){xe.length&&(en=(s+xe.length)%xe.length,Re.querySelectorAll(".narr-row").forEach((l,u)=>l.classList.toggle("narr-sel",u===en)))}function Bi(){xe[en]?.commit()}function is(){bt==="custom"?We("tones"):bt==="tones"?We("voices"):bt==="charvideo"?We("character"):(bt==="voices"||bt==="character")&&$t.length?We("tracks"):Tt()}let fr=!1;function gr(s,l){oe.setMode(s,l),Tt(),M(s==="off"?"character off":s==="viseme"?`\u{1F3AD} character on \u2014 lips follow the narration${be?"":" \xB7 V starts it"}`:`\u{1F3A5} character video \u2014 ${oe.engine} \xB7 ${oe.portrait}${be?"":" \xB7 V starts narration"}`)}function Ui(s){if(oe.mode==="off"){M("turn the character on first \u2014 N \xB7 Character\u2026");return}oe.setSolo(s),Tt(),M(s?"\u{1F3AD} solo \u2014 the narrator has the stage \xB7 N brings the slides back":"solo off \u2014 the slides are back")}let Nn="Hey, this is Decklight",as=Nn,mr=null,Hi=new Map,os=new Map,br=null,yr=new Set;function hl(s){if(s===Nn)return Hi;if(s!==br){for(let l of os.values())l.then(u=>URL.revokeObjectURL(u)).catch(()=>{});os=new Map,br=s}return os}let zi=(s,l)=>`${s}|${l||""}`;function Fi(s,l,u,h=""){let f=zi(l,h);if(!s.has(f)){let g=(async()=>{let w=Date.now(),b=await fetch(Qs,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:u,voice:l,style:h})});if(!b.ok)throw new Error(String(b.status));let N=await b.blob(),ee=parseFloat(b.headers?.get?.("x-tts-cost")??"")||0;return ee&&(c+=ee),d("tts",`preview ${l}${h?" (styled)":""} \xB7 ${((Date.now()-w)/1e3).toFixed(1)}s`+(ee?` \xB7 ~$${ee.toFixed(4)}`:"")),URL.createObjectURL(N)})();g.catch(()=>{s.get(f)===g&&s.delete(f)}),s.set(f,g)}return s.get(f)}async function qi(s,l,u){let h=`${u}|${s}`;if(yr.has(h))return;yr.add(h);let f=s===Nn,g=f?Hi:os;try{d("narr",`preview prefetch ${u} (${f?"default":"custom"} sentence)`);for(let{voice:w,style:b}of l){if(!f&&br!==s)return;g.has(zi(w,b))||await Fi(g,w,s,b).catch(()=>{})}d("narr",`preview prefetch ${u} complete`)}finally{yr.delete(h)}}function Gi({voice:s,style:l="",prefetch:u},h){let f=as.trim();if(!f)return;let g=hl(f);h&&(h.textContent="\u2026"),Fi(g,s,f,l).then(w=>{h?.isConnected&&(h.textContent="\u25B6"),mr??=new Audio,mr.src=w,mr.play().catch(()=>{}),d("narr",`preview ${s}${l?" \xB7 styled":""}`),u==="voices"?qi(f,bi.map(([b])=>({voice:b,style:""})),"voices"):u==="tones"&&qi(f,Qn.map(([,b])=>({voice:s,style:b})),`tones:${s}`)}).catch(()=>{h?.isConnected&&(h.textContent="\u25B6"),M("live voice bridge unreachable \u2014 run: decklight tts"),d("narr",`preview ${s} failed`)})}function We(s){bt=s;let l=Re.querySelector(".narr-card");l.innerHTML="";let u=document.createElement("div");if(u.className="narr-head",l.appendChild(u),xe=[],s==="tracks")u.textContent="narration",$t.forEach(f=>xe.push({text:`\u{1F50A} ${f.label} (${f.dir}/)`,cur:f===ue,commit:()=>{ue=f,Pi(),Tt(),M(`\u{1F50A} track: ${f.label}`),be&&ts()}})),xe.push({text:"\u26A1 Live voice \u2014 synthesize on the fly\u2026",cur:ue?.live,commit:()=>We("voices")}),xe.push({text:"\u{1F9D1} Character \u2014 animated narrator\u2026",cur:oe.mode!=="off",commit:()=>We("character")});else if(s==="character"){u.textContent="character \u2014 an animated narrator lip-syncs the voice",fr||(fr=!0,oe.probe().then(()=>{Re&&bt==="character"&&We("character")}));let f=oe.bridgeInfo,g=f?.engines?.video??[];xe.push({text:"Off",cur:oe.mode==="off",commit:()=>gr("off")}),xe.push({text:`\u{1F3AD} 2D character \u2014 offline visemes${f?.engines?.viseme?"":' <span class="narr-flavor">bridge offline \u2014 amplitude fallback</span>'}`,html:!0,cur:oe.mode==="viseme",commit:()=>gr("viseme")}),xe.push({text:`\u{1F3A5} Neural video \u2014 local GPU${g.length?"\u2026":' <span class="narr-flavor">needs the bridge \u2014 run: decklight lipsync</span>'}`,html:!0,cur:oe.mode==="video",commit:()=>{g.length?We("charvideo"):M("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),oe.mode!=="off"&&xe.push({text:`${oe.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage <span class="narr-flavor">slide content steps aside</span>`,html:!0,cur:oe.solo,commit:()=>Ui(!oe.solo)})}else if(s==="charvideo"){u.textContent="neural video \u2014 pick engine \xB7 portrait";let f=oe.bridgeInfo;for(let g of f?.engines?.video??[])for(let w of f?.portraits?.length?f.portraits:["default"])xe.push({text:`\u{1F3A5} ${g} \xB7 ${w}`,cur:oe.mode==="video"&&oe.engine===g&&oe.portrait===w,commit:()=>gr("video",{engine:g,portrait:w})})}else if(s==="voices"){u.textContent="live voice \u2014 pick a voice \xB7 \u25B6 previews";let f=document.createElement("div");f.className="narr-preview-row";let g=document.createElement("input");g.className="narr-input narr-preview-text",g.value=as,g.placeholder="Preview sentence",g.setAttribute("aria-label","Preview sentence"),g.addEventListener("input",()=>{as=g.value}),g.addEventListener("keydown",b=>{b.key==="Escape"&&(is(),b.preventDefault()),b.stopPropagation()});let w=document.createElement("button");w.type="button",w.className="narr-prev-btn narr-reset-btn",w.textContent="\u21BA",w.title="restore the default sentence",w.setAttribute("aria-label","restore the default preview sentence"),w.addEventListener("click",b=>{b.stopPropagation(),as=Nn,g.value=Nn}),f.append(g,w),l.appendChild(f),Js.forEach(([b,N])=>xe.push({text:`${b} <span class="narr-flavor">${N}</span>`,html:!0,preview:{voice:b,style:"",prefetch:"voices"},cur:ue?.live&&pe.voice===b,commit:()=>{if(tn=b,er)return We("tones");hr(yi??"plain","")}}))}else if(s==="tones")u.textContent=`live voice \xB7 ${tn??pe.voice} \u2014 pick a tone \xB7 \u25B6 previews`,Qn.forEach(([f,g])=>xe.push({text:f,preview:{voice:tn??pe.voice,style:g,prefetch:"tones"},cur:ue?.live&&pe.tone===f,commit:()=>hr(f,g)})),xe.push({text:"Custom\u2026",cur:ue?.live&&pe.tone==="Custom",commit:()=>We("custom")});else{u.textContent=`live voice \xB7 ${tn??pe.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let f=document.createElement("div");f.className="narr-preview-row";let g=document.createElement("input");g.className="narr-input",g.value=pe.style,g.placeholder="Read in a \u2026",g.addEventListener("keydown",b=>{b.key==="Enter"?(Ki(),b.preventDefault()):b.key==="Escape"&&(is(),b.preventDefault()),b.stopPropagation()});let w=document.createElement("button");w.type="button",w.className="narr-prev-btn narr-reset-btn",w.textContent="\u25B6",w.title="preview this delivery instruction",w.setAttribute("aria-label","preview this delivery instruction"),w.addEventListener("click",b=>{b.stopPropagation();let N=g.value.trim();N&&Gi({voice:tn??pe.voice,style:N},w)}),f.append(g,w),l.appendChild(f),setTimeout(()=>{g.focus(),g.select()},0),xe=[],en=0;return}xe.forEach((f,g)=>{let w=document.createElement("div");w.className="narr-row"+(f.cur?" narr-cur":"");let b=document.createElement("span");if(b.className="narr-row-label",f.html?b.innerHTML=f.text:b.textContent=f.text,w.appendChild(b),f.preview){let N=document.createElement("button");N.type="button",N.className="narr-prev-btn",N.textContent="\u25B6",N.title=`preview ${f.preview.voice}`,N.setAttribute("aria-label",`preview ${f.preview.voice}`),N.addEventListener("click",ee=>{ee.stopPropagation(),Gi(f.preview,N)}),w.appendChild(N)}w.addEventListener("mouseenter",()=>Cn(g)),w.addEventListener("click",()=>{Cn(g),Bi()}),l.appendChild(w)});let h=xe.findIndex(f=>f.cur);Cn(Math.max(0,h)),Re.querySelector(".narr-sel")?.scrollIntoView({block:"nearest"})}function Ki(){let s=Re?.querySelector(".narr-input")?.value.trim();s&&hr("Custom",s)}function Rn(s){if(Re&&s===void 0)return Tt();Re||(Re=document.createElement("div"),Re.className="decklight-narr",Re.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',Re.addEventListener("click",l=>{l.target===Re&&Tt()}),p.appendChild(Re)),We(s??($t.length?"tracks":"voices")),rl().then(l=>{l&&Re&&bt==="voices"&&We("voices")})}function Tt(){Re?.remove(),Re=null,fr=!1}let Ye=null,kr="confirm",yt=0;function Wi(){let s=[];for(let l=1;l<=v.state.totalSlides;l++)tr(l)&&s.push(l);return s}function ji(s){let l=Math.round(s/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m${String(l%60).padStart(2,"0")}s`}function vr(s,l){let u=document.createElement("a");u.href=s,u.download=l,document.body.appendChild(u),u.click(),u.remove()}function ls(s,l={}){kr=s;let u=Ye.querySelector(".narr-card");if(s==="confirm"){let h=l.total;u.innerHTML=`<div class="narr-head">record offline narration</div>
|
|
262
|
-
|
|
263
|
-
<div class="rec-line">${h} slide${h===1?"":"s"} stitched from the sentence cache \u2014 only unheard sentences synthesize</div>
|
|
264
|
-
<div class="narr-row narr-sel">Start recording</div>
|
|
265
|
-
<div class="rec-hint">Enter to start \xB7 Esc to cancel</div>`,u.querySelector(".narr-row").addEventListener("click",Yi)}else if(s==="progress"){let{done:h,total:f,elapsedMs:g}=l,w=f?Math.round(h/f*100):0,b=h?ji(g/h*(f-h)):"\u2026";u.innerHTML=`<div class="narr-head">recording\u2026</div>
|
|
266
|
-
<div class="rec-bar"><div class="rec-bar-fill" style="width:${w}%"></div></div>
|
|
267
|
-
<div class="rec-line">${h} / ${f} slides \xB7 ${ji(g)} elapsed \xB7 ~${b} left</div>
|
|
268
|
-
<div class="rec-hint">Esc to cancel</div>`}else{let{saved:h,total:f,cancelled:g}=l;u.innerHTML=`<div class="narr-head">${g?"recording cancelled":"recording done"}</div>
|
|
269
|
-
<div class="rec-line">${h} / ${f} slide${f===1?"":"s"} saved as slide-NN.wav to your downloads</div>
|
|
270
|
-
<div class="rec-line">Point <code>narration.files</code> at that folder with <code>ext: 'wav'</code> to play them back without the bridge.</div>
|
|
271
|
-
<div class="rec-hint">Enter or Esc to close</div>`}}let Zi=.15,Vi=.35;function fl(s,l){let u=s.reduce((g,w)=>g+w.length,0),h=new DataView(new ArrayBuffer(44)),f=(g,w)=>{for(let b=0;b<w.length;b++)h.setUint8(g+b,w.charCodeAt(b))};return f(0,"RIFF"),h.setUint32(4,36+u,!0),f(8,"WAVE"),f(12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,1,!0),h.setUint32(24,l,!0),h.setUint32(28,l*2,!0),h.setUint16(32,2,!0),h.setUint16(34,16,!0),f(36,"data"),h.setUint32(40,u,!0),new Blob([h.buffer,...s],{type:"audio/wav"})}let gl=(s,l)=>new Uint8Array(2*Math.round(s*l));async function ml(s,l){let u=v._records[s-1],h=u?u.groups.length:0,f=pt(s),g=[],w=24e3;for(let b=0;b<=h;b++){let N=Xt(f[b]);for(let ee=0;ee<N.length;ee++){let Ke=await es(s,b,ee);if(l!==yt)return null;if(!Ke)continue;let Qi=await Ke.blob.arrayBuffer();g.length===0?w=new DataView(Qi).getUint32(24,!0)||24e3:g.push(gl(w,ee===0?Vi:Zi)),g.push(new Uint8Array(Qi.slice(44)))}}return g.length?fl(g,w):null}async function bl(s,l){if(oe.mode!=="viseme")return null;let u=v._records[s-1],h=u?u.groups.length:0,f=pt(s),g=[];try{for(let w=0;w<=h;w++){let b=Xt(f[w]);for(let N=0;N<b.length;N++){let ee=await oe.ensureTimeline(Qt(s,w,N),es(s,w,N),b[N]);if(l!==yt)return null;ee&&g.push({timeline:ee,gap:g.length?N===0?Vi:Zi:0})}}}catch{return d("lipsync",`slide ${s}: viseme sidecar skipped (bridge unreachable)`),null}return g.length?No(g):null}async function Yi(){let s=Wi(),l=++yt,u=Date.now(),h=0,f=0;ls("progress",{done:h,total:s.length,elapsedMs:0});for(let g of s){if(l!==yt)return;try{let w=await ml(g,l);if(l!==yt)return;if(w){let b=URL.createObjectURL(w);vr(b,`slide-${String(g).padStart(2,"0")}.wav`),setTimeout(()=>URL.revokeObjectURL(b),5e3),f++;let N=await bl(g,l);if(l!==yt)return;if(N){let ee=URL.createObjectURL(new Blob([JSON.stringify(N)],{type:"application/json"}));vr(ee,`slide-${String(g).padStart(2,"0")}.visemes.json`),setTimeout(()=>URL.revokeObjectURL(ee),5e3)}}}catch{M(`slide ${g}: recording failed`)}h++,l===yt&&ls("progress",{done:h,total:s.length,elapsedMs:Date.now()-u})}l===yt&&ls("done",{saved:f,total:s.length})}function Xi(){if(!ue?.live){M("live voice only \u2014 pick a voice with N first");return}Ye||(Ye=document.createElement("div"),Ye.className="decklight-narr decklight-record",Ye.innerHTML='<div class="narr-card" role="dialog" aria-label="Record offline narration"></div>',Ye.addEventListener("click",s=>{s.target===Ye&&wr()}),p.appendChild(Ye),ls("confirm",{total:Wi().length}))}function wr(){yt++,Ye?.remove(),Ye=null}if(v.saveGeneratedTheme=s=>Q(s),r)return p.classList.add("decklight-print"),v._sections.forEach((s,l)=>{s.classList.add("active"),At(v._records[l],v._records[l].groups.length)}),requestAnimationFrame(()=>v._sections.forEach((s,l)=>Ns(s,l+1))),p.__decklight=v,un=v,v._emit("ready",{slides:v.state.totalSlides,print:!0}),v;let Er=n.hash&&li()||{slide:1,step:0};return v._sections.forEach((s,l)=>{l!==Er.slide-1&&At(v._records[l],0)}),v.goto(Er.slide,Er.step,{force:!0}),p.__decklight=v,un=v,v._emit("ready",{slides:v.state.totalSlides}),v}I();D();I();D();var Xr="\x1B",Ms=Object.freeze({fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1});function Vd(t){if(t<16)return null;if(t>=16&&t<=231){let n=t-16,r=[0,95,135,175,215,255];return[r[Math.floor(n/36)%6],r[Math.floor(n/6)%6],r[n%6]]}let e=8+(t-232)*10;return[e,e,e]}function wt(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var pn=class{constructor(){this.rows=[[]],this.row=0,this.col=0,this.style={...Ms},this._pending=""}write(e){let n=this._pending+e;this._pending="";let r=0;for(;r<n.length;){let i=n[r];if(i===Xr){let a=this._consumeEscape(n,r);if(a===0){this._pending=n.slice(r);return}r+=a;continue}if(r+=1,i===`
|
|
272
|
-
`){this._lineFeed();continue}if(i==="\r"){this.col=0;continue}if(i==="\b"){this.col=Math.max(0,this.col-1);continue}if(i===" "){this.col=(Math.floor(this.col/8)+1)*8;continue}i!=="\x07"&&(i<" "&&i!==" "||this._putChar(i))}}_lineFeed(){this.row+=1,this.rows[this.row]||(this.rows[this.row]=[])}_putChar(e){let n=this.rows[this.row];for(;n.length<this.col;)n.push({ch:" ",style:Ms});n[this.col]={ch:e,style:{...this.style}},this.col+=1}_consumeEscape(e,n){if(n+1>=e.length)return 0;let r=e[n+1];if(r==="["){let i=n+2;for(;i<e.length;){let a=e.charCodeAt(i);if(a>=64&&a<=126)return this._handleCsi(e.slice(n+2,i),e[i]),i-n+1;i+=1}return 0}if(r==="]"){let i=n+2;for(;i<e.length;){if(e[i]==="\x07")return i-n+1;if(e[i]===Xr&&e[i+1]==="\\")return i-n+2;if(e[i]===Xr&&i+1>=e.length)return 0;i+=1}return 0}return r==="("||r===")"?n+2<e.length?3:0:2}_handleCsi(e,n){if(!e.startsWith("?"))switch(n){case"m":this._sgr(e);return;case"K":this._eraseLine(e);return;case"C":this.col+=Math.max(1,parseInt(e||"1",10)||1);return;case"D":this.col=Math.max(0,this.col-Math.max(1,parseInt(e||"1",10)||1));return;default:return}}_eraseLine(e){let n=parseInt(e||"0",10)||0,r=this.rows[this.row];if(n===0){r.length=Math.min(r.length,this.col);return}if(n===1){for(let i=0;i<=Math.min(this.col,r.length-1);i++)r[i]={ch:" ",style:Ms};return}if(n===2){r.length=0;return}}_sgr(e){let n=e===""?[0]:e.split(";").map(i=>parseInt(i,10)||0),r=0;for(;r<n.length;){let i=n[r];if(i===0)this.style={...Ms};else if(i===1)this.style.bold=!0;else if(i===2)this.style.dim=!0;else if(i===3)this.style.italic=!0;else if(i===4)this.style.underline=!0;else if(i===7)this.style.inverse=!0;else if(i===22)this.style.bold=!1,this.style.dim=!1;else if(i===23)this.style.italic=!1;else if(i===24)this.style.underline=!1;else if(i===27)this.style.inverse=!1;else if(i>=30&&i<=37)this.style.fg={type:"ansi",idx:i-30};else if(i>=90&&i<=97)this.style.fg={type:"ansi",idx:i-90+8};else if(i===39)this.style.fg=null;else if(i>=40&&i<=47)this.style.bg={type:"ansi",idx:i-40};else if(i>=100&&i<=107)this.style.bg={type:"ansi",idx:i-100+8};else if(i===49)this.style.bg=null;else if(i===38||i===48){let a=i===38?"fg":"bg";n[r+1]===5&&n.length>r+2?(this.style[a]={type:"256",idx:n[r+2]},r+=2):n[r+1]===2&&n.length>r+4&&(this.style[a]={type:"rgb",r:n[r+2],g:n[r+3],b:n[r+4]},r+=4)}r+=1}}get lines(){return this.rows.map(e=>{let n=[];for(let r of e){let i=n[n.length-1];i&&Yd(i.style,r.style)?i.text+=r.ch:n.push({text:r.ch,style:r.style})}return n})}toHtml(){return this.lines.map(e=>Qd(e)).join(`
|
|
273
|
-
`)}};function Yd(t,e){return t.bold===e.bold&&t.dim===e.dim&&t.italic===e.italic&&t.underline===e.underline&&t.inverse===e.inverse&&Po(t.fg,e.fg)&&Po(t.bg,e.bg)}function Po(t,e){return t===e?!0:!t||!e?!1:t.type===e.type&&t.idx===e.idx&&t.r===e.r&&t.g===e.g&&t.b===e.b}function Xd(t){if(t.type==="256"){if(t.idx<16)return null;let[e,n,r]=Vd(t.idx);return`rgb(${e},${n},${r})`}return t.type==="rgb"?`rgb(${t.r},${t.g},${t.b})`:null}function Qd(t){return t.map(({text:e,style:n})=>{let r=[],i=[],{fg:a,bg:o}=n;n.inverse&&([a,o]=[o??{type:"inv-default-bg"},a??{type:"inv-default-fg"}]);for(let[m,_]of[[a,"fg"],[o,"bg"]])if(m)if(m.type==="ansi"||m.type==="256"&&m.idx<16)r.push(`ansi-${_}-${m.idx}`);else if(m.type==="inv-default-bg")r.push("ansi-inv-fg");else if(m.type==="inv-default-fg")r.push("ansi-inv-bg");else{let y=Xd(m);y&&i.push(`${_==="fg"?"color":"background-color"}:${y}`)}n.bold&&r.push("ansi-bold"),n.dim&&r.push("ansi-dim"),n.italic&&r.push("ansi-italic"),n.underline&&r.push("ansi-underline");let c=wt(e);if(!r.length&&!i.length)return c;let d=r.length?` class="${r.join(" ")}"`:"",p=i.length?` style="${i.join(";")}"`:"";return`<span${d}${p}>${c}</span>`}).join("")}var Bo=24,Jd=t=>Math.max(1,Math.min(10,t)),eu=t=>2**((t-5)/2.5),Uo=55,Hn=[120,160],Ho="decklight-term-wpm:"+location.pathname,tu=t=>Hn.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e),Bn=["creamy","clacky","thocky","off"],zo="decklight-term-typesound:"+location.pathname,Fo="decklight-term-fontsize:"+location.pathname,Un=[.75,.9,1,1.15,1.35,1.6],qo={thocky:{click:.17,clickF:[680,1250],clickQ:.9,lp:1800,clickDecay:[.012,.017],thump:.008,thumpF:[130,185],thumpF2:[58,85],thumpF2Prob:.22,ring:[.005,.009]},creamy:{click:.3,clickF:[1400,2850],clickQ:.95,lp:3800,clickDecay:[.007,.011],thump:.0056,thumpF:[60,110],ring:[.065,.095]},clacky:{click:.34,clickF:[2300,3900],clickQ:1.1,lp:6800,clickDecay:[.005,.008],thump:.003,thumpF:[90,140],ring:[.035,.055]}};function Qr(t){let e=90+Math.random()*120;return Math.random()<.15&&(e+=Math.random()*240),t===" "?e+=70+Math.random()*220:".,:;/|&>-_=\"'`()".includes(t)&&(e+=40+Math.random()*140),Math.random()<.035&&(e+=300+Math.random()*440),e}var nu=.012,_e=null,Ls=null,Os=new Set,Go=t=>{Os.add(t),t.addEventListener("ended",()=>Os.delete(t),{once:!0})};function su(){if(!_e)return;let t=_e.currentTime;for(let e of Os)try{e.stop(t)}catch{}Os.clear()}function $s(t="",e="creamy",n=.12){try{let r=window.AudioContext||window.webkitAudioContext;if(!r)return;if(_e??=new r,_e.state==="suspended"&&_e.resume(),!Ls){let E=Math.floor(_e.sampleRate*.06);Ls=_e.createBuffer(1,E,_e.sampleRate);let H=Ls.getChannelData(0);for(let z=0;z<E;z++)H[z]=Math.random()*2-1}let i=qo[e]??qo.creamy,a=(E,H)=>E+Math.random()*(H-E),o=_e.currentTime+nu,c=t===" ",d=a(.45,1.3)*(c?1.25:1),p=a(...i.clickF)*(c?.7:1),m=a(...i.ring)*(c?1.5:1),_=(E,H,z,G)=>{let F=_e.createBufferSource();F.buffer=Ls;let Z=_e.createBiquadFilter();Z.type="bandpass",Z.frequency.value=z,Z.Q.value=i.clickQ;let J=_e.createBiquadFilter();J.type="lowpass",J.frequency.value=i.lp;let K=_e.createGain();K.gain.setValueAtTime(1e-4,E),K.gain.exponentialRampToValueAtTime(H,E+7e-4),K.gain.exponentialRampToValueAtTime(1e-4,E+G),F.connect(Z),Z.connect(J),J.connect(K),K.connect(_e.destination),F.start(E),F.stop(E+G+.01),Go(F)},y=(E,H,z,G)=>{let F=_e.createOscillator();F.type="sine",F.frequency.setValueAtTime(z,E),F.frequency.exponentialRampToValueAtTime(z*.6,E+G*.6);let Z=_e.createGain();Z.gain.setValueAtTime(1e-4,E),Z.gain.exponentialRampToValueAtTime(H,E+a(.003,.011)),Z.gain.exponentialRampToValueAtTime(H*.25,E+G),Z.gain.exponentialRampToValueAtTime(1e-4,E+G*2),F.connect(Z),Z.connect(_e.destination),F.start(E),F.stop(E+G*2+.01),Go(F)},k=i.thumpF2&&Math.random()<(i.thumpF2Prob??.4)?i.thumpF2:i.thumpF;_(o,i.click*d*(c?.82:1),p,a(...i.clickDecay)*(c?1.2:1)),y(o,i.thump*d*(c?2.4:1),a(...k)*(c?.7:1),m);let A=o+Math.max(.01,Math.min(a(.035,.08),n*.55));_(A,i.click*d*a(.35,.55),p*1.15,a(...i.clickDecay)*.8),y(A,i.thump*d*(c?.5:.25),a(...k)*(c?.7:1),m*.6)}catch{}}function ru(){try{let t=window.AudioContext||window.webkitAudioContext;if(!t)return;_e??=new t,_e.state==="suspended"&&_e.resume()}catch{}}var Ko=!1;function iu(){if(Ko||typeof document>"u")return;Ko=!0;let t=()=>{ru(),document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",t,!0)};document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",t,!0)}function ei(t,e=document){let n=[...e.querySelectorAll(".terminal[data-cast], .terminal[data-cast-inline]")];return n.length&&iu(),Promise.all(n.map(r=>au(r,t).catch(i=>{du(r,i)})))}async function au(t,e){if(t.dataset.decklightTerminal)return;t.dataset.decklightTerminal="1";let n,r,i=t.dataset.castInline;if(i){r=i;let d=document.querySelector(i);if(!d&&document.readyState==="loading"&&(await new Promise(p=>document.addEventListener("DOMContentLoaded",p,{once:!0})),d=document.querySelector(i)),!d)throw new Error(`inline cast not found: ${i}`);n=d.textContent}else{r=t.dataset.cast;let d=await fetch(r);if(!d.ok)throw new Error(`failed to load cast: ${r} (${d.status})`);n=await d.text()}let a=ou(n,r),o=new Jr(t,a);t._decklightTerminal=o;let c=t.dataset.mode||"step";a.imported&&c==="step"&&!a.hasMarkers&&(c="play"),c==="play"?o.mountPlayMode():o.mountStepMode(e)}function ou(t,e){let n=null;try{n=JSON.parse(t)}catch{}if(n){if(n.decklightCast===1&&Array.isArray(n.steps))return n;throw new Error(`not a decklight cast (v1): ${e}`)}return lu(t,e)}function lu(t,e){let n=t.split(`
|
|
274
|
-
`).filter(d=>d.trim()),r;try{r=JSON.parse(n[0])}catch{r=null}if(!r||r.version!==2)throw new Error(`not a decklight cast or asciicast v2: ${e}`);let i=[],a={cmd:"",raw:!0,output:[]},o=0,c=!1;for(let d of n.slice(1)){let p;try{p=JSON.parse(d)}catch{continue}if(!Array.isArray(p)||p.length<3)continue;let[m,_,y]=p;_==="m"?(c=!0,a.output.length&&i.push(a),a={cmd:String(y||""),raw:!0,output:[]},o=m):_==="o"&&a.output.push([Math.max(0,cu(m-o)),y])}if(a.output.length&&i.push(a),!i.length)throw new Error(`asciicast has no output events: ${e}`);return{decklightCast:1,imported:!0,hasMarkers:c,meta:{cols:r.width||100,rows:r.height||28,prompt:""},steps:i}}function cu(t){return Math.round(t*1e3)/1e3}function du(t,e){t.innerHTML=`<div class="terminal-window terminal-broken"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">terminal</span></div><div class="terminal-screen"><pre class="terminal-lines">\u26A0 ${wt(String(e.message||e))}</pre></div></div>`}var Jr=class{constructor(e,n){this.el=e,this.cast=n,this.prompt=n.meta.prompt??"$ ";let r=Jd(parseInt(e.dataset.typeSpeed??"5",10)||5);this.typeWpm=tu(Uo*eu(r));try{let a=parseInt(localStorage.getItem(Ho)??"",10);Hn.includes(a)&&(this.typeWpm=a)}catch{}e.dataset.typeWpm=String(this.typeWpm),this.fontIdx=Un.indexOf(1);try{let a=parseInt(localStorage.getItem(Fo)??"",10);a>=0&&a<Un.length&&(this.fontIdx=a)}catch{}this._applyFont();let i=(e.dataset.typeSound||"creamy").toLowerCase();this.soundName=Bn.includes(i)?i:"creamy";try{let a=localStorage.getItem(zo);a&&Bn.includes(a)&&(this.soundName=a)}catch{}this.typeSound=this.soundName==="off"?null:this.soundName,this.maxStep=(parseFloat(e.dataset.maxStep||"2.5")||2.5)*1e3,this.visibleRows=parseInt(e.dataset.rows||"",10)||Math.min(n.meta.rows||Bo,Bo),this.epoch=0,this.applied=0,this.playable=n.steps.filter(a=>!a.hidden&&a.sleep==null),this._mountChrome(),this._watchSlide()}stop(){if(this.epoch+=1,su(),this.playing){this.playing=!1;let e=this.controlsEl?.querySelector(".terminal-play");e&&(e.textContent="\u25B6")}}_watchSlide(){let e=this.el.closest("section");if(!e||typeof MutationObserver!="function")return;new MutationObserver(()=>{e.classList.contains("active")||this.stop()}).observe(e,{attributes:!0,attributeFilter:["class"]})}_mountChrome(){let e=this.el.dataset.title||"Terminal";this.el.innerHTML=`<div class="terminal-window"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">${wt(e)}</span><span class="terminal-controls"></span></div><div class="terminal-screen"><pre class="terminal-lines"></pre></div></div>`,this.linesEl=this.el.querySelector(".terminal-lines"),this.screenEl=this.el.querySelector(".terminal-screen"),this.controlsEl=this.el.querySelector(".terminal-controls"),this.screenEl.style.maxHeight=`calc(${this.visibleRows} * var(--term-line-height, 1.45em))`}_renderComplete(e,{withCursor:n=!0}={}){let r=[];for(let i=0;i<e;i++)r.push(this._stepHtml(this.playable[i]));n&&!this.cast.imported&&r.push(this._promptHtml()+'<span class="terminal-cursor"></span>'),this.linesEl.innerHTML=r.join(`
|
|
275
|
-
`),this._scrollToEnd()}_stepEvents(e){return[...(e.output||[]).map(([n,r])=>({t:n,kind:"o",d:r})),...(e.input||[]).map(([n,r])=>({t:n,kind:"i",d:r.replace(/\r?\n$/,"")}))].sort((n,r)=>n.t-r.t)}_stepHtml(e){let n=new pn;for(let i of this._stepEvents(e))n.write(i.d);let r=n.toHtml();return e.raw?r:this._promptHtml()+`<span class="terminal-cmd">${wt(e.cmd)}</span>`+(r?`
|
|
276
|
-
`+r:"")}_promptHtml(){return`<span class="terminal-prompt">${wt(this.prompt)}</span>`}_scrollToEnd(){this.screenEl.scrollTop=this.screenEl.scrollHeight}_applyFont(){let e=Un[this.fontIdx];this.el.style.fontSize=e===1?"":`${e}em`}_mountFontButton(){let e=document.createElement("button");e.className="terminal-btn terminal-fontsize",e.title="font size: click cycles 75% to 160%",e.setAttribute("aria-label","font size");let n=()=>{e.textContent=`A ${Math.round(Un[this.fontIdx]*100)}%`};n(),e.addEventListener("click",()=>{this.fontIdx=(this.fontIdx+1)%Un.length,this._applyFont();try{localStorage.setItem(Fo,String(this.fontIdx))}catch{}n()}),this.controlsEl.appendChild(e)}_mountSpeedButton(){let e=document.createElement("button");e.className="terminal-btn terminal-typespeed",e.title="typing speed: click cycles words per minute",e.setAttribute("aria-label","typing speed");let n=()=>{e.textContent=`\u2328 ${this.typeWpm} wpm`};n(),e.addEventListener("click",()=>{let r=(Hn.indexOf(this.typeWpm)+1)%Hn.length;this.typeWpm=Hn[r],this.el.dataset.typeWpm=String(this.typeWpm);try{localStorage.setItem(Ho,String(this.typeWpm))}catch{}n()}),this.controlsEl.appendChild(e)}_mountSoundButton(){let e=document.createElement("button");e.className="terminal-btn terminal-typesound",e.title="key sound: click cycles creamy, clacky, thocky, off",e.setAttribute("aria-label","key sound");let n=()=>{e.textContent=`\u266A ${this.soundName}`};n(),e.addEventListener("click",()=>{let r=(Bn.indexOf(this.soundName)+1)%Bn.length;this.soundName=Bn[r],this.typeSound=this.soundName==="off"?null:this.soundName,this.el.dataset.typeSound=this.soundName;try{localStorage.setItem(zo,this.soundName)}catch{}this.typeSound&&$s("a",this.typeSound,.12),n()}),this.controlsEl.appendChild(e)}_typeFactor(e,n=!1){return(n&&this.speed||1)*(this.typeWpm/Uo)*(e.typeSpeed||1)}async _typeCmd(e,n,r,i,a=!1){for(let o=1;o<=e.length;o++){if(this.epoch!==i)return!1;let c=e[o-1],d=Qr(c)/this._typeFactor(r,a);this.typeSound&&$s(c,this.typeSound,d/1e3),this.linesEl.innerHTML=n+this._promptHtml()+`<span class="terminal-cmd">${wt(e.slice(0,o))}</span><span class="terminal-cursor"></span>`,this._scrollToEnd(),await Rt(d)}return!0}mountStepMode(e){this.controlsEl.innerHTML="",this._mountSpeedButton(),this._mountSoundButton(),this._mountFontButton();let n=this.playable,r=Math.min(Math.max(parseInt(this.el.dataset.poster||"0",10)||0,0),n.length);if(this.poster=r,this.applied=r,this._renderComplete(r),!e||typeof e.registerBuildProvider!="function"){this._renderComplete(n.length,{withCursor:!1});return}e.registerBuildProvider(this.el,{count:n.length-r,label:i=>n[r+i]?`${this.prompt}${n[r+i].cmd||"\u25B6 recording"}`:"",apply:i=>this.applyStep(r+Math.max(0,Math.min(i,n.length-r)))})}applyStep(e){this.epoch+=1;let n=e===this.applied+1;if(this.applied=e,!n){this._renderComplete(e);return}this._animateStep(e-1,this.epoch)}async _animateStep(e,n){let r=this.playable[e],i=[];for(let k=0;k<e;k++)i.push(this._stepHtml(this.playable[k]));let a=i.length?i.join(`
|
|
343
|
+
<tr><td>?</td><td>this help</td></tr>
|
|
344
|
+
<tr><td>/</td><td>command palette \u2014 \u201CWelcome to Decklight\u201D reopens the intro</td></tr></table></div>`,Rt.addEventListener("click",Ot),b.appendChild(Rt)}k.register({isOpen:()=>!!Ae,close:Y,keydown:w=>pr(w,{query:ye,onMove:_=>j(Q+_),onCommit:B,onType:_=>{ye+=_,g()},onBackspace:()=>{ye=ye.slice(0,-1),g()},onClear:()=>{ye="",g()},onClose:Y})}),k.register({isOpen:()=>!!ge,close:Je,keydown:w=>pr(w,{onMove:_=>Fe(V+_),onCommit:()=>{_e(V),Je()},onClose:Je})}),k.register({isOpen:()=>!!F,close:W,keydown:w=>pr(w,{query:H,onMove:_=>Be(J+_,!1),onCommit:Ue,onType:_=>P(H+_),onBackspace:()=>P(H.slice(0,-1)),onClear:()=>P(""),onClose:W})}),k.register({isOpen:()=>!!pe,close:Et,keydown(w){switch(w.key){case"ArrowRight":Me(Pe+1);break;case"ArrowLeft":Me(Pe-1);break;case"ArrowDown":Me(Pe+Se());break;case"ArrowUp":Me(Pe-Se());break;case"Enter":case" ":rt();break;case"o":case"O":case"Escape":Et();break;default:return!1}return!0}});let Gt=w=>w.code==="Backquote"||w.key==="`"||w.key==="~"||w.key==="\xB2";function xn(w){if(Gt(w)&&(w.metaKey||w.ctrlKey||w.altKey)){ut(),w.preventDefault();return}if(/^(input|textarea|select)$/i.test(w.target.tagName))return;if(w.ctrlKey&&!w.metaKey&&!w.altKey&&(w.key==="T"||w.key==="t")){w.shiftKey?De():Ce.rollFromPicker()||qe(),w.preventDefault();return}if(w.metaKey||w.ctrlKey||w.altKey)return;let _=k.active();if(_){_.keydown(w)&&w.preventDefault();return}if(Gt(w)){ut(),w.preventDefault();return}switch(w.key){case"ArrowRight":case" ":case"PageDown":te.next();break;case"ArrowLeft":case"PageUp":te.prev();break;case"Home":te.goto(1,0);break;case"End":te.goto(te.state.totalSlides,0);break;case"o":case"O":Et();break;case"b":case"B":Yt();break;case"d":case"D":dt();break;case"c":case"C":Mt();break;case"k":case"K":Jt();break;case"h":case"H":on();break;case"p":case"P":$t();break;case"g":case"G":nt();break;case"r":case"R":xt.restore.open();break;case"e":case"E":T();break;case"f":case"F":G();break;case"v":case"V":w.shiftKey?sn():wt();break;case"n":case"N":Lt();break;case"s":case"S":{let A=te.__speakerWin;A&&!A.closed?A.__decklightSpeakerToggle?.():te.__speakerWin=Kr(te);break}case"t":case"T":Ce.openPicker();break;case"/":X();break;case".":E(1);break;case",":E(-1);break;case">":Ft(.25);break;case"<":Ft(-.25);break;case"]":Le(1);break;case"[":Le(-1);break;case"l":case"L":Pt(w.shiftKey?-1:1);break;case"z":case"Z":an(w.shiftKey?"redo":"undo");break;case"a":case"A":gt();break;case"w":case"W":Qt(w.shiftKey?"laser":"pen");break;case"Backspace":if(!zt.annotator?.active)return;zt.annotator.clear();break;case"?":Ot();break;case"Escape":if(Ie())break;pe&&Et();break;default:return}w.preventDefault()}d||document.addEventListener("keydown",xn);let Wt=null;b.addEventListener("touchstart",w=>{Wt=w.touches[0].clientX},{passive:!0}),b.addEventListener("touchend",w=>{if(Wt==null)return;let _=w.changedTouches[0].clientX-Wt;Math.abs(_)>40&&(_<0?te.next():te.prev()),Wt=null},{passive:!0});function L(){let w=b.getBoundingClientRect(),_=Math.min(w.width/l.width,w.height/l.height)||1;te._scale=_,Ye.style.transform=`translate(-50%, -50%) scale(${_})`}d||(new ResizeObserver(L).observe(b),L());let vn=ki({sectionsOf:()=>te._sections,checkOverflow:ts}),Vt=w=>vn.watch(w),pt=!1;if(l.hash&&!d&&window.addEventListener("hashchange",()=>{if(pt)return;let w=Xt();w&&te.goto(w.slide,w.step,{force:!0})}),!d){let w=()=>{te._sections.forEach((_,A)=>{let R=_.querySelector(":scope > .slide-bg > video");R&&(A===te.state.slide-1?R.play()?.catch?.(()=>{}):R.paused||R.pause())})};te.on("slide",w)}te.sync(),d&&Oe&&(te._sections.forEach(w=>{w.hasAttribute("data-logo")||w.appendChild(Oe.cloneNode(!0))}),Oe.remove()),document.fonts?.ready?.then(()=>{(Bn===te||!Bn)&&yr(te._sections,l)}),te.theme=w=>Xe(w),te.themePicker={open:Ce.openPicker,close:Ce.closePicker},te.generateTheme=qe,te.cycleFont=Le,te.cycleLayout=Pt,te.layoutRing=Kt,te.toggleMessages=ut,te.messages=Te,te.showWelcome=be.showWelcome,te.tips={show:be.showTip,reset:be.resetTips,set:be.setTips,status:be.status};let At=hi({root:b,stage:Ye,config:l,params:a,printMode:d,toast:Re,logOnly:$e,debugLog:m,overlays:k,instance:te,syncSoundBtn:ie,updateDebugState:It,downloadFromUrl:nn}),{character:rn,toggleNarration:wt,toggleNarrPause:$t,changeNarrRate:Ft,toggleCaptions:Mt,openRecordDialog:sn,notesSegs:hn}=At,Lt=At.openPicker;te.toggleNarration=wt;let zt=gi({root:b,printMode:d,toast:Re,debugLog:m,overlays:k,instance:te,narration:At,downloadFromUrl:nn,setProgressBar:w=>{Ct=w}}),{toggleClock:Jt,toggleProgress:on,toggleInk:Qt,toggleTranscript:Bt}=zt;te.toggleClock=Jt,te.toggleProgress=on;let xt=yi({root:b,config:l,params:a,printMode:d,toast:Re,debugLog:m,overlays:k,instance:te,notesSegs:hn,dismissOthers:()=>{Ce.closePicker(),F&&W(),Ae&&Y()}}),{deckHistory:an,toggleEditor:kn,toggleAgentAsk:gt,toggleElementEdit:T}=xt;if(te.restore=xt.restore,te.wizard=xt.wizard,te.toggleElementEdit=T,a.has("voiceover")&&At.status().track&&!d){let w=()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",w),At.status().narrating||wt()};window.addEventListener("pointerdown",w,{once:!0}),window.addEventListener("keydown",w,{once:!0})}if(!d){let w=document.createElement("div");w.className="decklight-touch-controls",st=document.createElement("button"),st.type="button",st.className="decklight-touch-btn",st.setAttribute("aria-label","Fullscreen"),st.innerHTML=it.full,st.addEventListener("click",G),w.appendChild(st),At.status().hasTracks&&(N=document.createElement("button"),N.type="button",N.className="decklight-touch-btn",N.addEventListener("pointerdown",_=>_.stopPropagation()),N.addEventListener("click",()=>wt()),w.appendChild(N),ie()),b.appendChild(w)}if(te.saveGeneratedTheme=w=>De(w),d)return b.classList.add("decklight-print"),te._sections.forEach((w,_)=>{w.classList.add("active"),cn(te._records[_],te._records[_].groups.length)}),(u==="handout"||u==="notes")&&(b.classList.add("decklight-print-"+u),mi(Ye,te._sections,u)),Vt(te._sections),b.__decklight=te,Bn=te,te._emit("ready",{slides:te.state.totalSlides,print:!0}),te;let K=l.hash&&Xt()||{slide:1,step:0};return te._sections.forEach((w,_)=>{_!==K.slide-1&&cn(te._records[_],0)}),te.goto(K.slide,K.step,{force:!0}),b.__decklight=te,Bn=te,te._emit("ready",{slides:te.state.totalSlides}),be.start(K),te}ae();le();ae();le();var ns="\x1B",xr=Object.freeze({fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1});function ad(r){if(r<16)return null;if(r>=16&&r<=231){let l=r-16,d=[0,95,135,175,215,255];return[d[Math.floor(l/36)%6],d[Math.floor(l/6)%6],d[l%6]]}let a=8+(r-232)*10;return[a,a,a]}var Pn=class{constructor(){this.rows=[[]],this.row=0,this.col=0,this.style={...xr},this._pending=""}write(a){let l=this._pending+a;this._pending="";let d=0;for(;d<l.length;){let u=l[d];if(u===ns){let h=this._consumeEscape(l,d);if(h===0){this._pending=l.slice(d);return}d+=h;continue}if(d+=1,u===`
|
|
345
|
+
`){this._lineFeed();continue}if(u==="\r"){this.col=0;continue}if(u==="\b"){this.col=Math.max(0,this.col-1);continue}if(u===" "){this.col=(Math.floor(this.col/8)+1)*8;continue}u!=="\x07"&&(u<" "&&u!==" "||this._putChar(u))}}_lineFeed(){this.row+=1,this.rows[this.row]||(this.rows[this.row]=[])}_putChar(a){let l=this.rows[this.row];for(;l.length<this.col;)l.push({ch:" ",style:xr});l[this.col]={ch:a,style:{...this.style}},this.col+=1}_consumeEscape(a,l){if(l+1>=a.length)return 0;let d=a[l+1];if(d==="["){let u=l+2;for(;u<a.length;){let h=a.charCodeAt(u);if(h>=64&&h<=126)return this._handleCsi(a.slice(l+2,u),a[u]),u-l+1;u+=1}return 0}if(d==="]"){let u=l+2;for(;u<a.length;){if(a[u]==="\x07")return u-l+1;if(a[u]===ns&&a[u+1]==="\\")return u-l+2;if(a[u]===ns&&u+1>=a.length)return 0;u+=1}return 0}return d==="("||d===")"?l+2<a.length?3:0:2}_handleCsi(a,l){if(!a.startsWith("?"))switch(l){case"m":this._sgr(a);return;case"K":this._eraseLine(a);return;case"C":this.col+=Math.max(1,parseInt(a||"1",10)||1);return;case"D":this.col=Math.max(0,this.col-Math.max(1,parseInt(a||"1",10)||1));return;default:return}}_eraseLine(a){let l=parseInt(a||"0",10)||0,d=this.rows[this.row];if(l===0){d.length=Math.min(d.length,this.col);return}if(l===1){for(let u=0;u<=Math.min(this.col,d.length-1);u++)d[u]={ch:" ",style:xr};return}if(l===2){d.length=0;return}}_sgr(a){let l=a===""?[0]:a.split(";").map(u=>parseInt(u,10)||0),d=0;for(;d<l.length;){let u=l[d];if(u===0)this.style={...xr};else if(u===1)this.style.bold=!0;else if(u===2)this.style.dim=!0;else if(u===3)this.style.italic=!0;else if(u===4)this.style.underline=!0;else if(u===7)this.style.inverse=!0;else if(u===22)this.style.bold=!1,this.style.dim=!1;else if(u===23)this.style.italic=!1;else if(u===24)this.style.underline=!1;else if(u===27)this.style.inverse=!1;else if(u>=30&&u<=37)this.style.fg={type:"ansi",idx:u-30};else if(u>=90&&u<=97)this.style.fg={type:"ansi",idx:u-90+8};else if(u===39)this.style.fg=null;else if(u>=40&&u<=47)this.style.bg={type:"ansi",idx:u-40};else if(u>=100&&u<=107)this.style.bg={type:"ansi",idx:u-100+8};else if(u===49)this.style.bg=null;else if(u===38||u===48){let h=u===38?"fg":"bg";l[d+1]===5&&l.length>d+2?(this.style[h]={type:"256",idx:l[d+2]},d+=2):l[d+1]===2&&l.length>d+4&&(this.style[h]={type:"rgb",r:l[d+2],g:l[d+3],b:l[d+4]},d+=4)}d+=1}}get lines(){return this.rows.map(a=>{let l=[];for(let d of a){let u=l[l.length-1];u&&ld(u.style,d.style)?u.text+=d.ch:l.push({text:d.ch,style:d.style})}return l})}toHtml(){return this.lines.map(a=>dd(a)).join(`
|
|
346
|
+
`)}};function ld(r,a){return r.bold===a.bold&&r.dim===a.dim&&r.italic===a.italic&&r.underline===a.underline&&r.inverse===a.inverse&&Ii(r.fg,a.fg)&&Ii(r.bg,a.bg)}function Ii(r,a){return r===a?!0:!r||!a?!1:r.type===a.type&&r.idx===a.idx&&r.r===a.r&&r.g===a.g&&r.b===a.b}function cd(r){if(r.type==="256"){if(r.idx<16)return null;let[a,l,d]=ad(r.idx);return`rgb(${a},${l},${d})`}return r.type==="rgb"?`rgb(${r.r},${r.g},${r.b})`:null}function dd(r){return r.map(({text:a,style:l})=>{let d=[],u=[],{fg:h,bg:f}=l;l.inverse&&([h,f]=[f??{type:"inv-default-bg"},h??{type:"inv-default-fg"}]);for(let[S,I]of[[h,"fg"],[f,"bg"]])if(S)if(S.type==="ansi"||S.type==="256"&&S.idx<16)d.push(`ansi-${I}-${S.idx}`);else if(S.type==="inv-default-bg")d.push("ansi-inv-fg");else if(S.type==="inv-default-fg")d.push("ansi-inv-bg");else{let M=cd(S);M&&u.push(`${I==="fg"?"color":"background-color"}:${M}`)}l.bold&&d.push("ansi-bold"),l.dim&&d.push("ansi-dim"),l.italic&&d.push("ansi-italic"),l.underline&&d.push("ansi-underline");let m=vt(a);if(!d.length&&!u.length)return m;let b=d.length?` class="${d.join(" ")}"`:"",k=u.length?` style="${u.join(";")}"`:"";return`<span${b}${k}>${m}</span>`}).join("")}var Bi=24,ud=r=>Math.max(1,Math.min(10,r)),pd=r=>2**((r-5)/2.5),Pi=55,Vn=[120,160],Di="decklight-term-wpm:"+location.pathname,hd=r=>Vn.reduce((a,l)=>Math.abs(l-r)<Math.abs(a-r)?l:a),Kn=["thocky","creamy","clacky","off"],qi="decklight-term-typesound:"+location.pathname,Fi="decklight-term-fontsize:"+location.pathname,Wn=[.75,.9,1,1.15,1.35,1.6],zi={thocky:{click:.17,clickF:[680,1250],clickQ:.9,lp:1800,clickDecay:[.012,.017],thump:.008,thumpF:[130,185],thumpF2:[58,85],thumpF2Prob:.22,ring:[.005,.009]},creamy:{click:.3,clickF:[1400,2850],clickQ:.95,lp:3800,clickDecay:[.007,.011],thump:.0056,thumpF:[60,110],ring:[.065,.095]},clacky:{click:.34,clickF:[2300,3900],clickQ:1.1,lp:6800,clickDecay:[.005,.008],thump:.003,thumpF:[90,140],ring:[.035,.055]}};function rs(r){let a=90+Math.random()*120;return Math.random()<.15&&(a+=Math.random()*240),r===" "?a+=70+Math.random()*220:".,:;/|&>-_=\"'`()".includes(r)&&(a+=40+Math.random()*140),Math.random()<.035&&(a+=300+Math.random()*440),a}var md=.012,yt=null,vr=null,Er=new Set,Ui=r=>{Er.add(r),r.addEventListener("ended",()=>Er.delete(r),{once:!0})};function fd(){if(!yt)return;let r=yt.currentTime;for(let a of Er)try{a.stop(r)}catch{}Er.clear()}function kr(r="",a="thocky",l=.12){try{let d=window.AudioContext||window.webkitAudioContext;if(!d)return;if(yt??=new d,yt.state==="suspended"&&yt.resume(),!vr){let q=Math.floor(yt.sampleRate*.06);vr=yt.createBuffer(1,q,yt.sampleRate);let he=vr.getChannelData(0);for(let se=0;se<q;se++)he[se]=Math.random()*2-1}let u=zi[a]??zi.thocky,h=(q,he)=>q+Math.random()*(he-q),f=yt.currentTime+md,m=r===" ",b=h(.45,1.3)*(m?1.25:1),k=h(...u.clickF)*(m?.7:1),S=h(...u.ring)*(m?1.5:1),I=(q,he,se,ce)=>{let U=yt.createBufferSource();U.buffer=vr;let me=yt.createBiquadFilter();me.type="bandpass",me.frequency.value=se,me.Q.value=u.clickQ;let Te=yt.createBiquadFilter();Te.type="lowpass",Te.frequency.value=u.lp;let $e=yt.createGain();$e.gain.setValueAtTime(1e-4,q),$e.gain.exponentialRampToValueAtTime(he,q+7e-4),$e.gain.exponentialRampToValueAtTime(1e-4,q+ce),U.connect(me),me.connect(Te),Te.connect($e),$e.connect(yt.destination),U.start(q),U.stop(q+ce+.01),Ui(U)},M=(q,he,se,ce)=>{let U=yt.createOscillator();U.type="sine",U.frequency.setValueAtTime(se,q),U.frequency.exponentialRampToValueAtTime(se*.6,q+ce*.6);let me=yt.createGain();me.gain.setValueAtTime(1e-4,q),me.gain.exponentialRampToValueAtTime(he,q+h(.003,.011)),me.gain.exponentialRampToValueAtTime(he*.25,q+ce),me.gain.exponentialRampToValueAtTime(1e-4,q+ce*2),U.connect(me),me.connect(yt.destination),U.start(q),U.stop(q+ce*2+.01),Ui(U)},C=u.thumpF2&&Math.random()<(u.thumpF2Prob??.4)?u.thumpF2:u.thumpF;I(f,u.click*b*(m?.82:1),k,h(...u.clickDecay)*(m?1.2:1)),M(f,u.thump*b*(m?2.4:1),h(...C)*(m?.7:1),S);let $=f+Math.max(.01,Math.min(h(.035,.08),l*.55));I($,u.click*b*h(.35,.55),k*1.15,h(...u.clickDecay)*.8),M($,u.thump*b*(m?.5:.25),h(...C)*(m?.7:1),S*.6)}catch{}}function gd(){try{let r=window.AudioContext||window.webkitAudioContext;if(!r)return;yt??=new r,yt.state==="suspended"&&yt.resume()}catch{}}var Hi=!1;function bd(){if(Hi||typeof document>"u")return;Hi=!0;let r=()=>{gd(),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0)};document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0)}function os(r,a=document){let l=[...a.querySelectorAll(".terminal[data-cast], .terminal[data-cast-inline]")];return l.length&&bd(),Promise.all(l.map(d=>yd(d,r).catch(u=>{kd(d,u)})))}async function yd(r,a){if(r.dataset.decklightTerminal)return;r.dataset.decklightTerminal="1";let l,d,u=r.dataset.castInline;if(u){d=u;let b=document.querySelector(u);if(!b&&document.readyState==="loading"&&(await new Promise(k=>document.addEventListener("DOMContentLoaded",k,{once:!0})),b=document.querySelector(u)),!b)throw new Error(`inline cast not found: ${u}`);l=b.textContent}else{d=r.dataset.cast;let b=await fetch(d);if(!b.ok)throw new Error(`failed to load cast: ${d} (${b.status})`);l=await b.text()}let h=wd(l,d),f=new ss(r,h);r._decklightTerminal=f;let m=r.dataset.mode||"step";h.imported&&m==="step"&&!h.hasMarkers&&(m="play"),m==="play"?f.mountPlayMode():f.mountStepMode(a)}function wd(r,a){let l=null;try{l=JSON.parse(r)}catch{}if(l){if(l.decklightCast===1&&Array.isArray(l.steps))return l;throw new Error(`not a decklight cast (v1): ${a}`)}return xd(r,a)}function xd(r,a){let l=r.split(`
|
|
347
|
+
`).filter(b=>b.trim()),d;try{d=JSON.parse(l[0])}catch{d=null}if(!d||d.version!==2)throw new Error(`not a decklight cast or asciicast v2: ${a}`);let u=[],h={cmd:"",raw:!0,output:[]},f=0,m=!1;for(let b of l.slice(1)){let k;try{k=JSON.parse(b)}catch{continue}if(!Array.isArray(k)||k.length<3)continue;let[S,I,M]=k;I==="m"?(m=!0,h.output.length&&u.push(h),h={cmd:String(M||""),raw:!0,output:[]},f=S):I==="o"&&h.output.push([Math.max(0,vd(S-f)),M])}if(h.output.length&&u.push(h),!u.length)throw new Error(`asciicast has no output events: ${a}`);return{decklightCast:1,imported:!0,hasMarkers:m,meta:{cols:d.width||100,rows:d.height||28,prompt:""},steps:u}}function vd(r){return Math.round(r*1e3)/1e3}function kd(r,a){r.innerHTML=`<div class="terminal-window terminal-broken"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">terminal</span></div><div class="terminal-screen"><pre class="terminal-lines">\u26A0 ${vt(String(a.message||a))}</pre></div></div>`}var ss=class{constructor(a,l){this.el=a,this.cast=l,this.prompt=l.meta.prompt??"$ ";let d=ud(parseInt(a.dataset.typeSpeed??"5",10)||5);this.typeWpm=hd(Pi*pd(d));try{let h=parseInt(localStorage.getItem(Di)??"",10);Vn.includes(h)&&(this.typeWpm=h)}catch{}a.dataset.typeWpm=String(this.typeWpm),this.fontIdx=Wn.indexOf(1);try{let h=parseInt(localStorage.getItem(Fi)??"",10);h>=0&&h<Wn.length&&(this.fontIdx=h)}catch{}this._applyFont();let u=(a.dataset.typeSound||"thocky").toLowerCase();this.soundName=Kn.includes(u)?u:"thocky";try{let h=localStorage.getItem(qi);h&&Kn.includes(h)&&(this.soundName=h)}catch{}this.typeSound=this.soundName==="off"?null:this.soundName,this.maxStep=(parseFloat(a.dataset.maxStep||"2.5")||2.5)*1e3,this.visibleRows=parseInt(a.dataset.rows||"",10)||Math.min(l.meta.rows||Bi,Bi),this.epoch=0,this.applied=0,this.playable=l.steps.filter(h=>!h.hidden&&h.sleep==null),this._mountChrome(),this._watchSlide()}stop(){if(this.epoch+=1,fd(),this.playing){this.playing=!1;let a=this.controlsEl?.querySelector(".terminal-play");a&&(a.textContent="\u25B6")}}_watchSlide(){let a=this.el.closest("section");if(!a||typeof MutationObserver!="function")return;new MutationObserver(()=>{a.classList.contains("active")||this.stop()}).observe(a,{attributes:!0,attributeFilter:["class"]})}_mountChrome(){let a=this.el.dataset.title||"Terminal";this.el.innerHTML=`<div class="terminal-window"><div class="terminal-titlebar"><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-dot"></span><span class="terminal-title">${vt(a)}</span><span class="terminal-controls"></span></div><div class="terminal-screen"><pre class="terminal-lines"></pre></div></div>`,this.linesEl=this.el.querySelector(".terminal-lines"),this.screenEl=this.el.querySelector(".terminal-screen"),this.controlsEl=this.el.querySelector(".terminal-controls"),this.screenEl.style.maxHeight=`calc(${this.visibleRows} * var(--term-line-height, 1.45em))`}_renderComplete(a,{withCursor:l=!0}={}){let d=[];for(let u=0;u<a;u++)d.push(this._stepHtml(this.playable[u]));l&&!this.cast.imported&&d.push(this._promptHtml()+'<span class="terminal-cursor"></span>'),this.linesEl.innerHTML=d.join(`
|
|
348
|
+
`),this._scrollToEnd()}_stepEvents(a){return[...(a.output||[]).map(([l,d])=>({t:l,kind:"o",d})),...(a.input||[]).map(([l,d])=>({t:l,kind:"i",d:d.replace(/\r?\n$/,"")}))].sort((l,d)=>l.t-d.t)}_stepHtml(a){let l=new Pn;for(let u of this._stepEvents(a))l.write(u.d);let d=l.toHtml();return a.raw?d:this._promptHtml()+`<span class="terminal-cmd">${vt(a.cmd)}</span>`+(d?`
|
|
349
|
+
`+d:"")}_promptHtml(){return`<span class="terminal-prompt">${vt(this.prompt)}</span>`}_scrollToEnd(){this.screenEl.scrollTop=this.screenEl.scrollHeight}_applyFont(){let a=Wn[this.fontIdx];this.el.style.fontSize=a===1?"":`${a}em`}_mountFontButton(){let a=document.createElement("button");a.className="terminal-btn terminal-fontsize",a.title="font size: click cycles 75% to 160%",a.setAttribute("aria-label","font size");let l=()=>{a.textContent=`A ${Math.round(Wn[this.fontIdx]*100)}%`};l(),a.addEventListener("click",()=>{this.fontIdx=(this.fontIdx+1)%Wn.length,this._applyFont();try{localStorage.setItem(Fi,String(this.fontIdx))}catch{}l()}),this.controlsEl.appendChild(a)}_mountSpeedButton(){let a=document.createElement("button");a.className="terminal-btn terminal-typespeed",a.title="typing speed: click cycles words per minute",a.setAttribute("aria-label","typing speed");let l=()=>{a.textContent=`\u2328 ${this.typeWpm} wpm`};l(),a.addEventListener("click",()=>{let d=(Vn.indexOf(this.typeWpm)+1)%Vn.length;this.typeWpm=Vn[d],this.el.dataset.typeWpm=String(this.typeWpm);try{localStorage.setItem(Di,String(this.typeWpm))}catch{}l()}),this.controlsEl.appendChild(a)}_mountSoundButton(){let a=document.createElement("button");a.className="terminal-btn terminal-typesound",a.title="key sound: click cycles thocky, creamy, clacky, off",a.setAttribute("aria-label","key sound");let l=()=>{a.textContent=`\u266A ${this.soundName}`};l(),a.addEventListener("click",()=>{let d=(Kn.indexOf(this.soundName)+1)%Kn.length;this.soundName=Kn[d],this.typeSound=this.soundName==="off"?null:this.soundName,this.el.dataset.typeSound=this.soundName;try{localStorage.setItem(qi,this.soundName)}catch{}this.typeSound&&kr("a",this.typeSound,.12),l()}),this.controlsEl.appendChild(a)}_typeFactor(a,l=!1){return(l&&this.speed||1)*(this.typeWpm/Pi)*(a.typeSpeed||1)}async _typeCmd(a,l,d,u,h=!1){for(let f=1;f<=a.length;f++){if(this.epoch!==u)return!1;let m=a[f-1],b=rs(m)/this._typeFactor(d,h);this.typeSound&&kr(m,this.typeSound,b/1e3),this.linesEl.innerHTML=l+this._promptHtml()+`<span class="terminal-cmd">${vt(a.slice(0,f))}</span><span class="terminal-cursor"></span>`,this._scrollToEnd(),await pn(b)}return!0}mountStepMode(a){this.controlsEl.innerHTML="",this._mountSpeedButton(),this._mountSoundButton(),this._mountFontButton();let l=this.playable,d=Math.min(Math.max(parseInt(this.el.dataset.poster||"0",10)||0,0),l.length);if(this.applied=d,this._renderComplete(d),!a||typeof a.registerBuildProvider!="function"){this._renderComplete(l.length,{withCursor:!1});return}a.registerBuildProvider(this.el,{count:l.length-d,label:u=>l[d+u]?`${this.prompt}${l[d+u].cmd||"\u25B6 recording"}`:"",apply:u=>this.applyStep(d+Math.max(0,Math.min(u,l.length-d)))})}applyStep(a){this.epoch+=1;let l=a===this.applied+1;if(this.applied=a,!l){this._renderComplete(a);return}this._animateStep(a-1,this.epoch)}async _animateStep(a,l){let d=this.playable[a],u=[];for(let C=0;C<a;C++)u.push(this._stepHtml(this.playable[C]));let h=u.length?u.join(`
|
|
277
350
|
`)+`
|
|
278
|
-
`:"",
|
|
279
|
-
`+
|
|
351
|
+
`:"",f=d.cmd||"";if(!d.raw){if(!await this._typeCmd(f,h,d,l))return;await pn(120/this._typeFactor(d))}let m=this._stepEvents(d),b=m.length?m[m.length-1].t*1e3:0,k=b>this.maxStep?this.maxStep/b:1,S=new Pn,I=()=>{let C=S.toHtml();this.linesEl.innerHTML=d.raw?h+C:h+this._promptHtml()+`<span class="terminal-cmd">${vt(f)}</span>`+(C?`
|
|
352
|
+
`+C:""),this._scrollToEnd()},M=0;for(let C of m){let $=Math.min((C.t-M)*1e3*k,400);if(M=C.t,$>8&&await pn($),this.epoch!==l)return;if(C.kind==="i")for(let q of C.d){if(this.epoch!==l)return;let he=rs(q)/this._typeFactor(d);this.typeSound&&kr(q,this.typeSound,he/1e3),S.write(q),I(),await pn(he)}else S.write(C.d),I()}this.epoch===l&&this._renderComplete(a+1)}mountPlayMode(){let a=[1,2,4],l=parseFloat(this.el.dataset.speed);this.speed=a.includes(l)?l:1,this.playing=!1,this.controlsEl.innerHTML=`<button class="terminal-btn terminal-play" aria-label="play">\u25B6</button><button class="terminal-btn terminal-speed" aria-label="speed">${this.speed}\xD7</button><button class="terminal-btn terminal-restart" aria-label="restart">\u21BA</button>`,this._mountSoundButton(),this._mountFontButton();let d=this.controlsEl.querySelector(".terminal-play"),u=this.controlsEl.querySelector(".terminal-speed");this.controlsEl.querySelector(".terminal-restart").addEventListener("click",()=>this._restart(d)),u.addEventListener("click",()=>{this.speed=this.speed>=4?1:this.speed*2,u.textContent=`${this.speed}\xD7`}),d.addEventListener("click",()=>{this.playing?this.stop():(d.textContent="\u23F8",this._playAll(d))}),this._renderComplete(0)}_restart(a){this.stop(),a.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(0)}async _playAll(a){this.playing=!0;let l=++this.epoch,d=this._playedUpTo||0;for(let u=d;u<this.cast.steps.length;u++){let h=this.cast.steps[u];if(h.hidden){this._playedUpTo=u+1;continue}if(h.sleep!=null){if(await pn(h.sleep*1e3/this.speed),this.epoch!==l){this._playedUpTo=u;return}this._playedUpTo=u+1;continue}let m=this.cast.steps.slice(0,u).filter(C=>!C.hidden&&C.sleep==null).map(C=>this._stepHtml(C)),b=m.length?m.join(`
|
|
280
353
|
`)+`
|
|
281
|
-
`:"",
|
|
282
|
-
`+
|
|
354
|
+
`:"",k=h.cmd||"";if(!h.raw&&!await this._typeCmd(k,b,h,l,!0)){this._playedUpTo=u;return}let S=new Pn,I=()=>{let C=S.toHtml();this.linesEl.innerHTML=h.raw?b+C:b+this._promptHtml()+`<span class="terminal-cmd">${vt(k)}</span>`+(C?`
|
|
355
|
+
`+C:""),this._scrollToEnd()},M=0;for(let C of this._stepEvents(h)){let $=(C.t-M)*1e3/this.speed;if(M=C.t,$>4&&await pn($),this.epoch!==l){this._playedUpTo=u;return}if(C.kind==="i")for(let q of C.d){if(this.epoch!==l){this._playedUpTo=u;return}let he=rs(q)/this._typeFactor(h,!0);this.typeSound&&kr(q,this.typeSound,he/1e3),S.write(q),I(),await pn(he)}else S.write(C.d),I()}await pn(350/this.speed),this._playedUpTo=u+1}this.playing=!1,a.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(this.playable.length,{withCursor:!0})}};function pn(r){return new Promise(a=>setTimeout(a,r))}var Ed="0.3.0";function Sd(r={}){let a=Ri(r),l=os||(void 0)?.registerTerminals;return typeof l=="function"&&Promise.resolve(l({registerBuildProvider:jn},document)).catch(d=>console.error("Decklight: terminal subsystem failed to initialize",d)),a}function Ad(r=document){let a=os||(void 0)?.registerTerminals;return typeof a=="function"?Promise.resolve(a({registerBuildProvider:jn},r)):Promise.resolve()}return Ua(_d);})();
|
|
283
356
|
//# sourceMappingURL=decklight.js.map
|