decklight 0.8.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/SPEC.md +3 -3
- package/cli/pptx-export.mjs +15 -3
- package/dist/build-info.json +1 -1
- package/dist/decklight.js +2 -2
- package/dist/decklight.js.map +1 -1
- package/package.json +1 -1
- package/tools/exec.mjs +34 -1
- package/tools/test-impact.mjs +4 -2
package/SPEC.md
CHANGED
|
@@ -1407,16 +1407,16 @@ decklight/
|
|
|
1407
1407
|
demo/ smoke.html (the render harnesses' deck — every feature, including deliberate regression
|
|
1408
1408
|
fixtures) + intro.html, features.html, pitch.html, showcase.html + assets/
|
|
1409
1409
|
test/ node:test units (ansi, builds, math, cast format, the CLI, the marketplace, the pieces lifted out
|
|
1410
|
-
of engine.js), found by run.mjs rather than a shell glob +
|
|
1410
|
+
of engine.js), found by run.mjs rather than a shell glob + 22 headless-Chrome harnesses (render,
|
|
1411
1411
|
player, narration × 5 — live/picker/recorded/segments/record, record, review, character, engine,
|
|
1412
|
-
pin, overflow, split, strict, shot, plugin, extension-check, deckfile, pdf, import) +
|
|
1412
|
+
pin, overflow, split, strict, shot, plugin, extension-check, deckfile, pdf, pptx, import) +
|
|
1413
1413
|
contrast.mjs and palette-rules.mjs (every shipped theme through tools/theme-check.mjs, and the house palette bar) + the two manual end-to-end scripts neither
|
|
1414
1414
|
blessed suite runs: soak.mjs (pack, install, walk the journey — the release gate) with its
|
|
1415
1415
|
soak-platform.mjs, and video-e2e.mjs (a real ffmpeg render)
|
|
1416
1416
|
```
|
|
1417
1417
|
|
|
1418
1418
|
- Build: `npm run build` = esbuild bundle (`src/index.js` → `dist/decklight.js`, minified + sourcemap) + CSS copy. Node ≥ 20. Runtime has **zero** runtime dependencies (highlight.js + temml are bundled at build time; Temml's stylesheet is appended to `decklight.css` with its optional woff2 `@font-face` stripped); `node-pty`, `js-yaml` are CLI-only deps.
|
|
1419
|
-
- Verification culture: `npm test` runs the units; `npm run verify` builds and then runs **all
|
|
1419
|
+
- Verification culture: `npm test` runs the units; `npm run verify` builds and then runs **all 24 harnesses** — the 22 headless-Chrome ones against `demo/smoke.html` and the decks each covers, plus the two theme graders — reporting every harness rather than stopping at the first failure. A feature is verified against a real render, not only unit-tested.
|
|
1420
1420
|
- Release gate: **`npm run soak`** packs this repo, installs the tarball into an empty project whose path contains a space, and drives the INSTALLED `decklight` through one user journey — create, import, marketplace, author, present, bundle, transform, pdf, publish, validate, open, record, film — plus a cross-version `upgrade` of a deck scaffolded by a decklight that actually shipped. Manual, in neither blessed suite (it runs a real `npm install`, and skipping inside them would let "green" mean "not actually run"); anything it cannot do here — no Chrome, no network, no ffmpeg, no toolchain — skips **by name**, so a green run with skips is never mistaken for a complete one.
|
|
1421
1421
|
|
|
1422
1422
|
## NON_GOALS — Non-goals (v1)
|
package/cli/pptx-export.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { tmpdir } from 'node:os';
|
|
|
14
14
|
import { basename, join, relative, resolve, sep } from 'node:path';
|
|
15
15
|
import { chromeBin, chromeArgs } from '../tools/chrome.mjs';
|
|
16
16
|
import { argReader } from '../tools/args.mjs';
|
|
17
|
-
import {
|
|
17
|
+
import { runAsync, CODEC_MS } from '../tools/exec.mjs';
|
|
18
18
|
import { NOTES_ASIDE, cleanNotes, sectionBodies } from '../tools/deck-html.mjs';
|
|
19
19
|
import { buildPptx } from '../tools/pptx-write.mjs';
|
|
20
20
|
import { serveForRender } from './present.mjs';
|
|
@@ -52,8 +52,20 @@ export function notesLines(html) {
|
|
|
52
52
|
/** The deck's <title>, else its file name. */
|
|
53
53
|
const titleOf = (html, file) => cleanNotes(/<title>([\s\S]*?)<\/title>/i.exec(html)?.[1] ?? '') || basename(file).replace(/\.html?$/i, '');
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Chrome, ASYNC — `runAsync`, never `run`.
|
|
57
|
+
*
|
|
58
|
+
* The deck is served from THIS process (serveForRender, PRESENTING) so that a
|
|
59
|
+
* relative asset still resolves and the CSP is the one `present` applies. A
|
|
60
|
+
* synchronous child blocks the event loop, so the server never answers the
|
|
61
|
+
* browser it just launched: Chrome waits for a first byte that cannot arrive
|
|
62
|
+
* until Chrome exits. 0.8.0 shipped exactly that — every `decklight pptx`
|
|
63
|
+
* stalled for the full five-minute budget and then reported a hang whose real
|
|
64
|
+
* cause was one import. tools/shot.mjs carries the same warning above the same
|
|
65
|
+
* call; test/pptx-render.mjs is what now notices.
|
|
66
|
+
*/
|
|
67
|
+
export async function chromeShot(bin, argv, _ctx, { timeout = CODEC_MS } = {}) {
|
|
68
|
+
await runAsync(bin, argv, { maxBuffer: 32 * 1024 * 1024, timeout, why: 'Chrome did not finish rendering a slide — it is probably waiting on a resource it cannot reach' });
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
export async function pptxMain(args = [], { render = chromeShot, log = console.error } = {}) {
|
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"tag":"0.8.
|
|
1
|
+
{"tag":"0.8.1","commits":0,"commit":"777d429","dirty":false}
|
package/dist/decklight.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Decklight v0.8.
|
|
1
|
+
/*! Decklight v0.8.1 — Copyright 2026 Gilles Philippart — SPDX-License-Identifier: Apache-2.0 */
|
|
2
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
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
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)+`:
|
|
@@ -429,5 +429,5 @@ ${ft.text||"(nothing)"}`:`cannot show what it said \u2014 ${ft.why}`))}I===g.id&
|
|
|
429
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(`
|
|
430
430
|
`)+`
|
|
431
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.
|
|
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);})();
|
|
433
433
|
//# sourceMappingURL=decklight.js.map
|