decklight 0.7.0 → 0.8.1
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 +7 -3
- package/SPEC.md +23 -15
- package/cli/associate.mjs +2 -2
- package/cli/bundle.mjs +1 -1
- package/cli/decklight.mjs +9 -1
- package/cli/edit.mjs +54 -1
- package/cli/import.mjs +41 -11
- package/cli/pdf.mjs +59 -14
- package/cli/pptx-export.mjs +119 -0
- package/cli/present.mjs +8 -4
- package/cli/publish.mjs +10 -2
- package/cli/record.mjs +3 -3
- package/cli/skill-content.mjs +1 -0
- package/dist/build-info.json +1 -1
- package/dist/decklight.css +10 -0
- package/dist/decklight.js +135 -84
- package/dist/decklight.js.map +4 -4
- package/docs/architecture.svg +3 -3
- package/package.json +2 -1
- package/tools/bridge.mjs +25 -2
- package/tools/deck-html.mjs +9 -0
- package/tools/elevenlabs-tts.mjs +2 -2
- package/tools/exec.mjs +87 -0
- package/tools/gemini-tts.mjs +4 -4
- package/tools/lipsync-server.mjs +6 -0
- package/tools/lipsync.mjs +6 -6
- package/tools/local-voice.mjs +73 -3
- package/tools/pptx-write.mjs +151 -0
- package/tools/pptx.mjs +82 -2
- package/tools/publish-site-voices.mjs +2 -2
- package/tools/publish-targets.mjs +39 -2
- package/tools/publish-voices.mjs +2 -2
- package/tools/template-theme.mjs +154 -0
- package/tools/test-impact.mjs +19 -10
- package/tools/tts-cache.mjs +191 -0
- package/tools/tts-engines.mjs +62 -7
- package/tools/tts-setup.mjs +3 -2
- package/tools/video.mjs +6 -3
- package/tools/voiceover-server.mjs +40 -54
- package/tools/voiceover.mjs +95 -16
package/dist/decklight.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! Decklight v0.
|
|
2
|
-
var Decklight=(()=>{var ll=Object.create;var fs=Object.defineProperty;var cl=Object.getOwnPropertyDescriptor;var dl=Object.getOwnPropertyNames;var ul=Object.getPrototypeOf,pl=Object.prototype.hasOwnProperty;var Po=(t,o)=>()=>(t&&(o=t(t=0)),o);var hl=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports),ml=(t,o)=>{for(var a in o)fs(t,a,{get:o[a],enumerable:!0})},Bo=(t,o,a,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of dl(o))!pl.call(t,d)&&d!==a&&fs(t,d,{get:()=>o[d],enumerable:!(c=cl(o,d))||c.enumerable});return t};var fl=(t,o,a)=>(a=t!=null?ll(ul(t)):{},Bo(o||!t||!t.__esModule?fs(a,"default",{value:t,enumerable:!0}):a,t)),gl=t=>Bo(fs({},"__esModule",{value:!0}),t);var it,ge=Po(()=>{it={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 rt,be=Po(()=>{rt=["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 Ai=hl((qu,Si)=>{ge();be();function pi(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(o=>{let a=t[o],c=typeof a;(c==="object"||c==="function")&&!Object.isFrozen(a)&&pi(a)}),t}var vs=class{constructor(o){o.data===void 0&&(o.data={}),this.data=o.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function hi(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function nr(t,...o){let a=Object.create(null);for(let c in t)a[c]=t[c];return o.forEach(function(c){for(let d in c)a[d]=c[d]}),a}var Wl="</span>",ii=t=>!!t.scope,Vl=(t,{prefix:o})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let a=t.split(".");return[`${o}${a.shift()}`,...a.map((c,d)=>`${c}${"_".repeat(d+1)}`)].join(" ")}return`${o}${t}`},eo=class{constructor(o,a){this.buffer="",this.classPrefix=a.classPrefix,o.walk(this)}addText(o){this.buffer+=hi(o)}openNode(o){if(!ii(o))return;let a=Vl(o.scope,{prefix:this.classPrefix});this.span(a)}closeNode(o){ii(o)&&(this.buffer+=Wl)}value(){return this.buffer}span(o){this.buffer+=`<span class="${o}">`}},ai=(t={})=>{let o={children:[]};return Object.assign(o,t),o},to=class t{constructor(){this.rootNode=ai(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(o){this.top.children.push(o)}openNode(o){let a=ai({scope:o});this.add(a),this.stack.push(a)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(o){return this.constructor._walk(o,this.rootNode)}static _walk(o,a){return typeof a=="string"?o.addText(a):a.children&&(o.openNode(a),a.children.forEach(c=>this._walk(o,c)),o.closeNode(a)),o}static _collapse(o){typeof o!="string"&&o.children&&(o.children.every(a=>typeof a=="string")?o.children=[o.children.join("")]:o.children.forEach(a=>{t._collapse(a)}))}},no=class extends to{constructor(o){super(),this.options=o}addText(o){o!==""&&this.add(o)}startScope(o){this.openNode(o)}endScope(){this.closeNode()}__addSublanguage(o,a){let c=o.root;a&&(c.scope=`language:${a}`),this.add(c)}toHTML(){return new eo(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Vr(t){return t?typeof t=="string"?t:t.source:null}function mi(t){return br("(?=",t,")")}function Zl(t){return br("(?:",t,")*")}function Yl(t){return br("(?:",t,")?")}function br(...t){return t.map(a=>Vr(a)).join("")}function Xl(t){let o=t[t.length-1];return typeof o=="object"&&o.constructor===Object?(t.splice(t.length-1,1),o):{}}function so(...t){return"("+(Xl(t).capture?"":"?:")+t.map(c=>Vr(c)).join("|")+")"}function fi(t){return new RegExp(t.toString()+"|").exec("").length-1}function Jl(t,o){let a=t&&t.exec(o);return a&&a.index===0}var Ql=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function oo(t,{joinWith:o}){let a=0;return t.map(c=>{a+=1;let d=a,p=Vr(c),g="";for(;p.length>0;){let m=Ql.exec(p);if(!m){g+=p;break}g+=p.substring(0,m.index),p=p.substring(m.index+m[0].length),m[0][0]==="\\"&&m[1]?g+="\\"+String(Number(m[1])+d):(g+=m[0],m[0]==="("&&a++)}return g}).map(c=>`(${c})`).join(o)}var ec=/\b\B/,gi="[a-zA-Z]\\w*",io="[a-zA-Z_]\\w*",bi="\\b\\d+(\\.\\d+)?",yi="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",wi="\\b(0b[01]+)",tc="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",nc=(t={})=>{let o=/^#![ ]*\//;return t.binary&&(t.begin=br(o,/.*\b/,t.binary,/\b.*/)),nr({scope:"meta",begin:o,end:/$/,relevance:0,"on:begin":(a,c)=>{a.index!==0&&c.ignoreMatch()}},t)},Zr={begin:"\\\\[\\s\\S]",relevance:0},rc={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Zr]},sc={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Zr]},oc={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/},ks=function(t,o,a={}){let c=nr({scope:"comment",begin:t,end:o,contains:[]},a);c.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 d=so("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 c.contains.push({begin:br(/[ ]+/,"(",d,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),c},ic=ks("//","$"),ac=ks("/\\*","\\*/"),lc=ks("#","$"),cc={scope:"number",begin:bi,relevance:0},dc={scope:"number",begin:yi,relevance:0},uc={scope:"number",begin:wi,relevance:0},pc={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Zr,{begin:/\[/,end:/\]/,relevance:0,contains:[Zr]}]},hc={scope:"title",begin:gi,relevance:0},mc={scope:"title",begin:io,relevance:0},fc={begin:"\\.\\s*"+io,relevance:0},gc=function(t){return Object.assign(t,{"on:begin":(o,a)=>{a.data._beginMatch=o[1]},"on:end":(o,a)=>{a.data._beginMatch!==o[1]&&a.ignoreMatch()}})},ws=Object.freeze({__proto__:null,APOS_STRING_MODE:rc,BACKSLASH_ESCAPE:Zr,BINARY_NUMBER_MODE:uc,BINARY_NUMBER_RE:wi,COMMENT:ks,C_BLOCK_COMMENT_MODE:ac,C_LINE_COMMENT_MODE:ic,C_NUMBER_MODE:dc,C_NUMBER_RE:yi,END_SAME_AS_BEGIN:gc,HASH_COMMENT_MODE:lc,IDENT_RE:gi,MATCH_NOTHING_RE:ec,METHOD_GUARD:fc,NUMBER_MODE:cc,NUMBER_RE:bi,PHRASAL_WORDS_MODE:oc,QUOTE_STRING_MODE:sc,REGEXP_MODE:pc,RE_STARTERS_RE:tc,SHEBANG:nc,TITLE_MODE:hc,UNDERSCORE_IDENT_RE:io,UNDERSCORE_TITLE_MODE:mc});function bc(t,o){t.input[t.index-1]==="."&&o.ignoreMatch()}function yc(t,o){t.className!==void 0&&(t.scope=t.className,delete t.className)}function wc(t,o){o&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=bc,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function vc(t,o){Array.isArray(t.illegal)&&(t.illegal=so(...t.illegal))}function xc(t,o){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 kc(t,o){t.relevance===void 0&&(t.relevance=1)}var Ec=(t,o)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let a=Object.assign({},t);Object.keys(t).forEach(c=>{delete t[c]}),t.keywords=a.keywords,t.begin=br(a.beforeMatch,mi(a.begin)),t.starts={relevance:0,contains:[Object.assign(a,{endsParent:!0})]},t.relevance=0,delete a.beforeMatch},Sc=["of","and","for","in","not","or","if","then","parent","list","value"],Ac="keyword";function vi(t,o,a=Ac){let c=Object.create(null);return typeof t=="string"?d(a,t.split(" ")):Array.isArray(t)?d(a,t):Object.keys(t).forEach(function(p){Object.assign(c,vi(t[p],o,p))}),c;function d(p,g){o&&(g=g.map(m=>m.toLowerCase())),g.forEach(function(m){let w=m.split("|");c[w[0]]=[p,_c(w[0],w[1])]})}}function _c(t,o){return o?Number(o):Tc(t)?0:1}function Tc(t){return Sc.includes(t.toLowerCase())}var li={},gr=t=>{console.error(t)},ci=(t,...o)=>{console.log(`WARN: ${t}`,...o)},$r=(t,o)=>{li[`${t}/${o}`]||(console.log(`Deprecated as of ${t}. ${o}`),li[`${t}/${o}`]=!0)},xs=new Error;function xi(t,o,{key:a}){let c=0,d=t[a],p={},g={};for(let m=1;m<=o.length;m++)g[m+c]=d[m],p[m+c]=!0,c+=fi(o[m-1]);t[a]=g,t[a]._emit=p,t[a]._multi=!0}function $c(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw gr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),xs;if(typeof t.beginScope!="object"||t.beginScope===null)throw gr("beginScope must be object"),xs;xi(t,t.begin,{key:"beginScope"}),t.begin=oo(t.begin,{joinWith:""})}}function Cc(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw gr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),xs;if(typeof t.endScope!="object"||t.endScope===null)throw gr("endScope must be object"),xs;xi(t,t.end,{key:"endScope"}),t.end=oo(t.end,{joinWith:""})}}function Nc(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Mc(t){Nc(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),$c(t),Cc(t)}function Oc(t){function o(g,m){return new RegExp(Vr(g),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(m?"g":""))}class a{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(m,w){w.position=this.position++,this.matchIndexes[this.matchAt]=w,this.regexes.push([w,m]),this.matchAt+=fi(m)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let m=this.regexes.map(w=>w[1]);this.matcherRe=o(oo(m,{joinWith:"|"}),!0),this.lastIndex=0}exec(m){this.matcherRe.lastIndex=this.lastIndex;let w=this.matcherRe.exec(m);if(!w)return null;let E=w.findIndex((P,$)=>$>0&&P!==void 0),S=this.matchIndexes[E];return w.splice(0,E),Object.assign(w,S)}}class c{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 w=new a;return this.rules.slice(m).forEach(([E,S])=>w.addRule(E,S)),w.compile(),this.multiRegexes[m]=w,w}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(m,w){this.rules.push([m,w]),w.type==="begin"&&this.count++}exec(m){let w=this.getMatcher(this.regexIndex);w.lastIndex=this.lastIndex;let E=w.exec(m);if(this.resumingScanAtSamePosition()&&!(E&&E.index===this.lastIndex)){let S=this.getMatcher(0);S.lastIndex=this.lastIndex+1,E=S.exec(m)}return E&&(this.regexIndex+=E.position+1,this.regexIndex===this.count&&this.considerAll()),E}}function d(g){let m=new c;return g.contains.forEach(w=>m.addRule(w.begin,{rule:w,type:"begin"})),g.terminatorEnd&&m.addRule(g.terminatorEnd,{type:"end"}),g.illegal&&m.addRule(g.illegal,{type:"illegal"}),m}function p(g,m){let w=g;if(g.isCompiled)return w;[yc,xc,Mc,Ec].forEach(S=>S(g,m)),t.compilerExtensions.forEach(S=>S(g,m)),g.__beforeBegin=null,[wc,vc,kc].forEach(S=>S(g,m)),g.isCompiled=!0;let E=null;return typeof g.keywords=="object"&&g.keywords.$pattern&&(g.keywords=Object.assign({},g.keywords),E=g.keywords.$pattern,delete g.keywords.$pattern),E=E||/\w+/,g.keywords&&(g.keywords=vi(g.keywords,t.case_insensitive)),w.keywordPatternRe=o(E,!0),m&&(g.begin||(g.begin=/\B|\b/),w.beginRe=o(w.begin),!g.end&&!g.endsWithParent&&(g.end=/\B|\b/),g.end&&(w.endRe=o(w.end)),w.terminatorEnd=Vr(w.end)||"",g.endsWithParent&&m.terminatorEnd&&(w.terminatorEnd+=(g.end?"|":"")+m.terminatorEnd)),g.illegal&&(w.illegalRe=o(g.illegal)),g.contains||(g.contains=[]),g.contains=[].concat(...g.contains.map(function(S){return Lc(S==="self"?g:S)})),g.contains.forEach(function(S){p(S,w)}),g.starts&&p(g.starts,m),w.matcher=d(w),w}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=nr(t.classNameAliases||{}),p(t)}function ki(t){return t?t.endsWithParent||ki(t.starts):!1}function Lc(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(o){return nr(t,{variants:null},o)})),t.cachedVariants?t.cachedVariants:ki(t)?nr(t,{starts:t.starts?nr(t.starts):null}):Object.isFrozen(t)?nr(t):t}var Rc="11.11.1",ro=class extends Error{constructor(o,a){super(o),this.name="HTMLInjectionError",this.html=a}},Qs=hi,di=nr,ui=Symbol("nomatch"),Ic=7,Ei=function(t){let o=Object.create(null),a=Object.create(null),c=[],d=!0,p="Could not find the language '{}', did you forget to load/include a language module?",g={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:no};function w(G){return m.noHighlightRe.test(G)}function E(G){let J=G.className+" ";J+=G.parentNode?G.parentNode.className:"";let ne=m.languageDetectRe.exec(J);if(ne){let fe=_e(ne[1]);return fe||(ci(p.replace("{}",ne[1])),ci("Falling back to no-highlight mode for this block.",G)),fe?ne[1]:"no-highlight"}return J.split(/\s+/).find(fe=>w(fe)||_e(fe))}function S(G,J,ne){let fe="",ue="";typeof J=="object"?(fe=G,ne=J.ignoreIllegals,ue=J.language):($r("10.7.0","highlight(lang, code, ...args) has been deprecated."),$r("10.7.0",`Please use highlight(code, options) instead.
|
|
3
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),
|
|
4
|
-
`,1;if(pt>1e5&&pt>Ee.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ne+=re,re.length}let ze=_e(G);if(!ze)throw gr(p.replace("{}",G)),new Error('Unknown language: "'+G+'"');let f=Oc(ze),Y="",F=fe||f,Ce={},ce=new m.__emitter(m);ie();let Ne="",ee=0,nt=0,pt=0,ut=!1;try{if(ze.__emitTokens)ze.__emitTokens(J,ce);else{for(F.matcher.considerAll();;){pt++,ut?ut=!1:F.matcher.considerAll(),F.matcher.lastIndex=nt;let ke=F.matcher.exec(J);if(!ke)break;let Ee=J.substring(nt,ke.index),re=v(Ee,ke);nt=ke.index+re}v(J.substring(nt))}return ce.finalize(),Y=ce.toHTML(),{language:G,value:Y,relevance:ee,illegal:!1,_emitter:ce,_top:F}}catch(ke){if(ke.message&&ke.message.includes("Illegal"))return{language:G,value:Qs(J),illegal:!0,relevance:0,_illegalBy:{message:ke.message,index:nt,context:J.slice(nt-100,nt+100),mode:ke.mode,resultSoFar:Y},_emitter:ce};if(d)return{language:G,value:Qs(J),illegal:!1,relevance:0,errorRaised:ke,_emitter:ce,_top:F};throw ke}}function $(G){let J={value:Qs(G),illegal:!1,relevance:0,_top:g,_emitter:new m.__emitter(m)};return J._emitter.addText(G),J}function _(G,J){J=J||m.languages||Object.keys(o);let ne=$(G),fe=J.filter(_e).filter(st).map(i=>P(i,G,!1));fe.unshift(ne);let ue=fe.sort((i,O)=>{if(i.relevance!==O.relevance)return O.relevance-i.relevance;if(i.language&&O.language){if(_e(i.language).supersetOf===O.language)return 1;if(_e(O.language).supersetOf===i.language)return-1}return 0}),[Ie,Q]=ue,s=Ie;return s.secondBest=Q,s}function C(G,J,ne){let fe=J&&a[J]||ne;G.classList.add("hljs"),G.classList.add(`language-${fe}`)}function I(G){let J=null,ne=E(G);if(w(ne))return;if(mt("before:highlightElement",{el:G,language:ne}),G.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",G);return}if(G.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(G)),m.throwUnescapedHTML))throw new ro("One of your code blocks includes unescaped HTML.",G.innerHTML);J=G;let fe=J.textContent,ue=ne?S(fe,{language:ne,ignoreIllegals:!0}):_(fe);G.innerHTML=ue.value,G.dataset.highlighted="yes",C(G,ne,ue.language),G.result={language:ue.language,re:ue.relevance,relevance:ue.relevance},ue.secondBest&&(G.secondBest={language:ue.secondBest.language,relevance:ue.secondBest.relevance}),mt("after:highlightElement",{el:G,result:ue,text:fe})}function Se(G){m=di(m,G)}let de=()=>{ae(),$r("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function $e(){ae(),$r("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let te=!1;function ae(){function G(){ae()}if(document.readyState==="loading"){te||window.addEventListener("DOMContentLoaded",G,!1),te=!0;return}document.querySelectorAll(m.cssSelector).forEach(I)}function Re(G,J){let ne=null;try{ne=J(t)}catch(fe){if(gr("Language definition for '{}' could not be registered.".replace("{}",G)),d)gr(fe);else throw fe;ne=g}ne.name||(ne.name=G),o[G]=ne,ne.rawDefinition=J.bind(null,t),ne.aliases&&Ae(ne.aliases,{languageName:G})}function Fe(G){delete o[G];for(let J of Object.keys(a))a[J]===G&&delete a[J]}function je(){return Object.keys(o)}function _e(G){return G=(G||"").toLowerCase(),o[G]||o[a[G]]}function Ae(G,{languageName:J}){typeof G=="string"&&(G=[G]),G.forEach(ne=>{a[ne.toLowerCase()]=J})}function st(G){let J=_e(G);return J&&!J.disableAutodetect}function bt(G){G["before:highlightBlock"]&&!G["before:highlightElement"]&&(G["before:highlightElement"]=J=>{G["before:highlightBlock"](Object.assign({block:J.el},J))}),G["after:highlightBlock"]&&!G["after:highlightElement"]&&(G["after:highlightElement"]=J=>{G["after:highlightBlock"](Object.assign({block:J.el},J))})}function T(G){bt(G),c.push(G)}function Ke(G){let J=c.indexOf(G);J!==-1&&c.splice(J,1)}function mt(G,J){let ne=G;c.forEach(function(fe){fe[ne]&&fe[ne](J)})}function dt(G){return $r("10.7.0","highlightBlock will be removed entirely in v12.0"),$r("10.7.0","Please use highlightElement now."),I(G)}Object.assign(t,{highlight:S,highlightAuto:_,highlightAll:ae,highlightElement:I,highlightBlock:dt,configure:Se,initHighlighting:de,initHighlightingOnLoad:$e,registerLanguage:Re,unregisterLanguage:Fe,listLanguages:je,getLanguage:_e,registerAliases:Ae,autoDetection:st,inherit:di,addPlugin:T,removePlugin:Ke}),t.debugMode=function(){d=!1},t.safeMode=function(){d=!0},t.versionString=Rc,t.regex={concat:br,lookahead:mi,either:so,optional:Yl,anyNumberOfTimes:Zl};for(let G in ws)typeof ws[G]=="object"&&pi(ws[G]);return Object.assign(t,ws),t},Cr=Ei({});Cr.newInstance=()=>Ei({});Si.exports=Cr;Cr.HighlightJS=Cr;Cr.default=Cr});var au={};ml(au,{init:()=>ou,initTerminals:()=>iu,registerBuildProvider:()=>Qr,version:()=>su});ge();be();ge();be();ge();be();var wl=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),vl=new Set(["defs","title","desc","style","metadata"]),Fo=new Map;function zo(t,o){Fo.set(t,o)}function bs(t){return[...t.children].filter(o=>{let a=o.tagName.toLowerCase();return!(vl.has(a)||a==="aside"&&o.classList.contains("notes")||o.hasAttribute("data-build-stay"))})}function xl(t){if(t.hasAttribute("data-build-self"))return!1;let o=t.tagName.toUpperCase();return wl.has(o)?!0:o==="DIV"||o==="G"?bs(t).length>=2:!1}function kl(t){if(t.tagName.toUpperCase()==="TABLE"){let a=t.querySelector(":scope > tbody");return a?bs(a):bs(t).filter(c=>c.tagName==="TR")}return bs(t)}function El(t){let o=t.map((g,m)=>({...g,i:m}));o.sort((g,m)=>g.key-m.key||g.i-m.i);let a=[],c=null,d=null,p=!1;for(let g of o){if(c&&g.explicit&&p&&g.key===d){c.push(g.i);continue}c=[g.i],d=g.key,p=g.explicit,a.push(c)}return a}function Do(t,o){t.classList.add("build-step"),t.setAttribute("data-build-style",o),t.setAttribute("data-build-state","pending"),o==="draw"&&Sl(t)}var qo="path, line, polyline, polygon, circle, ellipse, rect";function Sl(t){let o=t.matches?.(qo)?[t]:[...t.querySelectorAll(qo)],a=!1;for(let d of o){let p=d.getAttribute("stroke")??getComputedStyle(d).stroke;if(!p||p==="none")continue;let g=0;try{g=d.getTotalLength()}catch{continue}if(!g)continue;a=!0;let m=d.getAttribute("stroke-dasharray")||d.style.strokeDasharray;m&&(d.dataset.drawOrig=m);for(let[w,E]of Ys){let S=d.getAttribute(w);S&&(d.dataset[E]=S)}d.classList.add("draw-stroke"),d.style.setProperty("--draw-len",String(Math.ceil(g)))}t.querySelectorAll("text, tspan").forEach(d=>d.classList.add("draw-fade")),a||t.setAttribute("data-build-style","fade")}var Ys=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function gs(t,o){for(let[a,c]of Ys)c in t.dataset&&(o?t.setAttribute(a,t.dataset[c]):t.removeAttribute(a))}function Al(t,o){for(let a of t.querySelectorAll(".draw-stroke")){let c=a.dataset.drawOrig,d=Ys.some(([,p])=>p in a.dataset);if(!(!c&&!d))if(o==="done")c&&(a.style.strokeDasharray=c,a.style.strokeDashoffset="0"),gs(a,!0);else if(o==="pending")a.style.removeProperty("stroke-dasharray"),a.style.removeProperty("stroke-dashoffset"),gs(a,!1);else{a.style.removeProperty("stroke-dasharray"),a.style.removeProperty("stroke-dashoffset"),gs(a,!1);let p=()=>{t.getAttribute("data-build-state")!=="pending"&&(c&&(a.style.strokeDasharray=c,a.style.strokeDashoffset="0"),gs(a,!0))},g=parseFloat(getComputedStyle(a).transitionDuration)||0;g===0?p():(a.addEventListener("transitionend",p,{once:!0}),setTimeout(p,g*1e3+150))}}}function Xs(t){let o=[],a=[],c=new Set,d=0,p=(S,P)=>{let $=P!=null&&P!=="",_=$?parseInt(P,10):d;o.push(S),a.push({key:Number.isFinite(_)?_:d,explicit:$}),d++},g=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let S=g.nextNode();S;S=g.nextNode()){if(c.has(S))continue;let P=Fo.get(S);if(P){for(let _=0;_<P.count;_++)p({kind:"provider",provider:P,el:S,sub:_},null);S.querySelectorAll("*").forEach(_=>c.add(_));continue}if(!S.hasAttribute("data-build"))continue;let $=S.getAttribute("data-build")||"fade";if(xl(S)){for(let _ of kl(S)){c.add(_),_.querySelectorAll("[data-build]").forEach(I=>c.add(I));let C=_.getAttribute("data-build")||$;Do(_,C),p({kind:"dom",el:_,container:S},_.getAttribute("data-build-order"))}S.setAttribute("data-build-container","")}else Do(S,$),p({kind:"dom",el:S,container:null},S.getAttribute("data-build-order"))}let m=El(a),w=[],E=new Map;return o.forEach((S,P)=>{if(S.kind==="provider"){if(!E.has(S.provider)){let $={el:S.el,provider:S.provider,stepIdxs:[]};E.set(S.provider,$),w.push($)}E.get(S.provider).stepIdxs.push(P)}}),{steps:o,groups:m,providers:w}}function tr(t,o){let a=new Set;t.groups.forEach((g,m)=>{for(let w of g)m<o&&a.add(w)});let c=o>0?t.groups[o-1]??[]:[],d=new Set(c),p=new Set;t.steps.forEach((g,m)=>{if(g.kind!=="dom")return;let w=d.has(m)?"current":a.has(m)?"done":"pending";g.el.setAttribute("data-build-state",w),g.el.getAttribute("data-build-style")==="draw"&&Al(g.el,w),g.container&&p.add(g.container)});for(let g of p){let m=!!g.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');g.classList.toggle("has-current-highlight",m)}for(let g of t.providers){let m=g.stepIdxs.filter(w=>a.has(w)||d.has(w)).length;g._last!==m&&(g._last=m,g.provider.apply(m))}}function Uo(t){return t.groups.map(o=>{let a=t.steps[o[0]];if(a.kind==="provider"){let d=a.sub;return a.provider.label?a.provider.label(d+1):"step"}return a.el.textContent.trim().replace(/\s+/g," ").slice(0,60)||a.el.tagName.toLowerCase()})}ge();be();var Ho="rect, circle, ellipse, polygon, polyline, path";function _l(t){let o=5381;for(let a of String(t))o=(o*33^a.charCodeAt(0))>>>0;return 1+o%6}function Tl(t,o={}){let a=o[t];return typeof a=="number"?`var(--d-fill-${a})`:typeof a=="string"?a:`var(--d-fill-${_l(t)})`}function jo(t,o={}){let a=new Map;t.querySelectorAll("svg [data-concept]").forEach(c=>{let d=c.getAttribute("data-concept");if(!d)return;let p=Tl(d,o),g=p.match(/--d-fill-(\d)/);if(g){let w=a.get(g[1]);w&&w!==d?console.warn(`Decklight: concepts "${w}" and "${d}" share fill slot ${g[1]} \u2014 pin one explicitly via init({ concepts: { ${d}: <1-6> } })`):a.set(g[1],d)}let m=c.matches(Ho)?[c]:[...c.children].filter(w=>w.matches(Ho));for(let w of m){let E=w.getAttribute("fill")==="none"||w.style.fill==="none";w.style.setProperty(E?"stroke":"fill",p)}})}var $l=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function Go(t){t.querySelectorAll("svg").forEach((o,a)=>{let c=`svg${a}-`,d=new Map;if(o.querySelectorAll("[id]").forEach(g=>{let m=g.id;d.set(m,c+m),g.id=c+m}),d.size===0)return;let p=g=>g.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(m,w)=>d.has(w)?`url(#${d.get(w)})`:m);o.querySelectorAll("*").forEach(g=>{for(let m of $l){let w=g.getAttribute(m);w&&w.includes("url(#")&&g.setAttribute(m,p(w))}for(let m of["href","xlink:href"]){let w=g.getAttribute(m);w&&w.startsWith("#")&&d.has(w.slice(1))&&g.setAttribute(m,"#"+d.get(w.slice(1)))}})})}ge();be();ge();be();var $t=t=>String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");var Ko=640,Cl=360,Wo=["bar","line","area","pie","donut"],Ue=t=>{let o=Math.round(t*100)/100;return Object.is(o,-0)?"0":String(o)},_r=t=>`var(--d-fill-${t%6+1})`;function Nl(t,o={}){let a;if(typeof t=="string")try{a=JSON.parse(t)}catch(E){throw new Error(`invalid JSON \u2014 ${E.message}`)}else if(t&&typeof t=="object")a=t;else throw new Error('no data \u2014 expected a <script type="application/json"> child (or the fence body)');let c=String(o.type||a.type||"").toLowerCase();if(!Wo.includes(c))throw new Error(`unknown type "${c}" \u2014 use ${Wo.join(" | ")}`);if(!Array.isArray(a.labels)||a.labels.length===0)throw new Error('"labels" must be a non-empty array');if(!Array.isArray(a.series)||a.series.length===0)throw new Error('"series" must be a non-empty array');let d=a.labels.map(String),p=a.series.map((E,S)=>{if(!E||!Array.isArray(E.data))throw new Error(`series ${S+1}: "data" must be an array of numbers`);return{name:E.name!=null?String(E.name):`series ${S+1}`,concept:E.concept!=null?String(E.concept):null,data:d.map((P,$)=>{let _=Number(E.data[$]);return Number.isFinite(_)?_:null})}}),g=c==="pie"||c==="donut";if(g&&p.length>1)throw new Error("pie takes exactly one series (labels are the slices)");if(g&&!p[0].data.some(E=>E>0))throw new Error("pie needs at least one positive value");let m=Cl,w=o.aspect??a.aspect??null;if(w!=null){let E=String(w).match(/^\s*(\d+(?:\.\d+)?)\s*[:x]\s*(\d+(?:\.\d+)?)\s*$/i);if(!E||+E[1]==0)throw new Error(`bad aspect "${w}" \u2014 use "w:h", e.g. "4:3"`);m=Math.round(Ko*+E[2]/+E[1])}return{type:g?"pie":c,donut:c==="donut"||a.donut===!0,title:o.title??(a.title!=null?String(a.title):null),labels:d,series:p,legend:a.legend,width:Ko,height:m,build:a.build}}function Ml(t,o,a=5){if(!Number.isFinite(t)||!Number.isFinite(o))throw new Error("niceTicks: non-finite range");if(t>o&&([t,o]=[o,t]),t===o){let P=t===0?1:Math.abs(t)/2;t-=t===0?0:P,o+=P}let c=(o-t)/Math.max(1,a-1),d=10**Math.floor(Math.log10(c)),p=c/d,g=(p<=1?1:p<=2?2:p<=2.5?2.5:p<=5?5:10)*d,m=Math.floor(t/g+1e-9)*g,w=Math.ceil(o/g-1e-9)*g,E=Math.max(1,Math.round((w-m)/g)),S=Array.from({length:E+1},(P,$)=>+(m+$*g).toPrecision(12));return{min:S[0],max:S[E],step:g,ticks:S}}function Ol(t,o){let a=0;for(;a<6&&Math.abs(Math.round(o*10**a)-o*10**a)>1e-9;)a++;return t.toFixed(a)}function Ll(t,o,a,c){let d=c.max-c.min||1,p=S=>a.y+a.h*(1-(S-c.min)/d),g=p(Math.max(c.min,Math.min(c.max,0))),m=a.w/o,w=m*.72,E=w/t.length;return t.map((S,P)=>Array.from({length:o},($,_)=>{let C=S.data[_];if(C==null||!Number.isFinite(C))return null;let I=p(C);return{x:a.x+_*m+(m-w)/2+P*E+1,y:Math.min(I,g),w:Math.max(1,E-2),h:Math.abs(g-I),value:C}}))}function Rl(t){let o="",a=!1;for(let c of t){if(!c){a=!1;continue}o+=`${a?"L":"M"}${Ue(c.x)} ${Ue(c.y)}`,a=!0}return o}function Il(t,o){let a=t.filter(Boolean);if(!a.length)return"";let c=`M${Ue(a[0].x)} ${Ue(o)}`;for(let d of a)c+=`L${Ue(d.x)} ${Ue(d.y)}`;return c+=`L${Ue(a[a.length-1].x)} ${Ue(o)}Z`,c}function Pl(t,o,a,c,d=0){let p=t.map(E=>Math.max(0,Number(E)||0)),g=p.reduce((E,S)=>E+S,0);if(g<=0)throw new Error("pie needs at least one positive value");let m=(E,S)=>[o+S*Math.cos(E),a+S*Math.sin(E)],w=-Math.PI/2;return p.map(E=>{let S=E/g,P=w,$=w+S*2*Math.PI;w=$;let _=(P+$)/2,C=d>0?(c+d)/2:c*.66,[I,Se]=m(_,C),[de,$e]=m(_,c+14),te={value:E,frac:S,mid:_,labelX:I,labelY:Se,outX:de,outY:$e,anchor:Math.cos(_)<-1e-6?"end":Math.cos(_)>1e-6?"start":"middle"};if(S===0)return{...te,d:""};let ae;if(S>=.9999){let[Re,Fe]=m(P,c),[je,_e]=m(P+Math.PI,c);if(ae=`M${Ue(Re)} ${Ue(Fe)}A${Ue(c)} ${Ue(c)} 0 1 1 ${Ue(je)} ${Ue(_e)}A${Ue(c)} ${Ue(c)} 0 1 1 ${Ue(Re)} ${Ue(Fe)}Z`,d>0){let[Ae,st]=m(P,d),[bt,T]=m(P+Math.PI,d);ae+=`M${Ue(Ae)} ${Ue(st)}A${Ue(d)} ${Ue(d)} 0 1 0 ${Ue(bt)} ${Ue(T)}A${Ue(d)} ${Ue(d)} 0 1 0 ${Ue(Ae)} ${Ue(st)}Z`}}else{let Re=$-P>Math.PI?1:0,[Fe,je]=m(P,c),[_e,Ae]=m($,c);if(d>0){let[st,bt]=m($,d),[T,Ke]=m(P,d);ae=`M${Ue(Fe)} ${Ue(je)}A${Ue(c)} ${Ue(c)} 0 ${Re} 1 ${Ue(_e)} ${Ue(Ae)}L${Ue(st)} ${Ue(bt)}A${Ue(d)} ${Ue(d)} 0 ${Re} 0 ${Ue(T)} ${Ue(Ke)}Z`}else ae=`M${Ue(o)} ${Ue(a)}L${Ue(Fe)} ${Ue(je)}A${Ue(c)} ${Ue(c)} 0 ${Re} 1 ${Ue(_e)} ${Ue(Ae)}Z`}return{...te,d:ae}})}var Tr='fill="var(--d-text)"';function Js(t,o){return`<g class="chart-series" data-series="${o+1}" data-name="${$t(t.name)}"`+(t.concept?` data-concept="${$t(t.concept)}"`:"")+">"}function Bl(t,o,a){let c=t.series.flatMap(C=>C.data).filter(C=>C!=null),d=Math.min(0,...c),p=Math.max(0,...c),g=Ml(d,p===d?d+1:p,5),m=g.ticks.map(C=>Ol(C,g.step)),w=14+Math.max(...m.map(C=>C.length))*6.6+8,E={x:w,y:t.title||Vo(t)?40:18,w:t.width-w-14,h:0};E.h=t.height-E.y-34;let S=g.max-g.min||1,P=C=>E.y+E.h*(1-(C-g.min)/S);g.ticks.forEach((C,I)=>{let Se=P(C);o.push(`<line class="chart-grid" x1="${Ue(E.x)}" y1="${Ue(Se)}" x2="${Ue(E.x+E.w)}" y2="${Ue(Se)}" stroke="var(--d-muted)" stroke-opacity="0.35" stroke-width="1"/>`),o.push(`<text class="chart-tick" x="${Ue(E.x-8)}" y="${Ue(Se+4)}" text-anchor="end" font-size="11" ${Tr}>${$t(m[I])}</text>`)}),o.push(`<line class="chart-axis" x1="${Ue(E.x)}" y1="${Ue(E.y)}" x2="${Ue(E.x)}" y2="${Ue(E.y+E.h)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let $=P(Math.max(g.min,Math.min(g.max,0)));o.push(`<line class="chart-axis" x1="${Ue(E.x)}" y1="${Ue($)}" x2="${Ue(E.x+E.w)}" y2="${Ue($)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let _=E.w/t.labels.length;if(t.labels.forEach((C,I)=>{o.push(`<text class="chart-cat" x="${Ue(E.x+(I+.5)*_)}" y="${Ue(E.y+E.h+20)}" text-anchor="middle" font-size="12" ${Tr}>${$t(C)}</text>`)}),t.type==="bar"){let C=Ll(t.series,t.labels.length,E,g);t.series.forEach((I,Se)=>{a.push(Js(I,Se)),C[Se].forEach(de=>{de&&a.push(`<rect class="chart-bar draw-fade" x="${Ue(de.x)}" y="${Ue(de.y)}" width="${Ue(de.w)}" height="${Ue(de.h)}" rx="2" fill="${_r(Se)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`)}),a.push("</g>")})}else t.series.forEach((C,I)=>{let Se=C.data.map((te,ae)=>te==null?null:{x:E.x+(ae+.5)*_,y:P(te)}),de=Rl(Se),$e='stroke-linejoin="round" stroke-linecap="round"';if(a.push(Js(C,I)),t.type==="area"&&a.push(`<path class="chart-area draw-fade" d="${Il(Se,$)}" fill="${_r(I)}" fill-opacity="0.35"/>`),a.push(`<g class="chart-casing"><path d="${de}" fill="none" stroke="var(--d-stroke)" stroke-width="4.5" ${$e}/></g>`),a.push(`<path class="chart-line" d="${de}" fill="none" stroke="${_r(I)}" stroke-width="2.5" ${$e}/>`),t.type==="line")for(let te of Se)te&&a.push(`<circle class="chart-dot draw-fade" cx="${Ue(te.x)}" cy="${Ue(te.y)}" r="4" fill="${_r(I)}" stroke="var(--d-stroke)" stroke-width="1"/>`);a.push("</g>")})}function Dl(t,o){let a=t.title?40:16,c=t.width/2,d=a+(t.height-a-12)/2,p=Math.max(24,Math.min((t.height-a-12)/2-26,t.width/2-110)),g=Pl(t.series[0].data.map(m=>m??0),c,d,p,t.donut?p*.55:0);o.push(Js(t.series[0],0)),g.forEach((m,w)=>{m.d&&(o.push(`<path class="chart-slice draw-fade" d="${m.d}" fill="${_r(w)}" fill-rule="evenodd" stroke="var(--d-stroke)" stroke-width="1.5" stroke-linejoin="round"/>`),o.push(`<text class="chart-cat draw-fade" x="${Ue(m.outX)}" y="${Ue(m.outY+4)}" text-anchor="${m.anchor}" font-size="12" ${Tr}>${$t(t.labels[w])}</text>`),m.frac>=.05&&o.push(`<text class="chart-value draw-fade" x="${Ue(m.labelX)}" y="${Ue(m.labelY+4)}" text-anchor="middle" font-size="12" font-weight="600" ${Tr}>${Math.round(m.frac*100)}%</text>`))}),o.push("</g>")}function Vo(t){return t.legend===!0?!0:t.legend===!1?!1:t.type!=="pie"&&t.series.length>1}function ql(t){let o=[],a=[];if(t.title&&o.push(`<text class="chart-title" x="14" y="24" font-size="15" font-weight="600" ${Tr}>${$t(t.title)}</text>`),Vo(t)){let d=t.series.map(g=>({name:g.name,w:g.name.length*6.6+24})),p=t.width-14-d.reduce((g,m)=>g+m.w,0);t.series.forEach((g,m)=>{o.push(`<rect class="chart-swatch" x="${Ue(p)}" y="14" width="11" height="11" rx="2" fill="${_r(m)}" stroke="var(--d-stroke)" stroke-width="1"/>`),o.push(`<text class="chart-legend" x="${Ue(p+16)}" y="24" font-size="12" ${Tr}>${$t(g.name)}</text>`),p+=d[m].w})}t.type==="pie"?Dl(t,a):Bl(t,o,a);let c=t.title?`${t.title} \u2014 ${t.type} chart`:`${t.type} chart`;return`<svg class="chart-svg" viewBox="0 0 ${t.width} ${t.height}" role="img" aria-label="${$t(c)}" preserveAspectRatio="xMidYMid meet"><g class="chart-chrome" data-build-stay>${o.join("")}</g>`+a.join("")+"</svg>"}function Zo(t){t.querySelectorAll("[data-chart]").forEach(o=>{if(o.querySelector(":scope > svg.chart-svg, :scope > .chart-broken"))return;o.classList.add("chart");let a=o.querySelector('script[type="application/json"]');try{let c=Nl(a?a.textContent:null,{type:o.getAttribute("data-chart")||void 0,title:o.getAttribute("data-title")||void 0,aspect:o.getAttribute("data-aspect")||void 0}),d=document.createElement("template");d.innerHTML=ql(c);let p=d.content.firstElementChild;o.hasAttribute("data-build")?(p.setAttribute("data-build",o.getAttribute("data-build")),o.removeAttribute("data-build")):c.build!=null&&c.build!==!1&&p.setAttribute("data-build",c.build===!0?"":String(c.build)),o.getAttribute("data-chart")||o.setAttribute("data-chart",c.donut?"donut":c.type),o.insertBefore(p,a)}catch(c){let d=document.createElement("div");d.className="chart-broken",d.textContent=`chart: ${c.message||c}`,o.insertBefore(d,a)}})}ge();be();ge();be();function ys(t,o){let a=String(t??"").trim(),c=parseFloat(a);return!Number.isFinite(c)||c<=0?o:a.endsWith("ms")?c:a.endsWith("s")?c*1e3:c}var Wr=["opacity","color","backgroundColor","borderRadius","fontSize"],Yo=(t=Wr)=>["transform",...t.map(o=>o.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`))];function Xo(t,o,a,c=!1){let d=a?.x||1,p=a?.y||1,g=(t.rect.left-o.rect.left)/d,m=(t.rect.top-o.rect.top)/p,w=c||!o.rect.width?1:t.rect.width/o.rect.width,E=c||!o.rect.height?1:t.rect.height/o.rect.height;return{dx:g,dy:m,sx:w,sy:E}}function Jo({dx:t,dy:o,sx:a,sy:c}){return!t&&!o&&a===1&&c===1?"":`translate(${t}px, ${o}px) scale(${a}, ${c})`}var Qo=(t,o)=>t||o||"fade";function ei(t,o){if(t==="none")return null;let a=`dir-${o}`;return{entering:["entering",`tr-${t}`,a],leaving:["leaving",`tr-${t}`,a,"active-out"]}}var Fl=Yo();function ti(t){let o=getComputedStyle(t),a={rect:t.getBoundingClientRect()};for(let c of Wr)a[c]=o[c];return a}function zl(t,o){if(t.ownerSVGElement){let a=t.getScreenCTM?.();if(a&&a.a&&a.d)return{x:a.a,y:a.d}}return{x:o,y:o}}function ni(t,o,a){let c=ys(getComputedStyle(o).getPropertyValue("--auto-animate-duration"),500),d=new Map;t.querySelectorAll("[data-id]").forEach(m=>{d.set(m.getAttribute("data-id"),ti(m))});let p=[];o.querySelectorAll("[data-id]").forEach(m=>{let w=d.get(m.getAttribute("data-id"));w&&p.push({el:m,o:w})});for(let{el:m,o:w}of p){let E=ti(m),S=zl(m,a),P=m.children.length===0&&w.fontSize!==E.fontSize,$=Xo(w,E,S,P),_=m.getAttribute("style")??"";m.style.transition="none",m.ownerSVGElement&&(m.style.transformBox="fill-box"),m.style.transformOrigin="0 0",m.style.transform=Jo($);for(let I of Wr)m.style[I]=w[I];m.offsetWidth,m.style.transition=Fl.map(I=>`${I} ${c}ms ease`).join(", "),m.style.transform="";for(let I of Wr)m.style[I]=E[I];let C=()=>{_?m.setAttribute("style",_):m.removeAttribute("style"),m.removeEventListener("transitionend",C)};m.addEventListener("transitionend",C),setTimeout(C,c+80)}let g=new Set(p.map(m=>m.el));return[...o.children].forEach(m=>{m.matches("aside.notes")||g.has(m)||[...g].some(E=>m.contains(E))||(m.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>m.classList.add("aa-in"))),setTimeout(()=>m.classList.remove("aa-fresh","aa-in"),c+120))}),c}ge();be();ge();be();var ri=function(){"use strict";class t{constructor(n,r){let l,u=" "+n,h=r&&r.loc;if(h&&h.start<=h.end){let x=h.lexer.input;l=h.start;let q=h.end;l===x.length?u+=" at end of input: ":u+=" at position "+(l+1)+`:
|
|
5
|
-
`;let Z=x.slice(l,q).replace(/[^]/g,"$&\u0332"),ve,Te;ve=l>15?"\u2026"+x.slice(l-15,l):x.slice(0,l),Te=q+15<x.length?x.slice(q,q+15)+"\u2026":x.slice(q),u+=ve+Z+Te}let y=new Error(u);return y.name="ParseError",y.__proto__=t.prototype,y.position=l,y}}t.prototype.__proto__=Error.prototype;let o=function(e,n){return e===void 0?n:e},a=/([A-Z])/g,c=function(e){return e.replace(a,"-$1").toLowerCase()},d={"&":"&",">":">","<":"<",'"':""","'":"'"},p=/[&><"']/g;function g(e){return String(e).replace(p,n=>d[n])}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},w=function(e){let n=m(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},E=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 P{constructor(n){n=n||{},this.displayMode=o(n.displayMode,!1),this.annotate=o(n.annotate,!1),this.leqno=o(n.leqno,!1),this.throwOnError=o(n.throwOnError,!1),this.errorColor=o(n.errorColor,"#b22222"),this.macros=n.macros||{},this.wrap=o(n.wrap,"none"),this.xml=o(n.xml,!1),this.colorIsTextColor=o(n.colorIsTextColor,!1),this.strict=o(n.strict,!1),this.trust=o(n.trust,!1),this.maxSize=n.maxSize===void 0?[1/0,1/0]:Array.isArray(n.maxSize)?n.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,o(n.maxExpand,1e3)),this.wrapDelimiterPairs=!0}isTrusted(n){if(n.url&&!n.protocol){let l=function(u){let h=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(u);return h?h[2]!==":"?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(h[1])?h[1].toLowerCase():null:"_relative"}(n.url);if(l==null)return!1;n.protocol=l}return!!(typeof this.trust=="function"?this.trust(n):this.trust)}}let $={},_={};function C({type:e,names:n,props:r,handler:l,mathmlBuilder:u}){let h={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:l};for(let y=0;y<n.length;++y)$[n[y]]=h;e&&u&&(_[e]=u)}function I({type:e,mathmlBuilder:n}){C({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:n})}let Se=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},de=function(e){return e.type==="ordgroup"?e.body:[e]};class $e{constructor(n){this.children=n,this.classes=[],this.style={}}hasClass(n){return this.classes.includes(n)}toNode(){let n=document.createDocumentFragment();for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){let n="";for(let r=0;r<this.children.length;r++)n+=this.children[r].toMarkup();return n}toText(){return this.children.map(n=>n.toText()).join("")}}let te=function(e){return e.filter(n=>n).join(" ")},ae=function(e,n){this.classes=e||[],this.attributes={},this.style=n||{}},Re=function(e){let n=document.createElement(e);n.className=te(this.classes);for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n.style[r]=this.style[r]);for(let r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n},Fe=function(e){let n=`<${e}`;this.classes.length&&(n+=` class="${g(te(this.classes))}"`);let r="";for(let l in this.style)Object.prototype.hasOwnProperty.call(this.style,l)&&(r+=`${c(l)}:${this.style[l]};`);r&&(n+=` style="${r}"`);for(let l in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,l)&&(n+=` ${l}="${g(this.attributes[l])}"`);n+=">";for(let l=0;l<this.children.length;l++)n+=this.children[l].toMarkup();return n+=`</${e}>`,n};class je{constructor(n,r,l){ae.call(this,n,l),this.children=r||[]}setAttribute(n,r){this.attributes[n]=r}toNode(){return Re.call(this,"span")}toMarkup(){return Fe.call(this,"span")}}let _e=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return g(this.text)}};class Ae{constructor(n,r,l){this.href=n,this.classes=r,this.children=l||[]}toNode(){let n=document.createElement("a");n.setAttribute("href",this.href),this.classes.length>0&&(n.className=te(this.classes));for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){let n=`<a href='${g(this.href)}'`;this.classes.length>0&&(n+=` class="${g(te(this.classes))}"`),n+=">";for(let r=0;r<this.children.length;r++)n+=this.children[r].toMarkup();return n+="</a>",n}}class st{constructor(n,r,l){this.alt=r,this.src=n,this.classes=["mord"],this.style=l}hasClass(n){return this.classes.includes(n)}toNode(){let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.className="mord";for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n.style[r]=this.style[r]);return n}toMarkup(){let n=`<img src='${this.src}' alt='${this.alt}'`,r="";for(let l in this.style)Object.prototype.hasOwnProperty.call(this.style,l)&&(r+=`${c(l)}:${this.style[l]};`);return r&&(n+=` style="${g(r)}"`),n+=">",n}}function bt(e){return new $e(e)}class T{constructor(n,r,l,u){this.type=n,this.attributes={},this.children=r||[],this.classes=l||[],this.style=u||{},this.label=""}setAttribute(n,r){this.attributes[n]=r}getAttribute(n){return this.attributes[n]}setLabel(n){this.label=n}toNode(){let n=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(let r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);this.classes.length>0&&(n.className=te(this.classes));for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n.style[r]=this.style[r]);for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){let n="<"+this.type;for(let l in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,l)&&(n+=" "+l+'="',n+=g(this.attributes[l]),n+='"');this.classes.length>0&&(n+=` class="${g(te(this.classes))}"`);let r="";for(let l in this.style)Object.prototype.hasOwnProperty.call(this.style,l)&&(r+=`${c(l)}:${this.style[l]};`);r&&(n+=` style="${r}"`),n+=">";for(let l=0;l<this.children.length;l++)n+=this.children[l].toMarkup();return n+="</"+this.type+">",n}toText(){return this.children.map(n=>n.toText()).join("")}}class Ke{constructor(n){this.text=n}toNode(){return document.createTextNode(this.text)}toMarkup(){return g(this.toText())}toText(){return this.text}}let mt=e=>{let n;return e.length===1&&e[0].type==="mrow"?(n=e.pop(),n.type="mstyle"):n=new T("mstyle",e),n},dt=e=>{let n=0;if(e.body&&Array.isArray(e.body))for(let r of e.body)n+=dt(r);else if(e.body)n+=dt(e.body);else if(e.type==="supsub")n+=dt(e.base),e.sub&&(n+=.7*dt(e.sub)),e.sup&&(n+=.7*dt(e.sup));else if(e.type==="mathord"||e.type==="textord")for(let r of e.text.split("")){let l=r.codePointAt(0);n+=96<l&&l<123||944<l&&l<970?.56:47<l&&l<58?.5:.92}else n+=1;return n},G={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 n=new Ke(G[e.slice(1)]),r=new T("mo",[n]);return r.setAttribute("stretchy","true"),r},ne=["\\widetilde","\\widehat","\\widecheck","\\utilde"],fe=e=>{let n=J(e.label);if(ne.includes(e.label)){let r=dt(e.base);1<r&&r<1.6?n.classes.push("tml-crooked-2"):1.6<=r&&r<2.5?n.classes.push("tml-crooked-3"):2.5<=r&&n.classes.push("tml-crooked-4")}return n},ue={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ie={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Q={math:{},text:{}};function s(e,n,r,l,u){Q[e][l]={group:n,replace:r},u&&r&&(Q[e][r]=Q[e][l])}let i="math",O="text",De="accent-token",B="bin",Pe="close",_t="inner",W="mathord",ye="op-token",ie="open",Ze="punct",v="rel",ze="spacing",f="textord";s(i,v,"\u2261","\\equiv",!0),s(i,v,"\u227A","\\prec",!0),s(i,v,"\u227B","\\succ",!0),s(i,v,"\u223C","\\sim",!0),s(i,v,"\u27C2","\\perp",!0),s(i,v,"\u2AAF","\\preceq",!0),s(i,v,"\u2AB0","\\succeq",!0),s(i,v,"\u2243","\\simeq",!0),s(i,v,"\u224C","\\backcong",!0),s(i,v,"|","\\mid",!0),s(i,v,"\u226A","\\ll",!0),s(i,v,"\u226B","\\gg",!0),s(i,v,"\u224D","\\asymp",!0),s(i,v,"\u2225","\\parallel"),s(i,v,"\u2323","\\smile",!0),s(i,v,"\u2291","\\sqsubseteq",!0),s(i,v,"\u2292","\\sqsupseteq",!0),s(i,v,"\u2250","\\doteq",!0),s(i,v,"\u2322","\\frown",!0),s(i,v,"\u220B","\\ni",!0),s(i,v,"\u220C","\\notni",!0),s(i,v,"\u221D","\\propto",!0),s(i,v,"\u22A2","\\vdash",!0),s(i,v,"\u22A3","\\dashv",!0),s(i,v,"\u220B","\\owns"),s(i,v,"\u2258","\\arceq",!0),s(i,v,"\u2259","\\wedgeq",!0),s(i,v,"\u225A","\\veeeq",!0),s(i,v,"\u225B","\\stareq",!0),s(i,v,"\u225D","\\eqdef",!0),s(i,v,"\u225E","\\measeq",!0),s(i,v,"\u225F","\\questeq",!0),s(i,v,"\u2260","\\ne",!0),s(i,v,"\u2260","\\neq"),s(i,v,"\u2A75","\\eqeq",!0),s(i,v,"\u2A76","\\eqeqeq",!0),s(i,v,"\u2237","\\dblcolon",!0),s(i,v,"\u2254","\\coloneqq",!0),s(i,v,"\u2255","\\eqqcolon",!0),s(i,v,"\u2239","\\eqcolon",!0),s(i,v,"\u2A74","\\Coloneqq",!0),s(i,Ze,".","\\ldotp"),s(i,Ze,"\xB7","\\cdotp"),s(i,f,"#","\\#"),s(O,f,"#","\\#"),s(i,f,"&","\\&"),s(O,f,"&","\\&"),s(i,f,"\u2135","\\aleph",!0),s(i,f,"\u2200","\\forall",!0),s(i,f,"\u210F","\\hbar",!0),s(i,f,"\u2203","\\exists",!0),s(i,ie,"\u2207","\\nabla",!0),s(i,f,"\u266D","\\flat",!0),s(i,f,"\u2113","\\ell",!0),s(i,f,"\u266E","\\natural",!0),s(i,f,"\u212B","\\Angstrom",!0),s(O,f,"\u212B","\\Angstrom",!0),s(i,f,"\u2663","\\clubsuit",!0),s(i,f,"\u2667","\\varclubsuit",!0),s(i,f,"\u2118","\\wp",!0),s(i,f,"\u266F","\\sharp",!0),s(i,f,"\u2662","\\diamondsuit",!0),s(i,f,"\u2666","\\vardiamondsuit",!0),s(i,f,"\u211C","\\Re",!0),s(i,f,"\u2661","\\heartsuit",!0),s(i,f,"\u2665","\\varheartsuit",!0),s(i,f,"\u2111","\\Im",!0),s(i,f,"\u2660","\\spadesuit",!0),s(i,f,"\u2664","\\varspadesuit",!0),s(i,f,"\u2640","\\female",!0),s(i,f,"\u2642","\\male",!0),s(i,f,"\xA7","\\S",!0),s(O,f,"\xA7","\\S"),s(i,f,"\xB6","\\P",!0),s(O,f,"\xB6","\\P"),s(O,f,"\u263A","\\smiley",!0),s(i,f,"\u263A","\\smiley",!0),s(i,f,"\u2020","\\dag"),s(O,f,"\u2020","\\dag"),s(O,f,"\u2020","\\textdagger"),s(i,f,"\u2021","\\ddag"),s(O,f,"\u2021","\\ddag"),s(O,f,"\u2021","\\textdaggerdbl"),s(i,Pe,"\u23B1","\\rmoustache",!0),s(i,ie,"\u23B0","\\lmoustache",!0),s(i,Pe,"\u27EF","\\rgroup",!0),s(i,ie,"\u27EE","\\lgroup",!0),s(i,B,"\u2213","\\mp",!0),s(i,B,"\u2296","\\ominus",!0),s(i,B,"\u228E","\\uplus",!0),s(i,B,"\u2293","\\sqcap",!0),s(i,B,"\u2217","\\ast"),s(i,B,"\u2294","\\sqcup",!0),s(i,B,"\u25EF","\\bigcirc",!0),s(i,B,"\u2219","\\bullet",!0),s(i,B,"\u2021","\\ddagger"),s(i,B,"\u2240","\\wr",!0),s(i,B,"\u2A3F","\\amalg"),s(i,B,"&","\\And"),s(i,B,"\u2AFD","\\sslash",!0),s(i,v,"\u27F5","\\longleftarrow",!0),s(i,v,"\u21D0","\\Leftarrow",!0),s(i,v,"\u27F8","\\Longleftarrow",!0),s(i,v,"\u27F6","\\longrightarrow",!0),s(i,v,"\u21D2","\\Rightarrow",!0),s(i,v,"\u27F9","\\Longrightarrow",!0),s(i,v,"\u2194","\\leftrightarrow",!0),s(i,v,"\u27F7","\\longleftrightarrow",!0),s(i,v,"\u21D4","\\Leftrightarrow",!0),s(i,v,"\u27FA","\\Longleftrightarrow",!0),s(i,v,"\u21A4","\\mapsfrom",!0),s(i,v,"\u21A6","\\mapsto",!0),s(i,v,"\u27FC","\\longmapsto",!0),s(i,v,"\u2197","\\nearrow",!0),s(i,v,"\u21A9","\\hookleftarrow",!0),s(i,v,"\u21AA","\\hookrightarrow",!0),s(i,v,"\u2198","\\searrow",!0),s(i,v,"\u21BC","\\leftharpoonup",!0),s(i,v,"\u21C0","\\rightharpoonup",!0),s(i,v,"\u2199","\\swarrow",!0),s(i,v,"\u21BD","\\leftharpoondown",!0),s(i,v,"\u21C1","\\rightharpoondown",!0),s(i,v,"\u2196","\\nwarrow",!0),s(i,v,"\u21CC","\\rightleftharpoons",!0),s(i,W,"\u21AF","\\lightning",!0),s(i,W,"\u220E","\\QED",!0),s(i,W,"\u2030","\\permil",!0),s(O,f,"\u2030","\\permil"),s(i,W,"\u2609","\\astrosun",!0),s(i,W,"\u263C","\\sun",!0),s(i,W,"\u263E","\\leftmoon",!0),s(i,W,"\u263D","\\rightmoon",!0),s(i,W,"\u2295","\\Earth"),s(i,v,"\u226E","\\nless",!0),s(i,v,"\u2A87","\\lneq",!0),s(i,v,"\u2268","\\lneqq",!0),s(i,v,"\u2268\uFE00","\\lvertneqq"),s(i,v,"\u22E6","\\lnsim",!0),s(i,v,"\u2A89","\\lnapprox",!0),s(i,v,"\u2280","\\nprec",!0),s(i,v,"\u22E0","\\npreceq",!0),s(i,v,"\u22E8","\\precnsim",!0),s(i,v,"\u2AB9","\\precnapprox",!0),s(i,v,"\u2241","\\nsim",!0),s(i,v,"\u2224","\\nmid",!0),s(i,v,"\u2224","\\nshortmid"),s(i,v,"\u22AC","\\nvdash",!0),s(i,v,"\u22AD","\\nvDash",!0),s(i,v,"\u22EA","\\ntriangleleft"),s(i,v,"\u22EC","\\ntrianglelefteq",!0),s(i,v,"\u2284","\\nsubset",!0),s(i,v,"\u2285","\\nsupset",!0),s(i,v,"\u228A","\\subsetneq",!0),s(i,v,"\u228A\uFE00","\\varsubsetneq"),s(i,v,"\u2ACB","\\subsetneqq",!0),s(i,v,"\u2ACB\uFE00","\\varsubsetneqq"),s(i,v,"\u226F","\\ngtr",!0),s(i,v,"\u2A88","\\gneq",!0),s(i,v,"\u2269","\\gneqq",!0),s(i,v,"\u2269\uFE00","\\gvertneqq"),s(i,v,"\u22E7","\\gnsim",!0),s(i,v,"\u2A8A","\\gnapprox",!0),s(i,v,"\u2281","\\nsucc",!0),s(i,v,"\u22E1","\\nsucceq",!0),s(i,v,"\u22E9","\\succnsim",!0),s(i,v,"\u2ABA","\\succnapprox",!0),s(i,v,"\u2246","\\ncong",!0),s(i,v,"\u2226","\\nparallel",!0),s(i,v,"\u2226","\\nshortparallel"),s(i,v,"\u22AF","\\nVDash",!0),s(i,v,"\u22EB","\\ntriangleright"),s(i,v,"\u22ED","\\ntrianglerighteq",!0),s(i,v,"\u228B","\\supsetneq",!0),s(i,v,"\u228B","\\varsupsetneq"),s(i,v,"\u2ACC","\\supsetneqq",!0),s(i,v,"\u2ACC\uFE00","\\varsupsetneqq"),s(i,v,"\u22AE","\\nVdash",!0),s(i,v,"\u2AB5","\\precneqq",!0),s(i,v,"\u2AB6","\\succneqq",!0),s(i,B,"\u22B4","\\unlhd"),s(i,B,"\u22B5","\\unrhd"),s(i,v,"\u219A","\\nleftarrow",!0),s(i,v,"\u219B","\\nrightarrow",!0),s(i,v,"\u21CD","\\nLeftarrow",!0),s(i,v,"\u21CF","\\nRightarrow",!0),s(i,v,"\u21AE","\\nleftrightarrow",!0),s(i,v,"\u21CE","\\nLeftrightarrow",!0),s(i,v,"\u25B3","\\vartriangle"),s(i,f,"\u210F","\\hslash"),s(i,f,"\u25BD","\\triangledown"),s(i,f,"\u25CA","\\lozenge"),s(i,f,"\u24C8","\\circledS"),s(i,f,"\xAE","\\circledR",!0),s(O,f,"\xAE","\\circledR"),s(O,f,"\xAE","\\textregistered"),s(i,f,"\u2221","\\measuredangle",!0),s(i,f,"\u2204","\\nexists"),s(i,f,"\u2127","\\mho"),s(i,f,"\u2132","\\Finv",!0),s(i,f,"\u2141","\\Game",!0),s(i,f,"\u2035","\\backprime"),s(i,f,"\u2036","\\backdprime"),s(i,f,"\u2037","\\backtrprime"),s(i,f,"\u25B2","\\blacktriangle"),s(i,f,"\u25BC","\\blacktriangledown"),s(i,f,"\u25A0","\\blacksquare"),s(i,f,"\u29EB","\\blacklozenge"),s(i,f,"\u2605","\\bigstar"),s(i,f,"\u2222","\\sphericalangle",!0),s(i,f,"\u2201","\\complement",!0),s(i,f,"\u2571","\\diagup"),s(i,f,"\u2572","\\diagdown"),s(i,f,"\u25A1","\\square"),s(i,f,"\u25A1","\\Box"),s(i,f,"\u25CA","\\Diamond"),s(i,f,"\xA5","\\yen",!0),s(O,f,"\xA5","\\yen",!0),s(i,f,"\u2713","\\checkmark",!0),s(O,f,"\u2713","\\checkmark"),s(i,f,"\u2717","\\ballotx",!0),s(O,f,"\u2717","\\ballotx"),s(O,f,"\u2022","\\textbullet"),s(i,f,"\u2136","\\beth",!0),s(i,f,"\u2138","\\daleth",!0),s(i,f,"\u2137","\\gimel",!0),s(i,f,"\u03DD","\\digamma",!0),s(i,f,"\u03F0","\\varkappa"),s(i,ie,"\u231C","\\ulcorner",!0),s(i,Pe,"\u231D","\\urcorner",!0),s(i,ie,"\u231E","\\llcorner",!0),s(i,Pe,"\u231F","\\lrcorner",!0),s(i,v,"\u2266","\\leqq",!0),s(i,v,"\u2A7D","\\leqslant",!0),s(i,v,"\u2A95","\\eqslantless",!0),s(i,v,"\u2272","\\lesssim",!0),s(i,v,"\u2A85","\\lessapprox",!0),s(i,v,"\u224A","\\approxeq",!0),s(i,B,"\u22D6","\\lessdot"),s(i,v,"\u22D8","\\lll",!0),s(i,v,"\u2276","\\lessgtr",!0),s(i,v,"\u22DA","\\lesseqgtr",!0),s(i,v,"\u2A8B","\\lesseqqgtr",!0),s(i,v,"\u2251","\\doteqdot"),s(i,v,"\u2253","\\risingdotseq",!0),s(i,v,"\u2252","\\fallingdotseq",!0),s(i,v,"\u223D","\\backsim",!0),s(i,v,"\u22CD","\\backsimeq",!0),s(i,v,"\u2AC5","\\subseteqq",!0),s(i,v,"\u22D0","\\Subset",!0),s(i,v,"\u228F","\\sqsubset",!0),s(i,v,"\u227C","\\preccurlyeq",!0),s(i,v,"\u22DE","\\curlyeqprec",!0),s(i,v,"\u227E","\\precsim",!0),s(i,v,"\u2AB7","\\precapprox",!0),s(i,v,"\u22B2","\\vartriangleleft"),s(i,v,"\u22B4","\\trianglelefteq"),s(i,v,"\u22A8","\\vDash",!0),s(i,v,"\u22AB","\\VDash",!0),s(i,v,"\u22AA","\\Vvdash",!0),s(i,v,"\u2323","\\smallsmile"),s(i,v,"\u2322","\\smallfrown"),s(i,v,"\u224F","\\bumpeq",!0),s(i,v,"\u224E","\\Bumpeq",!0),s(i,v,"\u2267","\\geqq",!0),s(i,v,"\u2A7E","\\geqslant",!0),s(i,v,"\u2A96","\\eqslantgtr",!0),s(i,v,"\u2273","\\gtrsim",!0),s(i,v,"\u2A86","\\gtrapprox",!0),s(i,B,"\u22D7","\\gtrdot"),s(i,v,"\u22D9","\\ggg",!0),s(i,v,"\u2277","\\gtrless",!0),s(i,v,"\u22DB","\\gtreqless",!0),s(i,v,"\u2A8C","\\gtreqqless",!0),s(i,v,"\u2256","\\eqcirc",!0),s(i,v,"\u2257","\\circeq",!0),s(i,v,"\u225C","\\triangleq",!0),s(i,v,"\u223C","\\thicksim"),s(i,v,"\u2248","\\thickapprox"),s(i,v,"\u2AC6","\\supseteqq",!0),s(i,v,"\u22D1","\\Supset",!0),s(i,v,"\u2290","\\sqsupset",!0),s(i,v,"\u227D","\\succcurlyeq",!0),s(i,v,"\u22DF","\\curlyeqsucc",!0),s(i,v,"\u227F","\\succsim",!0),s(i,v,"\u2AB8","\\succapprox",!0),s(i,v,"\u22B3","\\vartriangleright"),s(i,v,"\u22B5","\\trianglerighteq"),s(i,v,"\u22A9","\\Vdash",!0),s(i,v,"\u2223","\\shortmid"),s(i,v,"\u2225","\\shortparallel"),s(i,v,"\u226C","\\between",!0),s(i,v,"\u22D4","\\pitchfork",!0),s(i,v,"\u221D","\\varpropto"),s(i,v,"\u25C0","\\blacktriangleleft"),s(i,v,"\u2234","\\therefore",!0),s(i,v,"\u220D","\\backepsilon"),s(i,v,"\u25B6","\\blacktriangleright"),s(i,v,"\u2235","\\because",!0),s(i,v,"\u22D8","\\llless"),s(i,v,"\u22D9","\\gggtr"),s(i,B,"\u22B2","\\lhd"),s(i,B,"\u22B3","\\rhd"),s(i,v,"\u2242","\\eqsim",!0),s(i,v,"\u2251","\\Doteq",!0),s(i,v,"\u297D","\\strictif",!0),s(i,v,"\u297C","\\strictfi",!0),s(i,B,"\u2214","\\dotplus",!0),s(i,B,"\u2216","\\smallsetminus"),s(i,B,"\u22D2","\\Cap",!0),s(i,B,"\u22D3","\\Cup",!0),s(i,B,"\u2A5E","\\doublebarwedge",!0),s(i,B,"\u229F","\\boxminus",!0),s(i,B,"\u229E","\\boxplus",!0),s(i,B,"\u29C4","\\boxslash",!0),s(i,B,"\u22C7","\\divideontimes",!0),s(i,B,"\u22C9","\\ltimes",!0),s(i,B,"\u22CA","\\rtimes",!0),s(i,B,"\u22CB","\\leftthreetimes",!0),s(i,B,"\u22CC","\\rightthreetimes",!0),s(i,B,"\u22CF","\\curlywedge",!0),s(i,B,"\u22CE","\\curlyvee",!0),s(i,B,"\u229D","\\circleddash",!0),s(i,B,"\u229B","\\circledast",!0),s(i,B,"\u22BA","\\intercal",!0),s(i,B,"\u22D2","\\doublecap"),s(i,B,"\u22D3","\\doublecup"),s(i,B,"\u22A0","\\boxtimes",!0),s(i,B,"\u22C8","\\bowtie",!0),s(i,B,"\u22C8","\\Join"),s(i,B,"\u27D5","\\leftouterjoin",!0),s(i,B,"\u27D6","\\rightouterjoin",!0),s(i,B,"\u27D7","\\fullouterjoin",!0),s(i,B,"\u2238","\\dotminus",!0),s(i,B,"\u27D1","\\wedgedot",!0),s(i,B,"\u27C7","\\veedot",!0),s(i,B,"\u2A62","\\doublebarvee",!0),s(i,B,"\u2A63","\\veedoublebar",!0),s(i,B,"\u2A5F","\\wedgebar",!0),s(i,B,"\u2A60","\\wedgedoublebar",!0),s(i,B,"\u2A54","\\Vee",!0),s(i,B,"\u2A53","\\Wedge",!0),s(i,B,"\u2A43","\\barcap",!0),s(i,B,"\u2A42","\\barcup",!0),s(i,B,"\u2A48","\\capbarcup",!0),s(i,B,"\u2A40","\\capdot",!0),s(i,B,"\u2A47","\\capovercup",!0),s(i,B,"\u2A46","\\cupovercap",!0),s(i,B,"\u2A4D","\\closedvarcap",!0),s(i,B,"\u2A4C","\\closedvarcup",!0),s(i,B,"\u2A2A","\\minusdot",!0),s(i,B,"\u2A2B","\\minusfdots",!0),s(i,B,"\u2A2C","\\minusrdots",!0),s(i,B,"\u22BB","\\Xor",!0),s(i,B,"\u22BC","\\Nand",!0),s(i,B,"\u22BD","\\Nor",!0),s(i,B,"\u22BD","\\barvee"),s(i,B,"\u2AF4","\\interleave",!0),s(i,B,"\u29E2","\\shuffle",!0),s(i,B,"\u2AF6","\\threedotcolon",!0),s(i,B,"\u2982","\\typecolon",!0),s(i,B,"\u223E","\\invlazys",!0),s(i,B,"\u2A4B","\\twocaps",!0),s(i,B,"\u2A4A","\\twocups",!0),s(i,B,"\u2A4E","\\Sqcap",!0),s(i,B,"\u2A4F","\\Sqcup",!0),s(i,B,"\u2A56","\\veeonvee",!0),s(i,B,"\u2A55","\\wedgeonwedge",!0),s(i,B,"\u29D7","\\blackhourglass",!0),s(i,B,"\u29C6","\\boxast",!0),s(i,B,"\u29C8","\\boxbox",!0),s(i,B,"\u29C7","\\boxcircle",!0),s(i,B,"\u229C","\\circledequal",!0),s(i,B,"\u29B7","\\circledparallel",!0),s(i,B,"\u29B6","\\circledvert",!0),s(i,B,"\u29B5","\\circlehbar",!0),s(i,B,"\u27E1","\\concavediamond",!0),s(i,B,"\u27E2","\\concavediamondtickleft",!0),s(i,B,"\u27E3","\\concavediamondtickright",!0),s(i,B,"\u22C4","\\diamond",!0),s(i,B,"\u29D6","\\hourglass",!0),s(i,B,"\u27E0","\\lozengeminus",!0),s(i,B,"\u233D","\\obar",!0),s(i,B,"\u29B8","\\obslash",!0),s(i,B,"\u2A38","\\odiv",!0),s(i,B,"\u29C1","\\ogreaterthan",!0),s(i,B,"\u29C0","\\olessthan",!0),s(i,B,"\u29B9","\\operp",!0),s(i,B,"\u2A37","\\Otimes",!0),s(i,B,"\u2A36","\\otimeshat",!0),s(i,B,"\u22C6","\\star",!0),s(i,B,"\u25B3","\\triangle",!0),s(i,B,"\u2A3A","\\triangleminus",!0),s(i,B,"\u2A39","\\triangleplus",!0),s(i,B,"\u2A3B","\\triangletimes",!0),s(i,B,"\u27E4","\\whitesquaretickleft",!0),s(i,B,"\u27E5","\\whitesquaretickright",!0),s(i,B,"\u2A33","\\smashtimes",!0),s(i,v,"\u21E2","\\dashrightarrow",!0),s(i,v,"\u21E0","\\dashleftarrow",!0),s(i,v,"\u21C7","\\leftleftarrows",!0),s(i,v,"\u21C6","\\leftrightarrows",!0),s(i,v,"\u21DA","\\Lleftarrow",!0),s(i,v,"\u219E","\\twoheadleftarrow",!0),s(i,v,"\u21A2","\\leftarrowtail",!0),s(i,v,"\u21AB","\\looparrowleft",!0),s(i,v,"\u21CB","\\leftrightharpoons",!0),s(i,v,"\u21B6","\\curvearrowleft",!0),s(i,v,"\u21BA","\\circlearrowleft",!0),s(i,v,"\u21B0","\\Lsh",!0),s(i,v,"\u21C8","\\upuparrows",!0),s(i,v,"\u21BF","\\upharpoonleft",!0),s(i,v,"\u21C3","\\downharpoonleft",!0),s(i,v,"\u22B6","\\origof",!0),s(i,v,"\u22B7","\\imageof",!0),s(i,v,"\u22B8","\\multimap",!0),s(i,v,"\u21AD","\\leftrightsquigarrow",!0),s(i,v,"\u21C9","\\rightrightarrows",!0),s(i,v,"\u21C4","\\rightleftarrows",!0),s(i,v,"\u21A0","\\twoheadrightarrow",!0),s(i,v,"\u21A3","\\rightarrowtail",!0),s(i,v,"\u21AC","\\looparrowright",!0),s(i,v,"\u21B7","\\curvearrowright",!0),s(i,v,"\u21BB","\\circlearrowright",!0),s(i,v,"\u21B1","\\Rsh",!0),s(i,v,"\u21CA","\\downdownarrows",!0),s(i,v,"\u21BE","\\upharpoonright",!0),s(i,v,"\u21C2","\\downharpoonright",!0),s(i,v,"\u21DD","\\rightsquigarrow",!0),s(i,v,"\u21DD","\\leadsto"),s(i,v,"\u21DB","\\Rrightarrow",!0),s(i,v,"\u21BE","\\restriction"),s(i,f,"\u2018","`"),s(i,f,"$","\\$"),s(O,f,"$","\\$"),s(O,f,"$","\\textdollar"),s(i,f,"\xA2","\\cent"),s(O,f,"\xA2","\\cent"),s(i,f,"%","\\%"),s(O,f,"%","\\%"),s(i,f,"_","\\_"),s(O,f,"_","\\_"),s(O,f,"_","\\textunderscore"),s(O,f,"\u2423","\\textvisiblespace",!0),s(i,f,"\u2220","\\angle",!0),s(i,f,"\u221E","\\infty",!0),s(i,f,"\u2032","\\prime"),s(i,f,"\u2033","\\dprime"),s(i,f,"\u2034","\\trprime"),s(i,f,"\u2057","\\qprime"),s(i,f,"\u25B3","\\triangle"),s(O,f,"\u0391","\\Alpha",!0),s(O,f,"\u0392","\\Beta",!0),s(O,f,"\u0393","\\Gamma",!0),s(O,f,"\u0394","\\Delta",!0),s(O,f,"\u0395","\\Epsilon",!0),s(O,f,"\u0396","\\Zeta",!0),s(O,f,"\u0397","\\Eta",!0),s(O,f,"\u0398","\\Theta",!0),s(O,f,"\u0399","\\Iota",!0),s(O,f,"\u039A","\\Kappa",!0),s(O,f,"\u039B","\\Lambda",!0),s(O,f,"\u039C","\\Mu",!0),s(O,f,"\u039D","\\Nu",!0),s(O,f,"\u039E","\\Xi",!0),s(O,f,"\u039F","\\Omicron",!0),s(O,f,"\u03A0","\\Pi",!0),s(O,f,"\u03A1","\\Rho",!0),s(O,f,"\u03A3","\\Sigma",!0),s(O,f,"\u03A4","\\Tau",!0),s(O,f,"\u03A5","\\Upsilon",!0),s(O,f,"\u03A6","\\Phi",!0),s(O,f,"\u03A7","\\Chi",!0),s(O,f,"\u03A8","\\Psi",!0),s(O,f,"\u03A9","\\Omega",!0),s(i,W,"\u0391","\\Alpha",!0),s(i,W,"\u0392","\\Beta",!0),s(i,W,"\u0393","\\Gamma",!0),s(i,W,"\u0394","\\Delta",!0),s(i,W,"\u0395","\\Epsilon",!0),s(i,W,"\u0396","\\Zeta",!0),s(i,W,"\u0397","\\Eta",!0),s(i,W,"\u0398","\\Theta",!0),s(i,W,"\u0399","\\Iota",!0),s(i,W,"\u039A","\\Kappa",!0),s(i,W,"\u039B","\\Lambda",!0),s(i,W,"\u039C","\\Mu",!0),s(i,W,"\u039D","\\Nu",!0),s(i,W,"\u039E","\\Xi",!0),s(i,W,"\u039F","\\Omicron",!0),s(i,W,"\u03A0","\\Pi",!0),s(i,W,"\u03A1","\\Rho",!0),s(i,W,"\u03A3","\\Sigma",!0),s(i,W,"\u03A4","\\Tau",!0),s(i,W,"\u03A5","\\Upsilon",!0),s(i,W,"\u03A6","\\Phi",!0),s(i,W,"\u03A7","\\Chi",!0),s(i,W,"\u03A8","\\Psi",!0),s(i,W,"\u03A9","\\Omega",!0),s(i,ie,"\xAC","\\neg",!0),s(i,ie,"\xAC","\\lnot"),s(i,f,"\u22A4","\\top"),s(i,f,"\u22A5","\\bot"),s(i,f,"\u2205","\\emptyset"),s(i,f,"\u2300","\\varnothing"),s(i,W,"\u03B1","\\alpha",!0),s(i,W,"\u03B2","\\beta",!0),s(i,W,"\u03B3","\\gamma",!0),s(i,W,"\u03B4","\\delta",!0),s(i,W,"\u03F5","\\epsilon",!0),s(i,W,"\u03B6","\\zeta",!0),s(i,W,"\u03B7","\\eta",!0),s(i,W,"\u03B8","\\theta",!0),s(i,W,"\u03B9","\\iota",!0),s(i,W,"\u03BA","\\kappa",!0),s(i,W,"\u03BB","\\lambda",!0),s(i,W,"\u03BC","\\mu",!0),s(i,W,"\u03BD","\\nu",!0),s(i,W,"\u03BE","\\xi",!0),s(i,W,"\u03BF","\\omicron",!0),s(i,W,"\u03C0","\\pi",!0),s(i,W,"\u03C1","\\rho",!0),s(i,W,"\u03C3","\\sigma",!0),s(i,W,"\u03C4","\\tau",!0),s(i,W,"\u03C5","\\upsilon",!0),s(i,W,"\u03D5","\\phi",!0),s(i,W,"\u03C7","\\chi",!0),s(i,W,"\u03C8","\\psi",!0),s(i,W,"\u03C9","\\omega",!0),s(i,W,"\u03B5","\\varepsilon",!0),s(i,W,"\u03D1","\\vartheta",!0),s(i,W,"\u03D6","\\varpi",!0),s(i,W,"\u03F1","\\varrho",!0),s(i,W,"\u03C2","\\varsigma",!0),s(i,W,"\u03C6","\\varphi",!0),s(i,W,"\u03D8","\\Coppa",!0),s(i,W,"\u03D9","\\coppa",!0),s(i,W,"\u03D9","\\varcoppa",!0),s(i,W,"\u03DE","\\Koppa",!0),s(i,W,"\u03DF","\\koppa",!0),s(i,W,"\u03E0","\\Sampi",!0),s(i,W,"\u03E1","\\sampi",!0),s(i,W,"\u03DA","\\Stigma",!0),s(i,W,"\u03DB","\\stigma",!0),s(i,W,"\u2AEB","\\Bot"),s(i,f,"\xF0","\\eth",!0),s(O,f,"\xF0","\xF0"),s(i,f,"\xC5","\\AA"),s(O,f,"\xC5","\\AA",!0),s(i,f,"\xC6","\\AE",!0),s(O,f,"\xC6","\\AE",!0),s(i,f,"\xD0","\\DH",!0),s(O,f,"\xD0","\\DH",!0),s(i,f,"\xDE","\\TH",!0),s(O,f,"\xDE","\\TH",!0),s(i,f,"\xDF","\\ss",!0),s(O,f,"\xDF","\\ss",!0),s(i,f,"\xE5","\\aa"),s(O,f,"\xE5","\\aa",!0),s(i,f,"\xE6","\\ae",!0),s(O,f,"\xE6","\\ae",!0),s(i,f,"\xF0","\\dh"),s(O,f,"\xF0","\\dh",!0),s(i,f,"\xFE","\\th",!0),s(O,f,"\xFE","\\th",!0),s(i,f,"\u0110","\\DJ",!0),s(O,f,"\u0110","\\DJ",!0),s(i,f,"\u0111","\\dj",!0),s(O,f,"\u0111","\\dj",!0),s(i,f,"\u0141","\\L",!0),s(O,f,"\u0141","\\L",!0),s(i,f,"\u0141","\\l",!0),s(O,f,"\u0141","\\l",!0),s(i,f,"\u014A","\\NG",!0),s(O,f,"\u014A","\\NG",!0),s(i,f,"\u014B","\\ng",!0),s(O,f,"\u014B","\\ng",!0),s(i,f,"\u0152","\\OE",!0),s(O,f,"\u0152","\\OE",!0),s(i,f,"\u0153","\\oe",!0),s(O,f,"\u0153","\\oe",!0),s(i,B,"\u2217","\u2217",!0),s(i,B,"+","+"),s(i,B,"\u2217","*"),s(i,B,"\u2044","/",!0),s(i,B,"\u2044","\u2044"),s(i,B,"\u2212","-",!0),s(i,B,"\u22C5","\\cdot",!0),s(i,B,"\u2218","\\circ",!0),s(i,B,"\xF7","\\div",!0),s(i,B,"\xB1","\\pm",!0),s(i,B,"\xD7","\\times",!0),s(i,B,"\u2229","\\cap",!0),s(i,B,"\u222A","\\cup",!0),s(i,B,"\u2216","\\setminus",!0),s(i,B,"\u2227","\\land"),s(i,B,"\u2228","\\lor"),s(i,B,"\u2227","\\wedge",!0),s(i,B,"\u2228","\\vee",!0),s(i,ie,"\u27E6","\\llbracket",!0),s(i,Pe,"\u27E7","\\rrbracket",!0),s(i,ie,"\u27E8","\\langle",!0),s(i,ie,"\u27EA","\\lAngle",!0),s(i,ie,"\u2989","\\llangle",!0),s(i,ie,"|","\\lvert"),s(i,ie,"\u2016","\\lVert",!0),s(i,f,"!","\\oc"),s(i,f,"?","\\wn"),s(i,f,"\u2193","\\shpos"),s(i,f,"\u2195","\\shift"),s(i,f,"\u2191","\\shneg"),s(i,Pe,"?","?"),s(i,Pe,"!","!"),s(i,Pe,"\u203C","\u203C"),s(i,Pe,"\u27E9","\\rangle",!0),s(i,Pe,"\u27EB","\\rAngle",!0),s(i,Pe,"\u298A","\\rrangle",!0),s(i,Pe,"|","\\rvert"),s(i,Pe,"\u2016","\\rVert"),s(i,ie,"\u2983","\\lBrace",!0),s(i,Pe,"\u2984","\\rBrace",!0),s(i,v,"=","\\equal",!0),s(i,v,":",":"),s(i,v,"\u2248","\\approx",!0),s(i,v,"\u2245","\\cong",!0),s(i,v,"\u2265","\\ge"),s(i,v,"\u2265","\\geq",!0),s(i,v,"\u2190","\\gets"),s(i,v,">","\\gt",!0),s(i,v,"\u2208","\\in",!0),s(i,v,"\u2209","\\notin",!0),s(i,v,"\uE020","\\@not"),s(i,v,"\u2282","\\subset",!0),s(i,v,"\u2283","\\supset",!0),s(i,v,"\u2286","\\subseteq",!0),s(i,v,"\u2287","\\supseteq",!0),s(i,v,"\u2288","\\nsubseteq",!0),s(i,v,"\u2288","\\nsubseteqq"),s(i,v,"\u2289","\\nsupseteq",!0),s(i,v,"\u2289","\\nsupseteqq"),s(i,v,"\u22A8","\\models"),s(i,v,"\u2190","\\leftarrow",!0),s(i,v,"\u2264","\\le"),s(i,v,"\u2264","\\leq",!0),s(i,v,"<","\\lt",!0),s(i,v,"\u2192","\\rightarrow",!0),s(i,v,"\u2192","\\to"),s(i,v,"\u2271","\\ngeq",!0),s(i,v,"\u2271","\\ngeqq"),s(i,v,"\u2271","\\ngeqslant"),s(i,v,"\u2270","\\nleq",!0),s(i,v,"\u2270","\\nleqq"),s(i,v,"\u2270","\\nleqslant"),s(i,v,"\u2AEB","\\Perp",!0),s(i,ze,"\xA0","\\ "),s(i,ze,"\xA0","\\space"),s(i,ze,"\xA0","\\nobreakspace"),s(O,ze,"\xA0","\\ "),s(O,ze,"\xA0"," "),s(O,ze,"\xA0","\\space"),s(O,ze,"\xA0","\\nobreakspace"),s(i,ze,null,"\\nobreak"),s(i,ze,null,"\\allowbreak"),s(i,Ze,",",","),s(O,Ze,":",":"),s(i,Ze,";",";"),s(i,B,"\u22BC","\\barwedge"),s(i,B,"\u22BB","\\veebar"),s(i,B,"\u2299","\\odot",!0),s(i,B,"\u2295\uFE0E","\\oplus"),s(i,B,"\u2297","\\otimes",!0),s(i,f,"\u2202","\\partial",!0),s(i,B,"\u2298","\\oslash",!0),s(i,B,"\u229A","\\circledcirc",!0),s(i,B,"\u22A1","\\boxdot",!0),s(i,B,"\u25B3","\\bigtriangleup"),s(i,B,"\u25BD","\\bigtriangledown"),s(i,B,"\u2020","\\dagger"),s(i,B,"\u22C4","\\diamond"),s(i,B,"\u25C3","\\triangleleft"),s(i,B,"\u25B9","\\triangleright"),s(i,ie,"{","\\{"),s(O,f,"{","\\{"),s(O,f,"{","\\textbraceleft"),s(i,Pe,"}","\\}"),s(O,f,"}","\\}"),s(O,f,"}","\\textbraceright"),s(i,ie,"{","\\lbrace"),s(i,Pe,"}","\\rbrace"),s(i,ie,"[","\\lbrack",!0),s(O,f,"[","\\lbrack",!0),s(i,Pe,"]","\\rbrack",!0),s(O,f,"]","\\rbrack",!0),s(i,ie,"(","\\lparen",!0),s(i,Pe,")","\\rparen",!0),s(i,ie,"\u2987","\\llparenthesis",!0),s(i,Pe,"\u2988","\\rrparenthesis",!0),s(O,f,"<","\\textless",!0),s(O,f,">","\\textgreater",!0),s(i,ie,"\u230A","\\lfloor",!0),s(i,Pe,"\u230B","\\rfloor",!0),s(i,ie,"\u2308","\\lceil",!0),s(i,Pe,"\u2309","\\rceil",!0),s(i,f,"\\","\\backslash"),s(i,f,"|","|"),s(i,f,"|","\\vert"),s(O,f,"|","\\textbar",!0),s(i,f,"\u2016","\\|"),s(i,f,"\u2016","\\Vert"),s(O,f,"\u2016","\\textbardbl"),s(O,f,"~","\\textasciitilde"),s(O,f,"\\","\\textbackslash"),s(O,f,"^","\\textasciicircum"),s(i,v,"\u2191","\\uparrow",!0),s(i,v,"\u21D1","\\Uparrow",!0),s(i,v,"\u2193","\\downarrow",!0),s(i,v,"\u21D3","\\Downarrow",!0),s(i,v,"\u2195","\\updownarrow",!0),s(i,v,"\u21D5","\\Updownarrow",!0),s(i,ye,"\u2210","\\coprod"),s(i,ye,"\u22C1","\\bigvee"),s(i,ye,"\u22C0","\\bigwedge"),s(i,ye,"\u2A04","\\biguplus"),s(i,ye,"\u2A04","\\bigcupplus"),s(i,ye,"\u2A03","\\bigcupdot"),s(i,ye,"\u2A07","\\bigdoublevee"),s(i,ye,"\u2A08","\\bigdoublewedge"),s(i,ye,"\u22C2","\\bigcap"),s(i,ye,"\u22C3","\\bigcup"),s(i,ye,"\u222B","\\int"),s(i,ye,"\u222B","\\intop"),s(i,ye,"\u222C","\\iint"),s(i,ye,"\u222D","\\iiint"),s(i,ye,"\u220F","\\prod"),s(i,ye,"\u2211","\\sum"),s(i,ye,"\u2A02","\\bigotimes"),s(i,ye,"\u2A01","\\bigoplus"),s(i,ye,"\u2A00","\\bigodot"),s(i,ye,"\u2A09","\\bigtimes"),s(i,ye,"\u222E","\\oint"),s(i,ye,"\u222F","\\oiint"),s(i,ye,"\u2230","\\oiiint"),s(i,ye,"\u2231","\\intclockwise"),s(i,ye,"\u2232","\\varointclockwise"),s(i,ye,"\u2A0C","\\iiiint"),s(i,ye,"\u2A0D","\\intbar"),s(i,ye,"\u2A0E","\\intBar"),s(i,ye,"\u2A0F","\\fint"),s(i,ye,"\u2A12","\\rppolint"),s(i,ye,"\u2A13","\\scpolint"),s(i,ye,"\u2A15","\\pointint"),s(i,ye,"\u2A16","\\sqint"),s(i,ye,"\u2A17","\\intlarhk"),s(i,ye,"\u2A18","\\intx"),s(i,ye,"\u2A19","\\intcap"),s(i,ye,"\u2A1A","\\intcup"),s(i,ye,"\u2A05","\\bigsqcap"),s(i,ye,"\u2A06","\\bigsqcup"),s(i,ye,"\u222B","\\smallint"),s(O,_t,"\u2026","\\textellipsis"),s(i,_t,"\u2026","\\mathellipsis"),s(O,_t,"\u2026","\\ldots",!0),s(i,_t,"\u2026","\\ldots",!0),s(i,_t,"\u22F0","\\iddots",!0),s(i,_t,"\u22EF","\\@cdots",!0),s(i,_t,"\u22F1","\\ddots",!0),s(i,f,"\u22EE","\\varvdots"),s(O,f,"\u22EE","\\varvdots"),s(i,De,"\xB4","\\acute"),s(i,De,"`","\\grave"),s(i,De,"\xA8","\\ddot"),s(i,De,"\u2026","\\dddot"),s(i,De,"\u2026.","\\ddddot"),s(i,De,"~","\\tilde"),s(i,De,"\u203E","\\bar"),s(i,De,"\u02D8","\\breve"),s(i,De,"\u02C7","\\check"),s(i,De,"^","\\hat"),s(i,De,"\u2192","\\vec"),s(i,De,"\u02D9","\\dot"),s(i,De,"\u02DA","\\mathring"),s(i,W,"\u0131","\\imath",!0),s(i,W,"\u0237","\\jmath",!0),s(i,f,"\u0131","\u0131"),s(i,f,"\u0237","\u0237"),s(O,f,"\u0131","\\i",!0),s(O,f,"\u0237","\\j",!0),s(O,f,"\xF8","\\o",!0),s(i,W,"\xF8","\\o",!0),s(O,f,"\xD8","\\O",!0),s(i,W,"\xD8","\\O",!0),s(O,De,"\u02CA","\\'"),s(O,De,"\u02CB","\\`"),s(O,De,"\u02C6","\\^"),s(O,De,"~","\\~"),s(O,De,"\u02C9","\\="),s(O,De,"\u02D8","\\u"),s(O,De,"\u02D9","\\."),s(O,De,"\xB8","\\c"),s(O,De,"\u02DA","\\r"),s(O,De,"\u02C7","\\v"),s(O,De,"\xA8",'\\"'),s(O,De,"\u02DD","\\H"),s(i,De,"\u02CA","\\'"),s(i,De,"\u02CB","\\`"),s(i,De,"\u02C6","\\^"),s(i,De,"~","\\~"),s(i,De,"\u02C9","\\="),s(i,De,"\u02D8","\\u"),s(i,De,"\u02D9","\\."),s(i,De,"\xB8","\\c"),s(i,De,"\u02DA","\\r"),s(i,De,"\u02C7","\\v"),s(i,De,"\xA8",'\\"'),s(i,De,"\u02DD","\\H");let Y={"--":!0,"---":!0,"``":!0,"''":!0};s(O,f,"\u2013","--",!0),s(O,f,"\u2013","\\textendash"),s(O,f,"\u2014","---",!0),s(O,f,"\u2014","\\textemdash"),s(O,f,"\u2018","`",!0),s(O,f,"\u2018","\\textquoteleft"),s(O,f,"\u2019","'",!0),s(O,f,"\u2019","\\textquoteright"),s(O,f,"\u201C","``",!0),s(O,f,"\u201C","\\textquotedblleft"),s(O,f,"\u201D","''",!0),s(O,f,"\u201D","\\textquotedblright"),s(i,f,"\xB0","\\degree",!0),s(O,f,"\xB0","\\degree"),s(O,f,"\xB0","\\textdegree",!0),s(i,f,"\xA3","\\pounds"),s(i,f,"\xA3","\\mathsterling",!0),s(O,f,"\xA3","\\pounds"),s(O,f,"\xA3","\\textsterling",!0),s(i,f,"\u2720","\\maltese"),s(O,f,"\u2720","\\maltese"),s(i,f,"\u20AC","\\euro",!0),s(O,f,"\u20AC","\\euro",!0),s(O,f,"\u20AC","\\texteuro"),s(i,f,"\xA9","\\copyright",!0),s(O,f,"\xA9","\\textcopyright"),s(i,f,"\u2300","\\diameter",!0),s(O,f,"\u2300","\\diameter"),s(i,f,"\u{1D6E4}","\\varGamma"),s(i,f,"\u{1D6E5}","\\varDelta"),s(i,f,"\u{1D6E9}","\\varTheta"),s(i,f,"\u{1D6EC}","\\varLambda"),s(i,f,"\u{1D6EF}","\\varXi"),s(i,f,"\u{1D6F1}","\\varPi"),s(i,f,"\u{1D6F4}","\\varSigma"),s(i,f,"\u{1D6F6}","\\varUpsilon"),s(i,f,"\u{1D6F7}","\\varPhi"),s(i,f,"\u{1D6F9}","\\varPsi"),s(i,f,"\u{1D6FA}","\\varOmega"),s(O,f,"\u{1D6E4}","\\varGamma"),s(O,f,"\u{1D6E5}","\\varDelta"),s(O,f,"\u{1D6E9}","\\varTheta"),s(O,f,"\u{1D6EC}","\\varLambda"),s(O,f,"\u{1D6EF}","\\varXi"),s(O,f,"\u{1D6F1}","\\varPi"),s(O,f,"\u{1D6F4}","\\varSigma"),s(O,f,"\u{1D6F6}","\\varUpsilon"),s(O,f,"\u{1D6F7}","\\varPhi"),s(O,f,"\u{1D6F9}","\\varPsi"),s(O,f,"\u{1D6FA}","\\varOmega");let F='0123456789/@."';for(let e=0;e<14;e++){let n=F.charAt(e);s(i,f,n,n)}let Ce='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){let n=Ce.charAt(e);s(O,f,n,n)}let ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){let n=ce.charAt(e);s(i,W,n,n),s(O,f,n,n)}let Ne="\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 n=Ne.charAt(e);s(i,W,n,n),s(O,f,n,n)}let ee="";for(let e=0;e<52;e++){ee=String.fromCharCode(55349,56320+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56372+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56424+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56580+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56736+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56788+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56840+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56944+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,56632+e),s(i,W,ee,ee),s(O,f,ee,ee);let n=ce.charAt(e);ee=String.fromCharCode(55349,56476+e),s(i,W,n,ee),s(O,f,n,ee)}for(let e=0;e<10;e++)ee=String.fromCharCode(55349,57294+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,57314+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,57324+e),s(i,W,ee,ee),s(O,f,ee,ee),ee=String.fromCharCode(55349,57334+e),s(i,W,ee,ee),s(O,f,ee,ee);let nt=function(e,n,r){return!Q[n][e]||!Q[n][e].replace||e.charCodeAt(0)===55349||Object.prototype.hasOwnProperty.call(Y,e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt")||(e=Q[n][e].replace),new Ke(e)},pt=(e,n)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){let r=new T("mtext",[new Ke(n.children[0].text)]);e.children.push(r)}else e.children[e.children.length-1].children[0].text+=n.children[0].text},ut=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;let n=new T("mrow");for(let r=0;r<e.children.length;r++){let l=e.children[r];if(l.type==="mtext"&&Object.keys(l.attributes).length===0)pt(n,l);else if(l.type==="mrow"){let u=!0;for(let h=0;h<l.children.length;h++)if(l.children[h].type!=="mtext"||Object.keys(l.attributes).length!==0){u=!1;break}if(u)for(let h=0;h<l.children.length;h++){let y=l.children[h];pt(n,y)}else n.children.push(l)}else n.children.push(l)}for(let r=0;r<n.children.length;r++)if(n.children[r].type==="mtext"){let l=n.children[r];l.children[0].text.charAt(0)===" "&&(l.children[0].text="\xA0"+l.children[0].text.slice(1));let u=l.children[0].text.length;u>0&&l.children[0].text.charAt(u-1)===" "&&(l.children[0].text=l.children[0].text.slice(0,-1)+"\xA0");for(let[h,y]of Object.entries(e.attributes))l.attributes[h]=y}return n.children.length===1&&n.children[0].type==="mtext"?n.children[0]:n},ke=function(e,n=!1){if(!(e.length!==1||e[0]instanceof $e))return e[0];if(!n){e[0]instanceof T&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");let r=e.length-1;e[r]instanceof T&&e[r].type==="mo"&&!e[r].attributes.fence&&(e[r].attributes.lspace="0em",e[r].attributes.rspace="0em")}return new T("mrow",e)};function Ee(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){let n=e.children[0];return n instanceof Ke&&n.text==="."}if(e.type==="mtext"&&e.children.length===1){let n=e.children[0];return n instanceof Ke&&n.text==="\u2008"}if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){let n=e.children[0];return n instanceof Ke&&n.text===","}return!1}let re=(e,n)=>{let r=e[n],l=e[n+1];return r.type==="atom"&&r.text===","&&r.loc&&l.loc&&r.loc.end===l.loc.start},Ge=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",ht=function(e,n,r=!1){if(!r&&e.length===1){let y=He(e[0],n);return y instanceof T&&y.type==="mo"&&(y.setAttribute("lspace","0em"),y.setAttribute("rspace","0em")),[y]}let l=[],u=[],h;for(let y=0;y<e.length;y++)u.push(He(e[y],n));for(let y=0;y<u.length;y++){let x=u[y];if(y<e.length-1&&Ge(e[y])&&Ge(e[y+1])&&x.setAttribute("rspace","0em"),y>0&&Ge(e[y])&&Ge(e[y-1])&&x.setAttribute("lspace","0em"),x.type==="mn"&&h&&h.type==="mn")h.children.push(...x.children);else if(Ee(x)&&h&&h.type==="mn")h.children.push(...x.children);else if(h&&h.type==="mn"&&y<u.length-1&&u[y+1].type==="mn"&&re(e,y))h.children.push(...x.children);else{if(x.type==="mn"&&Ee(h))x.children=[...h.children,...x.children],l.pop();else if((x.type==="msup"||x.type==="msub")&&x.children.length>=1&&h&&(h.type==="mn"||Ee(h))){let q=x.children[0];q instanceof T&&q.type==="mn"&&h&&(q.children=[...h.children,...q.children],l.pop())}l.push(x),h=x}}return l},tt=function(e,n,r=!1){return ke(ht(e,n,r),r)},He=function(e,n){if(!e)return new T("mrow");if(_[e.type])return _[e.type](e,n);throw new t("Got group of unknown type: '"+e.type+"'")},gt=e=>new T("mtd",[],[],{padding:"0",width:"50%"}),Yt=["mrow","mtd","mtable","mtr"],nn=e=>{for(let n of e.children)if(n.type&&Yt.includes(n.type)){if(n.classes&&n.classes[0]==="tml-label")return n.label;{let r=nn(n);if(r)return r}}else if(!n.type){let r=nn(n);if(r)return r}};function It(e,n,r,l){let u=null;e.length===1&&e[0].type==="tag"&&(u=e[0].tag,e=e[0].body);let h=ht(e,r);if(h.length===1&&h[0]instanceof Ae)return h[0];let y=l.displayMode||l.annotate?"none":l.wrap,x=h.length===0?null:h[0],q=h.length===1&&u===null&&x instanceof T?h[0]:function(ve,Te,le){let xt=[],lt=[],kt=[],zt=0,ct=0;for(;ct<ve.length;){for(;ve[ct]instanceof $e;)ve.splice(ct,1,...ve[ct].children);let ft=ve[ct];if(ft.attributes&&ft.attributes.linebreak&&ft.attributes.linebreak==="newline"){kt.length>0&<.push(new T("mrow",kt)),lt.push(ft),kt=[];let En=new T("mtd",lt);En.style.textAlign="left",xt.push(new T("mtr",[En])),lt=[],ct+=1;continue}if(kt.push(ft),ft.type&&ft.type==="mo"&&ft.children.length===1&&(!ft.attributes.form||ft.attributes.form!=="prefix")&&!Object.prototype.hasOwnProperty.call(ft.attributes,"movablelimits")){let En=ft.children[0].text;if(Te==="="&&En==="="){if(zt+=1,zt>1){kt.pop();let ln=new T("mrow",kt);lt.push(ln),kt=[ft]}}else if(Te==="tex"){let ln=ct<ve.length-1?ve[ct+1]:null,Ar=!0;if(!ln||ln.type!=="mtext"||!ln.attributes.linebreak||ln.attributes.linebreak!=="nobreak")for(let Hn=ct+1;Hn<ve.length;Hn++){let er=ve[Hn];if(!er.type||er.type!=="mspace"||er.attributes.linebreak&&er.attributes.linebreak==="newline")break;kt.push(er),ct+=1,er.attributes&&er.attributes.linebreak&&er.attributes.linebreak==="nobreak"&&(Ar=!1)}if(Ar){let Hn=new T("mrow",kt);lt.push(Hn),kt=[]}}}ct+=1}if(kt.length>0){let ft=new T("mrow",kt);lt.push(ft)}if(xt.length>0){let ft=new T("mtd",lt);ft.style.textAlign="left";let En=new T("mtr",[ft]);xt.push(En);let ln=new T("mtable",xt);return le||(ln.setAttribute("columnalign","left"),ln.setAttribute("rowspacing","0em")),ln}return bt(lt)}(h,y,l.displayMode);if(u&&(q=((ve,Te,le,xt)=>{Te=tt(Te[0].body,le),(Te=ut(Te)).classes.push("tml-tag");let lt=nn(ve);ve=new T("mtd",[ve]);let kt=[gt(),ve,gt()];kt[xt?0:2].children.push(Te);let zt=new T("mtr",kt,["tml-tageqn"]);lt&&zt.setAttribute("id",lt);let ct=new T("mtable",[zt]);return ct.style.width="100%",ct.setAttribute("displaystyle","true"),ct})(q,u,r,l.leqno)),l.annotate){let ve=new T("annotation",[new Ke(n)]);ve.setAttribute("encoding","application/x-tex"),q=new T("semantics",[q,ve])}let Z=new T("math",[q]);return l.xml&&Z.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),l.displayMode&&(Z.setAttribute("display","block"),Z.style.display="block math",Z.classes=["tml-display"]),Z}let Wt=(e,n)=>{let r=e.isStretchy?fe(e):new T("mo",[nt(e.label,e.mode)]);e.isStretchy||r.setAttribute("stretchy","false"),e.label!=="\\vec"&&(r.style.mathDepth="0");let l=e.label==="\\c"?"munder":"mover",u=pn.has(e.label);if(l==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let h=e.base.text,y=e.label==="\\vec",x=y==="\\vec"?"-vec":"";y&&r.classes.push("tml-vec");let q=y?"-vec":u?"-acc":"";"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(h)>-1?(r.classes.push(`chr-sml${x}`),r.classes.push(`wbk-sml${q}`)):"BCEGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(h)>-1?(r.classes.push(`chr-med${x}`),r.classes.push(`wbk-med${q}`)):"AFJdf\u0394\u039B".indexOf(h)>-1?(r.classes.push(`chr-lrg${x}`),r.classes.push(`wbk-lrg${q}`)):y?r.classes.push("wbk-vec"):u&&r.classes.push("wbk-acc")}else u&&r.classes.push("wbk-acc");return new T(l,[He(e.base,n),r])},oe=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),pn=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),Bt={"\\`":"\u0300","\\'":"\u0301","\\^":"\u0302","\\~":"\u0303","\\=":"\u0304","\\u":"\u0306","\\.":"\u0307",'\\"':"\u0308","\\r":"\u030A","\\H":"\u030B","\\v":"\u030C","\\c":"\u0327"};C({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,n)=>{let r=Se(n[0]),l=!oe.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:l,base:r}},mathmlBuilder:Wt}),C({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,n)=>{let r=Se(n[0]),l=e.parser.mode;return l==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),l==="text"&&r.text&&r.text.length===1&&e.funcName in Bt&&S.indexOf(r.text)>-1?{type:"textord",mode:"text",text:r.text+Bt[e.funcName]}:e.funcName==="\\c"&&l==="text"&&r.text&&r.text.length===1?{type:"textord",mode:"text",text:r.text+"\u0327"}:{type:"accent",mode:l,label:e.funcName,isStretchy:!1,base:r}},mathmlBuilder:Wt}),C({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:n},r)=>{let l=r[0];return{type:"accentUnder",mode:e.mode,label:n,base:l}},mathmlBuilder:(e,n)=>{let r=fe(e);return r.style["math-depth"]=0,new T("munder",[He(e.base,n),r])}});let rn={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},gn=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Lt=function(e){return typeof e!="string"&&(e=e.unit),gn.indexOf(e)>-1},mn=e=>[1,.7,.5][Math.max(e-1,0)],Dt=function(e,n){let r=e.number;if(n.maxSize[0]<0&&r>0)return{number:0,unit:"em"};let l=e.unit;switch(l){case"mm":case"cm":case"in":case"px":return r*rn[l]>n.maxSize[1]?{number:n.maxSize[1],unit:"pt"}:{number:r,unit:l};case"em":case"ex":return l==="ex"&&(r*=.431),r=Math.min(r/mn(n.level),n.maxSize[0]),{number:E(r),unit:"em"};case"bp":return r>n.maxSize[1]&&(r=n.maxSize[1]),{number:r,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return r=Math.min(r*rn[l],n.maxSize[1]),{number:E(r),unit:"pt"};case"mu":return r=Math.min(r/18,n.maxSize[0]),{number:E(r),unit:"em"};default:throw new t("Invalid unit: '"+l+"'")}},Ct=e=>{let n=new T("mspace");return n.setAttribute("width",e+"em"),n},Kt=(e,n=.3,r=0,l=!1)=>{if(e==null&&r===0)return Ct(n);let u=e?[e]:[];if(n!==0&&u.unshift(Ct(n)),r>0&&u.push(Ct(r)),l){let h=new T("mpadded",u);return h.setAttribute("height","0.1px"),h}return new T("mrow",u)},Rt=(e,n)=>Number(e)/mn(n),N=(e,n,r,l)=>{let u=J(e),h=e.slice(1,3)==="eq",y=e.charAt(1)==="x"?"1.75":e.slice(2,4)==="cd"?"3.0":h?"1.0":"2.0";u.setAttribute("lspace","0"),u.setAttribute("rspace",h?"0.5em":"0");let x=l.withLevel(l.level<2?2:3),q=Rt(y,x.level),Z=Rt(y,3),ve=Kt(null,q.toFixed(4),0),Te=Kt(null,Z.toFixed(4),0),le=Rt(h?0:.3,x.level).toFixed(4),xt,lt,kt=n&&n.body&&(n.body.body||n.body.length>0);if(kt){let ft=He(n,x);ft=Kt(ft,le,le,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),xt=new T("mover",[ft,Te])}let zt=r&&r.body&&(r.body.body||r.body.length>0);if(zt){let ft=He(r,x);ft=Kt(ft,le,le),lt=new T("munder",[ft,Te])}let ct;return ct=kt||zt?kt&&zt?new T("munderover",[u,lt,xt]):kt?new T("mover",[u,xt]):new T("munder",[u,lt]):new T("mover",[u,ve]),y==="3.0"&&(ct.style.height="1em"),ct.setAttribute("accent","false"),ct};C({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:n},r,l)=>({type:"xArrow",mode:e.mode,name:n,body:r[0],below:l[0]}),mathmlBuilder(e,n){let r=[N(e.name,e.body,e.below,n)];return r.unshift(Ct(.2778)),r.push(Ct(.2778)),new T("mrow",r)}});let X={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};C({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:n},r,l){let u=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null,h=l[0]?{type:"hphantom",mode:e.mode,body:l[0]}:null;return{type:"stackedArrow",mode:e.mode,name:n,body:r[0],upperArrowBelow:h,lowerArrowBody:u,below:l[0]}},mathmlBuilder(e,n){let r=X[e.name][0],l=X[e.name][1],u=N(r,e.body,e.upperArrowBelow,n),h=N(l,e.lowerArrowBody,e.below,n),y,x=new T("mpadded",[u]);if(x.setAttribute("voffset","0.3em"),x.setAttribute("height","+0.3em"),x.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){let q=new T("mpadded",[h]);q.setAttribute("width","0.5em"),y=new T("mpadded",[Ct(.2778),q,x,Ct(.2778)])}else x.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),y=new T("mpadded",[Ct(.2778),x,h,Ct(.2778)]);return y.setAttribute("voffset","-0.18em"),y.setAttribute("height","-0.18em"),y.setAttribute("depth","+0.18em"),y}});let pe={};function Me({type:e,names:n,props:r,handler:l,mathmlBuilder:u}){let h={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:l};for(let y=0;y<n.length;++y)pe[n[y]]=h;u&&(_[e]=u)}function Le(e,n){if(!e||e.type!==n)throw new Error(`Expected node of type ${n}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function qe(e){let n=M(e);if(!n)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return n}function M(e){return e&&(e.type==="atom"||e.type==="delimiter"||Object.prototype.hasOwnProperty.call(Ie,e.type))?e:null}let j={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},H=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),we=e=>e.type==="textord"&&e.text==="@",Ye=(e,n)=>(e.type==="mathord"||e.type==="atom")&&e.text===n;function We(e,n,r){let l=j[e];switch(l){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(l,[n[0]],[n[1]]);case"\\uparrow":case"\\downarrow":{let u={type:"atom",text:l,mode:"math",family:"rel"},h={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[n[0]],[]),r.callFunction("\\Big",[u],[]),r.callFunction("\\\\cdright",[n[1]],[])],semisimple:!0};return r.callFunction("\\\\cdparent",[h],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{let u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}C({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:n},r)=>({type:"cdlabel",mode:e.mode,side:n.slice(4),label:r[0]}),mathmlBuilder(e,n){if(e.label.body.length===0)return new T("mrow",n);let r=He(e.label,n);e.side==="left"&&r.classes.push("tml-shift-left");let l=new T("mtd",[r]);l.style.padding="0";let u=new T("mtr",[l]),h=new T("mtable",[u]),y=new T("mpadded",[h]);return y.setAttribute("width","0.1px"),y.setAttribute("displaystyle","false"),y.setAttribute("scriptlevel","1"),y}}),C({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},n)=>({type:"cdlabelparent",mode:e.mode,fragment:n[0]}),mathmlBuilder:(e,n)=>new T("mrow",[He(e.fragment,n)])});let Ve=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),xe=(e,n)=>({type:n,mode:"math",body:Ve(e)});class Oe{constructor(n,r,l){this.lexer=n,this.start=r,this.end=l}static range(n,r){return r?n&&n.loc&&r.loc&&n.loc.lexer===r.loc.lexer?new Oe(n.loc.lexer,n.loc.start,r.loc.end):null:n&&n.loc}}class ot{constructor(n,r){this.text=n,this.loc=r}range(n,r){return new ot(r,Oe.range(this,n))}}let Et=0,Tt=1,yt=2,Qe=3,wt={};function L(e,n){wt[e]=n}let Pt=wt;L("\\noexpand",function(e){let n=e.popToken();return e.isExpandable(n.text)&&(n.noexpand=!0,n.treatAsRelax=!0),{tokens:[n],numArgs:0}}),L("\\expandafter",function(e){let n=e.popToken();return e.expandOnce(!0),{tokens:[n],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 n=e.consumeArgs(3);e.consumeSpaces();let r=e.future();return n[0].length===1&&n[0][0].text===r.text?{tokens:n[1],numArgs:0}:{tokens:n[2],numArgs:0}}),L("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),L("\\TextOrMath",function(e){let n=e.consumeArgs(2);return e.mode==="text"?{tokens:n[0],numArgs:0}:{tokens:n[1],numArgs:0}});let sn=e=>{let n="";for(let r=e.length-1;r>-1;r--)n+=e[r].text;return n},on={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},Sn=e=>{let n=e.future().text;return n==="EOF"?[null,""]:[on[n.charAt(0)],n]},jn=(e,n,r)=>{for(let l=1;l<n.length;l++)e*=r,e+=on[n.charAt(l)];return e};function or(e){let n=e.consumeArgs(1)[0],r="",l=n[n.length-1].loc.start;for(let u=n.length-1;u>=0;u--){let h=n[u].loc.start;h>l&&(r+=" ",l=h),r+=n[u].text,l+=n[u].text.length}return r}L("\\char",function(e){let n,r=e.popToken(),l="";if(r.text==="'")n=8,r=e.popToken();else if(r.text==='"')n=16,r=e.popToken();else if(r.text==="`")if(r=e.popToken(),r.text[0]==="\\")l=r.text.charCodeAt(1);else{if(r.text==="EOF")throw new t("\\char` missing argument");l=r.text.charCodeAt(0)}else n=10;if(n){let u,h=r.text;if(l=on[h.charAt(0)],l==null||l>=n)throw new t(`Invalid base-${n} digit ${r.text}`);for(l=jn(l,h,n),[u,h]=Sn(e);u!=null&&u<n;)l*=n,l+=u,l=jn(l,h,n),e.popToken(),[u,h]=Sn(e)}return`\\@char{${l}}`}),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 qt={",":"\\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 n="\\dotso",r=e.expandAfterFuture().text;return r in qt?n=qt[r]:(r.slice(0,4)==="\\not"||r in Q.math&&["bin","rel"].includes(Q.math[r].group))&&(n="\\dotsb"),n});let bn={")":!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 bn?"\\ldots\\,":"\\ldots"}),L("\\dotsc",function(e){let n=e.future().text;return n in bn&&n!==","?"\\ldots\\,":"\\ldots"}),L("\\cdots",function(e){return e.future().text in bn?"\\@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 t("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 St=(e,n)=>{let r=`}\\,\\middle${n[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,n.index)+r+e.slice(n.index+n[0].length)};L("\\Braket",function(e){let n=or(e),r=/\|\||\||\\\|/g,l;for(;(l=r.exec(n))!==null;)n=St(n,l);return"\\left\\langle{"+n+"}\\right\\rangle"}),L("\\Set",function(e){let n=or(e),r=/\|\||\||\\\|/.exec(n);return r&&(n=St(n,r)),"\\left\\{\\:{"+n+"}\\:\\right\\}"}),L("\\set",function(e){return"\\{{"+or(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 At=e=>{let n=e[0][0].text,r=sn(e[1]).split(","),l=String(r.length),u=l==="1"?"\\partial":`\\partial^${l}`,h="";return r.map(y=>{h+="\\partial "+y.trim()+"\\,"}),[n,u,h.replace(/\\,$/,"")]};function yn(e){let n=[];e.consumeSpaces();let r=e.fetch().text;for(r==="\\relax"&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);r==="\\hline"||r==="\\hdashline";)e.consume(),n.push(r==="\\hdashline"),e.consumeSpaces(),r=e.fetch().text;return n}L("\\pdv@numerator",function(e){let[n,r,l]=At(e.consumeArgs(2));return`\\frac{${r} ${n}}{${l}}`}),L("\\pdv@next",function(e){let[n,r,l]=At(e.consumeArgs(2));return`\\frac{${r}}{${l}} ${n}`}),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}}}
|
|
1
|
+
/*! Decklight v0.8.1 — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
|
|
2
|
+
var Decklight=(()=>{var wl=Object.create;var gs=Object.defineProperty;var vl=Object.getOwnPropertyDescriptor;var xl=Object.getOwnPropertyNames;var kl=Object.getPrototypeOf,El=Object.prototype.hasOwnProperty;var zo=(t,o)=>()=>(t&&(o=t(t=0)),o);var Sl=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports),Al=(t,o)=>{for(var a in o)gs(t,a,{get:o[a],enumerable:!0})},Uo=(t,o,a,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of xl(o))!El.call(t,d)&&d!==a&&gs(t,d,{get:()=>o[d],enumerable:!(c=vl(o,d))||c.enumerable});return t};var _l=(t,o,a)=>(a=t!=null?wl(kl(t)):{},Uo(o||!t||!t.__esModule?gs(a,"default",{value:t,enumerable:!0}):a,t)),Tl=t=>Uo(gs({},"__esModule",{value:!0}),t);var at,me=zo(()=>{at={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 it,fe=zo(()=>{it=["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 Ni=Sl((Xu,Ci)=>{me();fe();function bi(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(o=>{let a=t[o],c=typeof a;(c==="object"||c==="function")&&!Object.isFrozen(a)&&bi(a)}),t}var xs=class{constructor(o){o.data===void 0&&(o.data={}),this.data=o.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function yi(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ar(t,...o){let a=Object.create(null);for(let c in t)a[c]=t[c];return o.forEach(function(c){for(let d in c)a[d]=c[d]}),a}var sc="</span>",ui=t=>!!t.scope,oc=(t,{prefix:o})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let a=t.split(".");return[`${o}${a.shift()}`,...a.map((c,d)=>`${c}${"_".repeat(d+1)}`)].join(" ")}return`${o}${t}`},to=class{constructor(o,a){this.buffer="",this.classPrefix=a.classPrefix,o.walk(this)}addText(o){this.buffer+=yi(o)}openNode(o){if(!ui(o))return;let a=oc(o.scope,{prefix:this.classPrefix});this.span(a)}closeNode(o){ui(o)&&(this.buffer+=sc)}value(){return this.buffer}span(o){this.buffer+=`<span class="${o}">`}},pi=(t={})=>{let o={children:[]};return Object.assign(o,t),o},no=class t{constructor(){this.rootNode=pi(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(o){this.top.children.push(o)}openNode(o){let a=pi({scope:o});this.add(a),this.stack.push(a)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(o){return this.constructor._walk(o,this.rootNode)}static _walk(o,a){return typeof a=="string"?o.addText(a):a.children&&(o.openNode(a),a.children.forEach(c=>this._walk(o,c)),o.closeNode(a)),o}static _collapse(o){typeof o!="string"&&o.children&&(o.children.every(a=>typeof a=="string")?o.children=[o.children.join("")]:o.children.forEach(a=>{t._collapse(a)}))}},ro=class extends no{constructor(o){super(),this.options=o}addText(o){o!==""&&this.add(o)}startScope(o){this.openNode(o)}endScope(){this.closeNode()}__addSublanguage(o,a){let c=o.root;a&&(c.scope=`language:${a}`),this.add(c)}toHTML(){return new to(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Zr(t){return t?typeof t=="string"?t:t.source:null}function wi(t){return br("(?=",t,")")}function ic(t){return br("(?:",t,")*")}function ac(t){return br("(?:",t,")?")}function br(...t){return t.map(a=>Zr(a)).join("")}function lc(t){let o=t[t.length-1];return typeof o=="object"&&o.constructor===Object?(t.splice(t.length-1,1),o):{}}function oo(...t){return"("+(lc(t).capture?"":"?:")+t.map(c=>Zr(c)).join("|")+")"}function vi(t){return new RegExp(t.toString()+"|").exec("").length-1}function cc(t,o){let a=t&&t.exec(o);return a&&a.index===0}var dc=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function io(t,{joinWith:o}){let a=0;return t.map(c=>{a+=1;let d=a,p=Zr(c),f="";for(;p.length>0;){let m=dc.exec(p);if(!m){f+=p;break}f+=p.substring(0,m.index),p=p.substring(m.index+m[0].length),m[0][0]==="\\"&&m[1]?f+="\\"+String(Number(m[1])+d):(f+=m[0],m[0]==="("&&a++)}return f}).map(c=>`(${c})`).join(o)}var uc=/\b\B/,xi="[a-zA-Z]\\w*",ao="[a-zA-Z_]\\w*",ki="\\b\\d+(\\.\\d+)?",Ei="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Si="\\b(0b[01]+)",pc="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",hc=(t={})=>{let o=/^#![ ]*\//;return t.binary&&(t.begin=br(o,/.*\b/,t.binary,/\b.*/)),ar({scope:"meta",begin:o,end:/$/,relevance:0,"on:begin":(a,c)=>{a.index!==0&&c.ignoreMatch()}},t)},Jr={begin:"\\\\[\\s\\S]",relevance:0},mc={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Jr]},fc={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Jr]},gc={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,o,a={}){let c=ar({scope:"comment",begin:t,end:o,contains:[]},a);c.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 d=oo("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 c.contains.push({begin:br(/[ ]+/,"(",d,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),c},bc=Es("//","$"),yc=Es("/\\*","\\*/"),wc=Es("#","$"),vc={scope:"number",begin:ki,relevance:0},xc={scope:"number",begin:Ei,relevance:0},kc={scope:"number",begin:Si,relevance:0},Ec={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Jr,{begin:/\[/,end:/\]/,relevance:0,contains:[Jr]}]},Sc={scope:"title",begin:xi,relevance:0},Ac={scope:"title",begin:ao,relevance:0},_c={begin:"\\.\\s*"+ao,relevance:0},Tc=function(t){return Object.assign(t,{"on:begin":(o,a)=>{a.data._beginMatch=o[1]},"on:end":(o,a)=>{a.data._beginMatch!==o[1]&&a.ignoreMatch()}})},vs=Object.freeze({__proto__:null,APOS_STRING_MODE:mc,BACKSLASH_ESCAPE:Jr,BINARY_NUMBER_MODE:kc,BINARY_NUMBER_RE:Si,COMMENT:Es,C_BLOCK_COMMENT_MODE:yc,C_LINE_COMMENT_MODE:bc,C_NUMBER_MODE:xc,C_NUMBER_RE:Ei,END_SAME_AS_BEGIN:Tc,HASH_COMMENT_MODE:wc,IDENT_RE:xi,MATCH_NOTHING_RE:uc,METHOD_GUARD:_c,NUMBER_MODE:vc,NUMBER_RE:ki,PHRASAL_WORDS_MODE:gc,QUOTE_STRING_MODE:fc,REGEXP_MODE:Ec,RE_STARTERS_RE:pc,SHEBANG:hc,TITLE_MODE:Sc,UNDERSCORE_IDENT_RE:ao,UNDERSCORE_TITLE_MODE:Ac});function $c(t,o){t.input[t.index-1]==="."&&o.ignoreMatch()}function Cc(t,o){t.className!==void 0&&(t.scope=t.className,delete t.className)}function Nc(t,o){o&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=$c,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function Mc(t,o){Array.isArray(t.illegal)&&(t.illegal=oo(...t.illegal))}function Oc(t,o){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 Lc(t,o){t.relevance===void 0&&(t.relevance=1)}var Rc=(t,o)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let a=Object.assign({},t);Object.keys(t).forEach(c=>{delete t[c]}),t.keywords=a.keywords,t.begin=br(a.beforeMatch,wi(a.begin)),t.starts={relevance:0,contains:[Object.assign(a,{endsParent:!0})]},t.relevance=0,delete a.beforeMatch},Ic=["of","and","for","in","not","or","if","then","parent","list","value"],Pc="keyword";function Ai(t,o,a=Pc){let c=Object.create(null);return typeof t=="string"?d(a,t.split(" ")):Array.isArray(t)?d(a,t):Object.keys(t).forEach(function(p){Object.assign(c,Ai(t[p],o,p))}),c;function d(p,f){o&&(f=f.map(m=>m.toLowerCase())),f.forEach(function(m){let v=m.split("|");c[v[0]]=[p,Bc(v[0],v[1])]})}}function Bc(t,o){return o?Number(o):Dc(t)?0:1}function Dc(t){return Ic.includes(t.toLowerCase())}var hi={},gr=t=>{console.error(t)},mi=(t,...o)=>{console.log(`WARN: ${t}`,...o)},Cr=(t,o)=>{hi[`${t}/${o}`]||(console.log(`Deprecated as of ${t}. ${o}`),hi[`${t}/${o}`]=!0)},ks=new Error;function _i(t,o,{key:a}){let c=0,d=t[a],p={},f={};for(let m=1;m<=o.length;m++)f[m+c]=d[m],p[m+c]=!0,c+=vi(o[m-1]);t[a]=f,t[a]._emit=p,t[a]._multi=!0}function qc(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw gr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ks;if(typeof t.beginScope!="object"||t.beginScope===null)throw gr("beginScope must be object"),ks;_i(t,t.begin,{key:"beginScope"}),t.begin=io(t.begin,{joinWith:""})}}function Fc(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw gr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ks;if(typeof t.endScope!="object"||t.endScope===null)throw gr("endScope must be object"),ks;_i(t,t.end,{key:"endScope"}),t.end=io(t.end,{joinWith:""})}}function zc(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Uc(t){zc(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),qc(t),Fc(t)}function Hc(t){function o(f,m){return new RegExp(Zr(f),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(m?"g":""))}class a{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(m,v){v.position=this.position++,this.matchIndexes[this.matchAt]=v,this.regexes.push([v,m]),this.matchAt+=vi(m)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let m=this.regexes.map(v=>v[1]);this.matcherRe=o(io(m,{joinWith:"|"}),!0),this.lastIndex=0}exec(m){this.matcherRe.lastIndex=this.lastIndex;let v=this.matcherRe.exec(m);if(!v)return null;let k=v.findIndex((P,T)=>T>0&&P!==void 0),S=this.matchIndexes[k];return v.splice(0,k),Object.assign(v,S)}}class c{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 v=new a;return this.rules.slice(m).forEach(([k,S])=>v.addRule(k,S)),v.compile(),this.multiRegexes[m]=v,v}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(m,v){this.rules.push([m,v]),v.type==="begin"&&this.count++}exec(m){let v=this.getMatcher(this.regexIndex);v.lastIndex=this.lastIndex;let k=v.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 d(f){let m=new c;return f.contains.forEach(v=>m.addRule(v.begin,{rule:v,type:"begin"})),f.terminatorEnd&&m.addRule(f.terminatorEnd,{type:"end"}),f.illegal&&m.addRule(f.illegal,{type:"illegal"}),m}function p(f,m){let v=f;if(f.isCompiled)return v;[Cc,Oc,Uc,Rc].forEach(S=>S(f,m)),t.compilerExtensions.forEach(S=>S(f,m)),f.__beforeBegin=null,[Nc,Mc,Lc].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=Ai(f.keywords,t.case_insensitive)),v.keywordPatternRe=o(k,!0),m&&(f.begin||(f.begin=/\B|\b/),v.beginRe=o(v.begin),!f.end&&!f.endsWithParent&&(f.end=/\B|\b/),f.end&&(v.endRe=o(v.end)),v.terminatorEnd=Zr(v.end)||"",f.endsWithParent&&m.terminatorEnd&&(v.terminatorEnd+=(f.end?"|":"")+m.terminatorEnd)),f.illegal&&(v.illegalRe=o(f.illegal)),f.contains||(f.contains=[]),f.contains=[].concat(...f.contains.map(function(S){return jc(S==="self"?f:S)})),f.contains.forEach(function(S){p(S,v)}),f.starts&&p(f.starts,m),v.matcher=d(v),v}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=ar(t.classNameAliases||{}),p(t)}function Ti(t){return t?t.endsWithParent||Ti(t.starts):!1}function jc(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(o){return ar(t,{variants:null},o)})),t.cachedVariants?t.cachedVariants:Ti(t)?ar(t,{starts:t.starts?ar(t.starts):null}):Object.isFrozen(t)?ar(t):t}var Gc="11.11.1",so=class extends Error{constructor(o,a){super(o),this.name="HTMLInjectionError",this.html=a}},eo=yi,fi=ar,gi=Symbol("nomatch"),Kc=7,$i=function(t){let o=Object.create(null),a=Object.create(null),c=[],d=!0,p="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:ro};function v(Q){return m.noHighlightRe.test(Q)}function k(Q){let j=Q.className+" ";j+=Q.parentNode?Q.parentNode.className:"";let oe=m.languageDetectRe.exec(j);if(oe){let he=$e(oe[1]);return he||(mi(p.replace("{}",oe[1])),mi("Falling back to no-highlight mode for this block.",Q)),he?oe[1]:"no-highlight"}return j.split(/\s+/).find(he=>v(he)||$e(he))}function S(Q,j,oe){let he="",le="";typeof j=="object"?(he=Q,oe=j.ignoreIllegals,le=j.language):(Cr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Cr("10.7.0",`Please use highlight(code, options) instead.
|
|
3
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),le=Q,he=j),oe===void 0&&(oe=!0);let Re={code:he,language:le};gt("before:highlight",Re);let Y=Re.result?Re.result:P(Re.language,Re.code,oe);return Y.code=Re.code,gt("after:highlight",Y),Y}function P(Q,j,oe,he){let le=Object.create(null);function Re(ke,ue){return ke.keywords[ue]}function Y(){if(!z.keywords){ye.addText(Pe);return}let ke=0;z.keywordPatternRe.lastIndex=0;let ue=z.keywordPatternRe.exec(Pe),ie="";for(;ue;){ie+=Pe.substring(ke,ue.index);let Ke=Ie.case_insensitive?ue[0].toLowerCase():ue[0],rt=Re(z,Ke);if(rt){let[Je,tt]=rt;if(ye.addText(ie),ie="",le[Ke]=(le[Ke]||0)+1,le[Ke]<=Kc&&(X+=tt),Je.startsWith("_"))ie+=ue[0];else{let Rt=Ie.classNameAliases[Je]||Je;O(ue[0],Rt)}}else ie+=ue[0];ke=z.keywordPatternRe.lastIndex,ue=z.keywordPatternRe.exec(Pe)}ie+=Pe.substring(ke),ye.addText(ie)}function s(){if(Pe==="")return;let ke=null;if(typeof z.subLanguage=="string"){if(!o[z.subLanguage]){ye.addText(Pe);return}ke=P(z.subLanguage,Pe,!0,Ce[z.subLanguage]),Ce[z.subLanguage]=ke._top}else ke=A(Pe,z.subLanguage.length?z.subLanguage:null);z.relevance>0&&(X+=ke.relevance),ye.__addSublanguage(ke._emitter,ke.language)}function i(){z.subLanguage!=null?s():Y(),Pe=""}function O(ke,ue){ke!==""&&(ye.startScope(ue),ye.addText(ke),ye.endScope())}function Ue(ke,ue){let ie=1,Ke=ue.length-1;for(;ie<=Ke;){if(!ke._emit[ie]){ie++;continue}let rt=Ie.classNameAliases[ke[ie]]||ke[ie],Je=ue[ie];rt?O(Je,rt):(Pe=Je,Y(),Pe=""),ie++}}function B(ke,ue){return ke.scope&&typeof ke.scope=="string"&&ye.openNode(Ie.classNameAliases[ke.scope]||ke.scope),ke.beginScope&&(ke.beginScope._wrap?(O(Pe,Ie.classNameAliases[ke.beginScope._wrap]||ke.beginScope._wrap),Pe=""):ke.beginScope._multi&&(Ue(ke.beginScope,ue),Pe="")),z=Object.create(ke,{parent:{value:z}}),z}function Le(ke,ue,ie){let Ke=cc(ke.endRe,ie);if(Ke){if(ke["on:end"]){let rt=new xs(ke);ke["on:end"](ue,rt),rt.isMatchIgnored&&(Ke=!1)}if(Ke){for(;ke.endsParent&&ke.parent;)ke=ke.parent;return ke}}if(ke.endsWithParent)return Le(ke.parent,ue,ie)}function $t(ke){return z.matcher.regexIndex===0?(Pe+=ke[0],1):(ft=!0,0)}function W(ke){let ue=ke[0],ie=ke.rule,Ke=new xs(ie),rt=[ie.__beforeBegin,ie["on:begin"]];for(let Je of rt)if(Je&&(Je(ke,Ke),Ke.isMatchIgnored))return $t(ue);return ie.skip?Pe+=ue:(ie.excludeBegin&&(Pe+=ue),i(),!ie.returnBegin&&!ie.excludeBegin&&(Pe=ue)),B(ie,ke),ie.returnBegin?0:ue.length}function Ae(ke){let ue=ke[0],ie=j.substring(ke.index),Ke=Le(z,ke,ie);if(!Ke)return gi;let rt=z;z.endScope&&z.endScope._wrap?(i(),O(ue,z.endScope._wrap)):z.endScope&&z.endScope._multi?(i(),Ue(z.endScope,ke)):rt.skip?Pe+=ue:(rt.returnEnd||rt.excludeEnd||(Pe+=ue),i(),rt.excludeEnd&&(Pe=ue));do z.scope&&ye.closeNode(),!z.skip&&!z.subLanguage&&(X+=z.relevance),z=z.parent;while(z!==Ke.parent);return Ke.starts&&B(Ke.starts,ke),rt.returnEnd?0:ue.length}function ee(){let ke=[];for(let ue=z;ue!==Ie;ue=ue.parent)ue.scope&&ke.unshift(ue.scope);ke.forEach(ue=>ye.openNode(ue))}let We={};function w(ke,ue){let ie=ue&&ue[0];if(Pe+=ke,ie==null)return i(),0;if(We.type==="begin"&&ue.type==="end"&&We.index===ue.index&&ie===""){if(Pe+=j.slice(ue.index,ue.index+1),!d){let Ke=new Error(`0 width match regex (${Q})`);throw Ke.languageName=Q,Ke.badRule=We.rule,Ke}return 1}if(We=ue,ue.type==="begin")return W(ue);if(ue.type==="illegal"&&!oe){let Ke=new Error('Illegal lexeme "'+ie+'" for mode "'+(z.scope||"<unnamed>")+'"');throw Ke.mode=z,Ke}else if(ue.type==="end"){let Ke=Ae(ue);if(Ke!==gi)return Ke}if(ue.type==="illegal"&&ie==="")return Pe+=`
|
|
4
|
+
`,1;if(mt>1e5&&mt>ue.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ie,ie.length}let Ie=$e(Q);if(!Ie)throw gr(p.replace("{}",Q)),new Error('Unknown language: "'+Q+'"');let g=Hc(Ie),J="",z=he||g,Ce={},ye=new m.__emitter(m);ee();let Pe="",X=0,Xe=0,mt=0,ft=!1;try{if(Ie.__emitTokens)Ie.__emitTokens(j,ye);else{for(z.matcher.considerAll();;){mt++,ft?ft=!1:z.matcher.considerAll(),z.matcher.lastIndex=Xe;let ke=z.matcher.exec(j);if(!ke)break;let ue=j.substring(Xe,ke.index),ie=w(ue,ke);Xe=ke.index+ie}w(j.substring(Xe))}return ye.finalize(),J=ye.toHTML(),{language:Q,value:J,relevance:X,illegal:!1,_emitter:ye,_top:z}}catch(ke){if(ke.message&&ke.message.includes("Illegal"))return{language:Q,value:eo(j),illegal:!0,relevance:0,_illegalBy:{message:ke.message,index:Xe,context:j.slice(Xe-100,Xe+100),mode:ke.mode,resultSoFar:J},_emitter:ye};if(d)return{language:Q,value:eo(j),illegal:!1,relevance:0,errorRaised:ke,_emitter:ye,_top:z};throw ke}}function T(Q){let j={value:eo(Q),illegal:!1,relevance:0,_top:f,_emitter:new m.__emitter(m)};return j._emitter.addText(Q),j}function A(Q,j){j=j||m.languages||Object.keys(o);let oe=T(Q),he=j.filter($e).filter(Ze).map(i=>P(i,Q,!1));he.unshift(oe);let le=he.sort((i,O)=>{if(i.relevance!==O.relevance)return O.relevance-i.relevance;if(i.language&&O.language){if($e(i.language).supersetOf===O.language)return 1;if($e(O.language).supersetOf===i.language)return-1}return 0}),[Re,Y]=le,s=Re;return s.secondBest=Y,s}function N(Q,j,oe){let he=j&&a[j]||oe;Q.classList.add("hljs"),Q.classList.add(`language-${he}`)}function I(Q){let j=null,oe=k(Q);if(v(oe))return;if(gt("before:highlightElement",{el:Q,language:oe}),Q.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Q);return}if(Q.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(Q)),m.throwUnescapedHTML))throw new so("One of your code blocks includes unescaped HTML.",Q.innerHTML);j=Q;let he=j.textContent,le=oe?S(he,{language:oe,ignoreIllegals:!0}):A(he);Q.innerHTML=le.value,Q.dataset.highlighted="yes",N(Q,oe,le.language),Q.result={language:le.language,re:le.relevance,relevance:le.relevance},le.secondBest&&(Q.secondBest={language:le.secondBest.language,relevance:le.secondBest.relevance}),gt("after:highlightElement",{el:Q,result:le,text:he})}function Se(Q){m=fi(m,Q)}let pe=()=>{ce(),Cr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Oe(){ce(),Cr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let re=!1;function ce(){function Q(){ce()}if(document.readyState==="loading"){re||window.addEventListener("DOMContentLoaded",Q,!1),re=!0;return}document.querySelectorAll(m.cssSelector).forEach(I)}function Me(Q,j){let oe=null;try{oe=j(t)}catch(he){if(gr("Language definition for '{}' could not be registered.".replace("{}",Q)),d)gr(he);else throw he;oe=f}oe.name||(oe.name=Q),o[Q]=oe,oe.rawDefinition=j.bind(null,t),oe.aliases&&_e(oe.aliases,{languageName:Q})}function ze(Q){delete o[Q];for(let j of Object.keys(a))a[j]===Q&&delete a[j]}function Ve(){return Object.keys(o)}function $e(Q){return Q=(Q||"").toLowerCase(),o[Q]||o[a[Q]]}function _e(Q,{languageName:j}){typeof Q=="string"&&(Q=[Q]),Q.forEach(oe=>{a[oe.toLowerCase()]=j})}function Ze(Q){let j=$e(Q);return j&&!j.disableAutodetect}function bt(Q){Q["before:highlightBlock"]&&!Q["before:highlightElement"]&&(Q["before:highlightElement"]=j=>{Q["before:highlightBlock"](Object.assign({block:j.el},j))}),Q["after:highlightBlock"]&&!Q["after:highlightElement"]&&(Q["after:highlightElement"]=j=>{Q["after:highlightBlock"](Object.assign({block:j.el},j))})}function _(Q){bt(Q),c.push(Q)}function je(Q){let j=c.indexOf(Q);j!==-1&&c.splice(j,1)}function gt(Q,j){let oe=Q;c.forEach(function(he){he[oe]&&he[oe](j)})}function ut(Q){return Cr("10.7.0","highlightBlock will be removed entirely in v12.0"),Cr("10.7.0","Please use highlightElement now."),I(Q)}Object.assign(t,{highlight:S,highlightAuto:A,highlightAll:ce,highlightElement:I,highlightBlock:ut,configure:Se,initHighlighting:pe,initHighlightingOnLoad:Oe,registerLanguage:Me,unregisterLanguage:ze,listLanguages:Ve,getLanguage:$e,registerAliases:_e,autoDetection:Ze,inherit:fi,addPlugin:_,removePlugin:je}),t.debugMode=function(){d=!1},t.safeMode=function(){d=!0},t.versionString=Gc,t.regex={concat:br,lookahead:wi,either:oo,optional:ac,anyNumberOfTimes:ic};for(let Q in vs)typeof vs[Q]=="object"&&bi(vs[Q]);return Object.assign(t,vs),t},Nr=$i({});Nr.newInstance=()=>$i({});Ci.exports=Nr;Nr.HighlightJS=Nr;Nr.default=Nr});var vu={};Al(vu,{init:()=>yu,initTerminals:()=>wu,registerBuildProvider:()=>es,version:()=>bu});me();fe();me();fe();me();fe();var Nl=new Set(["UL","OL","TABLE","TBODY","DL","SVG"]),Ml=new Set(["defs","title","desc","style","metadata"]),Go=new Map;function Ko(t,o){Go.set(t,o)}function ys(t){return[...t.children].filter(o=>{let a=o.tagName.toLowerCase();return!(Ml.has(a)||a==="aside"&&o.classList.contains("notes")||o.hasAttribute("data-build-stay"))})}function Ol(t){if(t.hasAttribute("data-build-self"))return!1;let o=t.tagName.toUpperCase();return Nl.has(o)?!0:o==="DIV"||o==="G"?ys(t).length>=2:!1}function Ll(t){if(t.tagName.toUpperCase()==="TABLE"){let a=t.querySelector(":scope > tbody");return a?ys(a):ys(t).filter(c=>c.tagName==="TR")}return ys(t)}function Rl(t){let o=t.map((f,m)=>({...f,i:m}));o.sort((f,m)=>f.key-m.key||f.i-m.i);let a=[],c=null,d=null,p=!1;for(let f of o){if(c&&f.explicit&&p&&f.key===d){c.push(f.i);continue}c=[f.i],d=f.key,p=f.explicit,a.push(c)}return a}function Ho(t,o){t.classList.add("build-step"),t.setAttribute("data-build-style",o),t.setAttribute("data-build-state","pending"),o==="draw"&&Il(t)}var jo="path, line, polyline, polygon, circle, ellipse, rect";function Il(t){let o=t.matches?.(jo)?[t]:[...t.querySelectorAll(jo)],a=!1;for(let d of o){let p=d.getAttribute("stroke")??getComputedStyle(d).stroke;if(!p||p==="none")continue;let f=0;try{f=d.getTotalLength()}catch{continue}if(!f)continue;a=!0;let m=d.getAttribute("stroke-dasharray")||d.style.strokeDasharray;m&&(d.dataset.drawOrig=m);for(let[v,k]of Ys){let S=d.getAttribute(v);S&&(d.dataset[k]=S)}d.classList.add("draw-stroke"),d.style.setProperty("--draw-len",String(Math.ceil(f)))}t.querySelectorAll("text, tspan").forEach(d=>d.classList.add("draw-fade")),a||t.setAttribute("data-build-style","fade")}var Ys=[["marker-start","drawMarkerStart"],["marker-mid","drawMarkerMid"],["marker-end","drawMarkerEnd"]];function bs(t,o){for(let[a,c]of Ys)c in t.dataset&&(o?t.setAttribute(a,t.dataset[c]):t.removeAttribute(a))}function Pl(t,o){for(let a of t.querySelectorAll(".draw-stroke")){let c=a.dataset.drawOrig,d=Ys.some(([,p])=>p in a.dataset);if(!(!c&&!d))if(o==="done")c&&(a.style.strokeDasharray=c,a.style.strokeDashoffset="0"),bs(a,!0);else if(o==="pending")a.style.removeProperty("stroke-dasharray"),a.style.removeProperty("stroke-dashoffset"),bs(a,!1);else{a.style.removeProperty("stroke-dasharray"),a.style.removeProperty("stroke-dashoffset"),bs(a,!1);let p=()=>{t.getAttribute("data-build-state")!=="pending"&&(c&&(a.style.strokeDasharray=c,a.style.strokeDashoffset="0"),bs(a,!0))},f=parseFloat(getComputedStyle(a).transitionDuration)||0;f===0?p():(a.addEventListener("transitionend",p,{once:!0}),setTimeout(p,f*1e3+150))}}}function Xs(t){let o=[],a=[],c=new Set,d=0,p=(S,P)=>{let T=P!=null&&P!=="",A=T?parseInt(P,10):d;o.push(S),a.push({key:Number.isFinite(A)?A:d,explicit:T}),d++},f=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let S=f.nextNode();S;S=f.nextNode()){if(c.has(S))continue;let P=Go.get(S);if(P){for(let A=0;A<P.count;A++)p({kind:"provider",provider:P,el:S,sub:A},null);S.querySelectorAll("*").forEach(A=>c.add(A));continue}if(!S.hasAttribute("data-build"))continue;let T=S.getAttribute("data-build")||"fade";if(Ol(S)){for(let A of Ll(S)){c.add(A),A.querySelectorAll("[data-build]").forEach(I=>c.add(I));let N=A.getAttribute("data-build")||T;Ho(A,N),p({kind:"dom",el:A,container:S},A.getAttribute("data-build-order"))}S.setAttribute("data-build-container","")}else Ho(S,T),p({kind:"dom",el:S,container:null},S.getAttribute("data-build-order"))}let m=Rl(a),v=[],k=new Map;return o.forEach((S,P)=>{if(S.kind==="provider"){if(!k.has(S.provider)){let T={el:S.el,provider:S.provider,stepIdxs:[]};k.set(S.provider,T),v.push(T)}k.get(S.provider).stepIdxs.push(P)}}),{steps:o,groups:m,providers:v}}function ir(t,o){let a=new Set;t.groups.forEach((f,m)=>{for(let v of f)m<o&&a.add(v)});let c=o>0?t.groups[o-1]??[]:[],d=new Set(c),p=new Set;t.steps.forEach((f,m)=>{if(f.kind!=="dom")return;let v=d.has(m)?"current":a.has(m)?"done":"pending";f.el.setAttribute("data-build-state",v),f.el.getAttribute("data-build-style")==="draw"&&Pl(f.el,v),f.container&&p.add(f.container)});for(let f of p){let m=!!f.querySelector(':scope [data-build-style="highlight"][data-build-state="current"]');f.classList.toggle("has-current-highlight",m)}for(let f of t.providers){let m=f.stepIdxs.filter(v=>a.has(v)||d.has(v)).length;f._last!==m&&(f._last=m,f.provider.apply(m))}}function Wo(t){return t.groups.map(o=>{let a=t.steps[o[0]];if(a.kind==="provider"){let d=a.sub;return a.provider.label?a.provider.label(d+1):"step"}return a.el.textContent.trim().replace(/\s+/g," ").slice(0,60)||a.el.tagName.toLowerCase()})}me();fe();var Vo="rect, circle, ellipse, polygon, polyline, path";function Bl(t){let o=5381;for(let a of String(t))o=(o*33^a.charCodeAt(0))>>>0;return 1+o%6}function Dl(t,o={}){let a=o[t];return typeof a=="number"?`var(--d-fill-${a})`:typeof a=="string"?a:`var(--d-fill-${Bl(t)})`}function Zo(t,o={}){let a=new Map;t.querySelectorAll("svg [data-concept]").forEach(c=>{let d=c.getAttribute("data-concept");if(!d)return;let p=Dl(d,o),f=p.match(/--d-fill-(\d)/);if(f){let v=a.get(f[1]);v&&v!==d?console.warn(`Decklight: concepts "${v}" and "${d}" share fill slot ${f[1]} \u2014 pin one explicitly via init({ concepts: { ${d}: <1-6> } })`):a.set(f[1],d)}let m=c.matches(Vo)?[c]:[...c.children].filter(v=>v.matches(Vo));for(let v of m){let k=v.getAttribute("fill")==="none"||v.style.fill==="none";v.style.setProperty(k?"stroke":"fill",p)}})}var ql=["fill","stroke","filter","clip-path","mask","marker-start","marker-mid","marker-end","style"];function Jo(t){t.querySelectorAll("svg").forEach((o,a)=>{let c=`svg${a}-`,d=new Map;if(o.querySelectorAll("[id]").forEach(f=>{let m=f.id;d.set(m,c+m),f.id=c+m}),d.size===0)return;let p=f=>f.replace(/url\(['"]?#([^'")]+)['"]?\)/g,(m,v)=>d.has(v)?`url(#${d.get(v)})`:m);o.querySelectorAll("*").forEach(f=>{for(let m of ql){let v=f.getAttribute(m);v&&v.includes("url(#")&&f.setAttribute(m,p(v))}for(let m of["href","xlink:href"]){let v=f.getAttribute(m);v&&v.startsWith("#")&&d.has(v.slice(1))&&f.setAttribute(m,"#"+d.get(v.slice(1)))}})})}me();fe();me();fe();var Nt=t=>String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");var Yo=640,Fl=360,Xo=["bar","line","area","pie","donut"],He=t=>{let o=Math.round(t*100)/100;return Object.is(o,-0)?"0":String(o)},Tr=t=>`var(--d-fill-${t%6+1})`;function zl(t,o={}){let a;if(typeof t=="string")try{a=JSON.parse(t)}catch(k){throw new Error(`invalid JSON \u2014 ${k.message}`)}else if(t&&typeof t=="object")a=t;else throw new Error('no data \u2014 expected a <script type="application/json"> child (or the fence body)');let c=String(o.type||a.type||"").toLowerCase();if(!Xo.includes(c))throw new Error(`unknown type "${c}" \u2014 use ${Xo.join(" | ")}`);if(!Array.isArray(a.labels)||a.labels.length===0)throw new Error('"labels" must be a non-empty array');if(!Array.isArray(a.series)||a.series.length===0)throw new Error('"series" must be a non-empty array');let d=a.labels.map(String),p=a.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:d.map((P,T)=>{let A=Number(k.data[T]);return Number.isFinite(A)?A:null})}}),f=c==="pie"||c==="donut";if(f&&p.length>1)throw new Error("pie takes exactly one series (labels are the slices)");if(f&&!p[0].data.some(k=>k>0))throw new Error("pie needs at least one positive value");let m=Fl,v=o.aspect??a.aspect??null;if(v!=null){let k=String(v).match(/^\s*(\d+(?:\.\d+)?)\s*[:x]\s*(\d+(?:\.\d+)?)\s*$/i);if(!k||+k[1]==0)throw new Error(`bad aspect "${v}" \u2014 use "w:h", e.g. "4:3"`);m=Math.round(Yo*+k[2]/+k[1])}return{type:f?"pie":c,donut:c==="donut"||a.donut===!0,title:o.title??(a.title!=null?String(a.title):null),labels:d,series:p,legend:a.legend,width:Yo,height:m,build:a.build}}function Ul(t,o,a=5){if(!Number.isFinite(t)||!Number.isFinite(o))throw new Error("niceTicks: non-finite range");if(t>o&&([t,o]=[o,t]),t===o){let P=t===0?1:Math.abs(t)/2;t-=t===0?0:P,o+=P}let c=(o-t)/Math.max(1,a-1),d=10**Math.floor(Math.log10(c)),p=c/d,f=(p<=1?1:p<=2?2:p<=2.5?2.5:p<=5?5:10)*d,m=Math.floor(t/f+1e-9)*f,v=Math.ceil(o/f-1e-9)*f,k=Math.max(1,Math.round((v-m)/f)),S=Array.from({length:k+1},(P,T)=>+(m+T*f).toPrecision(12));return{min:S[0],max:S[k],step:f,ticks:S}}function Hl(t,o){let a=0;for(;a<6&&Math.abs(Math.round(o*10**a)-o*10**a)>1e-9;)a++;return t.toFixed(a)}function jl(t,o,a,c){let d=c.max-c.min||1,p=S=>a.y+a.h*(1-(S-c.min)/d),f=p(Math.max(c.min,Math.min(c.max,0))),m=a.w/o,v=m*.72,k=v/t.length;return t.map((S,P)=>Array.from({length:o},(T,A)=>{let N=S.data[A];if(N==null||!Number.isFinite(N))return null;let I=p(N);return{x:a.x+A*m+(m-v)/2+P*k+1,y:Math.min(I,f),w:Math.max(1,k-2),h:Math.abs(f-I),value:N}}))}function Gl(t){let o="",a=!1;for(let c of t){if(!c){a=!1;continue}o+=`${a?"L":"M"}${He(c.x)} ${He(c.y)}`,a=!0}return o}function Kl(t,o){let a=t.filter(Boolean);if(!a.length)return"";let c=`M${He(a[0].x)} ${He(o)}`;for(let d of a)c+=`L${He(d.x)} ${He(d.y)}`;return c+=`L${He(a[a.length-1].x)} ${He(o)}Z`,c}function Wl(t,o,a,c,d=0){let p=t.map(k=>Math.max(0,Number(k)||0)),f=p.reduce((k,S)=>k+S,0);if(f<=0)throw new Error("pie needs at least one positive value");let m=(k,S)=>[o+S*Math.cos(k),a+S*Math.sin(k)],v=-Math.PI/2;return p.map(k=>{let S=k/f,P=v,T=v+S*2*Math.PI;v=T;let A=(P+T)/2,N=d>0?(c+d)/2:c*.66,[I,Se]=m(A,N),[pe,Oe]=m(A,c+14),re={value:k,frac:S,mid:A,labelX:I,labelY:Se,outX:pe,outY:Oe,anchor:Math.cos(A)<-1e-6?"end":Math.cos(A)>1e-6?"start":"middle"};if(S===0)return{...re,d:""};let ce;if(S>=.9999){let[Me,ze]=m(P,c),[Ve,$e]=m(P+Math.PI,c);if(ce=`M${He(Me)} ${He(ze)}A${He(c)} ${He(c)} 0 1 1 ${He(Ve)} ${He($e)}A${He(c)} ${He(c)} 0 1 1 ${He(Me)} ${He(ze)}Z`,d>0){let[_e,Ze]=m(P,d),[bt,_]=m(P+Math.PI,d);ce+=`M${He(_e)} ${He(Ze)}A${He(d)} ${He(d)} 0 1 0 ${He(bt)} ${He(_)}A${He(d)} ${He(d)} 0 1 0 ${He(_e)} ${He(Ze)}Z`}}else{let Me=T-P>Math.PI?1:0,[ze,Ve]=m(P,c),[$e,_e]=m(T,c);if(d>0){let[Ze,bt]=m(T,d),[_,je]=m(P,d);ce=`M${He(ze)} ${He(Ve)}A${He(c)} ${He(c)} 0 ${Me} 1 ${He($e)} ${He(_e)}L${He(Ze)} ${He(bt)}A${He(d)} ${He(d)} 0 ${Me} 0 ${He(_)} ${He(je)}Z`}else ce=`M${He(o)} ${He(a)}L${He(ze)} ${He(Ve)}A${He(c)} ${He(c)} 0 ${Me} 1 ${He($e)} ${He(_e)}Z`}return{...re,d:ce}})}var $r='fill="var(--d-text)"';function Qs(t,o){return`<g class="chart-series" data-series="${o+1}" data-name="${Nt(t.name)}"`+(t.concept?` data-concept="${Nt(t.concept)}"`:"")+">"}function Vl(t,o,a){let c=t.series.flatMap(N=>N.data).filter(N=>N!=null),d=Math.min(0,...c),p=Math.max(0,...c),f=Ul(d,p===d?d+1:p,5),m=f.ticks.map(N=>Hl(N,f.step)),v=14+Math.max(...m.map(N=>N.length))*6.6+8,k={x:v,y:t.title||Qo(t)?40:18,w:t.width-v-14,h:0};k.h=t.height-k.y-34;let S=f.max-f.min||1,P=N=>k.y+k.h*(1-(N-f.min)/S);f.ticks.forEach((N,I)=>{let Se=P(N);o.push(`<line class="chart-grid" x1="${He(k.x)}" y1="${He(Se)}" x2="${He(k.x+k.w)}" y2="${He(Se)}" stroke="var(--d-muted)" stroke-opacity="0.35" stroke-width="1"/>`),o.push(`<text class="chart-tick" x="${He(k.x-8)}" y="${He(Se+4)}" text-anchor="end" font-size="11" ${$r}>${Nt(m[I])}</text>`)}),o.push(`<line class="chart-axis" x1="${He(k.x)}" y1="${He(k.y)}" x2="${He(k.x)}" y2="${He(k.y+k.h)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let T=P(Math.max(f.min,Math.min(f.max,0)));o.push(`<line class="chart-axis" x1="${He(k.x)}" y1="${He(T)}" x2="${He(k.x+k.w)}" y2="${He(T)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`);let A=k.w/t.labels.length;if(t.labels.forEach((N,I)=>{o.push(`<text class="chart-cat" x="${He(k.x+(I+.5)*A)}" y="${He(k.y+k.h+20)}" text-anchor="middle" font-size="12" ${$r}>${Nt(N)}</text>`)}),t.type==="bar"){let N=jl(t.series,t.labels.length,k,f);t.series.forEach((I,Se)=>{a.push(Qs(I,Se)),N[Se].forEach(pe=>{pe&&a.push(`<rect class="chart-bar draw-fade" x="${He(pe.x)}" y="${He(pe.y)}" width="${He(pe.w)}" height="${He(pe.h)}" rx="2" fill="${Tr(Se)}" stroke="var(--d-stroke)" stroke-width="1.5"/>`)}),a.push("</g>")})}else t.series.forEach((N,I)=>{let Se=N.data.map((re,ce)=>re==null?null:{x:k.x+(ce+.5)*A,y:P(re)}),pe=Gl(Se),Oe='stroke-linejoin="round" stroke-linecap="round"';if(a.push(Qs(N,I)),t.type==="area"&&a.push(`<path class="chart-area draw-fade" d="${Kl(Se,T)}" fill="${Tr(I)}" fill-opacity="0.35"/>`),a.push(`<g class="chart-casing"><path d="${pe}" fill="none" stroke="var(--d-stroke)" stroke-width="4.5" ${Oe}/></g>`),a.push(`<path class="chart-line" d="${pe}" fill="none" stroke="${Tr(I)}" stroke-width="2.5" ${Oe}/>`),t.type==="line")for(let re of Se)re&&a.push(`<circle class="chart-dot draw-fade" cx="${He(re.x)}" cy="${He(re.y)}" r="4" fill="${Tr(I)}" stroke="var(--d-stroke)" stroke-width="1"/>`);a.push("</g>")})}function Zl(t,o){let a=t.title?40:16,c=t.width/2,d=a+(t.height-a-12)/2,p=Math.max(24,Math.min((t.height-a-12)/2-26,t.width/2-110)),f=Wl(t.series[0].data.map(m=>m??0),c,d,p,t.donut?p*.55:0);o.push(Qs(t.series[0],0)),f.forEach((m,v)=>{m.d&&(o.push(`<path class="chart-slice draw-fade" d="${m.d}" fill="${Tr(v)}" fill-rule="evenodd" stroke="var(--d-stroke)" stroke-width="1.5" stroke-linejoin="round"/>`),o.push(`<text class="chart-cat draw-fade" x="${He(m.outX)}" y="${He(m.outY+4)}" text-anchor="${m.anchor}" font-size="12" ${$r}>${Nt(t.labels[v])}</text>`),m.frac>=.05&&o.push(`<text class="chart-value draw-fade" x="${He(m.labelX)}" y="${He(m.labelY+4)}" text-anchor="middle" font-size="12" font-weight="600" ${$r}>${Math.round(m.frac*100)}%</text>`))}),o.push("</g>")}function Qo(t){return t.legend===!0?!0:t.legend===!1?!1:t.type!=="pie"&&t.series.length>1}function Jl(t){let o=[],a=[];if(t.title&&o.push(`<text class="chart-title" x="14" y="24" font-size="15" font-weight="600" ${$r}>${Nt(t.title)}</text>`),Qo(t)){let d=t.series.map(f=>({name:f.name,w:f.name.length*6.6+24})),p=t.width-14-d.reduce((f,m)=>f+m.w,0);t.series.forEach((f,m)=>{o.push(`<rect class="chart-swatch" x="${He(p)}" y="14" width="11" height="11" rx="2" fill="${Tr(m)}" stroke="var(--d-stroke)" stroke-width="1"/>`),o.push(`<text class="chart-legend" x="${He(p+16)}" y="24" font-size="12" ${$r}>${Nt(f.name)}</text>`),p+=d[m].w})}t.type==="pie"?Zl(t,a):Vl(t,o,a);let c=t.title?`${t.title} \u2014 ${t.type} chart`:`${t.type} chart`;return`<svg class="chart-svg" viewBox="0 0 ${t.width} ${t.height}" role="img" aria-label="${Nt(c)}" preserveAspectRatio="xMidYMid meet"><g class="chart-chrome" data-build-stay>${o.join("")}</g>`+a.join("")+"</svg>"}function ei(t){t.querySelectorAll("[data-chart]").forEach(o=>{if(o.querySelector(":scope > svg.chart-svg, :scope > .chart-broken"))return;o.classList.add("chart");let a=o.querySelector('script[type="application/json"]');try{let c=zl(a?a.textContent:null,{type:o.getAttribute("data-chart")||void 0,title:o.getAttribute("data-title")||void 0,aspect:o.getAttribute("data-aspect")||void 0}),d=document.createElement("template");d.innerHTML=Jl(c);let p=d.content.firstElementChild;o.hasAttribute("data-build")?(p.setAttribute("data-build",o.getAttribute("data-build")),o.removeAttribute("data-build")):c.build!=null&&c.build!==!1&&p.setAttribute("data-build",c.build===!0?"":String(c.build)),o.getAttribute("data-chart")||o.setAttribute("data-chart",c.donut?"donut":c.type),o.insertBefore(p,a)}catch(c){let d=document.createElement("div");d.className="chart-broken",d.textContent=`chart: ${c.message||c}`,o.insertBefore(d,a)}})}me();fe();me();fe();function ws(t,o){let a=String(t??"").trim(),c=parseFloat(a);return!Number.isFinite(c)||c<=0?o:a.endsWith("ms")?c:a.endsWith("s")?c*1e3:c}var Vr=["opacity","color","backgroundColor","borderRadius","fontSize"],ti=(t=Vr)=>["transform",...t.map(o=>o.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`))];function ni(t,o,a,c=!1){let d=a?.x||1,p=a?.y||1,f=(t.rect.left-o.rect.left)/d,m=(t.rect.top-o.rect.top)/p,v=c||!o.rect.width?1:t.rect.width/o.rect.width,k=c||!o.rect.height?1:t.rect.height/o.rect.height;return{dx:f,dy:m,sx:v,sy:k}}function ri({dx:t,dy:o,sx:a,sy:c}){return!t&&!o&&a===1&&c===1?"":`translate(${t}px, ${o}px) scale(${a}, ${c})`}var si=(t,o)=>t||o||"fade";function oi(t,o){if(t==="none")return null;let a=`dir-${o}`;return{entering:["entering",`tr-${t}`,a],leaving:["leaving",`tr-${t}`,a,"active-out"]}}var Yl=ti();function ii(t){let o=getComputedStyle(t),a={rect:t.getBoundingClientRect()};for(let c of Vr)a[c]=o[c];return a}function Xl(t,o){if(t.ownerSVGElement){let a=t.getScreenCTM?.();if(a&&a.a&&a.d)return{x:a.a,y:a.d}}return{x:o,y:o}}function ai(t,o,a){let c=ws(getComputedStyle(o).getPropertyValue("--auto-animate-duration"),500),d=new Map;t.querySelectorAll("[data-id]").forEach(m=>{d.set(m.getAttribute("data-id"),ii(m))});let p=[];o.querySelectorAll("[data-id]").forEach(m=>{let v=d.get(m.getAttribute("data-id"));v&&p.push({el:m,o:v})});for(let{el:m,o:v}of p){let k=ii(m),S=Xl(m,a),P=m.children.length===0&&v.fontSize!==k.fontSize,T=ni(v,k,S,P),A=m.getAttribute("style")??"";m.style.transition="none",m.ownerSVGElement&&(m.style.transformBox="fill-box"),m.style.transformOrigin="0 0",m.style.transform=ri(T);for(let I of Vr)m.style[I]=v[I];m.offsetWidth,m.style.transition=Yl.map(I=>`${I} ${c}ms ease`).join(", "),m.style.transform="";for(let I of Vr)m.style[I]=k[I];let N=()=>{A?m.setAttribute("style",A):m.removeAttribute("style"),m.removeEventListener("transitionend",N)};m.addEventListener("transitionend",N),setTimeout(N,c+80)}let f=new Set(p.map(m=>m.el));return[...o.children].forEach(m=>{m.matches("aside.notes")||f.has(m)||[...f].some(k=>m.contains(k))||(m.classList.add("aa-fresh"),requestAnimationFrame(()=>requestAnimationFrame(()=>m.classList.add("aa-in"))),setTimeout(()=>m.classList.remove("aa-fresh","aa-in"),c+120))}),c}me();fe();me();fe();var li=function(){"use strict";class t{constructor(n,r){let l,u=" "+n,h=r&&r.loc;if(h&&h.start<=h.end){let E=h.lexer.input;l=h.start;let U=h.end;l===E.length?u+=" at end of input: ":u+=" at position "+(l+1)+`:
|
|
5
|
+
`;let V=E.slice(l,U).replace(/[^]/g,"$&\u0332"),be,Te;be=l>15?"\u2026"+E.slice(l-15,l):E.slice(0,l),Te=U+15<E.length?E.slice(U,U+15)+"\u2026":E.slice(U),u+=be+V+Te}let y=new Error(u);return y.name="ParseError",y.__proto__=t.prototype,y.position=l,y}}t.prototype.__proto__=Error.prototype;let o=function(e,n){return e===void 0?n:e},a=/([A-Z])/g,c=function(e){return e.replace(a,"-$1").toLowerCase()},d={"&":"&",">":">","<":"<",'"':""","'":"'"},p=/[&><"']/g;function f(e){return String(e).replace(p,n=>d[n])}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},v=function(e){let n=m(e);return n.type==="mathord"||n.type==="textord"||n.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 P{constructor(n){n=n||{},this.displayMode=o(n.displayMode,!1),this.annotate=o(n.annotate,!1),this.leqno=o(n.leqno,!1),this.throwOnError=o(n.throwOnError,!1),this.errorColor=o(n.errorColor,"#b22222"),this.macros=n.macros||{},this.wrap=o(n.wrap,"none"),this.xml=o(n.xml,!1),this.colorIsTextColor=o(n.colorIsTextColor,!1),this.strict=o(n.strict,!1),this.trust=o(n.trust,!1),this.maxSize=n.maxSize===void 0?[1/0,1/0]:Array.isArray(n.maxSize)?n.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,o(n.maxExpand,1e3)),this.wrapDelimiterPairs=!0}isTrusted(n){if(n.url&&!n.protocol){let l=function(u){let h=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(u);return h?h[2]!==":"?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(h[1])?h[1].toLowerCase():null:"_relative"}(n.url);if(l==null)return!1;n.protocol=l}return!!(typeof this.trust=="function"?this.trust(n):this.trust)}}let T={},A={};function N({type:e,names:n,props:r,handler:l,mathmlBuilder:u}){let h={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:l};for(let y=0;y<n.length;++y)T[n[y]]=h;e&&u&&(A[e]=u)}function I({type:e,mathmlBuilder:n}){N({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:n})}let Se=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},pe=function(e){return e.type==="ordgroup"?e.body:[e]};class Oe{constructor(n){this.children=n,this.classes=[],this.style={}}hasClass(n){return this.classes.includes(n)}toNode(){let n=document.createDocumentFragment();for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){let n="";for(let r=0;r<this.children.length;r++)n+=this.children[r].toMarkup();return n}toText(){return this.children.map(n=>n.toText()).join("")}}let re=function(e){return e.filter(n=>n).join(" ")},ce=function(e,n){this.classes=e||[],this.attributes={},this.style=n||{}},Me=function(e){let n=document.createElement(e);n.className=re(this.classes);for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n.style[r]=this.style[r]);for(let r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n},ze=function(e){let n=`<${e}`;this.classes.length&&(n+=` class="${f(re(this.classes))}"`);let r="";for(let l in this.style)Object.prototype.hasOwnProperty.call(this.style,l)&&(r+=`${c(l)}:${this.style[l]};`);r&&(n+=` style="${r}"`);for(let l in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,l)&&(n+=` ${l}="${f(this.attributes[l])}"`);n+=">";for(let l=0;l<this.children.length;l++)n+=this.children[l].toMarkup();return n+=`</${e}>`,n};class Ve{constructor(n,r,l){ce.call(this,n,l),this.children=r||[]}setAttribute(n,r){this.attributes[n]=r}toNode(){return Me.call(this,"span")}toMarkup(){return ze.call(this,"span")}}let $e=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.text)}};class _e{constructor(n,r,l){this.href=n,this.classes=r,this.children=l||[]}toNode(){let n=document.createElement("a");n.setAttribute("href",this.href),this.classes.length>0&&(n.className=re(this.classes));for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){let n=`<a href='${f(this.href)}'`;this.classes.length>0&&(n+=` class="${f(re(this.classes))}"`),n+=">";for(let r=0;r<this.children.length;r++)n+=this.children[r].toMarkup();return n+="</a>",n}}class Ze{constructor(n,r,l){this.alt=r,this.src=n,this.classes=["mord"],this.style=l}hasClass(n){return this.classes.includes(n)}toNode(){let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.className="mord";for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n.style[r]=this.style[r]);return n}toMarkup(){let n=`<img src='${this.src}' alt='${this.alt}'`,r="";for(let l in this.style)Object.prototype.hasOwnProperty.call(this.style,l)&&(r+=`${c(l)}:${this.style[l]};`);return r&&(n+=` style="${f(r)}"`),n+=">",n}}function bt(e){return new Oe(e)}class _{constructor(n,r,l,u){this.type=n,this.attributes={},this.children=r||[],this.classes=l||[],this.style=u||{},this.label=""}setAttribute(n,r){this.attributes[n]=r}getAttribute(n){return this.attributes[n]}setLabel(n){this.label=n}toNode(){let n=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(let r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);this.classes.length>0&&(n.className=re(this.classes));for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n.style[r]=this.style[r]);for(let r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){let n="<"+this.type;for(let l in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,l)&&(n+=" "+l+'="',n+=f(this.attributes[l]),n+='"');this.classes.length>0&&(n+=` class="${f(re(this.classes))}"`);let r="";for(let l in this.style)Object.prototype.hasOwnProperty.call(this.style,l)&&(r+=`${c(l)}:${this.style[l]};`);r&&(n+=` style="${r}"`),n+=">";for(let l=0;l<this.children.length;l++)n+=this.children[l].toMarkup();return n+="</"+this.type+">",n}toText(){return this.children.map(n=>n.toText()).join("")}}class je{constructor(n){this.text=n}toNode(){return document.createTextNode(this.text)}toMarkup(){return f(this.toText())}toText(){return this.text}}let gt=e=>{let n;return e.length===1&&e[0].type==="mrow"?(n=e.pop(),n.type="mstyle"):n=new _("mstyle",e),n},ut=e=>{let n=0;if(e.body&&Array.isArray(e.body))for(let r of e.body)n+=ut(r);else if(e.body)n+=ut(e.body);else if(e.type==="supsub")n+=ut(e.base),e.sub&&(n+=.7*ut(e.sub)),e.sup&&(n+=.7*ut(e.sup));else if(e.type==="mathord"||e.type==="textord")for(let r of e.text.split("")){let l=r.codePointAt(0);n+=96<l&&l<123||944<l&&l<970?.56:47<l&&l<58?.5:.92}else n+=1;return n},Q={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 n=new je(Q[e.slice(1)]),r=new _("mo",[n]);return r.setAttribute("stretchy","true"),r},oe=["\\widetilde","\\widehat","\\widecheck","\\utilde"],he=e=>{let n=j(e.label);if(oe.includes(e.label)){let r=ut(e.base);1<r&&r<1.6?n.classes.push("tml-crooked-2"):1.6<=r&&r<2.5?n.classes.push("tml-crooked-3"):2.5<=r&&n.classes.push("tml-crooked-4")}return n},le={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Re={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Y={math:{},text:{}};function s(e,n,r,l,u){Y[e][l]={group:n,replace:r},u&&r&&(Y[e][r]=Y[e][l])}let i="math",O="text",Ue="accent-token",B="bin",Le="close",$t="inner",W="mathord",Ae="op-token",ee="open",We="punct",w="rel",Ie="spacing",g="textord";s(i,w,"\u2261","\\equiv",!0),s(i,w,"\u227A","\\prec",!0),s(i,w,"\u227B","\\succ",!0),s(i,w,"\u223C","\\sim",!0),s(i,w,"\u27C2","\\perp",!0),s(i,w,"\u2AAF","\\preceq",!0),s(i,w,"\u2AB0","\\succeq",!0),s(i,w,"\u2243","\\simeq",!0),s(i,w,"\u224C","\\backcong",!0),s(i,w,"|","\\mid",!0),s(i,w,"\u226A","\\ll",!0),s(i,w,"\u226B","\\gg",!0),s(i,w,"\u224D","\\asymp",!0),s(i,w,"\u2225","\\parallel"),s(i,w,"\u2323","\\smile",!0),s(i,w,"\u2291","\\sqsubseteq",!0),s(i,w,"\u2292","\\sqsupseteq",!0),s(i,w,"\u2250","\\doteq",!0),s(i,w,"\u2322","\\frown",!0),s(i,w,"\u220B","\\ni",!0),s(i,w,"\u220C","\\notni",!0),s(i,w,"\u221D","\\propto",!0),s(i,w,"\u22A2","\\vdash",!0),s(i,w,"\u22A3","\\dashv",!0),s(i,w,"\u220B","\\owns"),s(i,w,"\u2258","\\arceq",!0),s(i,w,"\u2259","\\wedgeq",!0),s(i,w,"\u225A","\\veeeq",!0),s(i,w,"\u225B","\\stareq",!0),s(i,w,"\u225D","\\eqdef",!0),s(i,w,"\u225E","\\measeq",!0),s(i,w,"\u225F","\\questeq",!0),s(i,w,"\u2260","\\ne",!0),s(i,w,"\u2260","\\neq"),s(i,w,"\u2A75","\\eqeq",!0),s(i,w,"\u2A76","\\eqeqeq",!0),s(i,w,"\u2237","\\dblcolon",!0),s(i,w,"\u2254","\\coloneqq",!0),s(i,w,"\u2255","\\eqqcolon",!0),s(i,w,"\u2239","\\eqcolon",!0),s(i,w,"\u2A74","\\Coloneqq",!0),s(i,We,".","\\ldotp"),s(i,We,"\xB7","\\cdotp"),s(i,g,"#","\\#"),s(O,g,"#","\\#"),s(i,g,"&","\\&"),s(O,g,"&","\\&"),s(i,g,"\u2135","\\aleph",!0),s(i,g,"\u2200","\\forall",!0),s(i,g,"\u210F","\\hbar",!0),s(i,g,"\u2203","\\exists",!0),s(i,ee,"\u2207","\\nabla",!0),s(i,g,"\u266D","\\flat",!0),s(i,g,"\u2113","\\ell",!0),s(i,g,"\u266E","\\natural",!0),s(i,g,"\u212B","\\Angstrom",!0),s(O,g,"\u212B","\\Angstrom",!0),s(i,g,"\u2663","\\clubsuit",!0),s(i,g,"\u2667","\\varclubsuit",!0),s(i,g,"\u2118","\\wp",!0),s(i,g,"\u266F","\\sharp",!0),s(i,g,"\u2662","\\diamondsuit",!0),s(i,g,"\u2666","\\vardiamondsuit",!0),s(i,g,"\u211C","\\Re",!0),s(i,g,"\u2661","\\heartsuit",!0),s(i,g,"\u2665","\\varheartsuit",!0),s(i,g,"\u2111","\\Im",!0),s(i,g,"\u2660","\\spadesuit",!0),s(i,g,"\u2664","\\varspadesuit",!0),s(i,g,"\u2640","\\female",!0),s(i,g,"\u2642","\\male",!0),s(i,g,"\xA7","\\S",!0),s(O,g,"\xA7","\\S"),s(i,g,"\xB6","\\P",!0),s(O,g,"\xB6","\\P"),s(O,g,"\u263A","\\smiley",!0),s(i,g,"\u263A","\\smiley",!0),s(i,g,"\u2020","\\dag"),s(O,g,"\u2020","\\dag"),s(O,g,"\u2020","\\textdagger"),s(i,g,"\u2021","\\ddag"),s(O,g,"\u2021","\\ddag"),s(O,g,"\u2021","\\textdaggerdbl"),s(i,Le,"\u23B1","\\rmoustache",!0),s(i,ee,"\u23B0","\\lmoustache",!0),s(i,Le,"\u27EF","\\rgroup",!0),s(i,ee,"\u27EE","\\lgroup",!0),s(i,B,"\u2213","\\mp",!0),s(i,B,"\u2296","\\ominus",!0),s(i,B,"\u228E","\\uplus",!0),s(i,B,"\u2293","\\sqcap",!0),s(i,B,"\u2217","\\ast"),s(i,B,"\u2294","\\sqcup",!0),s(i,B,"\u25EF","\\bigcirc",!0),s(i,B,"\u2219","\\bullet",!0),s(i,B,"\u2021","\\ddagger"),s(i,B,"\u2240","\\wr",!0),s(i,B,"\u2A3F","\\amalg"),s(i,B,"&","\\And"),s(i,B,"\u2AFD","\\sslash",!0),s(i,w,"\u27F5","\\longleftarrow",!0),s(i,w,"\u21D0","\\Leftarrow",!0),s(i,w,"\u27F8","\\Longleftarrow",!0),s(i,w,"\u27F6","\\longrightarrow",!0),s(i,w,"\u21D2","\\Rightarrow",!0),s(i,w,"\u27F9","\\Longrightarrow",!0),s(i,w,"\u2194","\\leftrightarrow",!0),s(i,w,"\u27F7","\\longleftrightarrow",!0),s(i,w,"\u21D4","\\Leftrightarrow",!0),s(i,w,"\u27FA","\\Longleftrightarrow",!0),s(i,w,"\u21A4","\\mapsfrom",!0),s(i,w,"\u21A6","\\mapsto",!0),s(i,w,"\u27FC","\\longmapsto",!0),s(i,w,"\u2197","\\nearrow",!0),s(i,w,"\u21A9","\\hookleftarrow",!0),s(i,w,"\u21AA","\\hookrightarrow",!0),s(i,w,"\u2198","\\searrow",!0),s(i,w,"\u21BC","\\leftharpoonup",!0),s(i,w,"\u21C0","\\rightharpoonup",!0),s(i,w,"\u2199","\\swarrow",!0),s(i,w,"\u21BD","\\leftharpoondown",!0),s(i,w,"\u21C1","\\rightharpoondown",!0),s(i,w,"\u2196","\\nwarrow",!0),s(i,w,"\u21CC","\\rightleftharpoons",!0),s(i,W,"\u21AF","\\lightning",!0),s(i,W,"\u220E","\\QED",!0),s(i,W,"\u2030","\\permil",!0),s(O,g,"\u2030","\\permil"),s(i,W,"\u2609","\\astrosun",!0),s(i,W,"\u263C","\\sun",!0),s(i,W,"\u263E","\\leftmoon",!0),s(i,W,"\u263D","\\rightmoon",!0),s(i,W,"\u2295","\\Earth"),s(i,w,"\u226E","\\nless",!0),s(i,w,"\u2A87","\\lneq",!0),s(i,w,"\u2268","\\lneqq",!0),s(i,w,"\u2268\uFE00","\\lvertneqq"),s(i,w,"\u22E6","\\lnsim",!0),s(i,w,"\u2A89","\\lnapprox",!0),s(i,w,"\u2280","\\nprec",!0),s(i,w,"\u22E0","\\npreceq",!0),s(i,w,"\u22E8","\\precnsim",!0),s(i,w,"\u2AB9","\\precnapprox",!0),s(i,w,"\u2241","\\nsim",!0),s(i,w,"\u2224","\\nmid",!0),s(i,w,"\u2224","\\nshortmid"),s(i,w,"\u22AC","\\nvdash",!0),s(i,w,"\u22AD","\\nvDash",!0),s(i,w,"\u22EA","\\ntriangleleft"),s(i,w,"\u22EC","\\ntrianglelefteq",!0),s(i,w,"\u2284","\\nsubset",!0),s(i,w,"\u2285","\\nsupset",!0),s(i,w,"\u228A","\\subsetneq",!0),s(i,w,"\u228A\uFE00","\\varsubsetneq"),s(i,w,"\u2ACB","\\subsetneqq",!0),s(i,w,"\u2ACB\uFE00","\\varsubsetneqq"),s(i,w,"\u226F","\\ngtr",!0),s(i,w,"\u2A88","\\gneq",!0),s(i,w,"\u2269","\\gneqq",!0),s(i,w,"\u2269\uFE00","\\gvertneqq"),s(i,w,"\u22E7","\\gnsim",!0),s(i,w,"\u2A8A","\\gnapprox",!0),s(i,w,"\u2281","\\nsucc",!0),s(i,w,"\u22E1","\\nsucceq",!0),s(i,w,"\u22E9","\\succnsim",!0),s(i,w,"\u2ABA","\\succnapprox",!0),s(i,w,"\u2246","\\ncong",!0),s(i,w,"\u2226","\\nparallel",!0),s(i,w,"\u2226","\\nshortparallel"),s(i,w,"\u22AF","\\nVDash",!0),s(i,w,"\u22EB","\\ntriangleright"),s(i,w,"\u22ED","\\ntrianglerighteq",!0),s(i,w,"\u228B","\\supsetneq",!0),s(i,w,"\u228B","\\varsupsetneq"),s(i,w,"\u2ACC","\\supsetneqq",!0),s(i,w,"\u2ACC\uFE00","\\varsupsetneqq"),s(i,w,"\u22AE","\\nVdash",!0),s(i,w,"\u2AB5","\\precneqq",!0),s(i,w,"\u2AB6","\\succneqq",!0),s(i,B,"\u22B4","\\unlhd"),s(i,B,"\u22B5","\\unrhd"),s(i,w,"\u219A","\\nleftarrow",!0),s(i,w,"\u219B","\\nrightarrow",!0),s(i,w,"\u21CD","\\nLeftarrow",!0),s(i,w,"\u21CF","\\nRightarrow",!0),s(i,w,"\u21AE","\\nleftrightarrow",!0),s(i,w,"\u21CE","\\nLeftrightarrow",!0),s(i,w,"\u25B3","\\vartriangle"),s(i,g,"\u210F","\\hslash"),s(i,g,"\u25BD","\\triangledown"),s(i,g,"\u25CA","\\lozenge"),s(i,g,"\u24C8","\\circledS"),s(i,g,"\xAE","\\circledR",!0),s(O,g,"\xAE","\\circledR"),s(O,g,"\xAE","\\textregistered"),s(i,g,"\u2221","\\measuredangle",!0),s(i,g,"\u2204","\\nexists"),s(i,g,"\u2127","\\mho"),s(i,g,"\u2132","\\Finv",!0),s(i,g,"\u2141","\\Game",!0),s(i,g,"\u2035","\\backprime"),s(i,g,"\u2036","\\backdprime"),s(i,g,"\u2037","\\backtrprime"),s(i,g,"\u25B2","\\blacktriangle"),s(i,g,"\u25BC","\\blacktriangledown"),s(i,g,"\u25A0","\\blacksquare"),s(i,g,"\u29EB","\\blacklozenge"),s(i,g,"\u2605","\\bigstar"),s(i,g,"\u2222","\\sphericalangle",!0),s(i,g,"\u2201","\\complement",!0),s(i,g,"\u2571","\\diagup"),s(i,g,"\u2572","\\diagdown"),s(i,g,"\u25A1","\\square"),s(i,g,"\u25A1","\\Box"),s(i,g,"\u25CA","\\Diamond"),s(i,g,"\xA5","\\yen",!0),s(O,g,"\xA5","\\yen",!0),s(i,g,"\u2713","\\checkmark",!0),s(O,g,"\u2713","\\checkmark"),s(i,g,"\u2717","\\ballotx",!0),s(O,g,"\u2717","\\ballotx"),s(O,g,"\u2022","\\textbullet"),s(i,g,"\u2136","\\beth",!0),s(i,g,"\u2138","\\daleth",!0),s(i,g,"\u2137","\\gimel",!0),s(i,g,"\u03DD","\\digamma",!0),s(i,g,"\u03F0","\\varkappa"),s(i,ee,"\u231C","\\ulcorner",!0),s(i,Le,"\u231D","\\urcorner",!0),s(i,ee,"\u231E","\\llcorner",!0),s(i,Le,"\u231F","\\lrcorner",!0),s(i,w,"\u2266","\\leqq",!0),s(i,w,"\u2A7D","\\leqslant",!0),s(i,w,"\u2A95","\\eqslantless",!0),s(i,w,"\u2272","\\lesssim",!0),s(i,w,"\u2A85","\\lessapprox",!0),s(i,w,"\u224A","\\approxeq",!0),s(i,B,"\u22D6","\\lessdot"),s(i,w,"\u22D8","\\lll",!0),s(i,w,"\u2276","\\lessgtr",!0),s(i,w,"\u22DA","\\lesseqgtr",!0),s(i,w,"\u2A8B","\\lesseqqgtr",!0),s(i,w,"\u2251","\\doteqdot"),s(i,w,"\u2253","\\risingdotseq",!0),s(i,w,"\u2252","\\fallingdotseq",!0),s(i,w,"\u223D","\\backsim",!0),s(i,w,"\u22CD","\\backsimeq",!0),s(i,w,"\u2AC5","\\subseteqq",!0),s(i,w,"\u22D0","\\Subset",!0),s(i,w,"\u228F","\\sqsubset",!0),s(i,w,"\u227C","\\preccurlyeq",!0),s(i,w,"\u22DE","\\curlyeqprec",!0),s(i,w,"\u227E","\\precsim",!0),s(i,w,"\u2AB7","\\precapprox",!0),s(i,w,"\u22B2","\\vartriangleleft"),s(i,w,"\u22B4","\\trianglelefteq"),s(i,w,"\u22A8","\\vDash",!0),s(i,w,"\u22AB","\\VDash",!0),s(i,w,"\u22AA","\\Vvdash",!0),s(i,w,"\u2323","\\smallsmile"),s(i,w,"\u2322","\\smallfrown"),s(i,w,"\u224F","\\bumpeq",!0),s(i,w,"\u224E","\\Bumpeq",!0),s(i,w,"\u2267","\\geqq",!0),s(i,w,"\u2A7E","\\geqslant",!0),s(i,w,"\u2A96","\\eqslantgtr",!0),s(i,w,"\u2273","\\gtrsim",!0),s(i,w,"\u2A86","\\gtrapprox",!0),s(i,B,"\u22D7","\\gtrdot"),s(i,w,"\u22D9","\\ggg",!0),s(i,w,"\u2277","\\gtrless",!0),s(i,w,"\u22DB","\\gtreqless",!0),s(i,w,"\u2A8C","\\gtreqqless",!0),s(i,w,"\u2256","\\eqcirc",!0),s(i,w,"\u2257","\\circeq",!0),s(i,w,"\u225C","\\triangleq",!0),s(i,w,"\u223C","\\thicksim"),s(i,w,"\u2248","\\thickapprox"),s(i,w,"\u2AC6","\\supseteqq",!0),s(i,w,"\u22D1","\\Supset",!0),s(i,w,"\u2290","\\sqsupset",!0),s(i,w,"\u227D","\\succcurlyeq",!0),s(i,w,"\u22DF","\\curlyeqsucc",!0),s(i,w,"\u227F","\\succsim",!0),s(i,w,"\u2AB8","\\succapprox",!0),s(i,w,"\u22B3","\\vartriangleright"),s(i,w,"\u22B5","\\trianglerighteq"),s(i,w,"\u22A9","\\Vdash",!0),s(i,w,"\u2223","\\shortmid"),s(i,w,"\u2225","\\shortparallel"),s(i,w,"\u226C","\\between",!0),s(i,w,"\u22D4","\\pitchfork",!0),s(i,w,"\u221D","\\varpropto"),s(i,w,"\u25C0","\\blacktriangleleft"),s(i,w,"\u2234","\\therefore",!0),s(i,w,"\u220D","\\backepsilon"),s(i,w,"\u25B6","\\blacktriangleright"),s(i,w,"\u2235","\\because",!0),s(i,w,"\u22D8","\\llless"),s(i,w,"\u22D9","\\gggtr"),s(i,B,"\u22B2","\\lhd"),s(i,B,"\u22B3","\\rhd"),s(i,w,"\u2242","\\eqsim",!0),s(i,w,"\u2251","\\Doteq",!0),s(i,w,"\u297D","\\strictif",!0),s(i,w,"\u297C","\\strictfi",!0),s(i,B,"\u2214","\\dotplus",!0),s(i,B,"\u2216","\\smallsetminus"),s(i,B,"\u22D2","\\Cap",!0),s(i,B,"\u22D3","\\Cup",!0),s(i,B,"\u2A5E","\\doublebarwedge",!0),s(i,B,"\u229F","\\boxminus",!0),s(i,B,"\u229E","\\boxplus",!0),s(i,B,"\u29C4","\\boxslash",!0),s(i,B,"\u22C7","\\divideontimes",!0),s(i,B,"\u22C9","\\ltimes",!0),s(i,B,"\u22CA","\\rtimes",!0),s(i,B,"\u22CB","\\leftthreetimes",!0),s(i,B,"\u22CC","\\rightthreetimes",!0),s(i,B,"\u22CF","\\curlywedge",!0),s(i,B,"\u22CE","\\curlyvee",!0),s(i,B,"\u229D","\\circleddash",!0),s(i,B,"\u229B","\\circledast",!0),s(i,B,"\u22BA","\\intercal",!0),s(i,B,"\u22D2","\\doublecap"),s(i,B,"\u22D3","\\doublecup"),s(i,B,"\u22A0","\\boxtimes",!0),s(i,B,"\u22C8","\\bowtie",!0),s(i,B,"\u22C8","\\Join"),s(i,B,"\u27D5","\\leftouterjoin",!0),s(i,B,"\u27D6","\\rightouterjoin",!0),s(i,B,"\u27D7","\\fullouterjoin",!0),s(i,B,"\u2238","\\dotminus",!0),s(i,B,"\u27D1","\\wedgedot",!0),s(i,B,"\u27C7","\\veedot",!0),s(i,B,"\u2A62","\\doublebarvee",!0),s(i,B,"\u2A63","\\veedoublebar",!0),s(i,B,"\u2A5F","\\wedgebar",!0),s(i,B,"\u2A60","\\wedgedoublebar",!0),s(i,B,"\u2A54","\\Vee",!0),s(i,B,"\u2A53","\\Wedge",!0),s(i,B,"\u2A43","\\barcap",!0),s(i,B,"\u2A42","\\barcup",!0),s(i,B,"\u2A48","\\capbarcup",!0),s(i,B,"\u2A40","\\capdot",!0),s(i,B,"\u2A47","\\capovercup",!0),s(i,B,"\u2A46","\\cupovercap",!0),s(i,B,"\u2A4D","\\closedvarcap",!0),s(i,B,"\u2A4C","\\closedvarcup",!0),s(i,B,"\u2A2A","\\minusdot",!0),s(i,B,"\u2A2B","\\minusfdots",!0),s(i,B,"\u2A2C","\\minusrdots",!0),s(i,B,"\u22BB","\\Xor",!0),s(i,B,"\u22BC","\\Nand",!0),s(i,B,"\u22BD","\\Nor",!0),s(i,B,"\u22BD","\\barvee"),s(i,B,"\u2AF4","\\interleave",!0),s(i,B,"\u29E2","\\shuffle",!0),s(i,B,"\u2AF6","\\threedotcolon",!0),s(i,B,"\u2982","\\typecolon",!0),s(i,B,"\u223E","\\invlazys",!0),s(i,B,"\u2A4B","\\twocaps",!0),s(i,B,"\u2A4A","\\twocups",!0),s(i,B,"\u2A4E","\\Sqcap",!0),s(i,B,"\u2A4F","\\Sqcup",!0),s(i,B,"\u2A56","\\veeonvee",!0),s(i,B,"\u2A55","\\wedgeonwedge",!0),s(i,B,"\u29D7","\\blackhourglass",!0),s(i,B,"\u29C6","\\boxast",!0),s(i,B,"\u29C8","\\boxbox",!0),s(i,B,"\u29C7","\\boxcircle",!0),s(i,B,"\u229C","\\circledequal",!0),s(i,B,"\u29B7","\\circledparallel",!0),s(i,B,"\u29B6","\\circledvert",!0),s(i,B,"\u29B5","\\circlehbar",!0),s(i,B,"\u27E1","\\concavediamond",!0),s(i,B,"\u27E2","\\concavediamondtickleft",!0),s(i,B,"\u27E3","\\concavediamondtickright",!0),s(i,B,"\u22C4","\\diamond",!0),s(i,B,"\u29D6","\\hourglass",!0),s(i,B,"\u27E0","\\lozengeminus",!0),s(i,B,"\u233D","\\obar",!0),s(i,B,"\u29B8","\\obslash",!0),s(i,B,"\u2A38","\\odiv",!0),s(i,B,"\u29C1","\\ogreaterthan",!0),s(i,B,"\u29C0","\\olessthan",!0),s(i,B,"\u29B9","\\operp",!0),s(i,B,"\u2A37","\\Otimes",!0),s(i,B,"\u2A36","\\otimeshat",!0),s(i,B,"\u22C6","\\star",!0),s(i,B,"\u25B3","\\triangle",!0),s(i,B,"\u2A3A","\\triangleminus",!0),s(i,B,"\u2A39","\\triangleplus",!0),s(i,B,"\u2A3B","\\triangletimes",!0),s(i,B,"\u27E4","\\whitesquaretickleft",!0),s(i,B,"\u27E5","\\whitesquaretickright",!0),s(i,B,"\u2A33","\\smashtimes",!0),s(i,w,"\u21E2","\\dashrightarrow",!0),s(i,w,"\u21E0","\\dashleftarrow",!0),s(i,w,"\u21C7","\\leftleftarrows",!0),s(i,w,"\u21C6","\\leftrightarrows",!0),s(i,w,"\u21DA","\\Lleftarrow",!0),s(i,w,"\u219E","\\twoheadleftarrow",!0),s(i,w,"\u21A2","\\leftarrowtail",!0),s(i,w,"\u21AB","\\looparrowleft",!0),s(i,w,"\u21CB","\\leftrightharpoons",!0),s(i,w,"\u21B6","\\curvearrowleft",!0),s(i,w,"\u21BA","\\circlearrowleft",!0),s(i,w,"\u21B0","\\Lsh",!0),s(i,w,"\u21C8","\\upuparrows",!0),s(i,w,"\u21BF","\\upharpoonleft",!0),s(i,w,"\u21C3","\\downharpoonleft",!0),s(i,w,"\u22B6","\\origof",!0),s(i,w,"\u22B7","\\imageof",!0),s(i,w,"\u22B8","\\multimap",!0),s(i,w,"\u21AD","\\leftrightsquigarrow",!0),s(i,w,"\u21C9","\\rightrightarrows",!0),s(i,w,"\u21C4","\\rightleftarrows",!0),s(i,w,"\u21A0","\\twoheadrightarrow",!0),s(i,w,"\u21A3","\\rightarrowtail",!0),s(i,w,"\u21AC","\\looparrowright",!0),s(i,w,"\u21B7","\\curvearrowright",!0),s(i,w,"\u21BB","\\circlearrowright",!0),s(i,w,"\u21B1","\\Rsh",!0),s(i,w,"\u21CA","\\downdownarrows",!0),s(i,w,"\u21BE","\\upharpoonright",!0),s(i,w,"\u21C2","\\downharpoonright",!0),s(i,w,"\u21DD","\\rightsquigarrow",!0),s(i,w,"\u21DD","\\leadsto"),s(i,w,"\u21DB","\\Rrightarrow",!0),s(i,w,"\u21BE","\\restriction"),s(i,g,"\u2018","`"),s(i,g,"$","\\$"),s(O,g,"$","\\$"),s(O,g,"$","\\textdollar"),s(i,g,"\xA2","\\cent"),s(O,g,"\xA2","\\cent"),s(i,g,"%","\\%"),s(O,g,"%","\\%"),s(i,g,"_","\\_"),s(O,g,"_","\\_"),s(O,g,"_","\\textunderscore"),s(O,g,"\u2423","\\textvisiblespace",!0),s(i,g,"\u2220","\\angle",!0),s(i,g,"\u221E","\\infty",!0),s(i,g,"\u2032","\\prime"),s(i,g,"\u2033","\\dprime"),s(i,g,"\u2034","\\trprime"),s(i,g,"\u2057","\\qprime"),s(i,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(i,W,"\u0391","\\Alpha",!0),s(i,W,"\u0392","\\Beta",!0),s(i,W,"\u0393","\\Gamma",!0),s(i,W,"\u0394","\\Delta",!0),s(i,W,"\u0395","\\Epsilon",!0),s(i,W,"\u0396","\\Zeta",!0),s(i,W,"\u0397","\\Eta",!0),s(i,W,"\u0398","\\Theta",!0),s(i,W,"\u0399","\\Iota",!0),s(i,W,"\u039A","\\Kappa",!0),s(i,W,"\u039B","\\Lambda",!0),s(i,W,"\u039C","\\Mu",!0),s(i,W,"\u039D","\\Nu",!0),s(i,W,"\u039E","\\Xi",!0),s(i,W,"\u039F","\\Omicron",!0),s(i,W,"\u03A0","\\Pi",!0),s(i,W,"\u03A1","\\Rho",!0),s(i,W,"\u03A3","\\Sigma",!0),s(i,W,"\u03A4","\\Tau",!0),s(i,W,"\u03A5","\\Upsilon",!0),s(i,W,"\u03A6","\\Phi",!0),s(i,W,"\u03A7","\\Chi",!0),s(i,W,"\u03A8","\\Psi",!0),s(i,W,"\u03A9","\\Omega",!0),s(i,ee,"\xAC","\\neg",!0),s(i,ee,"\xAC","\\lnot"),s(i,g,"\u22A4","\\top"),s(i,g,"\u22A5","\\bot"),s(i,g,"\u2205","\\emptyset"),s(i,g,"\u2300","\\varnothing"),s(i,W,"\u03B1","\\alpha",!0),s(i,W,"\u03B2","\\beta",!0),s(i,W,"\u03B3","\\gamma",!0),s(i,W,"\u03B4","\\delta",!0),s(i,W,"\u03F5","\\epsilon",!0),s(i,W,"\u03B6","\\zeta",!0),s(i,W,"\u03B7","\\eta",!0),s(i,W,"\u03B8","\\theta",!0),s(i,W,"\u03B9","\\iota",!0),s(i,W,"\u03BA","\\kappa",!0),s(i,W,"\u03BB","\\lambda",!0),s(i,W,"\u03BC","\\mu",!0),s(i,W,"\u03BD","\\nu",!0),s(i,W,"\u03BE","\\xi",!0),s(i,W,"\u03BF","\\omicron",!0),s(i,W,"\u03C0","\\pi",!0),s(i,W,"\u03C1","\\rho",!0),s(i,W,"\u03C3","\\sigma",!0),s(i,W,"\u03C4","\\tau",!0),s(i,W,"\u03C5","\\upsilon",!0),s(i,W,"\u03D5","\\phi",!0),s(i,W,"\u03C7","\\chi",!0),s(i,W,"\u03C8","\\psi",!0),s(i,W,"\u03C9","\\omega",!0),s(i,W,"\u03B5","\\varepsilon",!0),s(i,W,"\u03D1","\\vartheta",!0),s(i,W,"\u03D6","\\varpi",!0),s(i,W,"\u03F1","\\varrho",!0),s(i,W,"\u03C2","\\varsigma",!0),s(i,W,"\u03C6","\\varphi",!0),s(i,W,"\u03D8","\\Coppa",!0),s(i,W,"\u03D9","\\coppa",!0),s(i,W,"\u03D9","\\varcoppa",!0),s(i,W,"\u03DE","\\Koppa",!0),s(i,W,"\u03DF","\\koppa",!0),s(i,W,"\u03E0","\\Sampi",!0),s(i,W,"\u03E1","\\sampi",!0),s(i,W,"\u03DA","\\Stigma",!0),s(i,W,"\u03DB","\\stigma",!0),s(i,W,"\u2AEB","\\Bot"),s(i,g,"\xF0","\\eth",!0),s(O,g,"\xF0","\xF0"),s(i,g,"\xC5","\\AA"),s(O,g,"\xC5","\\AA",!0),s(i,g,"\xC6","\\AE",!0),s(O,g,"\xC6","\\AE",!0),s(i,g,"\xD0","\\DH",!0),s(O,g,"\xD0","\\DH",!0),s(i,g,"\xDE","\\TH",!0),s(O,g,"\xDE","\\TH",!0),s(i,g,"\xDF","\\ss",!0),s(O,g,"\xDF","\\ss",!0),s(i,g,"\xE5","\\aa"),s(O,g,"\xE5","\\aa",!0),s(i,g,"\xE6","\\ae",!0),s(O,g,"\xE6","\\ae",!0),s(i,g,"\xF0","\\dh"),s(O,g,"\xF0","\\dh",!0),s(i,g,"\xFE","\\th",!0),s(O,g,"\xFE","\\th",!0),s(i,g,"\u0110","\\DJ",!0),s(O,g,"\u0110","\\DJ",!0),s(i,g,"\u0111","\\dj",!0),s(O,g,"\u0111","\\dj",!0),s(i,g,"\u0141","\\L",!0),s(O,g,"\u0141","\\L",!0),s(i,g,"\u0141","\\l",!0),s(O,g,"\u0141","\\l",!0),s(i,g,"\u014A","\\NG",!0),s(O,g,"\u014A","\\NG",!0),s(i,g,"\u014B","\\ng",!0),s(O,g,"\u014B","\\ng",!0),s(i,g,"\u0152","\\OE",!0),s(O,g,"\u0152","\\OE",!0),s(i,g,"\u0153","\\oe",!0),s(O,g,"\u0153","\\oe",!0),s(i,B,"\u2217","\u2217",!0),s(i,B,"+","+"),s(i,B,"\u2217","*"),s(i,B,"\u2044","/",!0),s(i,B,"\u2044","\u2044"),s(i,B,"\u2212","-",!0),s(i,B,"\u22C5","\\cdot",!0),s(i,B,"\u2218","\\circ",!0),s(i,B,"\xF7","\\div",!0),s(i,B,"\xB1","\\pm",!0),s(i,B,"\xD7","\\times",!0),s(i,B,"\u2229","\\cap",!0),s(i,B,"\u222A","\\cup",!0),s(i,B,"\u2216","\\setminus",!0),s(i,B,"\u2227","\\land"),s(i,B,"\u2228","\\lor"),s(i,B,"\u2227","\\wedge",!0),s(i,B,"\u2228","\\vee",!0),s(i,ee,"\u27E6","\\llbracket",!0),s(i,Le,"\u27E7","\\rrbracket",!0),s(i,ee,"\u27E8","\\langle",!0),s(i,ee,"\u27EA","\\lAngle",!0),s(i,ee,"\u2989","\\llangle",!0),s(i,ee,"|","\\lvert"),s(i,ee,"\u2016","\\lVert",!0),s(i,g,"!","\\oc"),s(i,g,"?","\\wn"),s(i,g,"\u2193","\\shpos"),s(i,g,"\u2195","\\shift"),s(i,g,"\u2191","\\shneg"),s(i,Le,"?","?"),s(i,Le,"!","!"),s(i,Le,"\u203C","\u203C"),s(i,Le,"\u27E9","\\rangle",!0),s(i,Le,"\u27EB","\\rAngle",!0),s(i,Le,"\u298A","\\rrangle",!0),s(i,Le,"|","\\rvert"),s(i,Le,"\u2016","\\rVert"),s(i,ee,"\u2983","\\lBrace",!0),s(i,Le,"\u2984","\\rBrace",!0),s(i,w,"=","\\equal",!0),s(i,w,":",":"),s(i,w,"\u2248","\\approx",!0),s(i,w,"\u2245","\\cong",!0),s(i,w,"\u2265","\\ge"),s(i,w,"\u2265","\\geq",!0),s(i,w,"\u2190","\\gets"),s(i,w,">","\\gt",!0),s(i,w,"\u2208","\\in",!0),s(i,w,"\u2209","\\notin",!0),s(i,w,"\uE020","\\@not"),s(i,w,"\u2282","\\subset",!0),s(i,w,"\u2283","\\supset",!0),s(i,w,"\u2286","\\subseteq",!0),s(i,w,"\u2287","\\supseteq",!0),s(i,w,"\u2288","\\nsubseteq",!0),s(i,w,"\u2288","\\nsubseteqq"),s(i,w,"\u2289","\\nsupseteq",!0),s(i,w,"\u2289","\\nsupseteqq"),s(i,w,"\u22A8","\\models"),s(i,w,"\u2190","\\leftarrow",!0),s(i,w,"\u2264","\\le"),s(i,w,"\u2264","\\leq",!0),s(i,w,"<","\\lt",!0),s(i,w,"\u2192","\\rightarrow",!0),s(i,w,"\u2192","\\to"),s(i,w,"\u2271","\\ngeq",!0),s(i,w,"\u2271","\\ngeqq"),s(i,w,"\u2271","\\ngeqslant"),s(i,w,"\u2270","\\nleq",!0),s(i,w,"\u2270","\\nleqq"),s(i,w,"\u2270","\\nleqslant"),s(i,w,"\u2AEB","\\Perp",!0),s(i,Ie,"\xA0","\\ "),s(i,Ie,"\xA0","\\space"),s(i,Ie,"\xA0","\\nobreakspace"),s(O,Ie,"\xA0","\\ "),s(O,Ie,"\xA0"," "),s(O,Ie,"\xA0","\\space"),s(O,Ie,"\xA0","\\nobreakspace"),s(i,Ie,null,"\\nobreak"),s(i,Ie,null,"\\allowbreak"),s(i,We,",",","),s(O,We,":",":"),s(i,We,";",";"),s(i,B,"\u22BC","\\barwedge"),s(i,B,"\u22BB","\\veebar"),s(i,B,"\u2299","\\odot",!0),s(i,B,"\u2295\uFE0E","\\oplus"),s(i,B,"\u2297","\\otimes",!0),s(i,g,"\u2202","\\partial",!0),s(i,B,"\u2298","\\oslash",!0),s(i,B,"\u229A","\\circledcirc",!0),s(i,B,"\u22A1","\\boxdot",!0),s(i,B,"\u25B3","\\bigtriangleup"),s(i,B,"\u25BD","\\bigtriangledown"),s(i,B,"\u2020","\\dagger"),s(i,B,"\u22C4","\\diamond"),s(i,B,"\u25C3","\\triangleleft"),s(i,B,"\u25B9","\\triangleright"),s(i,ee,"{","\\{"),s(O,g,"{","\\{"),s(O,g,"{","\\textbraceleft"),s(i,Le,"}","\\}"),s(O,g,"}","\\}"),s(O,g,"}","\\textbraceright"),s(i,ee,"{","\\lbrace"),s(i,Le,"}","\\rbrace"),s(i,ee,"[","\\lbrack",!0),s(O,g,"[","\\lbrack",!0),s(i,Le,"]","\\rbrack",!0),s(O,g,"]","\\rbrack",!0),s(i,ee,"(","\\lparen",!0),s(i,Le,")","\\rparen",!0),s(i,ee,"\u2987","\\llparenthesis",!0),s(i,Le,"\u2988","\\rrparenthesis",!0),s(O,g,"<","\\textless",!0),s(O,g,">","\\textgreater",!0),s(i,ee,"\u230A","\\lfloor",!0),s(i,Le,"\u230B","\\rfloor",!0),s(i,ee,"\u2308","\\lceil",!0),s(i,Le,"\u2309","\\rceil",!0),s(i,g,"\\","\\backslash"),s(i,g,"|","|"),s(i,g,"|","\\vert"),s(O,g,"|","\\textbar",!0),s(i,g,"\u2016","\\|"),s(i,g,"\u2016","\\Vert"),s(O,g,"\u2016","\\textbardbl"),s(O,g,"~","\\textasciitilde"),s(O,g,"\\","\\textbackslash"),s(O,g,"^","\\textasciicircum"),s(i,w,"\u2191","\\uparrow",!0),s(i,w,"\u21D1","\\Uparrow",!0),s(i,w,"\u2193","\\downarrow",!0),s(i,w,"\u21D3","\\Downarrow",!0),s(i,w,"\u2195","\\updownarrow",!0),s(i,w,"\u21D5","\\Updownarrow",!0),s(i,Ae,"\u2210","\\coprod"),s(i,Ae,"\u22C1","\\bigvee"),s(i,Ae,"\u22C0","\\bigwedge"),s(i,Ae,"\u2A04","\\biguplus"),s(i,Ae,"\u2A04","\\bigcupplus"),s(i,Ae,"\u2A03","\\bigcupdot"),s(i,Ae,"\u2A07","\\bigdoublevee"),s(i,Ae,"\u2A08","\\bigdoublewedge"),s(i,Ae,"\u22C2","\\bigcap"),s(i,Ae,"\u22C3","\\bigcup"),s(i,Ae,"\u222B","\\int"),s(i,Ae,"\u222B","\\intop"),s(i,Ae,"\u222C","\\iint"),s(i,Ae,"\u222D","\\iiint"),s(i,Ae,"\u220F","\\prod"),s(i,Ae,"\u2211","\\sum"),s(i,Ae,"\u2A02","\\bigotimes"),s(i,Ae,"\u2A01","\\bigoplus"),s(i,Ae,"\u2A00","\\bigodot"),s(i,Ae,"\u2A09","\\bigtimes"),s(i,Ae,"\u222E","\\oint"),s(i,Ae,"\u222F","\\oiint"),s(i,Ae,"\u2230","\\oiiint"),s(i,Ae,"\u2231","\\intclockwise"),s(i,Ae,"\u2232","\\varointclockwise"),s(i,Ae,"\u2A0C","\\iiiint"),s(i,Ae,"\u2A0D","\\intbar"),s(i,Ae,"\u2A0E","\\intBar"),s(i,Ae,"\u2A0F","\\fint"),s(i,Ae,"\u2A12","\\rppolint"),s(i,Ae,"\u2A13","\\scpolint"),s(i,Ae,"\u2A15","\\pointint"),s(i,Ae,"\u2A16","\\sqint"),s(i,Ae,"\u2A17","\\intlarhk"),s(i,Ae,"\u2A18","\\intx"),s(i,Ae,"\u2A19","\\intcap"),s(i,Ae,"\u2A1A","\\intcup"),s(i,Ae,"\u2A05","\\bigsqcap"),s(i,Ae,"\u2A06","\\bigsqcup"),s(i,Ae,"\u222B","\\smallint"),s(O,$t,"\u2026","\\textellipsis"),s(i,$t,"\u2026","\\mathellipsis"),s(O,$t,"\u2026","\\ldots",!0),s(i,$t,"\u2026","\\ldots",!0),s(i,$t,"\u22F0","\\iddots",!0),s(i,$t,"\u22EF","\\@cdots",!0),s(i,$t,"\u22F1","\\ddots",!0),s(i,g,"\u22EE","\\varvdots"),s(O,g,"\u22EE","\\varvdots"),s(i,Ue,"\xB4","\\acute"),s(i,Ue,"`","\\grave"),s(i,Ue,"\xA8","\\ddot"),s(i,Ue,"\u2026","\\dddot"),s(i,Ue,"\u2026.","\\ddddot"),s(i,Ue,"~","\\tilde"),s(i,Ue,"\u203E","\\bar"),s(i,Ue,"\u02D8","\\breve"),s(i,Ue,"\u02C7","\\check"),s(i,Ue,"^","\\hat"),s(i,Ue,"\u2192","\\vec"),s(i,Ue,"\u02D9","\\dot"),s(i,Ue,"\u02DA","\\mathring"),s(i,W,"\u0131","\\imath",!0),s(i,W,"\u0237","\\jmath",!0),s(i,g,"\u0131","\u0131"),s(i,g,"\u0237","\u0237"),s(O,g,"\u0131","\\i",!0),s(O,g,"\u0237","\\j",!0),s(O,g,"\xF8","\\o",!0),s(i,W,"\xF8","\\o",!0),s(O,g,"\xD8","\\O",!0),s(i,W,"\xD8","\\O",!0),s(O,Ue,"\u02CA","\\'"),s(O,Ue,"\u02CB","\\`"),s(O,Ue,"\u02C6","\\^"),s(O,Ue,"~","\\~"),s(O,Ue,"\u02C9","\\="),s(O,Ue,"\u02D8","\\u"),s(O,Ue,"\u02D9","\\."),s(O,Ue,"\xB8","\\c"),s(O,Ue,"\u02DA","\\r"),s(O,Ue,"\u02C7","\\v"),s(O,Ue,"\xA8",'\\"'),s(O,Ue,"\u02DD","\\H"),s(i,Ue,"\u02CA","\\'"),s(i,Ue,"\u02CB","\\`"),s(i,Ue,"\u02C6","\\^"),s(i,Ue,"~","\\~"),s(i,Ue,"\u02C9","\\="),s(i,Ue,"\u02D8","\\u"),s(i,Ue,"\u02D9","\\."),s(i,Ue,"\xB8","\\c"),s(i,Ue,"\u02DA","\\r"),s(i,Ue,"\u02C7","\\v"),s(i,Ue,"\xA8",'\\"'),s(i,Ue,"\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(i,g,"\xB0","\\degree",!0),s(O,g,"\xB0","\\degree"),s(O,g,"\xB0","\\textdegree",!0),s(i,g,"\xA3","\\pounds"),s(i,g,"\xA3","\\mathsterling",!0),s(O,g,"\xA3","\\pounds"),s(O,g,"\xA3","\\textsterling",!0),s(i,g,"\u2720","\\maltese"),s(O,g,"\u2720","\\maltese"),s(i,g,"\u20AC","\\euro",!0),s(O,g,"\u20AC","\\euro",!0),s(O,g,"\u20AC","\\texteuro"),s(i,g,"\xA9","\\copyright",!0),s(O,g,"\xA9","\\textcopyright"),s(i,g,"\u2300","\\diameter",!0),s(O,g,"\u2300","\\diameter"),s(i,g,"\u{1D6E4}","\\varGamma"),s(i,g,"\u{1D6E5}","\\varDelta"),s(i,g,"\u{1D6E9}","\\varTheta"),s(i,g,"\u{1D6EC}","\\varLambda"),s(i,g,"\u{1D6EF}","\\varXi"),s(i,g,"\u{1D6F1}","\\varPi"),s(i,g,"\u{1D6F4}","\\varSigma"),s(i,g,"\u{1D6F6}","\\varUpsilon"),s(i,g,"\u{1D6F7}","\\varPhi"),s(i,g,"\u{1D6F9}","\\varPsi"),s(i,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 z='0123456789/@."';for(let e=0;e<14;e++){let n=z.charAt(e);s(i,g,n,n)}let Ce='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){let n=Ce.charAt(e);s(O,g,n,n)}let ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){let n=ye.charAt(e);s(i,W,n,n),s(O,g,n,n)}let Pe="\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 n=Pe.charAt(e);s(i,W,n,n),s(O,g,n,n)}let X="";for(let e=0;e<52;e++){X=String.fromCharCode(55349,56320+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56372+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56424+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56580+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56736+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56788+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56840+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56944+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,56632+e),s(i,W,X,X),s(O,g,X,X);let n=ye.charAt(e);X=String.fromCharCode(55349,56476+e),s(i,W,n,X),s(O,g,n,X)}for(let e=0;e<10;e++)X=String.fromCharCode(55349,57294+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,57314+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,57324+e),s(i,W,X,X),s(O,g,X,X),X=String.fromCharCode(55349,57334+e),s(i,W,X,X),s(O,g,X,X);let Xe=function(e,n,r){return!Y[n][e]||!Y[n][e].replace||e.charCodeAt(0)===55349||Object.prototype.hasOwnProperty.call(J,e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt")||(e=Y[n][e].replace),new je(e)},mt=(e,n)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){let r=new _("mtext",[new je(n.children[0].text)]);e.children.push(r)}else e.children[e.children.length-1].children[0].text+=n.children[0].text},ft=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;let n=new _("mrow");for(let r=0;r<e.children.length;r++){let l=e.children[r];if(l.type==="mtext"&&Object.keys(l.attributes).length===0)mt(n,l);else if(l.type==="mrow"){let u=!0;for(let h=0;h<l.children.length;h++)if(l.children[h].type!=="mtext"||Object.keys(l.attributes).length!==0){u=!1;break}if(u)for(let h=0;h<l.children.length;h++){let y=l.children[h];mt(n,y)}else n.children.push(l)}else n.children.push(l)}for(let r=0;r<n.children.length;r++)if(n.children[r].type==="mtext"){let l=n.children[r];l.children[0].text.charAt(0)===" "&&(l.children[0].text="\xA0"+l.children[0].text.slice(1));let u=l.children[0].text.length;u>0&&l.children[0].text.charAt(u-1)===" "&&(l.children[0].text=l.children[0].text.slice(0,-1)+"\xA0");for(let[h,y]of Object.entries(e.attributes))l.attributes[h]=y}return n.children.length===1&&n.children[0].type==="mtext"?n.children[0]:n},ke=function(e,n=!1){if(!(e.length!==1||e[0]instanceof Oe))return e[0];if(!n){e[0]instanceof _&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");let r=e.length-1;e[r]instanceof _&&e[r].type==="mo"&&!e[r].attributes.fence&&(e[r].attributes.lspace="0em",e[r].attributes.rspace="0em")}return new _("mrow",e)};function ue(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){let n=e.children[0];return n instanceof je&&n.text==="."}if(e.type==="mtext"&&e.children.length===1){let n=e.children[0];return n instanceof je&&n.text==="\u2008"}if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){let n=e.children[0];return n instanceof je&&n.text===","}return!1}let ie=(e,n)=>{let r=e[n],l=e[n+1];return r.type==="atom"&&r.text===","&&r.loc&&l.loc&&r.loc.end===l.loc.start},Ke=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",rt=function(e,n,r=!1){if(!r&&e.length===1){let y=tt(e[0],n);return y instanceof _&&y.type==="mo"&&(y.setAttribute("lspace","0em"),y.setAttribute("rspace","0em")),[y]}let l=[],u=[],h;for(let y=0;y<e.length;y++)u.push(tt(e[y],n));for(let y=0;y<u.length;y++){let E=u[y];if(y<e.length-1&&Ke(e[y])&&Ke(e[y+1])&&E.setAttribute("rspace","0em"),y>0&&Ke(e[y])&&Ke(e[y-1])&&E.setAttribute("lspace","0em"),E.type==="mn"&&h&&h.type==="mn")h.children.push(...E.children);else if(ue(E)&&h&&h.type==="mn")h.children.push(...E.children);else if(h&&h.type==="mn"&&y<u.length-1&&u[y+1].type==="mn"&&ie(e,y))h.children.push(...E.children);else{if(E.type==="mn"&&ue(h))E.children=[...h.children,...E.children],l.pop();else if((E.type==="msup"||E.type==="msub")&&E.children.length>=1&&h&&(h.type==="mn"||ue(h))){let U=E.children[0];U instanceof _&&U.type==="mn"&&h&&(U.children=[...h.children,...U.children],l.pop())}l.push(E),h=E}}return l},Je=function(e,n,r=!1){return ke(rt(e,n,r),r)},tt=function(e,n){if(!e)return new _("mrow");if(A[e.type])return A[e.type](e,n);throw new t("Got group of unknown type: '"+e.type+"'")},Rt=e=>new _("mtd",[],[],{padding:"0",width:"50%"}),jt=["mrow","mtd","mtable","mtr"],en=e=>{for(let n of e.children)if(n.type&&jt.includes(n.type)){if(n.classes&&n.classes[0]==="tml-label")return n.label;{let r=en(n);if(r)return r}}else if(!n.type){let r=en(n);if(r)return r}};function Pt(e,n,r,l){let u=null;e.length===1&&e[0].type==="tag"&&(u=e[0].tag,e=e[0].body);let h=rt(e,r);if(h.length===1&&h[0]instanceof _e)return h[0];let y=l.displayMode||l.annotate?"none":l.wrap,E=h.length===0?null:h[0],U=h.length===1&&u===null&&E instanceof _?h[0]:function(be,Te,de){let kt=[],ct=[],Et=[],Ut=0,dt=0;for(;dt<be.length;){for(;be[dt]instanceof Oe;)be.splice(dt,1,...be[dt].children);let ht=be[dt];if(ht.attributes&&ht.attributes.linebreak&&ht.attributes.linebreak==="newline"){Et.length>0&&ct.push(new _("mrow",Et)),ct.push(ht),Et=[];let An=new _("mtd",ct);An.style.textAlign="left",kt.push(new _("mtr",[An])),ct=[],dt+=1;continue}if(Et.push(ht),ht.type&&ht.type==="mo"&&ht.children.length===1&&(!ht.attributes.form||ht.attributes.form!=="prefix")&&!Object.prototype.hasOwnProperty.call(ht.attributes,"movablelimits")){let An=ht.children[0].text;if(Te==="="&&An==="="){if(Ut+=1,Ut>1){Et.pop();let dn=new _("mrow",Et);ct.push(dn),Et=[ht]}}else if(Te==="tex"){let dn=dt<be.length-1?be[dt+1]:null,_r=!0;if(!dn||dn.type!=="mtext"||!dn.attributes.linebreak||dn.attributes.linebreak!=="nobreak")for(let Zn=dt+1;Zn<be.length;Zn++){let or=be[Zn];if(!or.type||or.type!=="mspace"||or.attributes.linebreak&&or.attributes.linebreak==="newline")break;Et.push(or),dt+=1,or.attributes&&or.attributes.linebreak&&or.attributes.linebreak==="nobreak"&&(_r=!1)}if(_r){let Zn=new _("mrow",Et);ct.push(Zn),Et=[]}}}dt+=1}if(Et.length>0){let ht=new _("mrow",Et);ct.push(ht)}if(kt.length>0){let ht=new _("mtd",ct);ht.style.textAlign="left";let An=new _("mtr",[ht]);kt.push(An);let dn=new _("mtable",kt);return de||(dn.setAttribute("columnalign","left"),dn.setAttribute("rowspacing","0em")),dn}return bt(ct)}(h,y,l.displayMode);if(u&&(U=((be,Te,de,kt)=>{Te=Je(Te[0].body,de),(Te=ft(Te)).classes.push("tml-tag");let ct=en(be);be=new _("mtd",[be]);let Et=[Rt(),be,Rt()];Et[kt?0:2].children.push(Te);let Ut=new _("mtr",Et,["tml-tageqn"]);ct&&Ut.setAttribute("id",ct);let dt=new _("mtable",[Ut]);return dt.style.width="100%",dt.setAttribute("displaystyle","true"),dt})(U,u,r,l.leqno)),l.annotate){let be=new _("annotation",[new je(n)]);be.setAttribute("encoding","application/x-tex"),U=new _("semantics",[U,be])}let V=new _("math",[U]);return l.xml&&V.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),l.displayMode&&(V.setAttribute("display","block"),V.style.display="block math",V.classes=["tml-display"]),V}let sn=(e,n)=>{let r=e.isStretchy?he(e):new _("mo",[Xe(e.label,e.mode)]);e.isStretchy||r.setAttribute("stretchy","false"),e.label!=="\\vec"&&(r.style.mathDepth="0");let l=e.label==="\\c"?"munder":"mover",u=At.has(e.label);if(l==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let h=e.base.text,y=e.label==="\\vec",E=y==="\\vec"?"-vec":"";y&&r.classes.push("tml-vec");let U=y?"-vec":u?"-acc":"";"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(h)>-1?(r.classes.push(`chr-sml${E}`),r.classes.push(`wbk-sml${U}`)):"BCEGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1".indexOf(h)>-1?(r.classes.push(`chr-med${E}`),r.classes.push(`wbk-med${U}`)):"AFJdf\u0394\u039B".indexOf(h)>-1?(r.classes.push(`chr-lrg${E}`),r.classes.push(`wbk-lrg${U}`)):y?r.classes.push("wbk-vec"):u&&r.classes.push("wbk-acc")}else u&&r.classes.push("wbk-acc");return new _(l,[tt(e.base,n),r])},Gt=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),At=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),on={"\\`":"\u0300","\\'":"\u0301","\\^":"\u0302","\\~":"\u0303","\\=":"\u0304","\\u":"\u0306","\\.":"\u0307",'\\"':"\u0308","\\r":"\u030A","\\H":"\u030B","\\v":"\u030C","\\c":"\u0327"};N({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,n)=>{let r=Se(n[0]),l=!Gt.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:l,base:r}},mathmlBuilder:sn}),N({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,n)=>{let r=Se(n[0]),l=e.parser.mode;return l==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),l==="text"&&r.text&&r.text.length===1&&e.funcName in on&&S.indexOf(r.text)>-1?{type:"textord",mode:"text",text:r.text+on[e.funcName]}:e.funcName==="\\c"&&l==="text"&&r.text&&r.text.length===1?{type:"textord",mode:"text",text:r.text+"\u0327"}:{type:"accent",mode:l,label:e.funcName,isStretchy:!1,base:r}},mathmlBuilder:sn}),N({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:n},r)=>{let l=r[0];return{type:"accentUnder",mode:e.mode,label:n,base:l}},mathmlBuilder:(e,n)=>{let r=he(e);return r.style["math-depth"]=0,new _("munder",[tt(e.base,n),r])}});let un={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},qt=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],pn=function(e){return typeof e!="string"&&(e=e.unit),qt.indexOf(e)>-1},te=e=>[1,.7,.5][Math.max(e-1,0)],Kt=function(e,n){let r=e.number;if(n.maxSize[0]<0&&r>0)return{number:0,unit:"em"};let l=e.unit;switch(l){case"mm":case"cm":case"in":case"px":return r*un[l]>n.maxSize[1]?{number:n.maxSize[1],unit:"pt"}:{number:r,unit:l};case"em":case"ex":return l==="ex"&&(r*=.431),r=Math.min(r/te(n.level),n.maxSize[0]),{number:k(r),unit:"em"};case"bp":return r>n.maxSize[1]&&(r=n.maxSize[1]),{number:r,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return r=Math.min(r*un[l],n.maxSize[1]),{number:k(r),unit:"pt"};case"mu":return r=Math.min(r/18,n.maxSize[0]),{number:k(r),unit:"em"};default:throw new t("Invalid unit: '"+l+"'")}},_t=e=>{let n=new _("mspace");return n.setAttribute("width",e+"em"),n},tn=(e,n=.3,r=0,l=!1)=>{if(e==null&&r===0)return _t(n);let u=e?[e]:[];if(n!==0&&u.unshift(_t(n)),r>0&&u.push(_t(r)),l){let h=new _("mpadded",u);return h.setAttribute("height","0.1px"),h}return new _("mrow",u)},Yt=(e,n)=>Number(e)/te(n),C=(e,n,r,l)=>{let u=j(e),h=e.slice(1,3)==="eq",y=e.charAt(1)==="x"?"1.75":e.slice(2,4)==="cd"?"3.0":h?"1.0":"2.0";u.setAttribute("lspace","0"),u.setAttribute("rspace",h?"0.5em":"0");let E=l.withLevel(l.level<2?2:3),U=Yt(y,E.level),V=Yt(y,3),be=tn(null,U.toFixed(4),0),Te=tn(null,V.toFixed(4),0),de=Yt(h?0:.3,E.level).toFixed(4),kt,ct,Et=n&&n.body&&(n.body.body||n.body.length>0);if(Et){let ht=tt(n,E);ht=tn(ht,de,de,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),kt=new _("mover",[ht,Te])}let Ut=r&&r.body&&(r.body.body||r.body.length>0);if(Ut){let ht=tt(r,E);ht=tn(ht,de,de),ct=new _("munder",[ht,Te])}let dt;return dt=Et||Ut?Et&&Ut?new _("munderover",[u,ct,kt]):Et?new _("mover",[u,kt]):new _("munder",[u,ct]):new _("mover",[u,be]),y==="3.0"&&(dt.style.height="1em"),dt.setAttribute("accent","false"),dt};N({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:n},r,l)=>({type:"xArrow",mode:e.mode,name:n,body:r[0],below:l[0]}),mathmlBuilder(e,n){let r=[C(e.name,e.body,e.below,n)];return r.unshift(_t(.2778)),r.push(_t(.2778)),new _("mrow",r)}});let ne={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};N({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:n},r,l){let u=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null,h=l[0]?{type:"hphantom",mode:e.mode,body:l[0]}:null;return{type:"stackedArrow",mode:e.mode,name:n,body:r[0],upperArrowBelow:h,lowerArrowBody:u,below:l[0]}},mathmlBuilder(e,n){let r=ne[e.name][0],l=ne[e.name][1],u=C(r,e.body,e.upperArrowBelow,n),h=C(l,e.lowerArrowBody,e.below,n),y,E=new _("mpadded",[u]);if(E.setAttribute("voffset","0.3em"),E.setAttribute("height","+0.3em"),E.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){let U=new _("mpadded",[h]);U.setAttribute("width","0.5em"),y=new _("mpadded",[_t(.2778),U,E,_t(.2778)])}else E.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),y=new _("mpadded",[_t(.2778),E,h,_t(.2778)]);return y.setAttribute("voffset","-0.18em"),y.setAttribute("height","-0.18em"),y.setAttribute("depth","+0.18em"),y}});let Ee={};function we({type:e,names:n,props:r,handler:l,mathmlBuilder:u}){let h={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:l};for(let y=0;y<n.length;++y)Ee[n[y]]=h;u&&(A[e]=u)}function Ne(e,n){if(!e||e.type!==n)throw new Error(`Expected node of type ${n}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function Ge(e){let n=M(e);if(!n)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return n}function M(e){return e&&(e.type==="atom"||e.type==="delimiter"||Object.prototype.hasOwnProperty.call(Re,e.type))?e:null}let H={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},K=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),se=e=>e.type==="textord"&&e.text==="@",qe=(e,n)=>(e.type==="mathord"||e.type==="atom")&&e.text===n;function Qe(e,n,r){let l=H[e];switch(l){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(l,[n[0]],[n[1]]);case"\\uparrow":case"\\downarrow":{let u={type:"atom",text:l,mode:"math",family:"rel"},h={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[n[0]],[]),r.callFunction("\\Big",[u],[]),r.callFunction("\\\\cdright",[n[1]],[])],semisimple:!0};return r.callFunction("\\\\cdparent",[h],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{let u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}N({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:n},r)=>({type:"cdlabel",mode:e.mode,side:n.slice(4),label:r[0]}),mathmlBuilder(e,n){if(e.label.body.length===0)return new _("mrow",n);let r=tt(e.label,n);e.side==="left"&&r.classes.push("tml-shift-left");let l=new _("mtd",[r]);l.style.padding="0";let u=new _("mtr",[l]),h=new _("mtable",[u]),y=new _("mpadded",[h]);return y.setAttribute("width","0.1px"),y.setAttribute("displaystyle","false"),y.setAttribute("scriptlevel","1"),y}}),N({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},n)=>({type:"cdlabelparent",mode:e.mode,fragment:n[0]}),mathmlBuilder:(e,n)=>new _("mrow",[tt(e.fragment,n)])});let Fe=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),ge=(e,n)=>({type:n,mode:"math",body:Fe(e)});class Be{constructor(n,r,l){this.lexer=n,this.start=r,this.end=l}static range(n,r){return r?n&&n.loc&&r.loc&&n.loc.lexer===r.loc.lexer?new Be(n.loc.lexer,n.loc.start,r.loc.end):null:n&&n.loc}}class st{constructor(n,r){this.text=n,this.loc=r}range(n,r){return new st(r,Be.range(this,n))}}let wt=0,Mt=1,pt=2,nt=3,vt={};function L(e,n){vt[e]=n}let Bt=vt;L("\\noexpand",function(e){let n=e.popToken();return e.isExpandable(n.text)&&(n.noexpand=!0,n.treatAsRelax=!0),{tokens:[n],numArgs:0}}),L("\\expandafter",function(e){let n=e.popToken();return e.expandOnce(!0),{tokens:[n],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 n=e.consumeArgs(3);e.consumeSpaces();let r=e.future();return n[0].length===1&&n[0][0].text===r.text?{tokens:n[1],numArgs:0}:{tokens:n[2],numArgs:0}}),L("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),L("\\TextOrMath",function(e){let n=e.consumeArgs(2);return e.mode==="text"?{tokens:n[0],numArgs:0}:{tokens:n[1],numArgs:0}});let ln=e=>{let n="";for(let r=e.length-1;r>-1;r--)n+=e[r].text;return n},cn={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},Jn=e=>{let n=e.future().text;return n==="EOF"?[null,""]:[cn[n.charAt(0)],n]},dr=(e,n,r)=>{for(let l=1;l<n.length;l++)e*=r,e+=cn[n.charAt(l)];return e};function Wt(e){let n=e.consumeArgs(1)[0],r="",l=n[n.length-1].loc.start;for(let u=n.length-1;u>=0;u--){let h=n[u].loc.start;h>l&&(r+=" ",l=h),r+=n[u].text,l+=n[u].text.length}return r}L("\\char",function(e){let n,r=e.popToken(),l="";if(r.text==="'")n=8,r=e.popToken();else if(r.text==='"')n=16,r=e.popToken();else if(r.text==="`")if(r=e.popToken(),r.text[0]==="\\")l=r.text.charCodeAt(1);else{if(r.text==="EOF")throw new t("\\char` missing argument");l=r.text.charCodeAt(0)}else n=10;if(n){let u,h=r.text;if(l=cn[h.charAt(0)],l==null||l>=n)throw new t(`Invalid base-${n} digit ${r.text}`);for(l=dr(l,h,n),[u,h]=Jn(e);u!=null&&u<n;)l*=n,l+=u,l=dr(l,h,n),e.popToken(),[u,h]=Jn(e)}return`\\@char{${l}}`}),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 yn={",":"\\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 n="\\dotso",r=e.expandAfterFuture().text;return r in yn?n=yn[r]:(r.slice(0,4)==="\\not"||r in Y.math&&["bin","rel"].includes(Y.math[r].group))&&(n="\\dotsb"),n});let Zt={")":!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 Zt?"\\ldots\\,":"\\ldots"}),L("\\dotsc",function(e){let n=e.future().text;return n in Zt&&n!==","?"\\ldots\\,":"\\ldots"}),L("\\cdots",function(e){return e.future().text in Zt?"\\@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 t("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 xt=(e,n)=>{let r=`}\\,\\middle${n[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,n.index)+r+e.slice(n.index+n[0].length)};L("\\Braket",function(e){let n=Wt(e),r=/\|\||\||\\\|/g,l;for(;(l=r.exec(n))!==null;)n=xt(n,l);return"\\left\\langle{"+n+"}\\right\\rangle"}),L("\\Set",function(e){let n=Wt(e),r=/\|\||\||\\\|/.exec(n);return r&&(n=xt(n,r)),"\\left\\{\\:{"+n+"}\\:\\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 _n=e=>{let n=e[0][0].text,r=ln(e[1]).split(","),l=String(r.length),u=l==="1"?"\\partial":`\\partial^${l}`,h="";return r.map(y=>{h+="\\partial "+y.trim()+"\\,"}),[n,u,h.replace(/\\,$/,"")]};function Tn(e){let n=[];e.consumeSpaces();let r=e.fetch().text;for(r==="\\relax"&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);r==="\\hline"||r==="\\hdashline";)e.consume(),n.push(r==="\\hdashline"),e.consumeSpaces(),r=e.fetch().text;return n}L("\\pdv@numerator",function(e){let[n,r,l]=_n(e.consumeArgs(2));return`\\frac{${r} ${n}}{${l}}`}),L("\\pdv@next",function(e){let[n,r,l]=_n(e.consumeArgs(2));return`\\frac{${r}}{${l}} ${n}`}),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
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 $n=e=>{if(!e.parser.settings.displayMode)throw new t(`{${e.envName}} can be used only in display mode.`)},Cn=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,xn=e=>{let n=e.get("\\arraystretch");typeof n!="string"&&(n=sn(n.tokens)),n=isNaN(n)?null:Number(n);let r=e.get("\\arraycolsep");typeof r!="string"&&(r=sn(r.tokens));let l=Cn.exec(r);return[n,l?{number:+(l[1]+l[2]),unit:l[3]}:null]},wr=e=>{let n="";for(let r=0;r<e.length;r++)if(e[r].type==="label"){if(n)throw new t("Multiple \\labels in one row");n=e[r].string}return n};function An(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function cn(e,{cols:n,envClasses:r,autoTag:l,singleRow:u,emptySingleRow:h,maxNumCols:y,leqno:x,arraystretch:q,arraycolsep:Z},ve){let Te=r&&r.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let le=[],xt=[le],lt=[],kt=[],zt=[],ct=l!=null?[]:void 0;function ft(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function En(){ct&&(e.gullet.macros.get("\\df@tag")?(ct.push(e.subparse([new ot("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):ct.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(ft(),zt.push(yn(e));;){let ln=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),ln={type:"ordgroup",mode:e.mode,body:ln,semisimple:!0},le.push(ln);let Ar=e.fetch().text;if(Ar==="&"){if(y&&le.length===y){if(!r.includes("array"))throw new t(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 t("Too few columns specified in the {array} column argument.",e.nextToken)}e.consume()}else{if(Ar===Te){En(),le.length===1&&ln.body.length===0&&(xt.length>1||!h)&&xt.pop(),kt.push(wr(ln.body)),zt.length<xt.length+1&&zt.push([]);break}if(Ar!=="\\\\")throw new t("Expected & or \\\\ or \\cr or "+Te,e.nextToken);{let Hn;e.consume(),e.gullet.future().text!==" "&&(Hn=e.parseSizeGroup(!0)),lt.push(Hn?Hn.value:null),En(),kt.push(wr(ln.body)),zt.push(yn(e)),le=[],xt.push(le),ft()}}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:xt,cols:n,rowGaps:lt,hLinesBeforeRow:zt,envClasses:r,autoTag:l,scriptLevel:ve,tags:ct,labels:kt,leqno:x,arraystretch:q,arraycolsep:Z}}function _n(e){return e.slice(0,1)==="d"?"display":"text"}let Nn={c:"center ",l:"left ",r:"right "},dn=e=>{let n=new T("mtd",[]);return n.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(n.style.width="7.5%"),n},Xt=function(e,n){let r=[],l=e.body.length,u=e.hLinesBeforeRow,h=e.tags&&e.tags.some(Z=>Z);for(let Z=0;Z<l;Z++){let ve=e.body[Z],Te=[],le=e.scriptLevel==="text"?Tt:e.scriptLevel==="script"?yt:Et;for(let ct=0;ct<ve.length;ct++){let ft=new T("mtd",[He(ve[ct],n.withLevel(le))]);if(e.envClasses.includes("multline")){let En=Z===0?"left":Z===l-1?"right":"center";En!=="center"&&ft.classes.push("tml-"+En)}Te.push(ft)}let xt=e.body[0].length;for(let ct=0;ct<xt-ve.length;ct++)Te.push(new T("mtd",[],[],n));if(h){let ct=e.tags[Z],ft;ct===!0?ft=new T("mtext",[new je(["tml-eqn"])]):ct===!1?ft=new T("mtext",[],[]):(ft=tt(ct[0].body,n.withLevel(le),!0),ft=ut(ft),ft.classes=["tml-tag"]),ft&&(Te.unshift(dn(e)),Te.push(dn(e)),e.leqno?Te[0].children.push(ft):Te[Te.length-1].children.push(ft))}let lt=new T("mtr",Te,[]),kt=e.labels.shift();kt&&e.tags&&e.tags[Z]&&(lt.setAttribute("id",kt),Array.isArray(e.tags[Z])&<.classes.push("tml-tageqn")),Z===0&&u[0].length>0&&(u[0].length===2?lt.children.forEach(ct=>{ct.style.borderTop="0.15em double"}):lt.children.forEach(ct=>{ct.style.borderTop=u[0][0]?"0.06em dashed":"0.06em solid"})),u[Z+1].length>0&&(u[Z+1].length===2?lt.children.forEach(ct=>{ct.style.borderBottom="0.15em double"}):lt.children.forEach(ct=>{ct.style.borderBottom=u[Z+1][0]?"0.06em dashed":"0.06em solid"}));let zt=!0;for(let ct=0;ct<lt.children.length;ct++){let ft=lt.children[ct].children[0];if(!ft||ft.type!=="mpadded"||ft.attributes.height!=="0px"){zt=!1;break}}if(zt){lt.classes.push("ff-squash");for(let ct=0;ct<lt.children.length;ct++)lt.children[ct].style.paddingTop="0",lt.children[ct].style.paddingBottom="0"}r.push(lt)}if(e.arraystretch&&e.arraystretch!==1){let Z=String(1.4*e.arraystretch-.8)+"ex";for(let ve=0;ve<r.length;ve++)for(let Te=0;Te<r[ve].children.length;Te++)r[ve].children[Te].style.paddingTop=Z,r[ve].children[Te].style.paddingBottom=Z}let y,x;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",x="em"),e.arraycolsep){let Z=Dt(e.arraycolsep,n);y=Z.number.toFixed(4),x=Z.unit}if(y){let Z=r.length===0?0:r[0].children.length,ve=(Te,le)=>Te===0&&le===0||Te===Z-1&&le===1?"0":e.envClasses[0]!=="align"?y:le===1?"0":h?Te%2?"1":"0":Te%2?"0":"1";for(let Te=0;Te<r.length;Te++)for(let le=0;le<r[Te].children.length;le++)r[Te].children[le].style.paddingLeft=`${ve(le,0)}${x}`,r[Te].children[le].style.paddingRight=`${ve(le,1)}${x}`}if(e.envClasses.length===0)for(let Z=0;Z<r.length;Z++)r[Z].children[0].style.paddingLeft="0em",r[Z].children.length===r[0].children.length&&(r[Z].children[r[Z].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){let Z=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let ve=0;ve<r.length;ve++){let Te=r[ve];if(Z){for(let le=0;le<Te.children.length;le++)Te.children[le].classes=["tml-"+(le%2?"left":"right")];if(h){let le=e.leqno?0:Te.children.length-1;Te.children[le].classes=[]}}if(Te.children.length>1&&e.envClasses.includes("cases")&&(Te.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let le of Te.children)le.classes.push("tml-left")}}let q=new T("mtable",r);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?q.classes.push("tml-jot"):e.envClasses.includes("small")&&q.classes.push("tml-small")),e.scriptLevel==="display"&&q.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(q.style.width="100%"),e.cols&&e.cols.length>0){let Z=e.cols,ve=!1,Te=0,le=Z.length;for(;Z[Te].type==="separator";)Te+=1;for(;Z[le-1].type==="separator";)le-=1;if(Z[0].type==="separator"){let lt=Z[1].type==="separator"?"0.15em double":Z[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(let kt of q.children)kt.children[0].style.borderLeft=lt}let xt=h?0:-1;for(let lt=Te;lt<le;lt++)if(Z[lt].type==="align"){let kt=Nn[Z[lt].align];xt+=1;for(let zt of q.children)kt.trim()!=="center"&&xt<zt.children.length&&(zt.children[xt].classes=["tml-"+kt.trim()]);ve=!0}else if(Z[lt].type==="separator"){if(ve){let kt=Z[lt+1].type==="separator"?"0.15em double":Z[lt].separator==="|"?"0.06em solid":"0.06em dashed";for(let zt of q.children)xt<zt.children.length&&(zt.children[xt].style.borderRight=kt)}ve=!1}if(Z[Z.length-1].type==="separator"){let lt=Z[Z.length-2].type==="separator"?"0.15em double":Z[Z.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(let kt of q.children)kt.children[kt.children.length-1].style.borderRight=lt,kt.children[kt.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(q=new T("mstyle",[q]),q.setAttribute("scriptlevel","1")),q},wn=function(e,n){e.envName.indexOf("ed")===-1&&$n(e);let r=e.envName==="split",l=[],u=cn(e.parser,{cols:l,emptySingleRow:!0,autoTag:r?void 0:An(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display"),h,y=0,x=e.envName.indexOf("at")>-1;if(n[0]&&x){let q="";for(let Z=0;Z<n[0].body.length;Z++)q+=Le(n[0].body[Z],"textord").text;if(isNaN(q))throw new t("The alignat enviroment requires a numeric first argument.");h=Number(q),y=2*h}u.body.forEach(function(q){if(x){let Z=q.length/2;if(h<Z)throw new t(`Too many math in a row: expected ${h}, but got ${Z}`,q[0])}else y<q.length&&(y=q.length)});for(let q=0;q<y;++q){let Z="r";q%2==1&&(Z="l"),l[q]={type:"align",align:Z}}return e.envName==="split"||(x?u.envClasses.push("alignat"):u.envClasses[0]="align"),u};Me({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,n){let r=(M(n[0])?[n[0]]:Le(n[0],"ordgroup").body).map(function(y){let x=qe(y).text;if("lcr".indexOf(x)!==-1)return{type:"align",align:x};if(x==="|")return{type:"separator",separator:"|"};if(x===":")return{type:"separator",separator:":"};throw new t("Unknown column alignment: "+x,y)}),[l,u]=xn(e.parser.gullet.macros),h={cols:r,envClasses:["array"],maxNumCols:r.length,arraystretch:l,arraycolsep:u};return cn(e.parser,h,_n(e.envName))},mathmlBuilder:Xt}),Me({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){let n={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",l={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){let x=e.parser;if(x.consumeSpaces(),x.fetch().text==="["){if(x.consume(),x.consumeSpaces(),r=x.fetch().text,"lcr".indexOf(r)===-1)throw new t("Expected l or c or r",x.nextToken);x.consume(),x.consumeSpaces(),x.expect("]"),x.consume(),l.cols=[]}}let u=cn(e.parser,l,"text");u.cols=u.body.length>0?new Array(u.body[0].length).fill({type:"align",align:r}):[];let[h,y]=xn(e.parser.gullet.macros);return u.arraystretch=h,!y||y===6&&y==="pt"||(u.arraycolsep=y),n?{type:"leftright",mode:e.mode,body:[u],left:n[0],right:n[1],rightColor:void 0}:u},mathmlBuilder:Xt}),Me({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){let n=cn(e.parser,{cols:[],envClasses:["bordermatrix"]},"text");return n.cols=n.body.length>0?new Array(n.body[0].length).fill({type:"align",align:"c"}):[],n.envClasses=[],n.arraystretch=1,e.envName==="matrix"?n:((r,l)=>{let u=r.body;u[0].shift();let h=new Array(u.length-1).fill().map(()=>[]);for(let ve=1;ve<u.length;ve++){h[ve-1].push(u[ve].shift());let Te=[];for(let le=0;le<u[ve].length;le++)Te.push(u[ve][le]);h[ve-1].push(xe(Te,"vphantom"))}let y=new Array(u.length).fill().map(()=>[]);for(let ve=0;ve<u[0].length;ve++)y[0].push(u[0][ve]);for(let ve=1;ve<u.length;ve++)for(let Te=0;Te<u[0].length;Te++)y[ve].push(xe(u[ve][Te].body,"hphantom"));for(let ve=0;ve<u[0].length;ve++)u[0][ve]=xe(u[0][ve].body,"hphantom");let x={type:"array",mode:"math",body:h,cols:[{type:"align",align:"c"}],rowGaps:new Array(h.length-1).fill(null),hLinesBeforeRow:new Array(h.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(h.length).fill(""),arraycolsep:{number:.04,unit:"em"}},q={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:[r],left:l?l[0]:"(",right:l?l[1]:")",rightColor:void 0};return Ve([x,{type:"supsub",mode:"math",stack:!0,base:{type:"op",mode:"math",limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[Z]},sup:q,sub:null}])})(n,e.delimiters)},mathmlBuilder:Xt}),Me({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:e=>cn(e.parser,{envClasses:["small"]},"script"),mathmlBuilder:Xt}),Me({type:"array",names:["subarray"],props:{numArgs:1},handler(e,n){let r=(M(n[0])?[n[0]]:Le(n[0],"ordgroup").body).map(function(u){let h=qe(u).text;if("lc".indexOf(h)!==-1)return{type:"align",align:h};throw new t("Unknown column alignment: "+h,u)});if(r.length>1)throw new t("{subarray} can contain only one column");let l={cols:r,envClasses:["small"]};if(l=cn(e.parser,l,"script"),l.body.length>0&&l.body[0].length>1)throw new t("{subarray} can contain only one column");return l},mathmlBuilder:Xt}),Me({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){let n=cn(e.parser,{cols:[],envClasses:["cases"]},_n(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:Xt}),Me({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:wn,mathmlBuilder:Xt}),Me({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:wn,mathmlBuilder:Xt}),Me({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&$n(e);let n={cols:[],envClasses:["abut","jot"],autoTag:An(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return cn(e.parser,n,"display")},mathmlBuilder:Xt}),Me({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){$n(e);let n={autoTag:An(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return cn(e.parser,n,"display")},mathmlBuilder:Xt}),Me({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){$n(e);let n={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return cn(e.parser,n,"display")},mathmlBuilder:Xt}),Me({type:"array",names:["CD"],props:{numArgs:0},handler:e=>($n(e),function(n){let r=[];for(n.gullet.beginGroup(),n.gullet.macros.set("\\cr","\\\\\\relax"),n.gullet.beginGroup();;){r.push(n.parseExpression(!1,"\\\\")),n.gullet.endGroup(),n.gullet.beginGroup();let h=n.fetch().text;if(h!=="&"&&h!=="\\\\"){if(h==="\\end"){r[r.length-1].length===0&&r.pop();break}throw new t("Expected \\\\ or \\cr or \\end",n.nextToken)}n.consume()}let l=[],u=[l];for(let h=0;h<r.length;h++){let y=r[h],x=H();for(let q=0;q<y.length;q++)if(we(y[q])){l.push(x),q+=1;let Z=qe(y[q]).text,ve=new Array(2);if(ve[0]={type:"ordgroup",mode:"math",body:[]},ve[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(Z)>-1)){if(!("<>AV".indexOf(Z)>-1))throw new t('Expected one of "<>AV=|." after @.');for(let le=0;le<2;le++){let xt=!0;for(let lt=q+1;lt<y.length;lt++){if(Ye(y[lt],Z)){xt=!1,q=lt;break}if(we(y[lt]))throw new t("Missing a "+Z+" character to complete a CD arrow.",y[lt]);ve[le].body.push(y[lt])}if(xt)throw new t("Missing a "+Z+" character to complete a CD arrow.",y[q])}}let Te=We(Z,ve,n);l.push(Te),x=H()}else x.body.push(y[q]);h%2==0?l.push(x):l.shift(),l=[],u.push(l)}return u.pop(),n.gullet.endGroup(),n.gullet.endGroup(),{type:"array",mode:"math",body:u,tags:null,labels:new Array(u.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(u.length+1).fill([])}}(e.parser)),mathmlBuilder:Xt}),C({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,n){throw new t(`${e.funcName} valid only within array environment`)}});let fn=pe;C({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:n},r,l)=>{let u=["(",")"];if(n==="\\bordermatrix"&&l[0]&&l[0].body){let q=l[0].body;q.length===1&&q[0].type==="delimiter"&&(u=[q[0].left,q[0].right])}e.consumeSpaces(),e.consume();let h=fn.bordermatrix,y={mode:e.mode,envName:n.slice(1),delimiters:u,parser:e},x=h.handler(y);return e.expect("}",!0),x}}),C({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},n){let r=n[0],l=n[1];return{type:"cancelto",mode:e.mode,body:l,to:r,isCharacterBox:w(l)}},mathmlBuilder(e,n){let r=new T("mrow",[He(e.body,n)],["ff-narrow"]),l=new T("mphantom",[He(e.body,n)]),u=new T("mrow",[l],["tml-cancelto"]);u.style.color=n.color,e.isCharacterBox&&S.indexOf(e.body.body[0].text)>-1&&(u.style.left="0.1em",u.style.width="90%");let h=new T("mrow",[r,u],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))l.style.paddingRight="0.2em";else{l.style.padding="0.5ex 0.1em 0 0";let Te=new T("mspace",[]);Te.setAttribute("height","0.85em"),r.children.push(Te)}let y;if(e.isCharacterBox)y=new T("mspace",[]),y.setAttribute("height","1em");else{let Te=He(e.body,n),le=new T("mpadded",[Te]);le.setAttribute("width","0.1px"),y=new T("mphantom",[le])}let x=He(e.to,n);x.style.color=n.color;let q=new T("mpadded",[x]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let Te=new T("mspace",[]);Te.setAttribute("width","0.2em"),q.children.unshift(Te)}q.setAttribute("width","0.1px");let Z=new T("mover",[y,q]),ve=new T("mrow",[],["ff-nudge-left"]);return bt([ke([h,Z]),ve])}}),C({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:n},r){let l=Le(r[0],"ordgroup").body,u="";for(let y=0;y<l.length;y++)u+=Le(l[y],"textord").text;let h=parseInt(u);if(isNaN(h))throw new t(`\\@char has non-numeric argument ${u}`,n);return{type:"textord",mode:e.mode,text:String.fromCodePoint(h)}}});let ir=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,Nt=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,Mn=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,ar=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Gn=/^[a-f0-9]{6}$/i,Kn=e=>{let n=e.toString(16);return n.length===1&&(n="0"+n),n},On=JSON.parse(`{
|
|
7
|
+
{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`),L("\\standardstate","\\text{\\tiny\\char`\u29B5}");let wn=e=>{if(!e.parser.settings.displayMode)throw new t(`{${e.envName}} can be used only in display mode.`)},Ot=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Yn=e=>{let n=e.get("\\arraystretch");typeof n!="string"&&(n=ln(n.tokens)),n=isNaN(n)?null:Number(n);let r=e.get("\\arraycolsep");typeof r!="string"&&(r=ln(r.tokens));let l=Ot.exec(r);return[n,l?{number:+(l[1]+l[2]),unit:l[3]}:null]},Ln=e=>{let n="";for(let r=0;r<e.length;r++)if(e[r].type==="label"){if(n)throw new t("Multiple \\labels in one row");n=e[r].string}return n};function Xn(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function an(e,{cols:n,envClasses:r,autoTag:l,singleRow:u,emptySingleRow:h,maxNumCols:y,leqno:E,arraystretch:U,arraycolsep:V},be){let Te=r&&r.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let de=[],kt=[de],ct=[],Et=[],Ut=[],dt=l!=null?[]:void 0;function ht(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function An(){dt&&(e.gullet.macros.get("\\df@tag")?(dt.push(e.subparse([new st("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):dt.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(ht(),Ut.push(Tn(e));;){let dn=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),dn={type:"ordgroup",mode:e.mode,body:dn,semisimple:!0},de.push(dn);let _r=e.fetch().text;if(_r==="&"){if(y&&de.length===y){if(!r.includes("array"))throw new t(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 t("Too few columns specified in the {array} column argument.",e.nextToken)}e.consume()}else{if(_r===Te){An(),de.length===1&&dn.body.length===0&&(kt.length>1||!h)&&kt.pop(),Et.push(Ln(dn.body)),Ut.length<kt.length+1&&Ut.push([]);break}if(_r!=="\\\\")throw new t("Expected & or \\\\ or \\cr or "+Te,e.nextToken);{let Zn;e.consume(),e.gullet.future().text!==" "&&(Zn=e.parseSizeGroup(!0)),ct.push(Zn?Zn.value:null),An(),Et.push(Ln(dn.body)),Ut.push(Tn(e)),de=[],kt.push(de),ht()}}}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:kt,cols:n,rowGaps:ct,hLinesBeforeRow:Ut,envClasses:r,autoTag:l,scriptLevel:be,tags:dt,labels:Et,leqno:E,arraystretch:U,arraycolsep:V}}function Qn(e){return e.slice(0,1)==="d"?"display":"text"}let er={c:"center ",l:"left ",r:"right "},zn=e=>{let n=new _("mtd",[]);return n.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(n.style.width="7.5%"),n},Xt=function(e,n){let r=[],l=e.body.length,u=e.hLinesBeforeRow,h=e.tags&&e.tags.some(V=>V);for(let V=0;V<l;V++){let be=e.body[V],Te=[],de=e.scriptLevel==="text"?Mt:e.scriptLevel==="script"?pt:wt;for(let dt=0;dt<be.length;dt++){let ht=new _("mtd",[tt(be[dt],n.withLevel(de))]);if(e.envClasses.includes("multline")){let An=V===0?"left":V===l-1?"right":"center";An!=="center"&&ht.classes.push("tml-"+An)}Te.push(ht)}let kt=e.body[0].length;for(let dt=0;dt<kt-be.length;dt++)Te.push(new _("mtd",[],[],n));if(h){let dt=e.tags[V],ht;dt===!0?ht=new _("mtext",[new Ve(["tml-eqn"])]):dt===!1?ht=new _("mtext",[],[]):(ht=Je(dt[0].body,n.withLevel(de),!0),ht=ft(ht),ht.classes=["tml-tag"]),ht&&(Te.unshift(zn(e)),Te.push(zn(e)),e.leqno?Te[0].children.push(ht):Te[Te.length-1].children.push(ht))}let ct=new _("mtr",Te,[]),Et=e.labels.shift();Et&&e.tags&&e.tags[V]&&(ct.setAttribute("id",Et),Array.isArray(e.tags[V])&&ct.classes.push("tml-tageqn")),V===0&&u[0].length>0&&(u[0].length===2?ct.children.forEach(dt=>{dt.style.borderTop="0.15em double"}):ct.children.forEach(dt=>{dt.style.borderTop=u[0][0]?"0.06em dashed":"0.06em solid"})),u[V+1].length>0&&(u[V+1].length===2?ct.children.forEach(dt=>{dt.style.borderBottom="0.15em double"}):ct.children.forEach(dt=>{dt.style.borderBottom=u[V+1][0]?"0.06em dashed":"0.06em solid"}));let Ut=!0;for(let dt=0;dt<ct.children.length;dt++){let ht=ct.children[dt].children[0];if(!ht||ht.type!=="mpadded"||ht.attributes.height!=="0px"){Ut=!1;break}}if(Ut){ct.classes.push("ff-squash");for(let dt=0;dt<ct.children.length;dt++)ct.children[dt].style.paddingTop="0",ct.children[dt].style.paddingBottom="0"}r.push(ct)}if(e.arraystretch&&e.arraystretch!==1){let V=String(1.4*e.arraystretch-.8)+"ex";for(let be=0;be<r.length;be++)for(let Te=0;Te<r[be].children.length;Te++)r[be].children[Te].style.paddingTop=V,r[be].children[Te].style.paddingBottom=V}let y,E;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",E="em"),e.arraycolsep){let V=Kt(e.arraycolsep,n);y=V.number.toFixed(4),E=V.unit}if(y){let V=r.length===0?0:r[0].children.length,be=(Te,de)=>Te===0&&de===0||Te===V-1&&de===1?"0":e.envClasses[0]!=="align"?y:de===1?"0":h?Te%2?"1":"0":Te%2?"0":"1";for(let Te=0;Te<r.length;Te++)for(let de=0;de<r[Te].children.length;de++)r[Te].children[de].style.paddingLeft=`${be(de,0)}${E}`,r[Te].children[de].style.paddingRight=`${be(de,1)}${E}`}if(e.envClasses.length===0)for(let V=0;V<r.length;V++)r[V].children[0].style.paddingLeft="0em",r[V].children.length===r[0].children.length&&(r[V].children[r[V].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){let V=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let be=0;be<r.length;be++){let Te=r[be];if(V){for(let de=0;de<Te.children.length;de++)Te.children[de].classes=["tml-"+(de%2?"left":"right")];if(h){let de=e.leqno?0:Te.children.length-1;Te.children[de].classes=[]}}if(Te.children.length>1&&e.envClasses.includes("cases")&&(Te.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let de of Te.children)de.classes.push("tml-left")}}let U=new _("mtable",r);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?U.classes.push("tml-jot"):e.envClasses.includes("small")&&U.classes.push("tml-small")),e.scriptLevel==="display"&&U.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(U.style.width="100%"),e.cols&&e.cols.length>0){let V=e.cols,be=!1,Te=0,de=V.length;for(;V[Te].type==="separator";)Te+=1;for(;V[de-1].type==="separator";)de-=1;if(V[0].type==="separator"){let ct=V[1].type==="separator"?"0.15em double":V[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(let Et of U.children)Et.children[0].style.borderLeft=ct}let kt=h?0:-1;for(let ct=Te;ct<de;ct++)if(V[ct].type==="align"){let Et=er[V[ct].align];kt+=1;for(let Ut of U.children)Et.trim()!=="center"&&kt<Ut.children.length&&(Ut.children[kt].classes=["tml-"+Et.trim()]);be=!0}else if(V[ct].type==="separator"){if(be){let Et=V[ct+1].type==="separator"?"0.15em double":V[ct].separator==="|"?"0.06em solid":"0.06em dashed";for(let Ut of U.children)kt<Ut.children.length&&(Ut.children[kt].style.borderRight=Et)}be=!1}if(V[V.length-1].type==="separator"){let ct=V[V.length-2].type==="separator"?"0.15em double":V[V.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(let Et of U.children)Et.children[Et.children.length-1].style.borderRight=ct,Et.children[Et.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(U=new _("mstyle",[U]),U.setAttribute("scriptlevel","1")),U},gn=function(e,n){e.envName.indexOf("ed")===-1&&wn(e);let r=e.envName==="split",l=[],u=an(e.parser,{cols:l,emptySingleRow:!0,autoTag:r?void 0:Xn(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display"),h,y=0,E=e.envName.indexOf("at")>-1;if(n[0]&&E){let U="";for(let V=0;V<n[0].body.length;V++)U+=Ne(n[0].body[V],"textord").text;if(isNaN(U))throw new t("The alignat enviroment requires a numeric first argument.");h=Number(U),y=2*h}u.body.forEach(function(U){if(E){let V=U.length/2;if(h<V)throw new t(`Too many math in a row: expected ${h}, but got ${V}`,U[0])}else y<U.length&&(y=U.length)});for(let U=0;U<y;++U){let V="r";U%2==1&&(V="l"),l[U]={type:"align",align:V}}return e.envName==="split"||(E?u.envClasses.push("alignat"):u.envClasses[0]="align"),u};we({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,n){let r=(M(n[0])?[n[0]]:Ne(n[0],"ordgroup").body).map(function(y){let E=Ge(y).text;if("lcr".indexOf(E)!==-1)return{type:"align",align:E};if(E==="|")return{type:"separator",separator:"|"};if(E===":")return{type:"separator",separator:":"};throw new t("Unknown column alignment: "+E,y)}),[l,u]=Yn(e.parser.gullet.macros),h={cols:r,envClasses:["array"],maxNumCols:r.length,arraystretch:l,arraycolsep:u};return an(e.parser,h,Qn(e.envName))},mathmlBuilder:Xt}),we({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){let n={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",l={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){let E=e.parser;if(E.consumeSpaces(),E.fetch().text==="["){if(E.consume(),E.consumeSpaces(),r=E.fetch().text,"lcr".indexOf(r)===-1)throw new t("Expected l or c or r",E.nextToken);E.consume(),E.consumeSpaces(),E.expect("]"),E.consume(),l.cols=[]}}let u=an(e.parser,l,"text");u.cols=u.body.length>0?new Array(u.body[0].length).fill({type:"align",align:r}):[];let[h,y]=Yn(e.parser.gullet.macros);return u.arraystretch=h,!y||y===6&&y==="pt"||(u.arraycolsep=y),n?{type:"leftright",mode:e.mode,body:[u],left:n[0],right:n[1],rightColor:void 0}:u},mathmlBuilder:Xt}),we({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){let n=an(e.parser,{cols:[],envClasses:["bordermatrix"]},"text");return n.cols=n.body.length>0?new Array(n.body[0].length).fill({type:"align",align:"c"}):[],n.envClasses=[],n.arraystretch=1,e.envName==="matrix"?n:((r,l)=>{let u=r.body;u[0].shift();let h=new Array(u.length-1).fill().map(()=>[]);for(let be=1;be<u.length;be++){h[be-1].push(u[be].shift());let Te=[];for(let de=0;de<u[be].length;de++)Te.push(u[be][de]);h[be-1].push(ge(Te,"vphantom"))}let y=new Array(u.length).fill().map(()=>[]);for(let be=0;be<u[0].length;be++)y[0].push(u[0][be]);for(let be=1;be<u.length;be++)for(let Te=0;Te<u[0].length;Te++)y[be].push(ge(u[be][Te].body,"hphantom"));for(let be=0;be<u[0].length;be++)u[0][be]=ge(u[0][be].body,"hphantom");let E={type:"array",mode:"math",body:h,cols:[{type:"align",align:"c"}],rowGaps:new Array(h.length-1).fill(null),hLinesBeforeRow:new Array(h.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(h.length).fill(""),arraycolsep:{number:.04,unit:"em"}},U={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}]},V={type:"leftright",mode:"math",body:[r],left:l?l[0]:"(",right:l?l[1]:")",rightColor:void 0};return Fe([E,{type:"supsub",mode:"math",stack:!0,base:{type:"op",mode:"math",limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[V]},sup:U,sub:null}])})(n,e.delimiters)},mathmlBuilder:Xt}),we({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:e=>an(e.parser,{envClasses:["small"]},"script"),mathmlBuilder:Xt}),we({type:"array",names:["subarray"],props:{numArgs:1},handler(e,n){let r=(M(n[0])?[n[0]]:Ne(n[0],"ordgroup").body).map(function(u){let h=Ge(u).text;if("lc".indexOf(h)!==-1)return{type:"align",align:h};throw new t("Unknown column alignment: "+h,u)});if(r.length>1)throw new t("{subarray} can contain only one column");let l={cols:r,envClasses:["small"]};if(l=an(e.parser,l,"script"),l.body.length>0&&l.body[0].length>1)throw new t("{subarray} can contain only one column");return l},mathmlBuilder:Xt}),we({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){let n=an(e.parser,{cols:[],envClasses:["cases"]},Qn(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:Xt}),we({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:gn,mathmlBuilder:Xt}),we({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:gn,mathmlBuilder:Xt}),we({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&wn(e);let n={cols:[],envClasses:["abut","jot"],autoTag:Xn(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return an(e.parser,n,"display")},mathmlBuilder:Xt}),we({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){wn(e);let n={autoTag:Xn(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return an(e.parser,n,"display")},mathmlBuilder:Xt}),we({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){wn(e);let n={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return an(e.parser,n,"display")},mathmlBuilder:Xt}),we({type:"array",names:["CD"],props:{numArgs:0},handler:e=>(wn(e),function(n){let r=[];for(n.gullet.beginGroup(),n.gullet.macros.set("\\cr","\\\\\\relax"),n.gullet.beginGroup();;){r.push(n.parseExpression(!1,"\\\\")),n.gullet.endGroup(),n.gullet.beginGroup();let h=n.fetch().text;if(h!=="&"&&h!=="\\\\"){if(h==="\\end"){r[r.length-1].length===0&&r.pop();break}throw new t("Expected \\\\ or \\cr or \\end",n.nextToken)}n.consume()}let l=[],u=[l];for(let h=0;h<r.length;h++){let y=r[h],E=K();for(let U=0;U<y.length;U++)if(se(y[U])){l.push(E),U+=1;let V=Ge(y[U]).text,be=new Array(2);if(be[0]={type:"ordgroup",mode:"math",body:[]},be[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(V)>-1)){if(!("<>AV".indexOf(V)>-1))throw new t('Expected one of "<>AV=|." after @.');for(let de=0;de<2;de++){let kt=!0;for(let ct=U+1;ct<y.length;ct++){if(qe(y[ct],V)){kt=!1,U=ct;break}if(se(y[ct]))throw new t("Missing a "+V+" character to complete a CD arrow.",y[ct]);be[de].body.push(y[ct])}if(kt)throw new t("Missing a "+V+" character to complete a CD arrow.",y[U])}}let Te=Qe(V,be,n);l.push(Te),E=K()}else E.body.push(y[U]);h%2==0?l.push(E):l.shift(),l=[],u.push(l)}return u.pop(),n.gullet.endGroup(),n.gullet.endGroup(),{type:"array",mode:"math",body:u,tags:null,labels:new Array(u.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(u.length+1).fill([])}}(e.parser)),mathmlBuilder:Xt}),N({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,n){throw new t(`${e.funcName} valid only within array environment`)}});let vn=Ee;N({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:n},r,l)=>{let u=["(",")"];if(n==="\\bordermatrix"&&l[0]&&l[0].body){let U=l[0].body;U.length===1&&U[0].type==="delimiter"&&(u=[U[0].left,U[0].right])}e.consumeSpaces(),e.consume();let h=vn.bordermatrix,y={mode:e.mode,envName:n.slice(1),delimiters:u,parser:e},E=h.handler(y);return e.expect("}",!0),E}}),N({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},n){let r=n[0],l=n[1];return{type:"cancelto",mode:e.mode,body:l,to:r,isCharacterBox:v(l)}},mathmlBuilder(e,n){let r=new _("mrow",[tt(e.body,n)],["ff-narrow"]),l=new _("mphantom",[tt(e.body,n)]),u=new _("mrow",[l],["tml-cancelto"]);u.style.color=n.color,e.isCharacterBox&&S.indexOf(e.body.body[0].text)>-1&&(u.style.left="0.1em",u.style.width="90%");let h=new _("mrow",[r,u],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))l.style.paddingRight="0.2em";else{l.style.padding="0.5ex 0.1em 0 0";let Te=new _("mspace",[]);Te.setAttribute("height","0.85em"),r.children.push(Te)}let y;if(e.isCharacterBox)y=new _("mspace",[]),y.setAttribute("height","1em");else{let Te=tt(e.body,n),de=new _("mpadded",[Te]);de.setAttribute("width","0.1px"),y=new _("mphantom",[de])}let E=tt(e.to,n);E.style.color=n.color;let U=new _("mpadded",[E]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let Te=new _("mspace",[]);Te.setAttribute("width","0.2em"),U.children.unshift(Te)}U.setAttribute("width","0.1px");let V=new _("mover",[y,U]),be=new _("mrow",[],["ff-nudge-left"]);return bt([ke([h,V]),be])}}),N({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:n},r){let l=Ne(r[0],"ordgroup").body,u="";for(let y=0;y<l.length;y++)u+=Ne(l[y],"textord").text;let h=parseInt(u);if(isNaN(h))throw new t(`\\@char has non-numeric argument ${u}`,n);return{type:"textord",mode:e.mode,text:String.fromCodePoint(h)}}});let Sn=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,Un=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,Hn=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,jn=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Fr=/^[a-f0-9]{6}$/i,Tt=e=>{let n=e.toString(16);return n.length===1&&(n="0"+n),n},Gn=JSON.parse(`{
|
|
8
8
|
"Apricot": "#ffb484",
|
|
9
9
|
"Aquamarine": "#08b4bc",
|
|
10
10
|
"Bittersweet": "#c84c14",
|
|
@@ -88,16 +88,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
88
88
|
"Yellow": "#fff404",
|
|
89
89
|
"YellowGreen": "#98cc6c",
|
|
90
90
|
"YellowOrange": "#ffa41c"
|
|
91
|
-
}`),k=(e,n)=>{let r="";if(e==="HTML"){if(!ir.test(n))throw new t("Invalid HTML input.");r=n}else if(e==="RGB"){if(!Mn.test(n))throw new t("Invalid RGB input.");n.split(",").map(l=>{r+=Kn(Number(l.trim()))})}else{if(!ar.test(n))throw new t("Invalid rbg input.");n.split(",").map(l=>{let u=Number(l.trim());if(u>1)throw new t("Color rgb input must be < 1.");r+=Kn(Number((255*u).toFixed(0)))})}return r.charAt(0)!=="#"&&(r="#"+r),r},z=(e,n,r)=>{let l=`\\\\color@${e}`;if(!Nt.exec(e))throw new t("Invalid color: '"+e+"'",r);return Gn.test(e)?"#"+e:(e.charAt(0)==="#"||(n.has(l)?e=n.get(l).tokens[0].text:On[e]&&(e=On[e])),e)},K=(e,n)=>{let r=ht(e.body,n.withColor(e.color));return r.length===0&&r.push(new T("mrow")),r=r.map(l=>(l.style.color=e.color,l)),bt(r)};C({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:n},r,l){let u=l[0]&&Le(l[0],"raw").string,h="";if(u){let x=Le(r[0],"raw").string;h=k(u,x)}else h=z(Le(r[0],"raw").string,e.gullet.macros,n);let y=r[1];return{type:"color",mode:e.mode,color:h,isTextColor:!0,body:de(y)}},mathmlBuilder:K}),C({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:n,token:r},l,u){let h=u[0]&&Le(u[0],"raw").string,y="";if(h){let q=Le(l[0],"raw").string;y=k(h,q)}else y=z(Le(l[0],"raw").string,e.gullet.macros,r);let x=e.parseExpression(!0,n,!0);return{type:"color",mode:e.mode,color:y,isTextColor:!1,body:x}},mathmlBuilder:K}),C({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:n,token:r},l){let u=Le(l[0],"raw").string;if(!/^[A-Za-z]+$/.test(u))throw new t("Color name must be latin letters.",r);let h=Le(l[1],"raw").string;if(!["HTML","RGB","rgb"].includes(h))throw new t("Color model must be HTML, RGB, or rgb.",r);let y=Le(l[2],"raw").string,x=k(h,y);return e.gullet.macros.set(`\\\\color@${u}`,{tokens:[{text:x}],numArgs:0}),{type:"internal",mode:e.mode}}}),C({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},n,r){let l=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,u=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:u,size:l&&Le(l,"size").value}},mathmlBuilder(e,n){let r=new T("mo");if(e.newLine&&(r.setAttribute("linebreak","newline"),e.size)){let l=Dt(e.size,n);r.setAttribute("height",l.number+l.unit)}return r}});let me={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},et=e=>{let n=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(n))throw new t("Expected a control sequence",e);return n},Ht=(e,n,r,l)=>{let u=e.gullet.macros.get(r.text);u==null&&(r.noexpand=!0,u={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(n,u,l)};C({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:n}){e.consumeSpaces();let r=e.fetch();if(me[r.text])return n!=="\\global"&&n!=="\\\\globallong"||(r.text=me[r.text]),Le(e.parseFunction(),"internal");throw new t("Invalid token after macro prefix",r)}}),C({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r=e.gullet.popToken(),l=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(l))throw new t("Expected a control sequence",r);let u,h=0,y=[[]];for(;e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){u=e.gullet.future(),y[h].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new t(`Invalid argument number "${r.text}"`);if(parseInt(r.text)!==h+1)throw new t(`Argument number "${r.text}" out of order`);h++,y.push([])}else{if(r.text==="EOF")throw new t("Expected a macro definition");y[h].push(r.text)}let{tokens:x}=e.gullet.consumeArg();if(u&&x.unshift(u),n==="\\edef"||n==="\\xdef"){if(x=e.gullet.expandTokens(x),x.length>e.gullet.settings.maxExpand)throw new t("Too many expansions in an "+n);x.reverse()}return e.gullet.macros.set(l,{tokens:x,numArgs:h,delimiters:y},n===me[n]),{type:"internal",mode:e.mode}}}),C({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r=et(e.gullet.popToken());e.gullet.consumeSpaces();let l=(u=>{let h=u.gullet.popToken();return h.text==="="&&(h=u.gullet.popToken(),h.text===" "&&(h=u.gullet.popToken())),h})(e);return Ht(e,r,l,n==="\\\\globallet"),{type:"internal",mode:e.mode}}}),C({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r=et(e.gullet.popToken()),l=e.gullet.popToken(),u=e.gullet.popToken();return Ht(e,r,u,n==="\\\\globalfuture"),e.gullet.pushToken(u),e.gullet.pushToken(l),{type:"internal",mode:e.mode}}}),C({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r="",l=e.gullet.popToken();l.text==="{"?(r=et(e.gullet.popToken()),e.gullet.popToken()):r=et(l);let u=e.gullet.isDefined(r);if(u&&n==="\\newcommand")throw new t(`\\newcommand{${r}} attempting to redefine ${r}; use \\renewcommand`);if(!u&&n==="\\renewcommand")throw new t(`\\renewcommand{${r}} when command ${r} does not yet exist; use \\newcommand`);let h=0;if(e.gullet.future().text==="["){let x=e.gullet.popToken();if(x=e.gullet.popToken(),!/^[0-9]$/.test(x.text))throw new t(`Invalid number of arguments: "${x.text}"`);if(h=parseInt(x.text),x=e.gullet.popToken(),x.text!=="]")throw new t(`Invalid argument "${x.text}"`)}let{tokens:y}=e.gullet.consumeArg();return n==="\\providecommand"&&e.gullet.macros.has(r)||e.gullet.macros.set(r,{tokens:y,numArgs:h}),{type:"internal",mode:e.mode}}});let un={"\\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}},an={"(":")","\\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"},Vt=new Set(Object.keys(an));new Set(Object.values(an));let qn=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","."]),en=new Set(["}","\\left","\\middle","\\right"]),Ln=e=>e.length>0&&(qn.has(e)||un[e]||en.has(e)),Wn=[0,1.2,1.8,2.4,3];function Vn(e,n){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);let r=M(e);if(r&&qn.has(r.text))return r.text!=="<"&&r.text!=="\\lt"||(r.text="\u27E8"),r.text!==">"&&r.text!=="\\gt"||(r.text="\u27E9"),r;throw new t(r?`Invalid delimiter '${r.text}' after '${n.funcName}'`:`Invalid delimiter type '${e.type}'`,e)}let lr=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),cr=(e,n,r,l)=>{let u=new T("mo",[nt(e==="."?"":e,n)]);return u.setAttribute("fence","true"),u.setAttribute("form",r),u.setAttribute("stretchy",l?"true":"false"),u};function dr(e){if(!e.body)throw new Error("Bug: The delim ParseNode wasn't fully parsed.")}C({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,n)=>{let r=Vn(n[0],e),l={type:"delimsizing",mode:e.parser.mode,size:un[e.funcName].size,mclass:un[e.funcName].mclass,delim:r.text},u=e.parser.fetch().text;return u!=="^"&&u!=="_"?l:{type:"ordgroup",mode:"math",body:[l,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{let n=[],r=e.delim==="."?"":e.delim;n.push(nt(r,e.mode));let l=new T("mo",n);return e.mclass==="mopen"||e.mclass==="mclose"?l.setAttribute("fence","true"):l.setAttribute("fence","false"),(lr.has(r)||r.indexOf("arrow")>-1)&&l.setAttribute("stretchy","true"),l.setAttribute("symmetric","true"),l.setAttribute("minsize",Wn[e.size]+"em"),l.setAttribute("maxsize",Wn[e.size]+"em"),l}}),C({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>({type:"leftright-right",mode:e.parser.mode,delim:Vn(n[0],e).text})}),C({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>{let r=Vn(n[0],e),l=e.parser;++l.leftrightDepth;let u=l.parseExpression(!1,"\\right",!0),h=l.fetch();for(;h.text==="\\middle";){l.consume();let x=l.fetch().text;if(!Q.math[x])throw new t(`Invalid delimiter '${x}' after '\\middle'`);Vn({type:"atom",mode:"math",text:x},{funcName:"\\middle"}),u.push({type:"middle",mode:"math",delim:x}),l.consume(),u=u.concat(l.parseExpression(!1,"\\right",!0)),h=l.fetch()}--l.leftrightDepth,l.expect("\\right",!1);let y=Le(l.parseFunction(),"leftright-right");return{type:"leftright",mode:l.mode,body:u,left:r.text,right:y.delim,isStretchy:!0}},mathmlBuilder:(e,n)=>{dr(e);let r=ht(e.body,n),l=cr(e.left,e.mode,"prefix",!0);r.unshift(l);let u=cr(e.right,e.mode,"postfix",!0);if(e.body.length>0){let h=e.body[e.body.length-1];h.type!=="color"||h.isTextColor||u.setAttribute("mathcolor",h.color)}return r.push(u),ke(r)}}),C({type:"delimiter",names:Array.from(Vt),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:n,token:r})=>{if(e.mode==="text")return{type:"textord",mode:"text",text:n,loc:r.loc};if(!e.settings.wrapDelimiterPairs)return{type:"atom",mode:"math",family:"open",loc:r.loc,text:n};let l=an[n],u=e.parseExpression(!1,l,!1);if(e.fetch().text!==l)throw new t("Unmatched delimiter");return e.consume(),{type:"delimiter",mode:e.mode,body:u,left:n,right:l}},mathmlBuilder:(e,n)=>{dr(e);let r=ht(e.body,n),l=cr(e.left,e.mode,"prefix",!1);r.unshift(l);let u=cr(e.right,e.mode,"postfix",!1);if(e.body.length>0){let h=e.body[e.body.length-1];h.type!=="color"||h.isTextColor||u.setAttribute("mathcolor",h.color)}return r.push(u),ke(r)}}),C({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>{let r=Vn(n[0],e);if(!e.parser.leftrightDepth)throw new t("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},mathmlBuilder:e=>{let n=nt(e.delim,e.mode),r=new T("mo",[n]);return r.setAttribute("stretchy","true"),r.setAttribute("form","infix"),n.text!=="/"&&(r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em")),r}});let rs=["\\boxed","\\fcolorbox","\\colorbox"],Fn=(e,n)=>{let r=rs.includes(e.label)?"mrow":"menclose",l=new T(r,[He(e.body,n)]);switch(e.label){case"\\overline":l.setAttribute("notation","top"),l.classes.push("tml-overline");break;case"\\underline":l.setAttribute("notation","bottom"),l.classes.push("tml-underline");break;case"\\cancel":l.setAttribute("notation","updiagonalstrike"),l.children.push(new T("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":l.setAttribute("notation","downdiagonalstrike"),l.children.push(new T("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":l.setAttribute("notation","horizontalstrike"),l.children.push(new T("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":l.setAttribute("notation","updiagonalstrike downdiagonalstrike"),l.children.push(new T("mrow",[],["tml-cancel","tml-xcancel"]));break;case"\\longdiv":l.setAttribute("notation","longdiv"),l.classes.push("longdiv-top"),l.children.push(new T("mrow",[],["longdiv-arc"]));break;case"\\phase":l.setAttribute("notation","phasorangle"),l.classes.push("phasor-bottom"),l.children.push(new T("mrow",[],["phasor-angle"]));break;case"\\textcircled":l.setAttribute("notation","circle"),l.classes.push("circle-pad"),l.children.push(new T("mrow",[],["textcircle"]));break;case"\\angl":l.setAttribute("notation","actuarial"),l.classes.push("actuarial");break;case"\\boxed":l.style.padding="3pt",l.style.border="1px solid",l.setAttribute("scriptlevel","0"),l.setAttribute("displaystyle","true");break;case"\\fbox":l.setAttribute("notation","box"),l.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":l.style.padding="0.3em",e.label==="\\fcolorbox"&&(l.style.border="0.0667em solid "+String(e.borderColor))}return e.backgroundColor&&l.setAttribute("mathbackground",e.backgroundColor),l};C({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:n},r,l){let u=l[0]&&Le(l[0],"raw").string,h="";if(u){let x=Le(r[0],"raw").string;h=k(u,x)}else h=z(Le(r[0],"raw").string,e.gullet.macros);let y=r[1];return{type:"enclose",mode:e.mode,label:n,backgroundColor:h,body:y}},mathmlBuilder:Fn}),C({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:n},r,l){let u=l[0]&&Le(l[0],"raw").string,h,y="";if(u){let q=Le(r[0],"raw").string,Z=Le(r[0],"raw").string;y=k(u,q),h=k(u,Z)}else y=z(Le(r[0],"raw").string,e.gullet.macros),h=z(Le(r[1],"raw").string,e.gullet.macros);let x=r[2];return{type:"enclose",mode:e.mode,label:n,backgroundColor:h,borderColor:y,body:x}},mathmlBuilder:Fn}),C({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},n)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:n[0]})}),C({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Fn}),C({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Fn}),C({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Fn}),C({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Fn}),C({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:n},r){let l=r[0];if(l.type!=="ordgroup")throw new t("Invalid environment name",l);let u="";for(let h=0;h<l.body.length;++h)u+=Le(l.body[h],"textord").text;if(n==="\\begin"){if(!Object.prototype.hasOwnProperty.call(fn,u))throw new t("No such environment: "+u,l);let h=fn[u],{args:y,optArgs:x}=e.parseArguments("\\begin{"+u+"}",h),q={mode:e.mode,envName:u,parser:e},Z=h.handler(q,y,x);e.expect("\\end",!1);let ve=e.nextToken,Te=Le(e.parseFunction(),"environment");if(Te.name!==u)throw new t(`Mismatch: \\begin{${u}} matched by \\end{${Te.name}}`,ve);return Z}return{type:"environment",mode:e.mode,name:u,nameGroup:l}}}),C({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},n)=>({type:"envTag",mode:e.mode,body:n[0]}),mathmlBuilder:(e,n)=>new T("mrow")}),C({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,n)=>new T("mrow")});let ss=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),qs=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),vr=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),ur=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),Fs=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),Zn=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),zs=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),Yn=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>ss[e]||119899,"script-bold":e=>119951,fraktur:e=>qs[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>vr[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=>ss[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=>ur[e]||-51,italic:e=>0,"bold-italic":e=>Fs[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>Zn[e]||116,"sans-serif-bold":e=>Zn[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>zs[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}}),zn=(e,n)=>{let r=e.codePointAt(0),l=64<r&&r<91?"upperCaseLatin":96<r&&r<123?"lowerCaseLatin":912<r&&r<938?"upperCaseGreek":944<r&&r<970||e==="\u03D5"?"lowerCaseGreek":120545<r&&r<120572||ur[e]?"varGreek":47<r&&r<58?"numeral":"other";return l==="other"?e:String.fromCodePoint(r+Yn[l][n](e))},os=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"}),Us=["mathrm","mathit"],qr=(e,n)=>{let r=e.font,l=n.withFont(r),u=He(e.body,l);if(u.children.length===0)return u;if(r==="boldsymbol"&&["mo","mpadded","mrow"].includes(u.type))return u.style.fontWeight="bold",u;if(((x,q)=>{if(!Us.includes(q)||!x.body||x.body.type!=="ordgroup"||x.body.body.length===1||x.body.body[0].type!=="mathord")return!1;for(let Z=1;Z<x.body.body.length;Z++){let ve=x.body.body[Z].type;if(ve!=="mathord"&&(ve!=="textord"||isNaN(x.body.body[Z].text)))return!1}return!0})(e,r)){let x=u.children[0].children[0].children?u.children[0].children[0]:u.children[0];delete x.attributes.mathvariant;for(let Z=1;Z<u.children.length;Z++)x.children[0].text+=u.children[Z].children[0].children?u.children[Z].children[0].children[0].text:u.children[Z].children[0].text;if(r==="mathit")return x.children[0].text=x.children[0].text.split("").map(Z=>zn(Z,"italic")).join(""),x;let q=new T("mpadded",[x]);return q.setAttribute("lspace","0"),q}let h=u.children[0].type==="mo";for(let x=1;x<u.children.length;x++)u.children[x].type==="mo"&&r==="boldsymbol"&&(u.children[x].style.fontWeight="bold"),u.children[x].type!=="mi"&&(h=!1),(u.children[x].attributes&&u.children[x].attributes.mathvariant||"")!=="normal"&&(h=!1);if(!h)return u;let y=u.children[0];for(let x=1;x<u.children.length;x++)y.children.push(u.children[x].children[0]);if(y.attributes.mathvariant&&y.attributes.mathvariant==="normal"){let x=new T("mtext",new Ke("\u200B"));return new T("mrow",[x,y])}return y},pr={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};C({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:n},r)=>{let l=Se(r[0]),u=n;return u in pr&&(u=pr[u]),{type:"font",mode:e.mode,font:u.slice(1),body:l}},mathmlBuilder:qr}),C({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:n,breakOnTokenText:r},l)=>{let{mode:u}=e,h=e.parseExpression(!0,r,!0);return{type:"font",mode:u,font:`math${n.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:h}}},mathmlBuilder:qr});let Fr=["display","text","script","scriptscript"],is={auto:-1,display:0,text:0,script:1,scriptscript:2},hr=(e,n)=>{n=((h,y)=>{let x=y;if(h==="display"){let q=x.level>=yt?Tt:Et;x=x.withLevel(q)}else h==="text"&&x.level===Et?x=x.withLevel(Tt):h==="auto"?x=x.incrementLevel():h==="script"?x=x.withLevel(yt):h==="scriptscript"&&(x=x.withLevel(Qe));return x})(e.scriptLevel,n);let r=He(e.numer,n),l=He(e.denom,n);n.level===3&&(r.style.mathDepth="2",r.setAttribute("scriptlevel","2"),l.style.mathDepth="2",l.setAttribute("scriptlevel","2"));let u=new T("mfrac",[r,l]);if(e.hasBarLine){if(e.barSize){let h=Dt(e.barSize,n);u.setAttribute("linethickness",h.number+h.unit)}}else u.setAttribute("linethickness","0px");if(e.leftDelim!=null||e.rightDelim!=null){let h=[];if(e.leftDelim!=null){let y=new T("mo",[new Ke(e.leftDelim.replace("\\",""))]);y.setAttribute("fence","true"),h.push(y)}if(h.push(u),e.rightDelim!=null){let y=new T("mo",[new Ke(e.rightDelim.replace("\\",""))]);y.setAttribute("fence","true"),h.push(y)}u=ke(h)}return e.scriptLevel!=="auto"&&(u=new T("mstyle",[u]),u.setAttribute("displaystyle",String(e.scriptLevel==="display")),u.setAttribute("scriptlevel",is[e.scriptLevel])),u};C({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:n},r)=>{let l=r[0],u=r[1],h=!1,y=null,x=null,q="auto";switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":h=!0;break;case"\\\\atopfrac":h=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":y="(",x=")";break;case"\\\\bracefrac":y="\\{",x="\\}";break;case"\\\\brackfrac":y="[",x="]";break;default:throw new Error("Unrecognized genfrac command")}return n==="\\cfrac"||n.startsWith("\\d")?q="display":n.startsWith("\\t")&&(q="text"),{type:"genfrac",mode:e.mode,continued:!1,numer:l,denom:u,hasBarLine:h,leftDelim:y,rightDelim:x,scriptLevel:q,barSize:null}},mathmlBuilder:hr}),C({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:n,token:r}){let l;switch(n){case"\\over":l="\\frac";break;case"\\choose":l="\\binom";break;case"\\atop":l="\\\\atopfrac";break;case"\\brace":l="\\\\bracefrac";break;case"\\brack":l="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:l,token:r}}});let zr=function(e){let n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};C({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},n){let r=n[4],l=n[5],u=Se(n[0]),h=u.type==="atom"&&u.family==="open"?zr(u.text):null,y=Se(n[1]),x=y.type==="atom"&&y.family==="close"?zr(y.text):null,q=Le(n[2],"size"),Z,ve=null;q.isBlank?Z=!0:(ve=q.value,Z=ve.number>0);let Te="auto",le=n[3];if(le.type==="ordgroup"){if(le.body.length>0){let xt=Le(le.body[0],"textord");Te=Fr[Number(xt.text)]}}else le=Le(le,"textord"),Te=Fr[Number(le.text)];return{type:"genfrac",mode:e.mode,numer:r,denom:l,continued:!1,hasBarLine:Z,barSize:ve,leftDelim:h,rightDelim:x,scriptLevel:Te}},mathmlBuilder:hr}),C({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:n,token:r},l)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:Le(l[0],"size").value,token:r})}),C({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:n},r)=>{let l=r[0],u=function(x){if(!x)throw new Error("Expected non-null, but got "+String(x));return x}(Le(r[1],"infix").barSize),h=r[2],y=u.number>0;return{type:"genfrac",mode:e.mode,numer:l,denom:h,continued:!1,hasBarLine:y,barSize:u,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:hr}),C({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},n)=>({type:"hbox",mode:e.mode,body:de(n[0])}),mathmlBuilder(e,n){let r=n.withLevel(Tt),l=tt(e.body,r);return ut(l)}}),C({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler:({parser:e,funcName:n},r)=>({type:"horizBracket",mode:e.mode,label:n,isOver:/^\\over/.test(n),base:r[0]}),mathmlBuilder:(e,n)=>{let r=J(e.label);return r.style["math-depth"]=0,new T(e.isOver?"mover":"munder",[He(e.base,n),r])}}),C({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:n,token:r},l)=>{let u=Le(l[0],"raw").string,h=l[1];if(e.settings.strict)throw new t(`Function "${n}" is disabled in strict mode`,r);let y,x={};switch(n){case"\\class":x.class=u,y={command:"\\class",class:u};break;case"\\id":x.id=u,y={command:"\\id",id:u};break;case"\\style":x.style=u,y={command:"\\style",style:u};break;case"\\data":{let q=u.split(",");for(let Z=0;Z<q.length;Z++){let ve=q[Z].split("=");if(ve.length!==2)throw new t("Error parsing key-value for \\data");x["data-"+ve[0].trim()]=ve[1].trim()}y={command:"\\data",attributes:x};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(y))throw new t(`Function "${n}" is not trusted`,r);return{type:"html",mode:e.mode,attributes:x,body:de(h)}},mathmlBuilder:(e,n)=>{let r=tt(e.body,n),l=[];e.attributes.class&&l.push(...e.attributes.class.trim().split(/\s+/)),r.classes=l;for(let u in e.attributes)u!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,u)&&r.setAttribute(u,e.attributes[u]);return r}});let xr=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{let n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new t("Invalid size: '"+e+"' in \\includegraphics");let r={number:+(n[1]+n[2]),unit:n[3]};if(!Lt(r))throw new t("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r}};C({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:n},r,l)=>{let u={number:0,unit:"em"},h={number:.9,unit:"em"},y={number:0,unit:"em"},x="";if(l[0]){let Z=Le(l[0],"raw").string.split(",");for(let ve=0;ve<Z.length;ve++){let Te=Z[ve].split("=");if(Te.length===2){let le=Te[1].trim();switch(Te[0].trim()){case"alt":x=le;break;case"width":u=xr(le);break;case"height":h=xr(le);break;case"totalheight":y=xr(le);break;default:throw new t("Invalid key: '"+Te[0]+"' in \\includegraphics.")}}}}let q=Le(r[0],"url").url;if(x===""&&(x=q,x=x.replace(/^.*[\\/]/,""),x=x.substring(0,x.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:q}))throw new t('Function "\\includegraphics" is not trusted',n);return{type:"includegraphics",mode:e.mode,alt:x,width:u,height:h,totalheight:y,src:q}},mathmlBuilder:(e,n)=>{let r=Dt(e.height,n),l={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===r.unit&&e.totalheight.number>r.number&&(l.number=e.totalheight.number-r.number,l.unit=r.unit);let u=0;e.width.number>0&&(u=Dt(e.width,n));let h={height:r.number+l.number+"em"};u.number>0&&(h.width=u.number+u.unit),l.number>0&&(h.verticalAlign=-l.number+l.unit);let y=new st(e.src,e.alt,h);return y.height=r,y.depth=l,new T("mtext",[y])}}),C({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:n,token:r},l){let u=Le(l[0],"size");if(e.settings.strict){let h=n[1]==="m",y=u.value.unit==="mu";if(h){if(!y)throw new t(`LaTeX's ${n} supports only mu units, not ${u.value.unit} units`,r);if(e.mode!=="math")throw new t(`LaTeX's ${n} works only in math mode`,r)}else if(y)throw new t(`LaTeX's ${n} doesn't support mu units`,r)}return{type:"kern",mode:e.mode,dimension:u.value}},mathmlBuilder(e,n){let r=Dt(e.dimension,n),l=r.number>0&&r.unit==="em"?mr(r.number):"";if(e.mode==="text"&&l.length>0){let u=new Ke(l);return new T("mtext",[u])}if(r.number>=0){let u=new T("mspace");return u.setAttribute("width",r.number+r.unit),u}{let u=new T("mrow");return u.style.marginLeft=r.number+r.unit,u}}});let mr=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},tn=/[^A-Za-z_0-9-]/g;C({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},n)=>({type:"label",mode:e.mode,string:n[0].string.replace(tn,"")}),mathmlBuilder(e,n){let r=new T("mrow",[],["tml-label"]);return e.string.length>0&&r.setLabel(e.string),r}});let fr=["\\clap","\\llap","\\rlap"];C({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:n,token:r},l)=>{if(fr.includes(n)){if(e.settings.strict&&e.mode!=="text")throw new t(`{${n}} can be used only in text mode.
|
|
92
|
-
Try \\math${n.slice(1)}`,r);n=n.slice(1)}else n=n.slice(5);let u=l[0];return{type:"lap",mode:e.mode,alignment:n,body:u}},mathmlBuilder:(e,n)=>{let r;if(e.alignment==="llap"){let h=ht(de(e.body),n),y=new T("mphantom",h);r=new T("mpadded",[y]),r.setAttribute("width","0.1px")}let l=He(e.body,n),u;if(e.alignment==="llap"?(l.style.position="absolute",l.style.right="0",l.style.bottom="0",u=new T("mpadded",[r,l])):u=new T("mpadded",[l]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&u.setAttribute("lspace","0.16667em");else{let h=e.alignment==="llap"?"-1":"-0.5";u.setAttribute("lspace",h+"width"),e.alignment==="llap"?u.style.position="relative":(u.style.display="flex",u.style.justifyContent="center")}return u.setAttribute("width","0.1px"),u}}),C({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:n},r){let l=n.mode;n.switchMode("math");let u=e==="\\("?"\\)":"$",h=n.parseExpression(!1,u);return n.expect(u),n.switchMode(l),{type:"ordgroup",mode:n.mode,body:h}}}),C({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,n){throw new t(`Mismatched ${e.funcName}`,n)}}),C({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},n)=>({type:"mathchoice",mode:e.mode,display:de(n[0]),text:de(n[1]),script:de(n[2]),scriptscript:de(n[3])}),mathmlBuilder:(e,n)=>{let r=((l,u)=>{switch(u.level){case Et:return l.display;case Tt:return l.text;case yt:return l.script;case Qe:return l.scriptscript;default:return l.text}})(e,n);return tt(r,n)}});let Tn=["text","textord","mathord","atom"];function Xn(e,n){let r,l=ht(e.body,n);if(e.mclass==="minner")r=new T("mpadded",l);else if(e.mclass==="mord")e.isCharacterBox||l[0].type==="mathord"?(r=l[0],r.type="mi",r.children.length===1&&r.children[0].text&&r.children[0].text==="\u2207"&&r.setAttribute("mathvariant","normal")):r=new T("mi",l);else{r=new T("mrow",l),e.mustPromote?(r=l[0],r.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&r.setAttribute("mathvariant","italic")):r=new T("mrow",l);let u=n.level<2;r.type==="mrow"?u&&(e.mclass==="mbin"?(r.children.unshift(Ct(.2222)),r.children.push(Ct(.2222))):e.mclass==="mrel"?(r.children.unshift(Ct(.2778)),r.children.push(Ct(.2778))):e.mclass==="mpunct"?r.children.push(Ct(.1667)):e.mclass==="minner"&&(r.children.unshift(Ct(.0556)),r.children.push(Ct(.0556)))):e.mclass==="mbin"?(r.attributes.lspace=u?"0.2222em":"0",r.attributes.rspace=u?"0.2222em":"0"):e.mclass==="mrel"?(r.attributes.lspace=u?"0.2778em":"0",r.attributes.rspace=u?"0.2778em":"0"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace=u?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&u&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em"),e.mclass!=="mopen"&&e.mclass!=="mclose"&&(delete r.attributes.stretchy,delete r.attributes.form)}return r}C({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:n},r){let l=r[0],u=w(l),h=!0,y={type:"mathord",text:"",mode:e.mode},x=l.body?l.body:[l];for(let q of x){if(!Tn.includes(q.type)){h=!1;break}Q[e.mode][q.text]?y.text+=Q[e.mode][q.text].replace:q.text?y.text+=q.text:q.body&&q.body.map(Z=>{y.text+=Z.text})}return h&&n==="\\mathord"&&y.type==="mathord"&&y.text.length>1?y:{type:"mclass",mode:e.mode,mclass:"m"+n.slice(5),body:de(h?y:l),isCharacterBox:u,mustPromote:h}},mathmlBuilder:Xn});let hn=e=>{let n=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;if(n.type==="atom"){let r=e.body.length>0&&e.body[0].text&&Q.math[e.body[0].text]?Q.math[e.body[0].text].group:n.family;return r==="bin"||r==="rel"?"m"+r:"mord"}return"mord"};C({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},n)=>({type:"mclass",mode:e.mode,mclass:hn(n[0]),body:de(n[1]),isCharacterBox:w(n[1])})}),C({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:n},r){let l=r[1],u=r[0],h;h=n!=="\\stackrel"?hn(l):"mrel";let y={type:h==="mrel"||h==="mbin"?"op":"ordgroup",mode:l.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:de(l)};return{type:"supsub",mode:u.mode,stack:!0,base:y,sup:n==="\\underset"?null:u,sub:n==="\\underset"?u:null}},mathmlBuilder:Xn});let Un=(e,n,r)=>{if(!e)return r;let l=He(e,n);return l.type==="mrow"&&l.children.length===0?r:l};C({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:n,token:r},l){if(l[2].body.length===0)throw new t(n+"cannot parse an empty base.");let u=l[2].body[0];if(e.settings.strict&&n==="\\sideset"&&!u.symbol)throw new t("The base of \\sideset must be a big operator. Try \\prescript.");if(l[0].body.length>0&&l[0].body[0].type!=="supsub"||l[1].body.length>0&&l[1].body[0].type!=="supsub")throw new t("\\sideset can parse only subscripts and superscripts in its first two arguments",r);let h=l[0].body.length>0?l[0].body[0]:null,y=l[1].body.length>0?l[1].body[0]:null;return h||y?h?{type:"multiscript",mode:e.mode,isSideset:n==="\\sideset",prescripts:h,postscripts:y,base:u}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:u,sup:y.sup,sub:y.sub}]}:u},mathmlBuilder(e,n){let r=He(e.base,n),l=new T("mprescripts"),u=new T("none"),h=[],y=Un(e.prescripts.sub,n,u),x=Un(e.prescripts.sup,n,u);return e.isSideset&&(y.setAttribute("style","text-align: left;"),x.setAttribute("style","text-align: left;")),e.postscripts?h=[r,Un(e.postscripts.sub,n,u),Un(e.postscripts.sup,n,u),l,y,x]:h=[r,l,y,x],new T("mmultiscripts",h)}}),C({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},n){let r=w(n[0]),l;return r?(l=de(n[0]),l[0].text.charAt(0)==="\\"&&(l[0].text=Q.math[l[0].text].replace),l[0].text=l[0].text.slice(0,1)+"\u0338"+l[0].text.slice(1)):l=[{type:"textord",mode:"math",text:"\u0338"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},n[0]],{type:"not",mode:e.mode,body:l,isCharacterBox:r}},mathmlBuilder(e,n){return e.isCharacterBox?ht(e.body,n,!0)[0]:tt(e.body,n)}});let Rn=["textord","mathord","atom"],kr=["\\smallint"],In=["textord","mathord","ordgroup","close","leftright","font"],Ur=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},kn=(e,n)=>{let r;if(e.symbol)r=new T("mo",[nt(e.name,e.mode)]),kr.includes(e.name)?r.setAttribute("largeop","false"):r.setAttribute("movablelimits","false"),e.fromMathOp&&Ur(r);else if(e.body)r=new T("mo",ht(e.body,n)),e.fromMathOp&&Ur(r);else if(r=new T("mi",[new Ke(e.name.slice(1))]),!e.parentIsSupSub){let l=[r,new T("mo",[nt("\u2061","text")])];if(e.needsLeadingSpace){let u=new T("mspace");u.setAttribute("width","0.1667em"),l.unshift(u)}if(!e.isFollowedByDelimiter){let u=new T("mspace");u.setAttribute("width","0.1667em"),l.push(u)}r=new T("mrow",l)}return r},Hr={"\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"};C({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:n},r)=>{let l=n;return l.length===1&&(l=Hr[l]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:l}},mathmlBuilder:kn}),C({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},n)=>{let r=n[0],l=r.body?r.body:[r],u=l.length===1&&Rn.includes(l[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:u,fromMathOp:!0,stack:!1,name:u?l[0].text:null,body:u?null:de(r)}},mathmlBuilder:kn});let Er={"\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"};C({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:n}){let r=e.prevAtomType,l=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Ln(l),needsLeadingSpace:r.length>0&&In.includes(r),name:n}},mathmlBuilder:kn}),C({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:n}){let r=e.prevAtomType,l=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Ln(l),needsLeadingSpace:r.length>0&&In.includes(r),name:n}},mathmlBuilder:kn}),C({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:n}){let r=n;return r.length===1&&(r=Er[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:kn}),C({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:n},r)=>{let l=r[0],u=e.prevAtomType,h=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:de(l),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:Ln(h),needsLeadingSpace:u.length>0&&In.includes(u)}},mathmlBuilder:(e,n)=>{let r,l=ht(e.body,n.withFont("mathrm")),u=!0;for(let h=0;h<l.length;h++){let y=l[h];if(y instanceof T)switch(((y.type==="mrow"||y.type==="mpadded")&&y.children.length===1&&y.children[0]instanceof T||y.type==="mrow"&&y.children.length===2&&y.children[0]instanceof T&&y.children[1]instanceof T&&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 x=y.attributes.width.replace("em",""),q=mr(Number(x));q===""?u=!1:l[h]=new T("mtext",[new Ke(q)])}break;case"mo":{let x=y.children[0];y.children.length===1&&x instanceof Ke?x.text=x.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):u=!1;break}default:u=!1}else u=!1}if(u){let h=l.map(y=>y.toText()).join("");l=[new Ke(h)]}else if(l.length===1&&["mover","munder"].includes(l[0].type)&&(l[0].children[0].type==="mi"||l[0].children[0].type==="mtext")){if(l[0].children[0].type="mi",e.parentIsSupSub)return new T("mrow",l);{let h=new T("mo",[nt("\u2061","text")]);return bt([l[0],h])}}if(u?(r=new T("mi",l),l[0].text.length===1&&r.setAttribute("mathvariant","normal")):r=new T("mrow",l),!e.parentIsSupSub){let h=[r,new T("mo",[nt("\u2061","text")])];if(e.needsLeadingSpace){let y=new T("mspace");y.setAttribute("width","0.1667em"),h.unshift(y)}if(!e.isFollowedByDelimiter){let y=new T("mspace");y.setAttribute("width","0.1667em"),h.push(y)}return bt(h)}return r}}),L("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),I({type:"ordgroup",mathmlBuilder:(e,n)=>tt(e.body,n,e.semisimple)}),C({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>{let r=n[0];return{type:"phantom",mode:e.mode,body:de(r)}},mathmlBuilder:(e,n)=>{let r=ht(e.body,n);return new T("mphantom",r)}}),C({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>{let r=n[0];return{type:"hphantom",mode:e.mode,body:r}},mathmlBuilder:(e,n)=>{let r=ht(de(e.body),n),l=new T("mphantom",r),u=new T("mpadded",[l]);return u.setAttribute("height","0px"),u.setAttribute("depth","0px"),u}}),C({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>{let r=n[0];return{type:"vphantom",mode:e.mode,body:r}},mathmlBuilder:(e,n)=>{let r=ht(de(e.body),n),l=new T("mphantom",r),u=new T("mpadded",[l]);return u.setAttribute("width","0.1px"),u}}),C({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>({type:"pmb",mode:e.mode,body:de(n[0])}),mathmlBuilder(e,n){let r=ht(e.body,n),l=mt(r);return l.setAttribute("style","font-weight:bold"),l}});let Sr=(e,n)=>{let r=n.withLevel(Tt),l=new T("mpadded",[He(e.body,r)]),u=Dt(e.dy,n);return l.setAttribute("voffset",u.number+u.unit),u.number>0?l.style.padding=u.number+u.unit+" 0 0 0":l.style.padding="0 0 "+Math.abs(u.number)+u.unit+" 0",l};C({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:n},r){let l=Le(r[0],"size").value;n==="\\lower"&&(l.number*=-1);let u=r[1];return{type:"raise",mode:e.mode,dy:l,body:u}},mathmlBuilder:Sr}),C({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:n},r){let l=Le(r[0],"size").value,u=r[1];return{type:"raise",mode:e.mode,dy:l,body:u}},mathmlBuilder:Sr}),C({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:n},r)=>({type:"ref",mode:e.mode,funcName:n,string:r[0].string.replace(tn,"")}),mathmlBuilder(e,n){let r=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new Ae("#"+e.string,r,null)}}),C({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},n)=>({type:"reflect",mode:e.mode,body:n[0]}),mathmlBuilder(e,n){let r=He(e.body,n);return r.style.transform="scaleX(-1)",r}}),C({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),C({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},n,r){let l=r[0],u=Le(n[0],"size"),h=Le(n[1],"size");return{type:"rule",mode:e.mode,shift:l&&Le(l,"size").value,width:u.value,height:h.value}},mathmlBuilder(e,n){let r=Dt(e.width,n),l=Dt(e.height,n),u=e.shift?Dt(e.shift,n):{number:0,unit:"em"},h=n.color&&n.getColor()||"black",y=new T("mspace");if(r.number>0&&l.number>0&&y.setAttribute("mathbackground",h),y.setAttribute("width",r.number+r.unit),y.setAttribute("height",l.number+l.unit),u.number===0)return y;let x=new T("mpadded",[y]);return u.number>=0?x.setAttribute("height","+"+u.number+u.unit):(x.setAttribute("height",u.number+u.unit),x.setAttribute("depth","+"+-u.number+u.unit)),x.setAttribute("voffset",u.number+u.unit),x}});let as=/^[0-9]$/,Hs={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},ls={0:"\u2070",1:"\xB9",2:"\xB2",3:"\xB3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079"};C({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},n){let r="";for(let u of n[0].body){if(u.type!=="textord"||!as.test(u.text))throw new t("Numerator must be an integer.",u);r+=u.text}let l="";for(let u of n[1].body){if(u.type!=="textord"||!as.test(u.text))throw new t("Denominator must be an integer.",u);l+=u.text}return{type:"sfrac",mode:e.mode,numerator:r,denominator:l}},mathmlBuilder(e,n){let r=e.numerator.split("").map(h=>ls[h]).join(""),l=e.denominator.split("").map(h=>Hs[h]).join(""),u=new Ke(r+"\u2044"+l,e.mode,n);return new T("mn",[u],["special-fraction"])}});let cs={"\\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};C({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:n,parser:r},l)=>{r.settings.strict&&r.mode==="math"&&console.log(`Temml strict-mode warning: Command ${n} is invalid in math mode.`);let u=r.parseExpression(!1,e,!0);return{type:"sizing",mode:r.mode,funcName:n,body:u}},mathmlBuilder:(e,n)=>{let r=n.withFontSize(cs[e.funcName]),l=ht(e.body,r),u=mt(l),h=(cs[e.funcName]/n.fontSize).toFixed(4);return u.setAttribute("mathsize",h+"em"),u}}),C({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},n,r)=>{let l=!1,u=!1,h=r[0]&&Le(r[0],"ordgroup");if(h){let x="";for(let q=0;q<h.body.length;++q)if(x=h.body[q].text,x==="t")l=!0;else{if(x!=="b"){l=!1,u=!1;break}u=!0}}else l=!0,u=!0;let y=n[0];return{type:"smash",mode:e.mode,body:y,smashHeight:l,smashDepth:u}},mathmlBuilder:(e,n)=>{let r=new T("mpadded",[He(e.body,n)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});let ds=["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"];C({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},n,r){let l=r[0],u=n[0];return u.body&&u.body.length===1&&u.body[0].text&&ds.includes(u.body[0].text)&&u.body.push({type:"rule",mode:"math",shift:null,width:{number:0,unit:"pt"},height:{number:.5,unit:"em"}}),{type:"sqrt",mode:e.mode,body:u,index:l}},mathmlBuilder(e,n){let{body:r,index:l}=e;return l?new T("mroot",[He(r,n),He(l,n.incrementLevel())]):new T("msqrt",[He(r,n)])}});let js={display:0,text:1,script:2,scriptscript:3},jr={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};C({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:n,parser:r},l){let u=r.parseExpression(!0,e,!0),h=n.slice(1,n.length-5);return{type:"styling",mode:r.mode,scriptLevel:h,body:u}},mathmlBuilder(e,n){let r=n.withLevel(js[e.scriptLevel]),l=ht(e.body,r),u=mt(l),h=jr[e.scriptLevel];return u.setAttribute("scriptlevel",h[0]),u.setAttribute("displaystyle",h[1]),u}});let Gs=/^m(over|under|underover)$/;I({type:"supsub",mathmlBuilder(e,n){let r,l,u=!1,h=!1,y=!1,x=!1;e.base&&e.base.type==="horizBracket"&&(l=!!e.sup,l===e.base.isOver&&(u=!0,r=e.base.isOver)),!e.base||e.stack||e.base.type!=="op"&&e.base.type!=="operatorname"||(e.base.parentIsSupSub=!0,h=!e.base.symbol,y=h&&!e.isFollowedByDelimiter,x=e.base.needsLeadingSpace);let q=e.stack&&e.base.body.length===1?[He(e.base.body[0],n)]:[He(e.base,n)],Z=n.inSubOrSup();if(e.sub){let le=He(e.sub,Z);n.level===3&&le.setAttribute("scriptlevel","2"),q.push(le)}if(e.sup){let le=He(e.sup,Z);if(n.level===3&&le.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){let xt=e.base.text;"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(xt)>-1?le.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(xt)>-1?le.classes.push("tml-med-pad"):"AJdf\u0394\u039B".indexOf(xt)>-1&&le.classes.push("tml-lrg-pad")}q.push(le)}let ve;if(u)ve=r?"mover":"munder";else if(e.sub)if(e.sup){let le=e.base;ve=le&&(le.type==="op"&&le.limits||le.type==="multiscript")&&(n.level===Et||le.alwaysHandleSupSub)||le&&le.type==="operatorname"&&le.alwaysHandleSupSub&&(n.level===Et||le.limits)?"munderover":"msubsup"}else{let le=e.base;ve=e.stack||le&&le.type==="op"&&le.limits&&(n.level===Et||le.alwaysHandleSupSub)||le&&le.type==="operatorname"&&le.alwaysHandleSupSub&&(le.limits||n.level===Et)?"munder":"msub"}else{let le=e.base;ve=le&&le.type==="op"&&le.limits&&(n.level===Et||le.alwaysHandleSupSub)||le&&le.type==="operatorname"&&le.alwaysHandleSupSub&&(le.limits||n.level===Et)?"mover":"msup"}let Te=new T(ve,q);if(h){let le=new T("mo",[nt("\u2061","text")]);if(x){let xt=new T("mspace");xt.setAttribute("width","0.1667em"),Te=bt([xt,Te,le])}else Te=bt([Te,le]);if(y){let xt=new T("mspace");xt.setAttribute("width","0.1667em"),Te.children.push(xt)}}else Gs.test(ve)&&(Te=new T("mrow",[Te]));return Te}});let Jn=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],us=["\\Rsh","\\Lsh","\\restriction"];I({type:"atom",mathmlBuilder(e,n){let r=new T("mo",[nt(e.text,e.mode)]);if(e.family==="punct")r.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(r.setAttribute("form","prefix"),r.setAttribute("stretchy","false")):e.family==="close"&&(r.setAttribute("form","postfix"),r.setAttribute("stretchy","false"));else if(e.text==="\\mid")r.setAttribute("lspace","0.22em"),r.setAttribute("rspace","0.22em"),r.setAttribute("stretchy","false");else if(e.family==="rel"&&(l=>{if(l.length===1){let u=l.codePointAt(0);return 8591<u&&u<8704}return l.indexOf("arrow")>-1||l.indexOf("harpoon")>-1||us.includes(l)})(e.text))r.setAttribute("stretchy","false");else if(Jn.includes(e.text))r.setAttribute("mathsize","70%");else if(e.text===":")r.attributes.lspace="0.2222em",r.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new T("mrow",[Ct(.222),r,Ct(.222)]):new T("mrow",[Ct(.2778),r,Ct(.2778)]);return r}});let Gr={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},Qn=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsc")return"normal";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"sans-serif-bold":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";let r=n.font;if(!r||r==="mathnormal")return null;let l=e.mode;switch(r){case"mathit":case"greekItalic":return"italic";case"mathrm":{let h=e.text.codePointAt(0);return 939<h&&h<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 u=e.text;return Q[l][u]&&Q[l][u].replace&&(u=Q[l][u].replace),Object.prototype.hasOwnProperty.call(Gr,r)?Gr[r]:null},b=/^\d(?:[\d,.]*\d)?$/,A=/[A-Ba-z]/,R=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);I({type:"mathord",mathmlBuilder(e,n){let r=nt(e.text,e.mode,n),l=r.text.codePointAt(0),u=912<l&&l<938?"normal":"italic",h=Qn(e,n)||u;if(h==="script")return r.text=zn(r.text,h),new T("mi",[r],[n.font]);h!=="italic"&&(r.text=zn(r.text,h));let y=new T("mi",[r]);if(h==="normal"&&(y.setAttribute("mathvariant","normal"),r.text.length===1)){let x=new T("mspace",[]);y=new T("mrow",[y,x])}return y}}),I({type:"textord",mathmlBuilder(e,n){let r=e.text,l=r.codePointAt(0);n.fontFamily==="textsc"&&96<l&&l<123&&(r=os[r]);let u=nt(r,e.mode,n),h=Qn(e,n)||"normal",y;if(b.test(e.text)){let x=e.mode==="text"?"mtext":"mn";if(h==="italic"||h==="bold-italic")return((q,Z,ve)=>{let Te=new T(ve,[q]),le=new T("mstyle",[Te]);return le.style["font-style"]="italic",le.style["font-family"]="Cambria, 'Times New Roman', serif",Z==="bold-italic"&&(le.style["font-weight"]="bold"),le})(u,h,x);h!=="normal"&&(u.text=u.text.split("").map(q=>zn(q,h)).join("")),y=new T(x,[u])}else if(e.mode==="text")h!=="normal"&&(u.text=zn(u.text,h)),y=new T("mtext",[u]);else if(R.has(e.text))y=new T("mo",[u]),y.classes.push("tml-prime");else{let x=u.text;h!=="italic"&&(u.text=zn(u.text,h)),y=new T("mi",[u]),u.text===x&&A.test(x)&&y.setAttribute("mathvariant","italic")}return y}});let U={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},V={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};I({type:"spacing",mathmlBuilder(e,n){let r;if(Object.prototype.hasOwnProperty.call(V,e.text))r=new T("mtext",[new Ke("\xA0")]);else{if(!Object.prototype.hasOwnProperty.call(U,e.text))throw new t(`Unknown type of space "${e.text}"`);r=new T("mo"),e.text==="\\nobreak"&&r.setAttribute("linebreak","nobreak")}return r}}),I({type:"tag"});let he={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},D={"\\textbf":"textbf","\\textmd":"textmd"},se={"\\textit":"textit","\\textup":"textup"};C({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:n},r){let l=r[0];return{type:"text",mode:e.mode,body:de(l),font:n}},mathmlBuilder(e,n){let r=((u,h)=>{let y=u.font;return y?he[y]?h.withTextFontFamily(he[y]):D[y]?h.withTextFontWeight(D[y]):y==="\\emph"?h.fontShape==="textit"?h.withTextFontShape("textup"):h.withTextFontShape("textit"):h.withTextFontShape(se[y]):h})(e,n),l=tt(e.body,r);return ut(l)}}),C({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},n)=>({type:"vcenter",mode:e.mode,body:n[0]}),mathmlBuilder(e,n){let r=new T("mtd",[He(e.body,n)]);r.style.padding="0";let l=new T("mtr",[r]);return new T("mtable",[l])}}),C({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,n,r){throw new t("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,n){let r=new Ke(Xe(e)),l=new T("mtext",[r]);return l.setAttribute("mathvariant","monospace"),l}});let Xe=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),Je=$,Be=`[ \r
|
|
93
|
-
]`,
|
|
91
|
+
}`),$n=(e,n)=>{let r="";if(e==="HTML"){if(!Sn.test(n))throw new t("Invalid HTML input.");r=n}else if(e==="RGB"){if(!Hn.test(n))throw new t("Invalid RGB input.");n.split(",").map(l=>{r+=Tt(Number(l.trim()))})}else{if(!jn.test(n))throw new t("Invalid rbg input.");n.split(",").map(l=>{let u=Number(l.trim());if(u>1)throw new t("Color rgb input must be < 1.");r+=Tt(Number((255*u).toFixed(0)))})}return r.charAt(0)!=="#"&&(r="#"+r),r},Cn=(e,n,r)=>{let l=`\\\\color@${e}`;if(!Un.exec(e))throw new t("Invalid color: '"+e+"'",r);return Fr.test(e)?"#"+e:(e.charAt(0)==="#"||(n.has(l)?e=n.get(l).tokens[0].text:Gn[e]&&(e=Gn[e])),e)},Ct=(e,n)=>{let r=rt(e.body,n.withColor(e.color));return r.length===0&&r.push(new _("mrow")),r=r.map(l=>(l.style.color=e.color,l)),bt(r)};N({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:n},r,l){let u=l[0]&&Ne(l[0],"raw").string,h="";if(u){let E=Ne(r[0],"raw").string;h=$n(u,E)}else h=Cn(Ne(r[0],"raw").string,e.gullet.macros,n);let y=r[1];return{type:"color",mode:e.mode,color:h,isTextColor:!0,body:pe(y)}},mathmlBuilder:Ct}),N({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:n,token:r},l,u){let h=u[0]&&Ne(u[0],"raw").string,y="";if(h){let U=Ne(l[0],"raw").string;y=$n(h,U)}else y=Cn(Ne(l[0],"raw").string,e.gullet.macros,r);let E=e.parseExpression(!0,n,!0);return{type:"color",mode:e.mode,color:y,isTextColor:!1,body:E}},mathmlBuilder:Ct}),N({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:n,token:r},l){let u=Ne(l[0],"raw").string;if(!/^[A-Za-z]+$/.test(u))throw new t("Color name must be latin letters.",r);let h=Ne(l[1],"raw").string;if(!["HTML","RGB","rgb"].includes(h))throw new t("Color model must be HTML, RGB, or rgb.",r);let y=Ne(l[2],"raw").string,E=$n(h,y);return e.gullet.macros.set(`\\\\color@${u}`,{tokens:[{text:E}],numArgs:0}),{type:"internal",mode:e.mode}}}),N({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},n,r){let l=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,u=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:u,size:l&&Ne(l,"size").value}},mathmlBuilder(e,n){let r=new _("mo");if(e.newLine&&(r.setAttribute("linebreak","newline"),e.size)){let l=Kt(e.size,n);r.setAttribute("height",l.number+l.unit)}return r}});let Rn={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},x=e=>{let n=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(n))throw new t("Expected a control sequence",e);return n},q=(e,n,r,l)=>{let u=e.gullet.macros.get(r.text);u==null&&(r.noexpand=!0,u={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(n,u,l)};N({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:n}){e.consumeSpaces();let r=e.fetch();if(Rn[r.text])return n!=="\\global"&&n!=="\\\\globallong"||(r.text=Rn[r.text]),Ne(e.parseFunction(),"internal");throw new t("Invalid token after macro prefix",r)}}),N({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r=e.gullet.popToken(),l=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(l))throw new t("Expected a control sequence",r);let u,h=0,y=[[]];for(;e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){u=e.gullet.future(),y[h].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new t(`Invalid argument number "${r.text}"`);if(parseInt(r.text)!==h+1)throw new t(`Argument number "${r.text}" out of order`);h++,y.push([])}else{if(r.text==="EOF")throw new t("Expected a macro definition");y[h].push(r.text)}let{tokens:E}=e.gullet.consumeArg();if(u&&E.unshift(u),n==="\\edef"||n==="\\xdef"){if(E=e.gullet.expandTokens(E),E.length>e.gullet.settings.maxExpand)throw new t("Too many expansions in an "+n);E.reverse()}return e.gullet.macros.set(l,{tokens:E,numArgs:h,delimiters:y},n===Rn[n]),{type:"internal",mode:e.mode}}}),N({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r=x(e.gullet.popToken());e.gullet.consumeSpaces();let l=(u=>{let h=u.gullet.popToken();return h.text==="="&&(h=u.gullet.popToken(),h.text===" "&&(h=u.gullet.popToken())),h})(e);return q(e,r,l,n==="\\\\globallet"),{type:"internal",mode:e.mode}}}),N({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r=x(e.gullet.popToken()),l=e.gullet.popToken(),u=e.gullet.popToken();return q(e,r,u,n==="\\\\globalfuture"),e.gullet.pushToken(u),e.gullet.pushToken(l),{type:"internal",mode:e.mode}}}),N({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:n}){let r="",l=e.gullet.popToken();l.text==="{"?(r=x(e.gullet.popToken()),e.gullet.popToken()):r=x(l);let u=e.gullet.isDefined(r);if(u&&n==="\\newcommand")throw new t(`\\newcommand{${r}} attempting to redefine ${r}; use \\renewcommand`);if(!u&&n==="\\renewcommand")throw new t(`\\renewcommand{${r}} when command ${r} does not yet exist; use \\newcommand`);let h=0;if(e.gullet.future().text==="["){let E=e.gullet.popToken();if(E=e.gullet.popToken(),!/^[0-9]$/.test(E.text))throw new t(`Invalid number of arguments: "${E.text}"`);if(h=parseInt(E.text),E=e.gullet.popToken(),E.text!=="]")throw new t(`Invalid argument "${E.text}"`)}let{tokens:y}=e.gullet.consumeArg();return n==="\\providecommand"&&e.gullet.macros.has(r)||e.gullet.macros.set(r,{tokens:y,numArgs:h}),{type:"internal",mode:e.mode}}});let D={"\\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}},ve={"(":")","\\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"},et=new Set(Object.keys(ve));new Set(Object.values(ve));let St=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","."]),Jt=new Set(["}","\\left","\\middle","\\right"]),hn=e=>e.length>0&&(St.has(e)||D[e]||Jt.has(e)),bn=[0,1.2,1.8,2.4,3];function In(e,n){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);let r=M(e);if(r&&St.has(r.text))return r.text!=="<"&&r.text!=="\\lt"||(r.text="\u27E8"),r.text!==">"&&r.text!=="\\gt"||(r.text="\u27E9"),r;throw new t(r?`Invalid delimiter '${r.text}' after '${n.funcName}'`:`Invalid delimiter type '${e.type}'`,e)}let wr=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),vr=(e,n,r,l)=>{let u=new _("mo",[Xe(e==="."?"":e,n)]);return u.setAttribute("fence","true"),u.setAttribute("form",r),u.setAttribute("stretchy",l?"true":"false"),u};function ss(e){if(!e.body)throw new Error("Bug: The delim ParseNode wasn't fully parsed.")}N({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,n)=>{let r=In(n[0],e),l={type:"delimsizing",mode:e.parser.mode,size:D[e.funcName].size,mclass:D[e.funcName].mclass,delim:r.text},u=e.parser.fetch().text;return u!=="^"&&u!=="_"?l:{type:"ordgroup",mode:"math",body:[l,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{let n=[],r=e.delim==="."?"":e.delim;n.push(Xe(r,e.mode));let l=new _("mo",n);return e.mclass==="mopen"||e.mclass==="mclose"?l.setAttribute("fence","true"):l.setAttribute("fence","false"),(wr.has(r)||r.indexOf("arrow")>-1)&&l.setAttribute("stretchy","true"),l.setAttribute("symmetric","true"),l.setAttribute("minsize",bn[e.size]+"em"),l.setAttribute("maxsize",bn[e.size]+"em"),l}}),N({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>({type:"leftright-right",mode:e.parser.mode,delim:In(n[0],e).text})}),N({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>{let r=In(n[0],e),l=e.parser;++l.leftrightDepth;let u=l.parseExpression(!1,"\\right",!0),h=l.fetch();for(;h.text==="\\middle";){l.consume();let E=l.fetch().text;if(!Y.math[E])throw new t(`Invalid delimiter '${E}' after '\\middle'`);In({type:"atom",mode:"math",text:E},{funcName:"\\middle"}),u.push({type:"middle",mode:"math",delim:E}),l.consume(),u=u.concat(l.parseExpression(!1,"\\right",!0)),h=l.fetch()}--l.leftrightDepth,l.expect("\\right",!1);let y=Ne(l.parseFunction(),"leftright-right");return{type:"leftright",mode:l.mode,body:u,left:r.text,right:y.delim,isStretchy:!0}},mathmlBuilder:(e,n)=>{ss(e);let r=rt(e.body,n),l=vr(e.left,e.mode,"prefix",!0);r.unshift(l);let u=vr(e.right,e.mode,"postfix",!0);if(e.body.length>0){let h=e.body[e.body.length-1];h.type!=="color"||h.isTextColor||u.setAttribute("mathcolor",h.color)}return r.push(u),ke(r)}}),N({type:"delimiter",names:Array.from(et),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:n,token:r})=>{if(e.mode==="text")return{type:"textord",mode:"text",text:n,loc:r.loc};if(!e.settings.wrapDelimiterPairs)return{type:"atom",mode:"math",family:"open",loc:r.loc,text:n};let l=ve[n],u=e.parseExpression(!1,l,!1);if(e.fetch().text!==l)throw new t("Unmatched delimiter");return e.consume(),{type:"delimiter",mode:e.mode,body:u,left:n,right:l}},mathmlBuilder:(e,n)=>{ss(e);let r=rt(e.body,n),l=vr(e.left,e.mode,"prefix",!1);r.unshift(l);let u=vr(e.right,e.mode,"postfix",!1);if(e.body.length>0){let h=e.body[e.body.length-1];h.type!=="color"||h.isTextColor||u.setAttribute("mathcolor",h.color)}return r.push(u),ke(r)}}),N({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>{let r=In(n[0],e);if(!e.parser.leftrightDepth)throw new t("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},mathmlBuilder:e=>{let n=Xe(e.delim,e.mode),r=new _("mo",[n]);return r.setAttribute("stretchy","true"),r.setAttribute("form","infix"),n.text!=="/"&&(r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em")),r}});let xr=["\\boxed","\\fcolorbox","\\colorbox"],Nn=(e,n)=>{let r=xr.includes(e.label)?"mrow":"menclose",l=new _(r,[tt(e.body,n)]);switch(e.label){case"\\overline":l.setAttribute("notation","top"),l.classes.push("tml-overline");break;case"\\underline":l.setAttribute("notation","bottom"),l.classes.push("tml-underline");break;case"\\cancel":l.setAttribute("notation","updiagonalstrike"),l.children.push(new _("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":l.setAttribute("notation","downdiagonalstrike"),l.children.push(new _("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":l.setAttribute("notation","horizontalstrike"),l.children.push(new _("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":l.setAttribute("notation","updiagonalstrike downdiagonalstrike"),l.children.push(new _("mrow",[],["tml-cancel","tml-xcancel"]));break;case"\\longdiv":l.setAttribute("notation","longdiv"),l.classes.push("longdiv-top"),l.children.push(new _("mrow",[],["longdiv-arc"]));break;case"\\phase":l.setAttribute("notation","phasorangle"),l.classes.push("phasor-bottom"),l.children.push(new _("mrow",[],["phasor-angle"]));break;case"\\textcircled":l.setAttribute("notation","circle"),l.classes.push("circle-pad"),l.children.push(new _("mrow",[],["textcircle"]));break;case"\\angl":l.setAttribute("notation","actuarial"),l.classes.push("actuarial");break;case"\\boxed":l.style.padding="3pt",l.style.border="1px solid",l.setAttribute("scriptlevel","0"),l.setAttribute("displaystyle","true");break;case"\\fbox":l.setAttribute("notation","box"),l.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":l.style.padding="0.3em",e.label==="\\fcolorbox"&&(l.style.border="0.0667em solid "+String(e.borderColor))}return e.backgroundColor&&l.setAttribute("mathbackground",e.backgroundColor),l};N({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:n},r,l){let u=l[0]&&Ne(l[0],"raw").string,h="";if(u){let E=Ne(r[0],"raw").string;h=$n(u,E)}else h=Cn(Ne(r[0],"raw").string,e.gullet.macros);let y=r[1];return{type:"enclose",mode:e.mode,label:n,backgroundColor:h,body:y}},mathmlBuilder:Nn}),N({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:n},r,l){let u=l[0]&&Ne(l[0],"raw").string,h,y="";if(u){let U=Ne(r[0],"raw").string,V=Ne(r[0],"raw").string;y=$n(u,U),h=$n(u,V)}else y=Cn(Ne(r[0],"raw").string,e.gullet.macros),h=Cn(Ne(r[1],"raw").string,e.gullet.macros);let E=r[2];return{type:"enclose",mode:e.mode,label:n,backgroundColor:h,borderColor:y,body:E}},mathmlBuilder:Nn}),N({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},n)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:n[0]})}),N({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Nn}),N({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Nn}),N({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Nn}),N({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:n},r){let l=r[0];return{type:"enclose",mode:e.mode,label:n,body:l}},mathmlBuilder:Nn}),N({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:n},r){let l=r[0];if(l.type!=="ordgroup")throw new t("Invalid environment name",l);let u="";for(let h=0;h<l.body.length;++h)u+=Ne(l.body[h],"textord").text;if(n==="\\begin"){if(!Object.prototype.hasOwnProperty.call(vn,u))throw new t("No such environment: "+u,l);let h=vn[u],{args:y,optArgs:E}=e.parseArguments("\\begin{"+u+"}",h),U={mode:e.mode,envName:u,parser:e},V=h.handler(U,y,E);e.expect("\\end",!1);let be=e.nextToken,Te=Ne(e.parseFunction(),"environment");if(Te.name!==u)throw new t(`Mismatch: \\begin{${u}} matched by \\end{${Te.name}}`,be);return V}return{type:"environment",mode:e.mode,name:u,nameGroup:l}}}),N({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},n)=>({type:"envTag",mode:e.mode,body:n[0]}),mathmlBuilder:(e,n)=>new _("mrow")}),N({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,n)=>new _("mrow")});let os=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),ur=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),Us=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),Kn=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),is=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),zr=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),Hs=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),as=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>os[e]||119899,"script-bold":e=>119951,fraktur:e=>ur[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>Us[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=>os[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=>Kn[e]||-51,italic:e=>0,"bold-italic":e=>is[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>zr[e]||116,"sans-serif-bold":e=>zr[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Hs[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}}),Mn=(e,n)=>{let r=e.codePointAt(0),l=64<r&&r<91?"upperCaseLatin":96<r&&r<123?"lowerCaseLatin":912<r&&r<938?"upperCaseGreek":944<r&&r<970||e==="\u03D5"?"lowerCaseGreek":120545<r&&r<120572||Kn[e]?"varGreek":47<r&&r<58?"numeral":"other";return l==="other"?e:String.fromCodePoint(r+as[l][n](e))},ls=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"}),cs=["mathrm","mathit"],kr=(e,n)=>{let r=e.font,l=n.withFont(r),u=tt(e.body,l);if(u.children.length===0)return u;if(r==="boldsymbol"&&["mo","mpadded","mrow"].includes(u.type))return u.style.fontWeight="bold",u;if(((E,U)=>{if(!cs.includes(U)||!E.body||E.body.type!=="ordgroup"||E.body.body.length===1||E.body.body[0].type!=="mathord")return!1;for(let V=1;V<E.body.body.length;V++){let be=E.body.body[V].type;if(be!=="mathord"&&(be!=="textord"||isNaN(E.body.body[V].text)))return!1}return!0})(e,r)){let E=u.children[0].children[0].children?u.children[0].children[0]:u.children[0];delete E.attributes.mathvariant;for(let V=1;V<u.children.length;V++)E.children[0].text+=u.children[V].children[0].children?u.children[V].children[0].children[0].text:u.children[V].children[0].text;if(r==="mathit")return E.children[0].text=E.children[0].text.split("").map(V=>Mn(V,"italic")).join(""),E;let U=new _("mpadded",[E]);return U.setAttribute("lspace","0"),U}let h=u.children[0].type==="mo";for(let E=1;E<u.children.length;E++)u.children[E].type==="mo"&&r==="boldsymbol"&&(u.children[E].style.fontWeight="bold"),u.children[E].type!=="mi"&&(h=!1),(u.children[E].attributes&&u.children[E].attributes.mathvariant||"")!=="normal"&&(h=!1);if(!h)return u;let y=u.children[0];for(let E=1;E<u.children.length;E++)y.children.push(u.children[E].children[0]);if(y.attributes.mathvariant&&y.attributes.mathvariant==="normal"){let E=new _("mtext",new je("\u200B"));return new _("mrow",[E,y])}return y},Ur={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};N({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:n},r)=>{let l=Se(r[0]),u=n;return u in Ur&&(u=Ur[u]),{type:"font",mode:e.mode,font:u.slice(1),body:l}},mathmlBuilder:kr}),N({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:n,breakOnTokenText:r},l)=>{let{mode:u}=e,h=e.parseExpression(!0,r,!0);return{type:"font",mode:u,font:`math${n.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:h}}},mathmlBuilder:kr});let Hr=["display","text","script","scriptscript"],Er={auto:-1,display:0,text:0,script:1,scriptscript:2},nn=(e,n)=>{n=((h,y)=>{let E=y;if(h==="display"){let U=E.level>=pt?Mt:wt;E=E.withLevel(U)}else h==="text"&&E.level===wt?E=E.withLevel(Mt):h==="auto"?E=E.incrementLevel():h==="script"?E=E.withLevel(pt):h==="scriptscript"&&(E=E.withLevel(nt));return E})(e.scriptLevel,n);let r=tt(e.numer,n),l=tt(e.denom,n);n.level===3&&(r.style.mathDepth="2",r.setAttribute("scriptlevel","2"),l.style.mathDepth="2",l.setAttribute("scriptlevel","2"));let u=new _("mfrac",[r,l]);if(e.hasBarLine){if(e.barSize){let h=Kt(e.barSize,n);u.setAttribute("linethickness",h.number+h.unit)}}else u.setAttribute("linethickness","0px");if(e.leftDelim!=null||e.rightDelim!=null){let h=[];if(e.leftDelim!=null){let y=new _("mo",[new je(e.leftDelim.replace("\\",""))]);y.setAttribute("fence","true"),h.push(y)}if(h.push(u),e.rightDelim!=null){let y=new _("mo",[new je(e.rightDelim.replace("\\",""))]);y.setAttribute("fence","true"),h.push(y)}u=ke(h)}return e.scriptLevel!=="auto"&&(u=new _("mstyle",[u]),u.setAttribute("displaystyle",String(e.scriptLevel==="display")),u.setAttribute("scriptlevel",Er[e.scriptLevel])),u};N({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:n},r)=>{let l=r[0],u=r[1],h=!1,y=null,E=null,U="auto";switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":h=!0;break;case"\\\\atopfrac":h=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":y="(",E=")";break;case"\\\\bracefrac":y="\\{",E="\\}";break;case"\\\\brackfrac":y="[",E="]";break;default:throw new Error("Unrecognized genfrac command")}return n==="\\cfrac"||n.startsWith("\\d")?U="display":n.startsWith("\\t")&&(U="text"),{type:"genfrac",mode:e.mode,continued:!1,numer:l,denom:u,hasBarLine:h,leftDelim:y,rightDelim:E,scriptLevel:U,barSize:null}},mathmlBuilder:nn}),N({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:n,token:r}){let l;switch(n){case"\\over":l="\\frac";break;case"\\choose":l="\\binom";break;case"\\atop":l="\\\\atopfrac";break;case"\\brace":l="\\\\bracefrac";break;case"\\brack":l="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:l,token:r}}});let tr=function(e){let n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};N({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},n){let r=n[4],l=n[5],u=Se(n[0]),h=u.type==="atom"&&u.family==="open"?tr(u.text):null,y=Se(n[1]),E=y.type==="atom"&&y.family==="close"?tr(y.text):null,U=Ne(n[2],"size"),V,be=null;U.isBlank?V=!0:(be=U.value,V=be.number>0);let Te="auto",de=n[3];if(de.type==="ordgroup"){if(de.body.length>0){let kt=Ne(de.body[0],"textord");Te=Hr[Number(kt.text)]}}else de=Ne(de,"textord"),Te=Hr[Number(de.text)];return{type:"genfrac",mode:e.mode,numer:r,denom:l,continued:!1,hasBarLine:V,barSize:be,leftDelim:h,rightDelim:E,scriptLevel:Te}},mathmlBuilder:nn}),N({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:n,token:r},l)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:Ne(l[0],"size").value,token:r})}),N({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:n},r)=>{let l=r[0],u=function(E){if(!E)throw new Error("Expected non-null, but got "+String(E));return E}(Ne(r[1],"infix").barSize),h=r[2],y=u.number>0;return{type:"genfrac",mode:e.mode,numer:l,denom:h,continued:!1,hasBarLine:y,barSize:u,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:nn}),N({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},n)=>({type:"hbox",mode:e.mode,body:pe(n[0])}),mathmlBuilder(e,n){let r=n.withLevel(Mt),l=Je(e.body,r);return ft(l)}}),N({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler:({parser:e,funcName:n},r)=>({type:"horizBracket",mode:e.mode,label:n,isOver:/^\\over/.test(n),base:r[0]}),mathmlBuilder:(e,n)=>{let r=j(e.label);return r.style["math-depth"]=0,new _(e.isOver?"mover":"munder",[tt(e.base,n),r])}}),N({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:n,token:r},l)=>{let u=Ne(l[0],"raw").string,h=l[1];if(e.settings.strict)throw new t(`Function "${n}" is disabled in strict mode`,r);let y,E={};switch(n){case"\\class":E.class=u,y={command:"\\class",class:u};break;case"\\id":E.id=u,y={command:"\\id",id:u};break;case"\\style":E.style=u,y={command:"\\style",style:u};break;case"\\data":{let U=u.split(",");for(let V=0;V<U.length;V++){let be=U[V].split("=");if(be.length!==2)throw new t("Error parsing key-value for \\data");E["data-"+be[0].trim()]=be[1].trim()}y={command:"\\data",attributes:E};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(y))throw new t(`Function "${n}" is not trusted`,r);return{type:"html",mode:e.mode,attributes:E,body:pe(h)}},mathmlBuilder:(e,n)=>{let r=Je(e.body,n),l=[];e.attributes.class&&l.push(...e.attributes.class.trim().split(/\s+/)),r.classes=l;for(let u in e.attributes)u!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,u)&&r.setAttribute(u,e.attributes[u]);return r}});let xn=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{let n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new t("Invalid size: '"+e+"' in \\includegraphics");let r={number:+(n[1]+n[2]),unit:n[3]};if(!pn(r))throw new t("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r}};N({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:n},r,l)=>{let u={number:0,unit:"em"},h={number:.9,unit:"em"},y={number:0,unit:"em"},E="";if(l[0]){let V=Ne(l[0],"raw").string.split(",");for(let be=0;be<V.length;be++){let Te=V[be].split("=");if(Te.length===2){let de=Te[1].trim();switch(Te[0].trim()){case"alt":E=de;break;case"width":u=xn(de);break;case"height":h=xn(de);break;case"totalheight":y=xn(de);break;default:throw new t("Invalid key: '"+Te[0]+"' in \\includegraphics.")}}}}let U=Ne(r[0],"url").url;if(E===""&&(E=U,E=E.replace(/^.*[\\/]/,""),E=E.substring(0,E.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:U}))throw new t('Function "\\includegraphics" is not trusted',n);return{type:"includegraphics",mode:e.mode,alt:E,width:u,height:h,totalheight:y,src:U}},mathmlBuilder:(e,n)=>{let r=Kt(e.height,n),l={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===r.unit&&e.totalheight.number>r.number&&(l.number=e.totalheight.number-r.number,l.unit=r.unit);let u=0;e.width.number>0&&(u=Kt(e.width,n));let h={height:r.number+l.number+"em"};u.number>0&&(h.width=u.number+u.unit),l.number>0&&(h.verticalAlign=-l.number+l.unit);let y=new Ze(e.src,e.alt,h);return y.height=r,y.depth=l,new _("mtext",[y])}}),N({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:n,token:r},l){let u=Ne(l[0],"size");if(e.settings.strict){let h=n[1]==="m",y=u.value.unit==="mu";if(h){if(!y)throw new t(`LaTeX's ${n} supports only mu units, not ${u.value.unit} units`,r);if(e.mode!=="math")throw new t(`LaTeX's ${n} works only in math mode`,r)}else if(y)throw new t(`LaTeX's ${n} doesn't support mu units`,r)}return{type:"kern",mode:e.mode,dimension:u.value}},mathmlBuilder(e,n){let r=Kt(e.dimension,n),l=r.number>0&&r.unit==="em"?nr(r.number):"";if(e.mode==="text"&&l.length>0){let u=new je(l);return new _("mtext",[u])}if(r.number>=0){let u=new _("mspace");return u.setAttribute("width",r.number+r.unit),u}{let u=new _("mrow");return u.style.marginLeft=r.number+r.unit,u}}});let nr=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},mn=/[^A-Za-z_0-9-]/g;N({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},n)=>({type:"label",mode:e.mode,string:n[0].string.replace(mn,"")}),mathmlBuilder(e,n){let r=new _("mrow",[],["tml-label"]);return e.string.length>0&&r.setLabel(e.string),r}});let Sr=["\\clap","\\llap","\\rlap"];N({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:n,token:r},l)=>{if(Sr.includes(n)){if(e.settings.strict&&e.mode!=="text")throw new t(`{${n}} can be used only in text mode.
|
|
92
|
+
Try \\math${n.slice(1)}`,r);n=n.slice(1)}else n=n.slice(5);let u=l[0];return{type:"lap",mode:e.mode,alignment:n,body:u}},mathmlBuilder:(e,n)=>{let r;if(e.alignment==="llap"){let h=rt(pe(e.body),n),y=new _("mphantom",h);r=new _("mpadded",[y]),r.setAttribute("width","0.1px")}let l=tt(e.body,n),u;if(e.alignment==="llap"?(l.style.position="absolute",l.style.right="0",l.style.bottom="0",u=new _("mpadded",[r,l])):u=new _("mpadded",[l]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&u.setAttribute("lspace","0.16667em");else{let h=e.alignment==="llap"?"-1":"-0.5";u.setAttribute("lspace",h+"width"),e.alignment==="llap"?u.style.position="relative":(u.style.display="flex",u.style.justifyContent="center")}return u.setAttribute("width","0.1px"),u}}),N({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:n},r){let l=n.mode;n.switchMode("math");let u=e==="\\("?"\\)":"$",h=n.parseExpression(!1,u);return n.expect(u),n.switchMode(l),{type:"ordgroup",mode:n.mode,body:h}}}),N({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,n){throw new t(`Mismatched ${e.funcName}`,n)}}),N({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},n)=>({type:"mathchoice",mode:e.mode,display:pe(n[0]),text:pe(n[1]),script:pe(n[2]),scriptscript:pe(n[3])}),mathmlBuilder:(e,n)=>{let r=((l,u)=>{switch(u.level){case wt:return l.display;case Mt:return l.text;case pt:return l.script;case nt:return l.scriptscript;default:return l.text}})(e,n);return Je(r,n)}});let Pn=["text","textord","mathord","atom"];function pr(e,n){let r,l=rt(e.body,n);if(e.mclass==="minner")r=new _("mpadded",l);else if(e.mclass==="mord")e.isCharacterBox||l[0].type==="mathord"?(r=l[0],r.type="mi",r.children.length===1&&r.children[0].text&&r.children[0].text==="\u2207"&&r.setAttribute("mathvariant","normal")):r=new _("mi",l);else{r=new _("mrow",l),e.mustPromote?(r=l[0],r.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&r.setAttribute("mathvariant","italic")):r=new _("mrow",l);let u=n.level<2;r.type==="mrow"?u&&(e.mclass==="mbin"?(r.children.unshift(_t(.2222)),r.children.push(_t(.2222))):e.mclass==="mrel"?(r.children.unshift(_t(.2778)),r.children.push(_t(.2778))):e.mclass==="mpunct"?r.children.push(_t(.1667)):e.mclass==="minner"&&(r.children.unshift(_t(.0556)),r.children.push(_t(.0556)))):e.mclass==="mbin"?(r.attributes.lspace=u?"0.2222em":"0",r.attributes.rspace=u?"0.2222em":"0"):e.mclass==="mrel"?(r.attributes.lspace=u?"0.2778em":"0",r.attributes.rspace=u?"0.2778em":"0"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace=u?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&u&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em"),e.mclass!=="mopen"&&e.mclass!=="mclose"&&(delete r.attributes.stretchy,delete r.attributes.form)}return r}N({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:n},r){let l=r[0],u=v(l),h=!0,y={type:"mathord",text:"",mode:e.mode},E=l.body?l.body:[l];for(let U of E){if(!Pn.includes(U.type)){h=!1;break}Y[e.mode][U.text]?y.text+=Y[e.mode][U.text].replace:U.text?y.text+=U.text:U.body&&U.body.map(V=>{y.text+=V.text})}return h&&n==="\\mathord"&&y.type==="mathord"&&y.text.length>1?y:{type:"mclass",mode:e.mode,mclass:"m"+n.slice(5),body:pe(h?y:l),isCharacterBox:u,mustPromote:h}},mathmlBuilder:pr});let Wn=e=>{let n=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;if(n.type==="atom"){let r=e.body.length>0&&e.body[0].text&&Y.math[e.body[0].text]?Y.math[e.body[0].text].group:n.family;return r==="bin"||r==="rel"?"m"+r:"mord"}return"mord"};N({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},n)=>({type:"mclass",mode:e.mode,mclass:Wn(n[0]),body:pe(n[1]),isCharacterBox:v(n[1])})}),N({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:n},r){let l=r[1],u=r[0],h;h=n!=="\\stackrel"?Wn(l):"mrel";let y={type:h==="mrel"||h==="mbin"?"op":"ordgroup",mode:l.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:pe(l)};return{type:"supsub",mode:u.mode,stack:!0,base:y,sup:n==="\\underset"?null:u,sub:n==="\\underset"?u:null}},mathmlBuilder:pr});let hr=(e,n,r)=>{if(!e)return r;let l=tt(e,n);return l.type==="mrow"&&l.children.length===0?r:l};N({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:n,token:r},l){if(l[2].body.length===0)throw new t(n+"cannot parse an empty base.");let u=l[2].body[0];if(e.settings.strict&&n==="\\sideset"&&!u.symbol)throw new t("The base of \\sideset must be a big operator. Try \\prescript.");if(l[0].body.length>0&&l[0].body[0].type!=="supsub"||l[1].body.length>0&&l[1].body[0].type!=="supsub")throw new t("\\sideset can parse only subscripts and superscripts in its first two arguments",r);let h=l[0].body.length>0?l[0].body[0]:null,y=l[1].body.length>0?l[1].body[0]:null;return h||y?h?{type:"multiscript",mode:e.mode,isSideset:n==="\\sideset",prescripts:h,postscripts:y,base:u}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:u,sup:y.sup,sub:y.sub}]}:u},mathmlBuilder(e,n){let r=tt(e.base,n),l=new _("mprescripts"),u=new _("none"),h=[],y=hr(e.prescripts.sub,n,u),E=hr(e.prescripts.sup,n,u);return e.isSideset&&(y.setAttribute("style","text-align: left;"),E.setAttribute("style","text-align: left;")),e.postscripts?h=[r,hr(e.postscripts.sub,n,u),hr(e.postscripts.sup,n,u),l,y,E]:h=[r,l,y,E],new _("mmultiscripts",h)}}),N({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},n){let r=v(n[0]),l;return r?(l=pe(n[0]),l[0].text.charAt(0)==="\\"&&(l[0].text=Y.math[l[0].text].replace),l[0].text=l[0].text.slice(0,1)+"\u0338"+l[0].text.slice(1)):l=[{type:"textord",mode:"math",text:"\u0338"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},n[0]],{type:"not",mode:e.mode,body:l,isCharacterBox:r}},mathmlBuilder(e,n){return e.isCharacterBox?rt(e.body,n,!0)[0]:Je(e.body,n)}});let rr=["textord","mathord","atom"],jr=["\\smallint"],sr=["textord","mathord","ordgroup","close","leftright","font"],Ar=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},mr=(e,n)=>{let r;if(e.symbol)r=new _("mo",[Xe(e.name,e.mode)]),jr.includes(e.name)?r.setAttribute("largeop","false"):r.setAttribute("movablelimits","false"),e.fromMathOp&&Ar(r);else if(e.body)r=new _("mo",rt(e.body,n)),e.fromMathOp&&Ar(r);else if(r=new _("mi",[new je(e.name.slice(1))]),!e.parentIsSupSub){let l=[r,new _("mo",[Xe("\u2061","text")])];if(e.needsLeadingSpace){let u=new _("mspace");u.setAttribute("width","0.1667em"),l.unshift(u)}if(!e.isFollowedByDelimiter){let u=new _("mspace");u.setAttribute("width","0.1667em"),l.push(u)}r=new _("mrow",l)}return r},ds={"\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"};N({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:n},r)=>{let l=n;return l.length===1&&(l=ds[l]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:l}},mathmlBuilder:mr}),N({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},n)=>{let r=n[0],l=r.body?r.body:[r],u=l.length===1&&rr.includes(l[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:u,fromMathOp:!0,stack:!1,name:u?l[0].text:null,body:u?null:pe(r)}},mathmlBuilder:mr});let js={"\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"};N({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:n}){let r=e.prevAtomType,l=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:hn(l),needsLeadingSpace:r.length>0&&sr.includes(r),name:n}},mathmlBuilder:mr}),N({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:n}){let r=e.prevAtomType,l=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:hn(l),needsLeadingSpace:r.length>0&&sr.includes(r),name:n}},mathmlBuilder:mr}),N({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:n}){let r=n;return r.length===1&&(r=js[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:mr}),N({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:n},r)=>{let l=r[0],u=e.prevAtomType,h=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:pe(l),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:hn(h),needsLeadingSpace:u.length>0&&sr.includes(u)}},mathmlBuilder:(e,n)=>{let r,l=rt(e.body,n.withFont("mathrm")),u=!0;for(let h=0;h<l.length;h++){let y=l[h];if(y instanceof _)switch(((y.type==="mrow"||y.type==="mpadded")&&y.children.length===1&&y.children[0]instanceof _||y.type==="mrow"&&y.children.length===2&&y.children[0]instanceof _&&y.children[1]instanceof _&&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 E=y.attributes.width.replace("em",""),U=nr(Number(E));U===""?u=!1:l[h]=new _("mtext",[new je(U)])}break;case"mo":{let E=y.children[0];y.children.length===1&&E instanceof je?E.text=E.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):u=!1;break}default:u=!1}else u=!1}if(u){let h=l.map(y=>y.toText()).join("");l=[new je(h)]}else if(l.length===1&&["mover","munder"].includes(l[0].type)&&(l[0].children[0].type==="mi"||l[0].children[0].type==="mtext")){if(l[0].children[0].type="mi",e.parentIsSupSub)return new _("mrow",l);{let h=new _("mo",[Xe("\u2061","text")]);return bt([l[0],h])}}if(u?(r=new _("mi",l),l[0].text.length===1&&r.setAttribute("mathvariant","normal")):r=new _("mrow",l),!e.parentIsSupSub){let h=[r,new _("mo",[Xe("\u2061","text")])];if(e.needsLeadingSpace){let y=new _("mspace");y.setAttribute("width","0.1667em"),h.unshift(y)}if(!e.isFollowedByDelimiter){let y=new _("mspace");y.setAttribute("width","0.1667em"),h.push(y)}return bt(h)}return r}}),L("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),I({type:"ordgroup",mathmlBuilder:(e,n)=>Je(e.body,n,e.semisimple)}),N({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>{let r=n[0];return{type:"phantom",mode:e.mode,body:pe(r)}},mathmlBuilder:(e,n)=>{let r=rt(e.body,n);return new _("mphantom",r)}}),N({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>{let r=n[0];return{type:"hphantom",mode:e.mode,body:r}},mathmlBuilder:(e,n)=>{let r=rt(pe(e.body),n),l=new _("mphantom",r),u=new _("mpadded",[l]);return u.setAttribute("height","0px"),u.setAttribute("depth","0px"),u}}),N({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>{let r=n[0];return{type:"vphantom",mode:e.mode,body:r}},mathmlBuilder:(e,n)=>{let r=rt(pe(e.body),n),l=new _("mphantom",r),u=new _("mpadded",[l]);return u.setAttribute("width","0.1px"),u}}),N({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},n)=>({type:"pmb",mode:e.mode,body:pe(n[0])}),mathmlBuilder(e,n){let r=rt(e.body,n),l=gt(r);return l.setAttribute("style","font-weight:bold"),l}});let Gr=(e,n)=>{let r=n.withLevel(Mt),l=new _("mpadded",[tt(e.body,r)]),u=Kt(e.dy,n);return l.setAttribute("voffset",u.number+u.unit),u.number>0?l.style.padding=u.number+u.unit+" 0 0 0":l.style.padding="0 0 "+Math.abs(u.number)+u.unit+" 0",l};N({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:n},r){let l=Ne(r[0],"size").value;n==="\\lower"&&(l.number*=-1);let u=r[1];return{type:"raise",mode:e.mode,dy:l,body:u}},mathmlBuilder:Gr}),N({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:n},r){let l=Ne(r[0],"size").value,u=r[1];return{type:"raise",mode:e.mode,dy:l,body:u}},mathmlBuilder:Gr}),N({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:n},r)=>({type:"ref",mode:e.mode,funcName:n,string:r[0].string.replace(mn,"")}),mathmlBuilder(e,n){let r=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new _e("#"+e.string,r,null)}}),N({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},n)=>({type:"reflect",mode:e.mode,body:n[0]}),mathmlBuilder(e,n){let r=tt(e.body,n);return r.style.transform="scaleX(-1)",r}}),N({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),N({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},n,r){let l=r[0],u=Ne(n[0],"size"),h=Ne(n[1],"size");return{type:"rule",mode:e.mode,shift:l&&Ne(l,"size").value,width:u.value,height:h.value}},mathmlBuilder(e,n){let r=Kt(e.width,n),l=Kt(e.height,n),u=e.shift?Kt(e.shift,n):{number:0,unit:"em"},h=n.color&&n.getColor()||"black",y=new _("mspace");if(r.number>0&&l.number>0&&y.setAttribute("mathbackground",h),y.setAttribute("width",r.number+r.unit),y.setAttribute("height",l.number+l.unit),u.number===0)return y;let E=new _("mpadded",[y]);return u.number>=0?E.setAttribute("height","+"+u.number+u.unit):(E.setAttribute("height",u.number+u.unit),E.setAttribute("depth","+"+-u.number+u.unit)),E.setAttribute("voffset",u.number+u.unit),E}});let us=/^[0-9]$/,Kr={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},Gs={0:"\u2070",1:"\xB9",2:"\xB2",3:"\xB3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079"};N({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},n){let r="";for(let u of n[0].body){if(u.type!=="textord"||!us.test(u.text))throw new t("Numerator must be an integer.",u);r+=u.text}let l="";for(let u of n[1].body){if(u.type!=="textord"||!us.test(u.text))throw new t("Denominator must be an integer.",u);l+=u.text}return{type:"sfrac",mode:e.mode,numerator:r,denominator:l}},mathmlBuilder(e,n){let r=e.numerator.split("").map(h=>Gs[h]).join(""),l=e.denominator.split("").map(h=>Kr[h]).join(""),u=new je(r+"\u2044"+l,e.mode,n);return new _("mn",[u],["special-fraction"])}});let Vn={"\\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};N({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:n,parser:r},l)=>{r.settings.strict&&r.mode==="math"&&console.log(`Temml strict-mode warning: Command ${n} is invalid in math mode.`);let u=r.parseExpression(!1,e,!0);return{type:"sizing",mode:r.mode,funcName:n,body:u}},mathmlBuilder:(e,n)=>{let r=n.withFontSize(Vn[e.funcName]),l=rt(e.body,r),u=gt(l),h=(Vn[e.funcName]/n.fontSize).toFixed(4);return u.setAttribute("mathsize",h+"em"),u}}),N({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},n,r)=>{let l=!1,u=!1,h=r[0]&&Ne(r[0],"ordgroup");if(h){let E="";for(let U=0;U<h.body.length;++U)if(E=h.body[U].text,E==="t")l=!0;else{if(E!=="b"){l=!1,u=!1;break}u=!0}}else l=!0,u=!0;let y=n[0];return{type:"smash",mode:e.mode,body:y,smashHeight:l,smashDepth:u}},mathmlBuilder:(e,n)=>{let r=new _("mpadded",[tt(e.body,n)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});let ps=["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"];N({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},n,r){let l=r[0],u=n[0];return u.body&&u.body.length===1&&u.body[0].text&&ps.includes(u.body[0].text)&&u.body.push({type:"rule",mode:"math",shift:null,width:{number:0,unit:"pt"},height:{number:.5,unit:"em"}}),{type:"sqrt",mode:e.mode,body:u,index:l}},mathmlBuilder(e,n){let{body:r,index:l}=e;return l?new _("mroot",[tt(r,n),tt(l,n.incrementLevel())]):new _("msqrt",[tt(r,n)])}});let hs={display:0,text:1,script:2,scriptscript:3},fr={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};N({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:n,parser:r},l){let u=r.parseExpression(!0,e,!0),h=n.slice(1,n.length-5);return{type:"styling",mode:r.mode,scriptLevel:h,body:u}},mathmlBuilder(e,n){let r=n.withLevel(hs[e.scriptLevel]),l=rt(e.body,r),u=gt(l),h=fr[e.scriptLevel];return u.setAttribute("scriptlevel",h[0]),u.setAttribute("displaystyle",h[1]),u}});let b=/^m(over|under|underover)$/;I({type:"supsub",mathmlBuilder(e,n){let r,l,u=!1,h=!1,y=!1,E=!1;e.base&&e.base.type==="horizBracket"&&(l=!!e.sup,l===e.base.isOver&&(u=!0,r=e.base.isOver)),!e.base||e.stack||e.base.type!=="op"&&e.base.type!=="operatorname"||(e.base.parentIsSupSub=!0,h=!e.base.symbol,y=h&&!e.isFollowedByDelimiter,E=e.base.needsLeadingSpace);let U=e.stack&&e.base.body.length===1?[tt(e.base.body[0],n)]:[tt(e.base,n)],V=n.inSubOrSup();if(e.sub){let de=tt(e.sub,V);n.level===3&&de.setAttribute("scriptlevel","2"),U.push(de)}if(e.sup){let de=tt(e.sup,V);if(n.level===3&&de.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){let kt=e.base.text;"DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5".indexOf(kt)>-1?de.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(kt)>-1?de.classes.push("tml-med-pad"):"AJdf\u0394\u039B".indexOf(kt)>-1&&de.classes.push("tml-lrg-pad")}U.push(de)}let be;if(u)be=r?"mover":"munder";else if(e.sub)if(e.sup){let de=e.base;be=de&&(de.type==="op"&&de.limits||de.type==="multiscript")&&(n.level===wt||de.alwaysHandleSupSub)||de&&de.type==="operatorname"&&de.alwaysHandleSupSub&&(n.level===wt||de.limits)?"munderover":"msubsup"}else{let de=e.base;be=e.stack||de&&de.type==="op"&&de.limits&&(n.level===wt||de.alwaysHandleSupSub)||de&&de.type==="operatorname"&&de.alwaysHandleSupSub&&(de.limits||n.level===wt)?"munder":"msub"}else{let de=e.base;be=de&&de.type==="op"&&de.limits&&(n.level===wt||de.alwaysHandleSupSub)||de&&de.type==="operatorname"&&de.alwaysHandleSupSub&&(de.limits||n.level===wt)?"mover":"msup"}let Te=new _(be,U);if(h){let de=new _("mo",[Xe("\u2061","text")]);if(E){let kt=new _("mspace");kt.setAttribute("width","0.1667em"),Te=bt([kt,Te,de])}else Te=bt([Te,de]);if(y){let kt=new _("mspace");kt.setAttribute("width","0.1667em"),Te.children.push(kt)}}else b.test(be)&&(Te=new _("mrow",[Te]));return Te}});let $=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],R=["\\Rsh","\\Lsh","\\restriction"];I({type:"atom",mathmlBuilder(e,n){let r=new _("mo",[Xe(e.text,e.mode)]);if(e.family==="punct")r.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(r.setAttribute("form","prefix"),r.setAttribute("stretchy","false")):e.family==="close"&&(r.setAttribute("form","postfix"),r.setAttribute("stretchy","false"));else if(e.text==="\\mid")r.setAttribute("lspace","0.22em"),r.setAttribute("rspace","0.22em"),r.setAttribute("stretchy","false");else if(e.family==="rel"&&(l=>{if(l.length===1){let u=l.codePointAt(0);return 8591<u&&u<8704}return l.indexOf("arrow")>-1||l.indexOf("harpoon")>-1||R.includes(l)})(e.text))r.setAttribute("stretchy","false");else if($.includes(e.text))r.setAttribute("mathsize","70%");else if(e.text===":")r.attributes.lspace="0.2222em",r.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new _("mrow",[_t(.222),r,_t(.222)]):new _("mrow",[_t(.2778),r,_t(.2778)]);return r}});let G={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},Z=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsc")return"normal";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"sans-serif-bold":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";let r=n.font;if(!r||r==="mathnormal")return null;let l=e.mode;switch(r){case"mathit":case"greekItalic":return"italic";case"mathrm":{let h=e.text.codePointAt(0);return 939<h&&h<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 u=e.text;return Y[l][u]&&Y[l][u].replace&&(u=Y[l][u].replace),Object.prototype.hasOwnProperty.call(G,r)?G[r]:null},xe=/^\d(?:[\d,.]*\d)?$/,F=/[A-Ba-z]/,ae=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);I({type:"mathord",mathmlBuilder(e,n){let r=Xe(e.text,e.mode,n),l=r.text.codePointAt(0),u=912<l&&l<938?"normal":"italic",h=Z(e,n)||u;if(h==="script")return r.text=Mn(r.text,h),new _("mi",[r],[n.font]);h!=="italic"&&(r.text=Mn(r.text,h));let y=new _("mi",[r]);if(h==="normal"&&(y.setAttribute("mathvariant","normal"),r.text.length===1)){let E=new _("mspace",[]);y=new _("mrow",[y,E])}return y}}),I({type:"textord",mathmlBuilder(e,n){let r=e.text,l=r.codePointAt(0);n.fontFamily==="textsc"&&96<l&&l<123&&(r=ls[r]);let u=Xe(r,e.mode,n),h=Z(e,n)||"normal",y;if(xe.test(e.text)){let E=e.mode==="text"?"mtext":"mn";if(h==="italic"||h==="bold-italic")return((U,V,be)=>{let Te=new _(be,[U]),de=new _("mstyle",[Te]);return de.style["font-style"]="italic",de.style["font-family"]="Cambria, 'Times New Roman', serif",V==="bold-italic"&&(de.style["font-weight"]="bold"),de})(u,h,E);h!=="normal"&&(u.text=u.text.split("").map(U=>Mn(U,h)).join("")),y=new _(E,[u])}else if(e.mode==="text")h!=="normal"&&(u.text=Mn(u.text,h)),y=new _("mtext",[u]);else if(ae.has(e.text))y=new _("mo",[u]),y.classes.push("tml-prime");else{let E=u.text;h!=="italic"&&(u.text=Mn(u.text,h)),y=new _("mi",[u]),u.text===E&&F.test(E)&&y.setAttribute("mathvariant","italic")}return y}});let Ye={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},ot={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};I({type:"spacing",mathmlBuilder(e,n){let r;if(Object.prototype.hasOwnProperty.call(ot,e.text))r=new _("mtext",[new je("\xA0")]);else{if(!Object.prototype.hasOwnProperty.call(Ye,e.text))throw new t(`Unknown type of space "${e.text}"`);r=new _("mo"),e.text==="\\nobreak"&&r.setAttribute("linebreak","nobreak")}return r}}),I({type:"tag"});let De={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},lt={"\\textbf":"textbf","\\textmd":"textmd"},It={"\\textit":"textit","\\textup":"textup"};N({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:n},r){let l=r[0];return{type:"text",mode:e.mode,body:pe(l),font:n}},mathmlBuilder(e,n){let r=((u,h)=>{let y=u.font;return y?De[y]?h.withTextFontFamily(De[y]):lt[y]?h.withTextFontWeight(lt[y]):y==="\\emph"?h.fontShape==="textit"?h.withTextFontShape("textup"):h.withTextFontShape("textit"):h.withTextFontShape(It[y]):h})(e,n),l=Je(e.body,r);return ft(l)}}),N({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},n)=>({type:"vcenter",mode:e.mode,body:n[0]}),mathmlBuilder(e,n){let r=new _("mtd",[tt(e.body,n)]);r.style.padding="0";let l=new _("mtr",[r]);return new _("mtable",[l])}}),N({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,n,r){throw new t("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,n){let r=new je(Lt(e)),l=new _("mtext",[r]);return l.setAttribute("mathvariant","monospace"),l}});let Lt=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),Dt=T,yt=`[ \r
|
|
93
|
+
]`,Ft=`(\\\\[a-zA-Z@]+)${yt}*`,zt="[\u0300-\u036F]",On=new RegExp(`${zt}+$`),Ks=`(${yt}+)|\\\\(
|
|
94
94
|
|[ \r ]+
|
|
95
|
-
?)[ \r ]*|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${
|
|
96
|
-
`,this.tokenRegex.lastIndex);if(h===-1){if(this.tokenRegex.lastIndex=n.length,this.settings.strict)throw new t("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=h+1;return this.lex()}return new ot(u,new Oe(this,r,this.tokenRegex.lastIndex))}}class Ft{constructor(n={},r={}){this.current=r,this.builtins=n,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new t("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");let n=this.undefStack.pop();for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&(n[r]===void 0?delete this.current[r]:this.current[r]=n[r])}has(n){return Object.prototype.hasOwnProperty.call(this.current,n)||Object.prototype.hasOwnProperty.call(this.builtins,n)}get(n){return Object.prototype.hasOwnProperty.call(this.current,n)?this.current[n]:this.builtins[n]}set(n,r,l=!1){if(l){for(let u=0;u<this.undefStack.length;u++)delete this.undefStack[u][n];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][n]=r)}else{let u=this.undefStack[this.undefStack.length-1];u&&!Object.prototype.hasOwnProperty.call(u,n)&&(u[n]=this.current[n])}this.current[n]=r}}let jt={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Pn{constructor(n,r,l){this.settings=r,this.expansionCount=0,this.feed(n),this.macros=new Ft(Pt,r.macros),this.mode=l,this.stack=[]}feed(n){this.lexer=new vt(n,this.settings)}switchMode(n){this.mode=n}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(n){this.stack.push(n)}pushTokens(n){this.stack.push(...n)}scanArgument(n){let r,l,u;if(n){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:u,end:l}=this.consumeArg(["]"])}else({tokens:u,start:r,end:l}=this.consumeArg());return this.pushToken(new ot("EOF",l.loc)),this.pushTokens(u),new ot("",Oe.range(r,l))}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(n){let r=[],l=n&&n.length>0;l||this.consumeSpaces();let u=this.future(),h,y=0,x=0;do{if(h=this.popToken(),r.push(h),h.text==="{")++y;else if(h.text==="}"){if(--y,y===-1)throw new t("Extra }",h)}else if(h.text==="EOF")throw new t("Unexpected end of input in a macro argument, expected '"+(n&&l?n[x]:"}")+"'",h);if(n&&l)if((y===0||y===1&&n[x]==="{")&&h.text===n[x]){if(++x,x===n.length){r.splice(-x,x);break}}else x=0}while(y!==0||l);return u.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:u,end:h}}consumeArgs(n,r){if(r){if(r.length!==n+1)throw new t("The length of delimiters doesn't match the number of args!");let u=r[0];for(let h=0;h<u.length;h++){let y=this.popToken();if(u[h]!==y.text)throw new t("Use of the macro doesn't match its definition",y)}}let l=[];for(let u=0;u<n;u++)l.push(this.consumeArg(r&&r[u+1]).tokens);return l}expandOnce(n){let r=this.popToken(),l=r.text,u=r.noexpand?null:this._getExpansion(l);if(u==null||n&&u.unexpandable){if(n&&u==null&&l[0]==="\\"&&!this.isDefined(l))throw new t("Undefined control sequence: "+l);return this.pushToken(r),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new t("Too many expansions: infinite loop or need to increase maxExpand setting");let h=u.tokens,y=this.consumeArgs(u.numArgs,u.delimiters);if(u.numArgs){h=h.slice();for(let x=h.length-1;x>=0;--x){let q=h[x];if(q.text==="#"){if(x===0)throw new t("Incomplete placeholder at end of macro body",q);if(q=h[--x],q.text==="#")h.splice(x+1,1);else{if(!/^[1-9]$/.test(q.text))throw new t("Not a valid argument number",q);h.splice(x,2,...y[+q.text-1])}}}}return this.pushTokens(h),h.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let n=this.stack.pop();return n.treatAsRelax&&(n.text="\\relax"),n}throw new Error}expandMacro(n){return this.macros.has(n)?this.expandTokens([new ot(n)]):void 0}expandTokens(n){let r=[],l=this.stack.length;for(this.pushTokens(n);this.stack.length>l;)if(this.expandOnce(!0)===!1){let u=this.stack.pop();u.treatAsRelax&&(u.noexpand=!1,u.treatAsRelax=!1),r.push(u)}return r}expandMacroAsText(n){let r=this.expandMacro(n);return r&&r.map(l=>l.text).join("")}_getExpansion(n){let r=this.macros.get(n);if(r==null)return r;if(n.length===1){let u=this.lexer.catcodes[n];if(u!=null&&u!==13)return}let l=typeof r=="function"?r(this):r;if(typeof l=="string"){let u=0;if(l.indexOf("#")!==-1){let q=l.replace(/##/g,"");for(;q.indexOf("#"+(u+1))!==-1;)++u}let h=new vt(l,this.settings),y=[],x=h.lex();for(;x.text!=="EOF";)y.push(x),x=h.lex();return y.reverse(),{tokens:y,numArgs:u}}return l}isDefined(n){return this.macros.has(n)||Object.prototype.hasOwnProperty.call(Je,n)||Object.prototype.hasOwnProperty.call(Q.math,n)||Object.prototype.hasOwnProperty.call(Q.text,n)||Object.prototype.hasOwnProperty.call(jt,n)}isExpandable(n){let r=this.macros.get(n);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Object.prototype.hasOwnProperty.call(Je,n)&&!Je[n].primitive}}let ps=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,hs=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"}),Co=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 Ks={"\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"}},No={\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 tl=["bin","op","open","punct","rel"],nl=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,rl=/^ *\\text/;class Kr{constructor(n,r,l=!1){this.mode="math",this.gullet=new Pn(n,r,this.mode),this.settings=r,this.isPreamble=l,this.leftrightDepth=0,this.prevAtomType=""}expect(n,r=!0){if(this.fetch().text!==n)throw new t(`Expected '${n}', got '${this.fetch().text}'`,this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(n){this.mode=n,this.gullet.switchMode(n)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");let n=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){let l=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([u,h])=>{l[u]=h}),this.gullet.endGroup(),l}let r=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),r&&(this.gullet.macros.current["\\df@tag"]=r),n}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(n){let r=this.nextToken;this.consume(),this.gullet.pushToken(new ot("}")),this.gullet.pushTokens(n);let l=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,l}parseExpression(n,r,l){let u=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();let h=this.fetch();if(Kr.endOfExpression.indexOf(h.text)!==-1||r&&h.text===r||l&&h.text==="\\middle"||n&&Je[h.text]&&Je[h.text].infix)break;let y=this.parseAtom(r);if(!y)break;y.type!=="internal"&&(u.push(y),this.prevAtomType=y.type==="atom"?y.family:y.type)}return this.mode==="text"&&this.formLigatures(u),this.handleInfixNodes(u)}handleInfixNodes(n){let r,l=-1;for(let u=0;u<n.length;u++)if(n[u].type==="infix"){if(l!==-1)throw new t("only one infix operator per group",n[u].token);l=u,r=n[u].replaceWith}if(l!==-1&&r){let u,h,y=n.slice(0,l),x=n.slice(l+1),q;return u=y.length===1&&y[0].type==="ordgroup"?y[0]:{type:"ordgroup",mode:this.mode,body:y},h=x.length===1&&x[0].type==="ordgroup"?x[0]:{type:"ordgroup",mode:this.mode,body:x},q=r==="\\\\abovefrac"?this.callFunction(r,[u,n[l],h],[]):this.callFunction(r,[u,h],[]),[q]}return n}handleSupSubscript(n){let r=this.fetch(),l=r.text,u;this.consume(),this.consumeSpaces();do u=this.parseGroup(n);while(u.type&&u.type==="internal");if(!u)throw new t("Expected group after '"+l+"'",r);return u}formatUnsupportedCmd(n){let r=[];for(let u=0;u<n.length;u++)r.push({type:"textord",mode:"text",text:n[u]});let l={type:"text",mode:this.mode,body:r};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[l]}}parseAtom(n){let r=this.parseGroup("atom",n);if(r&&r.type==="internal"||this.mode==="text")return r;let l,u;for(;;){this.consumeSpaces();let h=this.fetch();if(h.text==="\\limits"||h.text==="\\nolimits"){if(r&&r.type==="op"){let y=h.text==="\\limits";r.limits=y,r.alwaysHandleSupSub=!0}else{if(!r||r.type!=="operatorname")throw new t("Limit controls must follow a math operator",h);r.alwaysHandleSupSub&&(r.limits=h.text==="\\limits")}this.consume()}else if(h.text==="^"){if(l)throw new t("Double superscript",h);l=this.handleSupSubscript("superscript")}else if(h.text==="_"){if(u)throw new t("Double subscript",h);u=this.handleSupSubscript("subscript")}else if(h.text==="'"){if(l)throw new t("Double superscript",h);let y={type:"textord",mode:this.mode,text:"\\prime"},x=[y];for(this.consume();this.fetch().text==="'";)x.push(y),this.consume();this.fetch().text==="^"&&x.push(this.handleSupSubscript("superscript")),l={type:"ordgroup",mode:this.mode,body:x}}else{if(!hs[h.text])break;{let y=ps.test(h.text),x=[];for(x.push(new ot(hs[h.text])),this.consume();;){let Z=this.fetch().text;if(!hs[Z]||ps.test(Z)!==y)break;x.unshift(new ot(hs[Z])),this.consume()}let q=this.subparse(x);y?u={type:"ordgroup",mode:"math",body:q}:l={type:"ordgroup",mode:"math",body:q}}}}if(l||u){if(r&&r.type==="multiscript"&&!r.postscripts)return r.postscripts={sup:l,sub:u},r;{let h=!r||r.type!=="op"&&r.type!=="operatorname"?void 0:Ln(this.nextToken.text);return{type:"supsub",mode:this.mode,base:r,sup:l,sub:u,isFollowedByDelimiter:h}}}return r}parseFunction(n,r){let l=this.fetch(),u=l.text,h=Je[u];if(!h)return null;if(this.consume(),r&&r!=="atom"&&!h.allowedInArgument)throw new t("Got function '"+u+"' with no arguments"+(r?" as "+r:""),l);if(this.mode==="text"&&!h.allowedInText)throw new t("Can't use function '"+u+"' in text mode",l);if(this.mode==="math"&&h.allowedInMath===!1)throw new t("Can't use function '"+u+"' in math mode",l);let y=this.prevAtomType,{args:x,optArgs:q}=this.parseArguments(u,h);return this.prevAtomType=y,this.callFunction(u,x,q,l,n)}callFunction(n,r,l,u,h){let y={funcName:n,parser:this,token:u,breakOnTokenText:h},x=Je[n];if(x&&x.handler)return x.handler(y,r,l);throw new t(`No function handler for ${n}`)}parseArguments(n,r){let l=r.numArgs+r.numOptionalArgs;if(l===0)return{args:[],optArgs:[]};let u=[],h=[];for(let y=0;y<l;y++){let x=r.argTypes&&r.argTypes[y],q=y<r.numOptionalArgs;(r.primitive&&x==null||r.type==="sqrt"&&y===1&&h[0]==null)&&(x="primitive");let Z=this.parseGroupOfType(`argument to '${n}'`,x,q);if(q)h.push(Z);else{if(Z==null)throw new t("Null argument, please report this as a bug");u.push(Z)}}return{args:u,optArgs:h}}parseGroupOfType(n,r,l){switch(r){case"size":return this.parseSizeGroup(l);case"url":return this.parseUrlGroup(l);case"math":case"text":return this.parseArgumentGroup(l,r);case"hbox":{let u=this.parseArgumentGroup(l,"text");return u!=null?{type:"styling",mode:u.mode,body:[u],scriptLevel:"text"}:null}case"raw":{let u=this.parseStringGroup("raw",l);return u!=null?{type:"raw",mode:"text",string:u.text}:null}case"primitive":{if(l)throw new t("A primitive argument cannot be optional");let u=this.parseGroup(n);if(u==null)throw new t("Expected group as "+n,this.fetch());return u}case"original":case null:case void 0:return this.parseArgumentGroup(l);default:throw new t("Unknown group type as "+n,this.fetch())}}consumeSpaces(){for(;;){let n=this.fetch().text;if(n!==" "&&n!=="\xA0"&&n!=="\uFE0E")break;this.consume()}}parseStringGroup(n,r){let l=this.gullet.scanArgument(r);if(l==null)return null;let u,h="";for(;(u=this.fetch()).text!=="EOF";)h+=u.text,this.consume();return this.consume(),l.text=h,l}parseRegexGroup(n,r){let l=this.fetch(),u,h=l,y="";for(;(u=this.fetch()).text!=="EOF"&&n.test(y+u.text);)h=u,y+=h.text,this.consume();if(y==="")throw new t("Invalid "+r+": '"+l.text+"'",l);return l.range(h,y)}parseSizeGroup(n){let r,l=!1;if(this.gullet.consumeSpaces(),r=n||this.gullet.future().text==="{"?this.parseStringGroup("size",n):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!r)return null;n||r.text.length!==0||(r.text="0pt",l=!0);let u=nl.exec(r.text);if(!u)throw new t("Invalid size: '"+r.text+"'",r);let h={number:+(u[1]+u[2]),unit:u[3]};if(!Lt(h))throw new t("Invalid unit: '"+h.unit+"'",r);return{type:"size",mode:this.mode,value:h,isBlank:l}}parseUrlGroup(n){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);let r=this.parseStringGroup("url",n);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;let l=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return l=r.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:l}}parseArgumentGroup(n,r){let l=this.gullet.scanArgument(n);if(l==null)return null;let u=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();let h=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();let y={type:"ordgroup",mode:this.mode,loc:l.loc,body:h};return r&&this.switchMode(u),y}parseGroup(n,r){let l=this.fetch(),u=l.text;if(n==="argument to '\\left'")return this.parseSymbol();let h;if(u==="{"||u==="\\begingroup"||u==="\\toggle"){this.consume();let y=u==="{"?"}":u==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let x=this.parseExpression(!1,y),q=this.fetch();this.expect(y),this.gullet.endGroup(),h={type:q.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:Oe.range(l,q),body:x,semisimple:u==="\\begingroup"||void 0}}else if(h=this.parseFunction(r,n)||this.parseSymbol(),h==null&&u[0]==="\\"&&!Object.prototype.hasOwnProperty.call(jt,u)){if(this.settings.throwOnError)throw new t("Unsupported function name: "+u,l);h=this.formatUnsupportedCmd(u),this.consume()}return h}formLigatures(n){let r=n.length-1;for(let l=0;l<r;++l){let u=n[l],h=u.text;h==="-"&&n[l+1].text==="-"&&(l+1<r&&n[l+2].text==="-"?(n.splice(l,3,{type:"textord",mode:"text",loc:Oe.range(u,n[l+2]),text:"---"}),r-=2):(n.splice(l,2,{type:"textord",mode:"text",loc:Oe.range(u,n[l+1]),text:"--"}),r-=1)),h!=="'"&&h!=="`"||n[l+1].text!==h||(n.splice(l,2,{type:"textord",mode:"text",loc:Oe.range(u,n[l+1]),text:h+h}),r-=1)}}parseSymbol(){let n=this.fetch(),r=n.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();let h=r.slice(5),y=h.charAt(0)==="*";if(y&&(h=h.slice(1)),h.length<2||h.charAt(0)!==h.slice(-1))throw new t(`\\verb assertion failed --
|
|
97
|
-
please report what input caused this bug`);return h=h.slice(1,-1),{type:"verb",mode:"text",body:h,star:y}}if(Object.prototype.hasOwnProperty.call(
|
|
95
|
+
?)[ \r ]*|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${zt}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${zt}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Ft}|\\\\[^\uD800-\uDFFF])`;class Mo{constructor(n,r){this.input=n,this.settings=r,this.tokenRegex=new RegExp(Ks,"g"),this.catcodes={"%":14,"~":13}}setCatcode(n,r){this.catcodes[n]=r}lex(){let n=this.input,r=this.tokenRegex.lastIndex;if(r===n.length)return new st("EOF",new Be(this,r,r));let l=this.tokenRegex.exec(n);if(l===null||l.index!==r)throw new t(`Unexpected character: '${n[r]}'`,new st(n[r],new Be(this,r,r+1)));let u=l[6]||l[3]||(l[2]?"\\ ":" ");if(this.catcodes[u]===14){let h=n.indexOf(`
|
|
96
|
+
`,this.tokenRegex.lastIndex);if(h===-1){if(this.tokenRegex.lastIndex=n.length,this.settings.strict)throw new t("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=h+1;return this.lex()}return new st(u,new Be(this,r,this.tokenRegex.lastIndex))}}class dl{constructor(n={},r={}){this.current=r,this.builtins=n,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new t("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");let n=this.undefStack.pop();for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&(n[r]===void 0?delete this.current[r]:this.current[r]=n[r])}has(n){return Object.prototype.hasOwnProperty.call(this.current,n)||Object.prototype.hasOwnProperty.call(this.builtins,n)}get(n){return Object.prototype.hasOwnProperty.call(this.current,n)?this.current[n]:this.builtins[n]}set(n,r,l=!1){if(l){for(let u=0;u<this.undefStack.length;u++)delete this.undefStack[u][n];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][n]=r)}else{let u=this.undefStack[this.undefStack.length-1];u&&!Object.prototype.hasOwnProperty.call(u,n)&&(u[n]=this.current[n])}this.current[n]=r}}let Oo={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class ul{constructor(n,r,l){this.settings=r,this.expansionCount=0,this.feed(n),this.macros=new dl(Bt,r.macros),this.mode=l,this.stack=[]}feed(n){this.lexer=new Mo(n,this.settings)}switchMode(n){this.mode=n}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(n){this.stack.push(n)}pushTokens(n){this.stack.push(...n)}scanArgument(n){let r,l,u;if(n){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:u,end:l}=this.consumeArg(["]"])}else({tokens:u,start:r,end:l}=this.consumeArg());return this.pushToken(new st("EOF",l.loc)),this.pushTokens(u),new st("",Be.range(r,l))}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(n){let r=[],l=n&&n.length>0;l||this.consumeSpaces();let u=this.future(),h,y=0,E=0;do{if(h=this.popToken(),r.push(h),h.text==="{")++y;else if(h.text==="}"){if(--y,y===-1)throw new t("Extra }",h)}else if(h.text==="EOF")throw new t("Unexpected end of input in a macro argument, expected '"+(n&&l?n[E]:"}")+"'",h);if(n&&l)if((y===0||y===1&&n[E]==="{")&&h.text===n[E]){if(++E,E===n.length){r.splice(-E,E);break}}else E=0}while(y!==0||l);return u.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:u,end:h}}consumeArgs(n,r){if(r){if(r.length!==n+1)throw new t("The length of delimiters doesn't match the number of args!");let u=r[0];for(let h=0;h<u.length;h++){let y=this.popToken();if(u[h]!==y.text)throw new t("Use of the macro doesn't match its definition",y)}}let l=[];for(let u=0;u<n;u++)l.push(this.consumeArg(r&&r[u+1]).tokens);return l}expandOnce(n){let r=this.popToken(),l=r.text,u=r.noexpand?null:this._getExpansion(l);if(u==null||n&&u.unexpandable){if(n&&u==null&&l[0]==="\\"&&!this.isDefined(l))throw new t("Undefined control sequence: "+l);return this.pushToken(r),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new t("Too many expansions: infinite loop or need to increase maxExpand setting");let h=u.tokens,y=this.consumeArgs(u.numArgs,u.delimiters);if(u.numArgs){h=h.slice();for(let E=h.length-1;E>=0;--E){let U=h[E];if(U.text==="#"){if(E===0)throw new t("Incomplete placeholder at end of macro body",U);if(U=h[--E],U.text==="#")h.splice(E+1,1);else{if(!/^[1-9]$/.test(U.text))throw new t("Not a valid argument number",U);h.splice(E,2,...y[+U.text-1])}}}}return this.pushTokens(h),h.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let n=this.stack.pop();return n.treatAsRelax&&(n.text="\\relax"),n}throw new Error}expandMacro(n){return this.macros.has(n)?this.expandTokens([new st(n)]):void 0}expandTokens(n){let r=[],l=this.stack.length;for(this.pushTokens(n);this.stack.length>l;)if(this.expandOnce(!0)===!1){let u=this.stack.pop();u.treatAsRelax&&(u.noexpand=!1,u.treatAsRelax=!1),r.push(u)}return r}expandMacroAsText(n){let r=this.expandMacro(n);return r&&r.map(l=>l.text).join("")}_getExpansion(n){let r=this.macros.get(n);if(r==null)return r;if(n.length===1){let u=this.lexer.catcodes[n];if(u!=null&&u!==13)return}let l=typeof r=="function"?r(this):r;if(typeof l=="string"){let u=0;if(l.indexOf("#")!==-1){let U=l.replace(/##/g,"");for(;U.indexOf("#"+(u+1))!==-1;)++u}let h=new Mo(l,this.settings),y=[],E=h.lex();for(;E.text!=="EOF";)y.push(E),E=h.lex();return y.reverse(),{tokens:y,numArgs:u}}return l}isDefined(n){return this.macros.has(n)||Object.prototype.hasOwnProperty.call(Dt,n)||Object.prototype.hasOwnProperty.call(Y.math,n)||Object.prototype.hasOwnProperty.call(Y.text,n)||Object.prototype.hasOwnProperty.call(Oo,n)}isExpandable(n){let r=this.macros.get(n);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Object.prototype.hasOwnProperty.call(Dt,n)&&!Dt[n].primitive}}let Lo=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,ms=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"}),Ro=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 Ws={"\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"}},Io={\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 pl=["bin","op","open","punct","rel"],hl=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,ml=/^ *\\text/;class Wr{constructor(n,r,l=!1){this.mode="math",this.gullet=new ul(n,r,this.mode),this.settings=r,this.isPreamble=l,this.leftrightDepth=0,this.prevAtomType=""}expect(n,r=!0){if(this.fetch().text!==n)throw new t(`Expected '${n}', got '${this.fetch().text}'`,this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(n){this.mode=n,this.gullet.switchMode(n)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");let n=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){let l=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([u,h])=>{l[u]=h}),this.gullet.endGroup(),l}let r=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),r&&(this.gullet.macros.current["\\df@tag"]=r),n}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(n){let r=this.nextToken;this.consume(),this.gullet.pushToken(new st("}")),this.gullet.pushTokens(n);let l=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,l}parseExpression(n,r,l){let u=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();let h=this.fetch();if(Wr.endOfExpression.indexOf(h.text)!==-1||r&&h.text===r||l&&h.text==="\\middle"||n&&Dt[h.text]&&Dt[h.text].infix)break;let y=this.parseAtom(r);if(!y)break;y.type!=="internal"&&(u.push(y),this.prevAtomType=y.type==="atom"?y.family:y.type)}return this.mode==="text"&&this.formLigatures(u),this.handleInfixNodes(u)}handleInfixNodes(n){let r,l=-1;for(let u=0;u<n.length;u++)if(n[u].type==="infix"){if(l!==-1)throw new t("only one infix operator per group",n[u].token);l=u,r=n[u].replaceWith}if(l!==-1&&r){let u,h,y=n.slice(0,l),E=n.slice(l+1),U;return u=y.length===1&&y[0].type==="ordgroup"?y[0]:{type:"ordgroup",mode:this.mode,body:y},h=E.length===1&&E[0].type==="ordgroup"?E[0]:{type:"ordgroup",mode:this.mode,body:E},U=r==="\\\\abovefrac"?this.callFunction(r,[u,n[l],h],[]):this.callFunction(r,[u,h],[]),[U]}return n}handleSupSubscript(n){let r=this.fetch(),l=r.text,u;this.consume(),this.consumeSpaces();do u=this.parseGroup(n);while(u.type&&u.type==="internal");if(!u)throw new t("Expected group after '"+l+"'",r);return u}formatUnsupportedCmd(n){let r=[];for(let u=0;u<n.length;u++)r.push({type:"textord",mode:"text",text:n[u]});let l={type:"text",mode:this.mode,body:r};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[l]}}parseAtom(n){let r=this.parseGroup("atom",n);if(r&&r.type==="internal"||this.mode==="text")return r;let l,u;for(;;){this.consumeSpaces();let h=this.fetch();if(h.text==="\\limits"||h.text==="\\nolimits"){if(r&&r.type==="op"){let y=h.text==="\\limits";r.limits=y,r.alwaysHandleSupSub=!0}else{if(!r||r.type!=="operatorname")throw new t("Limit controls must follow a math operator",h);r.alwaysHandleSupSub&&(r.limits=h.text==="\\limits")}this.consume()}else if(h.text==="^"){if(l)throw new t("Double superscript",h);l=this.handleSupSubscript("superscript")}else if(h.text==="_"){if(u)throw new t("Double subscript",h);u=this.handleSupSubscript("subscript")}else if(h.text==="'"){if(l)throw new t("Double superscript",h);let y={type:"textord",mode:this.mode,text:"\\prime"},E=[y];for(this.consume();this.fetch().text==="'";)E.push(y),this.consume();this.fetch().text==="^"&&E.push(this.handleSupSubscript("superscript")),l={type:"ordgroup",mode:this.mode,body:E}}else{if(!ms[h.text])break;{let y=Lo.test(h.text),E=[];for(E.push(new st(ms[h.text])),this.consume();;){let V=this.fetch().text;if(!ms[V]||Lo.test(V)!==y)break;E.unshift(new st(ms[V])),this.consume()}let U=this.subparse(E);y?u={type:"ordgroup",mode:"math",body:U}:l={type:"ordgroup",mode:"math",body:U}}}}if(l||u){if(r&&r.type==="multiscript"&&!r.postscripts)return r.postscripts={sup:l,sub:u},r;{let h=!r||r.type!=="op"&&r.type!=="operatorname"?void 0:hn(this.nextToken.text);return{type:"supsub",mode:this.mode,base:r,sup:l,sub:u,isFollowedByDelimiter:h}}}return r}parseFunction(n,r){let l=this.fetch(),u=l.text,h=Dt[u];if(!h)return null;if(this.consume(),r&&r!=="atom"&&!h.allowedInArgument)throw new t("Got function '"+u+"' with no arguments"+(r?" as "+r:""),l);if(this.mode==="text"&&!h.allowedInText)throw new t("Can't use function '"+u+"' in text mode",l);if(this.mode==="math"&&h.allowedInMath===!1)throw new t("Can't use function '"+u+"' in math mode",l);let y=this.prevAtomType,{args:E,optArgs:U}=this.parseArguments(u,h);return this.prevAtomType=y,this.callFunction(u,E,U,l,n)}callFunction(n,r,l,u,h){let y={funcName:n,parser:this,token:u,breakOnTokenText:h},E=Dt[n];if(E&&E.handler)return E.handler(y,r,l);throw new t(`No function handler for ${n}`)}parseArguments(n,r){let l=r.numArgs+r.numOptionalArgs;if(l===0)return{args:[],optArgs:[]};let u=[],h=[];for(let y=0;y<l;y++){let E=r.argTypes&&r.argTypes[y],U=y<r.numOptionalArgs;(r.primitive&&E==null||r.type==="sqrt"&&y===1&&h[0]==null)&&(E="primitive");let V=this.parseGroupOfType(`argument to '${n}'`,E,U);if(U)h.push(V);else{if(V==null)throw new t("Null argument, please report this as a bug");u.push(V)}}return{args:u,optArgs:h}}parseGroupOfType(n,r,l){switch(r){case"size":return this.parseSizeGroup(l);case"url":return this.parseUrlGroup(l);case"math":case"text":return this.parseArgumentGroup(l,r);case"hbox":{let u=this.parseArgumentGroup(l,"text");return u!=null?{type:"styling",mode:u.mode,body:[u],scriptLevel:"text"}:null}case"raw":{let u=this.parseStringGroup("raw",l);return u!=null?{type:"raw",mode:"text",string:u.text}:null}case"primitive":{if(l)throw new t("A primitive argument cannot be optional");let u=this.parseGroup(n);if(u==null)throw new t("Expected group as "+n,this.fetch());return u}case"original":case null:case void 0:return this.parseArgumentGroup(l);default:throw new t("Unknown group type as "+n,this.fetch())}}consumeSpaces(){for(;;){let n=this.fetch().text;if(n!==" "&&n!=="\xA0"&&n!=="\uFE0E")break;this.consume()}}parseStringGroup(n,r){let l=this.gullet.scanArgument(r);if(l==null)return null;let u,h="";for(;(u=this.fetch()).text!=="EOF";)h+=u.text,this.consume();return this.consume(),l.text=h,l}parseRegexGroup(n,r){let l=this.fetch(),u,h=l,y="";for(;(u=this.fetch()).text!=="EOF"&&n.test(y+u.text);)h=u,y+=h.text,this.consume();if(y==="")throw new t("Invalid "+r+": '"+l.text+"'",l);return l.range(h,y)}parseSizeGroup(n){let r,l=!1;if(this.gullet.consumeSpaces(),r=n||this.gullet.future().text==="{"?this.parseStringGroup("size",n):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!r)return null;n||r.text.length!==0||(r.text="0pt",l=!0);let u=hl.exec(r.text);if(!u)throw new t("Invalid size: '"+r.text+"'",r);let h={number:+(u[1]+u[2]),unit:u[3]};if(!pn(h))throw new t("Invalid unit: '"+h.unit+"'",r);return{type:"size",mode:this.mode,value:h,isBlank:l}}parseUrlGroup(n){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);let r=this.parseStringGroup("url",n);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;let l=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return l=r.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:l}}parseArgumentGroup(n,r){let l=this.gullet.scanArgument(n);if(l==null)return null;let u=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();let h=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();let y={type:"ordgroup",mode:this.mode,loc:l.loc,body:h};return r&&this.switchMode(u),y}parseGroup(n,r){let l=this.fetch(),u=l.text;if(n==="argument to '\\left'")return this.parseSymbol();let h;if(u==="{"||u==="\\begingroup"||u==="\\toggle"){this.consume();let y=u==="{"?"}":u==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let E=this.parseExpression(!1,y),U=this.fetch();this.expect(y),this.gullet.endGroup(),h={type:U.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:Be.range(l,U),body:E,semisimple:u==="\\begingroup"||void 0}}else if(h=this.parseFunction(r,n)||this.parseSymbol(),h==null&&u[0]==="\\"&&!Object.prototype.hasOwnProperty.call(Oo,u)){if(this.settings.throwOnError)throw new t("Unsupported function name: "+u,l);h=this.formatUnsupportedCmd(u),this.consume()}return h}formLigatures(n){let r=n.length-1;for(let l=0;l<r;++l){let u=n[l],h=u.text;h==="-"&&n[l+1].text==="-"&&(l+1<r&&n[l+2].text==="-"?(n.splice(l,3,{type:"textord",mode:"text",loc:Be.range(u,n[l+2]),text:"---"}),r-=2):(n.splice(l,2,{type:"textord",mode:"text",loc:Be.range(u,n[l+1]),text:"--"}),r-=1)),h!=="'"&&h!=="`"||n[l+1].text!==h||(n.splice(l,2,{type:"textord",mode:"text",loc:Be.range(u,n[l+1]),text:h+h}),r-=1)}}parseSymbol(){let n=this.fetch(),r=n.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();let h=r.slice(5),y=h.charAt(0)==="*";if(y&&(h=h.slice(1)),h.length<2||h.charAt(0)!==h.slice(-1))throw new t(`\\verb assertion failed --
|
|
97
|
+
please report what input caused this bug`);return h=h.slice(1,-1),{type:"verb",mode:"text",body:h,star:y}}if(Object.prototype.hasOwnProperty.call(Io,r[0])&&this.mode==="math"&&!Y[this.mode][r[0]]){if(this.settings.strict&&this.mode==="math")throw new t(`Accented Unicode text character "${r[0]}" used in math mode`,n);r=Io[r[0]]+r.slice(1)}let l=this.mode==="math"?On.exec(r):null,u;if(l&&(r=r.substring(0,l.index),r==="i"?r="\u0131":r==="j"&&(r="\u0237")),Y[this.mode][r]){let h=Y[this.mode][r].group;h!=="bin"||!pl.includes(this.prevAtomType)&&this.prevAtomType!==""||(h="open");let y=Be.range(n),E;if(Object.prototype.hasOwnProperty.call(le,h)){let U=h;E={type:"atom",mode:this.mode,family:U,loc:y,text:r},U!=="rel"&&U!=="bin"||this.prevAtomType!=="text"||ml.test(y.lexer.input.slice(y.end))&&(E.needsSpacing=!0)}else{if(Ro[r]){this.consume();let U=this.fetch().text.charCodeAt(0),V=U===65025?"mathscr":"mathcal";return U!==65024&&U!==65025||this.consume(),{type:"font",mode:"math",font:V,body:{type:"mathord",mode:"math",loc:y,text:Ro[r]}}}E={type:h,mode:this.mode,loc:y,text:r}}u=E}else{if(!(r.charCodeAt(0)>=128||On.exec(r)))return null;if(this.settings.strict&&this.mode==="math")throw new t(`Unicode text character "${r[0]}" used in math mode`,n);u={type:"textord",mode:"text",loc:Be.range(n),text:r}}if(this.consume(),l)for(let h=0;h<l[0].length;h++){let y=l[0][h];if(!Ws[y])throw new t(`Unknown accent ' ${y}'`,n);let E=Ws[y][this.mode]||Ws[y].text;if(!E)throw new t(`Accent ${y} unsupported in ${this.mode} mode`,n);u={type:"accent",mode:this.mode,loc:Be.range(n),label:E,isStretchy:!1,base:u}}return u}}let Po=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let r,l;try{l=new Wr(e,n),delete l.gullet.macros.current["\\df@tag"],r=l.parse()}catch(u){if(u.toString()!=="ParseError: Unmatched delimiter")throw u;n.wrapDelimiterPairs=!1,l=new Wr(e,n),delete l.gullet.macros.current["\\df@tag"],r=l.parse()}if(!(r.length>0&&r[0].type&&r[0].type==="array"&&r[0].addEqnNum)&&l.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new t("\\tag works only in display mode");l.gullet.feed("\\df@tag"),r=[{type:"tag",mode:"text",body:r,tag:l.parse()}]}return r},fl=[2,2,3,3];class Vs{constructor(n){this.level=n.level,this.color=n.color,this.font=n.font||"",this.fontFamily=n.fontFamily||"",this.fontSize=n.fontSize||1,this.fontWeight=n.fontWeight||"",this.fontShape=n.fontShape||"",this.maxSize=n.maxSize}extend(n){let r={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 l in n)Object.prototype.hasOwnProperty.call(n,l)&&(r[l]=n[l]);return new Vs(r)}withLevel(n){return this.extend({level:n})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:fl[this.level]})}withColor(n){return this.extend({color:n})}withFont(n){return this.extend({font:n})}withTextFontFamily(n){return this.extend({fontFamily:n,font:""})}withFontSize(n){return this.extend({fontSize:n})}withTextFontWeight(n){return this.extend({fontWeight:n,font:""})}withTextFontShape(n){return this.extend({fontShape:n,font:""})}getColor(){return this.color}}function Bo(e){let n={},r=0,l=document.getElementsByClassName("tml-eqn");for(let h of l)for(r+=1,h.setAttribute("id","tml-eqn-"+String(r));h.tagName!=="mtable";){if(h.getElementsByClassName("tml-label").length>0){let y=h.attributes.id.value;n[y]=String(r);break}h=h.parentElement}let u=document.getElementsByClassName("tml-tageqn");for(let h of u)if(h.getElementsByClassName("tml-label").length>0){let y=h.getElementsByClassName("tml-tag");if(y.length>0){let E=h.attributes.id.value;n[E]=y[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(h=>{let y=h.getAttribute("href"),E=n[y.slice(1)];h.className.indexOf("tml-eqref")===-1?(E=E.replace(/^\(/,""),E=E.replace(/\)$/,"")):(E.charAt(0)!=="("&&(E="("+E),E.slice(-1)!==")"&&(E+=")"));let U=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");U.appendChild(document.createTextNode(E));let V=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");V.appendChild(U),h.textContent="",h.appendChild(V)})}let gl=function(e,n,r){let l=r,u=0,h=e.length;for(;l<n.length;){let y=n[l];if(u<=0&&n.slice(l,l+h)===e)return l;y==="\\"?l++:y==="{"?u++:y==="}"&&u--,l++}return-1},bl=/^\\(?:begin|(?:eq)?ref){/,Do=[{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}],fs={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},Zs=[{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}],yl=function(e,n){let r=function(u,h){let y,E=[],U=new RegExp("("+h.map(V=>V.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;y=u.search(U),y!==-1;){y>0&&(E.push({type:"text",data:u.slice(0,y)}),u=u.slice(y));let V=h.findIndex(de=>u.startsWith(de.left));if(y=gl(h[V].right,u,h[V].left.length),y===-1)break;let be=u.slice(0,y+h[V].right.length),Te=bl.test(be)?be:u.slice(h[V].left.length,y);E.push({type:"math",data:Te,rawData:be,display:h[V].display}),u=u.slice(y+h[V].right.length)}return u!==""&&E.push({type:"text",data:u}),E}(e,n.delimiters);if(r.length===1&&r[0].type==="text")return null;let l=document.createDocumentFragment();for(let u=0;u<r.length;u++)if(r[u].type==="text")l.appendChild(document.createTextNode(r[u].data));else{let h=document.createElement("span"),y=r[u].data;n.displayMode=r[u].display;try{n.preProcess&&(y=n.preProcess(y)),li.render(y,h,n)}catch(E){if(!(E instanceof t))throw E;n.errorCallback("Temml auto-render: Failed to parse `"+r[u].data+"` with ",E),l.appendChild(document.createTextNode(r[u].rawData));continue}l.appendChild(h)}return l},qo=function(e,n){for(let r=0;r<e.childNodes.length;r++){let l=e.childNodes[r];if(l.nodeType===3){let u=yl(l.textContent,n);u&&(r+=u.childNodes.length-1,e.replaceChild(u,l))}else if(l.nodeType===1){let u=" "+l.className+" ";n.ignoredTags.indexOf(l.nodeName.toLowerCase())===-1&&n.ignoredClasses.every(h=>u.indexOf(" "+h+" ")===-1)&&qo(l,n)}}},Fo=function(e,n,r={}){n.textContent="";let l=n.tagName.toLowerCase()==="math";l&&(r.wrap="none");let u=Js(e,r);l||u.children.length>1?(n.textContent="",u.children.forEach(h=>{n.appendChild(h.toNode())})):n.appendChild(u.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."),Fo=function(){throw new t("Temml doesn't work in quirks mode.")});let Js=function(e,n){let r=new P(n);try{let l=Po(e,r);return Pt(l,e,new Vs({level:r.displayMode?wt:Mt,maxSize:r.maxSize}),r)}catch(l){return function(u,h,y){if(y.throwOnError||!(u instanceof t))throw u;let E=new Ve(["temml-error"],[new $e(h+`
|
|
98
98
|
|
|
99
|
-
`+u.toString())]);return x.style.color=y.errorColor,x.style.whiteSpace="pre-line",x}(l,e,r)}};return{version:"0.13.3",render:Io,renderToString:function(e,n){return Zs(e,n).toMarkup()},renderMathInElement:function(e,n){if(!e)throw new Error("No element provided to render");let r={};for(let l in n)Object.prototype.hasOwnProperty.call(n,l)&&(r[l]=n[l]);r.fences?r.delimiters=(l=>l==="$"||l==="("?ms[l]:l==="$+"||l==="(+"?ms[l.slice(0,1)].concat(Vs):l==="ams"?Vs:l==="all"?ms["("].concat(ms.$).concat(Vs):Lo)(r.fences):r.delimiters=r.delimiters||Lo,r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},Ro(e,r),Oo(e)},postProcess:Oo,ParseError:t,definePreamble:function(e,n){let r=new P(n);if(r.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let l=new Kr(e,r,!0);return delete l.gullet.macros.current["\\df@tag"],l.parse()},__parse:function(e,n){let r=new P(n);return Mo(e,r)},__renderToMathMLTree:Zs,__defineSymbol:s,__defineMacro:L}}(),si=ri;function Ul(t,o){return si.renderToString(t,{displayMode:o,throwOnError:!1})}function Hl(t,o){let a=o;for(;(a=t.indexOf("$$",a))!==-1;){if(t[a-1]!=="\\")return a;a+=1}return-1}function jl(t){let o=[],a="",c=()=>{a&&(o.push({type:"text",value:a}),a="")},d=0;for(;d<t.length;){let p=t[d];if(p==="\\"){let g=t[d+1];if(g==="$"){a+="$",d+=2;continue}if(g==="("){let m=t.indexOf("\\)",d+2);if(m!==-1){c(),o.push({type:"math",tex:t.slice(d+2,m),display:!1}),d=m+2;continue}}a+=g===void 0?p:p+g,d+=g===void 0?1:2;continue}if(p==="$"&&t[d+1]==="$"){let g=Hl(t,d+2);if(g!==-1){c(),o.push({type:"math",tex:t.slice(d+2,g),display:!0}),d=g+2;continue}}a+=p,d+=1}return c(),o}var Gl="code, pre, script, style, svg, aside, math";function Kl(t){let o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:c=>c.parentElement&&c.parentElement.closest(Gl)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),a=[];for(let c=o.nextNode();c;c=o.nextNode())(c.nodeValue.includes("$")||c.nodeValue.includes("\\("))&&a.push(c);for(let c of a){let d=jl(c.nodeValue);if(d.length===1&&d[0].type==="text"&&d[0].value===c.nodeValue)continue;let p=document.createDocumentFragment();for(let g of d)if(g.type==="text")p.appendChild(document.createTextNode(g.value));else{let m=document.createElement("span");m.innerHTML=Ul(g.tex,g.display),p.appendChild(m.firstElementChild??document.createTextNode(""))}c.parentNode.replaceChild(p,c)}}function oi(t){t.querySelectorAll("section[data-math]").forEach(o=>Kl(o))}ge();be();ge();be();var _i=fl(Ai(),1);var Gt=_i.default;ge();be();function Ti(t){let o=t.regex,a=t.COMMENT("--","$"),c={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},d={begin:/"/,end:/"/,contains:[{match:/""/}]},p=["true","false","unknown"],g=["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"],w=["add","asc","collation","desc","final","first","last","view"],E=["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"],P=["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"],$=["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"],_=S,C=[...E,...w].filter(Re=>!S.includes(Re)),I={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},Se={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},de={match:o.concat(/\b/,o.either(..._),/\s*\(/),relevance:0,keywords:{built_in:_}};function $e(Re){return o.concat(/\b/,o.either(...Re.map(Fe=>Fe.replace(/\s+/,"\\s+"))),/\b/)}let te={scope:"keyword",match:$e($),relevance:0};function ae(Re,{exceptions:Fe,when:je}={}){let _e=je;return Fe=Fe||[],Re.map(Ae=>Ae.match(/\|\d+$/)||Fe.includes(Ae)?Ae:_e(Ae)?`${Ae}|0`:Ae)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:ae(C,{when:Re=>Re.length<3}),literal:p,type:m,built_in:P},contains:[{scope:"type",match:$e(g)},te,de,I,c,d,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,a,Se]}}ge();be();var $i="[A-Za-z$_][0-9A-Za-z$_]*",Pc=["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"],Bc=["true","false","null","undefined","NaN","Infinity"],Ci=["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"],Ni=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Mi=["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"],qc=[].concat(Mi,Ci,Ni);function Oi(t){let o=t.regex,a=(ne,{after:fe})=>{let ue="</"+ne[0].slice(1);return ne.input.indexOf(ue,fe)!==-1},c=$i,d={begin:"<>",end:"</>"},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,g={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(ne,fe)=>{let ue=ne[0].length+ne.index,Ie=ne.input[ue];if(Ie==="<"||Ie===","){fe.ignoreMatch();return}Ie===">"&&(a(ne,{after:ue})||fe.ignoreMatch());let Q,s=ne.input.substring(ue);if(Q=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Q=s.match(/^\s+extends\s+/))&&Q.index===0){fe.ignoreMatch();return}}},m={$pattern:$i,keyword:Pc,literal:Bc,built_in:qc,"variable.language":Dc},w="[0-9](_?[0-9])*",E=`\\.(${w})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${S})((${E})|\\.)?|(${E}))[eE][+-]?(${w})\\b`},{begin:`\\b(${S})\\b((${E})\\b|\\.)?|(${E})\\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},$={className:"subst",begin:"\\$\\{",end:"\\}",keywords:m,contains:[]},_={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,$],subLanguage:"xml"}},C={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,$],subLanguage:"css"}},I={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,$],subLanguage:"graphql"}},Se={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,$]},$e={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:c+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},te=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,_,C,I,Se,{match:/\$\d+/},P];$.contains=te.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(te)});let ae=[].concat($e,$.contains),Re=ae.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(ae)}]),Fe={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Re},je={variants:[{match:[/class/,/\s+/,c,/\s+/,/extends/,/\s+/,o.concat(c,"(",o.concat(/\./,c),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,c],scope:{1:"keyword",3:"title.class"}}]},_e={relevance:0,match:o.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:{_:[...Ci,...Ni]}},Ae={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},st={variants:[{match:[/function/,/\s+/,c,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[Fe],illegal:/%/},bt={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function T(ne){return o.concat("(?!",ne.join("|"),")")}let Ke={match:o.concat(/\b/,T([...Mi,"super","import"].map(ne=>`${ne}\\s*\\(`)),c,o.lookahead(/\s*\(/)),className:"title.function",relevance:0},mt={begin:o.concat(/\./,o.lookahead(o.concat(c,/(?![0-9A-Za-z$_(])/))),end:c,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},dt={match:[/get|set/,/\s+/,c,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},Fe]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,c,/\s*/,/=\s*/,/(async\s*)?/,o.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[Fe]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:m,exports:{PARAMS_CONTAINS:Re,CLASS_REFERENCE:_e},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),Ae,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,_,C,I,Se,$e,{match:/\$\d+/},P,_e,{scope:"attr",match:c+o.lookahead(":"),relevance:0},J,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[$e,t.REGEXP_MODE,{className:"function",begin:G,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:m,contains:Re}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:d.begin,end:d.end},{match:p},{begin:g.begin,"on:begin":g.isTrulyOpeningTag,end:g.end}],subLanguage:"xml",contains:[{begin:g.begin,end:g.end,skip:!0,contains:["self"]}]}]},st,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[Fe,t.inherit(t.TITLE_MODE,{begin:c,className:"title.function"})]},{match:/\.\.\./,relevance:0},mt,{match:"\\$"+c,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[Fe]},Ke,bt,je,dt,{match:/\$[(.]/}]}}ge();be();var Es="[A-Za-z$_][0-9A-Za-z$_]*",Li=["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"],Ri=["true","false","null","undefined","NaN","Infinity"],Ii=["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"],Pi=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Bi=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Di=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],qi=[].concat(Bi,Ii,Pi);function Fc(t){let o=t.regex,a=(ne,{after:fe})=>{let ue="</"+ne[0].slice(1);return ne.input.indexOf(ue,fe)!==-1},c=Es,d={begin:"<>",end:"</>"},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,g={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(ne,fe)=>{let ue=ne[0].length+ne.index,Ie=ne.input[ue];if(Ie==="<"||Ie===","){fe.ignoreMatch();return}Ie===">"&&(a(ne,{after:ue})||fe.ignoreMatch());let Q,s=ne.input.substring(ue);if(Q=s.match(/^\s*=/)){fe.ignoreMatch();return}if((Q=s.match(/^\s+extends\s+/))&&Q.index===0){fe.ignoreMatch();return}}},m={$pattern:Es,keyword:Li,literal:Ri,built_in:qi,"variable.language":Di},w="[0-9](_?[0-9])*",E=`\\.(${w})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${S})((${E})|\\.)?|(${E}))[eE][+-]?(${w})\\b`},{begin:`\\b(${S})\\b((${E})\\b|\\.)?|(${E})\\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},$={className:"subst",begin:"\\$\\{",end:"\\}",keywords:m,contains:[]},_={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,$],subLanguage:"xml"}},C={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,$],subLanguage:"css"}},I={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,$],subLanguage:"graphql"}},Se={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,$]},$e={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:c+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},te=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,_,C,I,Se,{match:/\$\d+/},P];$.contains=te.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(te)});let ae=[].concat($e,$.contains),Re=ae.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(ae)}]),Fe={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Re},je={variants:[{match:[/class/,/\s+/,c,/\s+/,/extends/,/\s+/,o.concat(c,"(",o.concat(/\./,c),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,c],scope:{1:"keyword",3:"title.class"}}]},_e={relevance:0,match:o.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:{_:[...Ii,...Pi]}},Ae={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},st={variants:[{match:[/function/,/\s+/,c,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[Fe],illegal:/%/},bt={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function T(ne){return o.concat("(?!",ne.join("|"),")")}let Ke={match:o.concat(/\b/,T([...Bi,"super","import"].map(ne=>`${ne}\\s*\\(`)),c,o.lookahead(/\s*\(/)),className:"title.function",relevance:0},mt={begin:o.concat(/\./,o.lookahead(o.concat(c,/(?![0-9A-Za-z$_(])/))),end:c,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},dt={match:[/get|set/,/\s+/,c,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},Fe]},G="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",J={match:[/const|var|let/,/\s+/,c,/\s*/,/=\s*/,/(async\s*)?/,o.lookahead(G)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[Fe]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:m,exports:{PARAMS_CONTAINS:Re,CLASS_REFERENCE:_e},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),Ae,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,_,C,I,Se,$e,{match:/\$\d+/},P,_e,{scope:"attr",match:c+o.lookahead(":"),relevance:0},J,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[$e,t.REGEXP_MODE,{className:"function",begin:G,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:m,contains:Re}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:d.begin,end:d.end},{match:p},{begin:g.begin,"on:begin":g.isTrulyOpeningTag,end:g.end}],subLanguage:"xml",contains:[{begin:g.begin,end:g.end,skip:!0,contains:["self"]}]}]},st,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[Fe,t.inherit(t.TITLE_MODE,{begin:c,className:"title.function"})]},{match:/\.\.\./,relevance:0},mt,{match:"\\$"+c,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[Fe]},Ke,bt,je,dt,{match:/\$[(.]/}]}}function Fi(t){let o=t.regex,a=Fc(t),c=Es,d=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],p={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},g={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:d},contains:[a.exports.CLASS_REFERENCE]},m={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},w=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],E={$pattern:Es,keyword:Li.concat(w),literal:Ri,built_in:qi.concat(d),"variable.language":Di},S={className:"meta",begin:"@"+c},P=(I,Se,de)=>{let $e=I.contains.findIndex(te=>te.label===Se);if($e===-1)throw new Error("can not find mode to replace");I.contains.splice($e,1,de)};Object.assign(a.keywords,E),a.exports.PARAMS_CONTAINS.push(S);let $=a.contains.find(I=>I.scope==="attr"),_=Object.assign({},$,{match:o.concat(c,o.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,$,_]),a.contains=a.contains.concat([S,p,g,_]),P(a,"shebang",t.SHEBANG()),P(a,"use_strict",m);let C=a.contains.find(I=>I.label==="func.def");return C.relevance=0,Object.assign(a,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),a}ge();be();function zi(t){let o=t.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,c=["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:c,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"]},w={className:"meta",begin:/^(>>>|\.\.\.) /},E={className:"subst",begin:/\{/,end:/\}/,keywords:m,illegal:/#/},S={begin:/\{\{/,relevance:0},P={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,w],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,w],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,w,S,E]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,w,S,E]},{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,S,E]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,S,E]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},$="[0-9](_?[0-9])*",_=`(\\b(${$}))?\\.(${$})|\\b(${$})\\.`,C=`\\b|${c.join("|")}`,I={className:"number",relevance:0,variants:[{begin:`(\\b(${$})|(${_}))[eE][+-]?(${$})[jJ]?(?=${C})`},{begin:`(${_})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${C})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${C})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${C})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${C})`},{begin:`\\b(${$})[jJ](?=${C})`}]},Se={className:"comment",begin:o.lookahead(/# type:/),end:/$/,keywords:m,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},de={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:["self",w,I,P,t.HASH_COMMENT_MODE]}]};return E.contains=[P,I,w],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[w,I,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},P,Se,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[de]},{variants:[{match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[I,de,P]}]}}ge();be();function Ui(t){let o=t.regex,a={},c={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[a]}]};Object.assign(a,{className:"variable",variants:[{begin:o.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},c]});let d={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},p=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),g={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},m={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,a,d]};d.contains.push(m);let w={match:/\\"/},E={className:"string",begin:/'/,end:/'/},S={match:/\\'/},P={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,a]},$=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],_=t.SHEBANG({binary:`(${$.join("|")})`,relevance:10}),C={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},I=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],Se=["true","false"],de={match:/(\/[a-z._-]+)+/},$e=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],te=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],ae=["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"],Re=["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:I,literal:Se,built_in:[...$e,...te,"set","shopt",...ae,...Re]},contains:[_,t.SHEBANG(),C,P,p,g,de,m,w,E,S,a]}}ge();be();function Hi(t){let o="true false yes no null",a="[\\w#;/?:@&=+$,.~*'()[\\]]+",c={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},d={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},p={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},g={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,d]},m=t.inherit(g,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),$={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"},_={end:",",endsWithParent:!0,excludeEnd:!0,keywords:o,relevance:0},C={begin:/\{/,end:/\}/,contains:[_],illegal:"\\n",relevance:0},I={begin:"\\[",end:"\\]",contains:[_],illegal:"\\n",relevance:0},Se=[c,{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+!"+a},{className:"type",begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:o,keywords:{literal:o}},$,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},C,I,p,g],de=[...Se];return de.pop(),de.push(m),_.contains=de,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:Se}}ge();be();function ji(t){let o={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},a={match:/[{}[\],:]/,className:"punctuation",relevance:0},c=["true","false","null"],d={scope:"literal",beginKeywords:c.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:c},contains:[o,a,t.QUOTE_STRING_MODE,d,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}ge();be();var Nr="[0-9](_*[0-9])*",Ss=`\\.(${Nr})`,As="[0-9a-fA-F](_*[0-9a-fA-F])*",Gi={className:"number",variants:[{begin:`(\\b(${Nr})((${Ss})|\\.)?|(${Ss}))[eE][+-]?(${Nr})[fFdD]?\\b`},{begin:`\\b(${Nr})((${Ss})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ss})[fFdD]?\\b`},{begin:`\\b(${Nr})[fFdD]\\b`},{begin:`\\b0[xX]((${As})\\.?|(${As})?\\.(${As}))[pP][+-]?(${Nr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${As})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Ki(t,o,a){return a===-1?"":t.replace(o,c=>Ki(t,o,a-1))}function Wi(t){let o=t.regex,a="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",c=a+Ki("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),w={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"]},E={className:"meta",begin:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},S={className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:w,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+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[o.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[S,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+c+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:w,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[E,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Gi,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Gi,E]}}ge();be();function Vi(t){let p={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:p,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:p,illegal:/["']/}]}]}}ge();be();function Zi(t){let o=t.regex,a=/(r#)?/,c=o.concat(a,t.UNDERSCORE_IDENT_RE),d=o.concat(a,t.IDENT_RE),p={className:"title.function.invoke",relevance:0,begin:o.concat(/\b/,/(?!let|for|while|if|else|match\b)/,d,o.lookahead(/\s*\(/))},g="([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"],w=["true","false","Some","None","Ok","Err"],E=["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:t.IDENT_RE+"!?",type:S,keyword:m,literal:w,built_in:E},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_]+)"+g},{begin:"\\b0o([0-7_]+)"+g},{begin:"\\b0x([A-Fa-f0-9_]+)"+g},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+g}],relevance:0},{begin:[/fn/,/\s+/,c],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,c],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,c,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,c],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,c],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:E,type:S}},{className:"punctuation",begin:"->"},p]}}ge();be();function Yi(t){let o=t.regex,a=o.concat(/[\p{L}_]/u,o.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),c=/[\p{L}0-9._:-]+/u,d={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},p={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},g=t.inherit(p,{begin:/\(/,end:/\)/}),m=t.inherit(t.APOS_STRING_MODE,{className:"string"}),w=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),E={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:c,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[d]},{begin:/'/,end:/'/,contains:[d]},{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:[p,w,m,g,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[p,g,w,m]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},d,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[w]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[E],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[E],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:o.concat(/</,o.lookahead(o.concat(a,o.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:a,relevance:0,starts:E}]},{className:"tag",begin:o.concat(/<\//,o.lookahead(o.concat(a,/>/))),contains:[{className:"name",begin:a,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}ge();be();var zc=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_-]*/}}),Uc=["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"],Hc=["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"],jc=[...Uc,...Hc],Gc=["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(),Kc=["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(),Vc=["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 Xi(t){let o=t.regex,a=zc(t),c={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},d="and or not only",p=/@-?\w[\w]*(-\w+)*/,g="[a-zA-Z-][a-zA-Z0-9_-]*",m=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[a.BLOCK_COMMENT,c,a.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+g,relevance:0},a.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Kc.join("|")+")"},{begin:":(:)?("+Wc.join("|")+")"}]},a.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Vc.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[a.BLOCK_COMMENT,a.HEXCOLOR,a.IMPORTANT,a.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}]},a.FUNCTION_DISPATCH]},{begin:o.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:p},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:d,attribute:Gc.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...m,a.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+jc.join("|")+")\\b"}]}}ge();be();function Ji(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}Gt.registerLanguage("sql",Ti);Gt.registerLanguage("javascript",Oi);Gt.registerLanguage("typescript",Fi);Gt.registerLanguage("python",zi);Gt.registerLanguage("bash",Ui);Gt.registerLanguage("yaml",Hi);Gt.registerLanguage("json",ji);Gt.registerLanguage("java",Wi);Gt.registerLanguage("go",Vi);Gt.registerLanguage("rust",Zi);Gt.registerLanguage("xml",Yi);Gt.registerLanguage("css",Xi);Gt.registerLanguage("plaintext",Ji);Gt.registerAliases(["js"],{languageName:"javascript"});Gt.registerAliases(["ts"],{languageName:"typescript"});Gt.registerAliases(["shell","sh","zsh"],{languageName:"bash"});Gt.registerAliases(["html"],{languageName:"xml"});Gt.registerAliases(["text","plain"],{languageName:"plaintext"});function Zc(t,o){return t.split("|").map(a=>{if(a=a.trim(),a===""||a==="all")return Array.from({length:o},(d,p)=>p+1);let c=[];for(let d of a.split(",")){let p=d.trim().match(/^(\d+)(?:-(\d+))?$/);if(!p)continue;let g=parseInt(p[1],10),m=p[2]?parseInt(p[2],10):g;for(let w=g;w<=Math.min(m,o);w++)c.push(w)}return c})}function Yc(t){let o=[[]];for(function a(c,d){for(let p of c.childNodes)p.nodeType===Node.TEXT_NODE?p.nodeValue.split(`
|
|
100
|
-
`).forEach((m,
|
|
99
|
+
`+u.toString())]);return E.style.color=y.errorColor,E.style.whiteSpace="pre-line",E}(l,e,r)}};return{version:"0.13.3",render:Fo,renderToString:function(e,n){return Js(e,n).toMarkup()},renderMathInElement:function(e,n){if(!e)throw new Error("No element provided to render");let r={};for(let l in n)Object.prototype.hasOwnProperty.call(n,l)&&(r[l]=n[l]);r.fences?r.delimiters=(l=>l==="$"||l==="("?fs[l]:l==="$+"||l==="(+"?fs[l.slice(0,1)].concat(Zs):l==="ams"?Zs:l==="all"?fs["("].concat(fs.$).concat(Zs):Do)(r.fences):r.delimiters=r.delimiters||Do,r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},qo(e,r),Bo(e)},postProcess:Bo,ParseError:t,definePreamble:function(e,n){let r=new P(n);if(r.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let l=new Wr(e,r,!0);return delete l.gullet.macros.current["\\df@tag"],l.parse()},__parse:function(e,n){let r=new P(n);return Po(e,r)},__renderToMathMLTree:Js,__defineSymbol:s,__defineMacro:L}}(),ci=li;function Ql(t,o){return ci.renderToString(t,{displayMode:o,throwOnError:!1})}function ec(t,o){let a=o;for(;(a=t.indexOf("$$",a))!==-1;){if(t[a-1]!=="\\")return a;a+=1}return-1}function tc(t){let o=[],a="",c=()=>{a&&(o.push({type:"text",value:a}),a="")},d=0;for(;d<t.length;){let p=t[d];if(p==="\\"){let f=t[d+1];if(f==="$"){a+="$",d+=2;continue}if(f==="("){let m=t.indexOf("\\)",d+2);if(m!==-1){c(),o.push({type:"math",tex:t.slice(d+2,m),display:!1}),d=m+2;continue}}a+=f===void 0?p:p+f,d+=f===void 0?1:2;continue}if(p==="$"&&t[d+1]==="$"){let f=ec(t,d+2);if(f!==-1){c(),o.push({type:"math",tex:t.slice(d+2,f),display:!0}),d=f+2;continue}}a+=p,d+=1}return c(),o}var nc="code, pre, script, style, svg, aside, math";function rc(t){let o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:c=>c.parentElement&&c.parentElement.closest(nc)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),a=[];for(let c=o.nextNode();c;c=o.nextNode())(c.nodeValue.includes("$")||c.nodeValue.includes("\\("))&&a.push(c);for(let c of a){let d=tc(c.nodeValue);if(d.length===1&&d[0].type==="text"&&d[0].value===c.nodeValue)continue;let p=document.createDocumentFragment();for(let f of d)if(f.type==="text")p.appendChild(document.createTextNode(f.value));else{let m=document.createElement("span");m.innerHTML=Ql(f.tex,f.display),p.appendChild(m.firstElementChild??document.createTextNode(""))}c.parentNode.replaceChild(p,c)}}function di(t){t.querySelectorAll("section[data-math]").forEach(o=>rc(o))}me();fe();me();fe();var Mi=_l(Ni(),1);var Vt=Mi.default;me();fe();function Oi(t){let o=t.regex,a=t.COMMENT("--","$"),c={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},d={begin:/"/,end:/"/,contains:[{match:/""/}]},p=["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"],v=["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"],P=["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"],T=["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"],A=S,N=[...k,...v].filter(Me=>!S.includes(Me)),I={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},Se={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},pe={match:o.concat(/\b/,o.either(...A),/\s*\(/),relevance:0,keywords:{built_in:A}};function Oe(Me){return o.concat(/\b/,o.either(...Me.map(ze=>ze.replace(/\s+/,"\\s+"))),/\b/)}let re={scope:"keyword",match:Oe(T),relevance:0};function ce(Me,{exceptions:ze,when:Ve}={}){let $e=Ve;return ze=ze||[],Me.map(_e=>_e.match(/\|\d+$/)||ze.includes(_e)?_e:$e(_e)?`${_e}|0`:_e)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:ce(N,{when:Me=>Me.length<3}),literal:p,type:m,built_in:P},contains:[{scope:"type",match:Oe(f)},re,pe,I,c,d,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,a,Se]}}me();fe();var Li="[A-Za-z$_][0-9A-Za-z$_]*",Wc=["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"],Vc=["true","false","null","undefined","NaN","Infinity"],Ri=["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"],Ii=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Pi=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Zc=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Jc=[].concat(Pi,Ri,Ii);function Bi(t){let o=t.regex,a=(oe,{after:he})=>{let le="</"+oe[0].slice(1);return oe.input.indexOf(le,he)!==-1},c=Li,d={begin:"<>",end:"</>"},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(oe,he)=>{let le=oe[0].length+oe.index,Re=oe.input[le];if(Re==="<"||Re===","){he.ignoreMatch();return}Re===">"&&(a(oe,{after:le})||he.ignoreMatch());let Y,s=oe.input.substring(le);if(Y=s.match(/^\s*=/)){he.ignoreMatch();return}if((Y=s.match(/^\s+extends\s+/))&&Y.index===0){he.ignoreMatch();return}}},m={$pattern:Li,keyword:Wc,literal:Vc,built_in:Jc,"variable.language":Zc},v="[0-9](_?[0-9])*",k=`\\.(${v})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${S})((${k})|\\.)?|(${k}))[eE][+-]?(${v})\\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},T={className:"subst",begin:"\\$\\{",end:"\\}",keywords:m,contains:[]},A={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,T],subLanguage:"xml"}},N={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,T],subLanguage:"css"}},I={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,T],subLanguage:"graphql"}},Se={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,T]},Oe={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:c+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},re=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,A,N,I,Se,{match:/\$\d+/},P];T.contains=re.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(re)});let ce=[].concat(Oe,T.contains),Me=ce.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(ce)}]),ze={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Me},Ve={variants:[{match:[/class/,/\s+/,c,/\s+/,/extends/,/\s+/,o.concat(c,"(",o.concat(/\./,c),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,c],scope:{1:"keyword",3:"title.class"}}]},$e={relevance:0,match:o.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:{_:[...Ri,...Ii]}},_e={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Ze={variants:[{match:[/function/,/\s+/,c,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[ze],illegal:/%/},bt={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function _(oe){return o.concat("(?!",oe.join("|"),")")}let je={match:o.concat(/\b/,_([...Pi,"super","import"].map(oe=>`${oe}\\s*\\(`)),c,o.lookahead(/\s*\(/)),className:"title.function",relevance:0},gt={begin:o.concat(/\./,o.lookahead(o.concat(c,/(?![0-9A-Za-z$_(])/))),end:c,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ut={match:[/get|set/,/\s+/,c,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},ze]},Q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,c,/\s*/,/=\s*/,/(async\s*)?/,o.lookahead(Q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[ze]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:m,exports:{PARAMS_CONTAINS:Me,CLASS_REFERENCE:$e},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),_e,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,A,N,I,Se,Oe,{match:/\$\d+/},P,$e,{scope:"attr",match:c+o.lookahead(":"),relevance:0},j,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[Oe,t.REGEXP_MODE,{className:"function",begin:Q,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:m,contains:Me}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:d.begin,end:d.end},{match:p},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},Ze,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[ze,t.inherit(t.TITLE_MODE,{begin:c,className:"title.function"})]},{match:/\.\.\./,relevance:0},gt,{match:"\\$"+c,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[ze]},je,bt,Ve,ut,{match:/\$[(.]/}]}}me();fe();var Ss="[A-Za-z$_][0-9A-Za-z$_]*",Di=["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"],qi=["true","false","null","undefined","NaN","Infinity"],Fi=["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"],zi=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ui=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Hi=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ji=[].concat(Ui,Fi,zi);function Yc(t){let o=t.regex,a=(oe,{after:he})=>{let le="</"+oe[0].slice(1);return oe.input.indexOf(le,he)!==-1},c=Ss,d={begin:"<>",end:"</>"},p=/<[A-Za-z0-9\\._:-]+\s*\/>/,f={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(oe,he)=>{let le=oe[0].length+oe.index,Re=oe.input[le];if(Re==="<"||Re===","){he.ignoreMatch();return}Re===">"&&(a(oe,{after:le})||he.ignoreMatch());let Y,s=oe.input.substring(le);if(Y=s.match(/^\s*=/)){he.ignoreMatch();return}if((Y=s.match(/^\s+extends\s+/))&&Y.index===0){he.ignoreMatch();return}}},m={$pattern:Ss,keyword:Di,literal:qi,built_in:ji,"variable.language":Hi},v="[0-9](_?[0-9])*",k=`\\.(${v})`,S="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${S})((${k})|\\.)?|(${k}))[eE][+-]?(${v})\\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},T={className:"subst",begin:"\\$\\{",end:"\\}",keywords:m,contains:[]},A={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,T],subLanguage:"xml"}},N={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,T],subLanguage:"css"}},I={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,T],subLanguage:"graphql"}},Se={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,T]},Oe={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:c+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},re=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,A,N,I,Se,{match:/\$\d+/},P];T.contains=re.concat({begin:/\{/,end:/\}/,keywords:m,contains:["self"].concat(re)});let ce=[].concat(Oe,T.contains),Me=ce.concat([{begin:/(\s*)\(/,end:/\)/,keywords:m,contains:["self"].concat(ce)}]),ze={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:Me},Ve={variants:[{match:[/class/,/\s+/,c,/\s+/,/extends/,/\s+/,o.concat(c,"(",o.concat(/\./,c),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,c],scope:{1:"keyword",3:"title.class"}}]},$e={relevance:0,match:o.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:{_:[...Fi,...zi]}},_e={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Ze={variants:[{match:[/function/,/\s+/,c,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[ze],illegal:/%/},bt={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function _(oe){return o.concat("(?!",oe.join("|"),")")}let je={match:o.concat(/\b/,_([...Ui,"super","import"].map(oe=>`${oe}\\s*\\(`)),c,o.lookahead(/\s*\(/)),className:"title.function",relevance:0},gt={begin:o.concat(/\./,o.lookahead(o.concat(c,/(?![0-9A-Za-z$_(])/))),end:c,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ut={match:[/get|set/,/\s+/,c,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},ze]},Q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,c,/\s*/,/=\s*/,/(async\s*)?/,o.lookahead(Q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[ze]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:m,exports:{PARAMS_CONTAINS:Me,CLASS_REFERENCE:$e},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),_e,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,A,N,I,Se,Oe,{match:/\$\d+/},P,$e,{scope:"attr",match:c+o.lookahead(":"),relevance:0},j,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[Oe,t.REGEXP_MODE,{className:"function",begin:Q,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:m,contains:Me}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:d.begin,end:d.end},{match:p},{begin:f.begin,"on:begin":f.isTrulyOpeningTag,end:f.end}],subLanguage:"xml",contains:[{begin:f.begin,end:f.end,skip:!0,contains:["self"]}]}]},Ze,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[ze,t.inherit(t.TITLE_MODE,{begin:c,className:"title.function"})]},{match:/\.\.\./,relevance:0},gt,{match:"\\$"+c,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[ze]},je,bt,Ve,ut,{match:/\$[(.]/}]}}function Gi(t){let o=t.regex,a=Yc(t),c=Ss,d=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],p={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},f={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:d},contains:[a.exports.CLASS_REFERENCE]},m={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},v=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],k={$pattern:Ss,keyword:Di.concat(v),literal:qi,built_in:ji.concat(d),"variable.language":Hi},S={className:"meta",begin:"@"+c},P=(I,Se,pe)=>{let Oe=I.contains.findIndex(re=>re.label===Se);if(Oe===-1)throw new Error("can not find mode to replace");I.contains.splice(Oe,1,pe)};Object.assign(a.keywords,k),a.exports.PARAMS_CONTAINS.push(S);let T=a.contains.find(I=>I.scope==="attr"),A=Object.assign({},T,{match:o.concat(c,o.lookahead(/\s*\?:/))});a.exports.PARAMS_CONTAINS.push([a.exports.CLASS_REFERENCE,T,A]),a.contains=a.contains.concat([S,p,f,A]),P(a,"shebang",t.SHEBANG()),P(a,"use_strict",m);let N=a.contains.find(I=>I.label==="func.def");return N.relevance=0,Object.assign(a,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),a}me();fe();function Ki(t){let o=t.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,c=["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:c,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"]},v={className:"meta",begin:/^(>>>|\.\.\.) /},k={className:"subst",begin:/\{/,end:/\}/,keywords:m,illegal:/#/},S={begin:/\{\{/,relevance:0},P={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,v],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,v],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,v,S,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,v,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:[t.BACKSLASH_ESCAPE,S,k]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,S,k]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},T="[0-9](_?[0-9])*",A=`(\\b(${T}))?\\.(${T})|\\b(${T})\\.`,N=`\\b|${c.join("|")}`,I={className:"number",relevance:0,variants:[{begin:`(\\b(${T})|(${A}))[eE][+-]?(${T})[jJ]?(?=${N})`},{begin:`(${A})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${N})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${N})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${N})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${N})`},{begin:`\\b(${T})[jJ](?=${N})`}]},Se={className:"comment",begin:o.lookahead(/# type:/),end:/$/,keywords:m,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},pe={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:["self",v,I,P,t.HASH_COMMENT_MODE]}]};return k.contains=[P,I,v],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[v,I,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},P,Se,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[pe]},{variants:[{match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[I,pe,P]}]}}me();fe();function Wi(t){let o=t.regex,a={},c={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[a]}]};Object.assign(a,{className:"variable",variants:[{begin:o.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},c]});let d={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},p=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),f={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},m={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,a,d]};d.contains.push(m);let v={match:/\\"/},k={className:"string",begin:/'/,end:/'/},S={match:/\\'/},P={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,a]},T=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],A=t.SHEBANG({binary:`(${T.join("|")})`,relevance:10}),N={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},I=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],Se=["true","false"],pe={match:/(\/[a-z._-]+)+/},Oe=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],re=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],ce=["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"],Me=["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:I,literal:Se,built_in:[...Oe,...re,"set","shopt",...ce,...Me]},contains:[A,t.SHEBANG(),N,P,p,f,pe,m,v,k,S,a]}}me();fe();function Vi(t){let o="true false yes no null",a="[\\w#;/?:@&=+$,.~*'()[\\]]+",c={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},d={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},p={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},f={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,d]},m=t.inherit(f,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),T={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"},A={end:",",endsWithParent:!0,excludeEnd:!0,keywords:o,relevance:0},N={begin:/\{/,end:/\}/,contains:[A],illegal:"\\n",relevance:0},I={begin:"\\[",end:"\\]",contains:[A],illegal:"\\n",relevance:0},Se=[c,{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+!"+a},{className:"type",begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:o,keywords:{literal:o}},T,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},N,I,p,f],pe=[...Se];return pe.pop(),pe.push(m),A.contains=pe,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:Se}}me();fe();function Zi(t){let o={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},a={match:/[{}[\],:]/,className:"punctuation",relevance:0},c=["true","false","null"],d={scope:"literal",beginKeywords:c.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:c},contains:[o,a,t.QUOTE_STRING_MODE,d,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}me();fe();var Mr="[0-9](_*[0-9])*",As=`\\.(${Mr})`,_s="[0-9a-fA-F](_*[0-9a-fA-F])*",Ji={className:"number",variants:[{begin:`(\\b(${Mr})((${As})|\\.)?|(${As}))[eE][+-]?(${Mr})[fFdD]?\\b`},{begin:`\\b(${Mr})((${As})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${As})[fFdD]?\\b`},{begin:`\\b(${Mr})[fFdD]\\b`},{begin:`\\b0[xX]((${_s})\\.?|(${_s})?\\.(${_s}))[pP][+-]?(${Mr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${_s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Yi(t,o,a){return a===-1?"":t.replace(o,c=>Yi(t,o,a-1))}function Xi(t){let o=t.regex,a="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",c=a+Yi("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),v={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:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},S={className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:v,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+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[o.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[S,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+c+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:v,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:v,relevance:0,contains:[k,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Ji,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Ji,k]}}me();fe();function Qi(t){let p={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:p,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:p,illegal:/["']/}]}]}}me();fe();function ea(t){let o=t.regex,a=/(r#)?/,c=o.concat(a,t.UNDERSCORE_IDENT_RE),d=o.concat(a,t.IDENT_RE),p={className:"title.function.invoke",relevance:0,begin:o.concat(/\b/,/(?!let|for|while|if|else|match\b)/,d,o.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"],v=["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:t.IDENT_RE+"!?",type:S,keyword:m,literal:v,built_in:k},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_]+)"+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+/,c],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,c],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,c,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,c],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,c],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:k,type:S}},{className:"punctuation",begin:"->"},p]}}me();fe();function ta(t){let o=t.regex,a=o.concat(/[\p{L}_]/u,o.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),c=/[\p{L}0-9._:-]+/u,d={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},p={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},f=t.inherit(p,{begin:/\(/,end:/\)/}),m=t.inherit(t.APOS_STRING_MODE,{className:"string"}),v=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),k={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:c,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[d]},{begin:/'/,end:/'/,contains:[d]},{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:[p,v,m,f,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[p,f,v,m]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},d,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[v]},{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:o.concat(/</,o.lookahead(o.concat(a,o.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:a,relevance:0,starts:k}]},{className:"tag",begin:o.concat(/<\//,o.lookahead(o.concat(a,/>/))),contains:[{className:"name",begin:a,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}me();fe();var Xc=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_-]*/}}),Qc=["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"],ed=["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"],td=[...Qc,...ed],nd=["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(),rd=["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(),sd=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),od=["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 na(t){let o=t.regex,a=Xc(t),c={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},d="and or not only",p=/@-?\w[\w]*(-\w+)*/,f="[a-zA-Z-][a-zA-Z0-9_-]*",m=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[a.BLOCK_COMMENT,c,a.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+f,relevance:0},a.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+rd.join("|")+")"},{begin:":(:)?("+sd.join("|")+")"}]},a.CSS_VARIABLE,{className:"attribute",begin:"\\b("+od.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[a.BLOCK_COMMENT,a.HEXCOLOR,a.IMPORTANT,a.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}]},a.FUNCTION_DISPATCH]},{begin:o.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:p},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:d,attribute:nd.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...m,a.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+td.join("|")+")\\b"}]}}me();fe();function ra(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}Vt.registerLanguage("sql",Oi);Vt.registerLanguage("javascript",Bi);Vt.registerLanguage("typescript",Gi);Vt.registerLanguage("python",Ki);Vt.registerLanguage("bash",Wi);Vt.registerLanguage("yaml",Vi);Vt.registerLanguage("json",Zi);Vt.registerLanguage("java",Xi);Vt.registerLanguage("go",Qi);Vt.registerLanguage("rust",ea);Vt.registerLanguage("xml",ta);Vt.registerLanguage("css",na);Vt.registerLanguage("plaintext",ra);Vt.registerAliases(["js"],{languageName:"javascript"});Vt.registerAliases(["ts"],{languageName:"typescript"});Vt.registerAliases(["shell","sh","zsh"],{languageName:"bash"});Vt.registerAliases(["html"],{languageName:"xml"});Vt.registerAliases(["text","plain"],{languageName:"plaintext"});function id(t,o){return t.split("|").map(a=>{if(a=a.trim(),a===""||a==="all")return Array.from({length:o},(d,p)=>p+1);let c=[];for(let d of a.split(",")){let p=d.trim().match(/^(\d+)(?:-(\d+))?$/);if(!p)continue;let f=parseInt(p[1],10),m=p[2]?parseInt(p[2],10):f;for(let v=f;v<=Math.min(m,o);v++)c.push(v)}return c})}function ad(t){let o=[[]];for(function a(c,d){for(let p of c.childNodes)p.nodeType===Node.TEXT_NODE?p.nodeValue.split(`
|
|
100
|
+
`).forEach((m,v)=>{v>0&&o.push([]),m&&o[o.length-1].push({path:d,text:m})}):p.nodeType===Node.ELEMENT_NODE&&a(p,[...d,p])}(t,[]);o.length&&o[o.length-1].length===0;)o.pop();t.textContent="";for(let a of o){let c=document.createElement("span");c.className="code-line";for(let{path:d,text:p}of a){let f=c;for(let m of d){let v=f.lastChild;v&&v.__orig===m||(v=m.cloneNode(!1),v.__orig=m,f.appendChild(v)),f=v}f.appendChild(document.createTextNode(p))}t.appendChild(c)}return t.querySelectorAll(":scope > .code-line")}function ld(t,o){if(t.length===o)return"all lines";let a=[...t],c=[],d=a[0],p=a[0];for(let f of a.slice(1)){if(f===p+1){p=f;continue}c.push(d===p?`${d}`:`${d}-${p}`),d=p=f}return c.push(d===p?`${d}`:`${d}-${p}`),`lines ${c.join(",")}`}function sa(t,o){t.querySelectorAll("pre > code").forEach(a=>{let c=[...a.classList].find(S=>S.startsWith("language-")),d=c?c.slice(9):null,p=a.textContent.replace(/^\n/,"").replace(/\s+$/,"");d&&Vt.getLanguage(d)?a.innerHTML=Vt.highlight(p,{language:d}).value:a.textContent=p,a.classList.add("hljs");let f=a.parentElement,m=ad(a);f.hasAttribute("data-lines-numbers")&&f.classList.add("line-numbers");let v=f.getAttribute("data-lines");if(!v)return;let k=id(v,m.length);f.classList.add("stepping"),o(f,{count:k.length,label:S=>S===0?"code":ld(k[S-1],m.length),apply(S){if(m.forEach(A=>A.classList.remove("line-hl","line-dim")),S===0)return;let P=new Set(k[S-1]),T=P.size===m.length;m.forEach((A,N)=>{P.has(N+1)?A.classList.add("line-hl"):T||A.classList.add("line-dim")})}})})}me();fe();me();fe();function kn(t,o=null){try{let a=localStorage.getItem(t);return a??o}catch{return o}}function Bn(t,o=null){try{let a=localStorage.getItem(t);if(a==null)return o;let c=JSON.parse(a);return c??o}catch{return o}}function fn(t,o){try{return o==null?localStorage.removeItem(t):localStorage.setItem(t,String(o)),!0}catch{return!1}}function Dn(t,o){return fn(t,JSON.stringify(o))}var cd=/⟨CLICK⟩|<CLICK>|<click(?:\s[^>]*)?>(?:<\/click>)?/gi,aa=()=>"decklight-timings:"+(typeof location<"u"?location.pathname:"");function dd(t,o=null){let a=t.map(c=>{let d=Number(c?.dataset?.timing);return Number.isFinite(d)&&d>0?d:null});return a.some(c=>c!=null)||!o?a:t.map((c,d)=>{let p=Number(o[d]);return Number.isFinite(p)&&p>0?p:null})}function oa(t){return(t||"").split(cd)}function Ts(t){let o="width=1100,height=700",a=window.open("","decklight-speaker",o);if(!a)return null;let c=!1;try{c=a.document.body?a.document.body.childNodes.length>0:!1}catch{c=!0}if(c){try{a.close()}catch{}if(a=window.open("","decklight-speaker",o),!a)return null;try{a.document}catch{return null}}let d=()=>{let f=new URL(location.href);return f.searchParams.set("embedded",""),f.hash="",f.href};window.__decklightBridge={subscribe(f){t.__speakerCb=f},async saveTimings(f){let m=f.map((v,k)=>({slide:k+1,seconds:Math.round(v||0)})).filter(v=>v.seconds>0);return t.__saveTimings?(await t.__saveTimings(m),"deck"):(Dn(aa(),f.map(v=>Math.round(v||0))),"browser")},getState:()=>ia(t,d()),next:()=>t.next(),prev:()=>t.prev()},t.__notifySpeaker=()=>{t.__speakerCb&&!a.closed&&t.__speakerCb(ia(t,d()))};let p=`${t.config.width} / ${t.config.height}`;return a.document.write(`<!doctype html><html><head><meta charset="utf-8">
|
|
101
101
|
<title>Decklight \u2014 speaker view</title>
|
|
102
102
|
<style>
|
|
103
103
|
body { margin:0; background:#111; color:#eee; font:14px/1.5 -apple-system, system-ui, sans-serif;
|
|
@@ -113,6 +113,9 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
113
113
|
width:min(70vw,70vh); height:min(70vw,70vh); z-index:10; cursor:zoom-out;
|
|
114
114
|
box-shadow:0 0 0 100vmax rgba(0,0,0,.8); }
|
|
115
115
|
#timer { font-size:22px; font-variant-numeric:tabular-nums; }
|
|
116
|
+
.pace { font-variant-numeric:tabular-nums; opacity:.8; }
|
|
117
|
+
.pace.over { color:#e5484d; opacity:1; }
|
|
118
|
+
#rec.on { background:#e5484d; color:#fff; }
|
|
116
119
|
#pos { color:#999; }
|
|
117
120
|
button { background:#333; color:#eee; border:0; border-radius:6px; padding:6px 12px; cursor:pointer; }
|
|
118
121
|
#mode { margin-left:auto; text-transform:uppercase; font-size:11px; letter-spacing:.09em; }
|
|
@@ -141,6 +144,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
141
144
|
<button id="prev">\u25C0 prev</button>
|
|
142
145
|
<button id="next">next \u25B6</button>
|
|
143
146
|
<button id="mode" title="S toggles rehearse mode (cue cards instead of prose)">speak</button>
|
|
147
|
+
<button id="rec" title="record how long each slide takes, then save the timings onto the deck">\u23F1 rehearse timings</button>
|
|
148
|
+
<span id="pace" class="pace"></span>
|
|
144
149
|
<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>
|
|
145
150
|
</header>
|
|
146
151
|
<div class="thumbs">
|
|
@@ -162,6 +167,50 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
162
167
|
$('#timer').textContent = String(Math.floor(s/60)).padStart(2,'0') + ':' + String(s%60).padStart(2,'0');
|
|
163
168
|
}, 500);
|
|
164
169
|
$('#resetTimer').onclick = () => { t0 = Date.now(); };
|
|
170
|
+
// \u2500\u2500 rehearsal timings: seconds per slide while recording, saved on stop \u2500\u2500
|
|
171
|
+
const rec = { on: false, since: 0, cur: null, spent: [] };
|
|
172
|
+
const fmt = (s) => String(Math.floor(s/60)).padStart(2,'0') + ':' + String(Math.floor(s%60)).padStart(2,'0');
|
|
173
|
+
let plan = [];
|
|
174
|
+
const tick = () => {
|
|
175
|
+
if (!rec.on || rec.cur == null) return;
|
|
176
|
+
const live = rec.spent.slice(); live[rec.cur - 1] = (live[rec.cur - 1] || 0) + (Date.now() - rec.since) / 1000;
|
|
177
|
+
const planned = plan[rec.cur - 1] || 0;
|
|
178
|
+
const total = live.reduce((a, b) => a + (b || 0), 0);
|
|
179
|
+
const plannedTotal = plan.reduce((a, b) => a + (b || 0), 0);
|
|
180
|
+
const spent = live[rec.cur - 1] || 0;
|
|
181
|
+
const over = planned && spent - planned > 5;
|
|
182
|
+
$('#pace').textContent = 'slide ' + rec.cur + ' \xB7 ' + fmt(spent) + (planned ? ' / ' + fmt(planned) : '')
|
|
183
|
+
+ (over ? ' \xB7 ' + fmt(spent - planned) + ' over' : '') + ' \xB7 total ' + fmt(total) + (plannedTotal ? ' / ' + fmt(plannedTotal) : '');
|
|
184
|
+
$('#pace').classList.toggle('over', !!over);
|
|
185
|
+
};
|
|
186
|
+
setInterval(tick, 500);
|
|
187
|
+
const arrive = (slide) => {
|
|
188
|
+
if (!rec.on) return;
|
|
189
|
+
if (rec.cur != null) rec.spent[rec.cur - 1] = (rec.spent[rec.cur - 1] || 0) + (Date.now() - rec.since) / 1000;
|
|
190
|
+
rec.cur = slide; rec.since = Date.now();
|
|
191
|
+
};
|
|
192
|
+
// Start/stop from the button, or from the deck's palette via
|
|
193
|
+
// window.__decklightSpeakerRec (like __decklightSpeakerToggle for S).
|
|
194
|
+
// start === true only ever starts: a palette row that opened this window
|
|
195
|
+
// to begin a rehearsal must not stop one already running.
|
|
196
|
+
const toggleRec = async (start) => {
|
|
197
|
+
if (!rec.on) {
|
|
198
|
+
rec.on = true; rec.spent = []; rec.cur = null; if (lastSt) arrive(lastSt.slide);
|
|
199
|
+
$('#rec').classList.add('on'); $('#rec').textContent = '\u23F9 stop & save timings';
|
|
200
|
+
$('#pace').textContent = 'recording \u2014 \u23F9 stop & save when the run is over';
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (start === true) return;
|
|
204
|
+
arrive(null); rec.on = false;
|
|
205
|
+
$('#rec').classList.remove('on'); $('#rec').textContent = '\u23F1 rehearse timings';
|
|
206
|
+
try {
|
|
207
|
+
const where = api ? await api.saveTimings(rec.spent) : 'nowhere';
|
|
208
|
+
$('#pace').textContent = where === 'deck' ? 'timings saved onto the deck' : where === 'browser' ? 'timings kept in this browser (no author server to write the deck)' : 'timings not saved';
|
|
209
|
+
$('#pace').classList.remove('over');
|
|
210
|
+
} catch (e) { $('#pace').textContent = 'could not save timings: ' + String(e.message || e); }
|
|
211
|
+
};
|
|
212
|
+
$('#rec').onclick = () => toggleRec();
|
|
213
|
+
window.__decklightSpeakerRec = toggleRec;
|
|
165
214
|
$('#prev').onclick = () => api && api.prev();
|
|
166
215
|
$('#next').onclick = () => api && api.next();
|
|
167
216
|
// speak = full prose notes; rehearse = the deck's aside.rehearse cue cards
|
|
@@ -184,6 +233,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
184
233
|
});
|
|
185
234
|
let last = { slide: -1, nextHash: '' };
|
|
186
235
|
function render(st) {
|
|
236
|
+
plan = st.timings || [];
|
|
237
|
+
if (st.slide !== last.slide) arrive(st.slide);
|
|
187
238
|
lastSt = st;
|
|
188
239
|
$('#pos').textContent = 'slide ' + st.slide + ' / ' + st.totalSlides + ' \xB7 step ' + st.step + ' / ' + st.totalSteps;
|
|
189
240
|
if (st.slide !== last.slide) $('#cur').src = st.url + '#/' + st.slide + '/999';
|
|
@@ -227,30 +278,30 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
227
278
|
}
|
|
228
279
|
connect(30);
|
|
229
280
|
<\/script>
|
|
230
|
-
</body></html>`),a.document.close(),a}function
|
|
281
|
+
</body></html>`),a.document.close(),a}function ia(t,o){let{slide:a,step:c,totalSlides:d}=t.state,p=t._records[a-1],f=p?p.groups.length:0,m=c<f?`/${a}/${c+1}`:a<d?`/${a+1}/0`:`/${a}/${c}`,v=t._sections[a-1]?.querySelector("aside.notes"),k=t._sections[a-1]?.querySelector("aside.rehearse");return{slide:a,step:c,totalSlides:d,totalSteps:f,url:o,nextHash:m,notesSegments:oa(v?v.innerHTML:""),rehearseSegments:k?oa(k.innerHTML):null,labels:t._stepLabels(a-1),timings:dd(t._sections,Bn(aa())),qr:t.__remoteQr??null}}me();fe();function Ht(t,o){t.addEventListener("click",a=>{a.target===t&&o()})}function En(t,o,a,{scroll:c=!0}={}){let d=(o+t.length)%t.length;return t.forEach((p,f)=>p.classList.toggle(a,f===d)),c&&t[d]?.scrollIntoView({block:"nearest"}),d}function $s(t,{query:o="",onMove:a,onCommit:c,onType:d,onBackspace:p,onClear:f,onClose:m}){switch(t.key){case"ArrowDown":return a?.(1),!0;case"ArrowUp":return a?.(-1),!0;case"Enter":return c?.(),!0;case"Backspace":return p?(p(),!0):!1;case"Escape":return o&&f?f():m?.(),!0;default:return t.key.length===1&&d?(d(t.key),!0):!1}}function la(){let t=[];return{register(o){return t.push(o),o},active:()=>t.find(o=>o.isOpen()),closeOthers(o){for(let a of t)a!==o&&a.isOpen()&&a.close()}}}me();fe();me();fe();function ud(t){return function(){t|=0,t=t+1831565813|0;let o=Math.imul(t^t>>>15,1|t);return o=o+Math.imul(o^o>>>7,61|o)^o,((o^o>>>14)>>>0)/4294967296}}function qn(t,o,a){t=(t%360+360)%360,o=Math.max(0,Math.min(100,o))/100,a=Math.max(0,Math.min(100,a))/100;let c=(1-Math.abs(2*a-1))*o,d=c*(1-Math.abs(t/60%2-1)),p=a-c/2,f=Math.floor(t/60)%6;return[[c,d,0],[d,c,0],[0,c,d],[0,d,c],[d,0,c],[c,0,d]][f].map(v=>Math.round((v+p)*255))}function lr([t,o,a]){return"#"+[t,o,a].map(c=>c.toString(16).padStart(2,"0")).join("")}function Lr([t,o,a]){let c=[t,o,a].map(d=>(d/=255,d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)));return .2126*c[0]+.7152*c[1]+.0722*c[2]}function pd(t,o){let[a,c]=[Lr(t),Lr(o)].sort((d,p)=>p-d);return(a+.05)/(c+.05)}var Or=(t,o)=>Math.min(...o.map(a=>pd(t,a)));function Qt(t,o,a,c,d){let f=c.reduce((S,P)=>S+Lr(P),0)/c.length<.5?1:-1,m=[];for(let S=o;S>0;S-=15)m.push(S);m.push(0);for(let S of[f,-f])for(let P of m)for(let T=a;T>=2&&T<=98;T+=S){let A=qn(t,P,T);if(Or(A,c)>=d)return A}let v=[253,253,254],k=[8,9,10];return Or(v,c)>=Or(k,c)?v:k}var hd=["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"],lo='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',md='ui-rounded, "SF Pro Rounded", "Segoe UI", Roboto, Helvetica, Arial, sans-serif',fd='"Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif',gd='"SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", Menlo, Consolas, monospace',bd=[lo,lo,md,fd],yd=[600,650,700,750,800],wd=["4px","6px","8px","10px","12px","14px","18px"],ca={analogous:[30,-30,60,15,-15],complementary:[180,150,210,30,-30],split:[150,210,30,180,-30],triadic:[120,240,60,180,300]},yr={bgSatMax:{dark:18,light:12},accentSat:[42,68],hlSat:[36,58],ansiSat:[46,66],gradientChance:.15,gradientHueDrift:[8,20]};function Cs(t){t=(t??Math.floor(Math.random()*4294967295))>>>0;let o=ud(t),a=Ce=>Ce[Math.floor(o()*Ce.length)],c=(Ce,ye)=>Ce+o()*(ye-Ce),d=o()<.5,p=Math.floor(o()*360),f=a(Object.keys(ca)),m=ca[f],v=p+m[0],k=o()*o(),S=(Ce,ye)=>Ce+k*(ye-Ce),P=S(5,yr.bgSatMax[d?"dark":"light"]),T=d?c(6,13):c(94,97.5),A=qn(p,P,T),N=lr(A),I=[A];if(o()<yr.gradientChance){let Ce=qn(p+c(...yr.gradientHueDrift),P+c(0,8),T+(d?c(2.5,5):-c(2,4)));N=`linear-gradient(${Math.round(c(120,210))}deg, ${lr(A)} 0%, ${lr(Ce)} 100%)`,I=[A,Ce]}let Se=qn(p,Math.min(P+4,35),d?T+4:T-4),pe=Qt(p,12,d?86:18,I,4.6),Oe=Qt(p,10,d?64:44,I,3.1),ce=o()<.5?Qt(v,S(20,55),d?80:26,I,3.2):Qt(p,8,d?92:12,I,4.6),Me=S(...yr.accentSat),ze=d?c(55,68):c(34,48),Ve=qn(v,Me,ze);for(;Math.max(Or([253,253,254],[Ve]),Or([8,9,10],[Ve]))<4.7;)ze+=d?1:-1,Ve=qn(v,Me,ze);let $e=Qt(v,18,Lr(Ve)<.4?96:10,[Ve],4.6),_e=Qt(o()<.5?v:p+(m[1]??30),S(35,60),d?70:34,I,3.2),Ze=lr(Se),bt=`1px solid ${lr(qn(p,Math.min(P+6,40),d?T+10:T-10))}`,_=a(wd),je=d?`0 ${Math.round(c(4,10))}px ${Math.round(c(18,30))}px rgba(0, 0, 0, 0.${Math.round(c(35,55))})`:`0 ${Math.round(c(3,6))}px ${Math.round(c(12,20))}px rgba(30, 30, 40, 0.${String(Math.round(c(8,14))).padStart(2,"0")})`,gt=qn(p,Math.min(P+2,28),d?Math.max(T-3,3):Math.min(T-3,93)),ut=[gt],Q=Qt(p,8,d?85:20,ut,4.6),j={keyword:m[0],string:m[3]??120,number:m[2]??60,function:m[1]??210,type:m[4]??280},oe=S(...yr.hlSat),he=d?68:36,le={};for(let[Ce,ye]of Object.entries(j))le[Ce]=Qt(p+ye,oe,he,ut,4.6);le.comment=Qt(p,12,d?60:46,ut,3.2),le.punct=Qt(p,10,d?74:32,ut,4.6);let Y=[0,m[0],m[1]??40,m[2]??90,m[3]??160,m[4]??230].map((Ce,ye)=>qn(p+Ce,S(14,34),d?T+8+ye%3*2:T-6-ye%3*2)),s=[...I,...Y],i=Qt(p,14,d?60:42,I,2.2),O=Qt(p,10,d?84:20,s,3.4),Ue=Qt(p,10,d?62:46,s,2.7),B=Qt(v,Me,d?68:38,s,2.7),Le=Y.map(lr),$t=qn(p,Math.min(P+4,30),d?Math.max(T-4,3):c(12,18)),W=[$t],Ae=Qt(p,8,82,W,4.6),ee=Qt(v,S(...yr.ansiSat),66,W,3.2),We={red:8,green:125,yellow:45,blue:215,magenta:290,cyan:175},w={black:Qt(p,10,58,W,3.1),white:Qt(p,6,88,W,4.6)};for(let[Ce,ye]of Object.entries(We))w[Ce]=Qt(ye+p%16-8,S(...yr.ansiSat),66,W,3.1);let Ie=Ce=>{let[ye,Pe,X]=Ce.map(Xe=>Math.min(255,Math.round(Xe+(255-Xe)*.35)));return Or([ye,Pe,X],W)>=3?[ye,Pe,X]:Qt(p,8,90,W,3.1)},g=`gen-${a(hd)}-${(t%65535).toString(16).padStart(4,"0")}`,J=lr,z={"--bg":N,"--bg-accent":lr(Se),"--fg":J(pe),"--muted":J(Oe),"--font-body":lo,"--font-heading":a(bd),"--font-mono":gd,"--heading-color":J(ce),"--heading-weight":String(a(yd)),"--link":J(_e),"--accent":J(Ve),"--accent-contrast":J($e),"--block-bg":Ze,"--block-border":bt,"--block-radius":_,"--shadow":je,"--code-bg":J(gt),"--code-fg":J(Q),"--hl-keyword":J(le.keyword),"--hl-string":J(le.string),"--hl-number":J(le.number),"--hl-comment":J(le.comment),"--hl-function":J(le.function),"--hl-type":J(le.type),"--hl-punct":J(le.punct),"--d-stroke":J(i),"--d-text":J(O),"--d-muted":J(Ue),"--d-accent":J(B),"--d-fill-1":Le[0],"--d-fill-2":Le[1],"--d-fill-3":Le[2],"--d-fill-4":Le[3],"--d-fill-5":Le[4],"--d-fill-6":Le[5],"--term-bg":J($t),"--term-fg":J(Ae),"--term-prompt":J(ee),"--term-cursor":J(ee),"--term-selection":`rgba(${Ve[0]}, ${Ve[1]}, ${Ve[2]}, 0.30)`,"--ansi-black":J(w.black),"--ansi-red":J(w.red),"--ansi-green":J(w.green),"--ansi-yellow":J(w.yellow),"--ansi-blue":J(w.blue),"--ansi-magenta":J(w.magenta),"--ansi-cyan":J(w.cyan),"--ansi-white":J(w.white),"--ansi-bright-black":J(Ie(w.black)),"--ansi-bright-red":J(Ie(w.red)),"--ansi-bright-green":J(Ie(w.green)),"--ansi-bright-yellow":J(Ie(w.yellow)),"--ansi-bright-blue":J(Ie(w.blue)),"--ansi-bright-magenta":J(Ie(w.magenta)),"--ansi-bright-cyan":J(Ie(w.cyan)),"--ansi-bright-white":J(Qt(p,6,97,W,3.1)),"--dim-opacity":(.25+Math.round(o()*15)/100).toFixed(2)};return{name:g,seed:t,dark:d,harmony:f,tokens:z}}var da=[["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 co(t,o){let a=`/* \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
282
|
Decklight theme \xB7 ${t}
|
|
232
283
|
generated by Decklight (\u2303T) \u2014 token contract: SPEC.md THEMING
|
|
233
284
|
All values derived with WCAG luminance math; passes test/contrast.mjs
|
|
234
285
|
\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 */
|
|
235
286
|
|
|
236
287
|
.decklight {
|
|
237
|
-
`;for(let[d,p]of
|
|
238
|
-
`;for(let m of
|
|
288
|
+
`;for(let[d,p]of da){let f=p.filter(m=>o[m]!==void 0);if(f.length){a+=` /* \u2500\u2500 ${d} ${"\u2500".repeat(Math.max(1,26-d.length))} */
|
|
289
|
+
`;for(let m of f)a+=` ${m}: ${o[m]};
|
|
239
290
|
`;a+=`
|
|
240
|
-
`}}let c=new Set(
|
|
291
|
+
`}}let c=new Set(da.flatMap(([,d])=>d));for(let[d,p]of Object.entries(o))c.has(d)||(a+=` ${d}: ${p};
|
|
241
292
|
`);return a.replace(/\n$/,"")+`}
|
|
242
|
-
`}function oa({root:t,config:o,params:a,toast:c,debugLog:d,overlays:p,deck:g,editmode:m}){let w=[...document.querySelectorAll("style[data-theme]:not([data-theme-added])")],E=[...document.querySelectorAll("style[data-theme][data-theme-added]")],S=new Set(E.map(N=>N.dataset.theme).filter(Boolean)),P=new Map;for(let N of E){let X=N.dataset.themeMarketplace;N.dataset.theme&&X&&P.set(N.dataset.theme,{pack:`mkt:${X}`,label:N.dataset.themeSource||X})}let $=w.length>0,_=$?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if($){let N=w.find(X=>!X.hasAttribute("disabled")&&X.media!=="not all");N=N||w[0],w.forEach(X=>{X.removeAttribute("disabled"),X.media=X===N?"all":"not all"})}let C=$||!!_,I=N=>(N.match(/themes\/([\w-]+)\.css/)||[])[1],Se="decklight-theme:"+location.pathname,de="decklight-custom-themes",$e={};try{$e=JSON.parse(localStorage.getItem(de)||"{}")||{}}catch{}let te=null,ae=null,Re={};function Fe(N,X,pe){let Me=pe==="generated"?te:Re[N];return Me||(Me=document.createElement("style"),Me.media="not all",pe==="generated"?Me.dataset.generated="":Me.dataset.custom=""),Me.dataset.theme=N,Me.textContent=co(N,X),document.head.appendChild(Me),pe==="generated"?te=Me:Re[N]=Me,Me}let je=()=>[te,...Object.values(Re),...E];function _e(N){for(let X of je())X&&X!==N&&(X.media="not all")}let Ae=()=>je().find(N=>N&&N.media!=="not all")||null,st=()=>{let N=Ae();return N?N.dataset.theme:$?w.find(X=>X.media!=="not all")?.dataset.theme:_?I(_.href):void 0};function bt(){let N=getComputedStyle(t),X=Le=>Le?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),pe=X(N.backgroundColor);(!pe||pe[4]!==void 0&&+pe[4]==0)&&(pe=X(N.backgroundImage));let Me=pe?Or([+pe[1],+pe[2],+pe[3]])<.5:!1;t.setAttribute("data-canvas",Me?"dark":"light")}_?.addEventListener("load",bt);function T(N,X=!1){if(!N||!/^[\w-]+$/.test(N))return;let pe=!1;if(ae&&te&&N===ae.name)te.media="all",_e(te),pe=!$e[N];else if($e[N]){let Me=Fe(N,$e[N],"custom");Me.media="all",_e(Me)}else if(S.has(N)){let Me=E.find(Le=>Le.dataset.theme===N);Me.media="all",_e(Me)}else{if(!C)return;if(_e(null),$){let Me=w.find(Le=>Le.dataset.theme===N);if(!Me)return;w.forEach(Le=>{Le.media=Le===Me?"all":"not all"})}else _.href=_.href.replace(/themes\/[\w-]+\.css(\?.*)?$/,`themes/${N}.css`)}if(!a.has("embedded")&&!pe)try{localStorage.setItem(Se,N)}catch{}X||c(N),d("theme",N),bt()}let Ke=typeof it<"u"?it:null,mt={added:"Added",custom:"Custom",generated:"Generated"},dt=new Map([...P.values()].map(N=>[N.pack,N.label])),G=N=>dt.get(N)??Ke?.labels?.[N]??mt[N]??N;function J(N){if($e[N])return"custom";if(ae&&N===ae.name)return"generated";if(P.has(N))return P.get(N).pack;if(S.has(N))return"added";if(Ke){for(let[X,pe]of Object.entries(Ke.packs))if(pe.includes(N))return X}return"other"}let ne=()=>{let N;if($){let pe=w.map(Me=>Me.dataset.theme);N=o.themes?.length?o.themes.filter(Me=>pe.includes(Me)):pe}else N=o.themes?.length?o.themes:typeof rt<"u"?rt:[];let X=[...S,...Object.keys($e)];if(ae&&!$e[ae.name]&&X.push(ae.name),N=[...N,...X.filter(pe=>!N.includes(pe))],Ke){let pe=new Map,Me=0;for(let Le of Ke.order)for(let qe of Ke.packs[Le]??[])pe.set(qe,Me++);N=[...N].sort((Le,qe)=>(pe.get(Le)??1e9)-(pe.get(qe)??1e9))}return N};function fe(N){let X=[];for(let pe of Ke.order){let Me=(Ke.packs[pe]??[]).filter(Le=>N.includes(Le));Me.length&&X.push([pe,Me])}for(let pe of new Set([...P.values()].map(Me=>Me.pack))){let Me=N.filter(Le=>J(Le)===pe);Me.length&&X.push([pe,Me])}for(let pe of["added","custom","generated"]){let Me=N.filter(Le=>J(Le)===pe);Me.length&&X.push([pe,Me])}return X}let ue=N=>btoa(unescape(encodeURIComponent(JSON.stringify(N)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Ie=N=>JSON.parse(decodeURIComponent(escape(atob(N.replace(/-/g,"+").replace(/_/g,"/")))));function Q(N,X=!1){ae={name:N.name,tokens:N.tokens};let pe=Fe(N.name,N.tokens,"generated");return pe.media="all",_e(pe),X||c(`\u2728 ${N.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),bt(),N.name}function s(){return Q(Ts())}function i(N){if(!ae||!te||te.media==="not all")return c("no generated theme to save \u2014 \u2303T to generate one"),null;let X=N??(window.prompt?.("Save theme as:",ae.name.replace(/^gen-/,""))||"");if(X=String(X).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!X)return null;((typeof rt<"u"?rt:[]).includes(X)||w.some(Le=>Le.dataset.theme===X))&&(X="custom-"+X),$e[X]=ae.tokens;try{localStorage.setItem(de,JSON.stringify($e))}catch{}let Me=Fe(X,$e[X],"custom");if(Me.media="all",te?.remove(),te=null,ae=null,_e(Me),!a.has("embedded"))try{localStorage.setItem(Se,X)}catch{}try{let Le=new Blob([co(X,$e[X])],{type:"text/css"}),qe=document.createElement("a");qe.href=URL.createObjectURL(Le),qe.download=`${X}.css`,qe.click(),setTimeout(()=>URL.revokeObjectURL(qe.href),5e3)}catch{}return c(`saved ${X} \u2014 ${X}.css downloaded`,2200),X}let O=null;function De(N=!1){return O?(clearTimeout(O.timer),O=null,N||c("theme cycle cancelled"),!0):!1}function B(N){let X=ne();if(!C||X.length<2)return;if(O){let qe=O;clearTimeout(qe.timer),O=null,qe.dir===N?T(qe.name):c("theme cycle cancelled");return}let pe=st(),Me=Math.max(0,X.indexOf(pe)),Le=X[(Me+N+X.length)%X.length];if(Ke&&J(Le)!==J(pe)){let qe=N>0?".":",",M=N>0?",":".";O={dir:N,name:Le,timer:setTimeout(()=>{O=null},4e3)},c(`\u2933 ${G(J(Le))} pack next (${Le}) \u2014 ${qe} confirms \xB7 ${M} or Esc cancels`,4e3);return}T(Le)}a.has("embedded")&&window.addEventListener("message",N=>{let X=N.data&&N.data.__decklightPreview;!X||N.source!==window.parent||(X.gen?Q(X.gen,!0):X.theme?T(X.theme,!0):X.goto&&g().goto(X.goto[0],X.goto[1]??0))});function Pe(){let N=st(),X=$e[N]?{name:N,tokens:$e[N]}:ae&&N===ae.name?ae:null;return X?"?embedded&gen="+ue(X):N?"?embedded&theme="+encodeURIComponent(N):"?embedded"}function _t(){let N=a.get("gen");if(N)try{let Me=Ie(N);if(Me&&Me.tokens){Q({name:Me.name||"gen-preview",tokens:Me.tokens},!0);return}}catch{}let X=null;try{X=localStorage.getItem(Se)}catch{}let pe=a.get("theme")||X;pe&&T(pe,!0)}let W="\0generate",ye="pack:",ie="back",Ze="all",v="browse",ze="",f=N=>N.charCodeAt(0)<32,Y=null,F=0,Ce,ce=[],Ne=null,ee="",nt="packs",pt=()=>Ke?"packs":"all",ut=()=>m?.()?.available()===!0,ke=()=>m?.()?.base()??"",Ee=()=>ut()?[v]:[],re=null,Ge=N=>(re?.themes??[]).find(X=>X.qualified===N);async function ht(){re={loading:!0,themes:[],stale:[]},Wt("browse");let N;try{let X=await fetch(ke()+"/edit/theme/browse"),pe=await X.json().catch(()=>({}));N=X.ok&&pe.ok?{themes:pe.themes??[],stale:pe.stale??[],cacheOnly:pe.cacheOnly!==!1}:{themes:[],stale:[],error:pe.error||`the author server said ${X.status}`}}catch{N={themes:[],stale:[],error:"the author server did not answer"}}!Y||nt!=="browse"||(re=N,Wt("browse"))}async function tt(N){let X=Y?.querySelector(".tp-caption");X&&(X.textContent=`installing ${N}\u2026`);try{let pe=await fetch(ke()+"/edit/theme/add",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:N})}),Me=await pe.json().catch(()=>({}));if(!pe.ok){let Le=[Me.error,...Me.problems??[]].filter(Boolean).join(" \xB7 ");X&&(X.textContent=Le||`install failed (${pe.status})`),c(`${N}: ${Me.error||"install refused"}`,3600);return}Kt(),c(`installed ${Me.name}${Me.replaced?" (replaced)":""} \u2014 Z takes it back`,2800),d("theme",`${N} installed from a marketplace`)}catch{X&&(X.textContent="the author server did not answer")}}function He(N){let X=g().state,pe="#/"+X.slide+"/"+X.step;if(N===W||$e[N]||ae&&N===ae.name){let Me=N===W?Ne:$e[N]?{name:N,tokens:$e[N]}:ae;return location.pathname+"?embedded&gen="+ue(Me)+pe}return location.pathname+"?embedded&theme="+encodeURIComponent(N)+pe}function gt(N){N.textContent=Ne?`\u2728 ${Ne.name} \u2014 \u2303T re-rolls`:"\u2728 Generate new\u2026"}function Yt(){Ne=Ts();let N=ce.indexOf(W);N<0||(gt(Y.querySelectorAll(".tp-row")[N]),Bt(N,!0))}function nn(){let N=Y.querySelector(".tp-list"),X=st(),pe=ne();if(nt==="browse"){let qe=(re?.themes??[]).filter(M=>!ee||M.qualified.includes(ee));ce=[ie,...qe.map(M=>ze+M.qualified)]}else if(ee)ce=pe.filter(qe=>qe.includes(ee));else if(!Ke||nt==="all")ce=Ke?[W,ie,...pe]:[W,...pe,...Ee()];else if(nt==="packs")ce=[W,...fe(pe).map(([qe])=>ye+qe),Ze,...Ee()];else{let qe=nt.slice(5);ce=[ie,...fe(pe).find(([M])=>M===qe)?.[1]??[]]}N.textContent="";let Me=(qe,M)=>{let j=document.createElement("span");j.className="tp-tag",j.textContent=M,qe.appendChild(j)};if(ce.forEach((qe,M)=>{let j=document.createElement("div");if(j.setAttribute("role","option"),qe===W)j.className="tp-row tp-gen",gt(j);else if(qe===ie)j.className="tp-row tp-back",j.textContent=pt()==="packs"?"\u2190 packs":"\u2190 themes";else if(qe===v)j.className="tp-row tp-browse",j.textContent="\u2315 Browse marketplaces\u2026";else if(qe.startsWith(ze)){let H=Ge(qe.slice(ze.length));j.className="tp-row tp-mkt",j.textContent=H?.name??qe.slice(ze.length);let we=S.has(H?.name)?"installed":H?.marketplace;we&&Me(j,we)}else if(qe===Ze)j.className="tp-row tp-all",j.textContent="\u2733 all themes",Me(j,String(pe.length));else if(qe.startsWith(ye)){let H=qe.slice(ye.length),we=fe(pe).find(([Ye])=>Ye===H)?.[1]??[];j.className="tp-row tp-pack"+(we.includes(X)?" tp-current":""),j.textContent=`\u25B8 ${G(H)}`,Me(j,String(we.length))}else{j.className="tp-row"+(qe===X?" tp-current":""),j.textContent=qe;let H=$e[qe]?"custom":ae&&qe===ae.name?"generated":P.has(qe)?P.get(qe).label:S.has(qe)?"added":ee&&Ke?G(J(qe)):null;H&&Me(j,H)}j.addEventListener("mouseenter",()=>Bt(M,!1)),j.addEventListener("click",()=>{Bt(M,!0),Ct()}),N.appendChild(j)}),!ce.length){let qe=document.createElement("div");qe.className="tp-none",qe.textContent="no themes match",N.appendChild(qe)}if(nt==="browse"){let qe=document.createElement("div");qe.className="tp-none",qe.textContent=re?.loading?"reading the catalogs\u2026":re?.error?re.error:ce.some(M=>M.startsWith(ze))?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":ee?"no marketplace theme matches":"no themes in the marketplaces you have registered",N.appendChild(qe)}let Le=Y.querySelector(".tp-filter");Le.textContent=ee||"type to filter\u2026",Le.classList.toggle("tp-active",!!ee)}function It(){let N=st(),X=ce.indexOf(N);if(X>=0)return X;let pe=ce.indexOf(ye+J(N));return pe>=0?pe:Math.min(1,ce.length-1)}function Wt(N,X=!1){nt=N,nn(),ce.length&&Bt(It(),X)}function oe(N){ee=N.toLowerCase(),nn(),ce.length?Bt(ee?0:It(),!1):Y.querySelector(".tp-caption").textContent="no match"}function pn(){if(Y)return Kt();p.closeOthers(Rt);let N=ne();if(!C&&!N.length)return;ee="",nt=pt(),re=null,Y=document.createElement("div"),Y.className="decklight-theme-picker",Y.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>',nn(),Ut(Y,Kt),t.appendChild(Y);let X=st();X&&Dt(Y.querySelector("iframe"),X),Bt(It(),!X)}function Bt(N,X){if(!ce.length)return;F=(N+ce.length)%ce.length;let pe=ce[F];pe===W&&!Ne&&(Ne=Ts(),gt(Y.querySelectorAll(".tp-row")[F])),vn(Y.querySelectorAll(".tp-row"),F,"tp-selected");let Me=ne(),Le=pe===W?Ne?`\u2728 ${Ne.name}`:"generate new":pe===ie?pt()==="packs"?"back to packs":"back to the theme list":pe===v?"themes from the marketplaces you have registered":pe.startsWith(ze)?rn(pe.slice(ze.length)):pe===Ze?`all ${Me.length} themes, flattened`:pe.startsWith(ye)?`${G(pe.slice(ye.length))} \xB7 ${fe(Me).find(([M])=>M===pe.slice(ye.length))?.[1].length??0} themes`:Ke?`${G(J(pe))} \xB7 ${pe}`:pe;if(Y.querySelector(".tp-caption").textContent=Le,clearTimeout(Ce),pe!==W&&f(pe))return;let qe=Y.querySelector("iframe");X?Dt(qe,pe):Ce=setTimeout(()=>Dt(qe,pe),60)}function rn(N){let X=Ge(N);return X?[X.qualified,X.description,S.has(X.name)?"installed \u2014 \u23CE re-installs it":"\u23CE installs it"].filter(Boolean).join(" \xB7 "):N}let gn=!1,Lt=null;function mn(N){return N===W||$e[N]||ae&&N===ae.name?{gen:N===W?Ne:$e[N]?{name:N,tokens:$e[N]}:ae}:{theme:N}}function Dt(N,X){if(!N.dataset.booted){N.dataset.booted="1",gn=!1,N.addEventListener("load",()=>{if(gn=!0,Lt!==null&&Y){let pe=Lt;Lt=null,Dt(N,pe)}},{once:!0}),N.src=He(X);return}if(!gn){Lt=X;return}N.contentWindow?.postMessage({__decklightPreview:mn(X)},"*")}function Ct(){let N=ce[F];if(N!==void 0){if(N===W){Ne&&Q(Ne),Kt();return}if(N===ie){Wt(pt());return}if(N===Ze){Wt("all");return}if(N===v){ht();return}if(N.startsWith(ze)){tt(N.slice(ze.length));return}if(N.startsWith(ye)){Wt("pack:"+N.slice(ye.length),!0);return}T(N),Kt()}}function Kt(){clearTimeout(Ce),Y?.remove(),Y=null}let Rt=p.register({isOpen:()=>!!Y,close:Kt,keydown(N){switch(N.key){case"ArrowDown":Bt(F+1,!1);break;case"ArrowUp":Bt(F-1,!1);break;case"Enter":Ct();break;case"Backspace":oe(ee.slice(0,-1));break;case"Escape":ee?oe(""):nt!==pt()?Wt(pt()):Kt();break;default:if(N.key.length===1&&/[a-z0-9-]/i.test(N.key)){oe(ee+N.key);break}return!1}return!0}});return{applyTheme:T,currentTheme:st,themeList:ne,cycleTheme:B,cancelCyclePending:De,rollTheme:s,saveGeneratedTheme:i,adoptGenerated:Q,updateCanvas:bt,restoreSaved:_t,previewQuery:Pe,openPicker:pn,closePicker:Kt,browse(){Y||pn(),Y&&ht()},hasGenerated:()=>!!ae,rollFromPicker(){return Y&&ce[F]===W?(Yt(),!0):!1}}}ge();be();ge();be();ge();be();var uo=["A","B","C","D","E","F","G","H","X"],Lr="#edb58e",ia="#c98f6d",ld="#43302a",Rr="#b96b58",Ir="#57262c",$s="#f6f1ea",aa="#d17a70",po=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
|
|
293
|
+
`}function ua({root:t,config:o,params:a,toast:c,debugLog:d,overlays:p,deck:f,editmode:m}){let v=[...document.querySelectorAll("style[data-theme]:not([data-theme-added])")],k=[...document.querySelectorAll("style[data-theme][data-theme-added]")],S=new Set(k.map(C=>C.dataset.theme).filter(Boolean)),P=new Map;for(let C of k){let ne=C.dataset.themeMarketplace;C.dataset.theme&&ne&&P.set(C.dataset.theme,{pack:`mkt:${ne}`,label:C.dataset.themeSource||ne})}let T=v.length>0,A=T?null:document.querySelector('link[rel="stylesheet"][href*="themes/"]');if(T){let C=v.find(ne=>!ne.hasAttribute("disabled")&&ne.media!=="not all");C=C||v[0],v.forEach(ne=>{ne.removeAttribute("disabled"),ne.media=ne===C?"all":"not all"})}let N=T||!!A,I=C=>(C.match(/themes\/([\w-]+)\.css/)||[])[1],Se="decklight-theme:"+location.pathname,pe="decklight-custom-themes",Oe={};Oe=Bn(pe,{})||{};let re=null,ce=null,Me={};function ze(C,ne,Ee){let we=Ee==="generated"?re:Me[C];return we||(we=document.createElement("style"),we.media="not all",Ee==="generated"?we.dataset.generated="":we.dataset.custom=""),we.dataset.theme=C,we.textContent=co(C,ne),document.head.appendChild(we),Ee==="generated"?re=we:Me[C]=we,we}let Ve=()=>[re,...Object.values(Me),...k];function $e(C){for(let ne of Ve())ne&&ne!==C&&(ne.media="not all")}let _e=()=>Ve().find(C=>C&&C.media!=="not all")||null,Ze=()=>{let C=_e();return C?C.dataset.theme:T?v.find(ne=>ne.media!=="not all")?.dataset.theme:A?I(A.href):void 0};function bt(){let C=getComputedStyle(t),ne=Ne=>Ne?.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[\s,/]+([\d.]+))?\)/),Ee=ne(C.backgroundColor);(!Ee||Ee[4]!==void 0&&+Ee[4]==0)&&(Ee=ne(C.backgroundImage));let we=Ee?Lr([+Ee[1],+Ee[2],+Ee[3]])<.5:!1;t.setAttribute("data-canvas",we?"dark":"light")}A?.addEventListener("load",bt);function _(C,ne=!1){if(!C||!/^[\w-]+$/.test(C))return;let Ee=!1;if(ce&&re&&C===ce.name)re.media="all",$e(re),Ee=!Oe[C];else if(Oe[C]){let we=ze(C,Oe[C],"custom");we.media="all",$e(we)}else if(S.has(C)){let we=k.find(Ne=>Ne.dataset.theme===C);we.media="all",$e(we)}else{if(!N)return;if($e(null),T){let we=v.find(Ne=>Ne.dataset.theme===C);if(!we)return;v.forEach(Ne=>{Ne.media=Ne===we?"all":"not all"})}else A.href=A.href.replace(/themes\/[\w-]+\.css(\?.*)?$/,`themes/${C}.css`)}!a.has("embedded")&&!Ee&&fn(Se,C),ne||c(C),d("theme",C),bt()}let je=typeof at<"u"?at:null,gt={added:"Added",custom:"Custom",generated:"Generated"},ut=new Map([...P.values()].map(C=>[C.pack,C.label])),Q=C=>ut.get(C)??je?.labels?.[C]??gt[C]??C;function j(C){if(Oe[C])return"custom";if(ce&&C===ce.name)return"generated";if(P.has(C))return P.get(C).pack;if(S.has(C))return"added";if(je){for(let[ne,Ee]of Object.entries(je.packs))if(Ee.includes(C))return ne}return"other"}let oe=()=>{let C;if(T){let Ee=v.map(we=>we.dataset.theme);C=o.themes?.length?o.themes.filter(we=>Ee.includes(we)):Ee}else C=o.themes?.length?o.themes:typeof it<"u"?it:[];let ne=[...S,...Object.keys(Oe)];if(ce&&!Oe[ce.name]&&ne.push(ce.name),C=[...C,...ne.filter(Ee=>!C.includes(Ee))],je){let Ee=new Map,we=0;for(let Ne of je.order)for(let Ge of je.packs[Ne]??[])Ee.set(Ge,we++);C=[...C].sort((Ne,Ge)=>(Ee.get(Ne)??1e9)-(Ee.get(Ge)??1e9))}return C};function he(C){let ne=[];for(let Ee of je.order){let we=(je.packs[Ee]??[]).filter(Ne=>C.includes(Ne));we.length&&ne.push([Ee,we])}for(let Ee of new Set([...P.values()].map(we=>we.pack))){let we=C.filter(Ne=>j(Ne)===Ee);we.length&&ne.push([Ee,we])}for(let Ee of["added","custom","generated"]){let we=C.filter(Ne=>j(Ne)===Ee);we.length&&ne.push([Ee,we])}return ne}let le=C=>btoa(unescape(encodeURIComponent(JSON.stringify(C)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Re=C=>JSON.parse(decodeURIComponent(escape(atob(C.replace(/-/g,"+").replace(/_/g,"/")))));function Y(C,ne=!1){ce={name:C.name,tokens:C.tokens};let Ee=ze(C.name,C.tokens,"generated");return Ee.media="all",$e(Ee),ne||c(`\u2728 ${C.name} \u2014 \u2303T re-roll \xB7 \u2303\u21E7T save`,2800),bt(),C.name}function s(){return Y(Cs())}function i(C){if(!ce||!re||re.media==="not all")return c("no generated theme to save \u2014 \u2303T to generate one"),null;let ne=C??(window.prompt?.("Save theme as:",ce.name.replace(/^gen-/,""))||"");if(ne=String(ne).toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),!ne)return null;((typeof it<"u"?it:[]).includes(ne)||v.some(Ne=>Ne.dataset.theme===ne))&&(ne="custom-"+ne),Oe[ne]=ce.tokens,Dn(pe,Oe);let we=ze(ne,Oe[ne],"custom");we.media="all",re?.remove(),re=null,ce=null,$e(we),a.has("embedded")||fn(Se,ne);try{let Ne=new Blob([co(ne,Oe[ne])],{type:"text/css"}),Ge=document.createElement("a");Ge.href=URL.createObjectURL(Ne),Ge.download=`${ne}.css`,Ge.click(),setTimeout(()=>URL.revokeObjectURL(Ge.href),5e3)}catch{}return c(`saved ${ne} \u2014 ${ne}.css downloaded`,2200),ne}let O=null;function Ue(C=!1){return O?(clearTimeout(O.timer),O=null,C||c("theme cycle cancelled"),!0):!1}function B(C){let ne=oe();if(!N||ne.length<2)return;if(O){let Ge=O;clearTimeout(Ge.timer),O=null,Ge.dir===C?_(Ge.name):c("theme cycle cancelled");return}let Ee=Ze(),we=Math.max(0,ne.indexOf(Ee)),Ne=ne[(we+C+ne.length)%ne.length];if(je&&j(Ne)!==j(Ee)){let Ge=C>0?".":",",M=C>0?",":".";O={dir:C,name:Ne,timer:setTimeout(()=>{O=null},4e3)},c(`\u2933 ${Q(j(Ne))} pack next (${Ne}) \u2014 ${Ge} confirms \xB7 ${M} or Esc cancels`,4e3);return}_(Ne)}a.has("embedded")&&window.addEventListener("message",C=>{let ne=C.data&&C.data.__decklightPreview;!ne||C.source!==window.parent||(ne.gen?Y(ne.gen,!0):ne.theme?_(ne.theme,!0):ne.goto&&f().goto(ne.goto[0],ne.goto[1]??0))});function Le(){let C=Ze(),ne=Oe[C]?{name:C,tokens:Oe[C]}:ce&&C===ce.name?ce:null;return ne?"?embedded&gen="+le(ne):C?"?embedded&theme="+encodeURIComponent(C):"?embedded"}function $t(){let C=a.get("gen");if(C)try{let we=Re(C);if(we&&we.tokens){Y({name:we.name||"gen-preview",tokens:we.tokens},!0);return}}catch{}let ne=null;ne=kn(Se);let Ee=a.get("theme")||ne;Ee&&_(Ee,!0)}let W="\0generate",Ae="pack:",ee="back",We="all",w="browse",Ie="",g=C=>C.charCodeAt(0)<32,J=null,z=0,Ce,ye=[],Pe=null,X="",Xe="packs",mt=()=>je?"packs":"all",ft=()=>m?.()?.available()===!0,ke=()=>m?.()?.base()??"",ue=()=>ft()?[w]:[],ie=null,Ke=C=>(ie?.themes??[]).find(ne=>ne.qualified===C);async function rt(){ie={loading:!0,themes:[],stale:[]},sn("browse");let C;try{let ne=await fetch(ke()+"/edit/theme/browse"),Ee=await ne.json().catch(()=>({}));C=ne.ok&&Ee.ok?{themes:Ee.themes??[],stale:Ee.stale??[],cacheOnly:Ee.cacheOnly!==!1}:{themes:[],stale:[],error:Ee.error||`the author server said ${ne.status}`}}catch{C={themes:[],stale:[],error:"the author server did not answer"}}!J||Xe!=="browse"||(ie=C,sn("browse"))}async function Je(C){let ne=J?.querySelector(".tp-caption");ne&&(ne.textContent=`installing ${C}\u2026`);try{let Ee=await fetch(ke()+"/edit/theme/add",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:C})}),we=await Ee.json().catch(()=>({}));if(!Ee.ok){let Ne=[we.error,...we.problems??[]].filter(Boolean).join(" \xB7 ");ne&&(ne.textContent=Ne||`install failed (${Ee.status})`),c(`${C}: ${we.error||"install refused"}`,3600);return}tn(),c(`installed ${we.name}${we.replaced?" (replaced)":""} \u2014 Z takes it back`,2800),d("theme",`${C} installed from a marketplace`)}catch{ne&&(ne.textContent="the author server did not answer")}}function tt(C){let ne=f().state,Ee="#/"+ne.slide+"/"+ne.step;if(C===W||Oe[C]||ce&&C===ce.name){let we=C===W?Pe:Oe[C]?{name:C,tokens:Oe[C]}:ce;return location.pathname+"?embedded&gen="+le(we)+Ee}return location.pathname+"?embedded&theme="+encodeURIComponent(C)+Ee}function Rt(C){C.textContent=Pe?`\u2728 ${Pe.name} \u2014 \u2303T re-rolls`:"\u2728 Generate new\u2026"}function jt(){Pe=Cs();let C=ye.indexOf(W);C<0||(Rt(J.querySelectorAll(".tp-row")[C]),on(C,!0))}function en(){let C=J.querySelector(".tp-list"),ne=Ze(),Ee=oe();if(Xe==="browse"){let Ge=(ie?.themes??[]).filter(M=>!X||M.qualified.includes(X));ye=[ee,...Ge.map(M=>Ie+M.qualified)]}else if(X)ye=Ee.filter(Ge=>Ge.includes(X));else if(!je||Xe==="all")ye=je?[W,ee,...Ee]:[W,...Ee,...ue()];else if(Xe==="packs")ye=[W,...he(Ee).map(([Ge])=>Ae+Ge),We,...ue()];else{let Ge=Xe.slice(5);ye=[ee,...he(Ee).find(([M])=>M===Ge)?.[1]??[]]}C.textContent="";let we=(Ge,M)=>{let H=document.createElement("span");H.className="tp-tag",H.textContent=M,Ge.appendChild(H)};if(ye.forEach((Ge,M)=>{let H=document.createElement("div");if(H.setAttribute("role","option"),Ge===W)H.className="tp-row tp-gen",Rt(H);else if(Ge===ee)H.className="tp-row tp-back",H.textContent=mt()==="packs"?"\u2190 packs":"\u2190 themes";else if(Ge===w)H.className="tp-row tp-browse",H.textContent="\u2315 Browse marketplaces\u2026";else if(Ge.startsWith(Ie)){let K=Ke(Ge.slice(Ie.length));H.className="tp-row tp-mkt",H.textContent=K?.name??Ge.slice(Ie.length);let se=S.has(K?.name)?"installed":K?.marketplace;se&&we(H,se)}else if(Ge===We)H.className="tp-row tp-all",H.textContent="\u2733 all themes",we(H,String(Ee.length));else if(Ge.startsWith(Ae)){let K=Ge.slice(Ae.length),se=he(Ee).find(([qe])=>qe===K)?.[1]??[];H.className="tp-row tp-pack"+(se.includes(ne)?" tp-current":""),H.textContent=`\u25B8 ${Q(K)}`,we(H,String(se.length))}else{H.className="tp-row"+(Ge===ne?" tp-current":""),H.textContent=Ge;let K=Oe[Ge]?"custom":ce&&Ge===ce.name?"generated":P.has(Ge)?P.get(Ge).label:S.has(Ge)?"added":X&&je?Q(j(Ge)):null;K&&we(H,K)}H.addEventListener("mouseenter",()=>on(M,!1)),H.addEventListener("click",()=>{on(M,!0),_t()}),C.appendChild(H)}),!ye.length){let Ge=document.createElement("div");Ge.className="tp-none",Ge.textContent="no themes match",C.appendChild(Ge)}if(Xe==="browse"){let Ge=document.createElement("div");Ge.className="tp-none",Ge.textContent=ie?.loading?"reading the catalogs\u2026":ie?.error?ie.error:ye.some(M=>M.startsWith(Ie))?ie.stale?.length?`from the cache \xB7 never fetched: ${ie.stale.join(", ")} \u2014 marketplace update`:"from the cache \u2014 listing never goes to the network":X?"no marketplace theme matches":"no themes in the marketplaces you have registered",C.appendChild(Ge)}let Ne=J.querySelector(".tp-filter");Ne.textContent=X||"type to filter\u2026",Ne.classList.toggle("tp-active",!!X)}function Pt(){let C=Ze(),ne=ye.indexOf(C);if(ne>=0)return ne;let Ee=ye.indexOf(Ae+j(C));return Ee>=0?Ee:Math.min(1,ye.length-1)}function sn(C,ne=!1){Xe=C,en(),ye.length&&on(Pt(),ne)}function Gt(C){X=C.toLowerCase(),en(),ye.length?on(X?0:Pt(),!1):J.querySelector(".tp-caption").textContent="no match"}function At(){if(J)return tn();p.closeOthers(Yt);let C=oe();if(!N&&!C.length)return;X="",Xe=mt(),ie=null,J=document.createElement("div"),J.className="decklight-theme-picker",J.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>',en(),Ht(J,tn),t.appendChild(J);let ne=Ze();ne&&Kt(J.querySelector("iframe"),ne),on(Pt(),!ne)}function on(C,ne){if(!ye.length)return;z=(C+ye.length)%ye.length;let Ee=ye[z];Ee===W&&!Pe&&(Pe=Cs(),Rt(J.querySelectorAll(".tp-row")[z])),En(J.querySelectorAll(".tp-row"),z,"tp-selected");let we=oe(),Ne=Ee===W?Pe?`\u2728 ${Pe.name}`:"generate new":Ee===ee?mt()==="packs"?"back to packs":"back to the theme list":Ee===w?"themes from the marketplaces you have registered":Ee.startsWith(Ie)?un(Ee.slice(Ie.length)):Ee===We?`all ${we.length} themes, flattened`:Ee.startsWith(Ae)?`${Q(Ee.slice(Ae.length))} \xB7 ${he(we).find(([M])=>M===Ee.slice(Ae.length))?.[1].length??0} themes`:je?`${Q(j(Ee))} \xB7 ${Ee}`:Ee;if(J.querySelector(".tp-caption").textContent=Ne,clearTimeout(Ce),Ee!==W&&g(Ee))return;let Ge=J.querySelector("iframe");ne?Kt(Ge,Ee):Ce=setTimeout(()=>Kt(Ge,Ee),60)}function un(C){let ne=Ke(C);return ne?[ne.qualified,ne.description,S.has(ne.name)?"installed \u2014 \u23CE re-installs it":"\u23CE installs it"].filter(Boolean).join(" \xB7 "):C}let qt=!1,pn=null;function te(C){return C===W||Oe[C]||ce&&C===ce.name?{gen:C===W?Pe:Oe[C]?{name:C,tokens:Oe[C]}:ce}:{theme:C}}function Kt(C,ne){if(!C.dataset.booted){C.dataset.booted="1",qt=!1,C.addEventListener("load",()=>{if(qt=!0,pn!==null&&J){let Ee=pn;pn=null,Kt(C,Ee)}},{once:!0}),C.src=tt(ne);return}if(!qt){pn=ne;return}C.contentWindow?.postMessage({__decklightPreview:te(ne)},"*")}function _t(){let C=ye[z];if(C!==void 0){if(C===W){Pe&&Y(Pe),tn();return}if(C===ee){sn(mt());return}if(C===We){sn("all");return}if(C===w){rt();return}if(C.startsWith(Ie)){Je(C.slice(Ie.length));return}if(C.startsWith(Ae)){sn("pack:"+C.slice(Ae.length),!0);return}_(C),tn()}}function tn(){clearTimeout(Ce),J?.remove(),J=null}let Yt=p.register({isOpen:()=>!!J,close:tn,keydown(C){switch(C.key){case"ArrowDown":on(z+1,!1);break;case"ArrowUp":on(z-1,!1);break;case"Enter":_t();break;case"Backspace":Gt(X.slice(0,-1));break;case"Escape":X?Gt(""):Xe!==mt()?sn(mt()):tn();break;default:if(C.key.length===1&&/[a-z0-9-]/i.test(C.key)){Gt(X+C.key);break}return!1}return!0}});return{applyTheme:_,currentTheme:Ze,themeList:oe,cycleTheme:B,cancelCyclePending:Ue,rollTheme:s,saveGeneratedTheme:i,adoptGenerated:Y,updateCanvas:bt,restoreSaved:$t,previewQuery:Le,openPicker:At,closePicker:tn,browse(){J||At(),J&&rt()},hasGenerated:()=>!!ce,rollFromPicker(){return J&&ye[z]===W?(jt(),!0):!1}}}me();fe();me();fe();me();fe();var uo=["A","B","C","D","E","F","G","H","X"],Rr="#edb58e",pa="#c98f6d",vd="#43302a",Ir="#b96b58",Pr="#57262c",Ns="#f6f1ea",ha="#d17a70",po=`<svg viewBox="0 0 240 240" role="img" aria-label="Narrator" xmlns="http://www.w3.org/2000/svg">
|
|
243
294
|
<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"/>
|
|
244
295
|
<clipPath id="dlc-bust"><circle cx="120" cy="120" r="114"/></clipPath>
|
|
245
296
|
<g clip-path="url(#dlc-bust)">
|
|
246
297
|
<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)"/>
|
|
247
|
-
<path d="M106 142 L 106 176 C 106 185 134 185 134 176 L 134 142 Z" fill="${
|
|
248
|
-
<path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${
|
|
298
|
+
<path d="M106 142 L 106 176 C 106 185 134 185 134 176 L 134 142 Z" fill="${Rr}"/>
|
|
299
|
+
<path d="M106 142 L 106 156 C 114 162 126 162 134 156 L 134 142 Z" fill="${pa}"/>
|
|
249
300
|
<g data-idle>
|
|
250
|
-
<circle cx="75" cy="98" r="9" fill="${
|
|
251
|
-
<circle cx="165" cy="98" r="9" fill="${
|
|
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="${
|
|
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="${
|
|
301
|
+
<circle cx="75" cy="98" r="9" fill="${Rr}"/>
|
|
302
|
+
<circle cx="165" cy="98" r="9" fill="${Rr}"/>
|
|
303
|
+
<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="${Rr}"/>
|
|
304
|
+
<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="${vd}"/>
|
|
254
305
|
<path d="M92 84 Q 103 78 114 83" stroke="#4a352c" stroke-width="4" fill="none" stroke-linecap="round"/>
|
|
255
306
|
<path d="M126 83 Q 137 78 148 84" stroke="#4a352c" stroke-width="4" fill="none" stroke-linecap="round"/>
|
|
256
307
|
<ellipse cx="103" cy="97" rx="7" ry="5.5" fill="#fbf7f2"/>
|
|
@@ -261,63 +312,63 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
261
312
|
<circle cx="137" cy="97" r="3.2" fill="#5a4030"/>
|
|
262
313
|
<circle cx="137" cy="97" r="1.5" fill="#241a14"/>
|
|
263
314
|
<circle cx="138.3" cy="95.6" r=".8" fill="#fff"/>
|
|
264
|
-
<g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${
|
|
265
|
-
<g data-eyelid><rect x="129" y="90.5" width="16" height="12" rx="6" fill="${
|
|
266
|
-
<path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${
|
|
315
|
+
<g data-eyelid><rect x="95" y="90.5" width="16" height="12" rx="6" fill="${Rr}"/></g>
|
|
316
|
+
<g data-eyelid><rect x="129" y="90.5" width="16" height="12" rx="6" fill="${Rr}"/></g>
|
|
317
|
+
<path d="M120 101 L 117 115 Q 120 119 124 116" stroke="${pa}" stroke-width="3" fill="none" stroke-linecap="round"/>
|
|
267
318
|
<ellipse cx="96" cy="115" rx="6.5" ry="4" fill="#e59e7d" opacity=".4"/>
|
|
268
319
|
<ellipse cx="144" cy="115" rx="6.5" ry="4" fill="#e59e7d" opacity=".4"/>
|
|
269
|
-
<g data-mouth="X"><path d="M106 130 Q 120 136 134 130" stroke="${
|
|
270
|
-
<g data-mouth="A"><path d="M105 130 Q 120 124 135 130 Q 120 137 105 130 Z" fill="${
|
|
271
|
-
<g data-mouth="B"><path d="M104 129 Q 120 122 136 129 Q 120 141 104 129 Z" fill="${
|
|
272
|
-
<g data-mouth="C"><ellipse cx="120" cy="131" rx="13" ry="8.5" fill="${
|
|
273
|
-
<g data-mouth="D"><ellipse cx="120" cy="132" rx="16" ry="12" fill="${
|
|
274
|
-
<g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${
|
|
275
|
-
<g data-mouth="F"><ellipse cx="120" cy="131" rx="6" ry="5.5" fill="${
|
|
276
|
-
<g data-mouth="G"><path d="M105 128 Q 120 123 135 128 Q 120 134 105 128 Z" fill="${
|
|
277
|
-
<g data-mouth="H"><ellipse cx="120" cy="131" rx="12" ry="9" fill="${
|
|
320
|
+
<g data-mouth="X"><path d="M106 130 Q 120 136 134 130" stroke="${Ir}" stroke-width="4" fill="none" stroke-linecap="round"/></g>
|
|
321
|
+
<g data-mouth="A"><path d="M105 130 Q 120 124 135 130 Q 120 137 105 130 Z" fill="${Ir}"/></g>
|
|
322
|
+
<g data-mouth="B"><path d="M104 129 Q 120 122 136 129 Q 120 141 104 129 Z" fill="${Pr}"/><rect x="110" y="126" width="20" height="5" rx="2" fill="${Ns}"/></g>
|
|
323
|
+
<g data-mouth="C"><ellipse cx="120" cy="131" rx="13" ry="8.5" fill="${Pr}"/><rect x="109" y="124.5" width="22" height="4.5" rx="2" fill="${Ns}"/></g>
|
|
324
|
+
<g data-mouth="D"><ellipse cx="120" cy="132" rx="16" ry="12" fill="${Pr}"/><rect x="106" y="122" width="28" height="6" rx="2.5" fill="${Ns}"/><ellipse cx="120" cy="140" rx="9" ry="4.5" fill="${ha}"/></g>
|
|
325
|
+
<g data-mouth="E"><ellipse cx="120" cy="131" rx="9" ry="7" fill="${Pr}" stroke="${Ir}" stroke-width="3"/></g>
|
|
326
|
+
<g data-mouth="F"><ellipse cx="120" cy="131" rx="6" ry="5.5" fill="${Pr}" stroke="${Ir}" stroke-width="3.5"/></g>
|
|
327
|
+
<g data-mouth="G"><path d="M105 128 Q 120 123 135 128 Q 120 134 105 128 Z" fill="${Ir}"/><rect x="110" y="127" width="20" height="5" rx="2" fill="${Ns}"/><path d="M108 134 Q 120 139 132 134" stroke="${Ir}" stroke-width="3" fill="none" stroke-linecap="round"/></g>
|
|
328
|
+
<g data-mouth="H"><ellipse cx="120" cy="131" rx="12" ry="9" fill="${Pr}"/><path d="M113 125 Q 120 122 127 125 Q 127 132 120 133 Q 113 132 113 125 Z" fill="${ha}"/></g>
|
|
278
329
|
</g>
|
|
279
330
|
</g>
|
|
280
|
-
</svg>`;function cd(t,o){let a=t?.cues;if(!a?.length||!(o>=0)||t.duration&&o>=t.duration)return"X";let c=0,d=a.length-1,p=-1;for(;c<=d;){let m=c+d>>1;a[m].t<=o?(p=m,c=m+1):d=m-1}if(p<0)return"X";let g=a[p].v;return uo.includes(g)?g:"X"}function ho(t){let o=p=>Math.round(p*1e3)/1e3,a=[],c=(p,g)=>{a.length&&a[a.length-1].v===g||a.push({t:o(p),v:g})},d=0;for(let{timeline:p,gap:g=0}of t){g>0&&(c(d,"X"),d+=g);for(let m of p?.cues??[])c(d+m.t,m.v);d+=p?.duration??0}return{v:1,kind:"visemes",duration:o(d),source:"stitch",cues:a}}function la({root:t,config:o,debugLog:a,toast:c}){let d=o.narration?.character??{},p=d.bridgeUrl??"http://127.0.0.1:8789",g=d.fallback??"amplitude",m="decklight-character:"+location.pathname,w=d.mode??"off",E=d.engine??"wav2lip",S=d.portrait??"default",P=d.solo??!1;try{let ie=JSON.parse(localStorage.getItem(m));ie?.mode&&(w=ie.mode,E=ie.engine??E,S=ie.portrait??S),typeof ie?.solo=="boolean"&&(P=ie.solo)}catch{}let $=null,_=null,C=null,I=null,Se=null,de=null,$e=null,te=0,ae=!1,Re,Fe=new Map,je=new Map,_e=ie=>`${ie}|${E}|${S}`;function Ae(){try{localStorage.setItem(m,JSON.stringify({mode:w,engine:E,portrait:S,solo:P}))}catch{}}function st(){t.classList.toggle("decklight-solo",P&&w!=="off"&&!!$?.classList.contains("show"))}function bt(){ae||(ae=!0,c("lipsync bridge unreachable \u2014 run: decklight lipsync"),a("lipsync","bridge unreachable \u2014 amplitude fallback"))}function T(){if($||($=document.createElement("div"),$.className="decklight-character pos-"+(d.position??"br"),$.setAttribute("aria-hidden","true"),d.size&&$.style.setProperty("--character-size",d.size+"px"),t.appendChild($)),C!==w)if(C=w,$.classList.toggle("mode-video",w==="video"),_=null,w==="video")$.innerHTML="",_=document.createElement("video"),_.muted=!0,_.playsInline=!0,_.preload="auto",$.appendChild(_);else if(d.sprites){$.innerHTML="";for(let ie of uo){if(!d.sprites[ie])continue;let Ze=document.createElement("img");Ze.src=d.sprites[ie],Ze.setAttribute("data-mouth",ie),Ze.alt="",$.appendChild(Ze)}}else if(typeof d.svg=="string"&&d.svg.startsWith("#")){$.innerHTML="";let ie=document.querySelector(d.svg);ie&&$.appendChild(ie.cloneNode(!0))}else typeof d.svg=="string"&&/^\s*</.test(d.svg)?$.innerHTML=d.svg:d.svg?($.innerHTML=po,fetch(d.svg).then(ie=>ie.text()).then(ie=>{$&&C==="viseme"&&($.innerHTML=ie)}).catch(()=>{})):$.innerHTML=po}function Ke(){T(),$.classList.add("show"),te||(te=setInterval(Q,33)),st()}function mt(){te&&(clearInterval(te),te=0),$?.classList.remove("show"),_?.pause(),Se=null,de=null,dt("X"),st()}function dt(ie){ie===$e||!$||($e=ie,$.setAttribute("data-viseme",ie))}let G=null,J=null,ne=null,fe=null;function ue(){if(g!=="amplitude"||!I)return!1;if(ne===I)return!!J;ne=I;try{G??=new(window.AudioContext||window.webkitAudioContext);let ie=G.createMediaElementSource(I);J=G.createAnalyser(),J.fftSize=512,ie.connect(J),J.connect(G.destination),fe=new Uint8Array(J.fftSize)}catch{J=null}return!!J}function Ie(){J.getByteTimeDomainData(fe);let ie=0;for(let v=0;v<fe.length;v++){let ze=(fe[v]-128)/128;ie+=ze*ze}let Ze=Math.sqrt(ie/fe.length);return Ze<.02?"X":Ze<.06?"B":Ze<.12?"C":"D"}function Q(){if($?.classList.contains("show")){if(w==="video"){_&&I&&_.readyState>=2&&!I.paused&&Math.abs(_.currentTime-I.currentTime)>.15&&(_.currentTime=I.currentTime);return}if(!I||I.paused||I.ended){dt("X");return}Se?dt(cd(Se,I.currentTime)):g==="hide"?dt("X"):ue()?dt(Ie()):dt("X")}}function s(ie,Ze,v){if(!Fe.has(ie)){let ze=(async()=>{let f=await Ze;if(!f)return null;let Y=Date.now(),F=await fetch(`${p}/viseme?text=${encodeURIComponent(v??"")}`,{method:"POST",headers:{"content-type":"audio/wav"},body:f.blob});if(!F.ok)throw new Error(String(F.status));let Ce=await F.json();return a("lipsync",`visemes ${ie} \xB7 ${Ce.cues?.length??0} cues \u2192 ${((Date.now()-Y)/1e3).toFixed(1)}s`),Ce})();ze.catch(()=>{Fe.get(ie)===ze&&Fe.delete(ie)}),Fe.set(ie,ze)}return Fe.get(ie)}function i(ie,Ze){let v=_e(ie);if(!je.has(v)){let ze=(async()=>{let f=await Ze;if(!f)return null;let Y=Date.now(),F=await fetch(`${p}/video?engine=${E}&portrait=${encodeURIComponent(S)}`,{method:"POST",headers:{"content-type":"audio/wav"},body:f.blob});if(!F.ok)throw new Error(String(F.status));let Ce=await F.blob(),ce=F.headers?.get?.("x-lipsync-cached")==="1";return a("lipsync",`video ${ie} \xB7 ${E} \u2192 ${((Date.now()-Y)/1e3).toFixed(1)}s${ce?" (cached)":""}`),URL.createObjectURL(Ce)})();ze.catch(()=>{je.get(v)===ze&&je.delete(v)}),je.set(v,ze)}return je.get(v)}function O(ie,Ze,v){w==="viseme"?s(ie,Ze,v).catch(()=>{}):w==="video"&&i(ie,Ze).catch(()=>{})}function De(ie,Ze,v){w!=="off"&&(Ke(),de=ie,w==="viseme"?(Se=null,s(ie,Promise.resolve(Ze),v).then(ze=>{de===ie&&(Se=ze)}).catch(()=>bt())):i(ie,Promise.resolve(Ze)).then(ze=>{de!==ie||!ze||!_||(_.src=ze,_.playbackRate=I?.playbackRate??1,I&&!I.paused&&(_.currentTime=I.currentTime,_.play().catch(()=>{})))}).catch(()=>bt()))}function B(ie,Ze,v=null){if(w==="off"||!ie||ie.live)return;Ke();let ze=String(Ze).padStart(2,"0"),f=v==null?`slide-${ze}`:`slide-${ze}-${String(v).padStart(2,"0")}`,Y=`file|${ie.dir}|${f}`;if(de!==Y){if(de=Y,w==="viseme")Se=null,(async()=>{let F=document.querySelector(`script[data-decklight-visemes="${f}"]`);if(F)return JSON.parse(F.textContent);let Ce=await fetch(`${ie.dir}/${f}.visemes.json`);if(!Ce.ok)throw new Error(String(Ce.status));return Ce.json()})().then(F=>{de===Y&&(Se=F)}).catch(()=>{});else if(_){let F=`${ie.dir}/slide-${ze}.mp4`;if(_.src===new URL(F,location.href).href)return;_.src=F,_.playbackRate=I?.playbackRate??1,_.play().catch(()=>{})}}}function Pe(ie){!ie||I===ie||(I=ie,ie.addEventListener("pause",()=>{w==="video"&&_?.pause()}),ie.addEventListener("play",()=>{w==="video"&&_?.src&&_.play().catch(()=>{})}),ie.addEventListener("ratechange",()=>{_&&(_.playbackRate=ie.playbackRate)}))}async function _t(){try{let ie=await fetch(p+"/ping");Re=ie.ok?await ie.json():null}catch{Re=null}return Re}function W(ie,Ze={}){w=ie,Ze.engine&&(E=Ze.engine),Ze.portrait&&(S=Ze.portrait),Ae(),w==="off"?mt():(ae=!1,T(),P&&Ke()),st(),a("lipsync",w==="off"?"character off":`character ${w}${w==="video"?` \xB7 ${E} \xB7 ${S}`:""}`)}function ye(ie){P=!!ie,Ae();let Ze=!!I&&!I.paused&&!I.ended;P&&w!=="off"?Ke():!P&&!Ze&&mt(),st(),a("lipsync",`character solo ${P?"on":"off"}`)}return{get mode(){return w},get engine(){return E},get portrait(){return S},get solo(){return P},get bridgeInfo(){return Re},setMode:W,setSolo:ye,prefetchSentence:O,beginSentence:De,beginSlide:B,attachAudio:Pe,stop:mt,probe:_t,ensureTimeline:s}}ge();be();function ca(t){let o=String(t??"").replace(/[?#].*$/,"");return o.slice(0,o.lastIndexOf("/")+1)}var da=/^[a-z][a-z0-9+.-]*:|^\/\//i;function ua(t,o,a){let c=t?.slides?.[a-1];return c?c.url?c.url:c.file?da.test(c.file)?c.file:ca(o)+c.file:null:null}function pa(t,o,a,c){let d=t?.slides?.[a-1]?.segments?.[c-1];return d?d.url?d.url:d.file?da.test(d.file)?d.file:ca(o)+d.file:null:null}function Yr(t,o=Date.now()){let a=t?.expires;if(!a)return{at:null,msLeft:1/0,expired:!1};let c=new Date(a);if(Number.isNaN(c.getTime()))return{at:null,msLeft:1/0,expired:!1};let d=c.getTime()-o;return{at:c,msLeft:d,expired:d<=0}}function ha(t){if(!Number.isFinite(t))return"";if(t<=0)return"expired";let o=Math.floor(t/6e4),a=Math.floor(o/60),c=Math.floor(a/24);return c?`${c}d ${a%24}h left`:a?`${a}h ${o%60}m left`:`${Math.max(1,o)}m left`}var Cs=t=>t.toISOString().slice(0,16).replace("T"," ")+"Z";function mo(t){let o=t?.source??"<voice-dir>",a=t?.bucket??"gs://<bucket>/<prefix>",c=t?.signDuration??"7d";return`node tools/publish-voices.mjs ${o} --bucket ${a} --sign ${c}`}function fo(t){return t?.manifest??t?.dir??null}function dd({hasTracks:t,used:o,printMode:a,embedded:c,voiceover:d,captionsOn:p,narrating:g}={}){return!!t&&!o&&!a&&!c&&!d&&!p&&!g}var ud=.25,pd=.5,hd=1;function go(t,o,a){if(t!=null&&String(t).trim()!==""){let c=Number(t);if(Number.isFinite(c)&&c>=0)return c}return typeof o=="number"&&Number.isFinite(o)&&o>=0?o:a}var md=(t,o)=>go(t,o,ud);function Ns(t){let o=(t??[]).map(c=>String(c??"").replace(/\s+/g," ").trim());if(o.filter(Boolean).length<2)return null;let a=0;return o.map(c=>c?++a:null)}var bo=t=>String(t??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/-/g,"_").toLowerCase();function ga(t){return bo(t).split(/\s+/).filter(Boolean).map(o=>o.startsWith("lang:")?{lang:o.slice(5)}:{any:o}).filter(o=>o.lang!=="")}function fd(t,o,a){let c=Array.isArray(a)?a:ga(a);if(!c.length)return!0;let d=bo(t),p=bo(o);return c.every(g=>g.lang!==void 0?p.startsWith(g.lang):d.includes(g.any)||p.includes(g.any))}function ma(t,o=0){let a=(t??[]).map(d=>String(d??"").replace(/\s+/g," ").trim()),c=Ns(a);if(!c){let d=a.filter(Boolean).join(" ");return d?[{seg:0,step:0,file:null,text:d}]:[]}return a.map((d,p)=>d?{seg:p,step:Math.min(p,o),file:c[p],text:d}:null).filter(Boolean)}function gd(t){let o=new Uint8Array(t.length*2),a=new DataView(o.buffer);for(let c=0;c<t.length;c++){let d=Math.max(-1,Math.min(1,t[c]));a.setInt16(c*2,Math.round(d*(d<0?32768:32767)),!0)}return o}function fa({engine:t,voice:o,mine:a=!1}={},c=[]){let d=S=>String(S??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),p=a?"voices/me":`voices/${d(o)||d(t)||"take"}`,g=new Set(c),m=p;for(let S=2;g.has(m);S++)m=`${p}-${S}`;let w=m===p?"":`, take ${m.slice(p.length+1)}`,E=a?`My voice${w}`:`${o||"Narration"}${t?` \xB7 ${t}`:""}${w}`;return{dir:m,label:E}}function bd(t){let o=t?.files;if(!o)return[];if(Array.isArray(o))return o;let a={label:"Narration",dir:o};return t.ext!==void 0&&(a.ext=t.ext),t.segments!==void 0&&(a.segments=t.segments),[a]}function ba({root:t,stage:o,config:a,params:c,printMode:d,toast:p,logOnly:g,debugLog:m,overlays:w,instance:E,syncSoundBtn:S,updateDebugState:P,downloadFromUrl:$,authorBase:_=()=>null,authorReady:C=()=>Promise.resolve()}){let I=0,Se="decklight-narration:"+location.pathname,de=a.narration?.liveUrl??"http://127.0.0.1:8787/tts",$e=[["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"]],te=de.replace(/\/tts\/?$/,"/ping"),ae=de.replace(/\/tts\/?$/,"/voices/install"),Re=de.replace(/\/tts\/?$/,"/engines"),Fe=de.replace(/\/tts\/?$/,"/engine"),je=$e,_e=!0,Ae=null,st=null,bt=new Set,T=null,Ke=!1,mt=null;function dt(){return T??=fetch(te).then(b=>b.ok?b.json():null).then(b=>b?(Ke=!0,G(b),m("tts",`bridge: ${b.engine} \xB7 ${b.model} \xB7 ${je.length} voice(s)`+(_e?"":" \xB7 no style")),b):null).catch(()=>null),T}function G(b){if(!b)return null;if(Ae=b.engine??null,st=typeof b.caveat=="string"?b.caveat:null,Array.isArray(b.voices)&&b.voices.length&&(je=b.voices),_e=b.stylable!==!1,je.length&&!je.some(([A])=>A===Ie.voice)){let A=Ie.voice;Ie={...Ie,voice:je[0][0]},$n(),m("tts",`voice ${A} is not on this bridge \u2014 using ${Ie.voice}`),Q?.live&&p(`voice ${A} \u2192 ${Ie.voice} (this bridge speaks its own roster)`,2600)}return b}let J=[["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"]],ne=([,b,A])=>Ae==="elevenlabs"?A:b,fe=bd(a.narration),ue={live:!0},Ie={voice:"Alnilam",tone:J[0][0],style:J[0][1]},Q=fe[0]??null;try{let b=JSON.parse(localStorage.getItem(Se));if(b?.live?.voice)Ie=b.live,Q=ue;else{let A=b?.track??b?.dir,R=fe.find(U=>fo(U)===A);R&&(Q=R)}}catch{}let s=!1,i=null,O="decklight-narr-rate:"+location.pathname,De=1;try{let b=parseFloat(localStorage.getItem(O)??"");b>=.25&&b<=2&&(De=b)}catch{}function B(b){De=Math.round(Math.min(2,Math.max(.25,De+b))*100)/100;try{localStorage.setItem(O,String(De))}catch{}i&&(i.playbackRate=De),p(`voice speed ${De}\xD7`),m("narr",`rate ${De}\xD7`),P()}let Pe=la({root:t,config:a,debugLog:m,toast:p}),_t=new Map;function W(b){return(E._sections?.[b-1]?.querySelector("aside.notes")?.textContent??"").replace(/⟨CLICK⟩/g," ").replace(/\s+/g," ").trim()}function ye(b){return(E._sections?.[b-1]?.querySelector("aside.notes")?.textContent??"").split("\u27E8CLICK\u27E9").map(R=>R.replace(/\s+/g," ").trim())}function ie(b,A,R){if(!b)return Promise.resolve(null);if(!_t.has(A)){let U=(async()=>{let V=Date.now();try{let he=await fetch(de,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:b,voice:Ie.voice,style:Ie.style})});if(!he.ok)throw new Error(String(he.status));let D=await he.blob(),se=parseFloat(he.headers?.get?.("x-tts-cost")??"")||0;return se&&(I+=se),m("tts",`${R} \xB7 ${Ie.voice} \xB7 ${b.length} chars \u2192 ${((Date.now()-V)/1e3).toFixed(1)}s`+(se?` \xB7 ~$${se.toFixed(4)}`:"")),{url:URL.createObjectURL(D),blob:D}}catch(he){throw m("tts",`${R} \xB7 ${Ie.voice} FAILED after ${((Date.now()-V)/1e3).toFixed(1)}s (${String(he.message||he)})`),he}})();U.catch(()=>{_t.get(A)===U&&_t.delete(A)}),_t.set(A,U)}return _t.get(A)}function Ze(b){return((b??"").match(/[^.!?…]+[.!?…]+[”’"')\]]*|[^.!?…]+$/g)??[]).map(A=>A.trim()).filter(Boolean)}let v=b=>E._records?.[b-1]?.groups.length??0;function ze(b,A){let R=ye(b),U=A<v(b)?[R[A]]:R.slice(A),V=[],he=new Set;for(let D of U){let se=Ze(D);se.length&&he.add(V.length),V.push(...se)}return{sentences:V,segStarts:he}}let f=(b,A)=>ze(b,A).sentences,Y=new Set;function F(b){if(Y.has(b))return;let A=ye(b).length,R=v(b)+1;if(A<=R)return;Y.add(b);let U=`slide ${b}: ${A} \u27E8CLICK\u27E9 segments but ${R} build step${R===1?"":"s"} \u2014 the last ${A-R} ${A-R===1?"is":"are"} spoken on the final step`;g?.(U),m("narr",U)}let Ce=(b,A,R)=>`${b}|s${A}|n${R}|${Ie.voice}|${Ie.style}`;function ce(b,A,R){let U=f(b,A)[R]??"";return ie(U,Ce(b,A,R),`slide ${b} seg ${A} #${R+1}`)}let Ne=b=>E._sections[b-1]?.dataset.narration==="hold",ee=b=>go(E._sections[b-1]?.dataset.narrationPause,a.narration?.slidePause,hd),nt=b=>go(E._sections[b-1]?.dataset.narrationBeatPause,a.narration?.beatPause,pd),pt=b=>md(E._sections[b-1]?.dataset.narrationSentencePause,a.narration?.sentencePause);async function ut(b,A){if(!(b>0))return!He&&!A();for(let R=b*1e3;R>0;){if(A())return!1;let U=Date.now();await new Promise(V=>setTimeout(V,Math.min(150,R))),He||(R-=Date.now()-U)}return!He&&!A()}let ke=10,Ee=3,re=0;function Ge(b){let A=[],R=E.state.slide,U=E.state.step;for(;A.length<b&&R<=E.state.totalSlides;){let V=v(R);for(;U<=V&&A.length<b;U++){let he=f(R,U).length;for(let D=0;D<he&&A.length<b;D++)A.push([R,U,D])}R+=1,U=0}return A}async function ht(){let b=++re,A=async()=>{for(;b===re&&s&&Q?.live;){let R=Ge(ke).find(([U,V,he])=>!_t.has(Ce(U,V,he)));if(!R)return;try{if(await ce(R[0],R[1],R[2]),Pe.mode!=="off"){let[U,V,he]=R;Pe.prefetchSentence(Ce(U,V,he),_t.get(Ce(U,V,he)),Ze(ye(U)[V])[he]??"")}}catch{return}await new Promise(U=>setTimeout(U,30))}};await Promise.all(Array.from({length:Ee},A))}let tt=0,He=!1,gt=!1,Yt=0;function nn(){if(!s){p("narration is off \u2014 \u23B5 starts it");return}He=!He,He?i?.pause():i?.src&&i.paused&&!i.ended&&i.currentTime>0?i.play().catch(()=>{}):gt||oe(),p(He?"\u23F8 narration paused \u2014 \u23B5 resumes":"\u25B6 narration resumed"),m("narr",He?"paused":"resumed"),P()}let It=()=>Q?.live?"live":Q?"file":null;async function Wt(b,A,{mode:R="live",endOfSlide:U=!1}={}){let V=tt,he=()=>V!==tt||!s||It()!==R||E.state.slide!==b||E.state.step!==A;if(He||he())return;let D=async(Xe,Je)=>(Xe>0&&m("narr",`slide ${b} \u2014 holding ${Xe}s before ${Je}`),ut(Xe,he)),se=E._records[b-1];if(!U&&A<(se?se.groups.length:0)){if(!await D(nt(b),"the next build"))return;E.next();return}Ne(b)||b>=E.state.totalSlides||await D(ee(b),"the next slide")&&E.goto(b+1,0)}async function oe(){let b=E.state.slide,A=E.state.step,R=++tt;if(ht(),!W(b)){if(Ne(b)){m("narr",`hold on slide ${b} \u2014 manual advance`);return}setTimeout(()=>{R!==tt||!s||!Q?.live||E.state.slide===b&&b<E.state.totalSlides&&E.goto(b+1,0)},400);return}F(b);let U=f(b,A);if(!U.length){setTimeout(()=>{R===tt&&Wt(b,A)},600);return}let V=()=>R!==tt||!s||E.state.slide!==b||E.state.step!==A;Yt=R,gt=!0;let he=0;try{for(let D=0;D<U.length;D++){for(;He;){if(V())return;await new Promise(Je=>setTimeout(Je,150))}if(V())return;let se;try{se=await ce(b,A,D)}catch(Je){m("narr",`sentence failed (slide ${b} seg ${A} #${D+1}) \u2014 narration stopped`),H(pn(Je));return}if(V())return;if(!se)continue;ot(U[D]),i??=new Audio,Pe.mode!=="off"&&(Pe.attachAudio(i),Pe.beginSentence(Ce(b,A,D),se,U[D])),i.onended=null,i.onerror=null,i.src=se.url,i.playbackRate=De;let Xe=!1;if(await new Promise(Je=>{i.onended=Je,i.play().catch(()=>{Xe=!0,Je()})}),Xe){H("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}if(he++,D<U.length-1&&!await ut(pt(b),V))return}if(V())return;if(!he&&U.length){H("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}await Wt(b,A)}finally{Yt===R&&(gt=!1)}}function pn(b){let A=String(b?.message??b);return A.startsWith("429")?"\u{1F507} voice quota exceeded (429) \u2014 auto-advance stopped \xB7 a free engine: decklight author --tts-engine chirp":/^\d{3}/.test(A)?`\u{1F507} voice bridge error ${A.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 Bt=new Map,rn=new Map,gn=new Set,Lt=null;function mn(b){for(let A of document.querySelectorAll('script[type="application/json"][data-decklight-voices]'))if(A.getAttribute("data-decklight-voices")===b)try{return JSON.parse(A.textContent)}catch{return null}return null}function Dt(b){if(!Bt.has(b)){let A=mn(b);Bt.set(b,A?Promise.resolve(A):fetch(b).then(R=>{if(!R.ok)throw new Error(`HTTP ${R.status}`);return R.json()}).catch(R=>{throw Bt.delete(b),R})),Bt.get(b).then(R=>rn.set(b,R)).catch(()=>{})}return Bt.get(b)}function Ct(b){let A=rn.get(b.manifest);if(!A)return gn.has(b.manifest)?"hosted \u2014 the voice list did not load":(Dt(b.manifest).catch(()=>gn.add(b.manifest)).then(()=>{qt&&St==="tracks"&&me("tracks")}),"hosted \u2014 checking\u2026");let R=Yr(A);return R.at?R.expired?`EXPIRED ${Cs(R.at)} \u2014 re-sign to play`:`signed \xB7 ${ha(R.msLeft)}`:"hosted \xB7 no expiry"}async function Kt(){if(!Q||Q.live||!Q.manifest)return Lt=null,X=Rt(),!0;if(Lt?.track!==Q)try{Lt={track:Q,data:await Dt(Q.manifest)}}catch(A){return Lt=null,H(`\u{1F507} could not load the voice list for \u201C${Q.label}\u201D (${Q.manifest} \u2014 ${A.message}) \u2014 auto-advance stopped`),!1}let b=Yr(Lt.data);return b.expired?(H(`\u{1F507} the signed voices for \u201C${Q.label}\u201D expired ${Cs(b.at)} \u2014 auto-advance stopped \xB7 re-sign: ${mo(Lt.data)}`),!1):(X=Rt(),!0)}function Rt(){if(N.clear(),!Q||Q.live||Q.segments===!1)return!1;if(Q.manifest){let b=Lt?.data,A=b?.slides??[],R=!!Yr(b).at;return A.some(U=>Array.isArray(U?.segments)&&U.segments.length&&(!R||U.segments.every(V=>V?.url)))}return Q.segments===!0}let N=new Set,X=!1;function pe(b,A){if(!X||N.has(b))return null;let R=ye(b),U=Ns(R);if(!U)return null;let V=A>=v(b),he=Math.min(A,U.length),D=(V?U.slice(he):U.slice(he,he+1)).filter(se=>se!==null).map(se=>({file:se,url:Q.manifest?pa(Lt?.data,Q.manifest,b,se):`${Q.dir}/slide-${String(b).padStart(2,"0")}-${String(se).padStart(2,"0")}.${Q.ext??"m4a"}`}));return D.every(se=>se.url)?D:null}function Me(b){return Q.manifest?ua(Lt?.data,Q.manifest,b):`${Q.dir}/slide-${String(b).padStart(2,"0")}.${Q.ext??"m4a"}`}function Le(){if(Q)return Q.live?oe():X?j():qe()}function qe({selfDriving:b=!1,gen:A=tt}={}){let R=E.state.slide,U=E.state.step;if(!W(R)){i?.pause();return}let V=Me(R);if(!V){i?.pause();return}i??=new Audio,i.onended=null,i.onerror=null,i.src=V,i.playbackRate=De,Pe.mode!=="off"&&(Pe.attachAudio(i),Pe.beginSlide(Q,R)),b&&(i.onended=()=>{A===tt&&Wt(R,U,{mode:"file",endOfSlide:!0})});let he=!1;i.onerror=()=>{he=!0,M(R,V)},i.play().catch(D=>{D?.name==="NotAllowedError"?p("\u{1F507} the browser blocked audio \u2014 click the deck once, then V"):he||M(R,V)})}function M(b,A,{fatal:R=!1}={}){m("narr",`no audio: ${A}`);let U=Q?.manifest?Yr(Lt?.data):null;if(U?.at){m("narr","signed url failed \u2014 a media element cannot report the status"),H(`\u{1F507} slide ${b} of \u201C${Q.label}\u201D would not load (signed until ${Cs(U.at)}) \u2014 auto-advance stopped \xB7 re-sign: ${mo(Lt?.data)}`);return}if(R){H(`\u{1F507} no audio for slide ${b} (${A}) \u2014 auto-advance stopped \xB7 press the key left of 1 for messages`);return}p(`\u{1F507} no narration for slide ${b} (${A}) \xB7 press the key left of 1 for messages`)}async function j(){let b=E.state.slide,A=E.state.step,R=++tt;if(!W(b)){if(Ne(b)){m("narr",`hold on slide ${b} \u2014 manual advance`);return}setTimeout(()=>{R!==tt||!s||It()!=="file"||E.state.slide===b&&b<E.state.totalSlides&&E.goto(b+1,0)},400);return}F(b);let U=pe(b,A);if(!U){qe({selfDriving:!0,gen:R});return}if(!U.length){setTimeout(()=>{R===tt&&Wt(b,A,{mode:"file"})},600);return}let V=()=>R!==tt||!s||It()!=="file"||E.state.slide!==b||E.state.step!==A;Yt=R,gt=!0;try{for(let he=0;he<U.length;he++){for(;He;){if(V())return;await new Promise(se=>setTimeout(se,150))}if(V())return;i??=new Audio,Pe.mode!=="off"&&(Pe.attachAudio(i),Pe.beginSlide(Q,b,U[he].file)),i.onended=null,i.onerror=null,i.src=U[he].url,i.playbackRate=De;let D=await new Promise(se=>{i.onended=()=>se("ended"),i.onerror=()=>se("error"),i.play().catch(Xe=>se(Xe?.name==="NotAllowedError"?"blocked":"error"))});if(V())return;if(D==="blocked"){H("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}if(D==="error"){if(A===0&&he===0){m("narr",`no segments for slide ${b} \u2014 falling back to the whole-slide file`),N.add(b),qe({selfDriving:!0,gen:R});return}M(b,U[he].url,{fatal:!0});return}}if(V())return;await Wt(b,A,{mode:"file"})}finally{Yt===R&&(gt=!1)}}function H(b="narration off"){s=!1,tt++,re++,He=!1,i?.pause(),Pe.stop(),p(b),m("narr",b),S()}function we(){return s?nn():We()}let Ye=()=>s||He;async function We(){if(!Q){p(fe.length||Ke?"no voice chosen \u2014 V picks one":"no narration here \u2014 V shows what is available");return}if(s)return H();if(jn(),Q.live&&await dt(),!await Kt())return;s=!0;let b=Q.live?`\u26A1 ${Ie.voice} \xB7 ${Ie.tone}`:Q.label;p(`\u{1F50A} ${b} \u2014 \u23B5 pauses \xB7 V picks`),m("narr",`on \u2014 ${b}`),Le(),S()}E.on("slide",()=>{s&&Le()}),E.on("build",()=>{s&&(Q?.live?oe():X&&j())});let Ve="decklight-captions:"+location.pathname,xe=!1;try{xe=localStorage.getItem(Ve)==="1"}catch{}let Oe=null;function ot(b){Oe&&(Oe.textContent=b,Oe.classList.toggle("show",!!b))}function Et(){if(Oe){if(s&&Q?.live){ot("");return}ot(f(E.state.slide,E.state.step).join(" "))}}function Tt(){Oe=document.createElement("div"),Oe.className="decklight-captions",Oe.setAttribute("aria-live","polite"),t.appendChild(Oe),Et()}function yt(){xe=!xe;try{localStorage.setItem(Ve,xe?"1":"0")}catch{}xe?(Tt(),Sn()):(Oe?.remove(),Oe=null),p(`captions ${xe?"on":"off"}`),m("narr",`captions ${xe?"on":"off"}`)}E.on("slide",Et),E.on("build",Et),xe&&!d&&Tt();let Qe="\u{1F50A} this deck has a voice-over \u2014 V plays it",wt=900,L=12e3,Pt="decklight-narr-used:"+location.pathname,sn=!1;try{sn=localStorage.getItem(Pt)==="1"}catch{}let on=null;function Sn(){if(!on)return;let b=on;on=null,b.classList.remove("show"),setTimeout(()=>b.remove(),260)}function jn(){if(Sn(),!sn){sn=!0;try{localStorage.setItem(Pt,"1")}catch{}}}function or(){let b=document.createElement("button");b.type="button",b.className="decklight-narr-hint",b.setAttribute("aria-label","Play this deck\u2019s voice-over");let A=document.createElement("kbd");A.textContent="V",b.append("\u{1F50A} this deck has a voice-over \u2014 ",A," plays it"),b.addEventListener("click",()=>{Sn(),We()}),on=b,t.appendChild(b),b.offsetWidth,b.classList.add("show"),g?.(Qe),m("narr","voice-over hint shown"),setTimeout(Sn,L)}dd({hasTracks:fe.length>0,used:sn,printMode:d,embedded:!!c?.has("embedded"),voiceover:!!c?.has("voiceover"),captionsOn:xe})&&setTimeout(()=>{s||or()},wt);let qt=null,bn=0,St="tracks",At=[],yn=null;function $n(){try{localStorage.setItem(Se,JSON.stringify(Q?.live?{live:Ie}:{track:fo(Q),dir:Q?.dir}))}catch{}}function Cn(b,A){Ie={voice:yn??Ie.voice,tone:b,style:A},Q=ue,$n(),an(),s||(s=!0),p(`\u26A1 live voice: ${Ie.voice} \xB7 ${Ie.tone} \u2014 V stops`),m("narr",`live config \u2014 ${Ie.voice} \xB7 ${Ie.tone}`),Le()}function xn(b,{scroll:A=!1}={}){At.length&&(bn=vn(qt.querySelectorAll(".narr-row"),b,"narr-sel",{scroll:A}))}function wr(){At[bn]?.commit()}function An(){St==="custom"?me("tones"):St==="tones"||St==="engines"?me("voices"):St==="charvideo"?me("character"):St==="record"||St==="voices"||St==="character"?me("tracks"):an()}let cn=!1;function _n(b,A){Pe.setMode(b,A),an(),p(b==="off"?"character off":b==="viseme"?`\u{1F3AD} character on \u2014 lips follow the narration${s?"":" \xB7 V starts it"}`:`\u{1F3A5} character video \u2014 ${Pe.engine} \xB7 ${Pe.portrait}${s?"":" \xB7 V starts narration"}`)}function Nn(b){if(Pe.mode==="off"){p("turn the character on first \u2014 N \xB7 Character\u2026");return}Pe.setSolo(b),an(),p(b?"\u{1F3AD} solo \u2014 the narrator has the stage \xB7 N brings the slides back":"solo off \u2014 the slides are back")}let dn="Hey, this is Decklight",Xt=dn,wn="",fn=!1,ir=null,Nt=new Map,Mn=new Map,ar=null,Gn=new Set;function Kn(b){if(b===dn)return Nt;if(b!==ar){for(let A of Mn.values())A.then(R=>URL.revokeObjectURL(R)).catch(()=>{});Mn=new Map,ar=b}return Mn}let On=(b,A)=>`${b}|${A||""}`;function k(b,A,R,U=""){let V=On(A,U);if(!b.has(V)){let he=(async()=>{let D=Date.now(),se=await fetch(de,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:R,voice:A,style:U})});if(!se.ok)throw new Error(String(se.status));let Xe=await se.blob(),Je=parseFloat(se.headers?.get?.("x-tts-cost")??"")||0;return Je&&(I+=Je),m("tts",`preview ${A}${U?" (styled)":""} \xB7 ${((Date.now()-D)/1e3).toFixed(1)}s`+(Je?` \xB7 ~$${Je.toFixed(4)}`:"")),URL.createObjectURL(Xe)})();he.catch(()=>{b.get(V)===he&&b.delete(V)}),b.set(V,he)}return b.get(V)}async function z(b,A,R){let U=`${R}|${b}`;if(Gn.has(U))return;Gn.add(U);let V=b===dn,he=V?Nt:Mn;try{m("narr",`preview prefetch ${R} (${V?"default":"custom"} sentence)`);for(let{voice:D,style:se}of A){if(!V&&ar!==b)return;he.has(On(D,se))||await k(he,D,b,se).catch(()=>{})}m("narr",`preview prefetch ${R} complete`)}finally{Gn.delete(U)}}function K({voice:b,style:A="",prefetch:R},U){let V=Xt.trim();if(!V)return;let he=Kn(V);U&&(U.textContent="\u2026"),k(he,b,V,A).then(D=>{if(U?.isConnected&&(U.textContent="\u25B6"),ir??=new Audio,ir.src=D,ir.play().catch(()=>{}),m("narr",`preview ${b}${A?" \xB7 styled":""}`),R==="voices"){let se=At.filter(Xe=>Xe.preview).map(Xe=>({voice:Xe.preview.voice,style:""}));z(V,se,"voices")}else R==="tones"&&z(V,J.map(se=>({voice:b,style:ne(se)})),`tones:${b}`)}).catch(()=>{U?.isConnected&&(U.textContent="\u25B6"),p("live voice bridge unreachable \u2014 run: decklight tts"),m("narr",`preview ${b} failed`)})}function me(b){let A=St;St=b,b==="voices"&&A!=="voices"&&(fn=!0);let R=qt.querySelector(".narr-card");R.innerHTML="";let U=document.createElement("div");if(U.className="narr-head",R.appendChild(U),At=[],b==="tracks")U.textContent="narration",fe.forEach(D=>At.push({text:D.manifest?`\u2601 ${D.label}`:`\u{1F50A} ${D.label} (${D.dir}/)`,flavor:D.manifest?Ct(D):"",cur:D===Q,commit:()=>{Q=D,$n(),an(),p(`\u{1F50A} track: ${D.label}`),s&&Kt().then(se=>{se&&Le()})}})),At.push({text:"\u26A1 Live voice \u2014 synthesize on the fly\u2026",cur:Q?.live,commit:()=>me("voices")}),At.push({text:"\u{1F9D1} Character \u2014 animated narrator\u2026",cur:Pe.mode!=="off",commit:()=>me("character")}),At.push({text:"\u{1F399} Record this deck\u2026",flavor:fe.some(D=>!D.live)?"re-record, or add another take":"write the audio to a folder",commit:()=>me("record")}),At.push({text:`${xe?"\u2611":"\u2610"} Captions \u2014 follow the voice on screen`,flavor:"C",toggle:!0,commit:()=>{yt(),me("tracks")}}),At.push({text:`\u23E9 Speed \u2014 ${De}\xD7`,flavor:"< slower \xB7 > faster",toggle:!0,commit:()=>{B(De>=2?-1.75:.25),me("tracks")}});else if(b==="record"){U.textContent="record this deck \u2014 writes wav files beside it";let D=Sr();At.push({text:"\u{1F3A4} With your voice \u2014 read it aloud, beat by beat",flavor:D?"":"the deck turns pages as you speak",blocked:D||null,commit:()=>{if(D)return p(D,5e3);an(),Gr()}});let se=Q?.live?null:"pick a live voice first \u2014 \u26A1 Live voice, above";At.push({text:"\u{1F50A} With the synthesized voice \u2014 unattended",flavor:se?"":`speaks every slide as ${Ie.voice}`,blocked:se,commit:()=>{if(se)return p(se,5e3);an(),xr()}})}else if(b==="character"){U.textContent="character \u2014 an animated narrator lip-syncs the voice",cn||(cn=!0,Pe.probe().then(()=>{qt&&St==="character"&&me("character")}));let D=Pe.bridgeInfo,se=D?.engines?.video??[];At.push({text:"Off",cur:Pe.mode==="off",commit:()=>_n("off")}),At.push({text:"\u{1F3AD} 2D character \u2014 offline visemes",flavor:D?.engines?.viseme?"":"bridge offline \u2014 amplitude fallback",cur:Pe.mode==="viseme",commit:()=>_n("viseme")}),At.push({text:`\u{1F3A5} Neural video \u2014 local GPU${se.length?"\u2026":""}`,flavor:se.length?"":"needs the bridge \u2014 run: decklight lipsync",cur:Pe.mode==="video",commit:()=>{se.length?me("charvideo"):p("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),Pe.mode!=="off"&&At.push({text:`${Pe.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage`,flavor:"slide content steps aside",cur:Pe.solo,commit:()=>Nn(!Pe.solo)})}else if(b==="charvideo"){U.textContent="neural video \u2014 pick engine \xB7 portrait";let D=Pe.bridgeInfo;for(let se of D?.engines?.video??[])for(let Xe of D?.portraits?.length?D.portraits:["default"])At.push({text:`\u{1F3A5} ${se} \xB7 ${Xe}`,cur:Pe.mode==="video"&&Pe.engine===se&&Pe.portrait===Xe,commit:()=>_n("video",{engine:se,portrait:Xe})})}else if(b==="engines")U.textContent="live voice \u2014 which engine speaks",mt||fetch(Re).then(D=>D.ok?D.json():{stale:!0}).then(D=>{mt=D?.stale?"stale":D?.engines??[]}).catch(()=>{mt=[]}).then(()=>{qt&&St==="engines"&&me("engines")}),mt?mt==="stale"?At.push({text:`\u26A1 ${Ae??"the bridge"} \u2014 and it cannot be changed from here`,flavor:"this voice bridge predates the engine picker",blocked:"restart it: decklight author",cur:!0,commit:()=>{}}):mt.length||At.push({text:"no voice bridge is answering",flavor:"the engine list comes from it",blocked:"decklight author",cur:!1,commit:()=>{}}):At.push({text:"asking the bridge\u2026",cur:!1,commit:()=>{}}),(Array.isArray(mt)?mt:[]).forEach(D=>At.push({text:D.name,flavor:D.ready?D.cost??"":D.why??"unavailable",blocked:D.ready?null:D.fix??null,cur:!!D.current,commit:()=>et(D)}));else if(b==="voices"){let D=ga(wn),se=D.length?je.filter(([vt,Ft])=>fd(vt,Ft,D)):je;U.textContent=D.length?`live voice \u2014 ${se.length} of ${je.length} \xB7 \u25B6 previews`:"live voice \u2014 pick a voice \xB7 \u25B6 previews",At.push({text:`\u2699 engine: ${Ae??"the bridge"}\u2026`,flavor:"changes which voices exist",cur:!1,commit:()=>me("engines")});let Xe=document.createElement("div");Xe.className="narr-preview-row narr-filter-row";let Je=document.createElement("input");Je.className="narr-input narr-filter",Je.value=wn,Je.placeholder="Filter voices \u2014 try fr, or lang:fr",Je.setAttribute("aria-label","Filter voices by name or language"),Je.addEventListener("input",()=>{wn=Je.value,fn=!0,me("voices")}),Je.addEventListener("keydown",vt=>{vt.key==="Escape"?(wn?(wn="",fn=!0,me("voices")):An(),vt.preventDefault()):(vt.key==="ArrowDown"||vt.key==="Enter")&&(fn=!1,Je.blur(),xn(0,{scroll:!0}),vt.preventDefault()),vt.stopPropagation()}),Xe.appendChild(Je),R.appendChild(Xe);let Be=document.createElement("div");Be.className="narr-preview-row";let at=document.createElement("input");at.className="narr-input narr-preview-text",at.value=Xt,at.placeholder="Preview sentence",at.setAttribute("aria-label","Preview sentence"),at.addEventListener("input",()=>{Xt=at.value}),at.addEventListener("keydown",vt=>{vt.key==="Escape"&&(An(),vt.preventDefault()),vt.stopPropagation()});let Mt=document.createElement("button");Mt.type="button",Mt.className="narr-prev-btn narr-reset-btn",Mt.textContent="\u21BA",Mt.title="restore the default sentence",Mt.setAttribute("aria-label","restore the default preview sentence"),Mt.addEventListener("click",vt=>{vt.stopPropagation(),Xt=dn,at.value=dn}),Be.append(at,Mt),R.appendChild(Be),(Ae==="say"||Ae==="sapi")&&st&&!je.some(([,,vt])=>vt==="best")&&At.push({text:Ae==="sapi"?"\u2B07 Get natural voices \u2014 free download":"\u2B07 Get Siri voices \u2014 free download",flavor:Ae==="sapi"?"opens Settings \u2192 Narrator":"opens System Settings",group:"best",commit:()=>{fetch(ae,{method:"POST"}).then(vt=>vt.json()).then(vt=>{if(!vt?.ok)throw new Error(vt?.error||"refused")}).then(()=>p("System Settings opened \u2014 download a Siri voice, then restart decklight tts",5200)).catch(()=>p(st,6e3))}});let Ot=["novelty","other languages"],Jt=new Set;se.forEach(([vt,Ft,jt])=>{if(!D.length&&jt&&Ot.includes(jt)&&!bt.has(jt)){if(!Jt.has(jt)){Jt.add(jt);let Pn=se.filter(([,,ps])=>ps===jt).length;At.push({text:`\u2023 ${jt==="novelty"?"novelty voices":jt} (${Pn})`,toggle:!0,cur:!1,commit:()=>{bt.add(jt),me("voices")}})}return}At.push({text:vt,flavor:Ft,group:jt??null,preview:{voice:vt,style:"",prefetch:"voices"},cur:Q?.live&&Ie.voice===vt,commit:()=>{if(yn=vt,_e)return me("tones");Cn(Ae??"plain","")}})}),D.length&&!se.length&&At.push({text:"no voice matches",flavor:"Esc clears the filter \xB7 lang:fr narrows to a language",blocked:!0,commit:()=>{}})}else if(b==="tones")U.textContent=`live voice \xB7 ${yn??Ie.voice} \u2014 pick a tone \xB7 \u25B6 previews`,J.forEach(D=>{let[se]=D,Xe=ne(D);At.push({text:se,preview:{voice:yn??Ie.voice,style:Xe,prefetch:"tones"},cur:Q?.live&&Ie.tone===se,commit:()=>Cn(se,Xe)})}),At.push({text:"Custom\u2026",cur:Q?.live&&Ie.tone==="Custom",commit:()=>me("custom")});else{U.textContent=`live voice \xB7 ${yn??Ie.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let D=document.createElement("div");D.className="narr-preview-row";let se=document.createElement("input");se.className="narr-input",se.value=Ie.style,se.placeholder="Read in a \u2026",se.addEventListener("keydown",Je=>{Je.key==="Enter"?(Ht(),Je.preventDefault()):Je.key==="Escape"&&(An(),Je.preventDefault()),Je.stopPropagation()});let Xe=document.createElement("button");Xe.type="button",Xe.className="narr-prev-btn narr-reset-btn",Xe.textContent="\u25B6",Xe.title="preview this delivery instruction",Xe.setAttribute("aria-label","preview this delivery instruction"),Xe.addEventListener("click",Je=>{Je.stopPropagation();let Be=se.value.trim();Be&&K({voice:yn??Ie.voice,style:Be},Xe)}),D.append(se,Xe),R.appendChild(D),setTimeout(()=>{se.focus(),se.select()},0),At=[],bn=0;return}let V=null;At.forEach((D,se)=>{if(D.group!==V&&(V=D.group??null,D.group)){let Be=document.createElement("div");Be.className="narr-group",Be.textContent=D.group,R.appendChild(Be)}let Xe=document.createElement("div");Xe.className="narr-row"+(D.cur?" narr-cur":"")+(D.toggle?" narr-toggle":"")+(D.blocked||D.blocked===""?" narr-blocked":"");let Je=document.createElement("span");if(Je.className="narr-row-label",Je.textContent=D.text,D.flavor){let Be=document.createElement("span");Be.className="narr-flavor",Be.textContent=D.flavor,Je.appendChild(Be)}if(Xe.appendChild(Je),D.blocked){let Be=document.createElement("div");Be.className="narr-fix",Be.textContent=D.blocked,Xe.appendChild(Be)}if(D.preview){let Be=document.createElement("button");Be.type="button",Be.className="narr-prev-btn",Be.textContent="\u25B6",Be.title=`preview ${D.preview.voice}`,Be.setAttribute("aria-label",`preview ${D.preview.voice}`),Be.addEventListener("click",at=>{at.stopPropagation(),K(D.preview,Be)}),Xe.appendChild(Be)}Xe.addEventListener("mouseenter",()=>xn(se)),Xe.addEventListener("click",()=>{xn(se),wr()}),R.appendChild(Xe)});let he=At.findIndex(D=>D.cur);if(xn(Math.max(0,he),{scroll:!0}),fn){let D=R.querySelector(".narr-filter");D&&(D.focus(),D.setSelectionRange(D.value.length,D.value.length))}}async function et(b){if(b?.name){if(!b.ready)return p(b.fix?`${b.name}: ${b.why} \u2014 ${b.fix}`:`${b.name}: ${b.why??"unavailable"}`,5e3);if(b.current)return me("voices");try{let R=await(await fetch(Fe,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:b.name})})).json();if(!R.ok)return p(`${b.name}: ${R.why??R.error}${R.fix?` \u2014 ${R.fix}`:""}`,5e3);T=Promise.resolve(G(R)),mt=null,m("tts",`engine \u2192 ${R.engine} \xB7 ${R.model} \xB7 ${je.length} voice(s)`),p(`\u26A1 engine: ${R.engine}${R.cost?` \xB7 ${R.cost}`:""} \u2014 this session only`,3200),R.caveat&&p(R.caveat,6e3),me("voices")}catch{p(`${b.name}: the voice bridge did not answer`,3e3)}}}function Ht(){let b=qt?.querySelector(".narr-input")?.value.trim();b&&Cn("Custom",b)}function un(b){if(qt&&b===void 0)return an();qt||(qt=document.createElement("div"),qt.className="decklight-narr",qt.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',Ut(qt,an),t.appendChild(qt)),me(b??"tracks"),dt().then(A=>{A&&qt&&St==="voices"&&me("voices")})}function an(){qt?.remove(),qt=null,bt.clear(),wn="",fn=!1,cn=!1}let Vt=null,qn="confirm",en=0,Ln=null;function Wn(){let b=[];for(let V=1;V<=E.state.totalSlides;V++)W(V)&&b.push(V);let A=/^(\d+)(?:-(\d+))?$/.exec(c?.get?.("slides")??"");if(!A)return b;let R=Number(A[1]),U=A[2]?Number(A[2]):R;return b.filter(V=>V>=R&&V<=U)}function Vn(b){let A=Math.round(b/1e3);return A<60?`${A}s`:`${Math.floor(A/60)}m${String(A%60).padStart(2,"0")}s`}function lr(b,A={}){qn=b;let R=Vt.querySelector(".narr-card");if(b==="confirm"){let U=A.total;R.innerHTML=`<div class="narr-head">record offline narration</div>
|
|
281
|
-
<div class="rec-line">\u26A1 ${
|
|
282
|
-
<div class="rec-line">${
|
|
283
|
-
${
|
|
331
|
+
</svg>`;function xd(t,o){let a=t?.cues;if(!a?.length||!(o>=0)||t.duration&&o>=t.duration)return"X";let c=0,d=a.length-1,p=-1;for(;c<=d;){let m=c+d>>1;a[m].t<=o?(p=m,c=m+1):d=m-1}if(p<0)return"X";let f=a[p].v;return uo.includes(f)?f:"X"}function ho(t){let o=p=>Math.round(p*1e3)/1e3,a=[],c=(p,f)=>{a.length&&a[a.length-1].v===f||a.push({t:o(p),v:f})},d=0;for(let{timeline:p,gap:f=0}of t){f>0&&(c(d,"X"),d+=f);for(let m of p?.cues??[])c(d+m.t,m.v);d+=p?.duration??0}return{v:1,kind:"visemes",duration:o(d),source:"stitch",cues:a}}function ma({root:t,config:o,debugLog:a,toast:c}){let d=o.narration?.character??{},p=d.bridgeUrl??"http://127.0.0.1:8789",f=d.fallback??"amplitude",m="decklight-character:"+location.pathname,v=d.mode??"off",k=d.engine??"wav2lip",S=d.portrait??"default",P=d.solo??!1;{let ee=Bn(m);ee?.mode&&(v=ee.mode,k=ee.engine??k,S=ee.portrait??S),typeof ee?.solo=="boolean"&&(P=ee.solo)}let T=null,A=null,N=null,I=null,Se=null,pe=null,Oe=null,re=0,ce=!1,Me,ze=new Map,Ve=new Map,$e=ee=>`${ee}|${k}|${S}`;function _e(){Dn(m,{mode:v,engine:k,portrait:S,solo:P})}function Ze(){t.classList.toggle("decklight-solo",P&&v!=="off"&&!!T?.classList.contains("show"))}function bt(){ce||(ce=!0,c("lipsync bridge unreachable \u2014 run: decklight lipsync"),a("lipsync","bridge unreachable \u2014 amplitude fallback"))}function _(){if(T||(T=document.createElement("div"),T.className="decklight-character pos-"+(d.position??"br"),T.setAttribute("aria-hidden","true"),d.size&&T.style.setProperty("--character-size",d.size+"px"),t.appendChild(T)),N!==v)if(N=v,T.classList.toggle("mode-video",v==="video"),A=null,v==="video")T.innerHTML="",A=document.createElement("video"),A.muted=!0,A.playsInline=!0,A.preload="auto",T.appendChild(A);else if(d.sprites){T.innerHTML="";for(let ee of uo){if(!d.sprites[ee])continue;let We=document.createElement("img");We.src=d.sprites[ee],We.setAttribute("data-mouth",ee),We.alt="",T.appendChild(We)}}else if(typeof d.svg=="string"&&d.svg.startsWith("#")){T.innerHTML="";let ee=document.querySelector(d.svg);ee&&T.appendChild(ee.cloneNode(!0))}else typeof d.svg=="string"&&/^\s*</.test(d.svg)?T.innerHTML=d.svg:d.svg?(T.innerHTML=po,fetch(d.svg).then(ee=>ee.text()).then(ee=>{T&&N==="viseme"&&(T.innerHTML=ee)}).catch(()=>{})):T.innerHTML=po}function je(){_(),T.classList.add("show"),re||(re=setInterval(Y,33)),Ze()}function gt(){re&&(clearInterval(re),re=0),T?.classList.remove("show"),A?.pause(),Se=null,pe=null,ut("X"),Ze()}function ut(ee){ee===Oe||!T||(Oe=ee,T.setAttribute("data-viseme",ee))}let Q=null,j=null,oe=null,he=null;function le(){if(f!=="amplitude"||!I)return!1;if(oe===I)return!!j;oe=I;try{Q??=new(window.AudioContext||window.webkitAudioContext);let ee=Q.createMediaElementSource(I);j=Q.createAnalyser(),j.fftSize=512,ee.connect(j),j.connect(Q.destination),he=new Uint8Array(j.fftSize)}catch{j=null}return!!j}function Re(){j.getByteTimeDomainData(he);let ee=0;for(let w=0;w<he.length;w++){let Ie=(he[w]-128)/128;ee+=Ie*Ie}let We=Math.sqrt(ee/he.length);return We<.02?"X":We<.06?"B":We<.12?"C":"D"}function Y(){if(T?.classList.contains("show")){if(v==="video"){A&&I&&A.readyState>=2&&!I.paused&&Math.abs(A.currentTime-I.currentTime)>.15&&(A.currentTime=I.currentTime);return}if(!I||I.paused||I.ended){ut("X");return}Se?ut(xd(Se,I.currentTime)):f==="hide"?ut("X"):le()?ut(Re()):ut("X")}}function s(ee,We,w){if(!ze.has(ee)){let Ie=(async()=>{let g=await We;if(!g)return null;let J=Date.now(),z=await fetch(`${p}/viseme?text=${encodeURIComponent(w??"")}`,{method:"POST",headers:{"content-type":"audio/wav"},body:g.blob});if(!z.ok)throw new Error(String(z.status));let Ce=await z.json();return a("lipsync",`visemes ${ee} \xB7 ${Ce.cues?.length??0} cues \u2192 ${((Date.now()-J)/1e3).toFixed(1)}s`),Ce})();Ie.catch(()=>{ze.get(ee)===Ie&&ze.delete(ee)}),ze.set(ee,Ie)}return ze.get(ee)}function i(ee,We){let w=$e(ee);if(!Ve.has(w)){let Ie=(async()=>{let g=await We;if(!g)return null;let J=Date.now(),z=await fetch(`${p}/video?engine=${k}&portrait=${encodeURIComponent(S)}`,{method:"POST",headers:{"content-type":"audio/wav"},body:g.blob});if(!z.ok)throw new Error(String(z.status));let Ce=await z.blob(),ye=z.headers?.get?.("x-lipsync-cached")==="1";return a("lipsync",`video ${ee} \xB7 ${k} \u2192 ${((Date.now()-J)/1e3).toFixed(1)}s${ye?" (cached)":""}`),URL.createObjectURL(Ce)})();Ie.catch(()=>{Ve.get(w)===Ie&&Ve.delete(w)}),Ve.set(w,Ie)}return Ve.get(w)}function O(ee,We,w){v==="viseme"?s(ee,We,w).catch(()=>{}):v==="video"&&i(ee,We).catch(()=>{})}function Ue(ee,We,w){v!=="off"&&(je(),pe=ee,v==="viseme"?(Se=null,s(ee,Promise.resolve(We),w).then(Ie=>{pe===ee&&(Se=Ie)}).catch(()=>bt())):i(ee,Promise.resolve(We)).then(Ie=>{pe!==ee||!Ie||!A||(A.src=Ie,A.playbackRate=I?.playbackRate??1,I&&!I.paused&&(A.currentTime=I.currentTime,A.play().catch(()=>{})))}).catch(()=>bt()))}function B(ee,We,w=null){if(v==="off"||!ee||ee.live)return;je();let Ie=String(We).padStart(2,"0"),g=w==null?`slide-${Ie}`:`slide-${Ie}-${String(w).padStart(2,"0")}`,J=`file|${ee.dir}|${g}`;if(pe!==J){if(pe=J,v==="viseme")Se=null,(async()=>{let z=document.querySelector(`script[data-decklight-visemes="${g}"]`);if(z)return JSON.parse(z.textContent);let Ce=await fetch(`${ee.dir}/${g}.visemes.json`);if(!Ce.ok)throw new Error(String(Ce.status));return Ce.json()})().then(z=>{pe===J&&(Se=z)}).catch(()=>{});else if(A){let z=`${ee.dir}/slide-${Ie}.mp4`;if(A.src===new URL(z,location.href).href)return;A.src=z,A.playbackRate=I?.playbackRate??1,A.play().catch(()=>{})}}}function Le(ee){!ee||I===ee||(I=ee,ee.addEventListener("pause",()=>{v==="video"&&A?.pause()}),ee.addEventListener("play",()=>{v==="video"&&A?.src&&A.play().catch(()=>{})}),ee.addEventListener("ratechange",()=>{A&&(A.playbackRate=ee.playbackRate)}))}async function $t(){try{let ee=await fetch(p+"/ping");Me=ee.ok?await ee.json():null}catch{Me=null}return Me}function W(ee,We={}){v=ee,We.engine&&(k=We.engine),We.portrait&&(S=We.portrait),_e(),v==="off"?gt():(ce=!1,_(),P&&je()),Ze(),a("lipsync",v==="off"?"character off":`character ${v}${v==="video"?` \xB7 ${k} \xB7 ${S}`:""}`)}function Ae(ee){P=!!ee,_e();let We=!!I&&!I.paused&&!I.ended;P&&v!=="off"?je():!P&&!We&>(),Ze(),a("lipsync",`character solo ${P?"on":"off"}`)}return{get mode(){return v},get engine(){return k},get portrait(){return S},get solo(){return P},get bridgeInfo(){return Me},setMode:W,setSolo:Ae,prefetchSentence:O,beginSentence:Ue,beginSlide:B,attachAudio:Le,stop:gt,probe:$t,ensureTimeline:s}}me();fe();function fa(t){let o=String(t??"").replace(/[?#].*$/,"");return o.slice(0,o.lastIndexOf("/")+1)}var ga=/^[a-z][a-z0-9+.-]*:|^\/\//i;function ba(t,o,a){let c=t?.slides?.[a-1];return c?c.url?c.url:c.file?ga.test(c.file)?c.file:fa(o)+c.file:null:null}function ya(t,o,a,c){let d=t?.slides?.[a-1]?.segments?.[c-1];return d?d.url?d.url:d.file?ga.test(d.file)?d.file:fa(o)+d.file:null:null}function Yr(t,o=Date.now()){let a=t?.expires;if(!a)return{at:null,msLeft:1/0,expired:!1};let c=new Date(a);if(Number.isNaN(c.getTime()))return{at:null,msLeft:1/0,expired:!1};let d=c.getTime()-o;return{at:c,msLeft:d,expired:d<=0}}function wa(t){if(!Number.isFinite(t))return"";if(t<=0)return"expired";let o=Math.floor(t/6e4),a=Math.floor(o/60),c=Math.floor(a/24);return c?`${c}d ${a%24}h left`:a?`${a}h ${o%60}m left`:`${Math.max(1,o)}m left`}var Ms=t=>t.toISOString().slice(0,16).replace("T"," ")+"Z";function mo(t){let o=t?.source??"<voice-dir>",a=t?.bucket??"gs://<bucket>/<prefix>",c=t?.signDuration??"7d";return`node tools/publish-voices.mjs ${o} --bucket ${a} --sign ${c}`}function fo(t){return t?.manifest??t?.dir??null}function kd({hasTracks:t,used:o,printMode:a,embedded:c,voiceover:d,captionsOn:p,narrating:f}={}){return!!t&&!o&&!a&&!c&&!d&&!p&&!f}var Ed=.25,Sd=.5,Ad=1;function bo(t,o,a){if(t!=null&&String(t).trim()!==""){let c=Number(t);if(Number.isFinite(c)&&c>=0)return c}return typeof o=="number"&&Number.isFinite(o)&&o>=0?o:a}var _d=(t,o)=>bo(t,o,Ed);function Ls(t){let o=(t??[]).map(c=>String(c??"").replace(/\s+/g," ").trim());if(o.filter(Boolean).length<2)return null;let a=0;return o.map(c=>c?++a:null)}var yo=t=>String(t??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/-/g,"_").toLowerCase();function Sa(t){return yo(t).split(/\s+/).filter(Boolean).map(o=>o.startsWith("lang:")?{lang:o.slice(5)}:{any:o}).filter(o=>o.lang!=="")}function Td(t,o,a){let c=Array.isArray(a)?a:Sa(a);if(!c.length)return!0;let d=yo(t),p=yo(o);return c.every(f=>f.lang!==void 0?p.startsWith(f.lang):d.includes(f.any)||p.includes(f.any))}function va(t,o=0){let a=(t??[]).map(d=>String(d??"").replace(/\s+/g," ").trim()),c=Ls(a);if(!c){let d=a.filter(Boolean).join(" ");return d?[{seg:0,step:0,file:null,text:d}]:[]}return a.map((d,p)=>d?{seg:p,step:Math.min(p,o),file:c[p],text:d}:null).filter(Boolean)}function $d(t){let o=new Uint8Array(t.length*2),a=new DataView(o.buffer);for(let c=0;c<t.length;c++){let d=Math.max(-1,Math.min(1,t[c]));a.setInt16(c*2,Math.round(d*(d<0?32768:32767)),!0)}return o}function xa({engine:t,voice:o,mine:a=!1}={},c=[]){let d=S=>String(S??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40),p=a?"voices/me":`voices/${d(o)||d(t)||"take"}`,f=new Set(c),m=p;for(let S=2;f.has(m);S++)m=`${p}-${S}`;let v=m===p?"":`, take ${m.slice(p.length+1)}`,k=a?`My voice${v}`:`${o||"Narration"}${t?` \xB7 ${t}`:""}${v}`;return{dir:m,label:k}}function Cd(t){let o=t?.files;if(!o)return[];if(Array.isArray(o))return o;let a={label:"Narration",dir:o};return t.ext!==void 0&&(a.ext=t.ext),t.segments!==void 0&&(a.segments=t.segments),[a]}function go(t){return((t??"").match(/[^.!?…]+[.!?…]+[”’"')\]]*|[^.!?…]+$/g)??[]).map(o=>o.trim()).filter(Boolean)}function ka(t){let o=Math.round(t/1e3);return o<60?`${o}s`:`${Math.floor(o/60)}m${String(o%60).padStart(2,"0")}s`}function Os(t,o){let a=t.reduce((p,f)=>p+f.length,0),c=new DataView(new ArrayBuffer(44)),d=(p,f)=>{for(let m=0;m<f.length;m++)c.setUint8(p+m,f.charCodeAt(m))};return d(0,"RIFF"),c.setUint32(4,36+a,!0),d(8,"WAVE"),d(12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,1,!0),c.setUint16(22,1,!0),c.setUint32(24,o,!0),c.setUint32(28,o*2,!0),c.setUint16(32,2,!0),c.setUint16(34,16,!0),d(36,"data"),c.setUint32(40,a,!0),new Blob([c.buffer,...t],{type:"audio/wav"})}var Ea=(t,o)=>new Uint8Array(2*Math.round(t*o));function Nd(t){let o=t?.name??"";return o==="NotAllowedError"||o==="SecurityError"?"the microphone was blocked. Allow it for this page (the \u2699 or \u{1F3A4} in the address bar), then open it again from V \u2192 Record this deck\u2026":o==="NotFoundError"||o==="OverconstrainedError"?"no microphone was found. Plug one in, or pick one as the system input, then open it again from V \u2192 Record this deck\u2026":o==="NotReadableError"?"the microphone is busy \u2014 another app (a call, a recorder) is holding it. Close it and open it again from V \u2192 Record this deck\u2026":`the microphone could not be opened (${Nt(String(t?.message||o||t))}).`}function Aa({root:t,stage:o,config:a,params:c,printMode:d,toast:p,logOnly:f,debugLog:m,overlays:v,instance:k,syncSoundBtn:S,updateDebugState:P,downloadFromUrl:T,authorBase:A=()=>null,authorReady:N=()=>Promise.resolve()}){let I=0,Se="decklight-narration:"+location.pathname,pe=a.narration?.liveUrl??"http://127.0.0.1:8787/tts",Oe=[["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"]],re=pe.replace(/\/tts\/?$/,"/ping"),ce=pe.replace(/\/tts\/?$/,"/voices/install"),Me=pe.replace(/\/tts\/?$/,"/engines"),ze=pe.replace(/\/tts\/?$/,"/engine"),Ve=Oe,$e=!0,_e=null,Ze=null,bt=new Set,_=null,je=!1,gt=null;function ut(){return _??=fetch(re).then(b=>b.ok?b.json():null).then(b=>b?(je=!0,Q(b),m("tts",`bridge: ${b.engine} \xB7 ${b.model} \xB7 ${Ve.length} voice(s)`+($e?"":" \xB7 no style")),b):null).catch(()=>null),_}function Q(b){if(!b)return null;if(_e=b.engine??null,Ze=typeof b.caveat=="string"?b.caveat:null,Array.isArray(b.voices)&&b.voices.length&&(Ve=b.voices),$e=b.stylable!==!1,Ve.length&&!Ve.some(([$])=>$===Re.voice)){let $=Re.voice;Re={...Re,voice:Ve[0][0]},Tn(),m("tts",`voice ${$} is not on this bridge \u2014 using ${Re.voice}`),Y?.live&&p(`voice ${$} \u2192 ${Re.voice} (this bridge speaks its own roster)`,2600)}return b}let j=[["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"]],oe=([,b,$])=>_e==="elevenlabs"?$:b,he=Cd(a.narration),le={live:!0},Re={voice:"Alnilam",tone:j[0][0],style:j[0][1]},Y=null;try{let b=Bn(Se);if(b?.live?.voice)Re=b.live,Y=le;else if(!b?.off){let $=b?.track??b?.dir,R=he.find(G=>fo(G)===$);R&&(Y=R)}}catch{}let s=!1,i=null,O="decklight-narr-rate:"+location.pathname,Ue=1;try{let b=parseFloat(kn(O)??"");b>=.25&&b<=2&&(Ue=b)}catch{}function B(b){Ue=Math.round(Math.min(2,Math.max(.25,Ue+b))*100)/100,fn(O,String(Ue)),i&&(i.playbackRate=Ue),p(`voice speed ${Ue}\xD7`),m("narr",`rate ${Ue}\xD7`),P()}let Le=ma({root:t,config:a,debugLog:m,toast:p}),$t=new Map;function W(b){return(k._sections?.[b-1]?.querySelector("aside.notes")?.textContent??"").replace(/⟨CLICK⟩/g," ").replace(/\s+/g," ").trim()}function Ae(b){return(k._sections?.[b-1]?.querySelector("aside.notes")?.textContent??"").split("\u27E8CLICK\u27E9").map(R=>R.replace(/\s+/g," ").trim())}function ee(b,$,R){if(!b)return Promise.resolve(null);if(!$t.has($)){let G=(async()=>{let Z=Date.now();try{let xe=await fetch(pe,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:b,voice:Re.voice,style:Re.style})});if(!xe.ok)throw new Error(String(xe.status));let F=await xe.blob(),ae=parseFloat(xe.headers?.get?.("x-tts-cost")??"")||0;return ae&&(I+=ae),m("tts",`${R} \xB7 ${Re.voice} \xB7 ${b.length} chars \u2192 ${((Date.now()-Z)/1e3).toFixed(1)}s`+(ae?` \xB7 ~$${ae.toFixed(4)}`:"")),{url:URL.createObjectURL(F),blob:F}}catch(xe){throw m("tts",`${R} \xB7 ${Re.voice} FAILED after ${((Date.now()-Z)/1e3).toFixed(1)}s (${String(xe.message||xe)})`),xe}})();G.catch(()=>{$t.get($)===G&&$t.delete($)}),$t.set($,G)}return $t.get($)}let We=b=>k._records?.[b-1]?.groups.length??0;function w(b,$){let R=Ae(b),G=$<We(b)?[R[$]]:R.slice($),Z=[],xe=new Set;for(let F of G){let ae=go(F);ae.length&&xe.add(Z.length),Z.push(...ae)}return{sentences:Z,segStarts:xe}}let Ie=(b,$)=>w(b,$).sentences,g=new Set;function J(b){if(g.has(b))return;let $=Ae(b).length,R=We(b)+1;if($<=R)return;g.add(b);let G=`slide ${b}: ${$} \u27E8CLICK\u27E9 segments but ${R} build step${R===1?"":"s"} \u2014 the last ${$-R} ${$-R===1?"is":"are"} spoken on the final step`;f?.(G),m("narr",G)}let z=(b,$,R)=>`${b}|s${$}|n${R}|${Re.voice}|${Re.style}`;function Ce(b,$,R){let G=Ie(b,$)[R]??"";return ee(G,z(b,$,R),`slide ${b} seg ${$} #${R+1}`)}let ye=b=>k._sections[b-1]?.dataset.narration==="hold",Pe=b=>bo(k._sections[b-1]?.dataset.narrationPause,a.narration?.slidePause,Ad),X=b=>bo(k._sections[b-1]?.dataset.narrationBeatPause,a.narration?.beatPause,Sd),Xe=b=>_d(k._sections[b-1]?.dataset.narrationSentencePause,a.narration?.sentencePause);async function mt(b,$){if(!(b>0))return!Je&&!$();for(let R=b*1e3;R>0;){if($())return!1;let G=Date.now();await new Promise(Z=>setTimeout(Z,Math.min(150,R))),Je||(R-=Date.now()-G)}return!Je&&!$()}let ft=10,ke=3,ue=0;function ie(b){let $=[],R=k.state.slide,G=k.state.step;for(;$.length<b&&R<=k.state.totalSlides;){let Z=We(R);for(;G<=Z&&$.length<b;G++){let xe=Ie(R,G).length;for(let F=0;F<xe&&$.length<b;F++)$.push([R,G,F])}R+=1,G=0}return $}async function Ke(){let b=++ue,$=async()=>{for(;b===ue&&s&&Y?.live;){let R=ie(ft).find(([G,Z,xe])=>!$t.has(z(G,Z,xe)));if(!R)return;try{if(await Ce(R[0],R[1],R[2]),Le.mode!=="off"){let[G,Z,xe]=R;Le.prefetchSentence(z(G,Z,xe),$t.get(z(G,Z,xe)),go(Ae(G)[Z])[xe]??"")}}catch{return}await new Promise(G=>setTimeout(G,30))}};await Promise.all(Array.from({length:ke},$))}let rt=0,Je=!1,tt=!1,Rt=0;function jt(){if(!s){p("narration is off \u2014 \u23B5 starts it");return}Je=!Je,Je?i?.pause():i?.src&&i.paused&&!i.ended&&i.currentTime>0?i.play().catch(()=>{}):tt||sn(),p(Je?"\u23F8 narration paused \u2014 \u23B5 resumes":"\u25B6 narration resumed"),m("narr",Je?"paused":"resumed"),P()}let en=()=>Y?.live?"live":Y?"file":null;async function Pt(b,$,{mode:R="live",endOfSlide:G=!1}={}){let Z=rt,xe=()=>Z!==rt||!s||en()!==R||k.state.slide!==b||k.state.step!==$;if(Je||xe())return;let F=async(Ye,ot)=>(Ye>0&&m("narr",`slide ${b} \u2014 holding ${Ye}s before ${ot}`),mt(Ye,xe)),ae=k._records[b-1];if(!G&&$<(ae?ae.groups.length:0)){if(!await F(X(b),"the next build"))return;k.next();return}ye(b)||b>=k.state.totalSlides||await F(Pe(b),"the next slide")&&k.goto(b+1,0)}async function sn(){let b=k.state.slide,$=k.state.step,R=++rt;if(Ke(),!W(b)){if(ye(b)){m("narr",`hold on slide ${b} \u2014 manual advance`);return}setTimeout(()=>{R!==rt||!s||!Y?.live||k.state.slide===b&&b<k.state.totalSlides&&k.goto(b+1,0)},400);return}J(b);let G=Ie(b,$);if(!G.length){setTimeout(()=>{R===rt&&Pt(b,$)},600);return}let Z=()=>R!==rt||!s||k.state.slide!==b||k.state.step!==$;Rt=R,tt=!0;let xe=0;try{for(let F=0;F<G.length;F++){for(;Je;){if(Z())return;await new Promise(ot=>setTimeout(ot,150))}if(Z())return;let ae;try{ae=await Ce(b,$,F)}catch(ot){m("narr",`sentence failed (slide ${b} seg ${$} #${F+1}) \u2014 narration stopped`),H(Gt(ot));return}if(Z())return;if(!ae)continue;Be(G[F]),i??=new Audio,Le.mode!=="off"&&(Le.attachAudio(i),Le.beginSentence(z(b,$,F),ae,G[F])),i.onended=null,i.onerror=null,i.src=ae.url,i.playbackRate=Ue;let Ye=!1;if(await new Promise(ot=>{i.onended=ot,i.play().catch(()=>{Ye=!0,ot()})}),Ye){H("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}if(xe++,F<G.length-1&&!await mt(Xe(b),Z))return}if(Z())return;if(!xe&&G.length){H("\u{1F507} the voice did not play \u2014 auto-advance stopped \xB7 press the key left of 1 for messages");return}await Pt(b,$)}finally{Rt===R&&(tt=!1)}}function Gt(b){let $=String(b?.message??b);return $.startsWith("429")?"\u{1F507} voice quota exceeded (429) \u2014 auto-advance stopped \xB7 a free engine: decklight author --tts-engine chirp":/^\d{3}/.test($)?`\u{1F507} voice bridge error ${$.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 At=new Map,on=new Map,un=new Set,qt=null;function pn(b){for(let $ of document.querySelectorAll('script[type="application/json"][data-decklight-voices]'))if($.getAttribute("data-decklight-voices")===b)try{return JSON.parse($.textContent)}catch{return null}return null}function te(b){if(!At.has(b)){let $=pn(b);At.set(b,$?Promise.resolve($):fetch(b).then(R=>{if(!R.ok)throw new Error(`HTTP ${R.status}`);return R.json()}).catch(R=>{throw At.delete(b),R})),At.get(b).then(R=>on.set(b,R)).catch(()=>{})}return At.get(b)}function Kt(b){let $=on.get(b.manifest);if(!$)return un.has(b.manifest)?"hosted \u2014 the voice list did not load":(te(b.manifest).catch(()=>un.add(b.manifest)).then(()=>{Wt&&Zt==="tracks"&&Ct("tracks")}),"hosted \u2014 checking\u2026");let R=Yr($);return R.at?R.expired?`EXPIRED ${Ms(R.at)} \u2014 re-sign to play`:`signed \xB7 ${wa(R.msLeft)}`:"hosted \xB7 no expiry"}async function _t(){if(!Y||Y.live||!Y.manifest)return qt=null,C=tn(),!0;if(qt?.track!==Y)try{qt={track:Y,data:await te(Y.manifest)}}catch($){return qt=null,H(`\u{1F507} could not load the voice list for \u201C${Y.label}\u201D (${Y.manifest} \u2014 ${$.message}) \u2014 auto-advance stopped`),!1}let b=Yr(qt.data);return b.expired?(H(`\u{1F507} the signed voices for \u201C${Y.label}\u201D expired ${Ms(b.at)} \u2014 auto-advance stopped \xB7 re-sign: ${mo(qt.data)}`),!1):(C=tn(),!0)}function tn(){if(Yt.clear(),!Y||Y.live||Y.segments===!1)return!1;if(Y.manifest){let b=qt?.data,$=b?.slides??[],R=!!Yr(b).at;return $.some(G=>Array.isArray(G?.segments)&&G.segments.length&&(!R||G.segments.every(Z=>Z?.url)))}return Y.segments===!0}let Yt=new Set,C=!1;function ne(b,$){if(!C||Yt.has(b))return null;let R=Ae(b),G=Ls(R);if(!G)return null;let Z=$>=We(b),xe=Math.min($,G.length),F=(Z?G.slice(xe):G.slice(xe,xe+1)).filter(ae=>ae!==null).map(ae=>({file:ae,url:Y.manifest?ya(qt?.data,Y.manifest,b,ae):`${Y.dir}/slide-${String(b).padStart(2,"0")}-${String(ae).padStart(2,"0")}.${Y.ext??"m4a"}`}));return F.every(ae=>ae.url)?F:null}function Ee(b){return Y.manifest?ba(qt?.data,Y.manifest,b):`${Y.dir}/slide-${String(b).padStart(2,"0")}.${Y.ext??"m4a"}`}function we(){if(Y)return Y.live?sn():C?M():Ne()}function Ne({selfDriving:b=!1,gen:$=rt}={}){let R=k.state.slide,G=k.state.step;if(!W(R)){i?.pause();return}let Z=Ee(R);if(!Z){i?.pause();return}i??=new Audio,i.onended=null,i.onerror=null,i.src=Z,i.playbackRate=Ue,Le.mode!=="off"&&(Le.attachAudio(i),Le.beginSlide(Y,R)),b&&(i.onended=()=>{$===rt&&Pt(R,G,{mode:"file",endOfSlide:!0})});let xe=!1;i.onerror=()=>{xe=!0,Ge(R,Z)},i.play().catch(F=>{F?.name==="NotAllowedError"?p("\u{1F507} the browser blocked audio \u2014 click the deck once, then V"):xe||Ge(R,Z)})}function Ge(b,$,{fatal:R=!1}={}){m("narr",`no audio: ${$}`);let G=Y?.manifest?Yr(qt?.data):null;if(G?.at){m("narr","signed url failed \u2014 a media element cannot report the status"),H(`\u{1F507} slide ${b} of \u201C${Y.label}\u201D would not load (signed until ${Ms(G.at)}) \u2014 auto-advance stopped \xB7 re-sign: ${mo(qt?.data)}`);return}if(R){H(`\u{1F507} no audio for slide ${b} (${$}) \u2014 auto-advance stopped \xB7 press the key left of 1 for messages`);return}p(`\u{1F507} no narration for slide ${b} (${$}) \xB7 press the key left of 1 for messages`)}async function M(){let b=k.state.slide,$=k.state.step,R=++rt;if(!W(b)){if(ye(b)){m("narr",`hold on slide ${b} \u2014 manual advance`);return}setTimeout(()=>{R!==rt||!s||en()!=="file"||k.state.slide===b&&b<k.state.totalSlides&&k.goto(b+1,0)},400);return}J(b);let G=ne(b,$);if(!G){Ne({selfDriving:!0,gen:R});return}if(!G.length){setTimeout(()=>{R===rt&&Pt(b,$,{mode:"file"})},600);return}let Z=()=>R!==rt||!s||en()!=="file"||k.state.slide!==b||k.state.step!==$;Rt=R,tt=!0;try{for(let xe=0;xe<G.length;xe++){for(;Je;){if(Z())return;await new Promise(ae=>setTimeout(ae,150))}if(Z())return;i??=new Audio,Le.mode!=="off"&&(Le.attachAudio(i),Le.beginSlide(Y,b,G[xe].file)),i.onended=null,i.onerror=null,i.src=G[xe].url,i.playbackRate=Ue;let F=await new Promise(ae=>{i.onended=()=>ae("ended"),i.onerror=()=>ae("error"),i.play().catch(Ye=>ae(Ye?.name==="NotAllowedError"?"blocked":"error"))});if(Z())return;if(F==="blocked"){H("\u{1F507} the browser blocked audio \u2014 click the deck once, then V \u2014 the slides wait for the voice");return}if(F==="error"){if($===0&&xe===0){m("narr",`no segments for slide ${b} \u2014 falling back to the whole-slide file`),Yt.add(b),Ne({selfDriving:!0,gen:R});return}Ge(b,G[xe].url,{fatal:!0});return}}if(Z())return;await Pt(b,$,{mode:"file"})}finally{Rt===R&&(tt=!1)}}function H(b="narration off"){s=!1,rt++,ue++,Je=!1,i?.pause(),Le.stop(),p(b),m("narr",b),S()}function K(){return s?jt():qe()}let se=()=>s||Je||!!Y;async function qe(){if(!Y){p(he.length||je?"no voice chosen \u2014 V picks one":"no narration here \u2014 V shows what is available");return}if(s)return H();if(Jn(),Y.live&&await ut(),!await _t())return;s=!0;let b=Y.live?`\u26A1 ${Re.voice} \xB7 ${Re.tone}`:Y.label;p(`\u{1F50A} ${b} \u2014 \u23B5 pauses \xB7 V picks`),m("narr",`on \u2014 ${b}`),we(),S()}k.on("slide",()=>{s&&we()}),k.on("build",()=>{s&&(Y?.live?sn():C&&M())});let Qe="decklight-captions:"+location.pathname,Fe=!1;Fe=kn(Qe)==="1";let ge=null;function Be(b){ge&&(ge.textContent=b,ge.classList.toggle("show",!!b))}function st(){if(ge){if(s&&Y?.live){Be("");return}Be(Ie(k.state.slide,k.state.step).join(" "))}}function wt(){ge=document.createElement("div"),ge.className="decklight-captions",ge.setAttribute("aria-live","polite"),t.appendChild(ge),st()}function Mt(){Fe=!Fe,fn(Qe,Fe?"1":"0"),Fe?(wt(),cn()):(ge?.remove(),ge=null),p(`captions ${Fe?"on":"off"}`),m("narr",`captions ${Fe?"on":"off"}`)}k.on("slide",st),k.on("build",st),Fe&&!d&&wt();let pt="\u{1F50A} this deck has a voice-over \u2014 V plays it",nt=900,vt=12e3,L="decklight-narr-used:"+location.pathname,Bt=!1;Bt=kn(L)==="1";let ln=null;function cn(){if(!ln)return;let b=ln;ln=null,b.classList.remove("show"),setTimeout(()=>b.remove(),260)}function Jn(){cn(),!Bt&&(Bt=!0,fn(L,"1"))}function dr(){let b=document.createElement("button");b.type="button",b.className="decklight-narr-hint",b.setAttribute("aria-label","Play this deck\u2019s voice-over");let $=document.createElement("kbd");$.textContent="V",b.append("\u{1F50A} this deck has a voice-over \u2014 ",$," plays it"),b.addEventListener("click",()=>{cn(),qe()}),ln=b,t.appendChild(b),b.offsetWidth,b.classList.add("show"),f?.(pt),m("narr","voice-over hint shown"),setTimeout(cn,vt)}kd({hasTracks:he.length>0,used:Bt,printMode:d,embedded:!!c?.has("embedded"),voiceover:!!c?.has("voiceover"),captionsOn:Fe})&&setTimeout(()=>{s||dr()},nt);let Wt=null,yn=0,Zt="tracks",xt=[],_n=null;function Tn(){try{Dn(Se,Y?.live?{live:Re}:Y?{track:fo(Y),dir:Y.dir}:{off:!0})}catch{}}function wn(b,$){Re={voice:_n??Re.voice,tone:b,style:$},Y=le,Tn(),D(),s||(s=!0),p(`\u26A1 live voice: ${Re.voice} \xB7 ${Re.tone} \u2014 V stops`),m("narr",`live config \u2014 ${Re.voice} \xB7 ${Re.tone}`),we()}function Ot(b,{scroll:$=!1}={}){xt.length&&(yn=En(Wt.querySelectorAll(".narr-row"),b,"narr-sel",{scroll:$}))}function Yn(){xt[yn]?.commit()}function Ln(){Zt==="custom"?Ct("tones"):Zt==="tones"||Zt==="engines"?Ct("voices"):Zt==="charvideo"?Ct("character"):Zt==="record"||Zt==="voices"||Zt==="character"?Ct("tracks"):D()}let Xn=!1;function an(b,$){Le.setMode(b,$),D(),p(b==="off"?"character off":b==="viseme"?`\u{1F3AD} character on \u2014 lips follow the narration${s?"":" \xB7 V starts it"}`:`\u{1F3A5} character video \u2014 ${Le.engine} \xB7 ${Le.portrait}${s?"":" \xB7 V starts narration"}`)}function Qn(b){if(Le.mode==="off"){p("turn the character on first \u2014 N \xB7 Character\u2026");return}Le.setSolo(b),D(),p(b?"\u{1F3AD} solo \u2014 the narrator has the stage \xB7 N brings the slides back":"solo off \u2014 the slides are back")}let er="Hey, this is Decklight",zn=er,Xt="",gn=!1,vn=null,Sn=new Map,Un=new Map,Hn=null,jn=new Set;function Fr(b){if(b===er)return Sn;if(b!==Hn){for(let $ of Un.values())$.then(R=>URL.revokeObjectURL(R)).catch(()=>{});Un=new Map,Hn=b}return Un}let Tt=(b,$)=>`${b}|${$||""}`;function Gn(b,$,R,G=""){let Z=Tt($,G);if(!b.has(Z)){let xe=(async()=>{let F=Date.now(),ae=await fetch(pe,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:R,voice:$,style:G})});if(!ae.ok)throw new Error(String(ae.status));let Ye=await ae.blob(),ot=parseFloat(ae.headers?.get?.("x-tts-cost")??"")||0;return ot&&(I+=ot),m("tts",`preview ${$}${G?" (styled)":""} \xB7 ${((Date.now()-F)/1e3).toFixed(1)}s`+(ot?` \xB7 ~$${ot.toFixed(4)}`:"")),URL.createObjectURL(Ye)})();xe.catch(()=>{b.get(Z)===xe&&b.delete(Z)}),b.set(Z,xe)}return b.get(Z)}async function $n(b,$,R){let G=`${R}|${b}`;if(jn.has(G))return;jn.add(G);let Z=b===er,xe=Z?Sn:Un;try{m("narr",`preview prefetch ${R} (${Z?"default":"custom"} sentence)`);for(let{voice:F,style:ae}of $){if(!Z&&Hn!==b)return;xe.has(Tt(F,ae))||await Gn(xe,F,b,ae).catch(()=>{})}m("narr",`preview prefetch ${R} complete`)}finally{jn.delete(G)}}function Cn({voice:b,style:$="",prefetch:R},G){let Z=zn.trim();if(!Z)return;let xe=Fr(Z);G&&(G.textContent="\u2026"),Gn(xe,b,Z,$).then(F=>{if(G?.isConnected&&(G.textContent="\u25B6"),vn??=new Audio,vn.src=F,vn.play().catch(()=>{}),m("narr",`preview ${b}${$?" \xB7 styled":""}`),R==="voices"){let ae=xt.filter(Ye=>Ye.preview).map(Ye=>({voice:Ye.preview.voice,style:""}));$n(Z,ae,"voices")}else R==="tones"&&$n(Z,j.map(ae=>({voice:b,style:oe(ae)})),`tones:${b}`)}).catch(()=>{G?.isConnected&&(G.textContent="\u25B6"),p("live voice bridge unreachable \u2014 run: decklight tts"),m("narr",`preview ${b} failed`)})}function Ct(b){let $=Zt;Zt=b,b==="voices"&&$!=="voices"&&(gn=!0);let R=Wt.querySelector(".narr-card");R.innerHTML="";let G=document.createElement("div");if(G.className="narr-head",R.appendChild(G),xt=[],b==="tracks")G.textContent="narration",xt.push({text:"\u{1F507} Off \u2014 no voice",flavor:he.length||je?"\u23B5 advances the deck":"",cur:!Y,commit:()=>{let F=s||Je;Y=null,Tn(),D(),F?H("\u{1F507} narration off"):p("\u{1F507} narration off")}}),he.forEach(F=>xt.push({text:F.manifest?`\u2601 ${F.label}`:`\u{1F50A} ${F.label} (${F.dir}/)`,flavor:F.manifest?Kt(F):"",cur:F===Y,commit:()=>{Y=F,Tn(),D(),p(`\u{1F50A} track: ${F.label}`),s&&_t().then(ae=>{ae&&we()})}})),xt.push({text:"\u26A1 Live voice \u2014 synthesize on the fly\u2026",cur:Y?.live,commit:()=>Ct("voices")}),xt.push({text:"\u{1F9D1} Character \u2014 animated narrator\u2026",cur:Le.mode!=="off",commit:()=>Ct("character")}),xt.push({text:"\u{1F399} Record this deck\u2026",flavor:he.some(F=>!F.live)?"re-record, or add another take":"write the audio to a folder",commit:()=>Ct("record")}),xt.push({text:`${Fe?"\u2611":"\u2610"} Captions \u2014 follow the voice on screen`,flavor:"C",toggle:!0,commit:()=>{Mt(),Ct("tracks")}}),xt.push({text:`\u23E9 Speed \u2014 ${Ue}\xD7`,flavor:"< slower \xB7 > faster",toggle:!0,commit:()=>{B(Ue>=2?-1.75:.25),Ct("tracks")}});else if(b==="record"){G.textContent="record this deck \u2014 writes wav files beside it";let F=Ar();xt.push({text:"\u{1F3A4} With your voice \u2014 read it aloud, beat by beat",flavor:F?"":"the deck turns pages as you speak",blocked:F||null,commit:()=>{if(F)return p(F,5e3);D(),hs()}});let ae=Y?.live?null:"pick a live voice first \u2014 \u26A1 Live voice, above";xt.push({text:"\u{1F50A} With the synthesized voice \u2014 unattended",flavor:ae?"":`speaks every slide as ${Re.voice}`,blocked:ae,commit:()=>{if(ae)return p(ae,5e3);D(),Hr()}})}else if(b==="character"){G.textContent="character \u2014 an animated narrator lip-syncs the voice",Xn||(Xn=!0,Le.probe().then(()=>{Wt&&Zt==="character"&&Ct("character")}));let F=Le.bridgeInfo,ae=F?.engines?.video??[];xt.push({text:"Off",cur:Le.mode==="off",commit:()=>an("off")}),xt.push({text:"\u{1F3AD} 2D character \u2014 offline visemes",flavor:F?.engines?.viseme?"":"bridge offline \u2014 amplitude fallback",cur:Le.mode==="viseme",commit:()=>an("viseme")}),xt.push({text:`\u{1F3A5} Neural video \u2014 local GPU${ae.length?"\u2026":""}`,flavor:ae.length?"":"needs the bridge \u2014 run: decklight lipsync",cur:Le.mode==="video",commit:()=>{ae.length?Ct("charvideo"):p("video needs wav2lip/sadtalker on the bridge \u2014 run: decklight lipsync")}}),Le.mode!=="off"&&xt.push({text:`${Le.solo?"\u25C9":"\u25CB"} Solo \u2014 the narrator takes the stage`,flavor:"slide content steps aside",cur:Le.solo,commit:()=>Qn(!Le.solo)})}else if(b==="charvideo"){G.textContent="neural video \u2014 pick engine \xB7 portrait";let F=Le.bridgeInfo;for(let ae of F?.engines?.video??[])for(let Ye of F?.portraits?.length?F.portraits:["default"])xt.push({text:`\u{1F3A5} ${ae} \xB7 ${Ye}`,cur:Le.mode==="video"&&Le.engine===ae&&Le.portrait===Ye,commit:()=>an("video",{engine:ae,portrait:Ye})})}else if(b==="engines")G.textContent="live voice \u2014 which engine speaks",gt||fetch(Me).then(F=>F.ok?F.json():{stale:!0}).then(F=>{gt=F?.stale?"stale":F?.engines??[]}).catch(()=>{gt=[]}).then(()=>{Wt&&Zt==="engines"&&Ct("engines")}),gt?gt==="stale"?xt.push({text:`\u26A1 ${_e??"the bridge"} \u2014 and it cannot be changed from here`,flavor:"this voice bridge predates the engine picker",blocked:"restart it: decklight author",cur:!0,commit:()=>{}}):gt.length||xt.push({text:"no voice bridge is answering",flavor:"the engine list comes from it",blocked:"decklight author",cur:!1,commit:()=>{}}):xt.push({text:"asking the bridge\u2026",cur:!1,commit:()=>{}}),(Array.isArray(gt)?gt:[]).forEach(F=>xt.push({text:F.name,flavor:F.ready?F.cost??"":F.why??"unavailable",blocked:F.ready?null:F.fix??null,cur:!!F.current,commit:()=>Rn(F)}));else if(b==="voices"){let F=Sa(Xt),ae=F.length?Ve.filter(([yt,Ft])=>Td(yt,Ft,F)):Ve;G.textContent=F.length?`live voice \u2014 ${ae.length} of ${Ve.length} \xB7 \u25B6 previews`:"live voice \u2014 pick a voice \xB7 \u25B6 previews",xt.push({text:`\u2699 engine: ${_e??"the bridge"}\u2026`,flavor:"changes which voices exist",cur:!1,commit:()=>Ct("engines")});let Ye=document.createElement("div");Ye.className="narr-preview-row narr-filter-row";let ot=document.createElement("input");ot.className="narr-input narr-filter",ot.value=Xt,ot.placeholder="Filter voices \u2014 try fr, or lang:fr",ot.setAttribute("aria-label","Filter voices by name or language"),ot.addEventListener("input",()=>{Xt=ot.value,gn=!0,Ct("voices")}),ot.addEventListener("keydown",yt=>{yt.key==="Escape"?(Xt?(Xt="",gn=!0,Ct("voices")):Ln(),yt.preventDefault()):(yt.key==="ArrowDown"||yt.key==="Enter")&&(gn=!1,ot.blur(),Ot(0,{scroll:!0}),yt.preventDefault()),yt.stopPropagation()}),Ye.appendChild(ot),R.appendChild(Ye);let De=document.createElement("div");De.className="narr-preview-row";let lt=document.createElement("input");lt.className="narr-input narr-preview-text",lt.value=zn,lt.placeholder="Preview sentence",lt.setAttribute("aria-label","Preview sentence"),lt.addEventListener("input",()=>{zn=lt.value}),lt.addEventListener("keydown",yt=>{yt.key==="Escape"&&(Ln(),yt.preventDefault()),yt.stopPropagation()});let It=document.createElement("button");It.type="button",It.className="narr-prev-btn narr-reset-btn",It.textContent="\u21BA",It.title="restore the default sentence",It.setAttribute("aria-label","restore the default preview sentence"),It.addEventListener("click",yt=>{yt.stopPropagation(),zn=er,lt.value=er}),De.append(lt,It),R.appendChild(De),(_e==="say"||_e==="sapi")&&Ze&&!Ve.some(([,,yt])=>yt==="best")&&xt.push({text:_e==="sapi"?"\u2B07 Get natural voices \u2014 free download":"\u2B07 Get Siri voices \u2014 free download",flavor:_e==="sapi"?"opens Settings \u2192 Narrator":"opens System Settings",group:"best",commit:()=>{fetch(ce,{method:"POST"}).then(yt=>yt.json()).then(yt=>{if(!yt?.ok)throw new Error(yt?.error||"refused")}).then(()=>p("System Settings opened \u2014 download a Siri voice, then restart decklight tts",5200)).catch(()=>p(Ze,6e3))}});let Lt=["novelty","other languages"],Dt=new Set;ae.forEach(([yt,Ft,zt])=>{if(!F.length&&zt&&Lt.includes(zt)&&!bt.has(zt)){if(!Dt.has(zt)){Dt.add(zt);let On=ae.filter(([,,Ks])=>Ks===zt).length;xt.push({text:`\u2023 ${zt==="novelty"?"novelty voices":zt} (${On})`,toggle:!0,cur:!1,commit:()=>{bt.add(zt),Ct("voices")}})}return}xt.push({text:yt,flavor:Ft,group:zt??null,preview:{voice:yt,style:"",prefetch:"voices"},cur:Y?.live&&Re.voice===yt,commit:()=>{if(_n=yt,$e)return Ct("tones");wn(_e??"plain","")}})}),F.length&&!ae.length&&xt.push({text:"no voice matches",flavor:"Esc clears the filter \xB7 lang:fr narrows to a language",blocked:!0,commit:()=>{}})}else if(b==="tones")G.textContent=`live voice \xB7 ${_n??Re.voice} \u2014 pick a tone \xB7 \u25B6 previews`,j.forEach(F=>{let[ae]=F,Ye=oe(F);xt.push({text:ae,preview:{voice:_n??Re.voice,style:Ye,prefetch:"tones"},cur:Y?.live&&Re.tone===ae,commit:()=>wn(ae,Ye)})}),xt.push({text:"Custom\u2026",cur:Y?.live&&Re.tone==="Custom",commit:()=>Ct("custom")});else{G.textContent=`live voice \xB7 ${_n??Re.voice} \u2014 type the delivery instruction \xB7 \u25B6 previews`;let F=document.createElement("div");F.className="narr-preview-row";let ae=document.createElement("input");ae.className="narr-input",ae.value=Re.style,ae.placeholder="Read in a \u2026",ae.addEventListener("keydown",ot=>{ot.key==="Enter"?(x(),ot.preventDefault()):ot.key==="Escape"&&(Ln(),ot.preventDefault()),ot.stopPropagation()});let Ye=document.createElement("button");Ye.type="button",Ye.className="narr-prev-btn narr-reset-btn",Ye.textContent="\u25B6",Ye.title="preview this delivery instruction",Ye.setAttribute("aria-label","preview this delivery instruction"),Ye.addEventListener("click",ot=>{ot.stopPropagation();let De=ae.value.trim();De&&Cn({voice:_n??Re.voice,style:De},Ye)}),F.append(ae,Ye),R.appendChild(F),setTimeout(()=>{ae.focus(),ae.select()},0),xt=[],yn=0;return}let Z=null;xt.forEach((F,ae)=>{if(F.group!==Z&&(Z=F.group??null,F.group)){let De=document.createElement("div");De.className="narr-group",De.textContent=F.group,R.appendChild(De)}let Ye=document.createElement("div");Ye.className="narr-row"+(F.cur?" narr-cur":"")+(F.toggle?" narr-toggle":"")+(F.blocked||F.blocked===""?" narr-blocked":"");let ot=document.createElement("span");if(ot.className="narr-row-label",ot.textContent=F.text,F.flavor){let De=document.createElement("span");De.className="narr-flavor",De.textContent=F.flavor,ot.appendChild(De)}if(Ye.appendChild(ot),F.blocked){let De=document.createElement("div");De.className="narr-fix",De.textContent=F.blocked,Ye.appendChild(De)}if(F.preview){let De=document.createElement("button");De.type="button",De.className="narr-prev-btn",De.textContent="\u25B6",De.title=`preview ${F.preview.voice}`,De.setAttribute("aria-label",`preview ${F.preview.voice}`),De.addEventListener("click",lt=>{lt.stopPropagation(),Cn(F.preview,De)}),Ye.appendChild(De)}Ye.addEventListener("mouseenter",()=>Ot(ae)),Ye.addEventListener("click",()=>{Ot(ae),Yn()}),R.appendChild(Ye)});let xe=xt.findIndex(F=>F.cur);if(Ot(Math.max(0,xe),{scroll:!0}),gn){let F=R.querySelector(".narr-filter");F&&(F.focus(),F.setSelectionRange(F.value.length,F.value.length))}}async function Rn(b){if(b?.name){if(!b.ready)return p(b.fix?`${b.name}: ${b.why} \u2014 ${b.fix}`:`${b.name}: ${b.why??"unavailable"}`,5e3);if(b.current)return Ct("voices");try{let R=await(await fetch(ze,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:b.name})})).json();if(!R.ok)return p(`${b.name}: ${R.why??R.error}${R.fix?` \u2014 ${R.fix}`:""}`,5e3);_=Promise.resolve(Q(R)),gt=null,m("tts",`engine \u2192 ${R.engine} \xB7 ${R.model} \xB7 ${Ve.length} voice(s)`),p(`\u26A1 engine: ${R.engine}${R.cost?` \xB7 ${R.cost}`:""} \u2014 this session only`,3200),R.caveat&&p(R.caveat,6e3),Ct("voices")}catch{p(`${b.name}: the voice bridge did not answer`,3e3)}}}function x(){let b=Wt?.querySelector(".narr-input")?.value.trim();b&&wn("Custom",b)}function q(b){if(Wt&&b===void 0)return D();Wt||(Wt=document.createElement("div"),Wt.className="decklight-narr",Wt.innerHTML='<div class="narr-card" role="listbox" aria-label="Narration"></div>',Ht(Wt,D),t.appendChild(Wt)),Ct(b??"tracks"),ut().then($=>{$&&Wt&&Zt==="voices"&&Ct("voices")})}function D(){Wt?.remove(),Wt=null,bt.clear(),Xt="",gn=!1,Xn=!1}let ve=null,et="confirm",St=0,Jt=null;function hn(){let b=[];for(let Z=1;Z<=k.state.totalSlides;Z++)W(Z)&&b.push(Z);let $=/^(\d+)(?:-(\d+))?$/.exec(c?.get?.("slides")??"");if(!$)return b;let R=Number($[1]),G=$[2]?Number($[2]):R;return b.filter(Z=>Z>=R&&Z<=G)}function bn(b,$={}){et=b;let R=ve.querySelector(".narr-card");if(b==="confirm"){let G=$.total;R.innerHTML=`<div class="narr-head">record offline narration</div>
|
|
332
|
+
<div class="rec-line">\u26A1 ${Re.voice} \xB7 ${Re.tone}</div>
|
|
333
|
+
<div class="rec-line">${G} slide${G===1?"":"s"} stitched from the sentence cache \u2014 only unheard sentences synthesize</div>
|
|
334
|
+
${is($.target)}
|
|
284
335
|
<div class="narr-row narr-sel">Start recording</div>
|
|
285
|
-
<div class="rec-hint">Enter to start \xB7 Esc to cancel</div>`,
|
|
286
|
-
<div class="rec-bar"><div class="rec-bar-fill" style="width:${
|
|
287
|
-
<div class="rec-line">${
|
|
288
|
-
<div class="rec-hint">Esc to cancel</div>`}else{let{saved:
|
|
289
|
-
<div class="rec-line">${
|
|
290
|
-
<div class="rec-line">${
|
|
291
|
-
${
|
|
292
|
-
${
|
|
293
|
-
<input class="rec-dir" value="${
|
|
294
|
-
aria-label="folder to record into"></label></div>${
|
|
295
|
-
<div class="rec-line">${
|
|
296
|
-
<div class="rec-hint">Esc to close</div>`;return}let{range:
|
|
297
|
-
<div class="rec-line">${
|
|
298
|
-
${
|
|
299
|
-
${
|
|
300
|
-
${
|
|
301
|
-
${
|
|
302
|
-
<div class="rec-hint">${
|
|
303
|
-
<div class="rec-line rec-where">slide ${
|
|
304
|
-
<div class="rec-read">${
|
|
336
|
+
<div class="rec-hint">Enter to start \xB7 Esc to cancel</div>`,zr(R,Z=>{Jt=Z}),R.querySelector(".narr-row").addEventListener("click",Ur)}else if(b==="progress"){let{done:G,total:Z,elapsedMs:xe}=$,F=Z?Math.round(G/Z*100):0,ae=G?ka(xe/G*(Z-G)):"\u2026";R.innerHTML=`<div class="narr-head">recording\u2026</div>
|
|
337
|
+
<div class="rec-bar"><div class="rec-bar-fill" style="width:${F}%"></div></div>
|
|
338
|
+
<div class="rec-line">${G} / ${Z} slides \xB7 ${ka(xe)} elapsed \xB7 ~${ae} left</div>
|
|
339
|
+
<div class="rec-hint">Esc to cancel</div>`}else{let{saved:G,total:Z,cancelled:xe,dir:F}=$,ae=$.segmented?"slide-NN.wav + one slide-NN-KK.wav per \u27E8CLICK\u27E9":"slide-NN.wav",Ye=F?`saved as ${ae} in <code>${Nt(F)}/</code>, next to the deck`:`saved as ${ae} to your downloads \u2014 ${kr()}`,ot=$.segmented?", segments: true":"",De=F?`Set <code>narration: { files: '${Nt(F)}', ext: 'wav'${ot} }</code> to play them back without the bridge \u2014 <code>decklight bundle</code> picks the folder up from there.`+($.segmented?" <strong>segments</strong> is what makes them step the builds.":""):`Move them next to the deck and point <code>narration.files</code> at that folder with <code>ext: 'wav'${ot}</code> to play them back without the bridge.`;R.innerHTML=`<div class="narr-head">${xe?"recording cancelled":"recording done"}</div>
|
|
340
|
+
<div class="rec-line">${G} / ${Z} slide${Z===1?"":"s"} ${Ye}</div>
|
|
341
|
+
<div class="rec-line">${De}</div>
|
|
342
|
+
${as(F)}
|
|
343
|
+
${ls(F)}`,cs(R,F,{ext:"wav",label:$.label,...$.segmented?{segments:!0}:{}})}}let In=.35;function wr(b,$){let R=Ae(b),G=$<We(b)?[[$,R[$]]]:R.slice($).map((F,ae)=>[$+ae,F]),Z=[],xe=0;for(let[F,ae]of G){let Ye=go(ae??"");Ye.length&&Z.push({seg:F,from:xe,count:Ye.length}),xe+=Ye.length}return Z}async function vr(b,$){let R=We(b),G=Ls(Ae(b)),Z=[],xe=new Map,F=24e3;for(let ae=0;ae<=R;ae++){let{sentences:Ye,segStarts:ot}=w(b,ae),De=wr(b,ae);for(let lt=0;lt<Ye.length;lt++){let It=await Ce(b,ae,lt);if($!==St)return null;if(!It)continue;let Lt=await It.blob.arrayBuffer();Z.length===0?F=new DataView(Lt).getUint32(24,!0)||24e3:Z.push(Ea(F,lt===0||ot.has(lt)?In:Xe(b)));let Dt=new Uint8Array(Lt.slice(44));Z.push(Dt);let yt=De.find(On=>lt>=On.from&<<On.from+On.count),Ft=yt&&G?G[yt.seg]:null;if(Ft==null)continue;let zt=xe.get(Ft);zt||xe.set(Ft,zt=[]),zt.length&&zt.push(Ea(F,Xe(b))),zt.push(Dt)}}return{wav:Z.length?Os(Z,F):null,segments:[...xe].map(([ae,Ye])=>({file:ae,wav:Os(Ye,F)}))}}async function ss(b,$){if(Le.mode!=="viseme")return null;let R=We(b),G=Ls(Ae(b)),Z=[],xe=new Map;try{for(let F=0;F<=R;F++){let{sentences:ae,segStarts:Ye}=w(b,F),ot=wr(b,F);for(let De=0;De<ae.length;De++){let lt=await Le.ensureTimeline(z(b,F,De),Ce(b,F,De),ae[De]);if($!==St)return null;if(!lt)continue;Z.push({timeline:lt,gap:Z.length?De===0||Ye.has(De)?In:Xe(b):0});let It=ot.find(yt=>De>=yt.from&&De<yt.from+yt.count),Lt=It&&G?G[It.seg]:null;if(Lt==null)continue;let Dt=xe.get(Lt);Dt||xe.set(Lt,Dt=[]),Dt.push({timeline:lt,gap:Dt.length?Xe(b):0})}}}catch{return m("lipsync",`slide ${b}: viseme sidecar skipped (bridge unreachable)`),null}return{slide:Z.length?ho(Z):null,segments:[...xe].map(([F,ae])=>({file:F,timeline:ho(ae)}))}}async function xr(){let b=A();if(b==null)return[];try{let R=await(await fetch(`${b}/edit/tracks`)).json();return Array.isArray(R?.tracks)?R.tracks:[]}catch{return[]}}function Nn({mine:b},$){let R=b?null:_e,G=b?null:Re?.voice,Z=b?{mine:!0}:{engine:R,voice:G},xe=xa(Z,$.map(De=>De.dir)),F=xa(Z,[]).label,ae=(De,lt)=>({dir:De,label:lt==="new"?xe.label:F,why:lt,clash:$.find(It=>It.dir===De)??null}),Ye=ur(c?.get?.("dir"));if(Ye)return ae(Ye,"asked");if(!b&&G){let De=$.find(lt=>lt.voice&<.voice===G&&(!lt.engine||!R||lt.engine===R));if(De)return ae(De.dir,"refresh")}let ot=ur(Us({configOnly:!0}));return ot?ae(ot,"configured"):ae(xe.dir,"new")}let os="voiceover",ur=b=>typeof b=="string"&&b&&!/^[a-z][a-z0-9+.-]*:/i.test(b)&&!/^[/\\]/.test(b)&&!b.split(/[/\\]/).includes("..")?b:null;function Us({configOnly:b=!1}={}){let $=ur(c?.get?.("dir"));if($)return $;let R=a.narration?.files,G=typeof R=="string"?R:Array.isArray(R)?R.find(xe=>typeof xe?.dir=="string")?.dir:null;return ur(G)??(b?null:os)}async function Kn(b,$,R,G,Z=null){if(G)try{if((await(await fetch(`${G.base}/edit/record?slide=${b}&kind=${$}`+(Z==null?"":`&seg=${Z}`)+`&dir=${encodeURIComponent(G.name)}`,{method:"POST",body:R})).json())?.ok)return!0}catch{}let xe=`slide-${String(b).padStart(2,"0")}`+(Z==null?"":`-${String(Z).padStart(2,"0")}`)+`.${$==="wav"?"wav":"visemes.json"}`,F=URL.createObjectURL(R);return T(F,xe),setTimeout(()=>URL.revokeObjectURL(F),5e3),!1}function is(b){if(!b)return"";let $=b.clash&&b.why!=="refresh"?`<div class="rec-line rec-warn">${b.clash.files} file(s) are already in <code>${Nt(b.dir)}/</code>${b.clash.voice?` (${Nt(b.clash.voice)})`:""} and will be replaced.</div>`:"";return`<div class="rec-line rec-folder"><label>folder
|
|
344
|
+
<input class="rec-dir" value="${Nt(b.dir)}" spellcheck="false"
|
|
345
|
+
aria-label="folder to record into"></label></div>${$}`}function zr(b,$){let R=b?.querySelector(".rec-dir");if(!R)return;let G=()=>{let Z=ur(R.value.trim());return R.classList.toggle("rec-bad",!Z),Z};R.addEventListener("input",()=>{let Z=G();Z&&$({dir:Z,label:R.dataset.label||Z,clash:null})}),R.addEventListener("keydown",Z=>{Z.key==="Enter"&&Z.stopPropagation()})}async function Hs(b,$,R){let G=A();if(G!=null){b.textContent="saving\u2026";try{let Z=await fetch(`${G}/edit/narration`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({files:$,...R})}),xe=await Z.json();if(!xe?.ok)throw new Error(xe?.error||`HTTP ${Z.status}`);b.textContent="\u2713 the deck now plays this track \u2014 Z undoes it",b.classList.add("rec-done"),m("narr",`narration config \u2192 ${$}`)}catch(Z){b.classList.add("rec-failed"),b.textContent=`couldn't write it \u2014 ${String(Z.message||Z)}`}}}function as(b){return A()==null||!b?"":'<div class="narr-row narr-sel rec-use" role="button" tabindex="0">Use this track in the deck</div>'}function Mn(b){let $=b?.querySelector(".rec-use");return $&&!$.classList.contains("rec-done")&&!$.classList.contains("rec-failed")?$:null}function ls(b){return A()==null||!b?'<div class="rec-hint">Enter or Esc to close</div>':'<div class="rec-hint">\u23CE uses this track in the deck \xB7 Esc closes</div>'}function cs(b,$,R){let G=b?.querySelector(".rec-use");if(!G)return;let Z=()=>Hs(G,$,R);G.addEventListener("click",Z),G.addEventListener("keydown",xe=>{(xe.key==="Enter"||xe.key===" ")&&(xe.preventDefault(),Z())})}function kr(){return c?.has?.("record")?"no author server answered, though <code>decklight record</code> started one \u2014 something else is holding the port for another deck. Stop it and record again; press D for the log.":location.protocol==="file:"?"this deck was opened from a file, so nothing may write beside it. <code>decklight record deck.html</code> serves it and writes them for you.":"no author server owns this deck file \u2014 <code>decklight record deck.html</code> writes them next to the deck instead."}async function Ur(){let b=hn(),$=++St,R=Date.now(),G=0,Z=0,xe=0,F=!1;if(await N(),$!==St)return;let ae=A(),Ye=Jt??Nn({mine:!1},await xr());if($!==St)return;let ot=ae==null?null:{base:ae,name:Ye.dir};bn("progress",{done:G,total:b.length,elapsedMs:0});for(let De of b){if($!==St)return;try{let lt=await vr(De,$);if($!==St)return;if(lt?.wav){if(await Kn(De,"wav",lt.wav,ot)&&xe++,$!==St)return;Z++;for(let Lt of lt.segments){if(await Kn(De,"wav",Lt.wav,ot,Lt.file),$!==St)return;F=!0}let It=await ss(De,$);if($!==St||It?.slide&&(await Kn(De,"visemes",new Blob([JSON.stringify(It.slide)],{type:"application/json"}),ot),$!==St))return;for(let Lt of It?.segments??[])if(await Kn(De,"visemes",new Blob([JSON.stringify(Lt.timeline)],{type:"application/json"}),ot,Lt.file),$!==St)return}}catch{p(`slide ${De}: recording failed`)}G++,$===St&&bn("progress",{done:G,total:b.length,elapsedMs:Date.now()-R})}$===St&&bn("done",{saved:Z,total:b.length,dir:xe?ot.name:null,segmented:F,label:Ye.label})}function Hr(){if(!Y?.live){p("live voice only \u2014 pick a voice with N first");return}ve||(ve=document.createElement("div"),ve.className="decklight-narr decklight-record",ve.innerHTML='<div class="narr-card" role="dialog" aria-label="Record offline narration"></div>',Ht(ve,Er),t.appendChild(ve),Jt=null,bn("confirm",{total:hn().length}),N().then(()=>xr()).then(b=>{!ve||et!=="confirm"||(Jt=Nn({mine:!1},b),bn("confirm",{total:hn().length,target:Jt}))}))}function Er(){St++,ve?.remove(),ve=null}let nn=null,tr="intro",xn=0,nr=null,mn=null,Sr=null,Pn=null,pr=null,Wn=null,hr=null,rr=0,jr=null,sr=null;function Ar(){return navigator.mediaDevices?.getUserMedia?null:location.protocol==="file:"?"a browser will not open a microphone for a page loaded from a file. Serve the deck instead \u2014 <code>decklight record "+Nt(mr())+"</code> \u2014 and this works: 127.0.0.1 is a secure context, file:// is not.":"this browser exposes no microphone (getUserMedia needs a secure context \u2014 http://127.0.0.1 or https://)"}let mr=()=>decodeURIComponent(location.pathname.split("/").pop()||"deck.html"),ds=24e3;async function js(){Sr=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});let b=window.AudioContext??window.webkitAudioContext;try{mn=new b({sampleRate:ds})}catch{mn=new b}pr=mn.createMediaStreamSource(Sr),Pn=mn.createScriptProcessor(4096,1,1),Pn.onaudioprocess=R=>{let G=R.inputBuffer.getChannelData(0),Z=0;for(let xe=0;xe<G.length;xe++){let F=Math.abs(G[xe]);F>Z&&(Z=F)}rr=Math.max(rr,Z),Wn&&Wn.push($d(G))};let $=mn.createGain();$.gain.value=0,pr.connect(Pn),Pn.connect($),$.connect(mn.destination),mn.state==="suspended"&&await mn.resume(),m("narr",`mic open at ${mn.sampleRate} Hz`)}function Gr(){try{Pn?.disconnect(),pr?.disconnect()}catch{}Pn&&(Pn.onaudioprocess=null),Sr?.getTracks().forEach(b=>b.stop()),mn?.close?.(),mn=Sr=Pn=pr=null,Wn=null,clearInterval(jr),jr=null}function us(){return Wn=[],rr=0,new Promise(b=>{sr=b})}function Kr(b){if(!sr)return;hr=Wn??[],Wn=null;let $=sr;sr=null,$(b)}function Gs(b){let $=Math.min(100,Math.round(b*140));return`<div class="rec-level${b>.95?" hot":""}"><div class="rec-level-fill" style="width:${$}%"></div></div>`}function Vn(b,$={}){tr=b;let R=nn?.querySelector(".narr-card");if(!R)return;if(b==="intro"){let{slides:De,beats:lt,why:It}=$;if(It){R.innerHTML=`<div class="narr-head">record your voice</div>
|
|
346
|
+
<div class="rec-line">${It}</div>
|
|
347
|
+
<div class="rec-hint">Esc to close</div>`;return}let{range:Lt,warn:Dt}=$;R.innerHTML=`<div class="narr-head">record your voice</div>
|
|
348
|
+
<div class="rec-line">${De} slide${De===1?"":"s"} \xB7 ${lt} beat${lt===1?"":"s"} \u2014 the deck reads you the notes, one \u27E8CLICK\u27E9 at a time${Lt?` <strong>(slides ${Nt(Lt)} only \u2014 everything else is left alone)</strong>`:""}</div>
|
|
349
|
+
${lt===0?`<div class="rec-line rec-warn">Nothing to record${Lt?` in slides ${Nt(Lt)}`:""} \u2014 no slide there has notes to read.</div>`:'<div class="rec-line">Press <kbd>\u2192</kbd> when you finish a beat: it ends the file <em>and</em> reveals the next build, so your voice paces the deck exactly as it will on the night.</div>'}
|
|
350
|
+
${is($.target)}
|
|
351
|
+
${Dt?`<div class="rec-line rec-warn">${Dt}</div>`:""}
|
|
352
|
+
${lt===0?"":'<div class="narr-row narr-sel">Start recording</div>'}
|
|
353
|
+
<div class="rec-hint">${lt===0?"Esc to close":"Enter to start \xB7 Esc to cancel"}</div>`,zr(R,yt=>{nr=yt}),R.querySelector(".narr-row")?.addEventListener("click",()=>ps());return}if(b==="capture"){let{sl:De,nth:lt,slides:It,beat:Lt,i:Dt,of:yt,note:Ft}=$;R.innerHTML=`<div class="narr-head">recording \xB7 slide ${lt} of ${It}</div>
|
|
354
|
+
<div class="rec-line rec-where">slide ${De} \xB7 beat ${Dt+1} of ${yt}</div>
|
|
355
|
+
<div class="rec-read">${Nt(Lt.text)}</div>
|
|
305
356
|
${Ft?`<div class="rec-line rec-note">${Ft}</div>`:""}
|
|
306
357
|
${Gs(0)}
|
|
307
|
-
<div class="rec-hint"><kbd>\u2192</kbd> next beat \xB7 <kbd>\u232B</kbd> retake this one \xB7 <kbd>Esc</kbd> stop</div>`;return}if(b==="saving"){R.innerHTML=`<div class="narr-head">saving slide ${
|
|
308
|
-
<div class="rec-line">${
|
|
309
|
-
<div class="rec-line">${
|
|
310
|
-
<div class="rec-line">Play it back with <code>${
|
|
311
|
-
${
|
|
312
|
-
${
|
|
313
|
-
`)}function
|
|
358
|
+
<div class="rec-hint"><kbd>\u2192</kbd> next beat \xB7 <kbd>\u232B</kbd> retake this one \xB7 <kbd>Esc</kbd> stop</div>`;return}if(b==="saving"){R.innerHTML=`<div class="narr-head">saving slide ${$.sl}\u2026</div>
|
|
359
|
+
<div class="rec-line">${$.files} file${$.files===1?"":"s"}</div>`;return}let{slides:G,files:Z,dir:xe,segmented:F,stopped:ae}=$,Ye=xe?`saved to <code>${Nt(xe)}/</code>, next to the deck`:`saved to your downloads \u2014 ${kr()}`,ot=`narration: { files: '${Nt(xe??"voiceover")}', ext: 'wav'${F?", segments: true":""} }`;R.innerHTML=`<div class="narr-head">${ae?"recording stopped":"recording done"}</div>
|
|
360
|
+
<div class="rec-line">${G} slide${G===1?"":"s"} \xB7 ${Z} file${Z===1?"":"s"} ${Ye}</div>
|
|
361
|
+
<div class="rec-line">Play it back with <code>${ot}</code>${F?" \u2014 <strong>segments</strong> is what makes your voice step the builds.":"."}</div>
|
|
362
|
+
${as(xe)}
|
|
363
|
+
${ls(xe)}`,cs(R,xe,{ext:"wav",label:$.label,...F?{segments:!0}:{}})}async function ps(){let b=++xn,$=hn();if(await N(),b!==xn)return;let R=A(),G=nr??Nn({mine:!0},await xr());if(b!==xn)return;let Z=R==null?null:{base:R,name:G.dir},xe=0,F=0,ae=0,Ye=!1,ot=!1;s&&qe();try{await js()}catch(De){Vn("intro",{why:Nd(De)});return}jr=setInterval(()=>{let De=nn?.querySelector(".rec-level-fill"),lt=nn?.querySelector(".rec-level");De&&(De.style.width=`${Math.min(100,Math.round(rr*140))}%`,lt.classList.toggle("hot",rr>.95),rr*=.7)},100);e:for(let De of $){if(b!==xn)return;let lt=va(Ae(De),We(De));if(!lt.length)continue;let It=lt.length===1&&We(De)>0?`this slide has ${We(De)} build${We(De)===1?"":"s"} but no \u27E8CLICK\u27E9 in its notes \u2014 one take for the whole slide; add \u27E8CLICK\u27E9 between the beats to pace them`:null,Lt=[];for(let Ft=0;Ft<lt.length;Ft++){let zt=lt[Ft];k.goto(De,zt.step),Vn("capture",{sl:De,nth:xe+1,slides:$.length,beat:zt,i:Ft,of:lt.length,note:It});let On=await us();if(b!==xn)return;if(On==="stop"){ot=!0;break e}if(On==="retake"){Ft--;continue}Lt.push({file:zt.file,pcm:hr})}if(!Lt.length)continue;Vn("saving",{sl:De,files:Lt.length+1});let Dt=mn?.sampleRate??ds,yt=Lt.flatMap(Ft=>Ft.pcm);if(await Kn(De,"wav",Os(yt,Dt),Z)&&ae++,F++,b!==xn)return;for(let Ft of Lt)if(Ft.file!=null){if(await Kn(De,"wav",Os(Ft.pcm,Dt),Z,Ft.file),b!==xn)return;F++,Ye=!0}xe++}Gr(),b===xn&&Vn("done",{slides:xe,files:F,dir:ae?Z.name:null,segmented:Ye,stopped:ot,label:G.label})}function hs(){if(nn)return;nn=document.createElement("div"),nn.className="decklight-narr decklight-record decklight-mic",nn.innerHTML='<div class="narr-card" role="dialog" aria-label="Record your voice"></div>',Ht(nn,fr),t.appendChild(nn);let b=Ar(),$=hn(),R=$.reduce((Z,xe)=>Z+va(Ae(xe),We(xe)).length,0),G=c?.get?.("slides");nr=null,Vn("intro",b?{why:b}:{slides:$.length,beats:R,range:G}),!b&&N().then(()=>xr()).then(Z=>{!nn||tr!=="intro"||(nr=A()==null?null:Nn({mine:!0},Z),Vn("intro",{slides:$.length,beats:R,range:G,target:nr,warn:A()==null?kr():null}))})}function fr(){xn++,Kr("stop"),Gr(),nn?.remove(),nn=null}return v.register({isOpen:()=>!!nn,close:fr,keydown(b){if(tr==="capture"){if(b.key==="ArrowRight"||b.key==="Enter"||b.key===" "||b.key==="PageDown")Kr("next");else if(b.key==="Backspace")Kr("retake");else if(b.key==="Escape")fr();else return!1;return!0}if(b.key==="Escape")fr();else if(b.key==="Enter")tr==="intro"&&!Ar()&&nn?.querySelector(".narr-row")?ps():Mn(nn)?Mn(nn).click():tr!=="saving"&&fr();else return!1;return!0}}),v.register({isOpen:()=>!!ve,close:Er,keydown(b){if(b.key==="Escape")Er();else if(b.key==="Enter")et==="confirm"?Ur():Mn(ve)?Mn(ve).click():et!=="progress"&&Er();else return!1;return!0}}),v.register({isOpen:()=>!!Wt,close:D,keydown(b){if(Zt==="custom")return b.key==="Enter"?(x(),!0):b.key==="Escape"?(Ln(),!0):!1;switch(b.key){case"ArrowDown":Ot(yn+1,{scroll:!0});break;case"ArrowUp":Ot(yn-1,{scroll:!0});break;case"Enter":Yn();break;case"Escape":Ln();break;case"v":case"V":D();break;default:return!1}return!0}}),{character:Le,playPause:K,playDefault(){if(s)return qe();Y||(Y=he[0]??(je?le:null)),Y&&qe()},toggleNarration:qe,toggleNarrPause:jt,changeNarrRate:B,toggleCaptions:Mt,openPicker:q,openRecordDialog:Hr,openMicRecorder:hs,applySolo:Qn,notesSegs:Ae,status:()=>({narrating:s,paused:Je,rate:Ue,captionsOn:Fe,track:Y,live:!!Y?.live,voice:Re.voice,tone:Re.tone,hasTracks:he.length>0,voiceInPlay:se(),spend:I})}}me();fe();function Md(t,o){let a=[];for(let c=0;c<t;c+=o){let d=[];for(let p=c;p<t&&p<c+o;p++)d.push(p);a.push(d)}return a}function _a(t,o,a){let c=t.ownerDocument,d=m=>{let v=c.createElement("div");return v.className=m,v},p=m=>{let v=d("print-slot"),k=d("decklight-stage print-slide");return k.appendChild(m),v.appendChild(k),v};if(a==="handout")for(let m of Md(o.length,3)){let v=d("print-page print-handout");for(let k of m){let S=d("print-row");S.appendChild(p(o[k])),S.appendChild(d("print-notelines")),v.appendChild(S)}t.appendChild(v)}else o.forEach(m=>{let v=d("print-page print-notes-page"),k=d("print-notes"),S=m.querySelector("aside.notes");S&&(k.innerHTML=S.innerHTML),v.appendChild(p(m)),v.appendChild(k),t.appendChild(v)});let f=c.createElement("style");f.textContent="@media print { @page { size: 816px 1056px; margin: 0; } html, body { margin: 0; padding: 0; } }",c.head.appendChild(f)}me();fe();me();fe();function Od(t,o,a,c){let d=c||1;return{x:(t-a.left)/d,y:(o-a.top)/d}}function Ld(t,o,a=300){return t.filter(c=>o-c.t<a)}function Ta(t,o){let a=o.querySelector(":scope > .decklight-stage"),c=null,d=null,p=null,f=[],m=null,v=[],k=null,S=0,P=()=>getComputedStyle(o).getPropertyValue("--accent").trim()||"#fff",T=$e=>Od($e.clientX,$e.clientY,a.getBoundingClientRect(),t._scale);function A(){if(!d)return;let $e=window.devicePixelRatio||1,_e=o.getBoundingClientRect(),Ze=a.getBoundingClientRect(),bt=t._scale||1;d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height),d.setTransform($e*bt,0,0,$e*bt,(Ze.left-_e.left)*$e,(Ze.top-_e.top)*$e),d.lineCap=d.lineJoin="round",d.lineWidth=3.5;for(let _ of m?[...f,m]:f)if(_.points.length){d.strokeStyle=_.color,d.beginPath(),d.moveTo(_.points[0].x,_.points[0].y);for(let je of _.points)d.lineTo(je.x,je.y);d.stroke()}if(p==="laser"&&k){let _=P(),je=performance.now();d.fillStyle=_;for(let gt of v){let ut=1-(je-gt.t)/300;d.globalAlpha=ut*.4,d.beginPath(),d.arc(gt.x,gt.y,3+4*ut,0,Math.PI*2),d.fill()}d.globalAlpha=1,d.shadowColor=_,d.shadowBlur=22,d.beginPath(),d.arc(k.x,k.y,7,0,Math.PI*2),d.fill(),d.shadowBlur=0}}function N(){S=0,v=Ld(v,performance.now()),A(),v.length&&(S=requestAnimationFrame(N))}let I=()=>{S||(S=requestAnimationFrame(N))};function Se($e){if(!(p!=="pen"||$e.button>0)){try{c.setPointerCapture($e.pointerId)}catch{}m={color:P(),points:[T($e)]},A(),$e.preventDefault()}}function pe($e){p==="pen"&&m?(m.points.push(T($e)),A()):p==="laser"&&(k=T($e),v.push({...k,t:performance.now()}),I())}function Oe(){m&&(f.push(m),m=null)}function re(){let $e=o.getBoundingClientRect(),_e=window.devicePixelRatio||1;c.width=Math.max(1,Math.round($e.width*_e)),c.height=Math.max(1,Math.round($e.height*_e)),A()}function ce(){c||(c=document.createElement("canvas"),c.className="decklight-annotate",c.setAttribute("aria-hidden","true"),o.appendChild(c),d=c.getContext("2d"),c.addEventListener("pointerdown",Se),c.addEventListener("pointermove",pe),c.addEventListener("pointerup",Oe),c.addEventListener("pointercancel",Oe),c.addEventListener("touchstart",$e=>$e.stopPropagation(),{passive:!0}),re(),new ResizeObserver(()=>{re(),requestAnimationFrame(A)}).observe(o))}function Me($e="pen"){return p=p===$e?null:$e,p&&ce(),c&&(c.classList.toggle("tool-pen",p==="pen"),c.classList.toggle("tool-laser",p==="laser")),m&&(f.push(m),m=null),p!=="laser"&&(v=[],k=null,d&&A()),p}function ze(){f=[],m=null,v=[],k=null,d&&A()}function Ve($e){ce(),f.push({color:P(),points:$e.map(_e=>({x:_e.x,y:_e.y}))}),A()}return t.on("slide",ze),{toggle:Me,laser:()=>Me("laser"),clear:ze,stroke:Ve,get tool(){return p},get active(){return p!==null}}}function $a({root:t,printMode:o,toast:a,debugLog:c,overlays:d,instance:p,narration:f,downloadFromUrl:m,setProgressBar:v}){let k="decklight-clock:"+location.pathname,S=!1;S=kn(k)==="1";let P=null,T=null,A=null,N=!1,I=j=>String(j).padStart(2,"0");function Se(j){let oe=Math.floor(j/1e3),he=Math.floor(oe/3600);return(he?he+":":"")+I(Math.floor(oe/60)%60)+":"+I(oe%60)}function pe(){if(!P)return;let j=new Date;P.querySelector(".clk-time").textContent=I(j.getHours())+":"+I(j.getMinutes()),P.querySelector(".clk-elapsed").textContent="+"+Se(A==null?0:Date.now()-A)}function Oe(){P=document.createElement("div"),P.className="decklight-clock",P.innerHTML='<span class="clk-time"></span><span class="clk-elapsed"></span>',t.appendChild(P),pe(),T=setInterval(pe,1e3)}function re(){S=!S,fn(k,S?"1":"0"),S?Oe():(clearInterval(T),T=null,P?.remove(),P=null),a(`clock ${S?"on":"off"}`),c("nav",`clock ${S?"on":"off"}`)}p.on("ready",()=>{N=!0});let ce=()=>{!N||A!=null||(A=Date.now(),pe())};p.on("slide",ce),p.on("build",ce),p.toggleClock=re,S&&!o&&Oe();let Me="decklight-progress:"+location.pathname,ze=!1;ze=kn(Me)==="1";let Ve=null;function $e(){Ve=document.createElement("div"),Ve.className="decklight-progress",Ve.innerHTML='<div class="bar"></div>',t.appendChild(Ve),v(Ve.querySelector(".bar")),p._updateChrome()}function _e(){ze=!ze,fn(Me,ze?"1":"0"),ze?$e():(Ve?.remove(),Ve=null,v(null)),a(`progress bar ${ze?"on":"off"}`),c("nav",`progress bar ${ze?"on":"off"}`)}p.toggleProgress=_e,ze&&!o&&$e();let Ze=null;o||(Ze=Ta(p,t),p.annotate=Ze);function bt(j){if(!Ze)return;let oe=j==="laser"?Ze.laser():Ze.toggle();a(oe==="pen"?"pen on \u2014 drag to draw \xB7 \u232B clears \xB7 W off":oe==="laser"?"laser on \u2014 \u21E7W off":"ink off"),c("nav",`ink ${oe??"off"}`)}function _(){return(p._sections||[]).map((j,oe)=>({n:oe+1,title:j.querySelector("h1, h2, h3")?.textContent.trim()||`Slide ${oe+1}`,segs:f.notesSegs(oe+1).filter(Boolean)}))}function je(j){let oe=(document.title||"Deck").trim(),he=j?[`# ${oe} \u2014 transcript`,""]:[`${oe} \u2014 transcript`,""];for(let{n:le,title:Re,segs:Y}of _())if(Y.length){he.push(j?`## ${le}. ${Re}`:`${le}. ${Re}`,"");for(let s of Y)he.push(s,"")}return he.join(`
|
|
364
|
+
`)}function gt(j){let oe=j==="md",he=URL.createObjectURL(new Blob([je(oe)],{type:oe?"text/markdown":"text/plain"})),le=(location.pathname.split("/").pop()||"deck").replace(/\.html?$/i,"");m(he,`${le}-transcript.${oe?"md":"txt"}`),setTimeout(()=>URL.revokeObjectURL(he),5e3),c("narr",`transcript exported (.${oe?"md":"txt"})`)}let ut=null;function Q(){if(ut){ut.remove(),ut=null;return}ut=document.createElement("div"),ut.className="decklight-narr decklight-transcript";let j=document.createElement("div");j.className="narr-card";let oe=document.createElement("div");oe.className="narr-head",oe.textContent="transcript \u2014 the deck\u2019s spoken notes \xB7 Esc closes";let he=document.createElement("div");he.className="tr-actions";for(let[le,Re]of[["\u2B07 export .txt","txt"],["\u2B07 export .md","md"]]){let Y=document.createElement("button");Y.type="button",Y.className="narr-prev-btn",Y.textContent=le,Y.addEventListener("click",()=>gt(Re)),he.appendChild(Y)}j.append(oe,he);for(let{n:le,title:Re,segs:Y}of _()){if(!Y.length)continue;let s=document.createElement("div");s.className="tr-slide";let i=document.createElement("div");i.className="tr-title",i.textContent=`${le} \xB7 ${Re}`,i.title="jump to this slide",i.addEventListener("click",()=>{Q(),p.goto(le,0,{force:!0})}),s.appendChild(i);for(let O of Y){let Ue=document.createElement("p");Ue.className="tr-seg",Ue.textContent=O,s.appendChild(Ue)}j.appendChild(s)}ut.appendChild(j),Ht(ut,Q),t.appendChild(ut)}return p.transcript={open:Q,text:()=>je(!1),markdown:()=>je(!0)},d.register({isOpen:()=>!!ut,close:Q,keydown:j=>j.key==="Escape"&&(Q(),!0)}),{toggleClock:re,toggleProgress:_e,toggleInk:bt,toggleTranscript:Q,get annotator(){return Ze},status:()=>({clockOn:S,progressOn:ze})}}me();fe();var Rd=["data-background-image","data-background-video","data-background-poster","data-background-size","data-background-position","data-background-dim"];function Id(t){let o=t["data-background-image"]||null,a=t["data-background-video"]||null;if(!o&&!a)return null;let c=parseFloat(t["data-background-dim"]);return{image:o,video:a,poster:t["data-background-poster"]||null,size:t["data-background-size"]==="contain"?"contain":"cover",position:t["data-background-position"]||"center",dim:Number.isFinite(c)?Math.min(Math.max(c,0),1):0}}var Pd=t=>`url("${String(t).replace(/["\\]/g,"\\$&")}")`;function Bd(t){let o={};for(let a of Rd){let c=t.getAttribute(a);c!==null&&(o[a]=c)}return o}function Ca(t,{printMode:o=!1}={}){t.forEach(a=>{let c=Id(Bd(a)),d=a.querySelector(":scope > .slide-bg");if(!c){d?.remove();return}let p=JSON.stringify(c)+(o?"\xB7print":"");if(d&&d.dataset.sig===p){d!==a.firstElementChild&&a.prepend(d);return}d||(d=document.createElement("div"),d.className="slide-bg",d.setAttribute("aria-hidden","true")),d.dataset.sig=p,d.textContent="",d.style.backgroundSize=c.size,d.style.backgroundPosition=c.position;let f=c.image||(o?c.poster:null);if(d.style.backgroundImage=f?Pd(f):"",c.video&&!o){let m=document.createElement("video");m.muted=!0,m.loop=!0,m.setAttribute("muted",""),m.setAttribute("loop",""),m.setAttribute("playsinline",""),m.preload="auto",c.poster&&(m.poster=c.poster),m.style.objectFit=c.size,m.style.objectPosition=c.position,m.src=c.video,d.appendChild(m)}if(c.dim>0){let m=document.createElement("div");m.className="slide-bg-dim",m.style.opacity=String(c.dim),d.appendChild(m)}a.prepend(d)})}me();fe();me();fe();var Dd="npx decklight author";function qd(t){let o=t||"";try{o=decodeURIComponent(o)}catch{}/^\/[A-Za-z]:/.test(o)&&(o=o.slice(1));let a=o.lastIndexOf("/");return{dir:a>0?o.slice(0,a):"",file:a>=0?o.slice(a+1):o}}function Fn(t,o={}){let{protocol:a="",pathname:c=""}=o,{dir:d,file:p}=qd(c),f=/\.html?$/i.test(p)?p:"<deck.html>",m=a==="file:"&&d?`from ${d}, `:"";return`${t} needs author mode: ${m}run ${Dd} ${f}, then reopen the URL it prints`}function Fd(t){let o=Math.max(0,Math.floor((Number(t)||0)/1e3)),a=String(o%60).padStart(2,"0"),c=Math.floor(o/60);return c<60?`${c}:${a}`:`${Math.floor(c/60)}:${String(c%60).padStart(2,"0")}:${a}`}var zd={second:"s",minute:"m",hour:"h",day:"d",week:"w",month:"mo",year:"y"};function Na(t){let o=/^(\d+)\s+(second|minute|hour|day|week|month|year)s?\s+ago$/.exec(String(t??"").trim());return o?`${o[1]}${zd[o[2]]}`:String(t??"")}function Ma(t,o=Date.now()){if(!t||!t.agent)return null;let a=typeof t.activity=="string"&&t.activity.trim()?` \u2014 ${t.activity.trim().slice(0,60)}`:"",c=Number(t.startedAt);return!Number.isFinite(c)||c<=0||c>o?`${t.agent}${a}`:`${t.agent} \xB7 ${Fd(o-c)}${a}`}function Oa(t,{shown:o=!1,threshold:a=10}={}){if(o||!t||!["ok","no-upstream"].includes(t.state))return null;let c=t.state==="ok"?t.ahead:t.unpushed;return!c||c<a?null:`\u2191${c} commits are only on this machine \u2014 H shows them`}function La(t){if(!t||!t.nag||!t.dirty||!t.canWrite)return null;let o=Math.floor((Number(t.sinceMs)||0)/6e4),a=o>=60?` \xB7 ${Math.floor(o/60)}h`:o>=1?` \xB7 ${o}m`:"",c=Number(t.lines)||0;return`${c?`${c} line${c===1?"":"s"}`:"changes"} uncommitted${a} \u2014 K commits`}me();fe();var Ud=/<\s*(pre|textarea|script|style)\b/i,Hd=t=>!Ud.test(String(t??""));function Ra(t){let o=String(t??"");if(!Hd(o))return o;let a=o.split(`
|
|
314
365
|
`);if(a.length<2)return o;let c=1/0;for(let d of a.slice(1))if(d.trim()&&(/^\s*\t/.test(d)||(c=Math.min(c,/^ */.exec(d)[0].length),c===0)))return o;return Number.isFinite(c)?a.map((d,p)=>p===0?d:d.trim()?d.slice(c):"").join(`
|
|
315
|
-
`):o}function Ta({root:t,config:o,params:a,printMode:c,toast:d,debugLog:p,overlays:g,instance:m,notesSegs:w,dismissOthers:E}){let S=!1,P="",$=[],_=null,C=[],I=null,Se=!1,de=null,$e=0;function te(){let M=Ea(I);if(!M){clearInterval($e),$e=0,de?.remove(),de=null;return}de||(de=document.createElement("div"),de.className="decklight-agent-chip",de.setAttribute("role","status"),de.setAttribute("aria-live","polite"),t.appendChild(de)),de.textContent=`\u{1F916} ${M}`,de.title=I.prompt?`asked: ${I.prompt}`:"",$e||($e=setInterval(te,1e3))}let ae=null,Re=null;function Fe(){let M=Aa(ae);if(!M){Re?.remove(),Re=null;return}if(!Re){Re=document.createElement("div"),Re.className="decklight-commit-chip",Re.setAttribute("role","status"),Re.setAttribute("aria-live","polite"),Re.tabIndex=0;let j=()=>bt();Re.addEventListener("click",j),Re.addEventListener("keydown",H=>{(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),j())}),t.appendChild(Re)}Re.textContent=`\u2325 ${M}`,Re.title="commit this \u2014 the work is snapshotted either way"}async function je(){if(!S)return null;try{let j=await(await fetch(P+"/edit/commit")).json();if(j?.ok)return ae=j,Fe(),j}catch{}return null}let _e=null,Ae=!1;function st(){_e?.remove(),_e=null,Ae=!1}async function bt(){if(_e)return st();if(!S){d(Dn("committing",location),3200);return}let M=await je()??ae;if(!M?.canWrite){d("this session is not committing \u2014 start author with --git",3e3);return}if(!M.dirty){d("nothing to commit \u2014 the deck matches its last commit",2400);return}E(),_e=document.createElement("div"),_e.className="decklight-narr decklight-commit",_e.innerHTML='<div class="narr-card" role="dialog" aria-label="Commit"></div>',Ut(_e,st),t.appendChild(_e);let j=_e.querySelector(".narr-card"),H=document.createElement("div");H.className="narr-head",H.textContent="commit";let we=document.createElement("div");we.className="cm-what";let Ye=Number(M.lines)||0,We=Math.floor((Number(M.sinceMs)||0)/6e4);we.textContent=`${Ye?`${Ye} line${Ye===1?"":"s"}`:"changes"} in ${M.deck||"the deck"}`+(We>=1?`, ${We>=60?`${Math.floor(We/60)}h`:`${We}m`} old`:"");let Ve=document.createElement("textarea");Ve.className="narr-input cm-input",Ve.rows=3,Ve.placeholder="what changed, in one line\u2026";let xe=document.createElement("div");xe.className="cm-row";let Oe=document.createElement("div");Oe.className="narr-row narr-sel cm-write",Oe.setAttribute("role","button"),Oe.tabIndex=0,Oe.textContent=M.messages?"writing one\u2026":"write one for me";let ot=document.createElement("div");ot.className="narr-row narr-sel cm-go",ot.setAttribute("role","button"),ot.tabIndex=0,ot.textContent="Commit",xe.append(Oe,ot);let Et=document.createElement("div");Et.className="rec-hint",Et.textContent="\u2318\u23CE commits \xB7 Esc closes \u2014 the work is snapshotted either way",j.append(H,we,Ve,xe,Et),setTimeout(()=>Ve.focus(),0);let Tt=async()=>{if(!Ae){Ae=!0,Oe.textContent="writing one\u2026";try{let Qe=await fetch(P+"/edit/commit/subject",{method:"POST"}),wt=await Qe.json();if(!wt?.ok)throw new Error(wt?.error||`HTTP ${Qe.status}`);if(!_e)return;wt.subject&&!Ve.value.trim()&&(Ve.value=wt.subject),Oe.textContent=wt.subject?"write another":"nothing to say about it"}catch(Qe){_e&&(Oe.textContent=`couldn't \u2014 ${String(Qe.message||Qe).slice(0,40)}`)}finally{Ae=!1}}};Oe.addEventListener("click",Tt),M.messages&&Tt();let yt=async()=>{let Qe=Ve.value.trim();if(!Qe){Ve.focus();return}ot.textContent="committing\u2026";try{let wt=await fetch(P+"/edit/commit",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:Qe})}),L=await wt.json();if(!L?.ok)throw new Error(L?.error||`HTTP ${wt.status}`);st(),ae=L.committed?{...L,nag:!1}:ae,Fe(),d(L.committed?`committed \u2014 "${L.subject}"`:"nothing to commit",2600),p("git",L.committed?`commit: ${L.subject}`:"commit: nothing to do")}catch(wt){ot.textContent=`couldn't commit \u2014 ${String(wt.message||wt).slice(0,40)}`}};ot.addEventListener("click",yt),Ve.addEventListener("keydown",Qe=>{Qe.key==="Enter"&&(Qe.metaKey||Qe.ctrlKey)&&(Qe.preventDefault(),yt()),!((Qe.metaKey||Qe.ctrlKey)&&(Qe.key==="k"||Qe.key==="K"))&&Qe.stopPropagation()}),T??=g.register({isOpen:()=>!!_e,close:st,keydown(Qe){return Qe.key==="Escape"?(st(),!0):/^(input|textarea)$/i.test(Qe.target?.tagName??"")?!1:Qe.key==="Enter"?(_e?.querySelector(".cm-go")?.click(),!0):Qe.key==="k"||Qe.key==="K"?(st(),!0):!1}})}let T=null,Ke,mt=new Promise(M=>{Ke=M});if(!c&&!a.has("embedded")){let M=o.edit?.url?[o.edit.url]:/^https?:$/.test(location.protocol)?[""]:["http://127.0.0.1:8788"];(async()=>{for(let j of M)try{let H=await fetch(j+"/edit/ping");if(!H.ok)continue;let we=await H.json();if(!we?.ok)continue;let Ye=decodeURIComponent(location.pathname.split("/").pop()||"");if(Ye&&we.name&&Ye!==we.name){p("edit",`server edits ${we.name}, this deck is ${Ye} \u2014 not wiring up`);continue}P=j,S=!0,$=Array.isArray(we.agents)?we.agents:[],_=typeof we.preferredAgent=="string"?we.preferredAgent:null,C=Array.isArray(we.wizards)?we.wizards:[];let We=Sa(we.remote);We&&(Se=!0,d(We,4200)),we.commit&&(ae=we.commit,Fe()),I=we.agentBusy||null,I&&d(`${I.agent} is editing the deck\u2026`,2e3),te();let Ve=new EventSource(j+"/edit/events");Ve.onmessage=()=>location.reload(),Ve.addEventListener("commit",xe=>{try{ae=JSON.parse(xe.data),Fe(),p("git",`uncommitted: ${ae.lines} lines`)}catch{}}),Ve.addEventListener("agent",xe=>{try{let Oe=JSON.parse(xe.data);if(Oe.state==="activity")I&&(I.activity=Oe.text,te()),p("agent",`activity: ${Oe.text}`);else if(Oe.state==="start")I=Oe,te(),d(`\u{1F916} ${Oe.agent} is editing the deck\u2026`,2200),p("agent",`${Oe.agent} start: ${(Oe.prompt||"").slice(0,80)}`);else if(Oe.state==="done"){I=null,te();let ot=Oe.ok?"":Oe.error?` \u2014 ${Oe.error}`:` (exit ${Oe.code})`;d(Oe.changed?`\u{1F916} ${Oe.agent} edited the deck \u2014 Z undoes${ot}`:`\u{1F916} ${Oe.agent} finished \u2014 no changes${ot}`,3e3),p("agent",`${Oe.agent} done ok=${Oe.ok} changed=${Oe.changed}${ot}`),typeof Oe.recordingWarning=="string"&&(d(Oe.recordingWarning,9e3),p("agent",Oe.recordingWarning))}}catch{}}),p("edit",`live reload connected${j?` (${j})`:""}`+($.length?` \xB7 agents: ${$.map(xe=>xe.name).join(", ")}`:"")),Ke();return}catch{}Ke(),await s()})()}let dt=null,G=!1,J=null;function ne(){J?.remove(),J=null}function fe(M,j){let H=document.createElement("div");return H.className=j,H.textContent=M,H}async function ue(M){let j=J?.querySelector(".tp-list");if(!j)return;j.textContent="",j.appendChild(fe(M.message??M.state,"hs-remote"));for(let Ye of M.commits??[])j.appendChild(fe(`${Ye.hash} ${Ye.subject}`,"tp-row"));let H=J.querySelector(".up-actions");H.textContent="";let we=(Ye,We)=>{let Ve=document.createElement("button");return Ve.type="button",Ve.className="narr-prev-btn",Ve.textContent=Ye,Ve.addEventListener("click",We),H.appendChild(Ve),Ve};we("check now",async()=>{H.textContent="checking\u2026",await ue(await Ie("/present/upstream/check"))}),M.state==="behind"&&M.pull?.offered?we("update the deck",async()=>{H.textContent="pulling\u2026";let Ye=await Ie("/present/upstream/pull");if(Ye.reload)return location.reload();await ue({...Ye,commits:[],message:Ye.message}),Ye.state==="pulled"&&we("show it anyway",()=>location.reload())}):M.pull&&!M.pull.offered&&M.state==="behind"&&H.appendChild(fe(`update control off \u2014 ${M.pull.reason}`,"hs-remote"))}async function Ie(M){try{return await(await fetch(dt+M,{method:"POST"})).json()}catch{return{state:"error",message:"the presenting server did not answer"}}}async function Q(){if(J)return ne();let M;try{let j=await fetch(dt+"/present/upstream");if(!j.ok)return d("this deck is not a tracked file in a git clone \u2014 nothing to update from",3400);M=await j.json()}catch{return d("deck update: the presenting server did not answer",3e3)}E(),J=document.createElement("div"),J.className="decklight-theme-picker decklight-finder decklight-restore decklight-history",J.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter">Deck update \u2014 Esc closes</div><div class="tp-list" role="listbox" aria-label="Upstream commits"></div><div class="up-actions tr-actions"></div></div></div>',Ut(J,ne),t.appendChild(J),await ue(M)}g.register({isOpen:()=>!!J,close:ne,keydown:M=>M.key==="Escape"&&(ne(),!0)});async function s(){let M=/^https?:$/.test(location.protocol)?"":"http://127.0.0.1:8790";try{let j=await fetch(M+"/present/ping");if(!j.ok)return;let H=await j.json();if(!H?.ok||!H.present)return;let we=decodeURIComponent(location.pathname.split("/").pop()||"");if(we&&H.name&&we!==H.name){p("present",`server presents ${H.name}, this deck is ${we} \u2014 not wiring up`);return}m.__remoteQr=H.remote?`${M||location.origin}/remote/qr.svg`:null,dt=M,G=!0,new EventSource(M+"/present/events").addEventListener("remote",Ve=>{try{let{key:xe}=JSON.parse(Ve.data);xe==="next"?m.next():xe==="prev"&&m.prev()}catch{}});let We=()=>{fetch(M+"/remote/pos",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({i:m.state.slide,n:m.state.totalSlides})}).catch(()=>{})};m.on("slide",We),m.on("build",We),We(),p("present",`remote connected${M?` (${M})`:""} \u2014 no edit surface`)}catch{}}async function i(M){if(!S){d(Dn(M,location),3200);return}try{let j=await fetch(P+"/edit/"+M,{method:"POST"}),H=await j.json().catch(()=>({}));if(!j.ok){d(H.error||`${M} failed`);return}d(`${M} \u2014 ${H.undo} back \xB7 ${H.redo} forward`),p("edit",`${M} \u2192 ${H.undo} back, ${H.redo} forward`)}catch{d(`${M} failed \u2014 is the dev server still up?`,2200)}}let O=null;function De(){if(O){O.remove(),O=null;return}if(!S){d(Dn("asking an agent",location),3200);return}if(!$.length){d("no agent CLI detected on the dev machine (claude, codex, bob, \u2026)",2600);return}if(I){d(`${I.agent} is still working on the last ask`,2200);return}O=document.createElement("div"),O.className="decklight-narr decklight-editor";let M=document.createElement("div");M.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 H=document.createElement("textarea");H.className="narr-input edit-notes",H.placeholder=`e.g. "make slide ${m.state.slide} a split layout with the diagram on the left"`,H.spellcheck=!1;let we=_&&$.some(xe=>xe.name===_)?_:$[0].name,Ye=document.createElement("div");if(Ye.className="tr-actions",$.length>1){let xe=document.createElement("select");xe.className="narr-prev-btn";for(let Oe of $){let ot=document.createElement("option");ot.value=Oe.name,ot.textContent=Oe.label,xe.appendChild(ot)}xe.value=we,xe.addEventListener("change",()=>{we=xe.value,_=xe.value,fetch(P+"/edit/agent/prefer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:xe.value})}).catch(()=>{}),p("agent",`preferred agent \u2192 ${xe.value}`)}),xe.addEventListener("keydown",Oe=>Oe.stopPropagation()),Ye.appendChild(xe)}let We=async()=>{let xe=H.value.trim();if(xe)try{let Oe=await fetch(P+"/edit/agent",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({prompt:xe,agent:we})}),ot=await Oe.json().catch(()=>({}));if(!Oe.ok)throw new Error(ot.error||Oe.status);De()}catch(Oe){d(`ask failed: ${String(Oe.message||Oe).slice(0,60)}`,2200)}};H.addEventListener("keydown",xe=>{xe.key==="Enter"&&(xe.metaKey||xe.ctrlKey)?(We(),xe.preventDefault()):xe.key==="Escape"&&(De(),xe.preventDefault()),xe.stopPropagation()});let Ve=document.createElement("button");Ve.type="button",Ve.className="narr-prev-btn",Ve.textContent="\u{1F916} send to agent",Ve.addEventListener("click",We),Ye.appendChild(Ve),M.append(j,H,Ye),O.appendChild(M),Ut(O,De),t.appendChild(O),setTimeout(()=>H.focus(),0)}let B=null;function Pe(){if(B){B.remove(),B=null;return}let M=m.state.slide;if(!S){d(Dn("editing notes",location),3200);return}B=document.createElement("div"),B.className="decklight-narr decklight-editor";let j=document.createElement("div");j.className="narr-card";let H=document.createElement("div");H.className="narr-head",H.textContent=`edit notes \u2014 slide ${M} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let we=document.createElement("textarea");we.className="narr-input edit-notes",we.value=w(M).filter((xe,Oe,ot)=>xe||Oe<ot.length).join(`
|
|
366
|
+
`):o}function Ia({root:t,config:o,params:a,printMode:c,toast:d,debugLog:p,overlays:f,instance:m,notesSegs:v,dismissOthers:k}){let S=!1,P="",T=[],A=null,N=[],I=null,Se=!1,pe=null,Oe=0;function re(){let M=Ma(I);if(!M){clearInterval(Oe),Oe=0,pe?.remove(),pe=null;return}pe||(pe=document.createElement("div"),pe.className="decklight-agent-chip",pe.setAttribute("role","status"),pe.setAttribute("aria-live","polite"),t.appendChild(pe)),pe.textContent=`\u{1F916} ${M}`,pe.title=I.prompt?`asked: ${I.prompt}`:"",Oe||(Oe=setInterval(re,1e3))}let ce=null,Me=null;function ze(){let M=La(ce);if(!M){Me?.remove(),Me=null;return}if(!Me){Me=document.createElement("div"),Me.className="decklight-commit-chip",Me.setAttribute("role","status"),Me.setAttribute("aria-live","polite"),Me.tabIndex=0;let H=()=>bt();Me.addEventListener("click",H),Me.addEventListener("keydown",K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),H())}),t.appendChild(Me)}Me.textContent=`\u2325 ${M}`,Me.title="commit this \u2014 the work is snapshotted either way"}async function Ve(){if(!S)return null;try{let H=await(await fetch(P+"/edit/commit")).json();if(H?.ok)return ce=H,ze(),H}catch{}return null}let $e=null,_e=!1;function Ze(){$e?.remove(),$e=null,_e=!1}async function bt(){if($e)return Ze();if(!S){d(Fn("committing",location),3200);return}let M=await Ve()??ce;if(!M?.canWrite){d("this session is not committing \u2014 start author with --git",3e3);return}if(!M.dirty){d("nothing to commit \u2014 the deck matches its last commit",2400);return}k(),$e=document.createElement("div"),$e.className="decklight-narr decklight-commit",$e.innerHTML='<div class="narr-card" role="dialog" aria-label="Commit"></div>',Ht($e,Ze),t.appendChild($e);let H=$e.querySelector(".narr-card"),K=document.createElement("div");K.className="narr-head",K.textContent="commit";let se=document.createElement("div");se.className="cm-what";let qe=Number(M.lines)||0,Qe=Math.floor((Number(M.sinceMs)||0)/6e4);se.textContent=`${qe?`${qe} line${qe===1?"":"s"}`:"changes"} in ${M.deck||"the deck"}`+(Qe>=1?`, ${Qe>=60?`${Math.floor(Qe/60)}h`:`${Qe}m`} old`:"");let Fe=document.createElement("textarea");Fe.className="narr-input cm-input",Fe.rows=3,Fe.placeholder="what changed, in one line\u2026";let ge=document.createElement("div");ge.className="cm-row";let Be=document.createElement("div");Be.className="narr-row narr-sel cm-write",Be.setAttribute("role","button"),Be.tabIndex=0,Be.textContent=M.messages?"writing one\u2026":"write one for me";let st=document.createElement("div");st.className="narr-row narr-sel cm-go",st.setAttribute("role","button"),st.tabIndex=0,st.textContent="Commit",ge.append(Be,st);let wt=document.createElement("div");wt.className="rec-hint",wt.textContent="\u2318\u23CE commits \xB7 Esc closes \u2014 the work is snapshotted either way",H.append(K,se,Fe,ge,wt),setTimeout(()=>Fe.focus(),0);let Mt=async()=>{if(!_e){_e=!0,Be.textContent="writing one\u2026";try{let nt=await fetch(P+"/edit/commit/subject",{method:"POST"}),vt=await nt.json();if(!vt?.ok)throw new Error(vt?.error||`HTTP ${nt.status}`);if(!$e)return;vt.subject&&!Fe.value.trim()&&(Fe.value=vt.subject),Be.textContent=vt.subject?"write another":"nothing to say about it"}catch(nt){$e&&(Be.textContent=`couldn't \u2014 ${String(nt.message||nt).slice(0,40)}`)}finally{_e=!1}}};Be.addEventListener("click",Mt),M.messages&&Mt();let pt=async()=>{let nt=Fe.value.trim();if(!nt){Fe.focus();return}st.textContent="committing\u2026";try{let vt=await fetch(P+"/edit/commit",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:nt})}),L=await vt.json();if(!L?.ok)throw new Error(L?.error||`HTTP ${vt.status}`);Ze(),ce=L.committed?{...L,nag:!1}:ce,ze(),d(L.committed?`committed \u2014 "${L.subject}"`:"nothing to commit",2600),p("git",L.committed?`commit: ${L.subject}`:"commit: nothing to do")}catch(vt){st.textContent=`couldn't commit \u2014 ${String(vt.message||vt).slice(0,40)}`}};st.addEventListener("click",pt),Fe.addEventListener("keydown",nt=>{nt.key==="Enter"&&(nt.metaKey||nt.ctrlKey)&&(nt.preventDefault(),pt()),!((nt.metaKey||nt.ctrlKey)&&(nt.key==="k"||nt.key==="K"))&&nt.stopPropagation()}),_??=f.register({isOpen:()=>!!$e,close:Ze,keydown(nt){return nt.key==="Escape"?(Ze(),!0):/^(input|textarea)$/i.test(nt.target?.tagName??"")?!1:nt.key==="Enter"?($e?.querySelector(".cm-go")?.click(),!0):nt.key==="k"||nt.key==="K"?(Ze(),!0):!1}})}let _=null,je,gt=new Promise(M=>{je=M});if(!c&&!a.has("embedded")){let M=o.edit?.url?[o.edit.url]:/^https?:$/.test(location.protocol)?[""]:["http://127.0.0.1:8788"];(async()=>{for(let H of M)try{let K=await fetch(H+"/edit/ping");if(!K.ok)continue;let se=await K.json();if(!se?.ok)continue;let qe=decodeURIComponent(location.pathname.split("/").pop()||"");if(qe&&se.name&&qe!==se.name){p("edit",`server edits ${se.name}, this deck is ${qe} \u2014 not wiring up`);continue}P=H,S=!0,m.__saveTimings=async ge=>{let Be=await fetch(P+"/edit/timings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({timings:ge})});if(!Be.ok)throw new Error(await Be.text());p("edit",`rehearsal timings saved \u2014 ${ge.length} slides`)},T=Array.isArray(se.agents)?se.agents:[],A=typeof se.preferredAgent=="string"?se.preferredAgent:null,N=Array.isArray(se.wizards)?se.wizards:[];let Qe=Oa(se.remote);Qe&&(Se=!0,d(Qe,4200)),se.commit&&(ce=se.commit,ze()),I=se.agentBusy||null,I&&d(`${I.agent} is editing the deck\u2026`,2e3),re();let Fe=new EventSource(H+"/edit/events");Fe.onmessage=()=>location.reload(),Fe.addEventListener("commit",ge=>{try{ce=JSON.parse(ge.data),ze(),p("git",`uncommitted: ${ce.lines} lines`)}catch{}}),Fe.addEventListener("agent",ge=>{try{let Be=JSON.parse(ge.data);if(Be.state==="activity")I&&(I.activity=Be.text,re()),p("agent",`activity: ${Be.text}`);else if(Be.state==="start")I=Be,re(),d(`\u{1F916} ${Be.agent} is editing the deck\u2026`,2200),p("agent",`${Be.agent} start: ${(Be.prompt||"").slice(0,80)}`);else if(Be.state==="done"){I=null,re();let st=Be.ok?"":Be.error?` \u2014 ${Be.error}`:` (exit ${Be.code})`;d(Be.changed?`\u{1F916} ${Be.agent} edited the deck \u2014 Z undoes${st}`:`\u{1F916} ${Be.agent} finished \u2014 no changes${st}`,3e3),p("agent",`${Be.agent} done ok=${Be.ok} changed=${Be.changed}${st}`),typeof Be.recordingWarning=="string"&&(d(Be.recordingWarning,9e3),p("agent",Be.recordingWarning))}}catch{}}),p("edit",`live reload connected${H?` (${H})`:""}`+(T.length?` \xB7 agents: ${T.map(ge=>ge.name).join(", ")}`:"")),je();return}catch{}je(),await s()})()}let ut=null,Q=!1,j=null;function oe(){j?.remove(),j=null}function he(M,H){let K=document.createElement("div");return K.className=H,K.textContent=M,K}async function le(M){let H=j?.querySelector(".tp-list");if(!H)return;H.textContent="",H.appendChild(he(M.message??M.state,"hs-remote"));for(let qe of M.commits??[])H.appendChild(he(`${qe.hash} ${qe.subject}`,"tp-row"));let K=j.querySelector(".up-actions");K.textContent="";let se=(qe,Qe)=>{let Fe=document.createElement("button");return Fe.type="button",Fe.className="narr-prev-btn",Fe.textContent=qe,Fe.addEventListener("click",Qe),K.appendChild(Fe),Fe};se("check now",async()=>{K.textContent="checking\u2026",await le(await Re("/present/upstream/check"))}),M.state==="behind"&&M.pull?.offered?se("update the deck",async()=>{K.textContent="pulling\u2026";let qe=await Re("/present/upstream/pull");if(qe.reload)return location.reload();await le({...qe,commits:[],message:qe.message}),qe.state==="pulled"&&se("show it anyway",()=>location.reload())}):M.pull&&!M.pull.offered&&M.state==="behind"&&K.appendChild(he(`update control off \u2014 ${M.pull.reason}`,"hs-remote"))}async function Re(M){try{return await(await fetch(ut+M,{method:"POST"})).json()}catch{return{state:"error",message:"the presenting server did not answer"}}}async function Y(){if(j)return oe();let M;try{let H=await fetch(ut+"/present/upstream");if(!H.ok)return d("this deck is not a tracked file in a git clone \u2014 nothing to update from",3400);M=await H.json()}catch{return d("deck update: the presenting server did not answer",3e3)}k(),j=document.createElement("div"),j.className="decklight-theme-picker decklight-finder decklight-restore decklight-history",j.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter">Deck update \u2014 Esc closes</div><div class="tp-list" role="listbox" aria-label="Upstream commits"></div><div class="up-actions tr-actions"></div></div></div>',Ht(j,oe),t.appendChild(j),await le(M)}f.register({isOpen:()=>!!j,close:oe,keydown:M=>M.key==="Escape"&&(oe(),!0)});async function s(){let M=/^https?:$/.test(location.protocol)?"":"http://127.0.0.1:8790";try{let H=await fetch(M+"/present/ping");if(!H.ok)return;let K=await H.json();if(!K?.ok||!K.present)return;let se=decodeURIComponent(location.pathname.split("/").pop()||"");if(se&&K.name&&se!==K.name){p("present",`server presents ${K.name}, this deck is ${se} \u2014 not wiring up`);return}m.__remoteQr=K.remote?`${M||location.origin}/remote/qr.svg`:null,ut=M,Q=!0,new EventSource(M+"/present/events").addEventListener("remote",Fe=>{try{let{key:ge}=JSON.parse(Fe.data);ge==="next"?m.next():ge==="prev"&&m.prev()}catch{}});let Qe=()=>{fetch(M+"/remote/pos",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({i:m.state.slide,n:m.state.totalSlides})}).catch(()=>{})};m.on("slide",Qe),m.on("build",Qe),Qe(),p("present",`remote connected${M?` (${M})`:""} \u2014 no edit surface`)}catch{}}async function i(M){if(!S){d(Fn(M,location),3200);return}try{let H=await fetch(P+"/edit/"+M,{method:"POST"}),K=await H.json().catch(()=>({}));if(!H.ok){d(K.error||`${M} failed`);return}d(`${M} \u2014 ${K.undo} back \xB7 ${K.redo} forward`),p("edit",`${M} \u2192 ${K.undo} back, ${K.redo} forward`)}catch{d(`${M} failed \u2014 is the dev server still up?`,2200)}}let O=null;function Ue(){if(O){O.remove(),O=null;return}if(!S){d(Fn("asking an agent",location),3200);return}if(!T.length){d("no agent CLI detected on the dev machine (claude, codex, bob, \u2026)",2600);return}if(I){d(`${I.agent} is still working on the last ask`,2200);return}O=document.createElement("div"),O.className="decklight-narr decklight-editor";let M=document.createElement("div");M.className="narr-card";let H=document.createElement("div");H.className="narr-head",H.textContent="ask an agent \u2014 edits the deck file \xB7 \u2318\u23CE sends \xB7 Esc closes";let K=document.createElement("textarea");K.className="narr-input edit-notes",K.placeholder=`e.g. "make slide ${m.state.slide} a split layout with the diagram on the left"`,K.spellcheck=!1;let se=A&&T.some(ge=>ge.name===A)?A:T[0].name,qe=document.createElement("div");if(qe.className="tr-actions",T.length>1){let ge=document.createElement("select");ge.className="narr-prev-btn";for(let Be of T){let st=document.createElement("option");st.value=Be.name,st.textContent=Be.label,ge.appendChild(st)}ge.value=se,ge.addEventListener("change",()=>{se=ge.value,A=ge.value,fetch(P+"/edit/agent/prefer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:ge.value})}).catch(()=>{}),p("agent",`preferred agent \u2192 ${ge.value}`)}),ge.addEventListener("keydown",Be=>Be.stopPropagation()),qe.appendChild(ge)}let Qe=async()=>{let ge=K.value.trim();if(ge)try{let Be=await fetch(P+"/edit/agent",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({prompt:ge,agent:se})}),st=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(st.error||Be.status);Ue()}catch(Be){d(`ask failed: ${String(Be.message||Be).slice(0,60)}`,2200)}};K.addEventListener("keydown",ge=>{ge.key==="Enter"&&(ge.metaKey||ge.ctrlKey)?(Qe(),ge.preventDefault()):ge.key==="Escape"&&(Ue(),ge.preventDefault()),ge.stopPropagation()});let Fe=document.createElement("button");Fe.type="button",Fe.className="narr-prev-btn",Fe.textContent="\u{1F916} send to agent",Fe.addEventListener("click",Qe),qe.appendChild(Fe),M.append(H,K,qe),O.appendChild(M),Ht(O,Ue),t.appendChild(O),setTimeout(()=>K.focus(),0)}let B=null;function Le(){if(B){B.remove(),B=null;return}let M=m.state.slide;if(!S){d(Fn("editing notes",location),3200);return}B=document.createElement("div"),B.className="decklight-narr decklight-editor";let H=document.createElement("div");H.className="narr-card";let K=document.createElement("div");K.className="narr-head",K.textContent=`edit notes \u2014 slide ${M} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let se=document.createElement("textarea");se.className="narr-input edit-notes",se.value=v(M).filter((ge,Be,st)=>ge||Be<st.length).join(`
|
|
316
367
|
|
|
317
368
|
\u27E8CLICK\u27E9
|
|
318
369
|
|
|
319
|
-
`),
|
|
320
|
-
`,{language:"xml"}).value};xe.addEventListener("input",Oe),xe.addEventListener("scroll",()=>{We.scrollTop=xe.scrollTop,We.scrollLeft=xe.scrollLeft});let ot=async()=>{try{let yt=await fetch(P+"/edit/element/content",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:M,index:j,html:xe.value})});if(!yt.ok)throw new Error(await yt.text());d("element content saved \u2014 reloading")}catch(yt){d(`save failed: ${String(yt.message||yt).slice(0,60)}`)}};xe.addEventListener("keydown",yt=>{yt.key==="Enter"&&(yt.metaKey||yt.ctrlKey)?(ot(),yt.preventDefault()):yt.key==="Escape"&&(ut(),yt.preventDefault()),yt.stopPropagation()});let Et=document.createElement("div");Et.className="tr-actions";let Tt=document.createElement("button");Tt.type="button",Tt.className="narr-prev-btn",Tt.textContent="\u{1F4BE} save to file",Tt.addEventListener("click",ot),Et.appendChild(Tt),H.append(we,Ye,Et),pt.appendChild(H),Ut(pt,ut),t.appendChild(pt),(async()=>{try{let yt=await fetch(`${P}/edit/element/source?slide=${M}&index=${j}`),Qe=await yt.json().catch(()=>({}));if(!yt.ok||!Qe.ok)throw new Error(Qe.error||yt.status);xe.value=_a(Qe.html),xe.disabled=!1,Oe(),xe.focus()}catch(yt){xe.value="",d(`could not read the element's source: ${String(yt.message||yt).slice(0,60)}`,2600)}})()}g.register({isOpen:()=>!!ye,close:F,keydown(M){switch(M.key){case"ArrowDown":ce(Ze+1,!0);break;case"ArrowUp":ce(Ze-1,!0);break;case"Enter":ie[Ze]?.run();break;case"Escape":F();break;default:return!1}return!0}}),g.register({isOpen:()=>!!pt,close:ut,keydown:M=>M.key==="Escape"&&(ut(),!0)});let Ee=null,re=[],Ge=0,ht=null,tt=1,He=!1,gt=null,Yt=!1,nn={first:'<path d="M17 6l-6 6 6 6"/><path d="M7 6v12"/>',prev:'<path d="M15 6l-6 6 6 6"/>',next:'<path d="M9 6l6 6-6 6"/>',last:'<path d="M7 6l6 6-6 6"/><path d="M17 6v12"/>'},It={first:"first slide (Home)",prev:"previous slide (\u2190)",next:"next slide (\u2192)",last:"last slide (End)"},Wt=M=>`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${M}</svg>`,oe=()=>Number(re[Ge]?.slides)||0;function pn(M){let j=oe();tt=Math.max(1,j?Math.min(M,j):M);let H=Ee?.querySelector("iframe");He?H?.contentWindow?.postMessage({__decklightPreview:{goto:[tt,0]}},"*"):gt=tt,Bt()}function Bt(){let M=Ee?.querySelector(".hs-nav");if(!M)return;let j=oe();M.querySelector(".hs-pos").textContent=j?`${tt} / ${j}`:`${tt}`;for(let H of M.querySelectorAll(".hs-btn")){let we=H.dataset.go;H.disabled=tt<=1&&(we==="first"||we==="prev")||!!j&&tt>=j&&(we==="next"||we==="last")}}function rn(M){return pn(M==="first"?1:M==="prev"?tt-1:M==="next"?tt+1:oe()||tt+1)}function gn(M,j){j&&(He=!1,gt=null,tt=1,M.addEventListener("load",()=>{if(He=!0,gt!=null){let H=gt;gt=null,pn(H)}},{once:!0}),M.src=`${P}/edit/at?ref=${encodeURIComponent(j.hash)}&embedded`,Bt())}function Lt(M,j){let H=[...Ee.querySelectorAll(".tp-row")];if(!H.length)return;X(),Ge=vn(H,M,"tp-selected");let we=re[Ge];Ee.querySelector(".tp-caption").textContent=we?`${we.hash} \xB7 ${we.when} \xB7 ${we.subject}${mn(we)}`:"";let Ye=Ee.querySelector("iframe");clearTimeout(ht),j?gn(Ye,we):ht=setTimeout(()=>gn(Ye,we),60)}function mn(M){let j=[];Number.isFinite(M.slides)&&j.push(`${M.slides} slide${M.slides===1?"":"s"}`);let H=[M.add?`+${M.add}`:"",M.del?`\u2212${M.del}`:""].filter(Boolean);return H.length&&j.push(`${H.join(" ")} lines`),j.length?` \xB7 ${j.join(" \xB7 ")}`:""}async function Dt(){if(Ee)return Rt();if(!S)return d(`the progress bar moved to J \u2014 ${Dn("history",location)}`,3800);let M="history",j=[],H=null;try{let Ve=await(await fetch(P+"/edit/history")).json();if(!Ve.ok)return d(`${M}: ${Ve.error}`,3e3);j=Ve.entries||[],H=Ve.remote||null}catch{return d(`${M}: could not read the deck history`,3e3)}if(!j.length)return d(`${M}: git has no record of this deck yet`,3e3);E(),re=j,Yt=!1,Ee=document.createElement("div"),Ee.className="decklight-theme-picker decklight-finder decklight-restore decklight-history",Ee.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="hs-remote"></div><div class="tp-list" role="listbox" aria-label="Deck history"></div><div class="hs-confirm" hidden></div></div><div class="tp-preview"><iframe title="Version preview"></iframe><div class="hs-nav" role="group" aria-label="Preview navigation">'+["first","prev"].map(We=>Ct(We)).join("")+'<span class="hs-pos" aria-live="polite"></span>'+["next","last"].map(We=>Ct(We)).join("")+'</div><div class="tp-caption"></div></div></div>',Ee.querySelector(".tp-filter").textContent="History \u2014 \u2191\u2193 browse \xB7 \u2190\u2192 preview \xB7 \u23CE restore";let we=Ee.querySelector(".hs-remote");H?.line?we.textContent=H.line:we.remove();for(let We of Ee.querySelectorAll(".hs-btn"))We.addEventListener("click",()=>rn(We.dataset.go));let Ye=Ee.querySelector(".tp-list");re.forEach((We,Ve)=>{let xe=document.createElement("div");xe.className="tp-row",xe.setAttribute("role","option");let Oe=document.createElement("span");Oe.className="rs-subject",Oe.textContent=We.subject;let ot=document.createElement("span");ot.className="hs-meta";let Et=document.createElement("span");if(Et.className="rs-hash",Et.textContent=We.hash,ot.append(Et,Kt(We)),We.pushed===!1){let yt=document.createElement("span");yt.className="hs-push",yt.title="only on this machine",yt.textContent="\u2191",ot.append(yt)}let Tt=document.createElement("span");Tt.className="rs-when",Tt.title=We.when,Tt.textContent=ka(We.when),ot.append(Tt),xe.append(Oe,ot),xe.addEventListener("click",()=>{Lt(Ve,!0),N()}),Ye.appendChild(xe)}),Ut(Ee,Rt),t.appendChild(Ee),Lt(0,!0)}function Ct(M){return`<button type="button" class="hs-btn" data-go="${M}" title="${It[M]}" aria-label="${It[M]}">${Wt(nn[M])}</button>`}function Kt(M){let j=document.createElement("span");if(j.className="hs-stat",Number.isFinite(M.slides)){let H=document.createElement("span");H.className="hs-slides",H.title=`${M.slides} slide${M.slides===1?"":"s"} in this version`,H.textContent=String(M.slides),j.append(H)}if(M.add){let H=document.createElement("span");H.className="hs-add",H.title=`${M.add} line${M.add===1?"":"s"} added`,H.textContent=`+${M.add}`,j.append(H)}if(M.del){let H=document.createElement("span");H.className="hs-del",H.title=`${M.del} line${M.del===1?"":"s"} removed`,H.textContent=`\u2212${M.del}`,j.append(H)}return j}function Rt(){clearTimeout(ht),Ee?.remove(),Ee=null,Yt=!1,He=!1,gt=null}function N(){let M=re[Ge];if(!M)return;Yt=!0;let j=Ee.querySelector(".hs-confirm");j.hidden=!1,j.textContent="";let H=document.createElement("div");H.className="hs-q",H.append("restore ",Object.assign(document.createElement("span"),{className:"hs-q-hash",textContent:M.hash}),Object.assign(document.createElement("span"),{className:"hs-q-sub",textContent:` ${M.subject}`}),"?");let we=document.createElement("div");we.className="hs-why",we.textContent=`${Number.isFinite(M.slides)?`${M.slides} slides. `:""}Written as a NEW commit \u2014 nothing is rewritten, and where you are now stays in this list.`;let Ye=document.createElement("div");Ye.className="hs-buttons";let We=document.createElement("button");We.type="button",We.className="hs-yes",We.textContent="restore this version",We.addEventListener("click",pe);let Ve=document.createElement("button");Ve.type="button",Ve.className="hs-no",Ve.textContent="cancel",Ve.addEventListener("click",X),Ye.append(We,Ve);let xe=document.createElement("div");xe.className="hs-keys",xe.textContent="\u23CE confirms \xB7 Esc cancels",j.append(H,we,Ye,xe)}function X(){Yt=!1;let M=Ee?.querySelector(".hs-confirm");M&&(M.hidden=!0,M.textContent="")}async function pe(){let M=re[Ge];if(!(!M||!Yt)){Rt();try{let H=await(await fetch(P+"/edit/restore",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:M.hash})})).json();if(!H.ok)return d(`restore failed: ${H.error}`,3e3);if(!H.changed)return d(`already at ${M.hash}`,2e3);d(`restored ${M.hash} \u2014 Z takes it back`,2600)}catch{d("restore failed: the edit server did not answer",3e3)}}}g.register({isOpen:()=>!!B,close:Pe,keydown:M=>M.key==="Escape"&&(Pe(),!0)}),g.register({isOpen:()=>!!O,close:De,keydown:M=>M.key==="Escape"&&(De(),!0)}),g.register({isOpen:()=>!!Ee,close:Rt,keydown(M){switch(M.key){case"ArrowDown":Lt(Ge+1,!1);break;case"ArrowUp":Lt(Ge-1,!1);break;case"ArrowLeft":rn("prev");break;case"ArrowRight":rn("next");break;case"Home":rn("first");break;case"End":rn("last");break;case"Enter":Yt?pe():N();break;case"Escape":Yt?X():Rt();break;default:return!1}return!0}});let Me=null;function Le(){Me?.remove(),Me=null}async function qe(M){if(Me){Le();return}if(!S){d(Dn("configuring an engine",location),3200);return}let j,H;try{let Qe=await fetch(`${P}/edit/wizard?engine=${encodeURIComponent(M)}`),wt=await Qe.json().catch(()=>({}));if(!Qe.ok||!wt?.schema){d(wt.error||`no wizard for ${M}`,3200);return}if(typeof wt.from!="string"||!wt.from||typeof wt.provenance?.askedBy!="string"||typeof wt.provenance?.sentTo!="string"){d("the server did not say who is asking for these answers \u2014 not prompting",3200);return}j=wt.schema,H=wt.provenance}catch{d("the author server did not answer",2600);return}E?.(),Me=document.createElement("div"),Me.className="decklight-narr decklight-editor";let we=document.createElement("div");we.className="narr-card";let Ye=document.createElement("div");Ye.className="narr-head",Ye.textContent=`${j.title} \u2014 \u2318\u23CE saves \xB7 Esc closes`;let We=document.createElement("div");We.className="wiz-src";let Ve=document.createElement("div");Ve.textContent=H.askedBy;let xe=document.createElement("div");xe.textContent=H.sentTo,We.append(Ve,xe),we.append(Ye,We);let Oe=new Map;for(let Qe of j.fields){let wt=document.createElement("label");wt.className="tr-actions";let L=document.createElement("span");L.textContent=Qe.required?`${Qe.label} *`:Qe.label;let Pt;if(Qe.type==="choice"){Pt=document.createElement("select");for(let sn of Qe.options){let on=document.createElement("option");on.value=sn,on.textContent=sn,Pt.append(on)}Qe.default&&(Pt.value=Qe.default)}else Qe.type==="boolean"?(Pt=document.createElement("input"),Pt.type="checkbox",Pt.checked=Qe.default===!0):(Pt=document.createElement("input"),Pt.type=Qe.type==="secret"?"password":"text",Pt.autocomplete=Qe.type==="secret"?"off":"on",Pt.spellcheck=!1,Qe.default!==void 0&&(Pt.value=String(Qe.default)));Pt.className="narr-input",Oe.set(Qe.name,{field:Qe,input:Pt}),wt.append(L,Pt),we.append(wt)}let ot=document.createElement("div");ot.className="narr-head";let Et=document.createElement("button");Et.className="narr-prev-btn",Et.textContent="save";let Tt=document.createElement("div");Tt.className="tr-actions",Tt.append(Et),we.append(Tt,ot),Me.append(we),t.append(Me),Oe.values().next().value?.input.focus();async function yt(){let Qe={};for(let[wt,{field:L,input:Pt}]of Oe){let sn=L.type==="boolean"?Pt.checked:Pt.value;sn!==""&&sn!==void 0&&(Qe[wt]=sn)}Et.disabled=!0,ot.textContent="checking\u2026";try{let wt=await fetch(`${P}/edit/wizard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:j.engine,answers:Qe})}),L=await wt.json().catch(()=>({}));if(!wt.ok){ot.textContent=L.state==="unreachable"?`could not reach it \u2014 ${L.error??"try again"}`:L.state==="prerequisite"?`not ready on this machine \u2014 ${L.error??"something it needs is missing"}`:`not accepted \u2014 ${L.error??"check the answers"}`,Et.disabled=!1;return}p("wizard",`${j.engine} configured: ${JSON.stringify(L.stored)}`),Le(),d(`${j.title} configured`,2200)}catch(wt){ot.textContent=`could not reach the author server \u2014 ${String(wt.message||wt).slice(0,50)}`,Et.disabled=!1}}Et.addEventListener("click",yt),Me.addEventListener("keydown",Qe=>{Qe.key==="Enter"&&(Qe.metaKey||Qe.ctrlKey)&&(Qe.preventDefault(),yt())})}return g.register({isOpen:()=>!!Me,close:Le,keydown:M=>M.key==="Escape"&&(Le(),!0)}),{deckHistory:i,toggleEditor:Pe,toggleAgentAsk:De,toggleElementEdit:f,elementEditOn:()=>W,wizard:qe,wizards:()=>C.slice(),history:{open:()=>!S&&G?Q():Dt(),close:()=>{Rt(),ne()},list:()=>re.slice()},restore:{open:Dt,close:Rt,list:()=>re.slice()},available:()=>S,settled:()=>((c||a.has("embedded"))&&Ke(),mt),base:()=>P,commit:{open:bt,close:st,state:()=>ae}}}ge();be();var Xr=[{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"}],$a="decklight-onboarded",yo="decklight-tips-seen",Ca="decklight-tips-off";function wo(t){try{return localStorage.getItem(t)}catch{return null}}function Ms(t,o){try{localStorage.setItem(t,o)}catch{}}function Na({root:t,printMode:o,params:a,toast:c,debugLog:d,overlays:p,deck:g}){let m=a.has("embedded"),w=o||m,E=null;function S(){E&&(E.remove(),E=null,Ms($a,"1"),d?.("nav","welcome dismissed"))}function P(){E||o||(E=document.createElement("div"),E.className="decklight-welcome",E.innerHTML=`<div class="wel-card">
|
|
370
|
+
`),se.spellcheck=!1;let qe=async()=>{try{let ge=await fetch(P+"/edit/notes",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:M,text:se.value})});if(!ge.ok)throw new Error(await ge.text());p("edit",`notes saved \u2014 slide ${M}`),d("notes saved \u2014 reloading")}catch(ge){d(`save failed: ${String(ge.message||ge).slice(0,60)}`)}};se.addEventListener("keydown",ge=>{ge.key==="Enter"&&(ge.metaKey||ge.ctrlKey)?(qe(),ge.preventDefault()):ge.key==="Escape"&&(Le(),ge.preventDefault()),ge.stopPropagation()});let Qe=document.createElement("div");Qe.className="tr-actions";let Fe=document.createElement("button");Fe.type="button",Fe.className="narr-prev-btn",Fe.textContent="\u{1F4BE} save to file",Fe.addEventListener("click",qe),Qe.appendChild(Fe),H.append(K,se,Qe),B.appendChild(H),Ht(B,Le),t.appendChild(B),setTimeout(()=>se.focus(),0)}let $t=["fade","fade-up","fade-down","zoom","pop","draw","highlight"],W=!1,Ae=null,ee=[],We=0,w="main",Ie=null;function g(){if(!S){d(Fn("editing an element",location),3200);return}W=!W,z(),d(W?"element edit mode on \u2014 right-click a slide element":"element edit mode off",2200)}function J(M,H){let K=H;for(;K&&K!==M&&K.parentElement!==M;)K=K.parentElement;return K&&K!==M?K:null}t.addEventListener("contextmenu",M=>{if(!W)return;let H=M.target.closest("section"),K=H?m._sections.indexOf(H)+1:0;if(!H||!K)return;if(M.preventDefault(),H.hasAttribute("data-markdown-removed")){d("this slide has no per-element source mapping (data-markdown, removed in 0.3.0) \u2014 edit the file directly",3400);return}let se=J(H,M.target),qe=se?[...H.children].indexOf(se):null;k?.(),Pe(M.clientX,M.clientY,{sec:H,slide:K,index:qe})});function z(){Ae?.remove(),Ae=null,w="main"}function Ce(){let M=Ae.querySelector(".cm-list");M.textContent="";let H=[];if(w==="effects"){H.push({label:"\u2190 back",back:!0,run:()=>{w="main",Ce()}});for(let K of $t)H.push({label:K,run:()=>Xe(K)});H.push({label:"none (instant)",run:()=>Xe("none")}),H.push({label:"remove effect",run:()=>Xe(null)})}else Ie.index===null?H.push({label:"Edit speaker notes",run:()=>{z(),Le()}}):(H.push({label:"Edit speaker notes",run:()=>{z(),Le()}}),H.push({label:"Remove element",run:X}),H.push({label:"Edit content (HTML)",run:()=>{z(),ke(Ie)}}),H.push({label:"Add text effect \u25B8",run:()=>{w="effects",Ce()}}));ee=H,H.forEach((K,se)=>{let qe=document.createElement("div");qe.className="cm-row"+(K.back?" cm-back":""),qe.setAttribute("role","option"),qe.textContent=K.label,qe.addEventListener("mouseenter",()=>ye(se,!1)),qe.addEventListener("click",K.run),M.appendChild(qe)}),ye(0,!1)}function ye(M,H){let K=Ae.querySelectorAll(".cm-row");K.length&&(We=En(K,M,"cm-selected",{scroll:H}))}function Pe(M,H,K){Ie=K,w="main",Ae=document.createElement("div"),Ae.className="decklight-ctxmenu";let se=document.createElement("div");se.className="cm-card";let qe=document.createElement("div");qe.className="cm-list",qe.setAttribute("role","listbox"),qe.setAttribute("aria-label","Element edit menu"),se.appendChild(qe),Ae.appendChild(se),t.appendChild(Ae),Ce();let Qe=t.getBoundingClientRect(),Fe=Math.min(M-Qe.left,Qe.width-se.offsetWidth-4),ge=Math.min(H-Qe.top,Qe.height-se.offsetHeight-4);se.style.left=Math.max(4,Fe)+"px",se.style.top=Math.max(4,ge)+"px",Ht(Ae,z)}async function X(){let{slide:M,index:H}=Ie;z();try{let K=await fetch(P+"/edit/element/remove",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:M,index:H})}),se=await K.json().catch(()=>({}));if(!K.ok)throw new Error(se.error||K.status);d(se.changed?"element removed \u2014 reloading":"nothing to remove")}catch(K){d(`remove failed: ${String(K.message||K).slice(0,60)}`,2200)}}async function Xe(M){let{slide:H,index:K}=Ie;z();try{let se=await fetch(P+"/edit/element/effect",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:H,index:K,effect:M})}),qe=await se.json().catch(()=>({}));if(!se.ok)throw new Error(qe.error||se.status);d(M===null?"effect removed \u2014 reloading":`effect: ${M} \u2014 reloading`)}catch(se){d(`effect save failed: ${String(se.message||se).slice(0,60)}`,2200)}}let mt=null;function ft(){mt?.remove(),mt=null}function ke({slide:M,index:H}){mt=document.createElement("div"),mt.className="decklight-narr decklight-editor";let K=document.createElement("div");K.className="narr-card";let se=document.createElement("div");se.className="narr-head",se.textContent=`edit content \u2014 slide ${M}, element ${H} \xB7 \u2318\u23CE saves \xB7 Esc closes`;let qe=document.createElement("div");qe.className="edit-code";let Qe=document.createElement("pre");Qe.setAttribute("aria-hidden","true");let Fe=document.createElement("code");Fe.className="hljs language-xml",Qe.appendChild(Fe);let ge=document.createElement("textarea");ge.className="narr-input edit-notes",ge.value="loading\u2026",ge.disabled=!0,ge.spellcheck=!1,qe.append(Qe,ge);let Be=()=>{Fe.innerHTML=Vt.highlight(`${ge.value}
|
|
371
|
+
`,{language:"xml"}).value};ge.addEventListener("input",Be),ge.addEventListener("scroll",()=>{Qe.scrollTop=ge.scrollTop,Qe.scrollLeft=ge.scrollLeft});let st=async()=>{try{let pt=await fetch(P+"/edit/element/content",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:M,index:H,html:ge.value})});if(!pt.ok)throw new Error(await pt.text());d("element content saved \u2014 reloading")}catch(pt){d(`save failed: ${String(pt.message||pt).slice(0,60)}`)}};ge.addEventListener("keydown",pt=>{pt.key==="Enter"&&(pt.metaKey||pt.ctrlKey)?(st(),pt.preventDefault()):pt.key==="Escape"&&(ft(),pt.preventDefault()),pt.stopPropagation()});let wt=document.createElement("div");wt.className="tr-actions";let Mt=document.createElement("button");Mt.type="button",Mt.className="narr-prev-btn",Mt.textContent="\u{1F4BE} save to file",Mt.addEventListener("click",st),wt.appendChild(Mt),K.append(se,qe,wt),mt.appendChild(K),Ht(mt,ft),t.appendChild(mt),(async()=>{try{let pt=await fetch(`${P}/edit/element/source?slide=${M}&index=${H}`),nt=await pt.json().catch(()=>({}));if(!pt.ok||!nt.ok)throw new Error(nt.error||pt.status);ge.value=Ra(nt.html),ge.disabled=!1,Be(),ge.focus()}catch(pt){ge.value="",d(`could not read the element's source: ${String(pt.message||pt).slice(0,60)}`,2600)}})()}f.register({isOpen:()=>!!Ae,close:z,keydown(M){switch(M.key){case"ArrowDown":ye(We+1,!0);break;case"ArrowUp":ye(We-1,!0);break;case"Enter":ee[We]?.run();break;case"Escape":z();break;default:return!1}return!0}}),f.register({isOpen:()=>!!mt,close:ft,keydown:M=>M.key==="Escape"&&(ft(),!0)});let ue=null,ie=[],Ke=0,rt=null,Je=1,tt=!1,Rt=null,jt=!1,en={first:'<path d="M17 6l-6 6 6 6"/><path d="M7 6v12"/>',prev:'<path d="M15 6l-6 6 6 6"/>',next:'<path d="M9 6l6 6-6 6"/>',last:'<path d="M7 6l6 6-6 6"/><path d="M17 6v12"/>'},Pt={first:"first slide (Home)",prev:"previous slide (\u2190)",next:"next slide (\u2192)",last:"last slide (End)"},sn=M=>`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${M}</svg>`,Gt=()=>Number(ie[Ke]?.slides)||0;function At(M){let H=Gt();Je=Math.max(1,H?Math.min(M,H):M);let K=ue?.querySelector("iframe");tt?K?.contentWindow?.postMessage({__decklightPreview:{goto:[Je,0]}},"*"):Rt=Je,on()}function on(){let M=ue?.querySelector(".hs-nav");if(!M)return;let H=Gt();M.querySelector(".hs-pos").textContent=H?`${Je} / ${H}`:`${Je}`;for(let K of M.querySelectorAll(".hs-btn")){let se=K.dataset.go;K.disabled=Je<=1&&(se==="first"||se==="prev")||!!H&&Je>=H&&(se==="next"||se==="last")}}function un(M){return At(M==="first"?1:M==="prev"?Je-1:M==="next"?Je+1:Gt()||Je+1)}function qt(M,H){H&&(tt=!1,Rt=null,Je=1,M.addEventListener("load",()=>{if(tt=!0,Rt!=null){let K=Rt;Rt=null,At(K)}},{once:!0}),M.src=`${P}/edit/at?ref=${encodeURIComponent(H.hash)}&embedded`,on())}function pn(M,H){let K=[...ue.querySelectorAll(".tp-row")];if(!K.length)return;ne(),Ke=En(K,M,"tp-selected");let se=ie[Ke];ue.querySelector(".tp-caption").textContent=se?`${se.hash} \xB7 ${se.when} \xB7 ${se.subject}${te(se)}`:"";let qe=ue.querySelector("iframe");clearTimeout(rt),H?qt(qe,se):rt=setTimeout(()=>qt(qe,se),60)}function te(M){let H=[];Number.isFinite(M.slides)&&H.push(`${M.slides} slide${M.slides===1?"":"s"}`);let K=[M.add?`+${M.add}`:"",M.del?`\u2212${M.del}`:""].filter(Boolean);return K.length&&H.push(`${K.join(" ")} lines`),H.length?` \xB7 ${H.join(" \xB7 ")}`:""}async function Kt(){if(ue)return Yt();if(!S)return d(`the progress bar moved to J \u2014 ${Fn("history",location)}`,3800);let M="history",H=[],K=null;try{let Fe=await(await fetch(P+"/edit/history")).json();if(!Fe.ok)return d(`${M}: ${Fe.error}`,3e3);H=Fe.entries||[],K=Fe.remote||null}catch{return d(`${M}: could not read the deck history`,3e3)}if(!H.length)return d(`${M}: git has no record of this deck yet`,3e3);k(),ie=H,jt=!1,ue=document.createElement("div"),ue.className="decklight-theme-picker decklight-finder decklight-restore decklight-history",ue.innerHTML='<div class="tp-panel"><div class="tp-side"><div class="tp-filter"></div><div class="hs-remote"></div><div class="tp-list" role="listbox" aria-label="Deck history"></div><div class="hs-confirm" hidden></div></div><div class="tp-preview"><iframe title="Version preview"></iframe><div class="hs-nav" role="group" aria-label="Preview navigation">'+["first","prev"].map(Qe=>_t(Qe)).join("")+'<span class="hs-pos" aria-live="polite"></span>'+["next","last"].map(Qe=>_t(Qe)).join("")+'</div><div class="tp-caption"></div></div></div>',ue.querySelector(".tp-filter").textContent="History \u2014 \u2191\u2193 browse \xB7 \u2190\u2192 preview \xB7 \u23CE restore";let se=ue.querySelector(".hs-remote");K?.line?se.textContent=K.line:se.remove();for(let Qe of ue.querySelectorAll(".hs-btn"))Qe.addEventListener("click",()=>un(Qe.dataset.go));let qe=ue.querySelector(".tp-list");ie.forEach((Qe,Fe)=>{let ge=document.createElement("div");ge.className="tp-row",ge.setAttribute("role","option");let Be=document.createElement("span");Be.className="rs-subject",Be.textContent=Qe.subject;let st=document.createElement("span");st.className="hs-meta";let wt=document.createElement("span");if(wt.className="rs-hash",wt.textContent=Qe.hash,st.append(wt,tn(Qe)),Qe.pushed===!1){let pt=document.createElement("span");pt.className="hs-push",pt.title="only on this machine",pt.textContent="\u2191",st.append(pt)}let Mt=document.createElement("span");Mt.className="rs-when",Mt.title=Qe.when,Mt.textContent=Na(Qe.when),st.append(Mt),ge.append(Be,st),ge.addEventListener("click",()=>{pn(Fe,!0),C()}),qe.appendChild(ge)}),Ht(ue,Yt),t.appendChild(ue),pn(0,!0)}function _t(M){return`<button type="button" class="hs-btn" data-go="${M}" title="${Pt[M]}" aria-label="${Pt[M]}">${sn(en[M])}</button>`}function tn(M){let H=document.createElement("span");if(H.className="hs-stat",Number.isFinite(M.slides)){let K=document.createElement("span");K.className="hs-slides",K.title=`${M.slides} slide${M.slides===1?"":"s"} in this version`,K.textContent=String(M.slides),H.append(K)}if(M.add){let K=document.createElement("span");K.className="hs-add",K.title=`${M.add} line${M.add===1?"":"s"} added`,K.textContent=`+${M.add}`,H.append(K)}if(M.del){let K=document.createElement("span");K.className="hs-del",K.title=`${M.del} line${M.del===1?"":"s"} removed`,K.textContent=`\u2212${M.del}`,H.append(K)}return H}function Yt(){clearTimeout(rt),ue?.remove(),ue=null,jt=!1,tt=!1,Rt=null}function C(){let M=ie[Ke];if(!M)return;jt=!0;let H=ue.querySelector(".hs-confirm");H.hidden=!1,H.textContent="";let K=document.createElement("div");K.className="hs-q",K.append("restore ",Object.assign(document.createElement("span"),{className:"hs-q-hash",textContent:M.hash}),Object.assign(document.createElement("span"),{className:"hs-q-sub",textContent:` ${M.subject}`}),"?");let se=document.createElement("div");se.className="hs-why",se.textContent=`${Number.isFinite(M.slides)?`${M.slides} slides. `:""}Written as a NEW commit \u2014 nothing is rewritten, and where you are now stays in this list.`;let qe=document.createElement("div");qe.className="hs-buttons";let Qe=document.createElement("button");Qe.type="button",Qe.className="hs-yes",Qe.textContent="restore this version",Qe.addEventListener("click",Ee);let Fe=document.createElement("button");Fe.type="button",Fe.className="hs-no",Fe.textContent="cancel",Fe.addEventListener("click",ne),qe.append(Qe,Fe);let ge=document.createElement("div");ge.className="hs-keys",ge.textContent="\u23CE confirms \xB7 Esc cancels",H.append(K,se,qe,ge)}function ne(){jt=!1;let M=ue?.querySelector(".hs-confirm");M&&(M.hidden=!0,M.textContent="")}async function Ee(){let M=ie[Ke];if(!(!M||!jt)){Yt();try{let K=await(await fetch(P+"/edit/restore",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ref:M.hash})})).json();if(!K.ok)return d(`restore failed: ${K.error}`,3e3);if(!K.changed)return d(`already at ${M.hash}`,2e3);d(`restored ${M.hash} \u2014 Z takes it back`,2600)}catch{d("restore failed: the edit server did not answer",3e3)}}}f.register({isOpen:()=>!!B,close:Le,keydown:M=>M.key==="Escape"&&(Le(),!0)}),f.register({isOpen:()=>!!O,close:Ue,keydown:M=>M.key==="Escape"&&(Ue(),!0)}),f.register({isOpen:()=>!!ue,close:Yt,keydown(M){switch(M.key){case"ArrowDown":pn(Ke+1,!1);break;case"ArrowUp":pn(Ke-1,!1);break;case"ArrowLeft":un("prev");break;case"ArrowRight":un("next");break;case"Home":un("first");break;case"End":un("last");break;case"Enter":jt?Ee():C();break;case"Escape":jt?ne():Yt();break;default:return!1}return!0}});let we=null;function Ne(){we?.remove(),we=null}async function Ge(M){if(we){Ne();return}if(!S){d(Fn("configuring an engine",location),3200);return}let H,K;try{let nt=await fetch(`${P}/edit/wizard?engine=${encodeURIComponent(M)}`),vt=await nt.json().catch(()=>({}));if(!nt.ok||!vt?.schema){d(vt.error||`no wizard for ${M}`,3200);return}if(typeof vt.from!="string"||!vt.from||typeof vt.provenance?.askedBy!="string"||typeof vt.provenance?.sentTo!="string"){d("the server did not say who is asking for these answers \u2014 not prompting",3200);return}H=vt.schema,K=vt.provenance}catch{d("the author server did not answer",2600);return}k?.(),we=document.createElement("div"),we.className="decklight-narr decklight-editor";let se=document.createElement("div");se.className="narr-card";let qe=document.createElement("div");qe.className="narr-head",qe.textContent=`${H.title} \u2014 \u2318\u23CE saves \xB7 Esc closes`;let Qe=document.createElement("div");Qe.className="wiz-src";let Fe=document.createElement("div");Fe.textContent=K.askedBy;let ge=document.createElement("div");ge.textContent=K.sentTo,Qe.append(Fe,ge),se.append(qe,Qe);let Be=new Map;for(let nt of H.fields){let vt=document.createElement("label");vt.className="tr-actions";let L=document.createElement("span");L.textContent=nt.required?`${nt.label} *`:nt.label;let Bt;if(nt.type==="choice"){Bt=document.createElement("select");for(let ln of nt.options){let cn=document.createElement("option");cn.value=ln,cn.textContent=ln,Bt.append(cn)}nt.default&&(Bt.value=nt.default)}else nt.type==="boolean"?(Bt=document.createElement("input"),Bt.type="checkbox",Bt.checked=nt.default===!0):(Bt=document.createElement("input"),Bt.type=nt.type==="secret"?"password":"text",Bt.autocomplete=nt.type==="secret"?"off":"on",Bt.spellcheck=!1,nt.default!==void 0&&(Bt.value=String(nt.default)));Bt.className="narr-input",Be.set(nt.name,{field:nt,input:Bt}),vt.append(L,Bt),se.append(vt)}let st=document.createElement("div");st.className="narr-head";let wt=document.createElement("button");wt.className="narr-prev-btn",wt.textContent="save";let Mt=document.createElement("div");Mt.className="tr-actions",Mt.append(wt),se.append(Mt,st),we.append(se),t.append(we),Be.values().next().value?.input.focus();async function pt(){let nt={};for(let[vt,{field:L,input:Bt}]of Be){let ln=L.type==="boolean"?Bt.checked:Bt.value;ln!==""&&ln!==void 0&&(nt[vt]=ln)}wt.disabled=!0,st.textContent="checking\u2026";try{let vt=await fetch(`${P}/edit/wizard`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:H.engine,answers:nt})}),L=await vt.json().catch(()=>({}));if(!vt.ok){st.textContent=L.state==="unreachable"?`could not reach it \u2014 ${L.error??"try again"}`:L.state==="prerequisite"?`not ready on this machine \u2014 ${L.error??"something it needs is missing"}`:`not accepted \u2014 ${L.error??"check the answers"}`,wt.disabled=!1;return}p("wizard",`${H.engine} configured: ${JSON.stringify(L.stored)}`),Ne(),d(`${H.title} configured`,2200)}catch(vt){st.textContent=`could not reach the author server \u2014 ${String(vt.message||vt).slice(0,50)}`,wt.disabled=!1}}wt.addEventListener("click",pt),we.addEventListener("keydown",nt=>{nt.key==="Enter"&&(nt.metaKey||nt.ctrlKey)&&(nt.preventDefault(),pt())})}return f.register({isOpen:()=>!!we,close:Ne,keydown:M=>M.key==="Escape"&&(Ne(),!0)}),{deckHistory:i,toggleEditor:Le,toggleAgentAsk:Ue,toggleElementEdit:g,elementEditOn:()=>W,wizard:Ge,wizards:()=>N.slice(),history:{open:()=>!S&&Q?Y():Kt(),close:()=>{Yt(),oe()},list:()=>ie.slice()},restore:{open:Kt,close:Yt,list:()=>ie.slice()},available:()=>S,settled:()=>((c||a.has("embedded"))&&je(),gt),base:()=>P,commit:{open:bt,close:Ze,state:()=>ce}}}me();fe();var Xr=[{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"}],Pa="decklight-onboarded",wo="decklight-tips-seen",Ba="decklight-tips-off",vo=t=>kn(t),Rs=(t,o)=>{fn(t,o)};function Da({root:t,printMode:o,params:a,toast:c,debugLog:d,overlays:p,deck:f}){let m=a.has("embedded"),v=o||m,k=null;function S(){k&&(k.remove(),k=null,Rs(Pa,"1"),d?.("nav","welcome dismissed"))}function P(){k||o||(k=document.createElement("div"),k.className="decklight-welcome",k.innerHTML=`<div class="wel-card">
|
|
321
372
|
<h3>Welcome to Decklight</h3>
|
|
322
373
|
<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>
|
|
323
374
|
<table>
|
|
@@ -331,10 +382,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ue=G,fe=J),ne===void 0
|
|
|
331
382
|
<span>Press any key to dismiss \u2014 reopen anytime from the <code>/</code> palette.</span>
|
|
332
383
|
<button type="button" class="wel-go">Got it</button>
|
|
333
384
|
</div>
|
|
334
|
-
</div>`,
|
|
335
|
-
${ut.text||"(nothing)"}`:`cannot show what it said \u2014 ${ut.why}`))}I===f.id&&Ne.append(ue("div","rv-arm","resolve this comment? \u23CE again to confirm \xB7 Esc to back out")),de===f.id&&Ne.append(ue("div","rv-arm",`move this comment to slide ${c.state.slide} (the one on screen)? A again to confirm \xB7 Esc backs out`));let pt={id:f.id,slide:ce.slide,node:Ne,resolved:!!f.resolved,branch:F,done:Ce};return Ne.addEventListener("click",()=>{i(_.indexOf(pt)),O()}),_.push(pt),Ne}function s(f){let Y=_[C]?.id??null,F=$.querySelector(".narr-card");F.replaceChildren();let Ce=J(),ce=c.state.slide;_=[],$e=f.incoming?.reviews??[];let Ne=ue("div","narr-head");Ne.append(ue("span","rv-heading","comments"));let ee=ue("div","rv-dock-ctl");for(let re of["float","left","right","bottom"]){let Ge=ue("button","rv-dock-btn"+(Ae.mode===re?" rv-dock-on":""),bt[re]);Ge.dataset.mode=re,Ge.title=re==="float"?"float (movable)":`dock ${re}`,Ge.setAttribute("aria-label",re==="float"?"float":`dock ${re}`),Ge.addEventListener("click",()=>dt(re)),ee.append(Ge)}let nt=ue("button","rv-dock-btn rv-close","\xD7");if(nt.title="close (M)",nt.setAttribute("aria-label","close"),nt.addEventListener("click",ze),ee.append(nt),Ne.append(ee),Ne.style.cursor=Ae.mode==="float"?"move":"",Ne.addEventListener("pointerdown",re=>G(re,Ne)),F.append(Ne),f.incoming){let re=f.incoming;if(re.reviews?.length){let Ge=ue("div","rv-incoming"),ht=[...re.reviews].sort((tt,He)=>Number(tt.done)-Number(He.done));for(let tt of ht){let He=new Set(tt.doneIds??[]),gt=Pr(tt.records??[]).filter(It=>!It.resolved),Yt=gt.filter(It=>!He.has(It.id)).length;Ge.append(ue("div",`rv-src${tt.done?" rv-done":""}`,tt.done?`\u2713 ${tt.who} \u2014 all ${gt.length} done \xB7 ${tt.branch}`:`\u2193 ${tt.who} \u2014 ${Yt} of ${gt.length} left \xB7 ${tt.branch}`));let nn=[...gt].sort((It,Wt)=>Number(He.has(It.id))-Number(He.has(Wt.id)));for(let It of nn)Ge.append(Q(It,Ce,{branch:tt.branch,done:He.has(It.id)}))}F.append(Ge)}else re.state&&!["ok","none","no-repo","untracked","no-remote","suppressed"].includes(re.state)&&F.append(ue("div","rv-inc-how",`incoming reviews: not checked \u2014 ${re.state}`))}let pt=ue("div","rv-list");pt.setAttribute("role","listbox");let ut=Pr(f.records);if(f.error?pt.append(ue("div","rv-none",`could not read the comments \u2014 ${f.error}`)):ut.length||pt.append(ue("div","rv-none",f.can==="none"?"no comments, and nothing here can take one \u2014 a reviewer leaves them with: decklight review <deck>":"no comments yet")),f.skipped&&pt.append(ue("div","rv-skipped",`${f.skipped} line(s) could not be read and were skipped`)),f.incoming?.reviews?.length&&ut.length){let re=ut.filter(Ge=>!Ge.resolved).length;pt.append(ue("div","rv-src",re?`\u270E your comments \u2014 ${re} of ${ut.length} left`:`\u2713 your comments \u2014 all ${ut.length} done`))}let ke=[...ut].sort((re,Ge)=>+!!re.resolved-+!!Ge.resolved);for(let re of ke)pt.append(Q(re,Ce));if(F.append(pt),f.can==="comment"){let re=ue("div",`rv-submit${Se?" rv-arm":""}`,Se?"push this review to the author? S again to confirm \xB7 Esc backs out":"S sends this review to the author (a review/\u2026 branch on the remote)");re.setAttribute("role","button"),re.tabIndex=0,re.addEventListener("click",()=>W()),F.append(re)}F.append(ue("div","rec-hint",f.can==="resolve"?$e.length?"\u23CE jumps \xB7 R marks one done (again reopens a reviewer's) \xB7 A moves here \xB7 Esc closes":"\u23CE jumps (on a gone slide: shows what it said) \xB7 R marks one done \xB7 A moves here \xB7 Esc closes":f.can==="comment"?"\u23CE jumps to the slide \xB7 S submits the review \xB7 Esc closes":"\u23CE jumps to the slide \xB7 Esc closes"));let Ee=Y===null?-1:_.findIndex(re=>re.id===Y);i(Ee>=0?Ee:Math.min(C,Math.max(0,_.length-1))),mt()}function i(f){_.length&&(C=vn(_.map(Y=>Y.node),f,"rv-sel"))}function O(){let f=_[C];if(f){if(!f.slide){De(f);return}c.goto(f.slide,0,{force:!0})}}async function De(f){if(te?.id===f.id){te=null,s(await fe());return}let Y=S();if(Y==null){d("only the author server can look that far back");return}try{let F=await fetch(`${Y}/edit/review/at?id=${encodeURIComponent(f.id)}`),Ce=await F.json();if(!Ce?.ok)throw new Error(Ce?.error||`HTTP ${F.status}`);te={id:f.id,data:Ce}}catch(F){te={id:f.id,data:{known:!1,why:String(F.message||F)}}}s(await fe())}async function B(){let f=_[C];if(!f||f.resolved)return;let Y=S();if(Y==null)return;if(de!==f.id){de=f.id,I=null,s(await fe());return}if(de=null,f.branch){d("this comment is on a review branch \u2014 only your own comments can be moved");return}let F=c.state.slide,Ce=J()[F-1];try{if(!(await(await fetch(`${Y}/edit/review`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({op:"anchor",re:f.id,slide:F,title:Ce?.title,fp:Ce?.fp})})).json())?.ok)throw new Error("refused");d(`moved to slide ${F}`),te=null}catch(ce){d(`could not move that \u2014 ${String(ce.message||ce)}`)}s(await fe())}async function Pe(f,Y,F){let Ce=String(f??"").trim();if(!Ce)return;let ce=await ne(),Ne=ce!==null?{url:`${ce}/review/comments`,mine:!1}:S()!=null?{url:`${S()}/edit/review`,mine:!0}:null;if(Ne)try{let ee=await fetch(Ne.url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:Y,title:F?.title,fp:F?.fp,body:Ce})}),nt=await ee.json();if(!nt?.ok)throw new Error(nt?.error||`HTTP ${ee.status}`);d(`comment left on slide ${Y}`),p("review",`comment ${nt.id} on slide ${Y}`),$&&s(await fe())}catch(ee){d(`could not leave that comment \u2014 ${String(ee.message||ee)}`)}}async function _t(){let f=_[C];if(!f)return;let Y=S();if(Y!=null){if(f.branch){try{let Ce=await(await fetch(`${Y}/edit/review/done`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({branch:f.branch,id:f.id,done:!f.done})})).json();if(!Ce?.ok)throw new Error(Ce?.error||"refused");d(Ce.done?"done":"reopened"),p("review",`${f.branch} ${f.id} ${Ce.done?"done":"reopened"}`)}catch(F){d(`could not mark that \u2014 ${String(F.message||F)}`)}s(await fe());return}if(!f.resolved){if(I!==f.id){I=f.id,s(await fe());return}I=null;try{if(!(await(await fetch(`${Y}/edit/review`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({op:"resolve",re:f.id})})).json())?.ok)throw new Error("refused");d("resolved")}catch(F){d(`could not resolve that \u2014 ${String(F.message||F)}`)}s(await fe())}}}async function W(){let f=await ne();if(f===null){d("nothing here can submit \u2014 run: decklight review <deck>");return}if(!Se){Se=!0,s(await fe());return}Se=!1;try{let Y=await fetch(`${f}/review/submit`,{method:"POST"}),F=await Y.json();if(!F?.ok)throw new Error(F?.error||`HTTP ${Y.status}`);d(`review pushed \u2192 ${F.branch}`),p("review",`submitted ${F.comments} comment(s) to ${F.branch}`)}catch(Y){d(`could not submit \u2014 ${String(Y.message||Y)}`)}s(await fe())}let ye=null;function ie(){ye?.remove(),ye=null}async function Ze(){if(ye)return ie();let f=await ne(),Y=S();if(f===null&&Y==null){d("nothing here can take a comment \u2014 decklight author, or decklight review");return}g(),ze();let F=c.state.slide;ye=document.createElement("div"),ye.className="decklight-narr decklight-compose",ye.innerHTML='<div class="narr-card" role="dialog" aria-label="Leave a comment"></div>',Ut(ye,ie),t.appendChild(ye);let Ce=ye.querySelector(".narr-card"),ce=J();Ce.append(ue("div","narr-head","leave a comment")),Ce.append(ue("div","rv-on",`on slide ${F}${ce[F-1]?.title?` \xB7 ${ce[F-1].title}`:""}`));let Ne=ue("textarea","narr-input rv-input");Ne.placeholder="what you want remembered about this slide\u2026",Ne.rows=3;let ee=ue("div","narr-row narr-sel rv-send","Leave this comment");ee.setAttribute("role","button"),ee.tabIndex=0;let nt=async()=>{if(!Ne.value.trim()){Ne.focus();return}await Pe(Ne.value,F,ce[F-1]),ie()};ee.addEventListener("click",nt),Ne.addEventListener("keydown",re=>{re.key==="Enter"&&(re.metaKey||re.ctrlKey)&&(re.preventDefault(),nt()),re.stopPropagation()}),Ce.append(Ne,ee),Ce.append(ue("div","rec-hint","\u2318\u23CE leaves it \xB7 Esc closes \xB7 M reads them all")),setTimeout(()=>Ne.focus(),0);let pt=await fe();if(!ye)return;let ut=Pr(pt.records??[]).filter(re=>!re.resolved&&Jr(re,ce).slide===F),ke=(pt.incoming?.reviews??[]).flatMap(re=>Pr(re.records??[]).filter(Ge=>!Ge.resolved&&Jr(Ge,ce).slide===F).map(Ge=>({c:Ge,who:re.who})));if(!ut.length&&!ke.length)return;let Ee=ue("div","rv-already");Ee.append(ue("div","rv-src",`already on this slide \u2014 ${ut.length+ke.length}`));for(let re of ut)Ee.append(ue("div","rv-said",`${Ie(re)}: ${re.body}`));for(let{c:re,who:Ge}of ke)Ee.append(ue("div","rv-said",`${Ge}: ${re.body}`));Ce.append(Ee)}async function v(){if($)return ze();g(),I=null,Se=!1,de=null,te=null,C=0,$=document.createElement("div"),$.className="decklight-narr decklight-review",$.dataset.dock=Ae.mode,$.innerHTML='<div class="narr-card" role="dialog" aria-label="Review comments"></div>',t.appendChild($),Re=Ae.mode==="float",je=f=>{Re=!!$&&$.contains(f.target)},document.addEventListener("pointerdown",je,!0),document.addEventListener("focusin",je,!0),Fe=()=>Ke(),window.addEventListener("resize",Fe),Ke(),s({records:[],skipped:0,can:"none"}),await P(),$&&s(await fe())}function ze(){$?.remove(),$=null,I=null,Se=!1,de=null,te=null,Re=!1,t.style.removeProperty("--dock-left"),t.style.removeProperty("--dock-right"),t.style.removeProperty("--dock-bottom"),c._reflow?.(),Fe&&(window.removeEventListener("resize",Fe),Fe=null),je&&(document.removeEventListener("pointerdown",je,!0),document.removeEventListener("focusin",je,!0),je=null)}return a.register({isOpen:()=>!!ye,close:ie,keydown(f){return f.key==="Escape"?(ie(),!0):!1}}),a.register({isOpen:()=>!!$,close:ze,modal:()=>Re,keydown(f){let Y=/^(input|textarea)$/i.test(f.target?.tagName??"");if(f.key!=="Escape"&&!(f.key==="m"||f.key==="M")&&!Re)return!1;if(f.key==="Escape")return I||Se||de?(I=null,Se=!1,de=null,fe().then(F=>$&&s(F)),!0):(ze(),!0);if(Y)return!1;switch(f.key){case"ArrowDown":i(C+1);break;case"ArrowUp":i(C-1);break;case"Enter":I&&_[C]?.id===I?_t():O();break;case"r":case"R":_t();break;case"s":case"S":W();break;case"a":case"A":B();break;case"m":case"M":ze();break;default:return!1}return!0}}),o?.has?.("review")&&setTimeout(()=>{a.active()||v()},700),{open:v,close:ze,isOpen:()=>!!$,compose:Ze,submit:async()=>{$||await v(),Se=!0,$&&s(await fe())}}}ge();be();function Ba({now:t=Date.now,keep:o=200}={}){let a=t(),c=[],d=null;function p(g,m){let w={t:((t()-a)/1e3).toFixed(3),kind:g,msg:m};return c.push(w),c.length>o&&c.shift(),d?.(w),w}return{log:p,get entries(){return c.slice()},onEntry(g){d=g}}}ge();be();var Md=["auto","centered","pinned","top","split","split-flip"];function Od({autoPins:t,hasSplitPair:o}){return Md.filter(a=>(a!=="pinned"||!t)&&(a!=="split-flip"||o))}function Ld(t,o,a){if(!t.length)return null;let c=Math.max(0,t.indexOf(o));return t[(c+a+t.length)%t.length]}function Da({slideOf:t,sectionAt:o,describe:a,available:c,unavailableMessage:d,apply:p,relayout:g,post:m,toast:w,debugLog:E,schedule:S=setTimeout,cancel:P=clearTimeout,delay:$=600}){let _=null,C=null;function I(){P(C);let $e=_;_=null,$e&&m({slide:$e.slide,layout:$e.name}).then(()=>E("layout",`slide ${$e.slide}: ${$e.name} \u2192 saved to file`)).catch(()=>w("layout save failed \u2014 is the dev server still up?",2200))}function Se($e=t()){let te=o($e);return te?Od(a(te)):[]}function de($e){if(!c()){w(d(),3200);return}let te=t(),ae=o(te);if(!ae)return;let Re=Ld(Se(te),ae.getAttribute("data-layout")||"auto",$e);if(!Re)return;p(ae,Re),_&&_.slide!==te&&I(),_={slide:te,name:Re},P(C),C=S(I,$);let Fe=g(ae,te);w(Fe?`layout: ${Re} \u2014 fights this slide's own column flexbox; pick one`:`layout: ${Re}`),E("layout",`slide ${te}: ${Re}`)}return{ring:Se,cycle:de,flush:I}}ge();be();function qa({commands:t,query:o="",totalSlides:a=0,makeGotoRow:c,makeSearchRow:d}){let p=String(o).toLowerCase(),g=t.filter(w=>!p||(w.label+" "+(w.alias??"")).toLowerCase().includes(p)),m=String(o).trim().match(/^(?:goto\s*)?(\d+)$/i);if(m&&c){let w=Math.max(1,Math.min(parseInt(m[1],10),a));g.unshift(c(w,a))}return p&&!m&&d&&!g.some(w=>w.label.toLowerCase().startsWith(p))&&g.push(d(o)),g}var Rd={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},Ls=99,Id=18,Fa=6,Pd="ul, ol, svg, pre, table, .terminal, img, .columns",Br=null;function Qr(t,o){zo(t,o),Br&&Br._rescanFor(t)}function Bd(t){let o=getComputedStyle(t).position;return o==="absolute"||o==="fixed"}function Dd(t){for(let o of t.children)if(!o.matches("aside, script, style, .decklight-hero-logo, .slide-bg")){if(o.matches("h1, h2"))return o;if(!Bd(o))return null}return null}function qd(t,o){if(!o||t.getAttribute("data-subtitle")==="none")return null;let a=o.nextElementSibling;return a&&a.matches("p")&&!a.hasAttribute("data-build")?(a.classList.add("subtitle"),a):t.querySelector(":scope > p.subtitle")}function Ua(t){return t.pinTitles===!0?Ls:typeof t.pinTitles=="number"&&isFinite(t.pinTitles)?t.pinTitles:null}function Ha(t,o){let a=Ua(o),c=t.getAttribute("data-pin");if(c==="none")return null;if(c!==null&&c!==""){let p=parseFloat(c);return isFinite(p)?p:a??Ls}return c===""?a??Ls:a===null?null:[...t.querySelectorAll(Pd)].some(p=>!p.closest("aside")&&!p.closest(".decklight-hero-logo"))?a:null}function Os(t,o){t.forEach(a=>{let c=Dd(a),d=a.getAttribute("data-layout"),p;if(d==="pinned"){let E=parseFloat(a.getAttribute("data-pin"));p=isFinite(E)?E:Ua(o)??Ls}else d==="centered"||d==="top"?p=null:p=Ha(a,o);let g=qd(a,c);if(a.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),a.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),p===null||!c){a.removeAttribute("data-pinned"),a.style.removeProperty("--pin-y"),a.style.removeProperty("--pin-sub-y"),a.style.removeProperty("--pin-space");return}c.classList.add("pin-title"),a.setAttribute("data-pinned",""),a.style.setProperty("--pin-y",p+"px"),a.classList.add("pin-measure");let m=c.offsetHeight||0,w=p+m;g&&(g.classList.add("pin-subtitle"),a.style.setProperty("--pin-sub-y",Math.round(w+Fa)+"px"),w+=Fa+(g.offsetHeight||0)),a.classList.remove("pin-measure"),a.style.setProperty("--pin-space",Math.round(w+Id)+"px")})}function ja(t){return[...t.children].filter(o=>!o.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo, .slide-bg"))}function za(t){t.forEach((o,a)=>{if(o.querySelectorAll(":scope > .split-columns, :scope > .split-footer").forEach(d=>d.classList.remove("split-columns","split-footer")),!/^split/.test(o.getAttribute("data-layout")||"")){o.removeAttribute("data-split-conflict");return}let c=ja(o);if(Fd(o,c,a+1),c.length===1&&c[0].matches("ul, ol")){c[0].classList.add("split-columns");return}for(let d of c.slice(2))d.classList.add("split-footer")})}function Fd(t,o,a){let c=o.some(p=>{let g=getComputedStyle(p);return/flex$/.test(g.display)&&g.flexDirection.startsWith("row")}),d=t.hasAttribute("data-split-conflict");t.toggleAttribute("data-split-conflict",c),c&&!d&&console.warn(`Decklight: slide ${a} 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 So(t,o){if(!t)return;let a=[t,...t.querySelectorAll("pre, table, svg, ul, ol, blockquote")].some(d=>d.scrollHeight>d.clientHeight+2&&getComputedStyle(d).overflowY!=="visible"&&!d.closest(".terminal")&&!d.hasAttribute("data-scroll-ok")),c=t.hasAttribute("data-overflow");t.toggleAttribute("data-overflow",a),a&&!c&&console.warn(`Decklight: slide ${o} content overflows and is clipped \u2014 reduce content or font size`)}function zd(t){t.querySelectorAll("section[data-markdown]").forEach((o,a)=>{o.setAttribute("data-markdown-removed","");let c=[...t.children].indexOf(o)+1||a+1;console.warn(`Decklight: slide ${c} 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 Ga(t={}){let o=new URLSearchParams(location.search),a={...Rd,...t};o.has("embedded")&&(a.controls=!1);let c=o.has("print"),d=o.get("print")||"",p=Ba(),g=null,m=(k,z)=>p.log(k,z),w=document.querySelector(".decklight");if(!w)throw new Error("Decklight: no .decklight element found");let E=na(),S=Oa({config:a,root:w,embedded:o.has("embedded"),sectionsOf:()=>oe._sections,slideOf:()=>oe.state.slide,navigate:k=>{location.href=k}}),P=S.playlist,$=S.index,_=S.hasMarkers,C=k=>S.gotoModule(k),I=k=>S.navigateToModule(k),Se=200,de=4,$e=[],te=null,ae=null;function Re(){return $e}function Fe(k){$e.push({at:new Date,text:String(k)}),$e.length>Se&&$e.shift(),ae&&Qe()}function je(k,z=3200){if(Fe(k),c)return;te||(te=document.createElement("div"),te.className="decklight-messages",w.appendChild(te));let K=document.createElement("div");for(K.className="decklight-toast",K.textContent=k,te.appendChild(K),requestAnimationFrame(()=>K.classList.add("show"));te.children.length>de;)te.firstChild.remove();setTimeout(()=>{K.classList.remove("show"),setTimeout(()=>K.remove(),260)},z)}let _e=Na({root:w,printMode:c,params:o,toast:je,debugLog:m,overlays:E,deck:()=>oe}),Ae=oa({root:w,config:a,params:o,toast:je,debugLog:m,overlays:E,deck:()=>oe,editmode:()=>Nt}),{applyTheme:st,currentTheme:bt,cycleTheme:T,cancelCyclePending:Ke,rollTheme:mt,saveGeneratedTheme:dt}=Ae,G=null,J=0,ne="",fe=[],ue,Ie=!1,Q=null;function s(){return La({sections:oe._sections,modules:P?.modules??[],skipModule:$})}function i(){let k=G.querySelector(".tp-list");if(fe=Ra(G.__index,ne),k.textContent="",fe.forEach((K,me)=>{let et=document.createElement("div");et.className="tp-row"+(K.slide===oe.state.slide?" tp-current":"")+(K.href?" tp-module":""),et.textContent=K.href?`\u25B8 ${K.title} \u2014 module`:`${K.slide} \xB7 ${K.title}`,et.addEventListener("mouseenter",()=>De(me,!1)),et.addEventListener("click",()=>{De(me,!0),Pe()}),k.appendChild(et)}),!fe.length){let K=document.createElement("div");K.className="tp-none",K.textContent="no matches",k.appendChild(K)}let z=G.querySelector(".tp-filter");z.textContent=ne||(P?"type to find a slide or module\u2026":"type to find a slide\u2026"),z.classList.toggle("tp-active",!!ne)}function O(k,z){let K=z.href??location.pathname,me=z.slide??1;if(k.dataset.doc!==K){k.dataset.doc=K,Ie=!1,k.addEventListener("load",()=>{if(Ie=!0,Q&&G){let et=Q;Q=null,O(k,et)}},{once:!0}),k.src=K+Ae.previewQuery()+"#/"+me+"/0";return}if(!Ie){Q=z;return}k.contentWindow?.postMessage({__decklightPreview:{goto:[me,0]}},"*")}function De(k,z){if(!fe.length)return;J=vn(G.querySelectorAll(".tp-row"),k,"tp-selected");let K=fe[J];G.querySelector(".tp-caption").textContent=K.href?`module \u2014 ${K.title} (${K.href})`:`slide ${K.slide} \u2014 ${K.title}`,clearTimeout(ue);let me=G.querySelector("iframe");z?O(me,K):ue=setTimeout(()=>O(me,K),60)}function B(k){ne=k,i(),fe.length?De(0,!1):G.querySelector(".tp-caption").textContent="no match"}function Pe(){let k=fe[J];if(W(),!!k){if(k.href)return I(k.module);oe.goto(k.slide,0)}}function _t(){if(G)return W();Ae.closePicker(),Nt.restore.close(),ne="",G=document.createElement("div"),G.className="decklight-theme-picker decklight-finder",G.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>',G.__index=s(),i(),Ut(G,W),w.appendChild(G),De(Math.max(0,fe.findIndex(k=>k.slide===oe.state.slide)),!0)}function W(){clearTimeout(ue),G?.remove(),G=null}let ye=null,ie=0,Ze="",v=[];function ze(){let k=K=>typeof K=="function";return[{label:"Find slide\u2026",hint:"G",alias:"search grep goto module chapter jump",run:()=>{_t(),Ze&&B(Ze)}},{label:"Comments\u2026",hint:"M",alias:"feedback remarks reviewer notes critique review read",run:()=>Nn.open()},{label:"Leave a comment\u2026",hint:"\u21E7M",alias:"comment note remark feedback add write say",run:()=>Nn.compose()},{label:"Submit review\u2026",alias:"send review push comments submit feedback",run:()=>Nn.submit()},{label:"History\u2026 (dev)",hint:"H",alias:"restore version rollback revert back git log commits unpushed push remote when changed",run:()=>Nt.history.open()},{label:"Go to slide\u2026",hint:"#",alias:"goto",keepOpen:!0,run:()=>{Ze="goto ",f()}},{label:"Theme\u2026",hint:"T",run:Ae.openPicker},{label:"Cycle theme",hint:", \xB7 .",run:()=>T(1)},{label:"Generate a theme",hint:"\u2303T",run:mt},Ae.hasGenerated()&&{label:"Save the generated theme\u2026",hint:"\u2303\u21E7T",run:()=>dt()},Nt.available()&&{label:"Browse marketplace themes\u2026",alias:"marketplace install add third-party download catalog",run:Ae.browse},...Nt.wizards().map(K=>({label:`Configure ${K.title}\u2026 (dev)`,alias:"engine wizard setup api key credential token marketplace",run:()=>Nt.wizard(K.qualified)})),{label:"Font\u2026",hint:"[ \xB7 ]",run:nt},{label:"Cycle slide layout (dev)",hint:"L",alias:"pin pinned centered top auto split columns two sides arrange",run:()=>It(1)},{label:"Undo deck edit (dev)",hint:"Z",alias:"revert back history",run:()=>Mn("undo")},{label:"Redo deck edit (dev)",hint:"\u21E7Z",alias:"forward history repeat",run:()=>Mn("redo")},{label:"Ask agent\u2026 (dev)",hint:"A",alias:"ai claude codex bob gemini prompt edit",run:Gn},{label:"Messages",hint:"`",alias:"log toast notifications warnings why voice stopped history",run:wt},{label:`Narration ${St.status().paused?"resume":St.status().narrating?"pause":"play"}`,hint:"\u23B5",alias:"play pause resume voice narration speak start stop",run:()=>St.playPause()},{label:"Narration\u2026",hint:"V",alias:"voice audio track picker settings",run:()=>_n("tracks")},{label:"Live voice\u2026",hint:"V",alias:"tts synthesize tone gemini",run:()=>_n("voices")},{label:"Character\u2026",hint:"V",alias:"avatar lipsync face talking head visemes",run:()=>_n("character")},{label:"Record this deck\u2026",hint:"V",alias:"record narrate microphone mic voice wav offline batch teleprompter",run:()=>_n("record")},{label:`Character solo ${At.solo?"off":"on"}`,alias:"centre center stage narrator only fullscreen avatar",run:()=>St.applySolo(!At.solo)},{label:"Voice faster",hint:">",alias:"speed rate playback",run:()=>Cn(.25)},{label:"Voice slower",hint:"<",alias:"speed rate playback",run:()=>Cn(-.25)},{label:"Speaker view",hint:"S",run:()=>{let K=oe.__speakerWin;K&&!K.closed?K.__decklightSpeakerToggle?.():oe.__speakerWin=ao(oe)}},{label:"Overview",hint:"O",run:We},{label:"Blackout",hint:"B",run:xe},{label:`Pen ${dn.annotator?.tool==="pen"?"off":"on"} \u2014 draw on the slide`,hint:"W",alias:"ink annotate draw scribble marker highlight",run:()=>fn("pen")},{label:`Laser pointer ${dn.annotator?.tool==="laser"?"off":"on"}`,hint:"\u21E7W",alias:"ink dot glow point at",run:()=>fn("laser")},{label:"Debug log",hint:"D",alias:"console events state",run:yt},{label:`Captions ${St.status().captionsOn?"off":"on"}`,hint:"C",alias:"cc subtitles closed caption",run:xn},{label:`Clock ${dn.status().clockOn?"off":"on"}`,alias:"time elapsed timer talk wall watch clock",run:Xt},{label:"Commit\u2026",hint:"K",alias:"git save commit message history",run:()=>Nt.commit.open()},{label:`Progress bar ${dn.status().progressOn?"off":"on"}`,hint:"J",alias:"bar bottom edge position how far through shape of the talk",run:wn},{label:"Transcript\u2026",alias:"notes script export text markdown spoken",run:ir},{label:"Edit speaker notes\u2026",alias:"edit mode notes write right-click background",run:ar},{label:`Element edit mode ${Nt.elementEditOn()?"off":"on"} (dev)`,hint:"E",alias:"right-click remove delete html content build animation entrance effect context menu",run:Kn},{label:"Fullscreen",hint:"F",run:()=>Me()},{label:"Print view (all slides, new tab)",hint:"",run:()=>window.open(location.pathname+"?print")},{label:"First slide",hint:"Home",run:()=>oe.goto(1,0)},{label:"Last slide",hint:"End",run:()=>oe.goto(oe.state.totalSlides,0)},{label:"Keyboard help",hint:"?",run:L},{label:"Welcome to Decklight",alias:"onboarding intro getting started first run tour what is this help me",run:_e.showWelcome},{label:`Tips ${_e.status().tipsOn?"off":"on"}`,alias:"hints teach shortcuts learn stop showing quiet",run:()=>_e.setTips(!_e.status().tipsOn)},_e.status().tipsLeft<Xr.length&&{label:"Reset tips",alias:"hints again start over show all unsee replay",run:_e.resetTips}].filter(Boolean).filter(K=>k(K.run))}function f(){let k=ye.querySelector(".narr-card");k.textContent="",v=qa({commands:ze(),query:Ze,totalSlides:oe.state.totalSlides,makeGotoRow:(K,me)=>({label:`Go to slide ${K} / ${me}`,hint:"\u23CE",run:()=>oe.goto(K,0)}),makeSearchRow:K=>({label:`Search slides for \u201C${K}\u201D`,hint:"",run:()=>{_t(),B(K)}})});let z=document.createElement("div");if(z.className="pal-input"+(Ze?" tp-active":""),z.textContent=Ze||"type a command\u2026",k.appendChild(z),v.forEach((K,me)=>{let et=document.createElement("div");et.className="narr-row pal-row";let Ht=document.createElement("span");if(Ht.textContent=K.label,et.appendChild(Ht),K.hint){let un=document.createElement("span");un.className="pal-kbd",un.textContent=K.hint,et.appendChild(un)}et.addEventListener("mouseenter",()=>Y(me)),et.addEventListener("click",()=>{Y(me),F()}),k.appendChild(et)}),!v.length){let K=document.createElement("div");K.className="tp-none",K.textContent="no matching command",k.appendChild(K)}Y(0)}function Y(k){v.length&&(ie=vn(ye.querySelectorAll(".pal-row"),k,"narr-sel"))}function F(){let k=v[ie];k&&(k.keepOpen||ce(),k.run())}function Ce(){if(ye)return ce();G&&W(),Nt.restore.close(),Ze="",ye=document.createElement("div"),ye.className="decklight-narr decklight-palette",ye.innerHTML='<div class="narr-card" role="listbox" aria-label="Commands"></div>',Ut(ye,ce),w.appendChild(ye),f()}function ce(){ye?.remove(),ye=null}let Ne=null,ee=0;function nt(){if(Ne)return ut();Ne=document.createElement("div"),Ne.className="decklight-narr decklight-font-picker",Ne.innerHTML='<div class="narr-card" role="listbox" aria-label="Fonts"></div>';let k=Ne.querySelector(".narr-card");ke.forEach(([z],K)=>{let me=document.createElement("div");me.className="narr-row"+(K===re?" narr-cur":""),me.textContent=z,K>0&&(me.style.fontFamily=ke[K][1]),me.addEventListener("mouseenter",()=>pt(K)),me.addEventListener("click",()=>{Ge(K),ut()}),k.appendChild(me)}),Ut(Ne,ut),w.appendChild(Ne),pt(re)}function pt(k){ee=vn(Ne.querySelectorAll(".narr-row"),k,"narr-sel")}function ut(){Ne?.remove(),Ne=null}Ae.restoreSaved();let ke=[["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"]],Ee="decklight-font:"+location.pathname,re=0;function Ge(k,{silent:z=!1,remeasure:K=!0}={}){re=(k%ke.length+ke.length)%ke.length;let[me,et]=ke[re];if(et?(w.style.setProperty("--font-body",et),w.style.setProperty("--font-heading",et)):(w.style.removeProperty("--font-body"),w.style.removeProperty("--font-heading")),!o.has("embedded"))try{et?localStorage.setItem(Ee,String(re)):localStorage.removeItem(Ee)}catch{}K&&(Os(oe._sections,a),So(oe._sections[oe.state.slide-1],oe.state.slide)),z||je(`font: ${me}`),m("font",me)}function ht(k){Ge(re+k)}try{let k=parseInt(localStorage.getItem(Ee),10);k>0&&k<ke.length&&Ge(k,{silent:!0,remeasure:!1})}catch{}function tt(k){if(!k)return null;if(k.startsWith("#")){let K=document.querySelector(k);if(!K)return null;let me=K.cloneNode(!0);return me.removeAttribute("id"),me.style.removeProperty("display"),me}if(k.trim().startsWith("<")){let K=document.createElement("div");return K.innerHTML=k,K.firstElementChild}let z=document.createElement("img");return z.src=k,z.alt="",z}let He=null;Ae.updateCanvas();let gt=w.querySelector(":scope > .decklight-stage");if(!gt){for(gt=document.createElement("div"),gt.className="decklight-stage";w.firstChild;)gt.appendChild(w.firstChild);w.appendChild(gt)}if(gt.style.width=a.width+"px",gt.style.height=a.height+"px",a.logo&&(a.logo.src||a.logo.onLight||a.logo.onDark)){He=document.createElement("div"),He.className="decklight-logo",He.setAttribute("data-pos",a.logo.position||"bottom-left"),a.logo.height&&He.style.setProperty("--logo-h",a.logo.height+"px");for(let[k,z]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let K=tt(a.logo[k]);if(!K)continue;let me=document.createElement("span");me.className=z,me.appendChild(K),He.appendChild(me)}w.appendChild(He)}function Yt(k){He&&k.forEach(z=>{if(!z.hasAttribute("data-logo")||z.querySelector(":scope > .decklight-hero-logo"))return;let K=document.createElement("div");K.className="decklight-hero-logo";let me=parseFloat(z.getAttribute("data-logo"));me&&K.style.setProperty("--hero-logo-h",me+"px"),K.innerHTML=He.innerHTML,z.prepend(K)})}zd(gt),Zo(gt),oi(gt),Go(gt),Qi(gt,Qr);let nn=Da({slideOf:()=>oe.state.slide,sectionAt:k=>oe._sections[k-1],describe:k=>({autoPins:Ha(k,a)!==null,hasSplitPair:ja(k).length>1}),available:()=>Nt.available(),unavailableMessage:()=>Dn("layout",location),apply:(k,z)=>{z==="auto"?k.removeAttribute("data-layout"):k.setAttribute("data-layout",z)},relayout:(k,z)=>(Os(oe._sections,a),za(oe._sections),So(k,z),k.hasAttribute("data-split-conflict")),post:k=>fetch(Nt.base()+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(k)}).then(z=>{if(!z.ok)throw new Error(z.status)}),toast:je,debugLog:m}),It=k=>nn.cycle(k),Wt=k=>nn.ring(k),oe={root:w,stage:gt,config:a,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(k,z){return this._listeners.has(k)||this._listeners.set(k,new Set),this._listeners.get(k).add(z),this},off(k,z){return this._listeners.get(k)?.delete(z),this},_emit(k,z){(this._listeners.get(k)||[]).forEach(K=>K(z)),w.dispatchEvent(new CustomEvent("decklight:"+k,{detail:z}))},sync(){this._sections=[...gt.querySelectorAll(":scope > section")],this._sections.forEach((z,K)=>z.setAttribute("data-slide-index",String(K+1))),jo(gt,a.concepts),Yt(this._sections),xa(this._sections,{printMode:c}),Os(this._sections,a),za(this._sections),this._records=this._sections.map(z=>Xs(z)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let k=this._records[this.state.slide-1];k&&(this.state.step=Math.min(this.state.step,k.groups.length)),qt(c?this._sections:[this._sections[this.state.slide-1]])},_rescanFor(k){let z=k.closest("section"),K=this._sections.indexOf(z);if(K!==-1){if(this._records[K]=Xs(z),c){tr(this._records[K],this._records[K].groups.length);return}K===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[K].groups.length),this._requestedStep=null,Bt(()=>tr(this._records[K],this.state.step)),this._updateHash(!1)):Bt(()=>tr(this._records[K],0)),this._notify()}},_stepLabels(k){let z=this._records[k];return z?Uo(z):[]},next(){let k=this._records[this.state.slide-1];k&&this.state.step<k.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"}):C(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 k=this._records[this.state.slide-2];this.goto(this.state.slide-1,k.groups.length,{direction:"back"})}else C(-1)},goto(k,z=0,K={}){k=Math.max(1,Math.min(k,this.state.totalSlides));let me=this._records[k-1];this._requestedStep=z,z=Math.max(0,Math.min(z,me?me.groups.length:0));let et=k===this.state.slide;if(et&&z===this.state.step&&!K.force)return;let Ht=K.direction||(k>this.state.slide||et&&z>this.state.step?"fwd":"back");!et||K.force?(this._activateSlide(k,Ht,K),this.state.slide=k,this.state.step=z,Bt(()=>tr(me,z)),this._emit("slide",{slide:k,total:this.state.totalSlides,direction:Ht}),qt([this._sections[k-1]])):(this.state.step=z,tr(me,z),this._emit("build",{slide:k,index:z,total:me.groups.length,direction:Ht})),this._updateChrome(),this._updateHash(!et),this._notify()},_activateSlide(k,z,K={}){let me=this._sections[this.state.slide-1],et=this._sections[k-1];if(w.classList.toggle("has-hero-logo",et?.hasAttribute("data-logo")??!1),me===et){et.classList.add("active");return}let Ht=!me||!me.classList.contains("active"),un=me&&et&&!Ht&&me.hasAttribute("data-auto-animate")&&et.hasAttribute("data-auto-animate")&&Math.abs(this._sections.indexOf(et)-this._sections.indexOf(me))===1;if(this._sections.forEach(en=>en.classList.remove("active","entering","leaving","dir-fwd","dir-back","tr-none","tr-fade","tr-slide","tr-scale","tr-flip")),et.classList.add("active"),Ht||c)return;if(un){me.classList.add("leaving"),me.style.visibility="hidden",et.style.visibility="hidden",et.offsetWidth,et.style.visibility="",ni(me,et,this._scale),me.classList.remove("leaving"),me.style.visibility="";return}let an=Qo(et.getAttribute("data-transition"),this.config.transition),Vt=ei(an,z);if(!Vt)return;et.classList.add(...Vt.entering),me.classList.add(...Vt.leaving);let qn=ys(getComputedStyle(et).getPropertyValue("--transition-duration"),350);setTimeout(()=>{me.classList.remove(...Vt.leaving),et.classList.remove(...Vt.entering)},qn+60)},_updateChrome(){if(Kt){let k=this._records[this.state.slide-1],z=k?k.groups.length:0,K=this.state.totalSlides<=1?1:(this.state.slide-1+(z?this.state.step/(z+1):0))/(this.state.totalSlides-1);Kt.style.width=(Math.min(K,1)*100).toFixed(2)+"%"}if(Rt){let k=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if(Rt.textContent=k,S.any){let z=S.title(),K=document.createElement("span");K.className="mod",K.textContent=z,Rt.prepend(K)}}},_updateHash(k){!this.config.hash||c||(mn=mn||!!k,!Lt&&(Lt=setTimeout(()=>{Lt=null,Dt()},gn)))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function pn(k,z){let K=document.createElement("a");K.href=k,K.download=z,document.body.appendChild(K),K.click(),K.remove()}function Bt(k){w.classList.add("decklight-no-anim"),k(),w.offsetWidth,w.classList.remove("decklight-no-anim")}function rn(k){return(k||"").replace(/^#/,"")}let gn=90,Lt=null,mn=!1;function Dt(k=!0){if(!oe||!a.hash||c)return;let z=`#/${oe.state.slide}/${oe.state.step}`,K=mn;if(mn=!1,"#"+rn(location.hash)!==z){bn=!0;try{K?history.pushState(null,"",z):history.replaceState(null,"",z)}catch{}setTimeout(()=>{bn=!1}),k&&"#"+rn(location.hash)!==z&&(mn=K,requestAnimationFrame(()=>Dt(!1)))}}function Ct(){let k=rn(location.hash).match(/^\/(\d+)(?:\/(\d+))?/);return k?{slide:parseInt(k[1],10),step:k[2]?parseInt(k[2],10):0}:null}let Kt=null,Rt=null;if(a.controls&&!c){let k=document.createElement("div");k.className="decklight-controls",k.innerHTML=`
|
|
385
|
+
</div>`,k.addEventListener("click",re=>{re.stopPropagation(),S()}),Ht(k,S),t.appendChild(k),d?.("nav","welcome shown"))}p.register({isOpen:()=>!!k,close:S,keydown:()=>(S(),!0)});function T(){return vo(Ba)!=="1"}function A(){try{let re=JSON.parse(vo(wo)||"[]");return new Set(Array.isArray(re)?re:[])}catch{return new Set}}function N(){let re=A();return Xr.find(ce=>!re.has(ce.id))||null}function I(){let re=N();if(!re)return null;let ce=A();return ce.add(re.id),Rs(wo,JSON.stringify([...ce])),c(`tip \xB7 ${re.text}`,5200),re.id}function Se(re){Rs(Ba,re?"0":"1"),c(re?"tips on \u2014 one per deck you open":"tips off")}function pe(){Rs(wo,"[]"),c(`tips reset \u2014 all ${Xr.length} will show again, one per deck`)}function Oe(re){if(!v&&(f().on("slide",S),f().on("build",S),!(re.slide!==1||re.step!==0))){if(vo(Pa)!=="1"){P();return}T()&&I()}}return{start:Oe,showWelcome:P,dismissWelcome:S,showTip:I,setTips:Se,resetTips:pe,status:()=>({tipsOn:T(),tipsLeft:N()?Xr.length-A().size:0})}}me();fe();function qa({sectionsOf:t,checkOverflow:o,ResizeObs:a=typeof ResizeObserver=="function"?ResizeObserver:null,MutationObs:c=typeof MutationObserver=="function"?MutationObserver:null,schedule:d=p=>setTimeout(p)}){let p=[],f=0;function m(){f||(f=d(()=>{f=0;let T=t();for(let A of p)o(A,T.indexOf(A)+1)})||1)}let v=a?new a(m):null;function k(T){if(v)for(let A of[T,...T.querySelectorAll("*")])A.parentElement?.closest(".terminal")||v.observe(A)}let S=c?new c(T=>{let A=I=>!(I.nodeType===1?I:I.parentElement)?.closest(".terminal"),N=!1;for(let I of T)if(A(I.target)){N=!0;for(let Se of I.addedNodes)Se.nodeType===1&&Se.isConnected&&k(Se)}N&&m()}):null,P=T=>{T.target.closest?.(".terminal")||m()};return{watch(T){v?.disconnect(),S?.disconnect();for(let A of p)for(let N of["load","error"])A.removeEventListener(N,P,!0);p=T.filter(Boolean);for(let A of p){k(A),S?.observe(A,{childList:!0,subtree:!0,characterData:!0});for(let N of["load","error"])A.addEventListener(N,P,!0)}m()},get watched(){return p.slice()}}}me();fe();function Fa({config:t,root:o,embedded:a,sectionsOf:c,slideOf:d,navigate:p}){let f=!a&&t.playlist?.modules?.length?t.playlist:null,m=f?f.index??0:0,v=!!o.querySelector("section[data-module]");function k(){let P=[];return(c()||[]).forEach((T,A)=>{T.hasAttribute("data-module")&&P.push({title:T.getAttribute("data-module"),slide:A+1})}),P}function S(P=k()){let T=-1;return P.forEach((A,N)=>{A.slide<=d()&&(T=N)}),T}return{get playlist(){return f},get index(){return m},get hasMarkers(){return v},get any(){return v||!!f},markers:k,currentMarkerIndex:S,gotoModule(P){if(!f)return!1;let T=f.modules[m+P];return T?(p(T.href+(P>0?"#/1/0":"#/999/999")),!0):!1},navigateToModule(P){let T=f?.modules[P];T&&p(T.href+"#/1/0")},title(){if(v){let P=k();return P[S(P)]?.title||""}return f?.modules[m]?.title||""}}}me();fe();function xo(t,o,a){return(t.querySelector("h1, h2, h3")?.textContent||"").replace(/\s+/g," ").trim()||a.slice(0,60)||`slide ${o+1}`}function ko(t){return[...t.children].filter(a=>!a.matches("aside, script, style")).map(a=>a.textContent).join(" ").replace(/\s+/g," ").trim()}function za({sections:t,modules:o=[],skipModule:a=-1}){let c=t.map((p,f)=>{let m=ko(p);return{slide:f+1,title:xo(p,f,m),haystack:m.toLowerCase()}}),d=o.map((p,f)=>({module:f,title:p.title,href:p.href,haystack:(p.title||"").toLowerCase()})).filter(p=>p.module!==a);return[...c,...d]}function Ua(t,o){let a=String(o??"").toLowerCase().split(/\s+/).filter(Boolean),c=[],d=[];for(let p of t){let f=p.title.toLowerCase();a.every(m=>f.includes(m))?c.push(p):a.every(m=>p.haystack.includes(m))&&d.push(p)}return[...c,...d]}me();fe();me();fe();function Ha(t){let o=2166136261,a=String(t??"").replace(/\s+/g,"");for(let c=0;c<a.length;c++)o^=a.charCodeAt(c),o=Math.imul(o,16777619)>>>0;return o.toString(16).padStart(8,"0")}function Qr(t,o){let a=Array.isArray(o)?o:[],c=Number(t?.slide);if(t?.fp){let p=a.find(f=>f.fp===t.fp);if(p)return{verdict:"exact",slide:p.slide,movedFrom:p.slide===c?null:c}}let d=String(t?.title??"").trim();if(d){let p=a.filter(f=>String(f.title??"").trim()===d);if(p.length===1)return{verdict:"stale",slide:p[0].slide,movedFrom:p[0].slide===c?null:c}}return!t?.fp&&Number.isInteger(c)&&c>=1&&c<=a.length?{verdict:"unanchored",slide:c,movedFrom:null}:{verdict:"orphaned",slide:null,movedFrom:null}}var Eo={exact:null,stale:"this slide changed since the comment was written",unanchored:"could not find the slide this was written on \u2014 showing it where it used to be",orphaned:"the slide this was written on is gone"};function So(t,{titleOf:o,bodyOf:a}){return t.map((c,d)=>{let p=a(c);return{slide:d+1,title:o(c,d,p),fp:Ha(p)}})}function Br(t){let o=new Map,a=[],c=[],d=[];for(let p of t){if(p.op==="resolve"){c.push(p);continue}if(p.op==="anchor"){d.push(p);continue}if(p.re){a.push(p);continue}o.has(p.id)||o.set(p.id,{...p,replies:[],resolved:null})}for(let p of a)o.get(p.re)?.replies.push(p);for(let p of c){let f=o.get(p.re);f&&(f.resolved={at:p.at??null,by:p.by??null})}for(let p of d){let f=o.get(p.re);!f||!Number.isInteger(p.slide)||(f.slide=p.slide,f.title=p.title??null,f.fp=p.fp??null,f.anchored={at:p.at??null,by:p.by??null})}return[...o.values()]}function ja({root:t,params:o,overlays:a,instance:c,toast:d,debugLog:p,dismissOthers:f=()=>{},sections:m=()=>[],titleOf:v,bodyOf:k,authorBase:S=()=>null,authorReady:P=()=>Promise.resolve()}){let T=null,A=[],N=0,I=null,Se=!1,pe=null,Oe=[],re=null,ce=null,Me=!1,ze=null,Ve=null,$e="decklight-review-dock:"+location.pathname,_e={mode:"float",x:null,y:null};{let g=Bn($e);g?.mode&&(_e.mode=g.mode,_e.x=g.x??null,_e.y=g.y??null)}let Ze=()=>{Dn($e,_e)},bt={float:"\u274F",left:"\u25E7",right:"\u25E8",bottom:"\u2B13"},_=()=>({w:Math.min(360,Math.round(t.clientWidth*.32)),h:Math.min(320,Math.round(t.clientHeight*.4))});function je(){if(!T)return;T.dataset.dock=_e.mode;let g=_();t.style.setProperty("--dock-left",_e.mode==="left"?g.w+"px":"0px"),t.style.setProperty("--dock-right",_e.mode==="right"?g.w+"px":"0px"),t.style.setProperty("--dock-bottom",_e.mode==="bottom"?g.h+"px":"0px"),T.style.setProperty("--dock-size",_e.mode==="bottom"?g.h+"px":g.w+"px");let J=T.querySelector(".narr-card");J&&_e.mode!=="float"&&(J.style.left="",J.style.top=""),c._reflow?.(),_e.mode==="float"&>()}function gt(){let g=T?.querySelector(".narr-card");if(!g||_e.mode!=="float")return;let J=g.offsetWidth||460,z=g.offsetHeight||400,Ce=_e.x,ye=_e.y;(Ce==null||ye==null)&&(Ce=t.clientWidth-J-24,ye=24),Ce=Math.max(8,Math.min(Ce,t.clientWidth-J-8)),ye=Math.max(8,Math.min(ye,t.clientHeight-z-8)),_e.x=Ce,_e.y=ye,g.style.left=Ce+"px",g.style.top=ye+"px"}function ut(g){_e.mode=g,Ze(),je(),T?.querySelectorAll(".rv-dock-btn").forEach(z=>z.classList.toggle("rv-dock-on",z.dataset.mode===g));let J=T?.querySelector(".narr-head");J&&(J.style.cursor=g==="float"?"move":"")}function Q(g,J){if(_e.mode!=="float"||g.button!=null&&g.button!==0||g.target.closest(".rv-dock-ctl"))return;let z=T.querySelector(".narr-card");if(!z)return;g.preventDefault();let Ce=g.clientX,ye=g.clientY,Pe=parseFloat(z.style.left)||0,X=parseFloat(z.style.top)||0,Xe=ft=>{let ke=z.offsetWidth,ue=z.offsetHeight;_e.x=Math.max(8,Math.min(Pe+ft.clientX-Ce,t.clientWidth-ke-8)),_e.y=Math.max(8,Math.min(X+ft.clientY-ye,t.clientHeight-ue-8)),z.style.left=_e.x+"px",z.style.top=_e.y+"px"},mt=()=>{window.removeEventListener("pointermove",Xe),window.removeEventListener("pointerup",mt),Ze()};window.addEventListener("pointermove",Xe),window.addEventListener("pointerup",mt)}let j=()=>So(m(),{titleOf:v,bodyOf:k});async function oe(){if(ce!==null)return ce||(ce===""?"":null);try{let g=await fetch("/review/ping"),J=g.ok?await g.json():null;ce=J?.ok&&J.review?"":!1}catch{ce=!1}return ce===!1?null:ce}async function he(){let g=await oe(),J=g!==null?`${g}/review/comments`:`${S()??""}/edit/review`;if(g===null&&S()==null)return{records:[],skipped:0,can:"none"};try{let Ce=await(await fetch(J)).json();if(!Ce?.ok)throw new Error(Ce?.error||"unreadable");let ye={records:Ce.records??[],skipped:Ce.skipped??0,can:g!==null?"comment":"resolve"};if(ye.can==="resolve")try{let X=await(await fetch(`${S()??""}/edit/review/incoming`)).json();X?.ok&&(ye.incoming=X)}catch{}return ye}catch(z){return p("review",`could not read comments: ${String(z.message||z)}`),{records:[],skipped:0,can:"none",error:String(z.message||z)}}}let le=(g,J,z)=>{let Ce=document.createElement(g);return J&&(Ce.className=J),z!=null&&(Ce.textContent=z),Ce},Re=g=>g.by?g.by.replace(/\s*<[^>]*>$/,""):"someone";function Y(g,J,{branch:z=null,done:Ce=!1}={}){let ye=Qr(g,J),Pe=le("div",`rv-row${g.resolved?" rv-resolved":""}${z?" rv-inc":""}${Ce?" rv-done":""}`);Pe.setAttribute("role","option");let X=le("div","rv-head");X.append(le("span","rv-slide",ye.slide?`slide ${ye.slide}`:"slide gone")),X.append(le("span","rv-who",Re(g))),g.deck&&X.append(le("span","rv-at",`@${g.deck}`)),ye.movedFrom&&X.append(le("span","rv-moved",`was ${ye.movedFrom}`)),g.resolved&&X.append(le("span","rv-tick","\u2713")),Pe.append(X),Pe.append(le("div","rv-body",g.body??""));let Xe=Eo[ye.verdict];Xe&&Pe.append(le("div","rv-note",`\u26A0 ${Xe}`));for(let ft of g.replies)Pe.append(le("div","rv-reply",`\u21B3 ${Re(ft)}: ${ft.body??""}`));if(re?.id===g.id){let ft=re.data;Pe.append(le("div","rv-then",ft.known?`what it said \u2014 slide ${ft.slide}${ft.title?` \xB7 ${ft.title}`:""}${ft.deck?` \xB7 @${ft.deck}`:""}:
|
|
386
|
+
${ft.text||"(nothing)"}`:`cannot show what it said \u2014 ${ft.why}`))}I===g.id&&Pe.append(le("div","rv-arm","resolve this comment? \u23CE again to confirm \xB7 Esc to back out")),pe===g.id&&Pe.append(le("div","rv-arm",`move this comment to slide ${c.state.slide} (the one on screen)? A again to confirm \xB7 Esc backs out`));let mt={id:g.id,slide:ye.slide,node:Pe,resolved:!!g.resolved,branch:z,done:Ce};return Pe.addEventListener("click",()=>{i(A.indexOf(mt)),O()}),A.push(mt),Pe}function s(g){let J=A[N]?.id??null,z=T.querySelector(".narr-card");z.replaceChildren();let Ce=j(),ye=c.state.slide;A=[],Oe=g.incoming?.reviews??[];let Pe=le("div","narr-head");Pe.append(le("span","rv-heading","comments"));let X=le("div","rv-dock-ctl");for(let ie of["float","left","right","bottom"]){let Ke=le("button","rv-dock-btn"+(_e.mode===ie?" rv-dock-on":""),bt[ie]);Ke.dataset.mode=ie,Ke.title=ie==="float"?"float (movable)":`dock ${ie}`,Ke.setAttribute("aria-label",ie==="float"?"float":`dock ${ie}`),Ke.addEventListener("click",()=>ut(ie)),X.append(Ke)}let Xe=le("button","rv-dock-btn rv-close","\xD7");if(Xe.title="close (M)",Xe.setAttribute("aria-label","close"),Xe.addEventListener("click",Ie),X.append(Xe),Pe.append(X),Pe.style.cursor=_e.mode==="float"?"move":"",Pe.addEventListener("pointerdown",ie=>Q(ie,Pe)),z.append(Pe),g.incoming){let ie=g.incoming;if(ie.reviews?.length){let Ke=le("div","rv-incoming"),rt=[...ie.reviews].sort((Je,tt)=>Number(Je.done)-Number(tt.done));for(let Je of rt){let tt=new Set(Je.doneIds??[]),Rt=Br(Je.records??[]).filter(Pt=>!Pt.resolved),jt=Rt.filter(Pt=>!tt.has(Pt.id)).length;Ke.append(le("div",`rv-src${Je.done?" rv-done":""}`,Je.done?`\u2713 ${Je.who} \u2014 all ${Rt.length} done \xB7 ${Je.branch}`:`\u2193 ${Je.who} \u2014 ${jt} of ${Rt.length} left \xB7 ${Je.branch}`));let en=[...Rt].sort((Pt,sn)=>Number(tt.has(Pt.id))-Number(tt.has(sn.id)));for(let Pt of en)Ke.append(Y(Pt,Ce,{branch:Je.branch,done:tt.has(Pt.id)}))}z.append(Ke)}else ie.state&&!["ok","none","no-repo","untracked","no-remote","suppressed"].includes(ie.state)&&z.append(le("div","rv-inc-how",`incoming reviews: not checked \u2014 ${ie.state}`))}let mt=le("div","rv-list");mt.setAttribute("role","listbox");let ft=Br(g.records);if(g.error?mt.append(le("div","rv-none",`could not read the comments \u2014 ${g.error}`)):ft.length||mt.append(le("div","rv-none",g.can==="none"?"no comments, and nothing here can take one \u2014 a reviewer leaves them with: decklight review <deck>":"no comments yet")),g.skipped&&mt.append(le("div","rv-skipped",`${g.skipped} line(s) could not be read and were skipped`)),g.incoming?.reviews?.length&&ft.length){let ie=ft.filter(Ke=>!Ke.resolved).length;mt.append(le("div","rv-src",ie?`\u270E your comments \u2014 ${ie} of ${ft.length} left`:`\u2713 your comments \u2014 all ${ft.length} done`))}let ke=[...ft].sort((ie,Ke)=>+!!ie.resolved-+!!Ke.resolved);for(let ie of ke)mt.append(Y(ie,Ce));if(z.append(mt),g.can==="comment"){let ie=le("div",`rv-submit${Se?" rv-arm":""}`,Se?"push this review to the author? S again to confirm \xB7 Esc backs out":"S sends this review to the author (a review/\u2026 branch on the remote)");ie.setAttribute("role","button"),ie.tabIndex=0,ie.addEventListener("click",()=>W()),z.append(ie)}z.append(le("div","rec-hint",g.can==="resolve"?Oe.length?"\u23CE jumps \xB7 R marks one done (again reopens a reviewer's) \xB7 A moves here \xB7 Esc closes":"\u23CE jumps (on a gone slide: shows what it said) \xB7 R marks one done \xB7 A moves here \xB7 Esc closes":g.can==="comment"?"\u23CE jumps to the slide \xB7 S submits the review \xB7 Esc closes":"\u23CE jumps to the slide \xB7 Esc closes"));let ue=J===null?-1:A.findIndex(ie=>ie.id===J);i(ue>=0?ue:Math.min(N,Math.max(0,A.length-1))),gt()}function i(g){A.length&&(N=En(A.map(J=>J.node),g,"rv-sel"))}function O(){let g=A[N];if(g){if(!g.slide){Ue(g);return}c.goto(g.slide,0,{force:!0})}}async function Ue(g){if(re?.id===g.id){re=null,s(await he());return}let J=S();if(J==null){d("only the author server can look that far back");return}try{let z=await fetch(`${J}/edit/review/at?id=${encodeURIComponent(g.id)}`),Ce=await z.json();if(!Ce?.ok)throw new Error(Ce?.error||`HTTP ${z.status}`);re={id:g.id,data:Ce}}catch(z){re={id:g.id,data:{known:!1,why:String(z.message||z)}}}s(await he())}async function B(){let g=A[N];if(!g||g.resolved)return;let J=S();if(J==null)return;if(pe!==g.id){pe=g.id,I=null,s(await he());return}if(pe=null,g.branch){d("this comment is on a review branch \u2014 only your own comments can be moved");return}let z=c.state.slide,Ce=j()[z-1];try{if(!(await(await fetch(`${J}/edit/review`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({op:"anchor",re:g.id,slide:z,title:Ce?.title,fp:Ce?.fp})})).json())?.ok)throw new Error("refused");d(`moved to slide ${z}`),re=null}catch(ye){d(`could not move that \u2014 ${String(ye.message||ye)}`)}s(await he())}async function Le(g,J,z){let Ce=String(g??"").trim();if(!Ce)return;let ye=await oe(),Pe=ye!==null?{url:`${ye}/review/comments`,mine:!1}:S()!=null?{url:`${S()}/edit/review`,mine:!0}:null;if(Pe)try{let X=await fetch(Pe.url,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:J,title:z?.title,fp:z?.fp,body:Ce})}),Xe=await X.json();if(!Xe?.ok)throw new Error(Xe?.error||`HTTP ${X.status}`);d(`comment left on slide ${J}`),p("review",`comment ${Xe.id} on slide ${J}`),T&&s(await he())}catch(X){d(`could not leave that comment \u2014 ${String(X.message||X)}`)}}async function $t(){let g=A[N];if(!g)return;let J=S();if(J!=null){if(g.branch){try{let Ce=await(await fetch(`${J}/edit/review/done`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({branch:g.branch,id:g.id,done:!g.done})})).json();if(!Ce?.ok)throw new Error(Ce?.error||"refused");d(Ce.done?"done":"reopened"),p("review",`${g.branch} ${g.id} ${Ce.done?"done":"reopened"}`)}catch(z){d(`could not mark that \u2014 ${String(z.message||z)}`)}s(await he());return}if(!g.resolved){if(I!==g.id){I=g.id,s(await he());return}I=null;try{if(!(await(await fetch(`${J}/edit/review`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({op:"resolve",re:g.id})})).json())?.ok)throw new Error("refused");d("resolved")}catch(z){d(`could not resolve that \u2014 ${String(z.message||z)}`)}s(await he())}}}async function W(){let g=await oe();if(g===null){d("nothing here can submit \u2014 run: decklight review <deck>");return}if(!Se){Se=!0,s(await he());return}Se=!1;try{let J=await fetch(`${g}/review/submit`,{method:"POST"}),z=await J.json();if(!z?.ok)throw new Error(z?.error||`HTTP ${J.status}`);d(`review pushed \u2192 ${z.branch}`),p("review",`submitted ${z.comments} comment(s) to ${z.branch}`)}catch(J){d(`could not submit \u2014 ${String(J.message||J)}`)}s(await he())}let Ae=null;function ee(){Ae?.remove(),Ae=null}async function We(){if(Ae)return ee();let g=await oe(),J=S();if(g===null&&J==null){d("nothing here can take a comment \u2014 decklight author, or decklight review");return}f(),Ie();let z=c.state.slide;Ae=document.createElement("div"),Ae.className="decklight-narr decklight-compose",Ae.innerHTML='<div class="narr-card" role="dialog" aria-label="Leave a comment"></div>',Ht(Ae,ee),t.appendChild(Ae);let Ce=Ae.querySelector(".narr-card"),ye=j();Ce.append(le("div","narr-head","leave a comment")),Ce.append(le("div","rv-on",`on slide ${z}${ye[z-1]?.title?` \xB7 ${ye[z-1].title}`:""}`));let Pe=le("textarea","narr-input rv-input");Pe.placeholder="what you want remembered about this slide\u2026",Pe.rows=3;let X=le("div","narr-row narr-sel rv-send","Leave this comment");X.setAttribute("role","button"),X.tabIndex=0;let Xe=async()=>{if(!Pe.value.trim()){Pe.focus();return}await Le(Pe.value,z,ye[z-1]),ee()};X.addEventListener("click",Xe),Pe.addEventListener("keydown",ie=>{ie.key==="Enter"&&(ie.metaKey||ie.ctrlKey)&&(ie.preventDefault(),Xe()),ie.stopPropagation()}),Ce.append(Pe,X),Ce.append(le("div","rec-hint","\u2318\u23CE leaves it \xB7 Esc closes \xB7 M reads them all")),setTimeout(()=>Pe.focus(),0);let mt=await he();if(!Ae)return;let ft=Br(mt.records??[]).filter(ie=>!ie.resolved&&Qr(ie,ye).slide===z),ke=(mt.incoming?.reviews??[]).flatMap(ie=>Br(ie.records??[]).filter(Ke=>!Ke.resolved&&Qr(Ke,ye).slide===z).map(Ke=>({c:Ke,who:ie.who})));if(!ft.length&&!ke.length)return;let ue=le("div","rv-already");ue.append(le("div","rv-src",`already on this slide \u2014 ${ft.length+ke.length}`));for(let ie of ft)ue.append(le("div","rv-said",`${Re(ie)}: ${ie.body}`));for(let{c:ie,who:Ke}of ke)ue.append(le("div","rv-said",`${Ke}: ${ie.body}`));Ce.append(ue)}async function w(){if(T)return Ie();f(),I=null,Se=!1,pe=null,re=null,N=0,T=document.createElement("div"),T.className="decklight-narr decklight-review",T.dataset.dock=_e.mode,T.innerHTML='<div class="narr-card" role="dialog" aria-label="Review comments"></div>',t.appendChild(T),Me=_e.mode==="float",Ve=g=>{Me=!!T&&T.contains(g.target)},document.addEventListener("pointerdown",Ve,!0),document.addEventListener("focusin",Ve,!0),ze=()=>je(),window.addEventListener("resize",ze),je(),s({records:[],skipped:0,can:"none"}),await P(),T&&s(await he())}function Ie(){T?.remove(),T=null,I=null,Se=!1,pe=null,re=null,Me=!1,t.style.removeProperty("--dock-left"),t.style.removeProperty("--dock-right"),t.style.removeProperty("--dock-bottom"),c._reflow?.(),ze&&(window.removeEventListener("resize",ze),ze=null),Ve&&(document.removeEventListener("pointerdown",Ve,!0),document.removeEventListener("focusin",Ve,!0),Ve=null)}return a.register({isOpen:()=>!!Ae,close:ee,keydown(g){return g.key==="Escape"?(ee(),!0):!1}}),a.register({isOpen:()=>!!T,close:Ie,modal:()=>Me,keydown(g){let J=/^(input|textarea)$/i.test(g.target?.tagName??"");if(g.key!=="Escape"&&!(g.key==="m"||g.key==="M")&&!Me)return!1;if(g.key==="Escape")return I||Se||pe?(I=null,Se=!1,pe=null,he().then(z=>T&&s(z)),!0):(Ie(),!0);if(J)return!1;switch(g.key){case"ArrowDown":i(N+1);break;case"ArrowUp":i(N-1);break;case"Enter":I&&A[N]?.id===I?$t():O();break;case"r":case"R":$t();break;case"s":case"S":W();break;case"a":case"A":B();break;case"m":case"M":Ie();break;default:return!1}return!0}}),o?.has?.("review")&&setTimeout(()=>{a.active()||w()},700),{open:w,close:Ie,isOpen:()=>!!T,compose:We,submit:async()=>{T||await w(),Se=!0,T&&s(await he())}}}me();fe();function Ga({now:t=Date.now,keep:o=200}={}){let a=t(),c=[],d=null;function p(f,m){let v={t:((t()-a)/1e3).toFixed(3),kind:f,msg:m};return c.push(v),c.length>o&&c.shift(),d?.(v),v}return{log:p,get entries(){return c.slice()},onEntry(f){d=f}}}me();fe();var jd=["auto","centered","pinned","top","split","split-flip"];function Gd({autoPins:t,hasSplitPair:o}){return jd.filter(a=>(a!=="pinned"||!t)&&(a!=="split-flip"||o))}function Kd(t,o,a){if(!t.length)return null;let c=Math.max(0,t.indexOf(o));return t[(c+a+t.length)%t.length]}function Ka({slideOf:t,sectionAt:o,describe:a,available:c,unavailableMessage:d,apply:p,relayout:f,post:m,toast:v,debugLog:k,schedule:S=setTimeout,cancel:P=clearTimeout,delay:T=600}){let A=null,N=null;function I(){P(N);let Oe=A;A=null,Oe&&m({slide:Oe.slide,layout:Oe.name}).then(()=>k("layout",`slide ${Oe.slide}: ${Oe.name} \u2192 saved to file`)).catch(()=>v("layout save failed \u2014 is the dev server still up?",2200))}function Se(Oe=t()){let re=o(Oe);return re?Gd(a(re)):[]}function pe(Oe){if(!c()){v(d(),3200);return}let re=t(),ce=o(re);if(!ce)return;let Me=Kd(Se(re),ce.getAttribute("data-layout")||"auto",Oe);if(!Me)return;p(ce,Me),A&&A.slide!==re&&I(),A={slide:re,name:Me},P(N),N=S(I,T);let ze=f(ce,re);v(ze?`layout: ${Me} \u2014 fights this slide's own column flexbox; pick one`:`layout: ${Me}`),k("layout",`slide ${re}: ${Me}`)}return{ring:Se,cycle:pe,flush:I}}me();fe();function Wa({commands:t,query:o="",totalSlides:a=0,makeGotoRow:c,makeSearchRow:d}){let p=String(o).toLowerCase(),f=t.filter(v=>!p||(v.label+" "+(v.alias??"")).toLowerCase().includes(p)),m=String(o).trim().match(/^(?:goto\s*)?(\d+)$/i);if(m&&c){let v=Math.max(1,Math.min(parseInt(m[1],10),a));f.unshift(c(v,a))}return p&&!m&&d&&!f.some(v=>v.label.toLowerCase().startsWith(p))&&f.push(d(o)),f}var Wd={transition:"fade",hash:!0,controls:!0,slideNumber:!1,width:1280,height:720,pinTitles:!0},Ps=99,Vd=18,Va=6,Zd="ul, ol, svg, pre, table, .terminal, img, .columns",Dr=null;function es(t,o){Ko(t,o),Dr&&Dr._rescanFor(t)}function Jd(t){let o=getComputedStyle(t).position;return o==="absolute"||o==="fixed"}function Yd(t){for(let o of t.children)if(!o.matches("aside, script, style, .decklight-hero-logo, .slide-bg")){if(o.matches("h1, h2"))return o;if(!Jd(o))return null}return null}function Xd(t,o){if(!o||t.getAttribute("data-subtitle")==="none")return null;let a=o.nextElementSibling;return a&&a.matches("p")&&!a.hasAttribute("data-build")?(a.classList.add("subtitle"),a):t.querySelector(":scope > p.subtitle")}function Ya(t){return t.pinTitles===!0?Ps:typeof t.pinTitles=="number"&&isFinite(t.pinTitles)?t.pinTitles:null}function Xa(t,o){let a=Ya(o),c=t.getAttribute("data-pin");if(c==="none")return null;if(c!==null&&c!==""){let p=parseFloat(c);return isFinite(p)?p:a??Ps}return c===""?a??Ps:a===null?null:[...t.querySelectorAll(Zd)].some(p=>!p.closest("aside")&&!p.closest(".decklight-hero-logo"))?a:null}function Is(t,o){t.forEach(a=>{let c=Yd(a),d=a.getAttribute("data-layout"),p;if(d==="pinned"){let k=parseFloat(a.getAttribute("data-pin"));p=isFinite(k)?k:Ya(o)??Ps}else d==="centered"||d==="top"?p=null:p=Xa(a,o);let f=Xd(a,c);if(a.querySelector(":scope > .pin-title")?.classList.remove("pin-title"),a.querySelector(":scope > .pin-subtitle")?.classList.remove("pin-subtitle"),p===null||!c){a.removeAttribute("data-pinned"),a.style.removeProperty("--pin-y"),a.style.removeProperty("--pin-sub-y"),a.style.removeProperty("--pin-space");return}c.classList.add("pin-title"),a.setAttribute("data-pinned",""),a.style.setProperty("--pin-y",p+"px"),a.classList.add("pin-measure");let m=c.offsetHeight||0,v=p+m;f&&(f.classList.add("pin-subtitle"),a.style.setProperty("--pin-sub-y",Math.round(v+Va)+"px"),v+=Va+(f.offsetHeight||0)),a.classList.remove("pin-measure"),a.style.setProperty("--pin-space",Math.round(v+Vd)+"px")})}function Qa(t){return[...t.children].filter(o=>!o.matches("h1, h2, .subtitle, aside, script, style, .decklight-hero-logo, .slide-bg"))}function Za(t){t.forEach((o,a)=>{if(o.querySelectorAll(":scope > .split-columns, :scope > .split-footer").forEach(d=>d.classList.remove("split-columns","split-footer")),!/^split/.test(o.getAttribute("data-layout")||"")){o.removeAttribute("data-split-conflict");return}let c=Qa(o);if(Qd(o,c,a+1),c.length===1&&c[0].matches("ul, ol")){c[0].classList.add("split-columns");return}for(let d of c.slice(2))d.classList.add("split-footer")})}function Qd(t,o,a){let c=o.some(p=>{let f=getComputedStyle(p);return/flex$/.test(f.display)&&f.flexDirection.startsWith("row")}),d=t.hasAttribute("data-split-conflict");t.toggleAttribute("data-split-conflict",c),c&&!d&&console.warn(`Decklight: slide ${a} 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 Ao(t,o){if(!t)return;let a=[t,...t.querySelectorAll("pre, table, svg, ul, ol, blockquote")].some(d=>d.scrollHeight>d.clientHeight+2&&getComputedStyle(d).overflowY!=="visible"&&!d.closest(".terminal")&&!d.hasAttribute("data-scroll-ok")),c=t.hasAttribute("data-overflow");t.toggleAttribute("data-overflow",a),a&&!c&&console.warn(`Decklight: slide ${o} content overflows and is clipped \u2014 reduce content or font size`)}function eu(t){t.querySelectorAll("section[data-markdown]").forEach((o,a)=>{o.setAttribute("data-markdown-removed","");let c=[...t.children].indexOf(o)+1||a+1;console.warn(`Decklight: slide ${c} 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 _o(t){return(t||"").replace(/^#/,"")}function Ja(t){let o=_o(t).match(/^\/(\d+)(?:\/(\d+))?/);return o?{slide:parseInt(o[1],10),step:o[2]?parseInt(o[2],10):0}:null}function el(t={}){let o=new URLSearchParams(location.search),a={...Wd,...t};o.has("embedded")&&(a.controls=!1);let c=o.has("print"),d=o.has("all"),p=o.get("print")||"",f=Ga(),m=null,v=(x,q)=>f.log(x,q),k=document.querySelector(".decklight");if(!k)throw new Error("Decklight: no .decklight element found");let S=la(),P=Fa({config:a,root:k,embedded:o.has("embedded"),sectionsOf:()=>te._sections,slideOf:()=>te.state.slide,navigate:x=>{location.href=x}}),T=P.playlist,A=P.index,N=P.hasMarkers,I=x=>P.gotoModule(x),Se=x=>P.navigateToModule(x),pe=200,Oe=4,re=[],ce=null,Me=null;function ze(){return re}function Ve(x){re.push({at:new Date,text:String(x)}),re.length>pe&&re.shift(),Me&&ln()}function $e(x,q=3200){if(Ve(x),c)return;ce||(ce=document.createElement("div"),ce.className="decklight-messages",k.appendChild(ce));let D=document.createElement("div");for(D.className="decklight-toast",D.textContent=x,ce.appendChild(D),requestAnimationFrame(()=>D.classList.add("show"));ce.children.length>Oe;)ce.firstChild.remove();setTimeout(()=>{D.classList.remove("show"),setTimeout(()=>D.remove(),260)},q)}let _e=Da({root:k,printMode:c,params:o,toast:$e,debugLog:v,overlays:S,deck:()=>te}),Ze=ua({root:k,config:a,params:o,toast:$e,debugLog:v,overlays:S,deck:()=>te,editmode:()=>Tt}),{applyTheme:bt,currentTheme:_,cycleTheme:je,cancelCyclePending:gt,rollTheme:ut,saveGeneratedTheme:Q}=Ze,j=null,oe=0,he="",le=[],Re,Y=!1,s=null;function i(){return za({sections:te._sections,modules:T?.modules??[],skipModule:A})}function O(){let x=j.querySelector(".tp-list");if(le=Ua(j.__index,he),x.textContent="",le.forEach((D,ve)=>{let et=document.createElement("div");et.className="tp-row"+(D.slide===te.state.slide?" tp-current":"")+(D.href?" tp-module":""),et.textContent=D.href?`\u25B8 ${D.title} \u2014 module`:`${D.slide} \xB7 ${D.title}`,et.addEventListener("mouseenter",()=>B(ve,!1)),et.addEventListener("click",()=>{B(ve,!0),$t()}),x.appendChild(et)}),!le.length){let D=document.createElement("div");D.className="tp-none",D.textContent="no matches",x.appendChild(D)}let q=j.querySelector(".tp-filter");q.textContent=he||(T?"type to find a slide or module\u2026":"type to find a slide\u2026"),q.classList.toggle("tp-active",!!he)}function Ue(x,q){let D=q.href??location.pathname,ve=q.slide??1;if(x.dataset.doc!==D){x.dataset.doc=D,Y=!1,x.addEventListener("load",()=>{if(Y=!0,s&&j){let et=s;s=null,Ue(x,et)}},{once:!0}),x.src=D+Ze.previewQuery()+"#/"+ve+"/0";return}if(!Y){s=q;return}x.contentWindow?.postMessage({__decklightPreview:{goto:[ve,0]}},"*")}function B(x,q){if(!le.length)return;oe=En(j.querySelectorAll(".tp-row"),x,"tp-selected");let D=le[oe];j.querySelector(".tp-caption").textContent=D.href?`module \u2014 ${D.title} (${D.href})`:`slide ${D.slide} \u2014 ${D.title}`,clearTimeout(Re);let ve=j.querySelector("iframe");q?Ue(ve,D):Re=setTimeout(()=>Ue(ve,D),60)}function Le(x){he=x,O(),le.length?B(0,!1):j.querySelector(".tp-caption").textContent="no match"}function $t(){let x=le[oe];if(Ae(),!!x){if(x.href)return Se(x.module);te.goto(x.slide,0)}}function W(){if(j)return Ae();Ze.closePicker(),Tt.restore.close(),he="",j=document.createElement("div"),j.className="decklight-theme-picker decklight-finder",j.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>',j.__index=i(),O(),Ht(j,Ae),k.appendChild(j),B(Math.max(0,le.findIndex(x=>x.slide===te.state.slide)),!0)}function Ae(){clearTimeout(Re),j?.remove(),j=null}let ee=null,We=0,w="",Ie=[],g=()=>(te._sections??[]).some(x=>x.hasAttribute("data-hidden")),J=()=>!!te._sections?.[te.state.slide-1]?.hasAttribute("data-hidden");function z(){let x=new URL(location.href);d?x.searchParams.delete("all"):x.searchParams.set("all",""),location.href=x.href}async function Ce(x,q){let D=te._sections?.[x-1];if(D){try{let ve=await fetch(Tt.base()+"/edit/hidden",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({slide:x,hidden:q})});if(!ve.ok)throw new Error(String(ve.status))}catch(ve){$e(`could not ${q?"hide":"unhide"} slide ${x} \u2014 ${ve.message}`);return}if(D.toggleAttribute("data-hidden",q),$e(q?`slide ${x} hidden \u2014 the audience will not see it (?all shows it)`:`slide ${x} shown again`),q&&!d&&te.state.slide===x){let ve=te._visibleFrom(x+1,1)??te._visibleFrom(x-1,-1);ve!=null&&te.goto(ve,0)}}}function ye(){let x=te.__speakerWin;return x&&!x.closed?x:te.__speakerWin=Ts(te)}function Pe(){let x=D=>typeof D=="function";return[{label:"Find slide\u2026",hint:"G",alias:"search grep goto module chapter jump",run:()=>{W(),w&&Le(w)}},{label:"Comments\u2026",hint:"M",alias:"feedback remarks reviewer notes critique review read",run:()=>vn.open()},{label:"Leave a comment\u2026",hint:"\u21E7M",alias:"comment note remark feedback add write say",run:()=>vn.compose()},{label:"Submit review\u2026",alias:"send review push comments submit feedback",run:()=>vn.submit()},{label:"History\u2026 (dev)",hint:"H",alias:"restore version rollback revert back git log commits unpushed push remote when changed",run:()=>Tt.history.open()},{label:"Go to slide\u2026",hint:"#",alias:"goto",keepOpen:!0,run:()=>{w="goto ",X()}},{label:"Theme\u2026",hint:"T",run:Ze.openPicker},{label:"Cycle theme",hint:", \xB7 .",run:()=>je(1)},{label:"Generate a theme",hint:"\u2303T",run:ut},Ze.hasGenerated()&&{label:"Save the generated theme\u2026",hint:"\u2303\u21E7T",run:()=>Q()},Tt.available()&&{label:"Browse marketplace themes\u2026",alias:"marketplace install add third-party download catalog",run:Ze.browse},...Tt.wizards().map(D=>({label:`Configure ${D.title}\u2026 (dev)`,alias:"engine wizard setup api key credential token marketplace",run:()=>Tt.wizard(D.qualified)})),{label:"Font\u2026",hint:"[ \xB7 ]",run:Ke},{label:"Cycle slide layout (dev)",hint:"L",alias:"pin pinned centered top auto split columns two sides arrange",run:()=>qt(1)},{label:"Undo deck edit (dev)",hint:"Z",alias:"revert back history",run:()=>Gn("undo")},{label:"Redo deck edit (dev)",hint:"\u21E7Z",alias:"forward history repeat",run:()=>Gn("redo")},{label:"Ask agent\u2026 (dev)",hint:"A",alias:"ai claude codex bob gemini prompt edit",run:Cn},{label:"Messages",hint:"`",alias:"log toast notifications warnings why voice stopped history",run:cn},{label:`Narration ${Ot.status().paused?"resume":Ot.status().narrating?"pause":"play"}`,hint:"\u23B5",alias:"play pause resume voice narration speak start stop",run:()=>Ot.playPause()},{label:"Narration\u2026",hint:"V",alias:"voice audio track picker settings",run:()=>gn("tracks")},{label:"Live voice\u2026",hint:"V",alias:"tts synthesize tone gemini",run:()=>gn("voices")},{label:"Character\u2026",hint:"V",alias:"avatar lipsync face talking head visemes",run:()=>gn("character")},{label:"Record this deck\u2026",hint:"V",alias:"record narrate microphone mic voice wav offline batch teleprompter",run:()=>gn("record")},{label:`Character solo ${Yn.solo?"off":"on"}`,alias:"centre center stage narrator only fullscreen avatar",run:()=>Ot.applySolo(!Yn.solo)},{label:"Voice faster",hint:">",alias:"speed rate playback",run:()=>an(.25)},{label:"Voice slower",hint:"<",alias:"speed rate playback",run:()=>an(-.25)},{label:"Speaker view",hint:"S",run:()=>{let D=te.__speakerWin;D&&!D.closed?D.__decklightSpeakerToggle?.():te.__speakerWin=Ts(te)}},{label:"Overview",hint:"O",run:st},{label:"Blackout",hint:"B",run:Mt},{label:`Pen ${Sn.annotator?.tool==="pen"?"off":"on"} \u2014 draw on the slide`,hint:"W",alias:"ink annotate draw scribble marker highlight",run:()=>jn("pen")},{label:`Laser pointer ${Sn.annotator?.tool==="laser"?"off":"on"}`,hint:"\u21E7W",alias:"ink dot glow point at",run:()=>jn("laser")},{label:"Debug log",hint:"D",alias:"console events state",run:Bt},{label:`Captions ${Ot.status().captionsOn?"off":"on"}`,hint:"C",alias:"cc subtitles closed caption",run:Qn},{label:`Clock ${Sn.status().clockOn?"off":"on"}`,alias:"time elapsed timer talk wall watch clock",run:Un},{label:"Commit\u2026",hint:"K",alias:"git save commit message history",run:()=>Tt.commit.open()},{label:`Progress bar ${Sn.status().progressOn?"off":"on"}`,hint:"J",alias:"bar bottom edge position how far through shape of the talk",run:Hn},{label:"Transcript\u2026",alias:"notes script export text markdown spoken",run:Fr},{label:"Edit speaker notes\u2026",alias:"edit mode notes write right-click background",run:$n},{label:`Element edit mode ${Tt.elementEditOn()?"off":"on"} (dev)`,hint:"E",alias:"right-click remove delete html content build animation entrance effect context menu",run:Ct},{label:"Fullscreen",hint:"F",run:()=>H()},{label:"Print view (all slides, new tab)",hint:"",run:()=>window.open(location.pathname+"?print")},{label:"Print with notes (one slide per page, new tab)",alias:"pdf print speaker notes script handout pages",run:()=>window.open(location.pathname+"?print=notes")},{label:"Print handout (three per page, new tab)",alias:"pdf print handout thumbnails audience note-taking lines",run:()=>window.open(location.pathname+"?print=handout")},(d||g())&&{label:`Hidden slides ${d?"skip":"show"}`,alias:"all cut backup skipped unhide reveal present hidden \u2298",run:z},Tt.available()&&{label:`${J()?"Unhide":"Hide"} this slide (dev)`,alias:"hidden hide skip cut backup keep out of the talk unhide show",run:()=>Ce(te.state.slide,!J())},{label:"Rehearse timings\u2026 (speaker view)",alias:"rehearsal timing time each slide record pace plan stopwatch",run:()=>{ye()?.__decklightSpeakerRec?.(!0)}},{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:Jn},{label:"Welcome to Decklight",alias:"onboarding intro getting started first run tour what is this help me",run:_e.showWelcome},{label:`Tips ${_e.status().tipsOn?"off":"on"}`,alias:"hints teach shortcuts learn stop showing quiet",run:()=>_e.setTips(!_e.status().tipsOn)},_e.status().tipsLeft<Xr.length&&{label:"Reset tips",alias:"hints again start over show all unsee replay",run:_e.resetTips}].filter(Boolean).filter(D=>x(D.run))}function X(){let x=ee.querySelector(".narr-card");x.textContent="",Ie=Wa({commands:Pe(),query:w,totalSlides:te.state.totalSlides,makeGotoRow:(D,ve)=>({label:`Go to slide ${D} / ${ve}`,hint:"\u23CE",run:()=>te.goto(D,0)}),makeSearchRow:D=>({label:`Search slides for \u201C${D}\u201D`,hint:"",run:()=>{W(),Le(D)}})});let q=document.createElement("div");if(q.className="pal-input"+(w?" tp-active":""),q.textContent=w||"type a command\u2026",x.appendChild(q),Ie.forEach((D,ve)=>{let et=document.createElement("div");et.className="narr-row pal-row";let St=document.createElement("span");if(St.textContent=D.label,et.appendChild(St),D.hint){let Jt=document.createElement("span");Jt.className="pal-kbd",Jt.textContent=D.hint,et.appendChild(Jt)}et.addEventListener("mouseenter",()=>Xe(ve)),et.addEventListener("click",()=>{Xe(ve),mt()}),x.appendChild(et)}),!Ie.length){let D=document.createElement("div");D.className="tp-none",D.textContent="no matching command",x.appendChild(D)}Xe(0)}function Xe(x){Ie.length&&(We=En(ee.querySelectorAll(".pal-row"),x,"narr-sel"))}function mt(){let x=Ie[We];x&&(x.keepOpen||ke(),x.run())}function ft(){if(ee)return ke();j&&Ae(),Tt.restore.close(),w="",ee=document.createElement("div"),ee.className="decklight-narr decklight-palette",ee.innerHTML='<div class="narr-card" role="listbox" aria-label="Commands"></div>',Ht(ee,ke),k.appendChild(ee),X()}function ke(){ee?.remove(),ee=null}let ue=null,ie=0;function Ke(){if(ue)return Je();ue=document.createElement("div"),ue.className="decklight-narr decklight-font-picker",ue.innerHTML='<div class="narr-card" role="listbox" aria-label="Fonts"></div>';let x=ue.querySelector(".narr-card");tt.forEach(([q],D)=>{let ve=document.createElement("div");ve.className="narr-row"+(D===jt?" narr-cur":""),ve.textContent=q,D>0&&(ve.style.fontFamily=tt[D][1]),ve.addEventListener("mouseenter",()=>rt(D)),ve.addEventListener("click",()=>{en(D),Je()}),x.appendChild(ve)}),Ht(ue,Je),k.appendChild(ue),rt(jt)}function rt(x){ie=En(ue.querySelectorAll(".narr-row"),x,"narr-sel")}function Je(){ue?.remove(),ue=null}Ze.restoreSaved();let tt=[["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"]],Rt="decklight-font:"+location.pathname,jt=0;function en(x,{silent:q=!1,remeasure:D=!0}={}){jt=(x%tt.length+tt.length)%tt.length;let[ve,et]=tt[jt];if(et?(k.style.setProperty("--font-body",et),k.style.setProperty("--font-heading",et)):(k.style.removeProperty("--font-body"),k.style.removeProperty("--font-heading")),!o.has("embedded"))try{fn(Rt,et?jt:null)}catch{}D&&(Is(te._sections,a),Ao(te._sections[te.state.slide-1],te.state.slide)),q||$e(`font: ${ve}`),v("font",ve)}function Pt(x){en(jt+x)}try{let x=parseInt(kn(Rt)??"",10);x>0&&x<tt.length&&en(x,{silent:!0,remeasure:!1})}catch{}function sn(x){if(!x)return null;if(x.startsWith("#")){let D=document.querySelector(x);if(!D)return null;let ve=D.cloneNode(!0);return ve.removeAttribute("id"),ve.style.removeProperty("display"),ve}if(x.trim().startsWith("<")){let D=document.createElement("div");return D.innerHTML=x,D.firstElementChild}let q=document.createElement("img");return q.src=x,q.alt="",q}let Gt=null;Ze.updateCanvas();let At=k.querySelector(":scope > .decklight-stage");if(!At){for(At=document.createElement("div"),At.className="decklight-stage";k.firstChild;)At.appendChild(k.firstChild);k.appendChild(At)}if(At.style.width=a.width+"px",At.style.height=a.height+"px",a.logo&&(a.logo.src||a.logo.onLight||a.logo.onDark)){Gt=document.createElement("div"),Gt.className="decklight-logo",Gt.setAttribute("data-pos",a.logo.position||"bottom-left"),a.logo.height&&Gt.style.setProperty("--logo-h",a.logo.height+"px");for(let[x,q]of[["src","on-any"],["onLight","on-light"],["onDark","on-dark"]]){let D=sn(a.logo[x]);if(!D)continue;let ve=document.createElement("span");ve.className=q,ve.appendChild(D),Gt.appendChild(ve)}k.appendChild(Gt)}function on(x){Gt&&x.forEach(q=>{if(!q.hasAttribute("data-logo")||q.querySelector(":scope > .decklight-hero-logo"))return;let D=document.createElement("div");D.className="decklight-hero-logo";let ve=parseFloat(q.getAttribute("data-logo"));ve&&D.style.setProperty("--hero-logo-h",ve+"px"),D.innerHTML=Gt.innerHTML,q.prepend(D)})}eu(At),ei(At),di(At),Jo(At),sa(At,es);let un=Ka({slideOf:()=>te.state.slide,sectionAt:x=>te._sections[x-1],describe:x=>({autoPins:Xa(x,a)!==null,hasSplitPair:Qa(x).length>1}),available:()=>Tt.available(),unavailableMessage:()=>Fn("layout",location),apply:(x,q)=>{q==="auto"?x.removeAttribute("data-layout"):x.setAttribute("data-layout",q)},relayout:(x,q)=>(Is(te._sections,a),Za(te._sections),Ao(x,q),x.hasAttribute("data-split-conflict")),post:x=>fetch(Tt.base()+"/edit/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(x)}).then(q=>{if(!q.ok)throw new Error(q.status)}),toast:$e,debugLog:v}),qt=x=>un.cycle(x),pn=x=>un.ring(x),te={root:k,stage:At,config:a,_sections:[],_records:[],state:{slide:1,step:0,totalSlides:0},_listeners:new Map,_scale:1,on(x,q){return this._listeners.has(x)||this._listeners.set(x,new Set),this._listeners.get(x).add(q),this},off(x,q){return this._listeners.get(x)?.delete(q),this},_emit(x,q){(this._listeners.get(x)||[]).forEach(D=>D(q)),k.dispatchEvent(new CustomEvent("decklight:"+x,{detail:q}))},sync(){this._sections=[...At.querySelectorAll(":scope > section")],this._sections.forEach((q,D)=>q.setAttribute("data-slide-index",String(D+1))),Zo(At,a.concepts),on(this._sections),Ca(this._sections,{printMode:c}),Is(this._sections,a),Za(this._sections),this._records=this._sections.map(q=>Xs(q)),this.state.totalSlides=this._sections.length,this.state.slide=Math.min(this.state.slide,this.state.totalSlides||1);let x=this._records[this.state.slide-1];x&&(this.state.step=Math.min(this.state.step,x.groups.length)),Tn(c?this._sections:[this._sections[this.state.slide-1]])},_rescanFor(x){let q=x.closest("section"),D=this._sections.indexOf(q);if(D!==-1){if(this._records[D]=Xs(q),c){ir(this._records[D],this._records[D].groups.length);return}D===this.state.slide-1?(this.state.step=Math.min(this._requestedStep??this.state.step,this._records[D].groups.length),this._requestedStep=null,_t(()=>ir(this._records[D],this.state.step)),this._updateHash(!1)):_t(()=>ir(this._records[D],0)),this._notify()}},_stepLabels(x){let q=this._records[x];return q?Wo(q):[]},_hidden(x){return!d&&!!this._sections[x-1]?.hasAttribute("data-hidden")},_visibleFrom(x,q){for(let D=x;D>=1&&D<=this.state.totalSlides;D+=q)if(!this._hidden(D))return D;return null},next(){let x=this._records[this.state.slide-1];if(x&&this.state.step<x.groups.length){this.goto(this.state.slide,this.state.step+1,{direction:"fwd"});return}let q=this._visibleFrom(this.state.slide+1,1);q?this.goto(q,0,{direction:"fwd"}):I(1)},prev(){if(this.state.step>0){this.goto(this.state.slide,this.state.step-1,{direction:"back"});return}let x=this._visibleFrom(this.state.slide-1,-1);x?this.goto(x,this._records[x-1].groups.length,{direction:"back"}):I(-1)},goto(x,q=0,D={}){if(x=Math.max(1,Math.min(x,this.state.totalSlides)),this._hidden(x)){let Jt=D.direction==="back"?-1:1,hn=this._visibleFrom(x,Jt)??this._visibleFrom(x,-Jt);if(hn==null)return;x=hn,q=Jt<0?this._records[x-1]?.groups.length??0:0}let ve=this._records[x-1];this._requestedStep=q,q=Math.max(0,Math.min(q,ve?ve.groups.length:0));let et=x===this.state.slide;if(et&&q===this.state.step&&!D.force)return;let St=D.direction||(x>this.state.slide||et&&q>this.state.step?"fwd":"back");!et||D.force?(this._activateSlide(x,St,D),this.state.slide=x,this.state.step=q,_t(()=>ir(ve,q)),this._emit("slide",{slide:x,total:this.state.totalSlides,direction:St}),Tn([this._sections[x-1]])):(this.state.step=q,ir(ve,q),this._emit("build",{slide:x,index:q,total:ve.groups.length,direction:St})),this._updateChrome(),this._updateHash(!et),this._notify()},_activateSlide(x,q,D={}){let ve=this._sections[this.state.slide-1],et=this._sections[x-1];if(k.classList.toggle("has-hero-logo",et?.hasAttribute("data-logo")??!1),ve===et){et.classList.add("active");return}let St=!ve||!ve.classList.contains("active"),Jt=ve&&et&&!St&&ve.hasAttribute("data-auto-animate")&&et.hasAttribute("data-auto-animate")&&Math.abs(this._sections.indexOf(et)-this._sections.indexOf(ve))===1;if(this._sections.forEach(wr=>wr.classList.remove("active","entering","leaving","dir-fwd","dir-back","tr-none","tr-fade","tr-slide","tr-scale","tr-flip")),et.classList.add("active"),St||c)return;if(Jt){ve.classList.add("leaving"),ve.style.visibility="hidden",et.style.visibility="hidden",et.offsetWidth,et.style.visibility="",ai(ve,et,this._scale),ve.classList.remove("leaving"),ve.style.visibility="";return}let hn=si(et.getAttribute("data-transition"),this.config.transition),bn=oi(hn,q);if(!bn)return;et.classList.add(...bn.entering),ve.classList.add(...bn.leaving);let In=ws(getComputedStyle(et).getPropertyValue("--transition-duration"),350);setTimeout(()=>{ve.classList.remove(...bn.leaving),et.classList.remove(...bn.entering)},In+60)},_updateChrome(){if(Ee){let x=this._records[this.state.slide-1],q=x?x.groups.length:0,D=this.state.totalSlides<=1?1:(this.state.slide-1+(q?this.state.step/(q+1):0))/(this.state.totalSlides-1);Ee.style.width=(Math.min(D,1)*100).toFixed(2)+"%"}if(we){let x=this.config.slideNumber?this.config.slideNumber==="n/N"?`${this.state.slide} / ${this.state.totalSlides}`:String(this.state.slide):"";if(we.textContent=x,P.any){let q=P.title(),D=document.createElement("span");D.className="mod",D.textContent=q,we.prepend(D)}}},_updateHash(x){!this.config.hash||c||(C=C||!!x,!Yt&&(Yt=setTimeout(()=>{Yt=null,ne()},tn)))},_notify(){this.__notifySpeaker&&this.__notifySpeaker()}};function Kt(x,q){let D=document.createElement("a");D.href=x,D.download=q,document.body.appendChild(D),D.click(),D.remove()}function _t(x){k.classList.add("decklight-no-anim"),x(),k.offsetWidth,k.classList.remove("decklight-no-anim")}let tn=90,Yt=null,C=!1;function ne(x=!0){if(!te||!a.hash||c)return;let q=`#/${te.state.slide}/${te.state.step}`,D=C;if(C=!1,"#"+_o(location.hash)!==q){wn=!0;try{D?history.pushState(null,"",q):history.replaceState(null,"",q)}catch{}setTimeout(()=>{wn=!1}),x&&"#"+_o(location.hash)!==q&&(C=D,requestAnimationFrame(()=>ne(!1)))}}let Ee=null,we=null;if(a.controls&&!c){let x=document.createElement("div");x.className="decklight-controls",x.innerHTML=`
|
|
336
387
|
<button class="decklight-arrow prev" aria-label="Previous">\u2039</button>
|
|
337
|
-
<button class="decklight-arrow next" aria-label="Next">\u203A</button>`,
|
|
388
|
+
<button class="decklight-arrow next" aria-label="Next">\u203A</button>`,k.appendChild(x),x.querySelector(".prev").addEventListener("click",()=>te.prev()),x.querySelector(".next").addEventListener("click",()=>te.next())}let Ne={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>'},Ge=null,M=null;function H(){let x=k||document.documentElement;document.fullscreenElement?document.exitFullscreen?.():x.requestFullscreen?.()?.catch?.(()=>{})}document.addEventListener("fullscreenchange",()=>{Ge&&(Ge.innerHTML=document.fullscreenElement?Ne.unfull:Ne.full)});function K(){if(!M)return;let x=Ot.status().narrating;M.innerHTML=x?Ne.sound:Ne.mute,M.setAttribute("aria-label",x?"Mute narration":"Play narration"),M.setAttribute("aria-pressed",String(x))}(a.slideNumber||T||N)&&!c&&(we=document.createElement("div"),we.className="decklight-slide-number",(T||N)&&(we.title="G \u2014 find a slide or module",we.style.cursor="pointer",we.addEventListener("click",()=>W())),k.appendChild(we));let se=null,qe=0;function Qe(){return getComputedStyle(se).gridTemplateColumns.split(" ").length||1}function Fe(x){let q=se.querySelectorAll(".ov-cell");qe=Math.max(0,Math.min(x,q.length-1)),q.forEach((D,ve)=>D.classList.toggle("ov-selected",ve===qe)),q[qe]?.scrollIntoView({block:"nearest"})}function ge(){let x=qe+1;st(),te.goto(x,0,{force:!0})}function Be(){if(!se)return;let x=se.querySelector(".ov-cell");if(!x)return;se.style.gridAutoRows=Math.round(x.clientWidth*a.height/a.width)+"px";let q=x.clientWidth/a.width;se.querySelectorAll(".ov-frame").forEach(D=>{D.style.transform=`scale(${q})`})}function st(){if(se){window.removeEventListener("resize",Be),se.remove(),se=null,k.classList.remove("decklight-overview");return}se=document.createElement("div"),se.className="decklight-overview-grid",te._sections.forEach((x,q)=>{let D=document.createElement("div");D.className="ov-cell"+(q===te.state.slide-1?" ov-current":"")+(x.hasAttribute("data-hidden")?" ov-hidden":"");let ve=document.createElement("div");ve.className="ov-frame",ve.style.width=a.width+"px",ve.style.height=a.height+"px";let et=x.cloneNode(!0);et.classList.add("active","ov-clone"),et.querySelectorAll("aside.notes, aside.rehearse").forEach(Jt=>Jt.remove()),et.querySelectorAll("input, button, select, textarea").forEach(Jt=>{Jt.removeAttribute("name"),Jt.disabled=!0}),ve.appendChild(et),D.appendChild(ve);let St=document.createElement("span");St.className="ov-num",St.textContent=String(q+1),D.appendChild(St),D.addEventListener("click",()=>{st(),te.goto(q+1,0,{force:!0})}),se.appendChild(D)}),k.classList.add("decklight-overview"),k.appendChild(se),Be(),Fe(te.state.slide-1),window.addEventListener("resize",Be)}let wt=null;function Mt(){if(wt){wt.remove(),wt=null;return}wt=document.createElement("div"),wt.className="decklight-blackout",k.appendChild(wt)}let pt=null;function nt(){let x=te._records?.[te.state.slide-1],q=Ot.status(),D=q.live?`\u26A1 ${q.voice} \xB7 ${q.tone}`:q.track?`\u{1F50A} ${q.track.label}`:"none";return`slide ${te.state.slide}/${te.state.totalSlides} \xB7 step ${te.state.step}/${x?x.groups.length:0} \xB7 theme ${_()??"\u2014"} \xB7 narration ${q.narrating?q.paused?"paused":"on":"off"} (${D})`+(q.rate!==1?` \xB7 ${q.rate}\xD7`:"")+(q.spend>0?` \xB7 tts ~$${q.spend.toFixed(4)}`:"")}function vt(x){let q=document.createElement("div");q.className="dbg-row dbg-"+x.kind;for(let[D,ve]of[["dbg-t",x.t],["dbg-k",x.kind],["dbg-m",x.msg]]){let et=document.createElement("span");et.className=D,et.textContent=ve,q.appendChild(et)}m.querySelector(".dbg-log").appendChild(q)}function L(){let x=m?.querySelector(".dbg-state");x&&(x.textContent=nt())}function Bt(){if(m){m.remove(),m=null,f.onEntry(null);return}m=document.createElement("div"),m.className="decklight-debug",m.innerHTML='<div class="dbg-head">debug log \u2014 D closes</div><div class="dbg-state"></div><div class="dbg-log"></div>',k.appendChild(m),f.entries.forEach(vt),L();let x=m.querySelector(".dbg-log");x.scrollTop=x.scrollHeight,f.onEntry(q=>{vt(q),L();let D=m.querySelector(".dbg-log");D.scrollTop=D.scrollHeight})}function ln(){let x=Me?.querySelector(".msg-log");if(x){if(x.innerHTML="",!re.length){let q=document.createElement("div");q.className="msg-empty",q.textContent="no messages yet",x.appendChild(q);return}re.forEach(({at:q,text:D})=>{let ve=document.createElement("div");ve.className="msg-row";let et=document.createElement("span");et.className="msg-time",et.textContent=q.toLocaleTimeString([],{hour12:!1});let St=document.createElement("span");St.className="msg-text",St.textContent=D,ve.append(et,St),x.appendChild(ve)}),x.scrollTop=x.scrollHeight}}function cn(){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>',k.appendChild(Me),ln()}te.on("ready",x=>v("ready",`${x.slides} slides${x.print?" \xB7 print":""}`)),te.on("slide",x=>{v("slide",`\u2192 ${x.slide}/${x.total} (${x.direction})`),L()}),te.on("build",x=>{v("build",`slide ${x.slide} step ${x.index}/${x.total} (${x.direction})`),L()}),window.addEventListener("error",x=>v("error",String(x.message)));function Jn(){if(pt){pt.remove(),pt=null;return}pt=document.createElement("div"),pt.className="decklight-help",pt.innerHTML=`<div class="help-card"><h3>Keyboard</h3><table>
|
|
338
389
|
<tr><td>\u2192 / PageDown</td><td>next build / slide</td></tr>
|
|
339
390
|
<tr><td>\u23B5</td><td>pause / resume the voice while it is speaking \u2014 otherwise it advances</td></tr>
|
|
340
391
|
<tr><td>\u2190 / PageUp</td><td>previous</td></tr>
|
|
@@ -367,16 +418,16 @@ ${ut.text||"(nothing)"}`:`cannot show what it said \u2014 ${ut.why}`))}I===f.id&
|
|
|
367
418
|
<tr><td>A</td><td>ask an AI agent to edit the deck (author mode)</td></tr>
|
|
368
419
|
<tr><td>\u2303T</td><td>generate a theme (repeat to re-roll)</td></tr>
|
|
369
420
|
<tr><td>\u2303\u21E7T</td><td>save the generated theme</td></tr>
|
|
370
|
-
<tr><td>?</td><td>this help</td></tr></table></div>`,
|
|
371
|
-
`){this._lineFeed();continue}if(d==="\r"){this.col=0;continue}if(d==="\b"){this.col=Math.max(0,this.col-1);continue}if(d===" "){this.col=(Math.floor(this.col/8)+1)*8;continue}d!=="\x07"&&(d<" "&&d!==" "||this._putChar(d))}}_lineFeed(){this.row+=1,this.rows[this.row]||(this.rows[this.row]=[])}_putChar(o){let a=this.rows[this.row];for(;a.length<this.col;)a.push({ch:" ",style:
|
|
372
|
-
`)}};function
|
|
373
|
-
`).filter(
|
|
374
|
-
`),this._scrollToEnd()}_stepEvents(o){return[...(o.output||[]).map(([a,c])=>({t:a,kind:"o",d:c})),...(o.input||[]).map(([a,c])=>({t:a,kind:"i",d:c.replace(/\r?\n$/,"")}))].sort((a,c)=>a.t-c.t)}_stepHtml(o){let a=new
|
|
375
|
-
`+c:"")}_promptHtml(){return`<span class="terminal-prompt">${
|
|
421
|
+
<tr><td>?</td><td>this help</td></tr></table></div>`,pt.addEventListener("click",Jn),k.appendChild(pt)}S.register({isOpen:()=>!!ee,close:ke,keydown:x=>$s(x,{query:w,onMove:q=>Xe(We+q),onCommit:mt,onType:q=>{w+=q,X()},onBackspace:()=>{w=w.slice(0,-1),X()},onClear:()=>{w="",X()},onClose:ke})}),S.register({isOpen:()=>!!ue,close:Je,keydown:x=>$s(x,{onMove:q=>rt(ie+q),onCommit:()=>{en(ie),Je()},onClose:Je})}),S.register({isOpen:()=>!!j,close:Ae,keydown:x=>$s(x,{query:he,onMove:q=>B(oe+q,!1),onCommit:$t,onType:q=>Le(he+q),onBackspace:()=>Le(he.slice(0,-1)),onClear:()=>Le(""),onClose:Ae})}),S.register({isOpen:()=>!!se,close:st,keydown(x){switch(x.key){case"ArrowRight":Fe(qe+1);break;case"ArrowLeft":Fe(qe-1);break;case"ArrowDown":Fe(qe+Qe());break;case"ArrowUp":Fe(qe-Qe());break;case"Enter":case" ":ge();break;case"o":case"O":case"Escape":st();break;default:return!1}return!0}});let dr=x=>x.code==="Backquote"||x.key==="`"||x.key==="~"||x.key==="\xB2";function Wt(x){if(dr(x)&&(x.metaKey||x.ctrlKey||x.altKey)){cn(),x.preventDefault();return}if((x.metaKey||x.ctrlKey)&&!x.altKey&&!x.shiftKey&&(x.key==="k"||x.key==="K")){Tt.commit.open(),x.preventDefault();return}if(/^(input|textarea|select)$/i.test(x.target.tagName))return;if(x.ctrlKey&&!x.metaKey&&!x.altKey&&(x.key==="T"||x.key==="t")){x.shiftKey?Q():Ze.rollFromPicker()||ut(),x.preventDefault();return}if(x.metaKey||x.ctrlKey||x.altKey)return;let q=S.active();if(q){if(q.keydown(x)){x.preventDefault();return}if((typeof q.modal=="function"?q.modal():q.modal)!==!1)return}if(dr(x)){cn(),x.preventDefault();return}switch(x.key){case" ":Ot.status().voiceInPlay?Ot.playPause():te.next();break;case"ArrowRight":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":st();break;case"b":case"B":Mt();break;case"d":case"D":Bt();break;case"c":case"C":Qn();break;case"k":case"K":Tt.commit.open();break;case"j":case"J":Hn();break;case"h":case"H":Tt.history.open();break;case"p":case"P":Ot.playPause();break;case"g":case"G":W();break;case"m":case"M":x.shiftKey?vn.compose():vn.open();break;case"r":case"R":Tt.history.open();break;case"e":case"E":Ct();break;case"f":case"F":H();break;case"v":case"V":Ot.openPicker();break;case"s":case"S":{let D=te.__speakerWin;D&&!D.closed?D.__decklightSpeakerToggle?.():te.__speakerWin=Ts(te);break}case"t":case"T":Ze.openPicker();break;case"/":ft();break;case".":je(1);break;case",":je(-1);break;case">":an(.25);break;case"<":an(-.25);break;case"]":Pt(1);break;case"[":Pt(-1);break;case"l":case"L":qt(x.shiftKey?-1:1);break;case"z":case"Z":Gn(x.shiftKey?"redo":"undo");break;case"a":case"A":Cn();break;case"w":case"W":jn(x.shiftKey?"laser":"pen");break;case"Backspace":if(!Sn.annotator?.active)return;Sn.annotator.clear();break;case"?":Jn();break;case"Escape":if(gt())break;se&&st();break;default:return}x.preventDefault()}c||document.addEventListener("keydown",Wt);let yn=null;k.addEventListener("touchstart",x=>{yn=x.touches[0].clientX},{passive:!0}),k.addEventListener("touchend",x=>{if(yn==null)return;let q=x.changedTouches[0].clientX-yn;Math.abs(q)>40&&(q<0?te.next():te.prev()),yn=null},{passive:!0});let Zt=x=>parseFloat(getComputedStyle(k).getPropertyValue(x))||0;function xt(){let x=k.getBoundingClientRect(),q=Zt("--dock-left"),D=Zt("--dock-right"),ve=Zt("--dock-bottom"),et=Math.min((x.width-q-D)/a.width,(x.height-ve)/a.height)||1;te._scale=et,At.style.transform=`translate(-50%, -50%) translate(${(q-D)/2}px, ${-ve/2}px) scale(${et})`}te._reflow=()=>{c||xt()},c||(new ResizeObserver(xt).observe(k),xt());let _n=qa({sectionsOf:()=>te._sections,checkOverflow:Ao}),Tn=x=>_n.watch(x),wn=!1;if(a.hash&&!c&&window.addEventListener("hashchange",()=>{if(wn)return;let x=Ja(location.hash);x&&te.goto(x.slide,x.step,{force:!0})}),!c){let x=()=>{te._sections.forEach((q,D)=>{let ve=q.querySelector(":scope > .slide-bg > video");ve&&(D===te.state.slide-1?ve.play()?.catch?.(()=>{}):ve.paused||ve.pause())})};te.on("slide",x)}te.sync(),c&&Gt&&(te._sections.forEach(x=>{x.hasAttribute("data-logo")||x.appendChild(Gt.cloneNode(!0))}),Gt.remove()),document.fonts?.ready?.then(()=>{(Dr===te||!Dr)&&Is(te._sections,a)}),te.theme=x=>bt(x),te.themePicker={open:Ze.openPicker,close:Ze.closePicker},te.generateTheme=ut,te.cycleFont=Pt,te.cycleLayout=qt,te.layoutRing=pn,te.toggleMessages=cn,te.messages=ze,te.showWelcome=_e.showWelcome,te.tips={show:_e.showTip,reset:_e.resetTips,set:_e.setTips,status:_e.status};let Ot=Aa({root:k,stage:At,config:a,params:o,printMode:c,toast:$e,logOnly:Ve,debugLog:v,overlays:S,instance:te,syncSoundBtn:K,updateDebugState:L,downloadFromUrl:Kt,authorBase:()=>Tt?.available()?Tt.base():null,authorReady:()=>Tt?.settled?.()??Promise.resolve()}),{character:Yn,toggleNarration:Ln,toggleNarrPause:Xn,changeNarrRate:an,toggleCaptions:Qn,openRecordDialog:er,openMicRecorder:zn,notesSegs:Xt}=Ot,gn=Ot.openPicker;te.toggleNarration=Ln,te.narration={playPause:()=>Ot.playPause(),openPicker:x=>Ot.openPicker(x),status:()=>Ot.status()},o.has("record")&&!c&&setTimeout(()=>{S.active()||zn()},700);let vn=ja({root:k,params:o,overlays:S,instance:te,toast:$e,debugLog:v,dismissOthers:()=>{Ze.closePicker(),j&&Ae(),ee&&ke(),Tt.restore.close()},sections:()=>te._sections??[],titleOf:xo,bodyOf:ko,authorBase:()=>Tt?.available()?Tt.base():null,authorReady:()=>Tt?.settled?.()??Promise.resolve()}),Sn=$a({root:k,printMode:c,toast:$e,debugLog:v,overlays:S,instance:te,narration:Ot,downloadFromUrl:Kt,setProgressBar:x=>{Ee=x}}),{toggleClock:Un,toggleProgress:Hn,toggleInk:jn,toggleTranscript:Fr}=Sn;te.toggleClock=Un,te.toggleProgress=Hn;let Tt=Ia({root:k,config:a,params:o,printMode:c,toast:$e,debugLog:v,overlays:S,instance:te,notesSegs:Xt,dismissOthers:()=>{Ze.closePicker(),j&&Ae(),ee&&ke()}}),{deckHistory:Gn,toggleEditor:$n,toggleAgentAsk:Cn,toggleElementEdit:Ct}=Tt;if(te.restore=Tt.restore,te.wizard=Tt.wizard,te.toggleElementEdit=Ct,o.has("voiceover")&&Ot.status().hasTracks&&!c){let x=()=>{window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",x),Ot.status().narrating||Ot.playDefault()};window.addEventListener("pointerdown",x,{once:!0}),window.addEventListener("keydown",x,{once:!0})}if(!c){let x=document.createElement("div");x.className="decklight-touch-controls",Ge=document.createElement("button"),Ge.type="button",Ge.className="decklight-touch-btn",Ge.setAttribute("aria-label","Fullscreen"),Ge.innerHTML=Ne.full,Ge.addEventListener("click",H),x.appendChild(Ge),Ot.status().hasTracks&&(M=document.createElement("button"),M.type="button",M.className="decklight-touch-btn",M.addEventListener("pointerdown",q=>q.stopPropagation()),M.addEventListener("click",()=>Ot.playDefault()),x.appendChild(M),K()),k.appendChild(x)}if(te.saveGeneratedTheme=x=>Q(x),c)return k.classList.add("decklight-print"),te._sections.forEach((x,q)=>{x.classList.add("active"),ir(te._records[q],te._records[q].groups.length)}),d&&k.classList.add("decklight-show-hidden"),(p==="handout"||p==="notes")&&(k.classList.add("decklight-print-"+p),_a(At,te._sections.filter(x=>d||!x.hasAttribute("data-hidden")),p)),Tn(te._sections),k.__decklight=te,Dr=te,te._emit("ready",{slides:te.state.totalSlides,print:!0}),te;let Rn=a.hash&&Ja(location.hash)||{slide:1,step:0};return te._sections.forEach((x,q)=>{q!==Rn.slide-1&&ir(te._records[q],0)}),te.goto(Rn.slide,Rn.step,{force:!0}),k.__decklight=te,Dr=te,te._emit("ready",{slides:te.state.totalSlides}),_e.start(Rn),te}me();fe();me();fe();var To="\x1B",Bs=Object.freeze({fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1});function tu(t){if(t<16)return null;if(t>=16&&t<=231){let a=t-16,c=[0,95,135,175,215,255];return[c[Math.floor(a/36)%6],c[Math.floor(a/6)%6],c[a%6]]}let o=8+(t-232)*10;return[o,o,o]}var qr=class{constructor(){this.rows=[[]],this.row=0,this.col=0,this.style={...Bs},this._pending=""}write(o){let a=this._pending+o;this._pending="";let c=0;for(;c<a.length;){let d=a[c];if(d===To){let p=this._consumeEscape(a,c);if(p===0){this._pending=a.slice(c);return}c+=p;continue}if(c+=1,d===`
|
|
422
|
+
`){this._lineFeed();continue}if(d==="\r"){this.col=0;continue}if(d==="\b"){this.col=Math.max(0,this.col-1);continue}if(d===" "){this.col=(Math.floor(this.col/8)+1)*8;continue}d!=="\x07"&&(d<" "&&d!==" "||this._putChar(d))}}_lineFeed(){this.row+=1,this.rows[this.row]||(this.rows[this.row]=[])}_putChar(o){let a=this.rows[this.row];for(;a.length<this.col;)a.push({ch:" ",style:Bs});a[this.col]={ch:o,style:{...this.style}},this.col+=1}_consumeEscape(o,a){if(a+1>=o.length)return 0;let c=o[a+1];if(c==="["){let d=a+2;for(;d<o.length;){let p=o.charCodeAt(d);if(p>=64&&p<=126)return this._handleCsi(o.slice(a+2,d),o[d]),d-a+1;d+=1}return 0}if(c==="]"){let d=a+2;for(;d<o.length;){if(o[d]==="\x07")return d-a+1;if(o[d]===To&&o[d+1]==="\\")return d-a+2;if(o[d]===To&&d+1>=o.length)return 0;d+=1}return 0}return c==="("||c===")"?a+2<o.length?3:0:2}_handleCsi(o,a){if(!o.startsWith("?"))switch(a){case"m":this._sgr(o);return;case"K":this._eraseLine(o);return;case"C":this.col+=Math.max(1,parseInt(o||"1",10)||1);return;case"D":this.col=Math.max(0,this.col-Math.max(1,parseInt(o||"1",10)||1));return;default:return}}_eraseLine(o){let a=parseInt(o||"0",10)||0,c=this.rows[this.row];if(a===0){c.length=Math.min(c.length,this.col);return}if(a===1){for(let d=0;d<=Math.min(this.col,c.length-1);d++)c[d]={ch:" ",style:Bs};return}if(a===2){c.length=0;return}}_sgr(o){let a=o===""?[0]:o.split(";").map(d=>parseInt(d,10)||0),c=0;for(;c<a.length;){let d=a[c];if(d===0)this.style={...Bs};else if(d===1)this.style.bold=!0;else if(d===2)this.style.dim=!0;else if(d===3)this.style.italic=!0;else if(d===4)this.style.underline=!0;else if(d===7)this.style.inverse=!0;else if(d===22)this.style.bold=!1,this.style.dim=!1;else if(d===23)this.style.italic=!1;else if(d===24)this.style.underline=!1;else if(d===27)this.style.inverse=!1;else if(d>=30&&d<=37)this.style.fg={type:"ansi",idx:d-30};else if(d>=90&&d<=97)this.style.fg={type:"ansi",idx:d-90+8};else if(d===39)this.style.fg=null;else if(d>=40&&d<=47)this.style.bg={type:"ansi",idx:d-40};else if(d>=100&&d<=107)this.style.bg={type:"ansi",idx:d-100+8};else if(d===49)this.style.bg=null;else if(d===38||d===48){let p=d===38?"fg":"bg";a[c+1]===5&&a.length>c+2?(this.style[p]={type:"256",idx:a[c+2]},c+=2):a[c+1]===2&&a.length>c+4&&(this.style[p]={type:"rgb",r:a[c+2],g:a[c+3],b:a[c+4]},c+=4)}c+=1}}get lines(){return this.rows.map(o=>{let a=[];for(let c of o){let d=a[a.length-1];d&&nu(d.style,c.style)?d.text+=c.ch:a.push({text:c.ch,style:c.style})}return a})}toHtml(){return this.lines.map(o=>su(o)).join(`
|
|
423
|
+
`)}};function nu(t,o){return t.bold===o.bold&&t.dim===o.dim&&t.italic===o.italic&&t.underline===o.underline&&t.inverse===o.inverse&&tl(t.fg,o.fg)&&tl(t.bg,o.bg)}function tl(t,o){return t===o?!0:!t||!o?!1:t.type===o.type&&t.idx===o.idx&&t.r===o.r&&t.g===o.g&&t.b===o.b}function ru(t){if(t.type==="256"){if(t.idx<16)return null;let[o,a,c]=tu(t.idx);return`rgb(${o},${a},${c})`}return t.type==="rgb"?`rgb(${t.r},${t.g},${t.b})`:null}function su(t){return t.map(({text:o,style:a})=>{let c=[],d=[],{fg:p,bg:f}=a;a.inverse&&([p,f]=[f??{type:"inv-default-bg"},p??{type:"inv-default-fg"}]);for(let[S,P]of[[p,"fg"],[f,"bg"]])if(S)if(S.type==="ansi"||S.type==="256"&&S.idx<16)c.push(`ansi-${P}-${S.idx}`);else if(S.type==="inv-default-bg")c.push("ansi-inv-fg");else if(S.type==="inv-default-fg")c.push("ansi-inv-bg");else{let T=ru(S);T&&d.push(`${P==="fg"?"color":"background-color"}:${T}`)}a.bold&&c.push("ansi-bold"),a.dim&&c.push("ansi-dim"),a.italic&&c.push("ansi-italic"),a.underline&&c.push("ansi-underline");let m=Nt(o);if(!c.length&&!d.length)return m;let v=c.length?` class="${c.join(" ")}"`:"",k=d.length?` style="${d.join(";")}"`:"";return`<span${v}${k}>${m}</span>`}).join("")}var nl=24,ou=t=>Math.max(1,Math.min(10,t)),iu=t=>2**((t-5)/2.5),rl=55,rs=[120,160],sl="decklight-term-wpm:"+location.pathname,au=t=>rs.reduce((o,a)=>Math.abs(a-t)<Math.abs(o-t)?a:o),ts=["thocky","creamy","clacky","off"],ol="decklight-term-typesound:"+location.pathname,il="decklight-term-fontsize:"+location.pathname,ns=[.75,.9,1,1.15,1.35,1.6],al={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 $o(t){let o=90+Math.random()*120;return Math.random()<.15&&(o+=Math.random()*240),t===" "?o+=70+Math.random()*220:".,:;/|&>-_=\"'`()".includes(t)&&(o+=40+Math.random()*140),Math.random()<.035&&(o+=300+Math.random()*440),o}var lu=.012,rn=null,Ds=null,Fs=new Set,ll=t=>{Fs.add(t),t.addEventListener("ended",()=>Fs.delete(t),{once:!0})};function cu(){if(!rn)return;let t=rn.currentTime;for(let o of Fs)try{o.stop(t)}catch{}Fs.clear()}function qs(t="",o="thocky",a=.12){try{let c=window.AudioContext||window.webkitAudioContext;if(!c)return;if(rn??=new c,rn.state==="suspended"&&rn.resume(),!Ds){let I=Math.floor(rn.sampleRate*.06);Ds=rn.createBuffer(1,I,rn.sampleRate);let Se=Ds.getChannelData(0);for(let pe=0;pe<I;pe++)Se[pe]=Math.random()*2-1}let d=al[o]??al.thocky,p=(I,Se)=>I+Math.random()*(Se-I),f=rn.currentTime+lu,m=t===" ",v=p(.45,1.3)*(m?1.25:1),k=p(...d.clickF)*(m?.7:1),S=p(...d.ring)*(m?1.5:1),P=(I,Se,pe,Oe)=>{let re=rn.createBufferSource();re.buffer=Ds;let ce=rn.createBiquadFilter();ce.type="bandpass",ce.frequency.value=pe,ce.Q.value=d.clickQ;let Me=rn.createBiquadFilter();Me.type="lowpass",Me.frequency.value=d.lp;let ze=rn.createGain();ze.gain.setValueAtTime(1e-4,I),ze.gain.exponentialRampToValueAtTime(Se,I+7e-4),ze.gain.exponentialRampToValueAtTime(1e-4,I+Oe),re.connect(ce),ce.connect(Me),Me.connect(ze),ze.connect(rn.destination),re.start(I),re.stop(I+Oe+.01),ll(re)},T=(I,Se,pe,Oe)=>{let re=rn.createOscillator();re.type="sine",re.frequency.setValueAtTime(pe,I),re.frequency.exponentialRampToValueAtTime(pe*.6,I+Oe*.6);let ce=rn.createGain();ce.gain.setValueAtTime(1e-4,I),ce.gain.exponentialRampToValueAtTime(Se,I+p(.003,.011)),ce.gain.exponentialRampToValueAtTime(Se*.25,I+Oe),ce.gain.exponentialRampToValueAtTime(1e-4,I+Oe*2),re.connect(ce),ce.connect(rn.destination),re.start(I),re.stop(I+Oe*2+.01),ll(re)},A=d.thumpF2&&Math.random()<(d.thumpF2Prob??.4)?d.thumpF2:d.thumpF;P(f,d.click*v*(m?.82:1),k,p(...d.clickDecay)*(m?1.2:1)),T(f,d.thump*v*(m?2.4:1),p(...A)*(m?.7:1),S);let N=f+Math.max(.01,Math.min(p(.035,.08),a*.55));P(N,d.click*v*p(.35,.55),k*1.15,p(...d.clickDecay)*.8),T(N,d.thump*v*(m?.5:.25),p(...A)*(m?.7:1),S*.6)}catch{}}function du(){try{let t=window.AudioContext||window.webkitAudioContext;if(!t)return;rn??=new t,rn.state==="suspended"&&rn.resume()}catch{}}var cl=!1;function uu(){if(cl||typeof document>"u")return;cl=!0;let t=()=>{du(),document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",t,!0)};document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",t,!0)}function No(t,o=document){let a=[...o.querySelectorAll(".terminal[data-cast], .terminal[data-cast-inline]")];return a.length&&uu(),Promise.all(a.map(c=>pu(c,t).catch(d=>{gu(c,d)})))}async function pu(t,o){if(t.dataset.decklightTerminal)return;t.dataset.decklightTerminal="1";let a,c,d=t.dataset.castInline;if(d){c=d;let v=document.querySelector(d);if(!v&&document.readyState==="loading"&&(await new Promise(k=>document.addEventListener("DOMContentLoaded",k,{once:!0})),v=document.querySelector(d)),!v)throw new Error(`inline cast not found: ${d}`);a=v.textContent}else{c=t.dataset.cast;let v=await fetch(c);if(!v.ok)throw new Error(`failed to load cast: ${c} (${v.status})`);a=await v.text()}let p=hu(a,c),f=new Co(t,p);t._decklightTerminal=f;let m=t.dataset.mode||"step";p.imported&&m==="step"&&!p.hasMarkers&&(m="play"),m==="play"?f.mountPlayMode():f.mountStepMode(o)}function hu(t,o){let a=null;try{a=JSON.parse(t)}catch{}if(a){if(a.decklightCast===1&&Array.isArray(a.steps))return a;throw new Error(`not a decklight cast (v1): ${o}`)}return mu(t,o)}function mu(t,o){let a=t.split(`
|
|
424
|
+
`).filter(v=>v.trim()),c;try{c=JSON.parse(a[0])}catch{c=null}if(!c||c.version!==2)throw new Error(`not a decklight cast or asciicast v2: ${o}`);let d=[],p={cmd:"",raw:!0,output:[]},f=0,m=!1;for(let v of a.slice(1)){let k;try{k=JSON.parse(v)}catch{continue}if(!Array.isArray(k)||k.length<3)continue;let[S,P,T]=k;P==="m"?(m=!0,p.output.length&&d.push(p),p={cmd:String(T||""),raw:!0,output:[]},f=S):P==="o"&&p.output.push([Math.max(0,fu(S-f)),T])}if(p.output.length&&d.push(p),!d.length)throw new Error(`asciicast has no output events: ${o}`);return{decklightCast:1,imported:!0,hasMarkers:m,meta:{cols:c.width||100,rows:c.height||28,prompt:""},steps:d}}function fu(t){return Math.round(t*1e3)/1e3}function gu(t,o){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 ${Nt(String(o.message||o))}</pre></div></div>`}var Co=class{constructor(o,a){this.el=o,this.cast=a,this.prompt=a.meta.prompt??"$ ";let c=ou(parseInt(o.dataset.typeSpeed??"5",10)||5);this.typeWpm=au(rl*iu(c));try{let p=parseInt(localStorage.getItem(sl)??"",10);rs.includes(p)&&(this.typeWpm=p)}catch{}o.dataset.typeWpm=String(this.typeWpm),this.fontIdx=ns.indexOf(1);try{let p=parseInt(localStorage.getItem(il)??"",10);p>=0&&p<ns.length&&(this.fontIdx=p)}catch{}this._applyFont();let d=(o.dataset.typeSound||"thocky").toLowerCase();this.soundName=ts.includes(d)?d:"thocky";try{let p=localStorage.getItem(ol);p&&ts.includes(p)&&(this.soundName=p)}catch{}this.typeSound=this.soundName==="off"?null:this.soundName,this.maxStep=(parseFloat(o.dataset.maxStep||"2.5")||2.5)*1e3,this.visibleRows=parseInt(o.dataset.rows||"",10)||Math.min(a.meta.rows||nl,nl),this.epoch=0,this.applied=0,this.playable=a.steps.filter(p=>!p.hidden&&p.sleep==null),this._mountChrome(),this._watchSlide()}stop(){if(this.epoch+=1,cu(),this.playing){this.playing=!1;let o=this.controlsEl?.querySelector(".terminal-play");o&&(o.textContent="\u25B6")}}_watchSlide(){let o=this.el.closest("section");if(!o||typeof MutationObserver!="function")return;new MutationObserver(()=>{o.classList.contains("active")||this.stop()}).observe(o,{attributes:!0,attributeFilter:["class"]})}_mountChrome(){let o=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">${Nt(o)}</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(o,{withCursor:a=!0}={}){let c=[];for(let d=0;d<o;d++)c.push(this._stepHtml(this.playable[d]));a&&!this.cast.imported&&c.push(this._promptHtml()+'<span class="terminal-cursor"></span>'),this.linesEl.innerHTML=c.join(`
|
|
425
|
+
`),this._scrollToEnd()}_stepEvents(o){return[...(o.output||[]).map(([a,c])=>({t:a,kind:"o",d:c})),...(o.input||[]).map(([a,c])=>({t:a,kind:"i",d:c.replace(/\r?\n$/,"")}))].sort((a,c)=>a.t-c.t)}_stepHtml(o){let a=new qr;for(let d of this._stepEvents(o))a.write(d.d);let c=a.toHtml();return o.raw?c:this._promptHtml()+`<span class="terminal-cmd">${Nt(o.cmd)}</span>`+(c?`
|
|
426
|
+
`+c:"")}_promptHtml(){return`<span class="terminal-prompt">${Nt(this.prompt)}</span>`}_scrollToEnd(){this.screenEl.scrollTop=this.screenEl.scrollHeight}_applyFont(){let o=ns[this.fontIdx];this.el.style.fontSize=o===1?"":`${o}em`}_mountFontButton(){let o=document.createElement("button");o.className="terminal-btn terminal-fontsize",o.title="font size: click cycles 75% to 160%",o.setAttribute("aria-label","font size");let a=()=>{o.textContent=`A ${Math.round(ns[this.fontIdx]*100)}%`};a(),o.addEventListener("click",()=>{this.fontIdx=(this.fontIdx+1)%ns.length,this._applyFont();try{localStorage.setItem(il,String(this.fontIdx))}catch{}a()}),this.controlsEl.appendChild(o)}_mountSpeedButton(){let o=document.createElement("button");o.className="terminal-btn terminal-typespeed",o.title="typing speed: click cycles words per minute",o.setAttribute("aria-label","typing speed");let a=()=>{o.textContent=`\u2328 ${this.typeWpm} wpm`};a(),o.addEventListener("click",()=>{let c=(rs.indexOf(this.typeWpm)+1)%rs.length;this.typeWpm=rs[c],this.el.dataset.typeWpm=String(this.typeWpm);try{localStorage.setItem(sl,String(this.typeWpm))}catch{}a()}),this.controlsEl.appendChild(o)}_mountSoundButton(){let o=document.createElement("button");o.className="terminal-btn terminal-typesound",o.title="key sound: click cycles thocky, creamy, clacky, off",o.setAttribute("aria-label","key sound");let a=()=>{o.textContent=`\u266A ${this.soundName}`};a(),o.addEventListener("click",()=>{let c=(ts.indexOf(this.soundName)+1)%ts.length;this.soundName=ts[c],this.typeSound=this.soundName==="off"?null:this.soundName,this.el.dataset.typeSound=this.soundName;try{localStorage.setItem(ol,this.soundName)}catch{}this.typeSound&&qs("a",this.typeSound,.12),a()}),this.controlsEl.appendChild(o)}_typeFactor(o,a=!1){return(a&&this.speed||1)*(this.typeWpm/rl)*(o.typeSpeed||1)}async _typeCmd(o,a,c,d,p=!1){for(let f=1;f<=o.length;f++){if(this.epoch!==d)return!1;let m=o[f-1],v=$o(m)/this._typeFactor(c,p);this.typeSound&&qs(m,this.typeSound,v/1e3),this.linesEl.innerHTML=a+this._promptHtml()+`<span class="terminal-cmd">${Nt(o.slice(0,f))}</span><span class="terminal-cursor"></span>`,this._scrollToEnd(),await cr(v)}return!0}mountStepMode(o){this.controlsEl.innerHTML="",this._mountSpeedButton(),this._mountSoundButton(),this._mountFontButton();let a=this.playable,c=Math.min(Math.max(parseInt(this.el.dataset.poster||"0",10)||0,0),a.length);if(this.applied=c,this._renderComplete(c),!o||typeof o.registerBuildProvider!="function"){this._renderComplete(a.length,{withCursor:!1});return}o.registerBuildProvider(this.el,{count:a.length-c,label:d=>a[c+d]?`${this.prompt}${a[c+d].cmd||"\u25B6 recording"}`:"",apply:d=>this.applyStep(c+Math.max(0,Math.min(d,a.length-c)))})}applyStep(o){this.epoch+=1;let a=o===this.applied+1;if(this.applied=o,!a){this._renderComplete(o);return}this._animateStep(o-1,this.epoch)}async _animateStep(o,a){let c=this.playable[o],d=[];for(let A=0;A<o;A++)d.push(this._stepHtml(this.playable[A]));let p=d.length?d.join(`
|
|
376
427
|
`)+`
|
|
377
|
-
`:"",
|
|
378
|
-
`+
|
|
428
|
+
`:"",f=c.cmd||"";if(!c.raw){if(!await this._typeCmd(f,p,c,a))return;await cr(120/this._typeFactor(c))}let m=this._stepEvents(c),v=m.length?m[m.length-1].t*1e3:0,k=v>this.maxStep?this.maxStep/v:1,S=new qr,P=()=>{let A=S.toHtml();this.linesEl.innerHTML=c.raw?p+A:p+this._promptHtml()+`<span class="terminal-cmd">${Nt(f)}</span>`+(A?`
|
|
429
|
+
`+A:""),this._scrollToEnd()},T=0;for(let A of m){let N=Math.min((A.t-T)*1e3*k,400);if(T=A.t,N>8&&await cr(N),this.epoch!==a)return;if(A.kind==="i")for(let I of A.d){if(this.epoch!==a)return;let Se=$o(I)/this._typeFactor(c);this.typeSound&&qs(I,this.typeSound,Se/1e3),S.write(I),P(),await cr(Se)}else S.write(A.d),P()}this.epoch===a&&this._renderComplete(o+1)}mountPlayMode(){let o=[1,2,4],a=parseFloat(this.el.dataset.speed);this.speed=o.includes(a)?a: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 c=this.controlsEl.querySelector(".terminal-play"),d=this.controlsEl.querySelector(".terminal-speed");this.controlsEl.querySelector(".terminal-restart").addEventListener("click",()=>this._restart(c)),d.addEventListener("click",()=>{this.speed=this.speed>=4?1:this.speed*2,d.textContent=`${this.speed}\xD7`}),c.addEventListener("click",()=>{this.playing?this.stop():(c.textContent="\u23F8",this._playAll(c))}),this._renderComplete(0)}_restart(o){this.stop(),o.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(0)}async _playAll(o){this.playing=!0;let a=++this.epoch,c=this._playedUpTo||0;for(let d=c;d<this.cast.steps.length;d++){let p=this.cast.steps[d];if(p.hidden){this._playedUpTo=d+1;continue}if(p.sleep!=null){if(await cr(p.sleep*1e3/this.speed),this.epoch!==a){this._playedUpTo=d;return}this._playedUpTo=d+1;continue}let m=this.cast.steps.slice(0,d).filter(A=>!A.hidden&&A.sleep==null).map(A=>this._stepHtml(A)),v=m.length?m.join(`
|
|
379
430
|
`)+`
|
|
380
|
-
`:"",
|
|
381
|
-
`+
|
|
431
|
+
`:"",k=p.cmd||"";if(!p.raw&&!await this._typeCmd(k,v,p,a,!0)){this._playedUpTo=d;return}let S=new qr,P=()=>{let A=S.toHtml();this.linesEl.innerHTML=p.raw?v+A:v+this._promptHtml()+`<span class="terminal-cmd">${Nt(k)}</span>`+(A?`
|
|
432
|
+
`+A:""),this._scrollToEnd()},T=0;for(let A of this._stepEvents(p)){let N=(A.t-T)*1e3/this.speed;if(T=A.t,N>4&&await cr(N),this.epoch!==a){this._playedUpTo=d;return}if(A.kind==="i")for(let I of A.d){if(this.epoch!==a){this._playedUpTo=d;return}let Se=$o(I)/this._typeFactor(p,!0);this.typeSound&&qs(I,this.typeSound,Se/1e3),S.write(I),P(),await cr(Se)}else S.write(A.d),P()}await cr(350/this.speed),this._playedUpTo=d+1}this.playing=!1,o.textContent="\u25B6",this._playedUpTo=0,this._renderComplete(this.playable.length,{withCursor:!0})}};function cr(t){return new Promise(o=>setTimeout(o,t))}var bu="0.8.1";function yu(t={}){let o=el(t),a=No||(void 0)?.registerTerminals;return typeof a=="function"&&Promise.resolve(a({registerBuildProvider:es},document)).catch(c=>console.error("Decklight: terminal subsystem failed to initialize",c)),o}function wu(t=document){let o=No||(void 0)?.registerTerminals;return typeof o=="function"?Promise.resolve(o({registerBuildProvider:es},t)):Promise.resolve()}return Tl(vu);})();
|
|
382
433
|
//# sourceMappingURL=decklight.js.map
|