@pretextbook/import 0.13.0 → 0.14.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/dist/convert-worker.cjs +1 -1
- package/dist/convert-worker.js +1 -1
- package/dist/{engine-routing-ClG81Gp5.cjs → engine-routing-DXWabWIt.cjs} +1 -1
- package/dist/{engine-routing-UEp8JP8x.js → engine-routing-S5C2oiB0.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/clean/latex-preamble.d.ts +7 -0
- package/dist/lib/convert.d.ts +21 -2
- package/dist/lib/layout/document-kind.d.ts +1 -1
- package/dist/lib/layout/xml-scan.d.ts +21 -0
- package/dist/lib/pretext-divisions.d.ts +3 -1
- package/dist/react.cjs +2 -2
- package/dist/react.js +4 -3
- package/dist/{upload-DJuIYze6.js → upload-CjdLu68g.js} +1055 -997
- package/dist/{upload-B1HDv3IB.cjs → upload-DYjX5ohJ.cjs} +42 -42
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { formatPretext as
|
|
2
|
-
import { latexToPretext as
|
|
3
|
-
import { markdownToPretext as
|
|
4
|
-
const
|
|
1
|
+
import { formatPretext as ci } from "@pretextbook/format";
|
|
2
|
+
import { latexToPretext as li } from "@pretextbook/latex-pretext";
|
|
3
|
+
import { markdownToPretext as ui } from "@pretextbook/remark-pretext";
|
|
4
|
+
const di = [
|
|
5
5
|
"\\documentclass",
|
|
6
6
|
"\\begin{document}",
|
|
7
7
|
"\\begin{",
|
|
@@ -9,21 +9,21 @@ const li = [
|
|
|
9
9
|
"\\chapter",
|
|
10
10
|
"\\title",
|
|
11
11
|
"\\author"
|
|
12
|
-
],
|
|
13
|
-
function
|
|
12
|
+
], fi = ["# ", "## ", "### ", "#### "];
|
|
13
|
+
function ve(t) {
|
|
14
14
|
const r = t.trim();
|
|
15
|
-
return !r || r.startsWith("<") ? "pretext" :
|
|
15
|
+
return !r || r.startsWith("<") ? "pretext" : di.some((n) => r.includes(n)) ? "latex" : fi.some((n) => r.startsWith(n)) ? "markdown" : "pretext";
|
|
16
16
|
}
|
|
17
|
-
const di = /* @__PURE__ */ JSON.parse('[" ","!","\\"","#","&","\'","*",",",".",":",";","=",">","AA","AE","Alpha","And","Arrowvert","Bbb","Bbbk","Beta","Big","Bigg","Biggl","Biggm","Biggr","Bigl","Bigm","Bigr","Box","Bra","Bumpeq","C","Cap","Chi","Colonapprox","Coloneq","Coloneqq","Colonsim","Complex","Coppa","Cup","Dagger","Darr","DeclareMathOperator","Delta","Diamond","Digamma","Doteq","Downarrow","Epsilon","Eqcolon","Eqqcolon","Eta","Finv","Game","Gamma","H","Harr","Huge","Im","Iota","Join","KaTeX","Kappa","Ket","Koppa","L","LARGE","LaTeX","Lambda","Large","Larr","LeftArrow","Leftarrow","Leftrightarrow","Lleftarrow","Longleftarrow","Longleftrightarrow","Longrightarrow","Lrarr","Lsh","Mu","N","Newextarrow","Nu","O","OE","Omega","Omicron","Overrightarrow","P","Phi","Pi","Pr","Psi","Q","R","Rarr","Re","Reals","Rho","Rightarrow","Rrightarrow","Rsh","Rule","S","Sampi","Sigma","Space","Stigma","Subset","Supset","Tau","TeX","Theta","Tiny","Uarr","Uparrow","Updownarrow","Upsilon","Vdash","Vert","Vvdash","Xi","Z","Zeta","\\\\","^","_","`","aa","above","abovewithdelims","acute","add","ae","alef","alefsym","aleph","allowbreak","alpha","amalg","and","ang","angl","angle","angln","approx","approxcolon","approxcoloncolon","approxeq","arccos","arcctg","arcsin","arctan","arctg","arg","argmax","argmin","array","arraystretch","arrowvert","ast","asymp","atop","atopwithdelims","backepsilon","backprime","backsim","backsimeq","backslash","bar","barwedge","bbox","bcancel","because","begin","begingroup","beta","beth","between","bf","bfseries","big","bigcap","bigcirc","bigcup","bigg","biggl","biggm","biggr","bigl","bigm","bigodot","bigominus","bigoplus","bigoslash","bigotimes","bigr","bigsqcap","bigsqcup","bigstar","bigtriangledown","bigtriangleup","biguplus","bigvee","bigwedge","binom","blacklozenge","blacksquare","blacktriangle","blacktriangledown","blacktriangleleft","blacktriangleright","bm","bmod","bold","boldsymbol","bot","bowtie","boxdot","boxed","boxminus","boxplus","boxtimes","bra","brace","bracevert","brack","braket","breve","buildrel","bull","bullet","bumpeq","cal","cancel","cancelto","cap","cases","cdot","cdotp","cdots","ce","cee","centerdot","cf","cfrac","ch","char","check","checkmark","chi","chk","choose","circ","circeq","circlearrowleft","circlearrowright","circledR","circledS","circledast","circledcirc","circleddash","class","cline","clubs","clubsuit","cnums","colon","colonapprox","coloncolon","coloncolonapprox","coloncolonequals","coloncolonminus","coloncolonsim","coloneq","coloneqq","colonequals","colonminus","colonsim","color","colorbox","complement","cong","coppa","coprod","copyright","cos","cosec","cosh","cot","cotg","coth","cr","csc","cssId","ctg","cth","cup","curlyeqprec","curlyeqsucc","curlyvee","curlywedge","curvearrowleft","curvearrowright","dArr","dag","dagger","daleth","darr","dashleftarrow","dashrightarrow","dashv","dbinom","dblcolon","ddag","ddagger","ddddot","dddot","ddot","ddots","def","definecolor","deg","degree","delta","det","dfrac","diagdown","diagup","diamond","diamonds","diamondsuit","digamma","dim","displaylines","displaystyle","div","divideontimes","dot","doteq","doteqdot","dotplus","dots","dotsb","dotsc","dotsi","dotsm","dotso","doublebarwedge","doublecap","doublecup","downarrow","downdownarrows","downharpoonleft","downharpoonright","edef","ell","else","em","emph","empty","emptyset","enclose","end","endgroup","enspace","epsilon","eqalign","eqalignno","eqcirc","eqcolon","eqqcolon","eqref","eqsim","eqslantgtr","eqslantless","equalscolon","equalscoloncolon","equiv","eta","eth","euro","exist","exists","exp","expandafter","fallingdotseq","fbox","fcolorbox","fi","flat","foo","footnotesize","forall","frac","frak","frown","futurelet","gamma","gcd","gdef","ge","geneuro","geneuronarrow","geneurowide","genfrac","geq","geqq","geqslant","gets","gg","ggg","gggtr","gimel","global","gnapprox","gneq","gneqq","gnsim","grave","greet","gt","gtrapprox","gtrdot","gtreqless","gtreqqless","gtrless","gtrsim","gvertneqq","hArr","hail","harr","hat","hbar","hbox","hdashline","hearts","heartsuit","hfil","hfill","hline","hom","hookleftarrow","hookrightarrow","hphantom","href","hskip","hslash","hspace","htmlClass","htmlData","htmlId","htmlStyle","huge","i","iddots","idotsint","if","iff","ifmode","ifx","iiiint","iiint","iint","image","imageof","imath","impliedby","implies","in","includegraphics","inf","infin","infty","injlim","int","intercal","intop","iota","isin","it","itshape","j","jmath","kappa","ker","kern","ket","koppa","l","lArr","lBrace","lVert","label","lambda","land","lang","langle","large","larr","lbrace","lbrack","lceil","ldotp","ldots","le","leadsto","left","leftarrow","leftarrowtail","leftharpoondown","leftharpoonup","leftleftarrows","leftrightarrow","leftrightarrows","leftrightharpoons","leftrightsquigarrow","leftroot","leftthreetimes","leq","leqalignno","leqq","leqslant","lessapprox","lessdot","lesseqgtr","lesseqqgtr","lessgtr","lesssim","let","lfloor","lg","lgroup","lhd","lim","liminf","limits","limsup","ll","llap","llbracket","llcorner","lll","llless","lmoustache","ln","lnapprox","lneq","lneqq","lnot","lnsim","log","long","longleftarrow","longleftrightarrow","longmapsto","longrightarrow","looparrowleft","looparrowright","lor","lower","lozenge","lparen","lq","lrArr","lrarr","lrcorner","lt","ltimes","lvert","lvertneqq","maltese","mapsto","mathbb","mathbf","mathbin","mathcal","mathchoice","mathclap","mathclose","mathellipsis","mathfrak","mathinner","mathit","mathllap","mathnormal","mathop","mathopen","mathord","mathpunct","mathrel","mathring","mathrlap","mathrm","mathscr","mathsf","mathsterling","mathstrut","mathtip","mathtt","matrix","max","mbox","md","mdseries","measuredangle","medspace","mho","mid","middle","min","minuscolon","minuscoloncolon","minuso","mit","mkern","mmlToken","mod","models","moveleft","moveright","mp","mskip","mspace","mu","multicolumn","multimap","nLeftarrow","nLeftrightarrow","nRightarrow","nVDash","nVdash","nabla","natnums","natural","ncong","ne","nearrow","neg","negmedspace","negthickspace","negthinspace","neq","newcommand","newenvironment","newline","nexists","ngeq","ngeqq","ngeqslant","ngtr","ni","nleftarrow","nleftrightarrow","nleq","nleqq","nleqslant","nless","nmid","nobreak","nobreakspace","noexpand","nolimits","nonumber","normalfont","normalsize","not","notag","notin","notni","nparallel","nprec","npreceq","nrightarrow","nshortmid","nshortparallel","nsim","nsubseteq","nsubseteqq","nsucc","nsucceq","nsupseteq","nsupseteqq","ntriangleleft","ntrianglelefteq","ntriangleright","ntrianglerighteq","nu","nvDash","nvdash","nwarrow","o","odot","oe","officialeuro","oiiint","oiint","oint","oldstyle","omega","omicron","ominus","operatorname","operatornamewithlimits","oplus","or","origof","oslash","otimes","over","overbrace","overbracket","overgroup","overleftarrow","overleftharpoon","overleftrightarrow","overline","overlinesegment","overparen","overrightarrow","overrightharpoon","overset","overwithdelims","owns","pagecolor","parallel","part","partial","perp","phantom","phase","phi","pi","pitchfork","plim","plusmn","pm","pmatrix","pmb","pmod","pod","pounds","prec","precapprox","preccurlyeq","preceq","precnapprox","precneqq","precnsim","precsim","prime","prod","projlim","propto","providecommand","psi","pu","qquad","quad","r","rArr","rBrace","rVert","raise","raisebox","rang","rangle","rarr","ratio","rbrace","rbrack","rceil","real","reals","ref","relax","renewcommand","renewenvironment","require","restriction","rfloor","rgroup","rhd","rho","right","rightarrow","rightarrowtail","rightharpoondown","rightharpoonup","rightleftarrows","rightleftharpoons","rightrightarrows","rightsquigarrow","rightthreetimes","risingdotseq","rlap","rm","rmoustache","root","rotatebox","rparen","rq","rrbracket","rtimes","rule","rvert","sampi","sc","scalebox","scr","scriptscriptstyle","scriptsize","scriptstyle","sdot","searrow","sec","sect","setlength","setminus","sf","sh","sharp","shortmid","shortparallel","shoveleft","shoveright","sideset","sigma","sim","simcolon","simcoloncolon","simeq","sin","sinh","sixptsize","skew","skip","sl","small","smallfrown","smallint","smallsetminus","smallsmile","smash","smile","smiley","sout","space","spades","spadesuit","sphericalangle","sqcap","sqcup","sqrt","sqsubset","sqsubseteq","sqsupset","sqsupseteq","square","ss","stackrel","star","stigma","strut","style","sub","sube","subset","subseteq","subseteqq","subsetneq","subsetneqq","substack","succ","succapprox","succcurlyeq","succeq","succnapprox","succneqq","succnsim","succsim","sum","sup","supe","supset","supseteq","supseteqq","supsetneq","supsetneqq","surd","swarrow","tag","tan","tanh","tau","tbinom","text","textasciicircum","textasciitilde","textbackslash","textbar","textbardbl","textbf","textbraceleft","textbraceright","textcircled","textcolor","textdagger","textdaggerdbl","textdegree","textdollar","textellipsis","textemdash","textendash","textgreater","textit","textless","textmd","textnormal","textquotedblleft","textquotedblright","textquoteleft","textquoteright","textregistered","textrm","textsc","textsf","textsl","textsterling","textstyle","texttip","texttt","textunderscore","textup","textvisiblespace","tfrac","tg","th","therefore","theta","thetasym","thickapprox","thicksim","thickspace","thinspace","tilde","times","tiny","to","toggle","top","triangle","triangledown","triangleleft","trianglelefteq","triangleq","triangleright","trianglerighteq","tt","twoheadleftarrow","twoheadrightarrow","u","uArr","uarr","ulcorner","underbar","underbrace","underbracket","undergroup","underleftarrow","underleftrightarrow","underline","underlinesegment","underparen","underrightarrow","underset","unicode","unlhd","unrhd","up","uparrow","updownarrow","upharpoonleft","upharpoonright","uplus","uproot","upshape","upsilon","upuparrows","urcorner","url","utilde","v","vDash","varDelta","varGamma","varLambda","varOmega","varPhi","varPi","varPsi","varSigma","varTheta","varUpsilon","varXi","varcoppa","varepsilon","varinjlim","varkappa","varliminf","varlimsup","varnothing","varphi","varpi","varprojlim","varpropto","varrho","varsigma","varstigma","varsubsetneq","varsubsetneqq","varsupsetneq","varsupsetneqq","vartheta","vartriangle","vartriangleleft","vartriangleright","vcentcolon","vcenter","vdash","vdots","vec","vee","veebar","vert","vfil","vfill","vline","vphantom","wedge","weierp","widecheck","widehat","wideparen","widetilde","wp","wr","xLeftarrow","xLeftrightarrow","xRightarrow","xcancel","xdef","xhookleftarrow","xhookrightarrow","xi","xleftarrow","xleftharpoondown","xleftharpoonup","xleftrightarrow","xleftrightharpoons","xlongequal","xmapsto","xrightarrow","xrightharpoondown","xrightharpoonup","xrightleftharpoons","xtofrom","xtwoheadleftarrow","xtwoheadrightarrow","yen","zeta","{","|","}","~"]'), fi = ["align", "align*", "alignat", "alignat*", "aligned", "alignedat", "array", "Bmatrix", "bmatrix", "Bmatrix*", "bmatrix*", "cases", "CD", "darray", "dcases", "drcases", "equation", "equation*", "gather", "gathered", "matrix", "matrix*", "pmatrix", "pmatrix*", "rcases", "smallmatrix", "split", "Vmatrix", "vmatrix", "Vmatrix*", "vmatrix*"], wr = {
|
|
18
|
-
KATEX_MACROS:
|
|
19
|
-
KATEX_ENVIRONMENTS:
|
|
17
|
+
const hi = /* @__PURE__ */ JSON.parse('[" ","!","\\"","#","&","\'","*",",",".",":",";","=",">","AA","AE","Alpha","And","Arrowvert","Bbb","Bbbk","Beta","Big","Bigg","Biggl","Biggm","Biggr","Bigl","Bigm","Bigr","Box","Bra","Bumpeq","C","Cap","Chi","Colonapprox","Coloneq","Coloneqq","Colonsim","Complex","Coppa","Cup","Dagger","Darr","DeclareMathOperator","Delta","Diamond","Digamma","Doteq","Downarrow","Epsilon","Eqcolon","Eqqcolon","Eta","Finv","Game","Gamma","H","Harr","Huge","Im","Iota","Join","KaTeX","Kappa","Ket","Koppa","L","LARGE","LaTeX","Lambda","Large","Larr","LeftArrow","Leftarrow","Leftrightarrow","Lleftarrow","Longleftarrow","Longleftrightarrow","Longrightarrow","Lrarr","Lsh","Mu","N","Newextarrow","Nu","O","OE","Omega","Omicron","Overrightarrow","P","Phi","Pi","Pr","Psi","Q","R","Rarr","Re","Reals","Rho","Rightarrow","Rrightarrow","Rsh","Rule","S","Sampi","Sigma","Space","Stigma","Subset","Supset","Tau","TeX","Theta","Tiny","Uarr","Uparrow","Updownarrow","Upsilon","Vdash","Vert","Vvdash","Xi","Z","Zeta","\\\\","^","_","`","aa","above","abovewithdelims","acute","add","ae","alef","alefsym","aleph","allowbreak","alpha","amalg","and","ang","angl","angle","angln","approx","approxcolon","approxcoloncolon","approxeq","arccos","arcctg","arcsin","arctan","arctg","arg","argmax","argmin","array","arraystretch","arrowvert","ast","asymp","atop","atopwithdelims","backepsilon","backprime","backsim","backsimeq","backslash","bar","barwedge","bbox","bcancel","because","begin","begingroup","beta","beth","between","bf","bfseries","big","bigcap","bigcirc","bigcup","bigg","biggl","biggm","biggr","bigl","bigm","bigodot","bigominus","bigoplus","bigoslash","bigotimes","bigr","bigsqcap","bigsqcup","bigstar","bigtriangledown","bigtriangleup","biguplus","bigvee","bigwedge","binom","blacklozenge","blacksquare","blacktriangle","blacktriangledown","blacktriangleleft","blacktriangleright","bm","bmod","bold","boldsymbol","bot","bowtie","boxdot","boxed","boxminus","boxplus","boxtimes","bra","brace","bracevert","brack","braket","breve","buildrel","bull","bullet","bumpeq","cal","cancel","cancelto","cap","cases","cdot","cdotp","cdots","ce","cee","centerdot","cf","cfrac","ch","char","check","checkmark","chi","chk","choose","circ","circeq","circlearrowleft","circlearrowright","circledR","circledS","circledast","circledcirc","circleddash","class","cline","clubs","clubsuit","cnums","colon","colonapprox","coloncolon","coloncolonapprox","coloncolonequals","coloncolonminus","coloncolonsim","coloneq","coloneqq","colonequals","colonminus","colonsim","color","colorbox","complement","cong","coppa","coprod","copyright","cos","cosec","cosh","cot","cotg","coth","cr","csc","cssId","ctg","cth","cup","curlyeqprec","curlyeqsucc","curlyvee","curlywedge","curvearrowleft","curvearrowright","dArr","dag","dagger","daleth","darr","dashleftarrow","dashrightarrow","dashv","dbinom","dblcolon","ddag","ddagger","ddddot","dddot","ddot","ddots","def","definecolor","deg","degree","delta","det","dfrac","diagdown","diagup","diamond","diamonds","diamondsuit","digamma","dim","displaylines","displaystyle","div","divideontimes","dot","doteq","doteqdot","dotplus","dots","dotsb","dotsc","dotsi","dotsm","dotso","doublebarwedge","doublecap","doublecup","downarrow","downdownarrows","downharpoonleft","downharpoonright","edef","ell","else","em","emph","empty","emptyset","enclose","end","endgroup","enspace","epsilon","eqalign","eqalignno","eqcirc","eqcolon","eqqcolon","eqref","eqsim","eqslantgtr","eqslantless","equalscolon","equalscoloncolon","equiv","eta","eth","euro","exist","exists","exp","expandafter","fallingdotseq","fbox","fcolorbox","fi","flat","foo","footnotesize","forall","frac","frak","frown","futurelet","gamma","gcd","gdef","ge","geneuro","geneuronarrow","geneurowide","genfrac","geq","geqq","geqslant","gets","gg","ggg","gggtr","gimel","global","gnapprox","gneq","gneqq","gnsim","grave","greet","gt","gtrapprox","gtrdot","gtreqless","gtreqqless","gtrless","gtrsim","gvertneqq","hArr","hail","harr","hat","hbar","hbox","hdashline","hearts","heartsuit","hfil","hfill","hline","hom","hookleftarrow","hookrightarrow","hphantom","href","hskip","hslash","hspace","htmlClass","htmlData","htmlId","htmlStyle","huge","i","iddots","idotsint","if","iff","ifmode","ifx","iiiint","iiint","iint","image","imageof","imath","impliedby","implies","in","includegraphics","inf","infin","infty","injlim","int","intercal","intop","iota","isin","it","itshape","j","jmath","kappa","ker","kern","ket","koppa","l","lArr","lBrace","lVert","label","lambda","land","lang","langle","large","larr","lbrace","lbrack","lceil","ldotp","ldots","le","leadsto","left","leftarrow","leftarrowtail","leftharpoondown","leftharpoonup","leftleftarrows","leftrightarrow","leftrightarrows","leftrightharpoons","leftrightsquigarrow","leftroot","leftthreetimes","leq","leqalignno","leqq","leqslant","lessapprox","lessdot","lesseqgtr","lesseqqgtr","lessgtr","lesssim","let","lfloor","lg","lgroup","lhd","lim","liminf","limits","limsup","ll","llap","llbracket","llcorner","lll","llless","lmoustache","ln","lnapprox","lneq","lneqq","lnot","lnsim","log","long","longleftarrow","longleftrightarrow","longmapsto","longrightarrow","looparrowleft","looparrowright","lor","lower","lozenge","lparen","lq","lrArr","lrarr","lrcorner","lt","ltimes","lvert","lvertneqq","maltese","mapsto","mathbb","mathbf","mathbin","mathcal","mathchoice","mathclap","mathclose","mathellipsis","mathfrak","mathinner","mathit","mathllap","mathnormal","mathop","mathopen","mathord","mathpunct","mathrel","mathring","mathrlap","mathrm","mathscr","mathsf","mathsterling","mathstrut","mathtip","mathtt","matrix","max","mbox","md","mdseries","measuredangle","medspace","mho","mid","middle","min","minuscolon","minuscoloncolon","minuso","mit","mkern","mmlToken","mod","models","moveleft","moveright","mp","mskip","mspace","mu","multicolumn","multimap","nLeftarrow","nLeftrightarrow","nRightarrow","nVDash","nVdash","nabla","natnums","natural","ncong","ne","nearrow","neg","negmedspace","negthickspace","negthinspace","neq","newcommand","newenvironment","newline","nexists","ngeq","ngeqq","ngeqslant","ngtr","ni","nleftarrow","nleftrightarrow","nleq","nleqq","nleqslant","nless","nmid","nobreak","nobreakspace","noexpand","nolimits","nonumber","normalfont","normalsize","not","notag","notin","notni","nparallel","nprec","npreceq","nrightarrow","nshortmid","nshortparallel","nsim","nsubseteq","nsubseteqq","nsucc","nsucceq","nsupseteq","nsupseteqq","ntriangleleft","ntrianglelefteq","ntriangleright","ntrianglerighteq","nu","nvDash","nvdash","nwarrow","o","odot","oe","officialeuro","oiiint","oiint","oint","oldstyle","omega","omicron","ominus","operatorname","operatornamewithlimits","oplus","or","origof","oslash","otimes","over","overbrace","overbracket","overgroup","overleftarrow","overleftharpoon","overleftrightarrow","overline","overlinesegment","overparen","overrightarrow","overrightharpoon","overset","overwithdelims","owns","pagecolor","parallel","part","partial","perp","phantom","phase","phi","pi","pitchfork","plim","plusmn","pm","pmatrix","pmb","pmod","pod","pounds","prec","precapprox","preccurlyeq","preceq","precnapprox","precneqq","precnsim","precsim","prime","prod","projlim","propto","providecommand","psi","pu","qquad","quad","r","rArr","rBrace","rVert","raise","raisebox","rang","rangle","rarr","ratio","rbrace","rbrack","rceil","real","reals","ref","relax","renewcommand","renewenvironment","require","restriction","rfloor","rgroup","rhd","rho","right","rightarrow","rightarrowtail","rightharpoondown","rightharpoonup","rightleftarrows","rightleftharpoons","rightrightarrows","rightsquigarrow","rightthreetimes","risingdotseq","rlap","rm","rmoustache","root","rotatebox","rparen","rq","rrbracket","rtimes","rule","rvert","sampi","sc","scalebox","scr","scriptscriptstyle","scriptsize","scriptstyle","sdot","searrow","sec","sect","setlength","setminus","sf","sh","sharp","shortmid","shortparallel","shoveleft","shoveright","sideset","sigma","sim","simcolon","simcoloncolon","simeq","sin","sinh","sixptsize","skew","skip","sl","small","smallfrown","smallint","smallsetminus","smallsmile","smash","smile","smiley","sout","space","spades","spadesuit","sphericalangle","sqcap","sqcup","sqrt","sqsubset","sqsubseteq","sqsupset","sqsupseteq","square","ss","stackrel","star","stigma","strut","style","sub","sube","subset","subseteq","subseteqq","subsetneq","subsetneqq","substack","succ","succapprox","succcurlyeq","succeq","succnapprox","succneqq","succnsim","succsim","sum","sup","supe","supset","supseteq","supseteqq","supsetneq","supsetneqq","surd","swarrow","tag","tan","tanh","tau","tbinom","text","textasciicircum","textasciitilde","textbackslash","textbar","textbardbl","textbf","textbraceleft","textbraceright","textcircled","textcolor","textdagger","textdaggerdbl","textdegree","textdollar","textellipsis","textemdash","textendash","textgreater","textit","textless","textmd","textnormal","textquotedblleft","textquotedblright","textquoteleft","textquoteright","textregistered","textrm","textsc","textsf","textsl","textsterling","textstyle","texttip","texttt","textunderscore","textup","textvisiblespace","tfrac","tg","th","therefore","theta","thetasym","thickapprox","thicksim","thickspace","thinspace","tilde","times","tiny","to","toggle","top","triangle","triangledown","triangleleft","trianglelefteq","triangleq","triangleright","trianglerighteq","tt","twoheadleftarrow","twoheadrightarrow","u","uArr","uarr","ulcorner","underbar","underbrace","underbracket","undergroup","underleftarrow","underleftrightarrow","underline","underlinesegment","underparen","underrightarrow","underset","unicode","unlhd","unrhd","up","uparrow","updownarrow","upharpoonleft","upharpoonright","uplus","uproot","upshape","upsilon","upuparrows","urcorner","url","utilde","v","vDash","varDelta","varGamma","varLambda","varOmega","varPhi","varPi","varPsi","varSigma","varTheta","varUpsilon","varXi","varcoppa","varepsilon","varinjlim","varkappa","varliminf","varlimsup","varnothing","varphi","varpi","varprojlim","varpropto","varrho","varsigma","varstigma","varsubsetneq","varsubsetneqq","varsupsetneq","varsupsetneqq","vartheta","vartriangle","vartriangleleft","vartriangleright","vcentcolon","vcenter","vdash","vdots","vec","vee","veebar","vert","vfil","vfill","vline","vphantom","wedge","weierp","widecheck","widehat","wideparen","widetilde","wp","wr","xLeftarrow","xLeftrightarrow","xRightarrow","xcancel","xdef","xhookleftarrow","xhookrightarrow","xi","xleftarrow","xleftharpoondown","xleftharpoonup","xleftrightarrow","xleftrightharpoons","xlongequal","xmapsto","xrightarrow","xrightharpoondown","xrightharpoonup","xrightleftharpoons","xtofrom","xtwoheadleftarrow","xtwoheadrightarrow","yen","zeta","{","|","}","~"]'), pi = ["align", "align*", "alignat", "alignat*", "aligned", "alignedat", "array", "Bmatrix", "bmatrix", "Bmatrix*", "bmatrix*", "cases", "CD", "darray", "dcases", "drcases", "equation", "equation*", "gather", "gathered", "matrix", "matrix*", "pmatrix", "pmatrix*", "rcases", "smallmatrix", "split", "Vmatrix", "vmatrix", "Vmatrix*", "vmatrix*"], yr = {
|
|
18
|
+
KATEX_MACROS: hi,
|
|
19
|
+
KATEX_ENVIRONMENTS: pi
|
|
20
20
|
};
|
|
21
21
|
new Set(
|
|
22
|
-
|
|
22
|
+
yr.KATEX_MACROS
|
|
23
23
|
);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
),
|
|
24
|
+
const mi = new Set(
|
|
25
|
+
yr.KATEX_ENVIRONMENTS
|
|
26
|
+
), gi = [
|
|
27
27
|
{
|
|
28
28
|
name: "enumerate",
|
|
29
29
|
aliases: [],
|
|
@@ -367,7 +367,7 @@ const hi = new Set(
|
|
|
367
367
|
\\subsubpart $0
|
|
368
368
|
`
|
|
369
369
|
}
|
|
370
|
-
],
|
|
370
|
+
], bi = {
|
|
371
371
|
abstract: { requiresStatement: !1, aliases: ["abs", "abstr"] },
|
|
372
372
|
acknowledgement: { requiresStatement: !1, aliases: ["ack"] },
|
|
373
373
|
algorithm: { requiresStatement: !0, aliases: ["algo", "alg"] },
|
|
@@ -438,7 +438,7 @@ const hi = new Set(
|
|
|
438
438
|
},
|
|
439
439
|
solution: { requiresStatement: !1, aliases: ["sol"] },
|
|
440
440
|
warning: { requiresStatement: !1, aliases: ["warn", "wrn"] }
|
|
441
|
-
},
|
|
441
|
+
}, vi = /* @__PURE__ */ new Set([
|
|
442
442
|
"exercise",
|
|
443
443
|
"problem",
|
|
444
444
|
"question",
|
|
@@ -447,9 +447,9 @@ const hi = new Set(
|
|
|
447
447
|
"exploration",
|
|
448
448
|
"investigation"
|
|
449
449
|
]);
|
|
450
|
-
function
|
|
450
|
+
function wi(t, r) {
|
|
451
451
|
let n;
|
|
452
|
-
return
|
|
452
|
+
return vi.has(t) ? n = ["hint", "answer", "solution"] : r.requiresStatement && (n = ["proof"]), {
|
|
453
453
|
name: t,
|
|
454
454
|
aliases: r.aliases,
|
|
455
455
|
requiresStatement: r.requiresStatement,
|
|
@@ -458,15 +458,15 @@ function bi(t, r) {
|
|
|
458
458
|
childEnvironments: n
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
|
-
const
|
|
462
|
-
...
|
|
463
|
-
...Object.entries(
|
|
464
|
-
([t, r]) =>
|
|
461
|
+
const _i = [
|
|
462
|
+
...gi,
|
|
463
|
+
...Object.entries(bi).map(
|
|
464
|
+
([t, r]) => wi(t, r)
|
|
465
465
|
)
|
|
466
466
|
];
|
|
467
467
|
(() => {
|
|
468
468
|
const t = /* @__PURE__ */ new Map();
|
|
469
|
-
for (const r of
|
|
469
|
+
for (const r of _i) {
|
|
470
470
|
t.set(r.name, r);
|
|
471
471
|
for (const n of r.aliases)
|
|
472
472
|
t.set(n, r);
|
|
@@ -476,7 +476,7 @@ const vi = [
|
|
|
476
476
|
function vt(t, r) {
|
|
477
477
|
return t.map((n) => ({ name: n, signature: r, mode: "text" }));
|
|
478
478
|
}
|
|
479
|
-
const
|
|
479
|
+
const yi = vt(
|
|
480
480
|
[
|
|
481
481
|
// Generator / symbol macros that emit a fixed element with no arguments.
|
|
482
482
|
"latex",
|
|
@@ -541,7 +541,7 @@ const wi = vt(
|
|
|
541
541
|
"noindent"
|
|
542
542
|
],
|
|
543
543
|
""
|
|
544
|
-
),
|
|
544
|
+
), xi = vt(
|
|
545
545
|
[
|
|
546
546
|
// Text-formatting wrappers.
|
|
547
547
|
"emph",
|
|
@@ -596,7 +596,7 @@ const wi = vt(
|
|
|
596
596
|
"caption"
|
|
597
597
|
],
|
|
598
598
|
"m"
|
|
599
|
-
),
|
|
599
|
+
), xr = [
|
|
600
600
|
{
|
|
601
601
|
name: "href",
|
|
602
602
|
signature: "m m",
|
|
@@ -666,7 +666,7 @@ const wi = vt(
|
|
|
666
666
|
snippet: "plus{${1:chapter}}{${2:ref}}",
|
|
667
667
|
documentation: 'PreTeXt Plus modular include. `\\plus{type}{ref}` → `<plus:type ref="ref"/>`, pulling in the division or asset stored under `ref`. An optional `\\plus[width=50,margin=auto]{image}{ref}` argument becomes attributes on the element.'
|
|
668
668
|
}
|
|
669
|
-
],
|
|
669
|
+
], ki = vt(
|
|
670
670
|
[
|
|
671
671
|
"preface",
|
|
672
672
|
"biography",
|
|
@@ -684,7 +684,7 @@ const wi = vt(
|
|
|
684
684
|
...t,
|
|
685
685
|
snippet: `${t.name}{$1}`,
|
|
686
686
|
documentation: `PreTeXt division. \\${t.name}{title} opens a <${t.name === "readingquestions" ? "reading-questions" : t.name}> that runs to the next division of the same or higher level.`
|
|
687
|
-
})),
|
|
687
|
+
})), Si = vt(
|
|
688
688
|
[
|
|
689
689
|
"book",
|
|
690
690
|
"article",
|
|
@@ -700,7 +700,7 @@ const wi = vt(
|
|
|
700
700
|
"references"
|
|
701
701
|
],
|
|
702
702
|
"m"
|
|
703
|
-
),
|
|
703
|
+
), Ei = [
|
|
704
704
|
...vt(["email", "keywords"], "m"),
|
|
705
705
|
...vt(["subjclass"], "o m"),
|
|
706
706
|
...vt(["title", "author", "date", "input", "include", "subtitle"], "m"),
|
|
@@ -720,7 +720,7 @@ const wi = vt(
|
|
|
720
720
|
],
|
|
721
721
|
""
|
|
722
722
|
)
|
|
723
|
-
],
|
|
723
|
+
], Ai = vt(
|
|
724
724
|
[
|
|
725
725
|
"bfseries",
|
|
726
726
|
"itshape",
|
|
@@ -743,20 +743,20 @@ const wi = vt(
|
|
|
743
743
|
"tiny"
|
|
744
744
|
],
|
|
745
745
|
""
|
|
746
|
-
),
|
|
747
|
-
...
|
|
746
|
+
), Ii = vt(["question", "subpart", "subsubpart"], ""), Ti = new Set(xr.map((t) => t.name)), Ri = [
|
|
747
|
+
...xr,
|
|
748
748
|
...[
|
|
749
|
-
...wi,
|
|
750
|
-
..._i,
|
|
751
749
|
...yi,
|
|
752
750
|
...xi,
|
|
753
751
|
...ki,
|
|
754
752
|
...Si,
|
|
755
|
-
...Ei
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
753
|
+
...Ei,
|
|
754
|
+
...Ai,
|
|
755
|
+
...Ii
|
|
756
|
+
].filter((t) => !Ti.has(t.name)).filter((t, r, n) => n.findIndex((i) => i.name === t.name) === r)
|
|
757
|
+
], Ci = new Map(
|
|
758
|
+
Ri.map((t) => [t.name, t])
|
|
759
|
+
), kr = /* @__PURE__ */ new Set([
|
|
760
760
|
"code",
|
|
761
761
|
"program",
|
|
762
762
|
"console",
|
|
@@ -765,35 +765,35 @@ const wi = vt(
|
|
|
765
765
|
"lstlisting",
|
|
766
766
|
"minted"
|
|
767
767
|
]);
|
|
768
|
-
function
|
|
768
|
+
function we(t) {
|
|
769
769
|
return t >= "a" && t <= "z" || t >= "A" && t <= "Z";
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Oi(t, r, n) {
|
|
772
772
|
return t.startsWith(n, r) ? r + n.length : -1;
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function zi(t, r) {
|
|
775
775
|
if (t[r] !== "{") return null;
|
|
776
776
|
const n = t.indexOf("}", r + 1);
|
|
777
777
|
return n === -1 ? null : { content: t.slice(r + 1, n), end: n + 1 };
|
|
778
778
|
}
|
|
779
|
-
function
|
|
780
|
-
const i =
|
|
781
|
-
if (i === -1 ||
|
|
779
|
+
function Gt(t, r, n) {
|
|
780
|
+
const i = Oi(t, r, "\\" + n);
|
|
781
|
+
if (i === -1 || we(t[i] ?? "")) return null;
|
|
782
782
|
let e = i;
|
|
783
783
|
for (; t[e] === " " || t[e] === " "; ) e++;
|
|
784
|
-
const a =
|
|
784
|
+
const a = zi(t, e);
|
|
785
785
|
return a ? { group: a.content, groupStart: e + 1, end: a.end } : null;
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function $i(t) {
|
|
788
788
|
const r = [], n = [], i = [], e = [], a = [], s = t.length;
|
|
789
789
|
let o = 0, c = null, l = 0, f = null;
|
|
790
790
|
const p = (g) => ({
|
|
791
|
-
isMath:
|
|
792
|
-
isVerbatim:
|
|
791
|
+
isMath: mi.has(g),
|
|
792
|
+
isVerbatim: kr.has(g)
|
|
793
793
|
});
|
|
794
794
|
for (; o < s; ) {
|
|
795
795
|
if (f !== null) {
|
|
796
|
-
const d =
|
|
796
|
+
const d = Gt(t, o, "end");
|
|
797
797
|
d && d.group === f ? (e.push({
|
|
798
798
|
name: d.group,
|
|
799
799
|
type: "end",
|
|
@@ -828,7 +828,7 @@ function Oi(t) {
|
|
|
828
828
|
o += 2;
|
|
829
829
|
continue;
|
|
830
830
|
}
|
|
831
|
-
const d =
|
|
831
|
+
const d = Gt(t, o, "begin");
|
|
832
832
|
if (d) {
|
|
833
833
|
const v = p(d.group);
|
|
834
834
|
e.push({
|
|
@@ -840,7 +840,7 @@ function Oi(t) {
|
|
|
840
840
|
}), v.isVerbatim && (f = d.group), o = d.end;
|
|
841
841
|
continue;
|
|
842
842
|
}
|
|
843
|
-
const w =
|
|
843
|
+
const w = Gt(t, o, "end");
|
|
844
844
|
if (w) {
|
|
845
845
|
e.push({
|
|
846
846
|
name: w.group,
|
|
@@ -851,14 +851,14 @@ function Oi(t) {
|
|
|
851
851
|
}), o = w.end;
|
|
852
852
|
continue;
|
|
853
853
|
}
|
|
854
|
-
const h =
|
|
854
|
+
const h = Gt(t, o, "label");
|
|
855
855
|
if (h) {
|
|
856
856
|
r.push({ name: h.group, offset: h.groupStart }), o = h.end;
|
|
857
857
|
continue;
|
|
858
858
|
}
|
|
859
|
-
if (
|
|
859
|
+
if (we(t[o + 1] ?? "")) {
|
|
860
860
|
let v = o + 1;
|
|
861
|
-
for (; v < s &&
|
|
861
|
+
for (; v < s && we(t[v]); ) v++;
|
|
862
862
|
a.push({ name: t.slice(o + 1, v), start: o, end: v }), o = v;
|
|
863
863
|
continue;
|
|
864
864
|
}
|
|
@@ -874,7 +874,7 @@ function Oi(t) {
|
|
|
874
874
|
}
|
|
875
875
|
return c !== null && n.push({ start: l, end: s }), { labels: r, mathRegions: n, commentRegions: i, environments: e, macros: a };
|
|
876
876
|
}
|
|
877
|
-
function
|
|
877
|
+
function _e(t, r) {
|
|
878
878
|
const n = Math.max(0, Math.min(r, t.length));
|
|
879
879
|
let i = 0, e = 0;
|
|
880
880
|
for (let a = 0; a < n; a++)
|
|
@@ -884,32 +884,32 @@ function ve(t, r) {
|
|
|
884
884
|
}
|
|
885
885
|
function Qt(t, r, n) {
|
|
886
886
|
return {
|
|
887
|
-
start:
|
|
888
|
-
end:
|
|
887
|
+
start: _e(t, r),
|
|
888
|
+
end: _e(t, n)
|
|
889
889
|
};
|
|
890
890
|
}
|
|
891
|
-
var
|
|
891
|
+
var on;
|
|
892
892
|
(function(t) {
|
|
893
893
|
function r(n) {
|
|
894
894
|
return typeof n == "string";
|
|
895
895
|
}
|
|
896
896
|
t.is = r;
|
|
897
|
-
})(
|
|
898
|
-
var
|
|
897
|
+
})(on || (on = {}));
|
|
898
|
+
var ye;
|
|
899
899
|
(function(t) {
|
|
900
900
|
function r(n) {
|
|
901
901
|
return typeof n == "string";
|
|
902
902
|
}
|
|
903
903
|
t.is = r;
|
|
904
|
-
})(
|
|
905
|
-
var
|
|
904
|
+
})(ye || (ye = {}));
|
|
905
|
+
var cn;
|
|
906
906
|
(function(t) {
|
|
907
907
|
t.MIN_VALUE = -2147483648, t.MAX_VALUE = 2147483647;
|
|
908
908
|
function r(n) {
|
|
909
909
|
return typeof n == "number" && t.MIN_VALUE <= n && n <= t.MAX_VALUE;
|
|
910
910
|
}
|
|
911
911
|
t.is = r;
|
|
912
|
-
})(
|
|
912
|
+
})(cn || (cn = {}));
|
|
913
913
|
var te;
|
|
914
914
|
(function(t) {
|
|
915
915
|
t.MIN_VALUE = 0, t.MAX_VALUE = 2147483647;
|
|
@@ -930,7 +930,7 @@ var wt;
|
|
|
930
930
|
}
|
|
931
931
|
t.is = n;
|
|
932
932
|
})(wt || (wt = {}));
|
|
933
|
-
var
|
|
933
|
+
var dt;
|
|
934
934
|
(function(t) {
|
|
935
935
|
function r(i, e, a, s) {
|
|
936
936
|
if (T.uinteger(i) && T.uinteger(e) && T.uinteger(a) && T.uinteger(s))
|
|
@@ -945,7 +945,7 @@ var ft;
|
|
|
945
945
|
return T.objectLiteral(e) && wt.is(e.start) && wt.is(e.end);
|
|
946
946
|
}
|
|
947
947
|
t.is = n;
|
|
948
|
-
})(
|
|
948
|
+
})(dt || (dt = {}));
|
|
949
949
|
var ee;
|
|
950
950
|
(function(t) {
|
|
951
951
|
function r(i, e) {
|
|
@@ -954,11 +954,11 @@ var ee;
|
|
|
954
954
|
t.create = r;
|
|
955
955
|
function n(i) {
|
|
956
956
|
let e = i;
|
|
957
|
-
return T.objectLiteral(e) &&
|
|
957
|
+
return T.objectLiteral(e) && dt.is(e.range) && (T.string(e.uri) || T.undefined(e.uri));
|
|
958
958
|
}
|
|
959
959
|
t.is = n;
|
|
960
960
|
})(ee || (ee = {}));
|
|
961
|
-
var
|
|
961
|
+
var ln;
|
|
962
962
|
(function(t) {
|
|
963
963
|
function r(i, e, a, s) {
|
|
964
964
|
return { targetUri: i, targetRange: e, targetSelectionRange: a, originSelectionRange: s };
|
|
@@ -966,11 +966,11 @@ var on;
|
|
|
966
966
|
t.create = r;
|
|
967
967
|
function n(i) {
|
|
968
968
|
let e = i;
|
|
969
|
-
return T.objectLiteral(e) &&
|
|
969
|
+
return T.objectLiteral(e) && dt.is(e.targetRange) && T.string(e.targetUri) && dt.is(e.targetSelectionRange) && (dt.is(e.originSelectionRange) || T.undefined(e.originSelectionRange));
|
|
970
970
|
}
|
|
971
971
|
t.is = n;
|
|
972
|
-
})(
|
|
973
|
-
var
|
|
972
|
+
})(ln || (ln = {}));
|
|
973
|
+
var xe;
|
|
974
974
|
(function(t) {
|
|
975
975
|
function r(i, e, a, s) {
|
|
976
976
|
return {
|
|
@@ -986,8 +986,8 @@ var _e;
|
|
|
986
986
|
return T.objectLiteral(e) && T.numberRange(e.red, 0, 1) && T.numberRange(e.green, 0, 1) && T.numberRange(e.blue, 0, 1) && T.numberRange(e.alpha, 0, 1);
|
|
987
987
|
}
|
|
988
988
|
t.is = n;
|
|
989
|
-
})(
|
|
990
|
-
var
|
|
989
|
+
})(xe || (xe = {}));
|
|
990
|
+
var un;
|
|
991
991
|
(function(t) {
|
|
992
992
|
function r(i, e) {
|
|
993
993
|
return {
|
|
@@ -998,11 +998,11 @@ var cn;
|
|
|
998
998
|
t.create = r;
|
|
999
999
|
function n(i) {
|
|
1000
1000
|
const e = i;
|
|
1001
|
-
return T.objectLiteral(e) &&
|
|
1001
|
+
return T.objectLiteral(e) && dt.is(e.range) && xe.is(e.color);
|
|
1002
1002
|
}
|
|
1003
1003
|
t.is = n;
|
|
1004
|
-
})(
|
|
1005
|
-
var
|
|
1004
|
+
})(un || (un = {}));
|
|
1005
|
+
var dn;
|
|
1006
1006
|
(function(t) {
|
|
1007
1007
|
function r(i, e, a) {
|
|
1008
1008
|
return {
|
|
@@ -1014,15 +1014,15 @@ var ln;
|
|
|
1014
1014
|
t.create = r;
|
|
1015
1015
|
function n(i) {
|
|
1016
1016
|
const e = i;
|
|
1017
|
-
return T.objectLiteral(e) && T.string(e.label) && (T.undefined(e.textEdit) ||
|
|
1017
|
+
return T.objectLiteral(e) && T.string(e.label) && (T.undefined(e.textEdit) || Rt.is(e)) && (T.undefined(e.additionalTextEdits) || T.typedArray(e.additionalTextEdits, Rt.is));
|
|
1018
1018
|
}
|
|
1019
1019
|
t.is = n;
|
|
1020
|
-
})(
|
|
1021
|
-
var
|
|
1020
|
+
})(dn || (dn = {}));
|
|
1021
|
+
var fn;
|
|
1022
1022
|
(function(t) {
|
|
1023
1023
|
t.Comment = "comment", t.Imports = "imports", t.Region = "region";
|
|
1024
|
-
})(
|
|
1025
|
-
var
|
|
1024
|
+
})(fn || (fn = {}));
|
|
1025
|
+
var hn;
|
|
1026
1026
|
(function(t) {
|
|
1027
1027
|
function r(i, e, a, s, o, c) {
|
|
1028
1028
|
const l = {
|
|
@@ -1037,8 +1037,8 @@ var dn;
|
|
|
1037
1037
|
return T.objectLiteral(e) && T.uinteger(e.startLine) && T.uinteger(e.startLine) && (T.undefined(e.startCharacter) || T.uinteger(e.startCharacter)) && (T.undefined(e.endCharacter) || T.uinteger(e.endCharacter)) && (T.undefined(e.kind) || T.string(e.kind));
|
|
1038
1038
|
}
|
|
1039
1039
|
t.is = n;
|
|
1040
|
-
})(
|
|
1041
|
-
var
|
|
1040
|
+
})(hn || (hn = {}));
|
|
1041
|
+
var ke;
|
|
1042
1042
|
(function(t) {
|
|
1043
1043
|
function r(i, e) {
|
|
1044
1044
|
return {
|
|
@@ -1052,23 +1052,23 @@ var ye;
|
|
|
1052
1052
|
return T.defined(e) && ee.is(e.location) && T.string(e.message);
|
|
1053
1053
|
}
|
|
1054
1054
|
t.is = n;
|
|
1055
|
-
})(
|
|
1056
|
-
var
|
|
1055
|
+
})(ke || (ke = {}));
|
|
1056
|
+
var jt;
|
|
1057
1057
|
(function(t) {
|
|
1058
1058
|
t.Error = 1, t.Warning = 2, t.Information = 3, t.Hint = 4;
|
|
1059
|
-
})(
|
|
1060
|
-
var
|
|
1059
|
+
})(jt || (jt = {}));
|
|
1060
|
+
var pn;
|
|
1061
1061
|
(function(t) {
|
|
1062
1062
|
t.Unnecessary = 1, t.Deprecated = 2;
|
|
1063
|
-
})(
|
|
1064
|
-
var
|
|
1063
|
+
})(pn || (pn = {}));
|
|
1064
|
+
var mn;
|
|
1065
1065
|
(function(t) {
|
|
1066
1066
|
function r(n) {
|
|
1067
1067
|
const i = n;
|
|
1068
1068
|
return T.objectLiteral(i) && T.string(i.href);
|
|
1069
1069
|
}
|
|
1070
1070
|
t.is = r;
|
|
1071
|
-
})(
|
|
1071
|
+
})(mn || (mn = {}));
|
|
1072
1072
|
var ne;
|
|
1073
1073
|
(function(t) {
|
|
1074
1074
|
function r(i, e, a, s, o, c) {
|
|
@@ -1079,11 +1079,11 @@ var ne;
|
|
|
1079
1079
|
function n(i) {
|
|
1080
1080
|
var e;
|
|
1081
1081
|
let a = i;
|
|
1082
|
-
return T.defined(a) &&
|
|
1082
|
+
return T.defined(a) && dt.is(a.range) && T.string(a.message) && (T.number(a.severity) || T.undefined(a.severity)) && (T.integer(a.code) || T.string(a.code) || T.undefined(a.code)) && (T.undefined(a.codeDescription) || T.string((e = a.codeDescription) === null || e === void 0 ? void 0 : e.href)) && (T.string(a.source) || T.undefined(a.source)) && (T.undefined(a.relatedInformation) || T.typedArray(a.relatedInformation, ke.is));
|
|
1083
1083
|
}
|
|
1084
1084
|
t.is = n;
|
|
1085
1085
|
})(ne || (ne = {}));
|
|
1086
|
-
var
|
|
1086
|
+
var Tt;
|
|
1087
1087
|
(function(t) {
|
|
1088
1088
|
function r(i, e, ...a) {
|
|
1089
1089
|
let s = { title: i, command: e };
|
|
@@ -1095,8 +1095,8 @@ var It;
|
|
|
1095
1095
|
return T.defined(e) && T.string(e.title) && T.string(e.command);
|
|
1096
1096
|
}
|
|
1097
1097
|
t.is = n;
|
|
1098
|
-
})(
|
|
1099
|
-
var
|
|
1098
|
+
})(Tt || (Tt = {}));
|
|
1099
|
+
var Rt;
|
|
1100
1100
|
(function(t) {
|
|
1101
1101
|
function r(a, s) {
|
|
1102
1102
|
return { range: a, newText: s };
|
|
@@ -1112,11 +1112,11 @@ var Tt;
|
|
|
1112
1112
|
t.del = i;
|
|
1113
1113
|
function e(a) {
|
|
1114
1114
|
const s = a;
|
|
1115
|
-
return T.objectLiteral(s) && T.string(s.newText) &&
|
|
1115
|
+
return T.objectLiteral(s) && T.string(s.newText) && dt.is(s.range);
|
|
1116
1116
|
}
|
|
1117
1117
|
t.is = e;
|
|
1118
|
-
})(
|
|
1119
|
-
var
|
|
1118
|
+
})(Rt || (Rt = {}));
|
|
1119
|
+
var Se;
|
|
1120
1120
|
(function(t) {
|
|
1121
1121
|
function r(i, e, a) {
|
|
1122
1122
|
const s = { label: i };
|
|
@@ -1128,16 +1128,16 @@ var xe;
|
|
|
1128
1128
|
return T.objectLiteral(e) && T.string(e.label) && (T.boolean(e.needsConfirmation) || e.needsConfirmation === void 0) && (T.string(e.description) || e.description === void 0);
|
|
1129
1129
|
}
|
|
1130
1130
|
t.is = n;
|
|
1131
|
-
})(
|
|
1132
|
-
var
|
|
1131
|
+
})(Se || (Se = {}));
|
|
1132
|
+
var Ct;
|
|
1133
1133
|
(function(t) {
|
|
1134
1134
|
function r(n) {
|
|
1135
1135
|
const i = n;
|
|
1136
1136
|
return T.string(i);
|
|
1137
1137
|
}
|
|
1138
1138
|
t.is = r;
|
|
1139
|
-
})(
|
|
1140
|
-
var
|
|
1139
|
+
})(Ct || (Ct = {}));
|
|
1140
|
+
var gn;
|
|
1141
1141
|
(function(t) {
|
|
1142
1142
|
function r(a, s, o) {
|
|
1143
1143
|
return { range: a, newText: s, annotationId: o };
|
|
@@ -1153,11 +1153,11 @@ var pn;
|
|
|
1153
1153
|
t.del = i;
|
|
1154
1154
|
function e(a) {
|
|
1155
1155
|
const s = a;
|
|
1156
|
-
return
|
|
1156
|
+
return Rt.is(s) && (Se.is(s.annotationId) || Ct.is(s.annotationId));
|
|
1157
1157
|
}
|
|
1158
1158
|
t.is = e;
|
|
1159
|
-
})(
|
|
1160
|
-
var
|
|
1159
|
+
})(gn || (gn = {}));
|
|
1160
|
+
var Ee;
|
|
1161
1161
|
(function(t) {
|
|
1162
1162
|
function r(i, e) {
|
|
1163
1163
|
return { textDocument: i, edits: e };
|
|
@@ -1165,11 +1165,11 @@ var ke;
|
|
|
1165
1165
|
t.create = r;
|
|
1166
1166
|
function n(i) {
|
|
1167
1167
|
let e = i;
|
|
1168
|
-
return T.defined(e) &&
|
|
1168
|
+
return T.defined(e) && Ce.is(e.textDocument) && Array.isArray(e.edits);
|
|
1169
1169
|
}
|
|
1170
1170
|
t.is = n;
|
|
1171
|
-
})(
|
|
1172
|
-
var
|
|
1171
|
+
})(Ee || (Ee = {}));
|
|
1172
|
+
var Ae;
|
|
1173
1173
|
(function(t) {
|
|
1174
1174
|
function r(i, e, a) {
|
|
1175
1175
|
let s = {
|
|
@@ -1181,11 +1181,11 @@ var Se;
|
|
|
1181
1181
|
t.create = r;
|
|
1182
1182
|
function n(i) {
|
|
1183
1183
|
let e = i;
|
|
1184
|
-
return e && e.kind === "create" && T.string(e.uri) && (e.options === void 0 || (e.options.overwrite === void 0 || T.boolean(e.options.overwrite)) && (e.options.ignoreIfExists === void 0 || T.boolean(e.options.ignoreIfExists))) && (e.annotationId === void 0 ||
|
|
1184
|
+
return e && e.kind === "create" && T.string(e.uri) && (e.options === void 0 || (e.options.overwrite === void 0 || T.boolean(e.options.overwrite)) && (e.options.ignoreIfExists === void 0 || T.boolean(e.options.ignoreIfExists))) && (e.annotationId === void 0 || Ct.is(e.annotationId));
|
|
1185
1185
|
}
|
|
1186
1186
|
t.is = n;
|
|
1187
|
-
})(
|
|
1188
|
-
var
|
|
1187
|
+
})(Ae || (Ae = {}));
|
|
1188
|
+
var Ie;
|
|
1189
1189
|
(function(t) {
|
|
1190
1190
|
function r(i, e, a, s) {
|
|
1191
1191
|
let o = {
|
|
@@ -1198,11 +1198,11 @@ var Ee;
|
|
|
1198
1198
|
t.create = r;
|
|
1199
1199
|
function n(i) {
|
|
1200
1200
|
let e = i;
|
|
1201
|
-
return e && e.kind === "rename" && T.string(e.oldUri) && T.string(e.newUri) && (e.options === void 0 || (e.options.overwrite === void 0 || T.boolean(e.options.overwrite)) && (e.options.ignoreIfExists === void 0 || T.boolean(e.options.ignoreIfExists))) && (e.annotationId === void 0 ||
|
|
1201
|
+
return e && e.kind === "rename" && T.string(e.oldUri) && T.string(e.newUri) && (e.options === void 0 || (e.options.overwrite === void 0 || T.boolean(e.options.overwrite)) && (e.options.ignoreIfExists === void 0 || T.boolean(e.options.ignoreIfExists))) && (e.annotationId === void 0 || Ct.is(e.annotationId));
|
|
1202
1202
|
}
|
|
1203
1203
|
t.is = n;
|
|
1204
|
-
})(
|
|
1205
|
-
var
|
|
1204
|
+
})(Ie || (Ie = {}));
|
|
1205
|
+
var Te;
|
|
1206
1206
|
(function(t) {
|
|
1207
1207
|
function r(i, e, a) {
|
|
1208
1208
|
let s = {
|
|
@@ -1214,19 +1214,19 @@ var Ae;
|
|
|
1214
1214
|
t.create = r;
|
|
1215
1215
|
function n(i) {
|
|
1216
1216
|
let e = i;
|
|
1217
|
-
return e && e.kind === "delete" && T.string(e.uri) && (e.options === void 0 || (e.options.recursive === void 0 || T.boolean(e.options.recursive)) && (e.options.ignoreIfNotExists === void 0 || T.boolean(e.options.ignoreIfNotExists))) && (e.annotationId === void 0 ||
|
|
1217
|
+
return e && e.kind === "delete" && T.string(e.uri) && (e.options === void 0 || (e.options.recursive === void 0 || T.boolean(e.options.recursive)) && (e.options.ignoreIfNotExists === void 0 || T.boolean(e.options.ignoreIfNotExists))) && (e.annotationId === void 0 || Ct.is(e.annotationId));
|
|
1218
1218
|
}
|
|
1219
1219
|
t.is = n;
|
|
1220
|
-
})(
|
|
1221
|
-
var
|
|
1220
|
+
})(Te || (Te = {}));
|
|
1221
|
+
var Re;
|
|
1222
1222
|
(function(t) {
|
|
1223
1223
|
function r(n) {
|
|
1224
1224
|
let i = n;
|
|
1225
|
-
return i && (i.changes !== void 0 || i.documentChanges !== void 0) && (i.documentChanges === void 0 || i.documentChanges.every((e) => T.string(e.kind) ?
|
|
1225
|
+
return i && (i.changes !== void 0 || i.documentChanges !== void 0) && (i.documentChanges === void 0 || i.documentChanges.every((e) => T.string(e.kind) ? Ae.is(e) || Ie.is(e) || Te.is(e) : Ee.is(e)));
|
|
1226
1226
|
}
|
|
1227
1227
|
t.is = r;
|
|
1228
|
-
})(
|
|
1229
|
-
var
|
|
1228
|
+
})(Re || (Re = {}));
|
|
1229
|
+
var bn;
|
|
1230
1230
|
(function(t) {
|
|
1231
1231
|
function r(i) {
|
|
1232
1232
|
return { uri: i };
|
|
@@ -1237,8 +1237,8 @@ var mn;
|
|
|
1237
1237
|
return T.defined(e) && T.string(e.uri);
|
|
1238
1238
|
}
|
|
1239
1239
|
t.is = n;
|
|
1240
|
-
})(
|
|
1241
|
-
var
|
|
1240
|
+
})(bn || (bn = {}));
|
|
1241
|
+
var vn;
|
|
1242
1242
|
(function(t) {
|
|
1243
1243
|
function r(i, e) {
|
|
1244
1244
|
return { uri: i, version: e };
|
|
@@ -1249,8 +1249,8 @@ var gn;
|
|
|
1249
1249
|
return T.defined(e) && T.string(e.uri) && T.integer(e.version);
|
|
1250
1250
|
}
|
|
1251
1251
|
t.is = n;
|
|
1252
|
-
})(
|
|
1253
|
-
var
|
|
1252
|
+
})(vn || (vn = {}));
|
|
1253
|
+
var Ce;
|
|
1254
1254
|
(function(t) {
|
|
1255
1255
|
function r(i, e) {
|
|
1256
1256
|
return { uri: i, version: e };
|
|
@@ -1261,8 +1261,8 @@ var Te;
|
|
|
1261
1261
|
return T.defined(e) && T.string(e.uri) && (e.version === null || T.integer(e.version));
|
|
1262
1262
|
}
|
|
1263
1263
|
t.is = n;
|
|
1264
|
-
})(
|
|
1265
|
-
var
|
|
1264
|
+
})(Ce || (Ce = {}));
|
|
1265
|
+
var wn;
|
|
1266
1266
|
(function(t) {
|
|
1267
1267
|
function r(i, e, a, s) {
|
|
1268
1268
|
return { uri: i, languageId: e, version: a, text: s };
|
|
@@ -1273,8 +1273,8 @@ var bn;
|
|
|
1273
1273
|
return T.defined(e) && T.string(e.uri) && T.string(e.languageId) && T.integer(e.version) && T.string(e.text);
|
|
1274
1274
|
}
|
|
1275
1275
|
t.is = n;
|
|
1276
|
-
})(
|
|
1277
|
-
var
|
|
1276
|
+
})(wn || (wn = {}));
|
|
1277
|
+
var Oe;
|
|
1278
1278
|
(function(t) {
|
|
1279
1279
|
t.PlainText = "plaintext", t.Markdown = "markdown";
|
|
1280
1280
|
function r(n) {
|
|
@@ -1282,28 +1282,28 @@ var Re;
|
|
|
1282
1282
|
return i === t.PlainText || i === t.Markdown;
|
|
1283
1283
|
}
|
|
1284
1284
|
t.is = r;
|
|
1285
|
-
})(
|
|
1286
|
-
var
|
|
1285
|
+
})(Oe || (Oe = {}));
|
|
1286
|
+
var qt;
|
|
1287
1287
|
(function(t) {
|
|
1288
1288
|
function r(n) {
|
|
1289
1289
|
const i = n;
|
|
1290
|
-
return T.objectLiteral(n) &&
|
|
1290
|
+
return T.objectLiteral(n) && Oe.is(i.kind) && T.string(i.value);
|
|
1291
1291
|
}
|
|
1292
1292
|
t.is = r;
|
|
1293
|
-
})(
|
|
1294
|
-
var
|
|
1293
|
+
})(qt || (qt = {}));
|
|
1294
|
+
var _n;
|
|
1295
1295
|
(function(t) {
|
|
1296
1296
|
t.Text = 1, t.Method = 2, t.Function = 3, t.Constructor = 4, t.Field = 5, t.Variable = 6, t.Class = 7, t.Interface = 8, t.Module = 9, t.Property = 10, t.Unit = 11, t.Value = 12, t.Enum = 13, t.Keyword = 14, t.Snippet = 15, t.Color = 16, t.File = 17, t.Reference = 18, t.Folder = 19, t.EnumMember = 20, t.Constant = 21, t.Struct = 22, t.Event = 23, t.Operator = 24, t.TypeParameter = 25;
|
|
1297
|
-
})(
|
|
1298
|
-
var
|
|
1297
|
+
})(_n || (_n = {}));
|
|
1298
|
+
var yn;
|
|
1299
1299
|
(function(t) {
|
|
1300
1300
|
t.PlainText = 1, t.Snippet = 2;
|
|
1301
|
-
})(
|
|
1302
|
-
var
|
|
1301
|
+
})(yn || (yn = {}));
|
|
1302
|
+
var xn;
|
|
1303
1303
|
(function(t) {
|
|
1304
1304
|
t.Deprecated = 1;
|
|
1305
|
-
})(
|
|
1306
|
-
var
|
|
1305
|
+
})(xn || (xn = {}));
|
|
1306
|
+
var kn;
|
|
1307
1307
|
(function(t) {
|
|
1308
1308
|
function r(i, e, a) {
|
|
1309
1309
|
return { newText: i, insert: e, replace: a };
|
|
@@ -1311,36 +1311,36 @@ var yn;
|
|
|
1311
1311
|
t.create = r;
|
|
1312
1312
|
function n(i) {
|
|
1313
1313
|
const e = i;
|
|
1314
|
-
return e && T.string(e.newText) &&
|
|
1314
|
+
return e && T.string(e.newText) && dt.is(e.insert) && dt.is(e.replace);
|
|
1315
1315
|
}
|
|
1316
1316
|
t.is = n;
|
|
1317
|
-
})(
|
|
1318
|
-
var
|
|
1317
|
+
})(kn || (kn = {}));
|
|
1318
|
+
var Sn;
|
|
1319
1319
|
(function(t) {
|
|
1320
1320
|
t.asIs = 1, t.adjustIndentation = 2;
|
|
1321
|
-
})(
|
|
1322
|
-
var
|
|
1321
|
+
})(Sn || (Sn = {}));
|
|
1322
|
+
var En;
|
|
1323
1323
|
(function(t) {
|
|
1324
1324
|
function r(n) {
|
|
1325
1325
|
const i = n;
|
|
1326
1326
|
return i && (T.string(i.detail) || i.detail === void 0) && (T.string(i.description) || i.description === void 0);
|
|
1327
1327
|
}
|
|
1328
1328
|
t.is = r;
|
|
1329
|
-
})(
|
|
1330
|
-
var
|
|
1329
|
+
})(En || (En = {}));
|
|
1330
|
+
var An;
|
|
1331
1331
|
(function(t) {
|
|
1332
1332
|
function r(n) {
|
|
1333
1333
|
return { label: n };
|
|
1334
1334
|
}
|
|
1335
1335
|
t.create = r;
|
|
1336
|
-
})(
|
|
1337
|
-
var
|
|
1336
|
+
})(An || (An = {}));
|
|
1337
|
+
var In;
|
|
1338
1338
|
(function(t) {
|
|
1339
1339
|
function r(n, i) {
|
|
1340
1340
|
return { items: n || [], isIncomplete: !!i };
|
|
1341
1341
|
}
|
|
1342
1342
|
t.create = r;
|
|
1343
|
-
})(
|
|
1343
|
+
})(In || (In = {}));
|
|
1344
1344
|
var re;
|
|
1345
1345
|
(function(t) {
|
|
1346
1346
|
function r(i) {
|
|
@@ -1353,50 +1353,50 @@ var re;
|
|
|
1353
1353
|
}
|
|
1354
1354
|
t.is = n;
|
|
1355
1355
|
})(re || (re = {}));
|
|
1356
|
-
var
|
|
1356
|
+
var Tn;
|
|
1357
1357
|
(function(t) {
|
|
1358
1358
|
function r(n) {
|
|
1359
1359
|
let i = n;
|
|
1360
|
-
return !!i && T.objectLiteral(i) && (
|
|
1360
|
+
return !!i && T.objectLiteral(i) && (qt.is(i.contents) || re.is(i.contents) || T.typedArray(i.contents, re.is)) && (n.range === void 0 || dt.is(n.range));
|
|
1361
1361
|
}
|
|
1362
1362
|
t.is = r;
|
|
1363
|
-
})(
|
|
1364
|
-
var
|
|
1363
|
+
})(Tn || (Tn = {}));
|
|
1364
|
+
var Rn;
|
|
1365
1365
|
(function(t) {
|
|
1366
1366
|
function r(n, i) {
|
|
1367
1367
|
return i ? { label: n, documentation: i } : { label: n };
|
|
1368
1368
|
}
|
|
1369
1369
|
t.create = r;
|
|
1370
|
-
})(
|
|
1371
|
-
var
|
|
1370
|
+
})(Rn || (Rn = {}));
|
|
1371
|
+
var Cn;
|
|
1372
1372
|
(function(t) {
|
|
1373
1373
|
function r(n, i, ...e) {
|
|
1374
1374
|
let a = { label: n };
|
|
1375
1375
|
return T.defined(i) && (a.documentation = i), T.defined(e) ? a.parameters = e : a.parameters = [], a;
|
|
1376
1376
|
}
|
|
1377
1377
|
t.create = r;
|
|
1378
|
-
})(
|
|
1379
|
-
var
|
|
1378
|
+
})(Cn || (Cn = {}));
|
|
1379
|
+
var On;
|
|
1380
1380
|
(function(t) {
|
|
1381
1381
|
t.Text = 1, t.Read = 2, t.Write = 3;
|
|
1382
|
-
})(
|
|
1383
|
-
var
|
|
1382
|
+
})(On || (On = {}));
|
|
1383
|
+
var zn;
|
|
1384
1384
|
(function(t) {
|
|
1385
1385
|
function r(n, i) {
|
|
1386
1386
|
let e = { range: n };
|
|
1387
1387
|
return T.number(i) && (e.kind = i), e;
|
|
1388
1388
|
}
|
|
1389
1389
|
t.create = r;
|
|
1390
|
-
})(
|
|
1391
|
-
var
|
|
1390
|
+
})(zn || (zn = {}));
|
|
1391
|
+
var $n;
|
|
1392
1392
|
(function(t) {
|
|
1393
1393
|
t.File = 1, t.Module = 2, t.Namespace = 3, t.Package = 4, t.Class = 5, t.Method = 6, t.Property = 7, t.Field = 8, t.Constructor = 9, t.Enum = 10, t.Interface = 11, t.Function = 12, t.Variable = 13, t.Constant = 14, t.String = 15, t.Number = 16, t.Boolean = 17, t.Array = 18, t.Object = 19, t.Key = 20, t.Null = 21, t.EnumMember = 22, t.Struct = 23, t.Event = 24, t.Operator = 25, t.TypeParameter = 26;
|
|
1394
|
-
})(
|
|
1395
|
-
var
|
|
1394
|
+
})($n || ($n = {}));
|
|
1395
|
+
var Ln;
|
|
1396
1396
|
(function(t) {
|
|
1397
1397
|
t.Deprecated = 1;
|
|
1398
|
-
})(
|
|
1399
|
-
var
|
|
1398
|
+
})(Ln || (Ln = {}));
|
|
1399
|
+
var Dn;
|
|
1400
1400
|
(function(t) {
|
|
1401
1401
|
function r(n, i, e, a, s) {
|
|
1402
1402
|
let o = {
|
|
@@ -1407,15 +1407,15 @@ var $n;
|
|
|
1407
1407
|
return s && (o.containerName = s), o;
|
|
1408
1408
|
}
|
|
1409
1409
|
t.create = r;
|
|
1410
|
-
})(
|
|
1411
|
-
var
|
|
1410
|
+
})(Dn || (Dn = {}));
|
|
1411
|
+
var Pn;
|
|
1412
1412
|
(function(t) {
|
|
1413
1413
|
function r(n, i, e, a) {
|
|
1414
1414
|
return a !== void 0 ? { name: n, kind: i, location: { uri: e, range: a } } : { name: n, kind: i, location: { uri: e } };
|
|
1415
1415
|
}
|
|
1416
1416
|
t.create = r;
|
|
1417
|
-
})(
|
|
1418
|
-
var
|
|
1417
|
+
})(Pn || (Pn = {}));
|
|
1418
|
+
var jn;
|
|
1419
1419
|
(function(t) {
|
|
1420
1420
|
function r(i, e, a, s, o, c) {
|
|
1421
1421
|
let l = {
|
|
@@ -1430,19 +1430,19 @@ var Dn;
|
|
|
1430
1430
|
t.create = r;
|
|
1431
1431
|
function n(i) {
|
|
1432
1432
|
let e = i;
|
|
1433
|
-
return e && T.string(e.name) && T.number(e.kind) &&
|
|
1433
|
+
return e && T.string(e.name) && T.number(e.kind) && dt.is(e.range) && dt.is(e.selectionRange) && (e.detail === void 0 || T.string(e.detail)) && (e.deprecated === void 0 || T.boolean(e.deprecated)) && (e.children === void 0 || Array.isArray(e.children)) && (e.tags === void 0 || Array.isArray(e.tags));
|
|
1434
1434
|
}
|
|
1435
1435
|
t.is = n;
|
|
1436
|
-
})(
|
|
1437
|
-
var
|
|
1436
|
+
})(jn || (jn = {}));
|
|
1437
|
+
var Ot;
|
|
1438
1438
|
(function(t) {
|
|
1439
1439
|
t.Empty = "", t.QuickFix = "quickfix", t.Refactor = "refactor", t.RefactorExtract = "refactor.extract", t.RefactorInline = "refactor.inline", t.RefactorRewrite = "refactor.rewrite", t.Source = "source", t.SourceOrganizeImports = "source.organizeImports", t.SourceFixAll = "source.fixAll";
|
|
1440
|
-
})(
|
|
1440
|
+
})(Ot || (Ot = {}));
|
|
1441
1441
|
var ie;
|
|
1442
1442
|
(function(t) {
|
|
1443
1443
|
t.Invoked = 1, t.Automatic = 2;
|
|
1444
1444
|
})(ie || (ie = {}));
|
|
1445
|
-
var
|
|
1445
|
+
var Fn;
|
|
1446
1446
|
(function(t) {
|
|
1447
1447
|
function r(i, e, a) {
|
|
1448
1448
|
let s = { diagnostics: i };
|
|
@@ -1454,21 +1454,21 @@ var Pn;
|
|
|
1454
1454
|
return T.defined(e) && T.typedArray(e.diagnostics, ne.is) && (e.only === void 0 || T.typedArray(e.only, T.string)) && (e.triggerKind === void 0 || e.triggerKind === ie.Invoked || e.triggerKind === ie.Automatic);
|
|
1455
1455
|
}
|
|
1456
1456
|
t.is = n;
|
|
1457
|
-
})(
|
|
1458
|
-
var
|
|
1457
|
+
})(Fn || (Fn = {}));
|
|
1458
|
+
var qn;
|
|
1459
1459
|
(function(t) {
|
|
1460
1460
|
function r(i, e, a) {
|
|
1461
1461
|
let s = { title: i }, o = !0;
|
|
1462
|
-
return typeof e == "string" ? (o = !1, s.kind = e) :
|
|
1462
|
+
return typeof e == "string" ? (o = !1, s.kind = e) : Tt.is(e) ? s.command = e : s.edit = e, o && a !== void 0 && (s.kind = a), s;
|
|
1463
1463
|
}
|
|
1464
1464
|
t.create = r;
|
|
1465
1465
|
function n(i) {
|
|
1466
1466
|
let e = i;
|
|
1467
|
-
return e && T.string(e.title) && (e.diagnostics === void 0 || T.typedArray(e.diagnostics, ne.is)) && (e.kind === void 0 || T.string(e.kind)) && (e.edit !== void 0 || e.command !== void 0) && (e.command === void 0 ||
|
|
1467
|
+
return e && T.string(e.title) && (e.diagnostics === void 0 || T.typedArray(e.diagnostics, ne.is)) && (e.kind === void 0 || T.string(e.kind)) && (e.edit !== void 0 || e.command !== void 0) && (e.command === void 0 || Tt.is(e.command)) && (e.isPreferred === void 0 || T.boolean(e.isPreferred)) && (e.edit === void 0 || Re.is(e.edit));
|
|
1468
1468
|
}
|
|
1469
1469
|
t.is = n;
|
|
1470
|
-
})(
|
|
1471
|
-
var
|
|
1470
|
+
})(qn || (qn = {}));
|
|
1471
|
+
var Bn;
|
|
1472
1472
|
(function(t) {
|
|
1473
1473
|
function r(i, e) {
|
|
1474
1474
|
let a = { range: i };
|
|
@@ -1477,11 +1477,11 @@ var Fn;
|
|
|
1477
1477
|
t.create = r;
|
|
1478
1478
|
function n(i) {
|
|
1479
1479
|
let e = i;
|
|
1480
|
-
return T.defined(e) &&
|
|
1480
|
+
return T.defined(e) && dt.is(e.range) && (T.undefined(e.command) || Tt.is(e.command));
|
|
1481
1481
|
}
|
|
1482
1482
|
t.is = n;
|
|
1483
|
-
})(
|
|
1484
|
-
var
|
|
1483
|
+
})(Bn || (Bn = {}));
|
|
1484
|
+
var Nn;
|
|
1485
1485
|
(function(t) {
|
|
1486
1486
|
function r(i, e) {
|
|
1487
1487
|
return { tabSize: i, insertSpaces: e };
|
|
@@ -1492,8 +1492,8 @@ var qn;
|
|
|
1492
1492
|
return T.defined(e) && T.uinteger(e.tabSize) && T.boolean(e.insertSpaces);
|
|
1493
1493
|
}
|
|
1494
1494
|
t.is = n;
|
|
1495
|
-
})(
|
|
1496
|
-
var
|
|
1495
|
+
})(Nn || (Nn = {}));
|
|
1496
|
+
var Un;
|
|
1497
1497
|
(function(t) {
|
|
1498
1498
|
function r(i, e, a) {
|
|
1499
1499
|
return { range: i, target: e, data: a };
|
|
@@ -1501,11 +1501,11 @@ var Bn;
|
|
|
1501
1501
|
t.create = r;
|
|
1502
1502
|
function n(i) {
|
|
1503
1503
|
let e = i;
|
|
1504
|
-
return T.defined(e) &&
|
|
1504
|
+
return T.defined(e) && dt.is(e.range) && (T.undefined(e.target) || T.string(e.target));
|
|
1505
1505
|
}
|
|
1506
1506
|
t.is = n;
|
|
1507
|
-
})(
|
|
1508
|
-
var
|
|
1507
|
+
})(Un || (Un = {}));
|
|
1508
|
+
var Mn;
|
|
1509
1509
|
(function(t) {
|
|
1510
1510
|
function r(i, e) {
|
|
1511
1511
|
return { range: i, parent: e };
|
|
@@ -1513,27 +1513,27 @@ var Nn;
|
|
|
1513
1513
|
t.create = r;
|
|
1514
1514
|
function n(i) {
|
|
1515
1515
|
let e = i;
|
|
1516
|
-
return T.objectLiteral(e) &&
|
|
1516
|
+
return T.objectLiteral(e) && dt.is(e.range) && (e.parent === void 0 || t.is(e.parent));
|
|
1517
1517
|
}
|
|
1518
1518
|
t.is = n;
|
|
1519
|
-
})(
|
|
1520
|
-
var
|
|
1519
|
+
})(Mn || (Mn = {}));
|
|
1520
|
+
var Wn;
|
|
1521
1521
|
(function(t) {
|
|
1522
1522
|
t.namespace = "namespace", t.type = "type", t.class = "class", t.enum = "enum", t.interface = "interface", t.struct = "struct", t.typeParameter = "typeParameter", t.parameter = "parameter", t.variable = "variable", t.property = "property", t.enumMember = "enumMember", t.event = "event", t.function = "function", t.method = "method", t.macro = "macro", t.keyword = "keyword", t.modifier = "modifier", t.comment = "comment", t.string = "string", t.number = "number", t.regexp = "regexp", t.operator = "operator", t.decorator = "decorator";
|
|
1523
|
-
})(
|
|
1524
|
-
var
|
|
1523
|
+
})(Wn || (Wn = {}));
|
|
1524
|
+
var Zn;
|
|
1525
1525
|
(function(t) {
|
|
1526
1526
|
t.declaration = "declaration", t.definition = "definition", t.readonly = "readonly", t.static = "static", t.deprecated = "deprecated", t.abstract = "abstract", t.async = "async", t.modification = "modification", t.documentation = "documentation", t.defaultLibrary = "defaultLibrary";
|
|
1527
|
-
})(
|
|
1528
|
-
var
|
|
1527
|
+
})(Zn || (Zn = {}));
|
|
1528
|
+
var Xn;
|
|
1529
1529
|
(function(t) {
|
|
1530
1530
|
function r(n) {
|
|
1531
1531
|
const i = n;
|
|
1532
1532
|
return T.objectLiteral(i) && (i.resultId === void 0 || typeof i.resultId == "string") && Array.isArray(i.data) && (i.data.length === 0 || typeof i.data[0] == "number");
|
|
1533
1533
|
}
|
|
1534
1534
|
t.is = r;
|
|
1535
|
-
})(
|
|
1536
|
-
var
|
|
1535
|
+
})(Xn || (Xn = {}));
|
|
1536
|
+
var Vn;
|
|
1537
1537
|
(function(t) {
|
|
1538
1538
|
function r(i, e) {
|
|
1539
1539
|
return { range: i, text: e };
|
|
@@ -1541,11 +1541,11 @@ var Zn;
|
|
|
1541
1541
|
t.create = r;
|
|
1542
1542
|
function n(i) {
|
|
1543
1543
|
const e = i;
|
|
1544
|
-
return e != null &&
|
|
1544
|
+
return e != null && dt.is(e.range) && T.string(e.text);
|
|
1545
1545
|
}
|
|
1546
1546
|
t.is = n;
|
|
1547
|
-
})(
|
|
1548
|
-
var
|
|
1547
|
+
})(Vn || (Vn = {}));
|
|
1548
|
+
var Gn;
|
|
1549
1549
|
(function(t) {
|
|
1550
1550
|
function r(i, e, a) {
|
|
1551
1551
|
return { range: i, variableName: e, caseSensitiveLookup: a };
|
|
@@ -1553,11 +1553,11 @@ var Xn;
|
|
|
1553
1553
|
t.create = r;
|
|
1554
1554
|
function n(i) {
|
|
1555
1555
|
const e = i;
|
|
1556
|
-
return e != null &&
|
|
1556
|
+
return e != null && dt.is(e.range) && T.boolean(e.caseSensitiveLookup) && (T.string(e.variableName) || e.variableName === void 0);
|
|
1557
1557
|
}
|
|
1558
1558
|
t.is = n;
|
|
1559
|
-
})(
|
|
1560
|
-
var
|
|
1559
|
+
})(Gn || (Gn = {}));
|
|
1560
|
+
var Hn;
|
|
1561
1561
|
(function(t) {
|
|
1562
1562
|
function r(i, e) {
|
|
1563
1563
|
return { range: i, expression: e };
|
|
@@ -1565,11 +1565,11 @@ var Vn;
|
|
|
1565
1565
|
t.create = r;
|
|
1566
1566
|
function n(i) {
|
|
1567
1567
|
const e = i;
|
|
1568
|
-
return e != null &&
|
|
1568
|
+
return e != null && dt.is(e.range) && (T.string(e.expression) || e.expression === void 0);
|
|
1569
1569
|
}
|
|
1570
1570
|
t.is = n;
|
|
1571
|
-
})(
|
|
1572
|
-
var
|
|
1571
|
+
})(Hn || (Hn = {}));
|
|
1572
|
+
var Yn;
|
|
1573
1573
|
(function(t) {
|
|
1574
1574
|
function r(i, e) {
|
|
1575
1575
|
return { frameId: i, stoppedLocation: e };
|
|
@@ -1577,19 +1577,19 @@ var Gn;
|
|
|
1577
1577
|
t.create = r;
|
|
1578
1578
|
function n(i) {
|
|
1579
1579
|
const e = i;
|
|
1580
|
-
return T.defined(e) &&
|
|
1580
|
+
return T.defined(e) && dt.is(i.stoppedLocation);
|
|
1581
1581
|
}
|
|
1582
1582
|
t.is = n;
|
|
1583
|
-
})(
|
|
1584
|
-
var
|
|
1583
|
+
})(Yn || (Yn = {}));
|
|
1584
|
+
var ze;
|
|
1585
1585
|
(function(t) {
|
|
1586
1586
|
t.Type = 1, t.Parameter = 2;
|
|
1587
1587
|
function r(n) {
|
|
1588
1588
|
return n === 1 || n === 2;
|
|
1589
1589
|
}
|
|
1590
1590
|
t.is = r;
|
|
1591
|
-
})(
|
|
1592
|
-
var
|
|
1591
|
+
})(ze || (ze = {}));
|
|
1592
|
+
var $e;
|
|
1593
1593
|
(function(t) {
|
|
1594
1594
|
function r(i) {
|
|
1595
1595
|
return { value: i };
|
|
@@ -1597,11 +1597,11 @@ var Oe;
|
|
|
1597
1597
|
t.create = r;
|
|
1598
1598
|
function n(i) {
|
|
1599
1599
|
const e = i;
|
|
1600
|
-
return T.objectLiteral(e) && (e.tooltip === void 0 || T.string(e.tooltip) ||
|
|
1600
|
+
return T.objectLiteral(e) && (e.tooltip === void 0 || T.string(e.tooltip) || qt.is(e.tooltip)) && (e.location === void 0 || ee.is(e.location)) && (e.command === void 0 || Tt.is(e.command));
|
|
1601
1601
|
}
|
|
1602
1602
|
t.is = n;
|
|
1603
|
-
})(
|
|
1604
|
-
var
|
|
1603
|
+
})($e || ($e = {}));
|
|
1604
|
+
var Jn;
|
|
1605
1605
|
(function(t) {
|
|
1606
1606
|
function r(i, e, a) {
|
|
1607
1607
|
const s = { position: i, label: e };
|
|
@@ -1610,61 +1610,61 @@ var Hn;
|
|
|
1610
1610
|
t.create = r;
|
|
1611
1611
|
function n(i) {
|
|
1612
1612
|
const e = i;
|
|
1613
|
-
return T.objectLiteral(e) && wt.is(e.position) && (T.string(e.label) || T.typedArray(e.label,
|
|
1613
|
+
return T.objectLiteral(e) && wt.is(e.position) && (T.string(e.label) || T.typedArray(e.label, $e.is)) && (e.kind === void 0 || ze.is(e.kind)) && e.textEdits === void 0 || T.typedArray(e.textEdits, Rt.is) && (e.tooltip === void 0 || T.string(e.tooltip) || qt.is(e.tooltip)) && (e.paddingLeft === void 0 || T.boolean(e.paddingLeft)) && (e.paddingRight === void 0 || T.boolean(e.paddingRight));
|
|
1614
1614
|
}
|
|
1615
1615
|
t.is = n;
|
|
1616
|
-
})(
|
|
1617
|
-
var
|
|
1616
|
+
})(Jn || (Jn = {}));
|
|
1617
|
+
var Kn;
|
|
1618
1618
|
(function(t) {
|
|
1619
1619
|
function r(n) {
|
|
1620
1620
|
return { kind: "snippet", value: n };
|
|
1621
1621
|
}
|
|
1622
1622
|
t.createSnippet = r;
|
|
1623
|
-
})(
|
|
1624
|
-
var
|
|
1623
|
+
})(Kn || (Kn = {}));
|
|
1624
|
+
var Qn;
|
|
1625
1625
|
(function(t) {
|
|
1626
1626
|
function r(n, i, e, a) {
|
|
1627
1627
|
return { insertText: n, filterText: i, range: e, command: a };
|
|
1628
1628
|
}
|
|
1629
1629
|
t.create = r;
|
|
1630
|
-
})(
|
|
1631
|
-
var
|
|
1630
|
+
})(Qn || (Qn = {}));
|
|
1631
|
+
var tr;
|
|
1632
1632
|
(function(t) {
|
|
1633
1633
|
function r(n) {
|
|
1634
1634
|
return { items: n };
|
|
1635
1635
|
}
|
|
1636
1636
|
t.create = r;
|
|
1637
|
-
})(
|
|
1638
|
-
var
|
|
1637
|
+
})(tr || (tr = {}));
|
|
1638
|
+
var er;
|
|
1639
1639
|
(function(t) {
|
|
1640
1640
|
t.Invoked = 0, t.Automatic = 1;
|
|
1641
|
-
})(
|
|
1642
|
-
var
|
|
1641
|
+
})(er || (er = {}));
|
|
1642
|
+
var nr;
|
|
1643
1643
|
(function(t) {
|
|
1644
1644
|
function r(n, i) {
|
|
1645
1645
|
return { range: n, text: i };
|
|
1646
1646
|
}
|
|
1647
1647
|
t.create = r;
|
|
1648
|
-
})(
|
|
1649
|
-
var
|
|
1648
|
+
})(nr || (nr = {}));
|
|
1649
|
+
var rr;
|
|
1650
1650
|
(function(t) {
|
|
1651
1651
|
function r(n, i) {
|
|
1652
1652
|
return { triggerKind: n, selectedCompletionInfo: i };
|
|
1653
1653
|
}
|
|
1654
1654
|
t.create = r;
|
|
1655
|
-
})(
|
|
1656
|
-
var
|
|
1655
|
+
})(rr || (rr = {}));
|
|
1656
|
+
var ir;
|
|
1657
1657
|
(function(t) {
|
|
1658
1658
|
function r(n) {
|
|
1659
1659
|
const i = n;
|
|
1660
|
-
return T.objectLiteral(i) &&
|
|
1660
|
+
return T.objectLiteral(i) && ye.is(i.uri) && T.string(i.name);
|
|
1661
1661
|
}
|
|
1662
1662
|
t.is = r;
|
|
1663
|
-
})(
|
|
1664
|
-
var
|
|
1663
|
+
})(ir || (ir = {}));
|
|
1664
|
+
var ar;
|
|
1665
1665
|
(function(t) {
|
|
1666
1666
|
function r(a, s, o, c) {
|
|
1667
|
-
return new
|
|
1667
|
+
return new Li(a, s, o, c);
|
|
1668
1668
|
}
|
|
1669
1669
|
t.create = r;
|
|
1670
1670
|
function n(a) {
|
|
@@ -1702,8 +1702,8 @@ var rr;
|
|
|
1702
1702
|
a[g++] = l[p++];
|
|
1703
1703
|
return a;
|
|
1704
1704
|
}
|
|
1705
|
-
})(
|
|
1706
|
-
class
|
|
1705
|
+
})(ar || (ar = {}));
|
|
1706
|
+
class Li {
|
|
1707
1707
|
constructor(r, n, i, e) {
|
|
1708
1708
|
this._uri = r, this._languageId = n, this._version = i, this._content = e, this._lineOffsets = void 0;
|
|
1709
1709
|
}
|
|
@@ -1813,13 +1813,13 @@ var T;
|
|
|
1813
1813
|
}
|
|
1814
1814
|
t.typedArray = g;
|
|
1815
1815
|
})(T || (T = {}));
|
|
1816
|
-
const
|
|
1816
|
+
const Di = {
|
|
1817
1817
|
unused: "LaTeX-specific markup",
|
|
1818
1818
|
presentation: "Presentation does not go into PreTeXt source",
|
|
1819
1819
|
accessibility: "Accessibility issue",
|
|
1820
1820
|
mistake: "This feature should not have been added to LaTeX",
|
|
1821
1821
|
archaic: "plain TeX that should not be in LaTeX source"
|
|
1822
|
-
},
|
|
1822
|
+
}, Pi = {
|
|
1823
1823
|
textbf: [
|
|
1824
1824
|
{ macro: "alert", meaning: "something the reader must not miss" },
|
|
1825
1825
|
{ macro: "term", meaning: "a term being defined" },
|
|
@@ -1866,7 +1866,7 @@ function bt(t, r) {
|
|
|
1866
1866
|
reportMatch: l
|
|
1867
1867
|
}));
|
|
1868
1868
|
}
|
|
1869
|
-
const
|
|
1869
|
+
const ji = [
|
|
1870
1870
|
{
|
|
1871
1871
|
id: "paren-ref",
|
|
1872
1872
|
label: "(\\ref{...})",
|
|
@@ -1936,7 +1936,7 @@ const Di = [
|
|
|
1936
1936
|
replacement: "\\vspace{$1$2}",
|
|
1937
1937
|
severity: "info"
|
|
1938
1938
|
}
|
|
1939
|
-
],
|
|
1939
|
+
], Fi = [
|
|
1940
1940
|
{ from: "rm", to: "textrm" },
|
|
1941
1941
|
{ from: "em", to: "emph" },
|
|
1942
1942
|
{ from: "it", to: "textit" },
|
|
@@ -1947,7 +1947,7 @@ const Di = [
|
|
|
1947
1947
|
// Upstream typos, preserved so behavior matches PreprocessLaTeX.
|
|
1948
1948
|
{ from: "sffamily", to: "textss" },
|
|
1949
1949
|
{ from: "textsl", to: "testsl" }
|
|
1950
|
-
],
|
|
1950
|
+
], qi = Fi.map(
|
|
1951
1951
|
({ from: t, to: r }) => ({
|
|
1952
1952
|
id: `tex-font-${t}`,
|
|
1953
1953
|
label: t,
|
|
@@ -1964,7 +1964,7 @@ const Di = [
|
|
|
1964
1964
|
severity: "info",
|
|
1965
1965
|
message: `{\\${t} …} is a plain-TeX font directive; \\${r}{…} is its LaTeX form.`
|
|
1966
1966
|
})
|
|
1967
|
-
),
|
|
1967
|
+
), Bi = [
|
|
1968
1968
|
// --- badEverywhereMacros: bare control words, deleted wherever they appear.
|
|
1969
1969
|
...bt(["if", "fi", "iffalse", "then", "else", "loop", "repeat"], {
|
|
1970
1970
|
kind: "unused",
|
|
@@ -2120,7 +2120,7 @@ const Di = [
|
|
|
2120
2120
|
severity: "warning"
|
|
2121
2121
|
}).map((t) => ({
|
|
2122
2122
|
...t,
|
|
2123
|
-
alternatives:
|
|
2123
|
+
alternatives: Pi[t.id]
|
|
2124
2124
|
})),
|
|
2125
2125
|
// --- badBodyEnvironments: the wrapper goes, the content stays.
|
|
2126
2126
|
...["center", "minipage"].map(
|
|
@@ -2135,12 +2135,12 @@ const Di = [
|
|
|
2135
2135
|
severity: "info"
|
|
2136
2136
|
})
|
|
2137
2137
|
)
|
|
2138
|
-
],
|
|
2139
|
-
...Di,
|
|
2138
|
+
], Ni = [
|
|
2140
2139
|
...ji,
|
|
2141
|
-
...
|
|
2140
|
+
...qi,
|
|
2141
|
+
...Bi
|
|
2142
2142
|
];
|
|
2143
|
-
function
|
|
2143
|
+
function Sr(t, r = "auto") {
|
|
2144
2144
|
const n = { start: 0, end: 0 };
|
|
2145
2145
|
if (r === "preamble")
|
|
2146
2146
|
return {
|
|
@@ -2158,21 +2158,21 @@ function xr(t, r = "auto") {
|
|
|
2158
2158
|
bibliography: o
|
|
2159
2159
|
};
|
|
2160
2160
|
}
|
|
2161
|
-
function
|
|
2162
|
-
const r =
|
|
2161
|
+
function Ui(t) {
|
|
2162
|
+
const r = $i(t), n = [];
|
|
2163
2163
|
let i = null;
|
|
2164
2164
|
for (const e of r.environments)
|
|
2165
|
-
|
|
2165
|
+
kr.has(e.name) && (e.type === "begin" ? i === null && (i = e.start) : i !== null && (n.push({ start: i, end: e.end }), i = null));
|
|
2166
2166
|
return i !== null && n.push({ start: i, end: t.length }), { math: r.mathRegions, comment: r.commentRegions, verbatim: n };
|
|
2167
2167
|
}
|
|
2168
|
-
const
|
|
2169
|
-
function
|
|
2168
|
+
const Mi = ["comment", "verbatim"];
|
|
2169
|
+
function Wi(t, r, n) {
|
|
2170
2170
|
return t.some((i) => r < i.end && n > i.start);
|
|
2171
2171
|
}
|
|
2172
|
-
function
|
|
2172
|
+
function sr(t) {
|
|
2173
2173
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2174
2174
|
}
|
|
2175
|
-
function
|
|
2175
|
+
function Zi(t) {
|
|
2176
2176
|
const { match: r } = t;
|
|
2177
2177
|
if (r.type === "regex")
|
|
2178
2178
|
return new RegExp(
|
|
@@ -2181,10 +2181,10 @@ function Mi(t) {
|
|
|
2181
2181
|
);
|
|
2182
2182
|
if (r.type === "environment")
|
|
2183
2183
|
return new RegExp(
|
|
2184
|
-
`\\\\(?:begin|end)\\{\\s*${
|
|
2184
|
+
`\\\\(?:begin|end)\\{\\s*${sr(r.name)}\\}`,
|
|
2185
2185
|
"g"
|
|
2186
2186
|
);
|
|
2187
|
-
const n =
|
|
2187
|
+
const n = sr(r.name);
|
|
2188
2188
|
if (r.form === "args") {
|
|
2189
2189
|
let i = `\\\\${n}\\b\\*?`;
|
|
2190
2190
|
for (let e = 0; e < (r.arity ?? 1); e += 1) i += "\\{[^{}]*\\}";
|
|
@@ -2192,22 +2192,22 @@ function Mi(t) {
|
|
|
2192
2192
|
}
|
|
2193
2193
|
return r.form === "line" ? new RegExp(`\\\\${n}\\b.*`, "g") : new RegExp(`\\\\${n}\\b`, "g");
|
|
2194
2194
|
}
|
|
2195
|
-
function
|
|
2195
|
+
function Xi(t) {
|
|
2196
2196
|
if (t.label) return t.label;
|
|
2197
2197
|
const { match: r } = t;
|
|
2198
2198
|
return r.type === "macro" || r.type === "environment" ? r.name : t.id;
|
|
2199
2199
|
}
|
|
2200
|
-
function
|
|
2200
|
+
function Vi(t, r) {
|
|
2201
2201
|
return t.replace(
|
|
2202
2202
|
/\$(\d)/g,
|
|
2203
2203
|
(n, i) => r[Number(i)] ?? ""
|
|
2204
2204
|
);
|
|
2205
2205
|
}
|
|
2206
|
-
function
|
|
2207
|
-
const { scope: n = "auto", disable: i, only: e } = r, a =
|
|
2208
|
-
return
|
|
2206
|
+
function Ft(t, r = {}) {
|
|
2207
|
+
const { scope: n = "auto", disable: i, only: e } = r, a = Sr(t, n), s = Ui(t), o = new Set(i ?? []), c = e ? new Set(e) : null, l = [];
|
|
2208
|
+
return Ni.forEach((f, p) => {
|
|
2209
2209
|
if (o.has(f.id) || c && !c.has(f.id)) return;
|
|
2210
|
-
const d = (f.skipIn ??
|
|
2210
|
+
const d = (f.skipIn ?? Mi).flatMap((v) => s[v]), w = Zi(f);
|
|
2211
2211
|
let h;
|
|
2212
2212
|
for (; (h = w.exec(t)) !== null; ) {
|
|
2213
2213
|
const v = h.index, b = v + h[0].length;
|
|
@@ -2215,15 +2215,15 @@ function jt(t, r = {}) {
|
|
|
2215
2215
|
w.lastIndex += 1;
|
|
2216
2216
|
continue;
|
|
2217
2217
|
}
|
|
2218
|
-
if (!
|
|
2219
|
-
const x = f.action === "flag" ? void 0 : f.action === "delete" ? "" :
|
|
2218
|
+
if (!Gi(f.scope, a, v) || Wi(d, v, b)) continue;
|
|
2219
|
+
const x = f.action === "flag" ? void 0 : f.action === "delete" ? "" : Vi(f.replacement ?? "", h);
|
|
2220
2220
|
x !== h[0] && l.push({
|
|
2221
2221
|
ruleId: f.id,
|
|
2222
2222
|
action: f.action,
|
|
2223
2223
|
severity: f.severity,
|
|
2224
2224
|
kind: f.kind,
|
|
2225
2225
|
category: f.category,
|
|
2226
|
-
macro:
|
|
2226
|
+
macro: Xi(f),
|
|
2227
2227
|
start: v,
|
|
2228
2228
|
end: b,
|
|
2229
2229
|
matched: h[0],
|
|
@@ -2235,16 +2235,16 @@ function jt(t, r = {}) {
|
|
|
2235
2235
|
priority: p
|
|
2236
2236
|
});
|
|
2237
2237
|
}
|
|
2238
|
-
}),
|
|
2238
|
+
}), Hi(l);
|
|
2239
2239
|
}
|
|
2240
|
-
function
|
|
2240
|
+
function Gi(t, r, n) {
|
|
2241
2241
|
if (r.bibliography && n >= r.bibliography.start)
|
|
2242
2242
|
return !1;
|
|
2243
2243
|
if (t === "anywhere") return !0;
|
|
2244
2244
|
const i = t === "preamble" ? r.preamble : r.body;
|
|
2245
2245
|
return n >= i.start && n < i.end;
|
|
2246
2246
|
}
|
|
2247
|
-
function
|
|
2247
|
+
function Hi(t) {
|
|
2248
2248
|
const r = t.filter((a) => a.replacement !== void 0).sort(
|
|
2249
2249
|
(a, s) => a.start - s.start || s.end - s.start - (a.end - a.start) || a.priority - s.priority
|
|
2250
2250
|
), n = [];
|
|
@@ -2256,10 +2256,10 @@ function Vi(t) {
|
|
|
2256
2256
|
);
|
|
2257
2257
|
return [...n, ...e].sort((a, s) => a.start - s.start || a.priority - s.priority).map(({ priority: a, ...s }) => s);
|
|
2258
2258
|
}
|
|
2259
|
-
function
|
|
2259
|
+
function Yi(t) {
|
|
2260
2260
|
return t !== void 0 && (t >= "a" && t <= "z" || t >= "A" && t <= "Z");
|
|
2261
2261
|
}
|
|
2262
|
-
function
|
|
2262
|
+
function or(t, r, n, i) {
|
|
2263
2263
|
if (t[r] !== n) return null;
|
|
2264
2264
|
let e = 0;
|
|
2265
2265
|
for (let a = r; a < t.length; a += 1) {
|
|
@@ -2274,12 +2274,12 @@ function ar(t, r, n, i) {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
return null;
|
|
2276
2276
|
}
|
|
2277
|
-
function
|
|
2277
|
+
function Ji(t, r) {
|
|
2278
2278
|
if (t[r] !== "\\") return null;
|
|
2279
2279
|
let n = r + 1;
|
|
2280
|
-
for (;
|
|
2280
|
+
for (; Yi(t[n]); ) n += 1;
|
|
2281
2281
|
if (n === r + 1) return null;
|
|
2282
|
-
const i = t.slice(r + 1, n), e = n, a =
|
|
2282
|
+
const i = t.slice(r + 1, n), e = n, a = Ci.get(i)?.signature ?? "m", s = [];
|
|
2283
2283
|
let o = e;
|
|
2284
2284
|
for (const c of a.split(/\s+/).filter(Boolean)) {
|
|
2285
2285
|
let l = o;
|
|
@@ -2289,55 +2289,55 @@ function Hi(t, r) {
|
|
|
2289
2289
|
continue;
|
|
2290
2290
|
}
|
|
2291
2291
|
if (c === "o") {
|
|
2292
|
-
const p =
|
|
2292
|
+
const p = or(t, l, "[", "]");
|
|
2293
2293
|
p !== null && (o = p);
|
|
2294
2294
|
continue;
|
|
2295
2295
|
}
|
|
2296
|
-
const f =
|
|
2296
|
+
const f = or(t, l, "{", "}");
|
|
2297
2297
|
if (f === null) break;
|
|
2298
2298
|
s.push({ start: l + 1, end: f - 1 }), o = f;
|
|
2299
2299
|
}
|
|
2300
2300
|
return { name: i, start: r, nameEnd: e, end: o, mandatoryArguments: s };
|
|
2301
2301
|
}
|
|
2302
|
-
function
|
|
2302
|
+
function Ki(t, r) {
|
|
2303
2303
|
return r.mandatoryArguments.map((n) => t.slice(n.start, n.end)).join("");
|
|
2304
2304
|
}
|
|
2305
|
-
function
|
|
2305
|
+
function pe(t) {
|
|
2306
2306
|
return t.mandatoryArguments.length === 0;
|
|
2307
2307
|
}
|
|
2308
|
-
function
|
|
2308
|
+
function Qi(t, r) {
|
|
2309
2309
|
const n = r.filter((s) => s.replacement !== void 0).sort((s, o) => o.start - s.start), i = [];
|
|
2310
2310
|
let e = t, a = Number.POSITIVE_INFINITY;
|
|
2311
2311
|
for (const s of n)
|
|
2312
2312
|
s.end > a || (e = e.slice(0, s.start) + s.replacement + e.slice(s.end), i.push(s), a = s.start);
|
|
2313
2313
|
return { output: e, applied: i.reverse() };
|
|
2314
2314
|
}
|
|
2315
|
-
function
|
|
2315
|
+
function Me(t, r = {}) {
|
|
2316
2316
|
const { maxPasses: n = 5, ...i } = r, e = [];
|
|
2317
2317
|
let a = t, s = 0, o = !1;
|
|
2318
2318
|
for (; s < n; s += 1) {
|
|
2319
|
-
const l =
|
|
2319
|
+
const l = Ft(a, i).filter((g) => g.replacement !== void 0);
|
|
2320
2320
|
if (l.length === 0) break;
|
|
2321
|
-
const { output: f, applied: p } =
|
|
2321
|
+
const { output: f, applied: p } = Qi(a, l);
|
|
2322
2322
|
if (f === a) break;
|
|
2323
|
-
e.push(...p), a = f, s === n - 1 && (o =
|
|
2323
|
+
e.push(...p), a = f, s === n - 1 && (o = Ft(a, i).some(
|
|
2324
2324
|
(g) => g.replacement !== void 0
|
|
2325
2325
|
));
|
|
2326
2326
|
}
|
|
2327
2327
|
return e.push(
|
|
2328
|
-
...
|
|
2328
|
+
...Ft(a, i).filter(
|
|
2329
2329
|
(c) => c.replacement === void 0
|
|
2330
2330
|
)
|
|
2331
2331
|
), { output: a, fixes: e, passes: s, truncated: o };
|
|
2332
2332
|
}
|
|
2333
|
-
const
|
|
2334
|
-
info:
|
|
2335
|
-
warning:
|
|
2336
|
-
error:
|
|
2333
|
+
const ta = "pretext-latex-clean", ea = {
|
|
2334
|
+
info: jt.Information,
|
|
2335
|
+
warning: jt.Warning,
|
|
2336
|
+
error: jt.Error
|
|
2337
2337
|
};
|
|
2338
|
-
function
|
|
2338
|
+
function na(t) {
|
|
2339
2339
|
if (t.message) return t.message;
|
|
2340
|
-
const r =
|
|
2340
|
+
const r = Di[t.kind], n = t.ruleId.startsWith("env-") ? `The ${t.macro} environment` : `\\${t.macro}`;
|
|
2341
2341
|
if (t.action === "replace")
|
|
2342
2342
|
return `${n} is rewritten on import.`;
|
|
2343
2343
|
if (t.action === "delete")
|
|
@@ -2348,13 +2348,13 @@ function ta(t) {
|
|
|
2348
2348
|
}
|
|
2349
2349
|
return r ? `${n}: ${r}.` : `${n} is presentational.`;
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function We(t, r) {
|
|
2352
2352
|
return r.map((n) => ({
|
|
2353
|
-
severity:
|
|
2353
|
+
severity: ea[n.severity],
|
|
2354
2354
|
range: Qt(t, n.start, n.end),
|
|
2355
|
-
source:
|
|
2355
|
+
source: ta,
|
|
2356
2356
|
code: n.ruleId,
|
|
2357
|
-
message:
|
|
2357
|
+
message: na(n),
|
|
2358
2358
|
data: {
|
|
2359
2359
|
ruleId: n.ruleId,
|
|
2360
2360
|
start: n.start,
|
|
@@ -2363,10 +2363,10 @@ function Ue(t, r) {
|
|
|
2363
2363
|
}
|
|
2364
2364
|
}));
|
|
2365
2365
|
}
|
|
2366
|
-
function
|
|
2367
|
-
return
|
|
2366
|
+
function Eo(t, r) {
|
|
2367
|
+
return We(t, Ft(t, r));
|
|
2368
2368
|
}
|
|
2369
|
-
function
|
|
2369
|
+
function cr(t, r, n) {
|
|
2370
2370
|
let i = 0;
|
|
2371
2371
|
for (let e = 0; e < r; e += 1) {
|
|
2372
2372
|
const a = t.indexOf(`
|
|
@@ -2376,38 +2376,38 @@ function sr(t, r, n) {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
return Math.min(i + n, t.length);
|
|
2378
2378
|
}
|
|
2379
|
-
function
|
|
2380
|
-
const i =
|
|
2379
|
+
function ra(t, r, n) {
|
|
2380
|
+
const i = cr(t, n.start.line, n.start.character), e = cr(t, n.end.line, n.end.character);
|
|
2381
2381
|
return i === e ? r.start <= i && i <= r.end : r.start < e && r.end > i;
|
|
2382
2382
|
}
|
|
2383
|
-
function
|
|
2384
|
-
const { uri: i, includeCleanAll: e = !0, ...a } = n, s =
|
|
2383
|
+
function Ao(t, r, n) {
|
|
2384
|
+
const { uri: i, includeCleanAll: e = !0, ...a } = n, s = Ft(t, a), o = [];
|
|
2385
2385
|
for (const c of s)
|
|
2386
|
-
if (
|
|
2386
|
+
if (ra(t, c, r)) {
|
|
2387
2387
|
if (c.replacement !== void 0) {
|
|
2388
2388
|
const l = {
|
|
2389
2389
|
range: Qt(t, c.start, c.end),
|
|
2390
2390
|
newText: c.replacement
|
|
2391
2391
|
};
|
|
2392
2392
|
o.push({
|
|
2393
|
-
title:
|
|
2394
|
-
kind:
|
|
2395
|
-
diagnostics:
|
|
2393
|
+
title: aa(c),
|
|
2394
|
+
kind: Ot.QuickFix,
|
|
2395
|
+
diagnostics: We(t, [c]),
|
|
2396
2396
|
edit: { changes: { [i]: [l] } }
|
|
2397
2397
|
});
|
|
2398
2398
|
continue;
|
|
2399
2399
|
}
|
|
2400
|
-
o.push(...
|
|
2400
|
+
o.push(...ia(t, s, c, i));
|
|
2401
2401
|
}
|
|
2402
2402
|
if (e) {
|
|
2403
|
-
const c =
|
|
2403
|
+
const c = Me(t, a);
|
|
2404
2404
|
if (c.output !== t) {
|
|
2405
2405
|
const l = c.fixes.filter(
|
|
2406
2406
|
(f) => f.replacement !== void 0
|
|
2407
2407
|
).length;
|
|
2408
2408
|
o.push({
|
|
2409
2409
|
title: `Clean up LaTeX (${l} change${l === 1 ? "" : "s"})`,
|
|
2410
|
-
kind:
|
|
2410
|
+
kind: Ot.SourceFixAll,
|
|
2411
2411
|
// One whole-document edit: the fixpoint loop's intermediate offsets do
|
|
2412
2412
|
// not map back onto the original text, so per-fix edits would be wrong.
|
|
2413
2413
|
edit: {
|
|
@@ -2416,7 +2416,7 @@ function wo(t, r, n) {
|
|
|
2416
2416
|
{
|
|
2417
2417
|
range: {
|
|
2418
2418
|
start: { line: 0, character: 0 },
|
|
2419
|
-
end:
|
|
2419
|
+
end: _e(t, t.length)
|
|
2420
2420
|
},
|
|
2421
2421
|
newText: c.output
|
|
2422
2422
|
}
|
|
@@ -2428,12 +2428,12 @@ function wo(t, r, n) {
|
|
|
2428
2428
|
}
|
|
2429
2429
|
return o;
|
|
2430
2430
|
}
|
|
2431
|
-
function
|
|
2432
|
-
const e =
|
|
2431
|
+
function ia(t, r, n, i) {
|
|
2432
|
+
const e = We(t, [n]), a = r.filter((f) => f.ruleId === n.ruleId), s = [], o = (f, p, g) => {
|
|
2433
2433
|
const d = g(n);
|
|
2434
2434
|
if (!d || (s.push({
|
|
2435
2435
|
title: f,
|
|
2436
|
-
kind:
|
|
2436
|
+
kind: Ot.QuickFix,
|
|
2437
2437
|
diagnostics: e,
|
|
2438
2438
|
edit: {
|
|
2439
2439
|
changes: {
|
|
@@ -2449,7 +2449,7 @@ function na(t, r, n, i) {
|
|
|
2449
2449
|
const w = a.map(g).filter((h) => h !== null);
|
|
2450
2450
|
w.length < 2 || s.push({
|
|
2451
2451
|
title: p.replace("{n}", String(w.length)),
|
|
2452
|
-
kind:
|
|
2452
|
+
kind: Ot.QuickFix,
|
|
2453
2453
|
diagnostics: e,
|
|
2454
2454
|
edit: {
|
|
2455
2455
|
changes: {
|
|
@@ -2471,20 +2471,20 @@ function na(t, r, n, i) {
|
|
|
2471
2471
|
newText: `\\${f.macro}`
|
|
2472
2472
|
})
|
|
2473
2473
|
);
|
|
2474
|
-
const c = (f) =>
|
|
2475
|
-
return l && !
|
|
2474
|
+
const c = (f) => Ji(t, f.start), l = c(n);
|
|
2475
|
+
return l && !pe(l) && o(
|
|
2476
2476
|
`Remove \\${n.macro}, keep its text`,
|
|
2477
2477
|
`Remove all {n} \\${n.macro}, keep their text`,
|
|
2478
2478
|
(f) => {
|
|
2479
2479
|
const p = c(f);
|
|
2480
|
-
return !p ||
|
|
2480
|
+
return !p || pe(p) ? null : {
|
|
2481
2481
|
start: p.start,
|
|
2482
2482
|
end: p.end,
|
|
2483
|
-
newText:
|
|
2483
|
+
newText: Ki(t, p)
|
|
2484
2484
|
};
|
|
2485
2485
|
}
|
|
2486
2486
|
), o(
|
|
2487
|
-
l && !
|
|
2487
|
+
l && !pe(l) ? `Delete \\${n.macro} and its text` : `Delete \\${n.macro}`,
|
|
2488
2488
|
`Delete all {n} \\${n.macro} and their text`,
|
|
2489
2489
|
(f) => {
|
|
2490
2490
|
const p = c(f);
|
|
@@ -2492,11 +2492,11 @@ function na(t, r, n, i) {
|
|
|
2492
2492
|
}
|
|
2493
2493
|
), s;
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2495
|
+
function aa(t) {
|
|
2496
2496
|
const r = t.ruleId.startsWith("env-") ? `\\begin{${t.macro}}` : `\\${t.macro}`;
|
|
2497
2497
|
return t.replacement === "" ? `Remove ${r}` : `Replace ${r} with ${t.replacementLabel ?? t.replacement?.trim()}`;
|
|
2498
2498
|
}
|
|
2499
|
-
function
|
|
2499
|
+
function sa(t) {
|
|
2500
2500
|
const { mainSource: r, publication: n, outputBase: i = "output" } = t;
|
|
2501
2501
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
2502
2502
|
<project ptx-version="2">
|
|
@@ -2517,7 +2517,7 @@ function ia(t) {
|
|
|
2517
2517
|
</project>
|
|
2518
2518
|
`;
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function Er() {
|
|
2521
2521
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
2522
2522
|
<publication>
|
|
2523
2523
|
<source>
|
|
@@ -2529,42 +2529,42 @@ function kr() {
|
|
|
2529
2529
|
</publication>
|
|
2530
2530
|
`;
|
|
2531
2531
|
}
|
|
2532
|
-
function
|
|
2532
|
+
function oa() {
|
|
2533
2533
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
2534
2534
|
`;
|
|
2535
2535
|
}
|
|
2536
|
-
const
|
|
2537
|
-
function
|
|
2536
|
+
const ca = "http://www.w3.org/2001/XInclude";
|
|
2537
|
+
function Ze(t) {
|
|
2538
2538
|
return t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
|
|
2539
2539
|
}
|
|
2540
2540
|
function ue(t, r) {
|
|
2541
2541
|
const n = String(r).length;
|
|
2542
2542
|
return String(t).padStart(Math.max(n, 2), "0");
|
|
2543
2543
|
}
|
|
2544
|
-
function
|
|
2544
|
+
function Wt(t, r) {
|
|
2545
2545
|
const n = [...r].sort((a, s) => a.start - s.start);
|
|
2546
2546
|
let i = "", e = 0;
|
|
2547
2547
|
for (const a of n)
|
|
2548
2548
|
i += t.slice(e, a.start), i += a.replacement, e = a.end;
|
|
2549
2549
|
return i += t.slice(e), i;
|
|
2550
2550
|
}
|
|
2551
|
-
function
|
|
2551
|
+
function Le(t) {
|
|
2552
2552
|
return t.replace(
|
|
2553
2553
|
/<([a-zA-Z_][\w:.-]*)\b([^>]*)>/,
|
|
2554
|
-
(r, n, i) => /\bxmlns:xi\s*=/.test(i) ? r : `<${n}${i} xmlns:xi="${
|
|
2554
|
+
(r, n, i) => /\bxmlns:xi\s*=/.test(i) ? r : `<${n}${i} xmlns:xi="${ca}">`
|
|
2555
2555
|
);
|
|
2556
2556
|
}
|
|
2557
|
-
function
|
|
2558
|
-
return t.startsWith("<?xml") ? t :
|
|
2557
|
+
function De(t) {
|
|
2558
|
+
return t.startsWith("<?xml") ? t : oa() + t;
|
|
2559
2559
|
}
|
|
2560
|
-
const
|
|
2560
|
+
const Ar = [
|
|
2561
2561
|
"part",
|
|
2562
2562
|
"chapter",
|
|
2563
2563
|
"section",
|
|
2564
2564
|
"subsection",
|
|
2565
2565
|
"subsubsection"
|
|
2566
2566
|
];
|
|
2567
|
-
function
|
|
2567
|
+
function la(t, r) {
|
|
2568
2568
|
let n = r;
|
|
2569
2569
|
for (; n < t.length && /\s/.test(t[n]); ) n++;
|
|
2570
2570
|
if (t[n] !== "{") return null;
|
|
@@ -2582,7 +2582,7 @@ function oa(t, r) {
|
|
|
2582
2582
|
}
|
|
2583
2583
|
return null;
|
|
2584
2584
|
}
|
|
2585
|
-
function
|
|
2585
|
+
function ua(t, r) {
|
|
2586
2586
|
let n = r;
|
|
2587
2587
|
for (; n < t.length && /\s/.test(t[n]); ) n++;
|
|
2588
2588
|
if (t[n] !== "[") return r;
|
|
@@ -2599,11 +2599,11 @@ function ca(t, r) {
|
|
|
2599
2599
|
}
|
|
2600
2600
|
return r;
|
|
2601
2601
|
}
|
|
2602
|
-
function
|
|
2602
|
+
function da(t) {
|
|
2603
2603
|
return t.replace(/\\[a-zA-Z]+\{([^{}]*)\}/g, "$1").replace(/\\[a-zA-Z]+/g, "").replace(/[{}]/g, "").replace(/\s+/g, " ").trim();
|
|
2604
2604
|
}
|
|
2605
|
-
function
|
|
2606
|
-
const r = [], n = new Set(
|
|
2605
|
+
function Xe(t) {
|
|
2606
|
+
const r = [], n = new Set(Ar);
|
|
2607
2607
|
let i = 0;
|
|
2608
2608
|
for (let e = 0; e < t.length; e++) {
|
|
2609
2609
|
const a = t[e];
|
|
@@ -2627,7 +2627,7 @@ function We(t) {
|
|
|
2627
2627
|
e = s - 1;
|
|
2628
2628
|
continue;
|
|
2629
2629
|
}
|
|
2630
|
-
const c = t[s] === "*" ? s + 1 : s, l =
|
|
2630
|
+
const c = t[s] === "*" ? s + 1 : s, l = la(t, ua(t, c));
|
|
2631
2631
|
if (!l) {
|
|
2632
2632
|
e = s - 1;
|
|
2633
2633
|
continue;
|
|
@@ -2644,18 +2644,18 @@ function We(t) {
|
|
|
2644
2644
|
}
|
|
2645
2645
|
return r;
|
|
2646
2646
|
}
|
|
2647
|
-
function
|
|
2648
|
-
const r = new Set(
|
|
2649
|
-
return
|
|
2647
|
+
function Ve(t) {
|
|
2648
|
+
const r = new Set(Xe(t).map((n) => n.command));
|
|
2649
|
+
return Ar.filter((n) => r.has(n));
|
|
2650
2650
|
}
|
|
2651
|
-
function
|
|
2652
|
-
const r =
|
|
2651
|
+
function Ir(t) {
|
|
2652
|
+
const r = Ve(t), n = new Map(r.map((s, o) => [s, o + 1])), i = Xe(t), e = [], a = [];
|
|
2653
2653
|
for (const s of i) {
|
|
2654
2654
|
const o = n.get(s.command) ?? 1, c = {
|
|
2655
2655
|
command: s.command,
|
|
2656
2656
|
level: o,
|
|
2657
2657
|
rawTitle: s.rawTitle,
|
|
2658
|
-
title:
|
|
2658
|
+
title: da(s.rawTitle),
|
|
2659
2659
|
labelId: s.labelId,
|
|
2660
2660
|
start: s.start,
|
|
2661
2661
|
contentStart: s.contentStart,
|
|
@@ -2668,48 +2668,48 @@ function Er(t) {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
return e;
|
|
2670
2670
|
}
|
|
2671
|
-
const
|
|
2672
|
-
function
|
|
2673
|
-
return r <= 1 ? t : t.flatMap((n) =>
|
|
2671
|
+
const fa = 8e4, ha = 4e4, pa = 3, ma = 3;
|
|
2672
|
+
function Pe(t, r) {
|
|
2673
|
+
return r <= 1 ? t : t.flatMap((n) => Pe(n.children, r - 1));
|
|
2674
2674
|
}
|
|
2675
|
-
function
|
|
2676
|
-
const n =
|
|
2675
|
+
function ga(t, r) {
|
|
2676
|
+
const n = Ir(t);
|
|
2677
2677
|
if (n.length === 0) return 0;
|
|
2678
2678
|
let i = r === "book" ? 1 : 0;
|
|
2679
|
-
const e = t.length >
|
|
2680
|
-
for (; i <
|
|
2681
|
-
const s = i === 0 ? e :
|
|
2682
|
-
(o) => o.end - o.start >
|
|
2679
|
+
const e = t.length > fa;
|
|
2680
|
+
for (; i < ma && !(Pe(n, i + 1).length < pa); ) {
|
|
2681
|
+
const s = i === 0 ? e : Pe(n, i).some(
|
|
2682
|
+
(o) => o.end - o.start > ha
|
|
2683
2683
|
);
|
|
2684
2684
|
if (!e && !s) break;
|
|
2685
2685
|
i += 1;
|
|
2686
2686
|
}
|
|
2687
2687
|
return i;
|
|
2688
2688
|
}
|
|
2689
|
-
function
|
|
2689
|
+
function ba(t) {
|
|
2690
2690
|
let r = t;
|
|
2691
2691
|
return r = r.replace(/\s+%.*/g, ""), r = r.replace(/([^\\])%.*/g, "$1"), r = r.replace(/^%.*/, ""), r;
|
|
2692
2692
|
}
|
|
2693
|
-
function
|
|
2693
|
+
function va(t) {
|
|
2694
2694
|
return t.replace(/(.*\{)([^{}]+)(\}.*)/, (r, n, i, e) => {
|
|
2695
2695
|
const a = String(i).replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "-");
|
|
2696
2696
|
return `${n}${a}${e}`;
|
|
2697
2697
|
});
|
|
2698
2698
|
}
|
|
2699
|
-
function
|
|
2699
|
+
function wa(t) {
|
|
2700
2700
|
let r = t;
|
|
2701
2701
|
return r = r.replace(/> */g, "\\gt "), r = r.replace(/< */g, "\\lt "), r = r.replace(
|
|
2702
2702
|
/(\\(ref|eqref|cref|Cref|label)\{([^{}]+)\})/g,
|
|
2703
|
-
|
|
2703
|
+
va
|
|
2704
2704
|
), r;
|
|
2705
2705
|
}
|
|
2706
|
-
function
|
|
2706
|
+
function Tr(t) {
|
|
2707
2707
|
let r = t;
|
|
2708
|
-
return r = r.replace(/\\begin +/g, "\\begin"), r = r.replace(/\\chapter +/g, "\\chapter"), r = r.replace(/\\section +/g, "\\section"), r = r.replace(/\\section\*/g, "\\section"), r =
|
|
2708
|
+
return r = r.replace(/\\begin +/g, "\\begin"), r = r.replace(/\\chapter +/g, "\\chapter"), r = r.replace(/\\section +/g, "\\section"), r = r.replace(/\\section\*/g, "\\section"), r = ba(r), r = wa(r), r = r.replace(/\\end\{document\}.*/s, ""), r = r.replace(/^\s+/, ""), r = r.replace(/\n{3,}/g, `
|
|
2709
2709
|
|
|
2710
2710
|
`), r;
|
|
2711
2711
|
}
|
|
2712
|
-
function
|
|
2712
|
+
function lr(t, r = 0, n = "{", i = "}") {
|
|
2713
2713
|
let e = t.trimStart();
|
|
2714
2714
|
if (!e)
|
|
2715
2715
|
return ["", ""];
|
|
@@ -2723,10 +2723,10 @@ function or(t, r = 0, n = "{", i = "}") {
|
|
|
2723
2723
|
}
|
|
2724
2724
|
return o === 0 ? [s, e] : ["", s.substring(1)];
|
|
2725
2725
|
}
|
|
2726
|
-
function
|
|
2727
|
-
const n =
|
|
2726
|
+
function Io(t, r = {}) {
|
|
2727
|
+
const n = Tr(t).replace(/(\n *){3,}/g, `
|
|
2728
2728
|
|
|
2729
|
-
`), { output: i, fixes: e } =
|
|
2729
|
+
`), { output: i, fixes: e } = Me(n, {
|
|
2730
2730
|
scope: r.scope ?? "auto",
|
|
2731
2731
|
disable: r.disable
|
|
2732
2732
|
});
|
|
@@ -2734,11 +2734,11 @@ function _o(t, r = {}) {
|
|
|
2734
2734
|
output: i.replace(/(\n *){3,}/g, `
|
|
2735
2735
|
|
|
2736
2736
|
`),
|
|
2737
|
-
warnings:
|
|
2737
|
+
warnings: Rr(e),
|
|
2738
2738
|
fixes: e
|
|
2739
2739
|
};
|
|
2740
2740
|
}
|
|
2741
|
-
function
|
|
2741
|
+
function Rr(t) {
|
|
2742
2742
|
const r = /* @__PURE__ */ new Map();
|
|
2743
2743
|
for (const i of t) {
|
|
2744
2744
|
const e = r.get(i.ruleId);
|
|
@@ -2770,12 +2770,12 @@ function Ir(t) {
|
|
|
2770
2770
|
}
|
|
2771
2771
|
return n;
|
|
2772
2772
|
}
|
|
2773
|
-
function
|
|
2774
|
-
const r =
|
|
2773
|
+
function _a(t) {
|
|
2774
|
+
const r = Tr(t).replace(/(\n *){3,}/g, `
|
|
2775
2775
|
|
|
2776
|
-
`), n =
|
|
2776
|
+
`), n = Sr(r, "auto"), i = [], e = r.slice(n.preamble.start, n.preamble.end);
|
|
2777
2777
|
e && i.push(
|
|
2778
|
-
|
|
2778
|
+
Jt(
|
|
2779
2779
|
e,
|
|
2780
2780
|
{
|
|
2781
2781
|
path: [],
|
|
@@ -2787,21 +2787,21 @@ function va(t) {
|
|
|
2787
2787
|
)
|
|
2788
2788
|
);
|
|
2789
2789
|
const a = r.slice(n.body.start, n.body.end);
|
|
2790
|
-
i.push(...
|
|
2790
|
+
i.push(...ya(a));
|
|
2791
2791
|
const s = n.bibliography ? r.slice(n.bibliography.start, n.bibliography.end) : "", o = r.includes("\\begin{document}"), c = i.filter((g) => g.kind !== "preamble").map((g) => g.after).join(""), l = i.find((g) => g.kind === "preamble")?.after ?? "", f = ((o ? l + "\\begin{document}" : "") + c + s).replace(/(\n *){3,}/g, `
|
|
2792
2792
|
|
|
2793
2793
|
`), p = i.flatMap((g) => g.fixes);
|
|
2794
|
-
return { output: f, chunks: i, warnings:
|
|
2794
|
+
return { output: f, chunks: i, warnings: Rr(p), fixes: p };
|
|
2795
2795
|
}
|
|
2796
|
-
function
|
|
2797
|
-
const { output: i, fixes: e } =
|
|
2796
|
+
function Jt(t, r, n) {
|
|
2797
|
+
const { output: i, fixes: e } = Me(t, { scope: n });
|
|
2798
2798
|
return { ...r, before: t, after: i, fixes: e };
|
|
2799
2799
|
}
|
|
2800
|
-
function
|
|
2801
|
-
const r =
|
|
2800
|
+
function ya(t) {
|
|
2801
|
+
const r = Xe(t), n = Ve(t), i = new Map(n.map((c, l) => [c, l + 1]));
|
|
2802
2802
|
if (r.length === 0)
|
|
2803
2803
|
return t ? [
|
|
2804
|
-
|
|
2804
|
+
Jt(
|
|
2805
2805
|
t,
|
|
2806
2806
|
{ path: [], title: "", kind: "lead", level: 0 },
|
|
2807
2807
|
"body"
|
|
@@ -2810,15 +2810,15 @@ function wa(t) {
|
|
|
2810
2810
|
const e = [], a = t.slice(0, r[0].start);
|
|
2811
2811
|
let s = "";
|
|
2812
2812
|
a.trim() ? e.push(
|
|
2813
|
-
|
|
2813
|
+
Jt(a, { path: [], title: "", kind: "lead", level: 0 }, "body")
|
|
2814
2814
|
) : s = a;
|
|
2815
2815
|
const o = [];
|
|
2816
2816
|
return r.forEach((c, l) => {
|
|
2817
|
-
const f = i.get(c.command) ?? 1, p =
|
|
2817
|
+
const f = i.get(c.command) ?? 1, p = xa(c.rawTitle);
|
|
2818
2818
|
o.length = f - 1, o[f - 1] = p;
|
|
2819
2819
|
const g = r[l + 1]?.start ?? t.length, d = (l === 0 ? s : "") + t.slice(c.start, g);
|
|
2820
2820
|
e.push(
|
|
2821
|
-
|
|
2821
|
+
Jt(
|
|
2822
2822
|
d,
|
|
2823
2823
|
{
|
|
2824
2824
|
path: [...o],
|
|
@@ -2832,10 +2832,10 @@ function wa(t) {
|
|
|
2832
2832
|
);
|
|
2833
2833
|
}), e;
|
|
2834
2834
|
}
|
|
2835
|
-
function
|
|
2835
|
+
function xa(t) {
|
|
2836
2836
|
return t.replace(/\\[a-zA-Z]+\{([^{}]*)\}/g, "$1").replace(/\\[a-zA-Z]+/g, "").replace(/[{}]/g, "").replace(/\s+/g, " ").trim();
|
|
2837
2837
|
}
|
|
2838
|
-
function
|
|
2838
|
+
function To(t, r) {
|
|
2839
2839
|
const n = [];
|
|
2840
2840
|
for (const i of t) {
|
|
2841
2841
|
if (i.kind === "preamble") {
|
|
@@ -2856,7 +2856,7 @@ function yo(t, r) {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
return n;
|
|
2858
2858
|
}
|
|
2859
|
-
function
|
|
2859
|
+
function Bt(t) {
|
|
2860
2860
|
const r = "\\begin{document}", n = "\\end{document}", i = t.indexOf(r);
|
|
2861
2861
|
if (i === -1)
|
|
2862
2862
|
return { preamble: "", body: t };
|
|
@@ -2868,14 +2868,14 @@ function ae(t, r) {
|
|
|
2868
2868
|
if (!i) return "";
|
|
2869
2869
|
let e = t.slice(i.index + i[0].length).trimStart();
|
|
2870
2870
|
if (e.startsWith("[")) {
|
|
2871
|
-
const [s, o] =
|
|
2871
|
+
const [s, o] = lr(e, 0, "[", "]");
|
|
2872
2872
|
s && (e = o.trimStart());
|
|
2873
2873
|
}
|
|
2874
|
-
const [a] =
|
|
2874
|
+
const [a] = lr(e);
|
|
2875
2875
|
return a ? a.slice(1, -1).trim() : "";
|
|
2876
2876
|
}
|
|
2877
|
-
const
|
|
2878
|
-
function
|
|
2877
|
+
const ka = /^[ \t]*(\\(?:new|renew|provide)command\*?|\\DeclareMathOperator\*?|\\newenvironment\*?|\\def)\b/, Sa = /^[ \t]*\\def\b/;
|
|
2878
|
+
function ur(t) {
|
|
2879
2879
|
let r = 0;
|
|
2880
2880
|
for (let n = 0; n < t.length; n++) {
|
|
2881
2881
|
if (t[n] === "\\") {
|
|
@@ -2886,21 +2886,21 @@ function cr(t) {
|
|
|
2886
2886
|
}
|
|
2887
2887
|
return r;
|
|
2888
2888
|
}
|
|
2889
|
-
function
|
|
2889
|
+
function Cr(t) {
|
|
2890
2890
|
const r = t.split(`
|
|
2891
2891
|
`), n = [], i = [];
|
|
2892
2892
|
let e = 0;
|
|
2893
2893
|
for (; e < r.length; ) {
|
|
2894
|
-
if (!
|
|
2894
|
+
if (!ka.test(r[e])) {
|
|
2895
2895
|
e++;
|
|
2896
2896
|
continue;
|
|
2897
2897
|
}
|
|
2898
|
-
let s = r[e], o =
|
|
2898
|
+
let s = r[e], o = ur(r[e]);
|
|
2899
2899
|
for (e++; o > 0 && e < r.length; )
|
|
2900
2900
|
s += `
|
|
2901
|
-
` + r[e], o +=
|
|
2901
|
+
` + r[e], o += ur(r[e]), e++;
|
|
2902
2902
|
const c = s.trim();
|
|
2903
|
-
n.push(c),
|
|
2903
|
+
n.push(c), Sa.test(c) && i.push(c);
|
|
2904
2904
|
}
|
|
2905
2905
|
const a = i.length > 0 ? [
|
|
2906
2906
|
{
|
|
@@ -2917,15 +2917,24 @@ function Tr(t) {
|
|
|
2917
2917
|
return { macros: n.join(`
|
|
2918
2918
|
`), warnings: a };
|
|
2919
2919
|
}
|
|
2920
|
-
function
|
|
2920
|
+
function Ea(t) {
|
|
2921
2921
|
const r = /\\documentclass(?:\[[^\]]*\])?\{([^}]+)\}/.exec(t);
|
|
2922
2922
|
return r ? r[1].trim() : "article";
|
|
2923
2923
|
}
|
|
2924
|
-
function
|
|
2925
|
-
|
|
2924
|
+
function Aa(t) {
|
|
2925
|
+
return Ia.has(t.trim().toLowerCase());
|
|
2926
|
+
}
|
|
2927
|
+
const Ia = /* @__PURE__ */ new Set([
|
|
2928
|
+
"beamer",
|
|
2929
|
+
"powerdot",
|
|
2930
|
+
"seminar",
|
|
2931
|
+
"slides"
|
|
2932
|
+
]);
|
|
2933
|
+
function Ta(t) {
|
|
2934
|
+
const r = t.replace(/(^|[^\\])%[^\n]*/gm, "$1"), { macros: n, warnings: i } = Cr(r);
|
|
2926
2935
|
return {
|
|
2927
2936
|
info: {
|
|
2928
|
-
documentClass:
|
|
2937
|
+
documentClass: Ea(r),
|
|
2929
2938
|
title: ae(r, "title"),
|
|
2930
2939
|
author: ae(r, "author"),
|
|
2931
2940
|
macros: n
|
|
@@ -2933,7 +2942,7 @@ function Sa(t) {
|
|
|
2933
2942
|
warnings: i
|
|
2934
2943
|
};
|
|
2935
2944
|
}
|
|
2936
|
-
function
|
|
2945
|
+
function Ra(t) {
|
|
2937
2946
|
if (typeof t == "string")
|
|
2938
2947
|
return t;
|
|
2939
2948
|
if (typeof t == "object" && t !== null && "value" in t) {
|
|
@@ -2945,16 +2954,16 @@ function Ea(t) {
|
|
|
2945
2954
|
}
|
|
2946
2955
|
return String(t);
|
|
2947
2956
|
}
|
|
2948
|
-
function
|
|
2957
|
+
function je(t) {
|
|
2949
2958
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2950
2959
|
}
|
|
2951
|
-
function
|
|
2960
|
+
function Or(t) {
|
|
2952
2961
|
return t.replace(/\\LaTeX\b/g, "LaTeX").replace(/\\TeX\b/g, "TeX").replace(/\\thanks\{[^{}]*(?:\{[^{}]*\}[^{}]*)?\}/g, "").replace(/\\inst\{[^{}]*\}/g, "").replace(/\\email\{[^{}]*\}/g, "").replace(/\\[a-zA-Z]+\{([^{}]*)\}/g, "$1").replace(/\\\s/g, " ").replace(/~/g, " ").replace(/\s+/g, " ").trim();
|
|
2953
2962
|
}
|
|
2954
|
-
function
|
|
2963
|
+
function Ca(t) {
|
|
2955
2964
|
const r = [];
|
|
2956
2965
|
if (t.macros) {
|
|
2957
|
-
const n =
|
|
2966
|
+
const n = je(t.macros).split(`
|
|
2958
2967
|
`).map((i) => ` ${i}`).join(`
|
|
2959
2968
|
`);
|
|
2960
2969
|
r.push(` <macros>
|
|
@@ -2962,7 +2971,7 @@ ${n}
|
|
|
2962
2971
|
</macros>`);
|
|
2963
2972
|
}
|
|
2964
2973
|
if (t.author) {
|
|
2965
|
-
const n = t.author.split(/\s+\\and\s+/)[0].trim(), i =
|
|
2974
|
+
const n = t.author.split(/\s+\\and\s+/)[0].trim(), i = je(Or(n));
|
|
2966
2975
|
i && r.push(
|
|
2967
2976
|
` <author>
|
|
2968
2977
|
<personname>${i}</personname>
|
|
@@ -2974,27 +2983,30 @@ ${r.join(`
|
|
|
2974
2983
|
`)}
|
|
2975
2984
|
</docinfo>`;
|
|
2976
2985
|
}
|
|
2977
|
-
function
|
|
2986
|
+
function Oa(t, r) {
|
|
2987
|
+
return /<slide[\s/>]/.test(t) || Aa(r.documentClass) ? "slideshow" : /<chapter[\s>]/.test(t) ? "book" : "article";
|
|
2988
|
+
}
|
|
2989
|
+
function za(t, r) {
|
|
2978
2990
|
const n = t.replace(/^\s*<p\s*\/>\s*/g, "").replace(/^\s*<p>\s*<\/p>\s*/g, "").trim();
|
|
2979
2991
|
if (!n) return "";
|
|
2980
|
-
const
|
|
2981
|
-
` : "",
|
|
2982
|
-
${
|
|
2983
|
-
</${
|
|
2992
|
+
const i = Oa(n, r), e = Ca(r), a = r.title ? ` <title>${je(Or(r.title))}</title>
|
|
2993
|
+
` : "", s = `<${i}>
|
|
2994
|
+
${a}${n}
|
|
2995
|
+
</${i}>`;
|
|
2984
2996
|
return `<pretext>
|
|
2985
|
-
${[
|
|
2997
|
+
${[e, s].filter(Boolean).join(`
|
|
2986
2998
|
`)}
|
|
2987
2999
|
</pretext>`;
|
|
2988
3000
|
}
|
|
2989
|
-
function
|
|
3001
|
+
function Ge(t) {
|
|
2990
3002
|
const r = t.trim();
|
|
2991
|
-
return r ?
|
|
3003
|
+
return r ? ci(r) : "";
|
|
2992
3004
|
}
|
|
2993
|
-
function
|
|
3005
|
+
function $a(t) {
|
|
2994
3006
|
const r = t.trim();
|
|
2995
3007
|
if (!r)
|
|
2996
3008
|
return { pretext: "", cleanedLatex: "", warnings: [], cleanChunks: [] };
|
|
2997
|
-
const { preamble: n, body: i } =
|
|
3009
|
+
const { preamble: n, body: i } = Bt(r), { info: e, warnings: a } = Ta(n), s = i ? [
|
|
2998
3010
|
`\\documentclass{${e.documentClass}}`,
|
|
2999
3011
|
e.macros,
|
|
3000
3012
|
"\\begin{document}",
|
|
@@ -3005,77 +3017,85 @@ function Ta(t) {
|
|
|
3005
3017
|
output: o,
|
|
3006
3018
|
warnings: c,
|
|
3007
3019
|
chunks: l
|
|
3008
|
-
} =
|
|
3020
|
+
} = _a(s), f = [...a, ...c];
|
|
3009
3021
|
if (!o.trim())
|
|
3010
3022
|
return { pretext: "", cleanedLatex: o, warnings: f, cleanChunks: l };
|
|
3011
3023
|
const p = i ? o + `
|
|
3012
|
-
\\end{document}` : o, g =
|
|
3013
|
-
|
|
3024
|
+
\\end{document}` : o, g = Ra(
|
|
3025
|
+
li(p)
|
|
3014
3026
|
).trim();
|
|
3015
3027
|
if (!g)
|
|
3016
3028
|
return { pretext: "", cleanedLatex: o, warnings: f, cleanChunks: l };
|
|
3017
|
-
const d =
|
|
3018
|
-
return { pretext: d ?
|
|
3029
|
+
const d = za(g, e);
|
|
3030
|
+
return { pretext: d ? Ge(d) : "", cleanedLatex: o, warnings: f, cleanChunks: l };
|
|
3019
3031
|
}
|
|
3020
|
-
function
|
|
3021
|
-
const
|
|
3022
|
-
if (!
|
|
3032
|
+
function La(t, r) {
|
|
3033
|
+
const n = t.trim();
|
|
3034
|
+
if (!n)
|
|
3023
3035
|
return { pretext: "", cleanedMarkdown: "" };
|
|
3024
|
-
const
|
|
3025
|
-
|
|
3036
|
+
const i = String(
|
|
3037
|
+
ui(
|
|
3038
|
+
n,
|
|
3039
|
+
r ? { documentRoot: r } : void 0
|
|
3040
|
+
)
|
|
3041
|
+
).trim();
|
|
3042
|
+
return { pretext: i ? Ge(i) : "", cleanedMarkdown: n };
|
|
3026
3043
|
}
|
|
3027
|
-
function
|
|
3044
|
+
function Da(t) {
|
|
3028
3045
|
return t instanceof Error && t.message.trim() ? t.message.trim() : "Could not convert source content to PreTeXt.";
|
|
3029
3046
|
}
|
|
3030
|
-
function
|
|
3031
|
-
const
|
|
3047
|
+
function Pa(t, r, n) {
|
|
3048
|
+
const i = ve(t), e = r ?? i;
|
|
3032
3049
|
try {
|
|
3033
|
-
if (
|
|
3050
|
+
if (e === "pretext")
|
|
3034
3051
|
return {
|
|
3035
|
-
sourceFormat:
|
|
3036
|
-
detectedSourceFormat:
|
|
3037
|
-
pretextSource:
|
|
3052
|
+
sourceFormat: e,
|
|
3053
|
+
detectedSourceFormat: i,
|
|
3054
|
+
pretextSource: Ge(t),
|
|
3038
3055
|
warnings: []
|
|
3039
3056
|
};
|
|
3040
|
-
if (
|
|
3041
|
-
const { pretext:
|
|
3057
|
+
if (e === "markdown") {
|
|
3058
|
+
const { pretext: l, cleanedMarkdown: f } = La(
|
|
3059
|
+
t,
|
|
3060
|
+
n
|
|
3061
|
+
);
|
|
3042
3062
|
return {
|
|
3043
|
-
sourceFormat:
|
|
3044
|
-
detectedSourceFormat:
|
|
3045
|
-
pretextSource:
|
|
3046
|
-
cleanedNativeSource:
|
|
3063
|
+
sourceFormat: e,
|
|
3064
|
+
detectedSourceFormat: i,
|
|
3065
|
+
pretextSource: l,
|
|
3066
|
+
cleanedNativeSource: f,
|
|
3047
3067
|
warnings: []
|
|
3048
3068
|
};
|
|
3049
3069
|
}
|
|
3050
|
-
const { pretext:
|
|
3070
|
+
const { pretext: a, cleanedLatex: s, warnings: o, cleanChunks: c } = $a(t);
|
|
3051
3071
|
return {
|
|
3052
|
-
sourceFormat:
|
|
3053
|
-
detectedSourceFormat:
|
|
3054
|
-
pretextSource:
|
|
3055
|
-
cleanedNativeSource:
|
|
3056
|
-
warnings:
|
|
3057
|
-
cleanChunks:
|
|
3072
|
+
sourceFormat: e,
|
|
3073
|
+
detectedSourceFormat: i,
|
|
3074
|
+
pretextSource: a,
|
|
3075
|
+
cleanedNativeSource: s,
|
|
3076
|
+
warnings: o,
|
|
3077
|
+
cleanChunks: c
|
|
3058
3078
|
};
|
|
3059
|
-
} catch (
|
|
3079
|
+
} catch (a) {
|
|
3060
3080
|
return {
|
|
3061
|
-
sourceFormat:
|
|
3062
|
-
detectedSourceFormat:
|
|
3063
|
-
pretextError:
|
|
3081
|
+
sourceFormat: e,
|
|
3082
|
+
detectedSourceFormat: i,
|
|
3083
|
+
pretextError: Da(a),
|
|
3064
3084
|
warnings: []
|
|
3065
3085
|
};
|
|
3066
3086
|
}
|
|
3067
3087
|
}
|
|
3068
|
-
var
|
|
3069
|
-
function
|
|
3088
|
+
var Ht = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3089
|
+
function ja(t) {
|
|
3070
3090
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
3071
3091
|
}
|
|
3072
|
-
function
|
|
3092
|
+
function Yt(t) {
|
|
3073
3093
|
throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3074
3094
|
}
|
|
3075
|
-
var
|
|
3076
|
-
var
|
|
3077
|
-
function
|
|
3078
|
-
return
|
|
3095
|
+
var me = { exports: {} };
|
|
3096
|
+
var dr;
|
|
3097
|
+
function Fa() {
|
|
3098
|
+
return dr || (dr = 1, (function(t, r) {
|
|
3079
3099
|
(function(n) {
|
|
3080
3100
|
t.exports = n();
|
|
3081
3101
|
})(function() {
|
|
@@ -3083,7 +3103,7 @@ function $a() {
|
|
|
3083
3103
|
function s(l, f) {
|
|
3084
3104
|
if (!e[l]) {
|
|
3085
3105
|
if (!i[l]) {
|
|
3086
|
-
var p = typeof
|
|
3106
|
+
var p = typeof Yt == "function" && Yt;
|
|
3087
3107
|
if (!f && p) return p(l, !0);
|
|
3088
3108
|
if (o) return o(l, !0);
|
|
3089
3109
|
var g = new Error("Cannot find module '" + l + "'");
|
|
@@ -3097,7 +3117,7 @@ function $a() {
|
|
|
3097
3117
|
}
|
|
3098
3118
|
return e[l].exports;
|
|
3099
3119
|
}
|
|
3100
|
-
for (var o = typeof
|
|
3120
|
+
for (var o = typeof Yt == "function" && Yt, c = 0; c < a.length; c++) s(a[c]);
|
|
3101
3121
|
return s;
|
|
3102
3122
|
})({ 1: [function(n, i, e) {
|
|
3103
3123
|
var a = n("./utils"), s = n("./support"), o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
@@ -3195,9 +3215,9 @@ function $a() {
|
|
|
3195
3215
|
var O = 0;
|
|
3196
3216
|
w && (O |= 8), L || !D && !m || (O |= 2048);
|
|
3197
3217
|
var C = 0, K = 0;
|
|
3198
|
-
nt && (C |= 16), b === "UNIX" ? (K = 798, C |= (function(V,
|
|
3218
|
+
nt && (C |= 16), b === "UNIX" ? (K = 798, C |= (function(V, lt) {
|
|
3199
3219
|
var Q = V;
|
|
3200
|
-
return V || (Q =
|
|
3220
|
+
return V || (Q = lt ? 16893 : 33204), (65535 & Q) << 16;
|
|
3201
3221
|
})(A.unixPermissions, nt)) : (K = 20, C |= (function(V) {
|
|
3202
3222
|
return 63 & (V || 0);
|
|
3203
3223
|
})(A.dosPermissions)), S = M.getUTCHours(), S <<= 6, S |= M.getUTCMinutes(), S <<= 5, S |= M.getUTCSeconds() / 2, I = M.getUTCFullYear() - 1980, I <<= 4, I |= M.getUTCMonth() + 1, I <<= 5, I |= M.getUTCDate(), D && (it = a(1, 1) + a(f(B), 4) + $, F += "up" + a(it.length, 2) + it), m && (U = a(1, 1) + a(f(J), 4) + k, F += "uc" + a(U.length, 2) + U);
|
|
@@ -4132,7 +4152,7 @@ function $a() {
|
|
|
4132
4152
|
i.exports = function(h) {
|
|
4133
4153
|
d.push(h) !== 1 || o || s();
|
|
4134
4154
|
};
|
|
4135
|
-
}).call(this, typeof
|
|
4155
|
+
}).call(this, typeof Ht < "u" ? Ht : typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
4136
4156
|
}, {}], 37: [function(n, i, e) {
|
|
4137
4157
|
var a = n("immediate");
|
|
4138
4158
|
function s() {
|
|
@@ -4467,7 +4487,7 @@ function $a() {
|
|
|
4467
4487
|
while ((j = X[j & H]) > R && --_ != 0);
|
|
4468
4488
|
return q <= u.lookahead ? q : u.lookahead;
|
|
4469
4489
|
}
|
|
4470
|
-
function
|
|
4490
|
+
function lt(u) {
|
|
4471
4491
|
var j, z, y, _, E, q, N, R, Z, H, X = u.w_size;
|
|
4472
4492
|
do {
|
|
4473
4493
|
if (_ = u.window_size - u.lookahead - u.strstart, u.strstart >= X + (X - J)) {
|
|
@@ -4482,7 +4502,7 @@ function $a() {
|
|
|
4482
4502
|
function Q(u, j) {
|
|
4483
4503
|
for (var z, y; ; ) {
|
|
4484
4504
|
if (u.lookahead < J) {
|
|
4485
|
-
if (
|
|
4505
|
+
if (lt(u), u.lookahead < J && j === p) return m;
|
|
4486
4506
|
if (u.lookahead === 0) break;
|
|
4487
4507
|
}
|
|
4488
4508
|
if (z = 0, u.lookahead >= $ && (u.ins_h = (u.ins_h << u.hash_shift ^ u.window[u.strstart + $ - 1]) & u.hash_mask, z = u.prev[u.strstart & u.w_mask] = u.head[u.ins_h], u.head[u.ins_h] = u.strstart), z !== 0 && u.strstart - z <= u.w_size - J && (u.match_length = V(u, z)), u.match_length >= $) if (y = o._tr_tally(u, u.strstart - u.match_start, u.match_length - $), u.lookahead -= u.match_length, u.match_length <= u.max_lazy_match && u.lookahead >= $) {
|
|
@@ -4497,7 +4517,7 @@ function $a() {
|
|
|
4497
4517
|
function Y(u, j) {
|
|
4498
4518
|
for (var z, y, _; ; ) {
|
|
4499
4519
|
if (u.lookahead < J) {
|
|
4500
|
-
if (
|
|
4520
|
+
if (lt(u), u.lookahead < J && j === p) return m;
|
|
4501
4521
|
if (u.lookahead === 0) break;
|
|
4502
4522
|
}
|
|
4503
4523
|
if (z = 0, u.lookahead >= $ && (u.ins_h = (u.ins_h << u.hash_shift ^ u.window[u.strstart + $ - 1]) & u.hash_mask, z = u.prev[u.strstart & u.w_mask] = u.head[u.ins_h], u.head[u.ins_h] = u.strstart), u.prev_length = u.match_length, u.prev_match = u.match_start, u.match_length = $ - 1, z !== 0 && u.prev_length < u.max_lazy_match && u.strstart - z <= u.w_size - J && (u.match_length = V(u, z), u.match_length <= 5 && (u.strategy === 1 || u.match_length === $ && 4096 < u.strstart - u.match_start) && (u.match_length = $ - 1)), u.prev_length >= $ && u.match_length <= u.prev_length) {
|
|
@@ -4537,7 +4557,7 @@ function $a() {
|
|
|
4537
4557
|
var z = 65535;
|
|
4538
4558
|
for (z > u.pending_buf_size - 5 && (z = u.pending_buf_size - 5); ; ) {
|
|
4539
4559
|
if (u.lookahead <= 1) {
|
|
4540
|
-
if (
|
|
4560
|
+
if (lt(u), u.lookahead === 0 && j === p) return m;
|
|
4541
4561
|
if (u.lookahead === 0) break;
|
|
4542
4562
|
}
|
|
4543
4563
|
u.strstart += u.lookahead, u.lookahead = 0;
|
|
@@ -4591,7 +4611,7 @@ function $a() {
|
|
|
4591
4611
|
if (u.avail_in !== 0 || y.lookahead !== 0 || j !== p && y.status !== 666) {
|
|
4592
4612
|
var N = y.strategy === 2 ? (function(R, Z) {
|
|
4593
4613
|
for (var H; ; ) {
|
|
4594
|
-
if (R.lookahead === 0 && (
|
|
4614
|
+
if (R.lookahead === 0 && (lt(R), R.lookahead === 0)) {
|
|
4595
4615
|
if (Z === p) return m;
|
|
4596
4616
|
break;
|
|
4597
4617
|
}
|
|
@@ -4601,7 +4621,7 @@ function $a() {
|
|
|
4601
4621
|
})(y, j) : y.strategy === 3 ? (function(R, Z) {
|
|
4602
4622
|
for (var H, X, tt, ot, at = R.window; ; ) {
|
|
4603
4623
|
if (R.lookahead <= W) {
|
|
4604
|
-
if (
|
|
4624
|
+
if (lt(R), R.lookahead <= W && Z === p) return m;
|
|
4605
4625
|
if (R.lookahead === 0) break;
|
|
4606
4626
|
}
|
|
4607
4627
|
if (R.match_length = 0, R.lookahead >= $ && 0 < R.strstart && (X = at[tt = R.strstart - 1]) === at[++tt] && X === at[++tt] && X === at[++tt]) {
|
|
@@ -4625,9 +4645,9 @@ function $a() {
|
|
|
4625
4645
|
}, e.deflateSetDictionary = function(u, j) {
|
|
4626
4646
|
var z, y, _, E, q, N, R, Z, H = j.length;
|
|
4627
4647
|
if (!u || !u.state || (E = (z = u.state).wrap) === 2 || E === 1 && z.status !== k || z.lookahead) return w;
|
|
4628
|
-
for (E === 1 && (u.adler = c(u.adler, j, H, 0)), z.wrap = 0, H >= z.w_size && (E === 0 && (et(z.head), z.strstart = 0, z.block_start = 0, z.insert = 0), Z = new s.Buf8(z.w_size), s.arraySet(Z, j, H - z.w_size, z.w_size, 0), j = Z, H = z.w_size), q = u.avail_in, N = u.next_in, R = u.input, u.avail_in = H, u.next_in = 0, u.input = j,
|
|
4648
|
+
for (E === 1 && (u.adler = c(u.adler, j, H, 0)), z.wrap = 0, H >= z.w_size && (E === 0 && (et(z.head), z.strstart = 0, z.block_start = 0, z.insert = 0), Z = new s.Buf8(z.w_size), s.arraySet(Z, j, H - z.w_size, z.w_size, 0), j = Z, H = z.w_size), q = u.avail_in, N = u.next_in, R = u.input, u.avail_in = H, u.next_in = 0, u.input = j, lt(z); z.lookahead >= $; ) {
|
|
4629
4649
|
for (y = z.strstart, _ = z.lookahead - ($ - 1); z.ins_h = (z.ins_h << z.hash_shift ^ z.window[y + $ - 1]) & z.hash_mask, z.prev[y & z.w_mask] = z.head[z.ins_h], z.head[z.ins_h] = y, y++, --_; ) ;
|
|
4630
|
-
z.strstart = y, z.lookahead = $ - 1,
|
|
4650
|
+
z.strstart = y, z.lookahead = $ - 1, lt(z);
|
|
4631
4651
|
}
|
|
4632
4652
|
return z.strstart += z.lookahead, z.block_start = z.strstart, z.insert = z.lookahead, z.lookahead = 0, z.match_length = z.prev_length = $ - 1, z.match_available = 0, u.next_in = N, u.input = R, u.avail_in = q, z.wrap = E, d;
|
|
4633
4653
|
}, e.deflateInfo = "pako deflate (from Nodeca project)";
|
|
@@ -4750,7 +4770,7 @@ function $a() {
|
|
|
4750
4770
|
e.inflateReset = I, e.inflateReset2 = A, e.inflateResetKeep = S, e.inflateInit = function(k) {
|
|
4751
4771
|
return P(k, 15);
|
|
4752
4772
|
}, e.inflateInit2 = P, e.inflate = function(k, D) {
|
|
4753
|
-
var m, F, it, U, nt, M, et, O, C, K, G, V,
|
|
4773
|
+
var m, F, it, U, nt, M, et, O, C, K, G, V, lt, Q, Y, rt, ct, st, pt, ht, u, j, z, y, _ = 0, E = new a.Buf8(4), q = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
|
|
4754
4774
|
if (!k || !k.state || !k.output || !k.input && k.avail_in !== 0) return d;
|
|
4755
4775
|
(m = k.state).mode === 12 && (m.mode = 13), nt = k.next_out, it = k.output, et = k.avail_out, U = k.next_in, F = k.input, M = k.avail_in, O = m.hold, C = m.bits, K = M, G = et, j = g;
|
|
4756
4776
|
t: for (; ; ) switch (m.mode) {
|
|
@@ -5057,9 +5077,9 @@ function $a() {
|
|
|
5057
5077
|
k.msg = "invalid distance too far back", m.mode = 30;
|
|
5058
5078
|
break;
|
|
5059
5079
|
}
|
|
5060
|
-
|
|
5061
|
-
} else Q = it,
|
|
5062
|
-
for (et < V && (V = et), et -= V, m.length -= V; it[nt++] = Q[
|
|
5080
|
+
lt = V > m.wnext ? (V -= m.wnext, m.wsize - V) : m.wnext - V, V > m.length && (V = m.length), Q = m.window;
|
|
5081
|
+
} else Q = it, lt = nt - m.offset, V = m.length;
|
|
5082
|
+
for (et < V && (V = et), et -= V, m.length -= V; it[nt++] = Q[lt++], --V; ) ;
|
|
5063
5083
|
m.length === 0 && (m.mode = 21);
|
|
5064
5084
|
break;
|
|
5065
5085
|
case 26:
|
|
@@ -5118,7 +5138,7 @@ function $a() {
|
|
|
5118
5138
|
}, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(n, i, e) {
|
|
5119
5139
|
var a = n("../utils/common"), s = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], o = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], c = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], l = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
|
|
5120
5140
|
i.exports = function(f, p, g, d, w, h, v, b) {
|
|
5121
|
-
var x, S, I, A, P, L, B, $, W, J = b.bits, k = 0, D = 0, m = 0, F = 0, it = 0, U = 0, nt = 0, M = 0, et = 0, O = 0, C = null, K = 0, G = new a.Buf16(16), V = new a.Buf16(16),
|
|
5141
|
+
var x, S, I, A, P, L, B, $, W, J = b.bits, k = 0, D = 0, m = 0, F = 0, it = 0, U = 0, nt = 0, M = 0, et = 0, O = 0, C = null, K = 0, G = new a.Buf16(16), V = new a.Buf16(16), lt = null, Q = 0;
|
|
5122
5142
|
for (k = 0; k <= 15; k++) G[k] = 0;
|
|
5123
5143
|
for (D = 0; D < d; D++) G[p[g + D]]++;
|
|
5124
5144
|
for (it = J, F = 15; 1 <= F && G[F] === 0; F--) ;
|
|
@@ -5128,9 +5148,9 @@ function $a() {
|
|
|
5128
5148
|
if (0 < M && (f === 0 || F !== 1)) return -1;
|
|
5129
5149
|
for (V[1] = 0, k = 1; k < 15; k++) V[k + 1] = V[k] + G[k];
|
|
5130
5150
|
for (D = 0; D < d; D++) p[g + D] !== 0 && (v[V[p[g + D]]++] = D);
|
|
5131
|
-
if (L = f === 0 ? (C =
|
|
5151
|
+
if (L = f === 0 ? (C = lt = v, 19) : f === 1 ? (C = s, K -= 257, lt = o, Q -= 257, 256) : (C = c, lt = l, -1), k = m, P = h, nt = D = O = 0, I = -1, A = (et = 1 << (U = it)) - 1, f === 1 && 852 < et || f === 2 && 592 < et) return 1;
|
|
5132
5152
|
for (; ; ) {
|
|
5133
|
-
for (B = k - nt, W = v[D] < L ? ($ = 0, v[D]) : v[D] > L ? ($ =
|
|
5153
|
+
for (B = k - nt, W = v[D] < L ? ($ = 0, v[D]) : v[D] > L ? ($ = lt[Q + v[D]], C[K + v[D]]) : ($ = 96, 0), x = 1 << k - nt, m = S = 1 << U; w[P + (O >> nt) + (S -= x)] = B << 24 | $ << 16 | W | 0, S !== 0; ) ;
|
|
5134
5154
|
for (x = 1 << k - 1; O & x; ) x >>= 1;
|
|
5135
5155
|
if (x !== 0 ? (O &= x - 1, O += x) : O = 0, D++, --G[k] == 0) {
|
|
5136
5156
|
if (k === F) break;
|
|
@@ -5180,7 +5200,7 @@ function $a() {
|
|
|
5180
5200
|
function V(_, E, q) {
|
|
5181
5201
|
G(_, q[2 * E], q[2 * E + 1]);
|
|
5182
5202
|
}
|
|
5183
|
-
function
|
|
5203
|
+
function lt(_, E) {
|
|
5184
5204
|
for (var q = 0; q |= 1 & _, _ >>>= 1, q <<= 1, 0 < --E; ) ;
|
|
5185
5205
|
return q >>> 1;
|
|
5186
5206
|
}
|
|
@@ -5189,7 +5209,7 @@ function $a() {
|
|
|
5189
5209
|
for (N = 1; N <= v; N++) Z[N] = H = H + q[N - 1] << 1;
|
|
5190
5210
|
for (R = 0; R <= E; R++) {
|
|
5191
5211
|
var X = _[2 * R + 1];
|
|
5192
|
-
X !== 0 && (_[2 * R] =
|
|
5212
|
+
X !== 0 && (_[2 * R] = lt(Z[X]++, X));
|
|
5193
5213
|
}
|
|
5194
5214
|
}
|
|
5195
5215
|
function Y(_) {
|
|
@@ -5222,15 +5242,15 @@ function $a() {
|
|
|
5222
5242
|
for (E.max_code = ot, q = _.heap_len >> 1; 1 <= q; q--) st(_, Z, q);
|
|
5223
5243
|
for (R = tt; q = _.heap[1], _.heap[1] = _.heap[_.heap_len--], st(_, Z, 1), N = _.heap[1], _.heap[--_.heap_max] = q, _.heap[--_.heap_max] = N, Z[2 * R] = Z[2 * q] + Z[2 * N], _.depth[R] = (_.depth[q] >= _.depth[N] ? _.depth[q] : _.depth[N]) + 1, Z[2 * q + 1] = Z[2 * N + 1] = R, _.heap[1] = R++, st(_, Z, 1), 2 <= _.heap_len; ) ;
|
|
5224
5244
|
_.heap[--_.heap_max] = _.heap[1], (function(at, gt) {
|
|
5225
|
-
var
|
|
5226
|
-
for (
|
|
5227
|
-
for (xt[2 * at.heap[at.heap_max] + 1] = 0,
|
|
5228
|
-
if (
|
|
5245
|
+
var $t, _t, Lt, ut, Xt, he, xt = gt.dyn_tree, an = gt.max_code, ai = gt.stat_desc.static_tree, si = gt.stat_desc.has_stree, oi = gt.stat_desc.extra_bits, sn = gt.stat_desc.extra_base, Dt = gt.stat_desc.max_length, Vt = 0;
|
|
5246
|
+
for (ut = 0; ut <= v; ut++) at.bl_count[ut] = 0;
|
|
5247
|
+
for (xt[2 * at.heap[at.heap_max] + 1] = 0, $t = at.heap_max + 1; $t < h; $t++) Dt < (ut = xt[2 * xt[2 * (_t = at.heap[$t]) + 1] + 1] + 1) && (ut = Dt, Vt++), xt[2 * _t + 1] = ut, an < _t || (at.bl_count[ut]++, Xt = 0, sn <= _t && (Xt = oi[_t - sn]), he = xt[2 * _t], at.opt_len += he * (ut + Xt), si && (at.static_len += he * (ai[2 * _t + 1] + Xt)));
|
|
5248
|
+
if (Vt !== 0) {
|
|
5229
5249
|
do {
|
|
5230
|
-
for (
|
|
5231
|
-
at.bl_count[
|
|
5232
|
-
} while (0 <
|
|
5233
|
-
for (
|
|
5250
|
+
for (ut = Dt - 1; at.bl_count[ut] === 0; ) ut--;
|
|
5251
|
+
at.bl_count[ut]--, at.bl_count[ut + 1] += 2, at.bl_count[Dt]--, Vt -= 2;
|
|
5252
|
+
} while (0 < Vt);
|
|
5253
|
+
for (ut = Dt; ut !== 0; ut--) for (_t = at.bl_count[ut]; _t !== 0; ) an < (Lt = at.heap[--$t]) || (xt[2 * Lt + 1] !== ut && (at.opt_len += (ut - xt[2 * Lt + 1]) * xt[2 * Lt], xt[2 * Lt + 1] = ut), _t--);
|
|
5234
5254
|
}
|
|
5235
5255
|
})(_, E), Q(Z, ot, _.bl_count);
|
|
5236
5256
|
}
|
|
@@ -5264,7 +5284,7 @@ function $a() {
|
|
|
5264
5284
|
for (; E <= 255; ) J[2 * E + 1] = 9, E++, H[9]++;
|
|
5265
5285
|
for (; E <= 279; ) J[2 * E + 1] = 7, E++, H[7]++;
|
|
5266
5286
|
for (; E <= 287; ) J[2 * E + 1] = 8, E++, H[8]++;
|
|
5267
|
-
for (Q(J, g + 1, H), E = 0; E < d; E++) k[2 * E + 1] = 5, k[2 * E] =
|
|
5287
|
+
for (Q(J, g + 1, H), E = 0; E < d; E++) k[2 * E + 1] = 5, k[2 * E] = lt(E, 5);
|
|
5268
5288
|
it = new et(J, L, p + 1, g, v), U = new et(k, B, 0, d, v), nt = new et(new Array(0), $, 0, w, x);
|
|
5269
5289
|
})(), z = !0), _.l_desc = new O(_.dyn_ltree, it), _.d_desc = new O(_.dyn_dtree, U), _.bl_desc = new O(_.bl_tree, nt), _.bi_buf = 0, _.bi_valid = 0, Y(_);
|
|
5270
5290
|
}, e._tr_stored_block = y, e._tr_flush_block = function(_, E, q, N) {
|
|
@@ -5370,21 +5390,95 @@ function $a() {
|
|
|
5370
5390
|
I.source === s && typeof I.data == "string" && I.data.indexOf(p) === 0 && x(+I.data.slice(p.length));
|
|
5371
5391
|
}
|
|
5372
5392
|
})(typeof self > "u" ? a === void 0 ? this : a : self);
|
|
5373
|
-
}).call(this, typeof
|
|
5393
|
+
}).call(this, typeof Ht < "u" ? Ht : typeof self < "u" ? self : typeof window < "u" ? window : {});
|
|
5374
5394
|
}, {}] }, {}, [10])(10);
|
|
5375
5395
|
});
|
|
5376
|
-
})(
|
|
5396
|
+
})(me)), me.exports;
|
|
5377
5397
|
}
|
|
5378
|
-
var
|
|
5379
|
-
const
|
|
5380
|
-
|
|
5398
|
+
var qa = Fa();
|
|
5399
|
+
const Ba = /* @__PURE__ */ ja(qa), Na = ["book", "article", "slideshow"], Ua = [
|
|
5400
|
+
"frontmatter",
|
|
5401
|
+
"preface",
|
|
5402
|
+
"acknowledgement",
|
|
5403
|
+
"dedication",
|
|
5404
|
+
"biography",
|
|
5405
|
+
"contributors",
|
|
5406
|
+
"part",
|
|
5407
|
+
"introduction",
|
|
5408
|
+
"chapter",
|
|
5409
|
+
"section",
|
|
5410
|
+
"subsection",
|
|
5411
|
+
"subsubsection",
|
|
5412
|
+
"conclusion",
|
|
5413
|
+
"exercises",
|
|
5414
|
+
"worksheet",
|
|
5415
|
+
"handout",
|
|
5416
|
+
"reading-questions",
|
|
5417
|
+
"references",
|
|
5418
|
+
"solutions",
|
|
5419
|
+
"glossary",
|
|
5420
|
+
"backmatter",
|
|
5421
|
+
"appendix",
|
|
5422
|
+
"index",
|
|
5423
|
+
"colophon"
|
|
5424
|
+
];
|
|
5425
|
+
function He(t) {
|
|
5426
|
+
return Na.includes(t) ? t : void 0;
|
|
5427
|
+
}
|
|
5428
|
+
const Ma = new Set(Ua);
|
|
5429
|
+
function zt(t) {
|
|
5430
|
+
return Ma.has(t);
|
|
5431
|
+
}
|
|
5432
|
+
const Wa = {
|
|
5433
|
+
chapter: "ch",
|
|
5434
|
+
section: "sec",
|
|
5435
|
+
subsection: "subsec",
|
|
5436
|
+
subsubsection: "subsubsec",
|
|
5437
|
+
appendix: "app"
|
|
5438
|
+
};
|
|
5439
|
+
function Ye(t) {
|
|
5440
|
+
return Wa[t] ?? t;
|
|
5441
|
+
}
|
|
5442
|
+
const Za = /* @__PURE__ */ new Set([
|
|
5443
|
+
"frontmatter",
|
|
5444
|
+
"backmatter",
|
|
5445
|
+
"preface",
|
|
5446
|
+
"acknowledgement",
|
|
5447
|
+
"dedication",
|
|
5448
|
+
"biography",
|
|
5449
|
+
"contributors",
|
|
5450
|
+
"colophon",
|
|
5451
|
+
"glossary",
|
|
5452
|
+
"index"
|
|
5453
|
+
]);
|
|
5454
|
+
function Xa(t) {
|
|
5455
|
+
return Za.has(t);
|
|
5456
|
+
}
|
|
5457
|
+
const Nt = [
|
|
5458
|
+
"part",
|
|
5459
|
+
"chapter",
|
|
5460
|
+
"section",
|
|
5461
|
+
"subsection",
|
|
5462
|
+
"subsubsection"
|
|
5463
|
+
], zr = "paragraphs";
|
|
5464
|
+
function Ut(t) {
|
|
5465
|
+
return Nt.indexOf(t);
|
|
5466
|
+
}
|
|
5467
|
+
function Va(t, r) {
|
|
5468
|
+
const n = Ut(t);
|
|
5469
|
+
if (n < 0) return t;
|
|
5470
|
+
const i = n + r;
|
|
5471
|
+
return i >= Nt.length ? zr : Nt[Math.max(0, i)];
|
|
5472
|
+
}
|
|
5473
|
+
const fr = /([a-zA-Z_:][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
|
|
5474
|
+
function Mt(t) {
|
|
5381
5475
|
const r = {};
|
|
5382
5476
|
let n;
|
|
5383
|
-
for (
|
|
5477
|
+
for (fr.lastIndex = 0; (n = fr.exec(t)) !== null; )
|
|
5384
5478
|
r[n[1]] = n[2] ?? n[3] ?? "";
|
|
5385
5479
|
return r;
|
|
5386
5480
|
}
|
|
5387
|
-
function
|
|
5481
|
+
function de(t) {
|
|
5388
5482
|
const r = [];
|
|
5389
5483
|
let n = 0;
|
|
5390
5484
|
const i = t.length;
|
|
@@ -5441,11 +5535,11 @@ function Ve(t) {
|
|
|
5441
5535
|
}
|
|
5442
5536
|
return r;
|
|
5443
5537
|
}
|
|
5444
|
-
function
|
|
5445
|
-
return
|
|
5538
|
+
function $r(t, r) {
|
|
5539
|
+
return Et(t, (n) => n === r);
|
|
5446
5540
|
}
|
|
5447
|
-
function
|
|
5448
|
-
const n =
|
|
5541
|
+
function Et(t, r) {
|
|
5542
|
+
const n = de(t), i = [];
|
|
5449
5543
|
let e = 0, a = null;
|
|
5450
5544
|
for (const s of n) {
|
|
5451
5545
|
if (s.kind === "selfclose") {
|
|
@@ -5457,7 +5551,7 @@ function At(t, r) {
|
|
|
5457
5551
|
end: s.end,
|
|
5458
5552
|
inner: "",
|
|
5459
5553
|
outer: t.slice(s.pos, s.end),
|
|
5460
|
-
attributes:
|
|
5554
|
+
attributes: Mt(s.attrs)
|
|
5461
5555
|
});
|
|
5462
5556
|
continue;
|
|
5463
5557
|
}
|
|
@@ -5473,16 +5567,44 @@ function At(t, r) {
|
|
|
5473
5567
|
end: s.end,
|
|
5474
5568
|
inner: t.slice(a.end, s.pos),
|
|
5475
5569
|
outer: t.slice(a.pos, s.end),
|
|
5476
|
-
attributes:
|
|
5570
|
+
attributes: Mt(a.attrs)
|
|
5477
5571
|
}), a = null);
|
|
5478
5572
|
}
|
|
5479
5573
|
return i;
|
|
5480
5574
|
}
|
|
5481
|
-
function
|
|
5482
|
-
return
|
|
5575
|
+
function ft(t, r) {
|
|
5576
|
+
return $r(t, r)[0] ?? null;
|
|
5577
|
+
}
|
|
5578
|
+
function Ga(t) {
|
|
5579
|
+
for (const r of de(t)) {
|
|
5580
|
+
if (r.kind === "close") continue;
|
|
5581
|
+
const n = He(r.name);
|
|
5582
|
+
if (n) return n;
|
|
5583
|
+
}
|
|
5584
|
+
return null;
|
|
5483
5585
|
}
|
|
5484
|
-
function
|
|
5485
|
-
const
|
|
5586
|
+
function fe(t) {
|
|
5587
|
+
const r = Et(
|
|
5588
|
+
t,
|
|
5589
|
+
(e) => He(e) !== void 0
|
|
5590
|
+
);
|
|
5591
|
+
if (r.length > 1) {
|
|
5592
|
+
const e = r.map((a) => `<${a.name}>`).join(", ");
|
|
5593
|
+
throw new Error(
|
|
5594
|
+
`A PreTeXt document has one root element, but this source has ${r.length} side by side: ${e}. Keep one and move the rest into their own documents.`
|
|
5595
|
+
);
|
|
5596
|
+
}
|
|
5597
|
+
const n = r[0];
|
|
5598
|
+
if (!n) return null;
|
|
5599
|
+
const i = Ga(n.inner);
|
|
5600
|
+
if (i)
|
|
5601
|
+
throw new Error(
|
|
5602
|
+
`<${i}> is a PreTeXt root element, so it cannot appear inside the document's <${n.name}> root. Split it into its own document, or replace it with a division such as <section>.`
|
|
5603
|
+
);
|
|
5604
|
+
return n;
|
|
5605
|
+
}
|
|
5606
|
+
function It(t, r) {
|
|
5607
|
+
const n = de(t);
|
|
5486
5608
|
let i = 0, e = null, a = -1;
|
|
5487
5609
|
for (const s of n) {
|
|
5488
5610
|
if (s.kind === "selfclose") {
|
|
@@ -5495,7 +5617,7 @@ function Jt(t, r) {
|
|
|
5495
5617
|
end: s.end,
|
|
5496
5618
|
inner: "",
|
|
5497
5619
|
outer: t.slice(s.pos, s.end),
|
|
5498
|
-
attributes:
|
|
5620
|
+
attributes: Mt(s.attrs)
|
|
5499
5621
|
};
|
|
5500
5622
|
continue;
|
|
5501
5623
|
}
|
|
@@ -5513,27 +5635,27 @@ function Jt(t, r) {
|
|
|
5513
5635
|
end: s.end,
|
|
5514
5636
|
inner: t.slice(e.end, s.pos),
|
|
5515
5637
|
outer: t.slice(e.pos, s.end),
|
|
5516
|
-
attributes:
|
|
5638
|
+
attributes: Mt(o)
|
|
5517
5639
|
};
|
|
5518
5640
|
}
|
|
5519
5641
|
}
|
|
5520
5642
|
return null;
|
|
5521
5643
|
}
|
|
5522
|
-
function
|
|
5523
|
-
return
|
|
5644
|
+
function Lr(t) {
|
|
5645
|
+
return de(t).map((r) => ({
|
|
5524
5646
|
name: r.name,
|
|
5525
5647
|
kind: r.kind,
|
|
5526
5648
|
start: r.pos,
|
|
5527
5649
|
end: r.end,
|
|
5528
|
-
attributes: r.kind === "close" ? {} :
|
|
5650
|
+
attributes: r.kind === "close" ? {} : Mt(r.attrs)
|
|
5529
5651
|
}));
|
|
5530
5652
|
}
|
|
5531
|
-
function
|
|
5532
|
-
const r =
|
|
5653
|
+
function Je(t) {
|
|
5654
|
+
const r = ft(t, "title");
|
|
5533
5655
|
return r ? r.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() : "";
|
|
5534
5656
|
}
|
|
5535
|
-
function
|
|
5536
|
-
return
|
|
5657
|
+
function Dr(t) {
|
|
5658
|
+
return It(t, "slideshow") ? "slideshow" : It(t, "book") ? "book" : It(t, "article") ? "article" : It(t, "chapter") ? "book" : It(t, "slide") ? "slideshow" : "article";
|
|
5537
5659
|
}
|
|
5538
5660
|
function mt(t) {
|
|
5539
5661
|
const r = t.replace(/\\/g, "/"), n = r.startsWith("/"), i = [];
|
|
@@ -5547,7 +5669,7 @@ function mt(t) {
|
|
|
5547
5669
|
}
|
|
5548
5670
|
return (n ? "/" : "") + i.join("/");
|
|
5549
5671
|
}
|
|
5550
|
-
function
|
|
5672
|
+
function Ke(t) {
|
|
5551
5673
|
const r = t.lastIndexOf("/");
|
|
5552
5674
|
return r >= 0 ? t.slice(0, r) : "";
|
|
5553
5675
|
}
|
|
@@ -5564,15 +5686,15 @@ function se(t) {
|
|
|
5564
5686
|
function kt(...t) {
|
|
5565
5687
|
return mt(t.filter((r) => !!r).join("/"));
|
|
5566
5688
|
}
|
|
5567
|
-
function
|
|
5689
|
+
function Ha(t, r) {
|
|
5568
5690
|
if (!t)
|
|
5569
5691
|
return r;
|
|
5570
5692
|
const n = t.endsWith("/") ? t : `${t}/`;
|
|
5571
5693
|
return r.startsWith(n) ? r.slice(n.length) : r;
|
|
5572
5694
|
}
|
|
5573
|
-
const
|
|
5574
|
-
function
|
|
5575
|
-
const i =
|
|
5695
|
+
const Fe = /(\\(input|include) *\{([^{}]+)\})/g;
|
|
5696
|
+
function Qe(t, r, n) {
|
|
5697
|
+
const i = Ke(r);
|
|
5576
5698
|
return [
|
|
5577
5699
|
t,
|
|
5578
5700
|
`${t}.tex`,
|
|
@@ -5580,14 +5702,14 @@ function Ye(t, r, n) {
|
|
|
5580
5702
|
i ? kt(i, `${t}.tex`) : `${t}.tex`
|
|
5581
5703
|
].map(mt).find((a) => a in n) ?? null;
|
|
5582
5704
|
}
|
|
5583
|
-
function
|
|
5705
|
+
function hr(t, r, n, i = 3) {
|
|
5584
5706
|
let e = 0;
|
|
5585
5707
|
const a = [], s = /* @__PURE__ */ new Set(), o = (l) => {
|
|
5586
5708
|
let f = !1;
|
|
5587
5709
|
return { output: l.replace(
|
|
5588
|
-
|
|
5710
|
+
Fe,
|
|
5589
5711
|
(g, d, w, h) => {
|
|
5590
|
-
const v =
|
|
5712
|
+
const v = Qe(h, r, n);
|
|
5591
5713
|
return v ? s.has(v) ? "" : (f = !0, e += 1, s.add(v), n[v]) : (a.includes(h) || a.push(h), g);
|
|
5592
5714
|
}
|
|
5593
5715
|
), changed: f };
|
|
@@ -5605,21 +5727,21 @@ function dr(t, r, n, i = 3) {
|
|
|
5605
5727
|
consumedPaths: [...s]
|
|
5606
5728
|
};
|
|
5607
5729
|
}
|
|
5608
|
-
function
|
|
5730
|
+
function Ya(t) {
|
|
5609
5731
|
const r = /* @__PURE__ */ new Set();
|
|
5610
5732
|
for (const [n, i] of Object.entries(t)) {
|
|
5611
|
-
|
|
5733
|
+
Fe.lastIndex = 0;
|
|
5612
5734
|
let e;
|
|
5613
|
-
for (; (e =
|
|
5614
|
-
const a =
|
|
5735
|
+
for (; (e = Fe.exec(i)) !== null; ) {
|
|
5736
|
+
const a = Qe(e[3], n, t);
|
|
5615
5737
|
a && a !== n && r.add(a);
|
|
5616
5738
|
}
|
|
5617
5739
|
}
|
|
5618
5740
|
return r;
|
|
5619
5741
|
}
|
|
5620
|
-
const
|
|
5621
|
-
function
|
|
5622
|
-
const i =
|
|
5742
|
+
const Pr = String.raw`<xi:include\b[^>]*\bhref\s*=\s*(?:"([^"]+)"|'([^']+)')[^>]*\/>`, pr = new RegExp(Pr, "g");
|
|
5743
|
+
function jr(t, r, n) {
|
|
5744
|
+
const i = Ke(r), e = [
|
|
5623
5745
|
t,
|
|
5624
5746
|
`${t}.ptx`,
|
|
5625
5747
|
`${t}.xml`,
|
|
@@ -5634,21 +5756,21 @@ function Lr(t, r, n) {
|
|
|
5634
5756
|
}
|
|
5635
5757
|
return null;
|
|
5636
5758
|
}
|
|
5637
|
-
function
|
|
5759
|
+
function Ja(t) {
|
|
5638
5760
|
return t.replace(/^\s*<\?xml[^?]*\?>\s*/, "");
|
|
5639
5761
|
}
|
|
5640
|
-
function
|
|
5762
|
+
function Ka(t, r, n, i = 5) {
|
|
5641
5763
|
let e = 0;
|
|
5642
5764
|
const a = [], s = [r], o = /* @__PURE__ */ new Set(), c = (f, p) => f.replace(
|
|
5643
|
-
new RegExp(
|
|
5765
|
+
new RegExp(Pr, "g"),
|
|
5644
5766
|
(g, d, w) => {
|
|
5645
|
-
const h = d ?? w ?? "", v = s[s.length - 1], b =
|
|
5767
|
+
const h = d ?? w ?? "", v = s[s.length - 1], b = jr(h, v, n);
|
|
5646
5768
|
if (!b)
|
|
5647
5769
|
return a.includes(h) || a.push(h), g;
|
|
5648
5770
|
if (s.includes(b) || p >= i)
|
|
5649
5771
|
return g;
|
|
5650
5772
|
e += 1, o.add(b), s.push(b);
|
|
5651
|
-
const x = c(
|
|
5773
|
+
const x = c(Ja(n[b]), p + 1);
|
|
5652
5774
|
return s.pop(), x;
|
|
5653
5775
|
}
|
|
5654
5776
|
);
|
|
@@ -5659,92 +5781,22 @@ function qa(t, r, n, i = 5) {
|
|
|
5659
5781
|
consumedPaths: [...o]
|
|
5660
5782
|
};
|
|
5661
5783
|
}
|
|
5662
|
-
function
|
|
5784
|
+
function Qa(t) {
|
|
5663
5785
|
const r = /* @__PURE__ */ new Set();
|
|
5664
5786
|
for (const [n, i] of Object.entries(t)) {
|
|
5665
|
-
|
|
5787
|
+
pr.lastIndex = 0;
|
|
5666
5788
|
let e;
|
|
5667
|
-
for (; (e =
|
|
5668
|
-
const a = e[1] ?? e[2] ?? "", s =
|
|
5789
|
+
for (; (e = pr.exec(i)) !== null; ) {
|
|
5790
|
+
const a = e[1] ?? e[2] ?? "", s = jr(a, n, t);
|
|
5669
5791
|
s && s !== n && r.add(s);
|
|
5670
5792
|
}
|
|
5671
5793
|
}
|
|
5672
5794
|
return r;
|
|
5673
5795
|
}
|
|
5674
|
-
|
|
5675
|
-
"frontmatter",
|
|
5676
|
-
"preface",
|
|
5677
|
-
"acknowledgement",
|
|
5678
|
-
"dedication",
|
|
5679
|
-
"biography",
|
|
5680
|
-
"contributors",
|
|
5681
|
-
"part",
|
|
5682
|
-
"introduction",
|
|
5683
|
-
"chapter",
|
|
5684
|
-
"section",
|
|
5685
|
-
"subsection",
|
|
5686
|
-
"subsubsection",
|
|
5687
|
-
"conclusion",
|
|
5688
|
-
"exercises",
|
|
5689
|
-
"worksheet",
|
|
5690
|
-
"handout",
|
|
5691
|
-
"reading-questions",
|
|
5692
|
-
"references",
|
|
5693
|
-
"solutions",
|
|
5694
|
-
"glossary",
|
|
5695
|
-
"backmatter",
|
|
5696
|
-
"appendix",
|
|
5697
|
-
"index",
|
|
5698
|
-
"colophon"
|
|
5699
|
-
], Ua = new Set(Na);
|
|
5700
|
-
function Ot(t) {
|
|
5701
|
-
return Ua.has(t);
|
|
5702
|
-
}
|
|
5703
|
-
const Ma = {
|
|
5704
|
-
chapter: "ch",
|
|
5705
|
-
section: "sec",
|
|
5706
|
-
subsection: "subsec",
|
|
5707
|
-
subsubsection: "subsubsec",
|
|
5708
|
-
appendix: "app"
|
|
5709
|
-
};
|
|
5710
|
-
function Je(t) {
|
|
5711
|
-
return Ma[t] ?? t;
|
|
5712
|
-
}
|
|
5713
|
-
const Wa = /* @__PURE__ */ new Set([
|
|
5714
|
-
"frontmatter",
|
|
5715
|
-
"backmatter",
|
|
5716
|
-
"preface",
|
|
5717
|
-
"acknowledgement",
|
|
5718
|
-
"dedication",
|
|
5719
|
-
"biography",
|
|
5720
|
-
"contributors",
|
|
5721
|
-
"colophon",
|
|
5722
|
-
"glossary",
|
|
5723
|
-
"index"
|
|
5724
|
-
]);
|
|
5725
|
-
function Za(t) {
|
|
5726
|
-
return Wa.has(t);
|
|
5727
|
-
}
|
|
5728
|
-
const Nt = [
|
|
5729
|
-
"part",
|
|
5730
|
-
"chapter",
|
|
5731
|
-
"section",
|
|
5732
|
-
"subsection",
|
|
5733
|
-
"subsubsection"
|
|
5734
|
-
], Dr = "paragraphs";
|
|
5735
|
-
function Ut(t) {
|
|
5736
|
-
return Nt.indexOf(t);
|
|
5737
|
-
}
|
|
5738
|
-
function Xa(t, r) {
|
|
5739
|
-
const n = Ut(t);
|
|
5740
|
-
if (n < 0) return t;
|
|
5741
|
-
const i = n + r;
|
|
5742
|
-
return i >= Nt.length ? Dr : Nt[Math.max(0, i)];
|
|
5743
|
-
}
|
|
5744
|
-
function Wt(t) {
|
|
5796
|
+
function Zt(t) {
|
|
5745
5797
|
return t.trim().replace(/[^a-zA-Z0-9\-_]+/g, "-").replace(/^[^a-zA-Z_]+/, "").replace(/-+$/, "");
|
|
5746
5798
|
}
|
|
5747
|
-
class
|
|
5799
|
+
class tn {
|
|
5748
5800
|
used;
|
|
5749
5801
|
/**
|
|
5750
5802
|
* `taken` seeds the pool with names it must not hand out. An import into an
|
|
@@ -5766,9 +5818,9 @@ class Ke {
|
|
|
5766
5818
|
return this.used.has(r);
|
|
5767
5819
|
}
|
|
5768
5820
|
}
|
|
5769
|
-
function
|
|
5821
|
+
function qe(t, r, n) {
|
|
5770
5822
|
if (t) {
|
|
5771
|
-
const i =
|
|
5823
|
+
const i = Zt(t) || n, e = r.claim(i);
|
|
5772
5824
|
return e !== t ? { ref: e, renamedFrom: t, generated: !1 } : { ref: e, generated: !1 };
|
|
5773
5825
|
}
|
|
5774
5826
|
return { ref: r.claim(n), generated: !0 };
|
|
@@ -5795,36 +5847,36 @@ function oe(t, r, n, i) {
|
|
|
5795
5847
|
function ce(t, r) {
|
|
5796
5848
|
return Object.entries(t).map(([n, i]) => {
|
|
5797
5849
|
const e = n.split("/").pop() ?? n, a = e.replace(/\.[^.]+$/, "");
|
|
5798
|
-
return { ref: r.claim(
|
|
5850
|
+
return { ref: r.claim(Zt(a) || "asset"), fileName: e, data: i };
|
|
5799
5851
|
});
|
|
5800
5852
|
}
|
|
5801
|
-
function
|
|
5853
|
+
function Fr(t, r) {
|
|
5802
5854
|
return t.splitLevel !== void 0 ? Math.max(0, t.splitLevel) : t.splitChapters === !1 ? 0 : t.splitSections ? r === "book" ? 2 : 1 : r === "book" ? 1 : 0;
|
|
5803
5855
|
}
|
|
5804
|
-
function
|
|
5856
|
+
function qr(t, r, n) {
|
|
5805
5857
|
const i = t.slice(0, r), e = t.slice(r);
|
|
5806
5858
|
return /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/.test(i) ? i.replace(
|
|
5807
5859
|
/\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/,
|
|
5808
5860
|
`xml:id="${n}"`
|
|
5809
5861
|
) + e : i.replace(/^<([a-zA-Z_:][\w:.-]*)/, `<$1 xml:id="${n}"`) + e;
|
|
5810
5862
|
}
|
|
5811
|
-
function
|
|
5812
|
-
return
|
|
5863
|
+
function Br(t, r, n) {
|
|
5864
|
+
return qe(t.attributes["xml:id"], r, n);
|
|
5813
5865
|
}
|
|
5814
|
-
function
|
|
5866
|
+
function Nr(t, r) {
|
|
5815
5867
|
const n = t.outer.slice(0, t.startTagEnd - t.start), i = t.outer.slice(t.contentEnd - t.start);
|
|
5816
5868
|
return n + r + i;
|
|
5817
5869
|
}
|
|
5818
|
-
function
|
|
5870
|
+
function Ur(t, r, n, i) {
|
|
5819
5871
|
if (n > i.maxDepth)
|
|
5820
5872
|
return t;
|
|
5821
|
-
const e =
|
|
5873
|
+
const e = Et(t, zt);
|
|
5822
5874
|
if (e.length === 0)
|
|
5823
5875
|
return t;
|
|
5824
5876
|
const a = e.map((s, o) => {
|
|
5825
|
-
const c = o + 1, f = `${
|
|
5877
|
+
const c = o + 1, f = `${Ye(s.name)}-${ue(c, e.length)}`, p = n === 1 ? f : `${r}-${f}`, g = Br(s, i.refs, p);
|
|
5826
5878
|
oe(i.warnings, g, s.name, c);
|
|
5827
|
-
const d =
|
|
5879
|
+
const d = Ur(
|
|
5828
5880
|
s.inner,
|
|
5829
5881
|
g.ref,
|
|
5830
5882
|
n + 1,
|
|
@@ -5833,10 +5885,10 @@ function Br(t, r, n, i) {
|
|
|
5833
5885
|
return i.divisions.push({
|
|
5834
5886
|
xmlId: g.ref,
|
|
5835
5887
|
type: s.name,
|
|
5836
|
-
title:
|
|
5888
|
+
title: Je(s.inner),
|
|
5837
5889
|
sourceFormat: "pretext",
|
|
5838
|
-
content:
|
|
5839
|
-
|
|
5890
|
+
content: qr(
|
|
5891
|
+
Nr(s, d),
|
|
5840
5892
|
s.startTagEnd - s.start,
|
|
5841
5893
|
g.ref
|
|
5842
5894
|
),
|
|
@@ -5847,14 +5899,14 @@ function Br(t, r, n, i) {
|
|
|
5847
5899
|
replacement: `<plus:${s.name} ref="${g.ref}"/>`
|
|
5848
5900
|
};
|
|
5849
5901
|
});
|
|
5850
|
-
return
|
|
5902
|
+
return Wt(t, a);
|
|
5851
5903
|
}
|
|
5852
|
-
function
|
|
5853
|
-
const n = [], i = r.documentKind ??
|
|
5854
|
-
let l =
|
|
5904
|
+
function Mr(t, r = {}) {
|
|
5905
|
+
const n = [], i = r.documentKind ?? Dr(t), e = Fr(r, i), a = It(t, "pretext"), s = a ? a.inner : t, o = ft(s, "docinfo"), c = o?.outer.trim() ?? "";
|
|
5906
|
+
let l = fe(s);
|
|
5855
5907
|
if (!l) {
|
|
5856
|
-
const b = i
|
|
5857
|
-
l =
|
|
5908
|
+
const b = i, x = (o ? s.slice(0, o.start) + s.slice(o.end) : s).trim();
|
|
5909
|
+
l = ft(
|
|
5858
5910
|
`<${b}>
|
|
5859
5911
|
${x}
|
|
5860
5912
|
</${b}>`,
|
|
@@ -5872,20 +5924,22 @@ ${x}
|
|
|
5872
5924
|
occurrences: 1,
|
|
5873
5925
|
message: "Document was treated as a book but no <book> element found; importing with the existing root."
|
|
5874
5926
|
});
|
|
5875
|
-
const f = new
|
|
5927
|
+
const f = new tn(r.takenIds), p = [], g = Br(l, f, "document");
|
|
5876
5928
|
g.renamedFrom !== void 0 && oe(n, g, l.name, 1);
|
|
5877
|
-
const d =
|
|
5929
|
+
const d = Je(l.inner), w = Ur(l.inner, g.ref, 1, {
|
|
5878
5930
|
refs: f,
|
|
5879
5931
|
divisions: p,
|
|
5880
5932
|
warnings: n,
|
|
5881
5933
|
maxDepth: e
|
|
5882
5934
|
}), h = {
|
|
5883
5935
|
xmlId: g.ref,
|
|
5884
|
-
|
|
5936
|
+
// The root element the document actually has. Collapsing this to a
|
|
5937
|
+
// book/article binary is what used to turn a <slideshow> into an <article>.
|
|
5938
|
+
type: He(l.name) ?? "article",
|
|
5885
5939
|
title: d,
|
|
5886
5940
|
sourceFormat: "pretext",
|
|
5887
|
-
content:
|
|
5888
|
-
|
|
5941
|
+
content: qr(
|
|
5942
|
+
Nr(l, w),
|
|
5889
5943
|
l.startTagEnd - l.start,
|
|
5890
5944
|
g.ref
|
|
5891
5945
|
),
|
|
@@ -5904,35 +5958,35 @@ ${x}
|
|
|
5904
5958
|
warnings: n
|
|
5905
5959
|
};
|
|
5906
5960
|
}
|
|
5907
|
-
function
|
|
5908
|
-
return r === "latex" ?
|
|
5961
|
+
function Wr(t, r, n = {}) {
|
|
5962
|
+
return r === "latex" ? ts(t, n) : es(t, n);
|
|
5909
5963
|
}
|
|
5910
|
-
function
|
|
5911
|
-
return
|
|
5964
|
+
function mr(t) {
|
|
5965
|
+
return Zt(Ze(t));
|
|
5912
5966
|
}
|
|
5913
|
-
function
|
|
5967
|
+
function en(t, r, n, i, e, a, s) {
|
|
5914
5968
|
if (t) {
|
|
5915
|
-
const l =
|
|
5969
|
+
const l = qe(
|
|
5916
5970
|
t,
|
|
5917
5971
|
n,
|
|
5918
|
-
|
|
5972
|
+
mr(r) || i
|
|
5919
5973
|
);
|
|
5920
5974
|
return oe(s, l, e, a), l.ref;
|
|
5921
5975
|
}
|
|
5922
|
-
const o =
|
|
5976
|
+
const o = mr(r);
|
|
5923
5977
|
if (o)
|
|
5924
5978
|
return n.claim(o);
|
|
5925
|
-
const c =
|
|
5979
|
+
const c = qe(void 0, n, i);
|
|
5926
5980
|
return oe(s, c, e, a), c.ref;
|
|
5927
5981
|
}
|
|
5928
|
-
function
|
|
5929
|
-
const n = [], { body: i } =
|
|
5982
|
+
function ts(t, r) {
|
|
5983
|
+
const n = [], { body: i } = Bt(t), e = (i || t).trim(), a = Ir(e), s = Ve(e), o = r.documentKind ?? (s.includes("chapter") || s.includes("part") ? "book" : "article"), c = Fr(r, o), l = new tn(), f = l.claim("document"), p = [], g = Zr(e, a, 0, e.length, 1, {
|
|
5930
5984
|
maxDepth: c,
|
|
5931
5985
|
refs: l,
|
|
5932
5986
|
divisions: p,
|
|
5933
5987
|
warnings: n,
|
|
5934
5988
|
parentRef: f
|
|
5935
|
-
}), d = o
|
|
5989
|
+
}), d = o, w = r.title ?? "", h = `\\${d}{${w}}\\label{${f}}`;
|
|
5936
5990
|
return p.unshift({
|
|
5937
5991
|
xmlId: f,
|
|
5938
5992
|
type: d,
|
|
@@ -5952,12 +6006,12 @@ ${g}` : h,
|
|
|
5952
6006
|
warnings: n
|
|
5953
6007
|
};
|
|
5954
6008
|
}
|
|
5955
|
-
function
|
|
6009
|
+
function Zr(t, r, n, i, e, a) {
|
|
5956
6010
|
if (e > a.maxDepth || r.length === 0)
|
|
5957
6011
|
return t.slice(n, i).trim();
|
|
5958
6012
|
const s = [t.slice(n, r[0].start)];
|
|
5959
6013
|
return r.forEach((o, c) => {
|
|
5960
|
-
const f = `${
|
|
6014
|
+
const f = `${Ye(o.command)}-${ue(c + 1, r.length)}`, p = e === 1 ? f : `${a.parentRef}-${f}`, g = en(
|
|
5961
6015
|
o.labelId,
|
|
5962
6016
|
o.title,
|
|
5963
6017
|
a.refs,
|
|
@@ -5965,7 +6019,7 @@ function Mr(t, r, n, i, e, a) {
|
|
|
5965
6019
|
o.command,
|
|
5966
6020
|
c + 1,
|
|
5967
6021
|
a.warnings
|
|
5968
|
-
), d =
|
|
6022
|
+
), d = Zr(
|
|
5969
6023
|
t,
|
|
5970
6024
|
o.children,
|
|
5971
6025
|
o.contentStart,
|
|
@@ -5986,7 +6040,7 @@ ${d}`,
|
|
|
5986
6040
|
|
|
5987
6041
|
`).trim();
|
|
5988
6042
|
}
|
|
5989
|
-
function
|
|
6043
|
+
function Xr(t, r) {
|
|
5990
6044
|
const n = new RegExp(`^#{${r}}\\s+(.*)$`), i = [], e = [];
|
|
5991
6045
|
let a = null, s = !1, o = "";
|
|
5992
6046
|
for (const c of t.split(`
|
|
@@ -6016,12 +6070,12 @@ ${Object.entries(t).map(([n, i]) => `${n}: ${i}`).join(`
|
|
|
6016
6070
|
`)}
|
|
6017
6071
|
---`;
|
|
6018
6072
|
}
|
|
6019
|
-
function
|
|
6020
|
-
const n = [], i = t.trim(), e = r.documentKind ?? "article", a = r.splitChapters ?? e === "book", s = r.splitSections ?? !1, o = new
|
|
6073
|
+
function es(t, r) {
|
|
6074
|
+
const n = [], i = t.trim(), e = r.documentKind ?? "article", a = r.splitChapters ?? e === "book", s = r.splitSections ?? !1, o = new tn(), c = o.claim("document"), l = [];
|
|
6021
6075
|
if (!(a && e === "book"))
|
|
6022
6076
|
return l.push({
|
|
6023
6077
|
xmlId: c,
|
|
6024
|
-
type: e
|
|
6078
|
+
type: e,
|
|
6025
6079
|
title: r.title ?? "",
|
|
6026
6080
|
sourceFormat: "markdown",
|
|
6027
6081
|
content: `${Kt({
|
|
@@ -6042,9 +6096,9 @@ ${i}`.trim(),
|
|
|
6042
6096
|
},
|
|
6043
6097
|
warnings: n
|
|
6044
6098
|
};
|
|
6045
|
-
const { preamble: f, sections: p } =
|
|
6099
|
+
const { preamble: f, sections: p } = Xr(i, 1), g = f ? [f] : [];
|
|
6046
6100
|
return p.forEach((d, w) => {
|
|
6047
|
-
const h =
|
|
6101
|
+
const h = en(
|
|
6048
6102
|
void 0,
|
|
6049
6103
|
d.headingText,
|
|
6050
6104
|
o,
|
|
@@ -6054,7 +6108,7 @@ ${i}`.trim(),
|
|
|
6054
6108
|
n
|
|
6055
6109
|
);
|
|
6056
6110
|
let v = d.body;
|
|
6057
|
-
s && (v =
|
|
6111
|
+
s && (v = ns(
|
|
6058
6112
|
d.body,
|
|
6059
6113
|
h,
|
|
6060
6114
|
o,
|
|
@@ -6102,12 +6156,12 @@ ${g.join(`
|
|
|
6102
6156
|
warnings: n
|
|
6103
6157
|
};
|
|
6104
6158
|
}
|
|
6105
|
-
function
|
|
6106
|
-
const { preamble: a, sections: s } =
|
|
6159
|
+
function ns(t, r, n, i, e) {
|
|
6160
|
+
const { preamble: a, sections: s } = Xr(t, 2);
|
|
6107
6161
|
if (s.length === 0) return t;
|
|
6108
6162
|
const o = a ? [a] : [];
|
|
6109
6163
|
return s.forEach((c, l) => {
|
|
6110
|
-
const f =
|
|
6164
|
+
const f = en(
|
|
6111
6165
|
void 0,
|
|
6112
6166
|
c.headingText,
|
|
6113
6167
|
n,
|
|
@@ -6136,45 +6190,45 @@ ${c.body}`.trim(),
|
|
|
6136
6190
|
|
|
6137
6191
|
`).trim();
|
|
6138
6192
|
}
|
|
6139
|
-
const
|
|
6193
|
+
const Be = /<plus:([a-zA-Z][a-zA-Z-]*)\s+ref="([^"]+)"\s*\/>/g;
|
|
6140
6194
|
function le(t) {
|
|
6141
6195
|
const r = [];
|
|
6142
|
-
|
|
6196
|
+
Be.lastIndex = 0;
|
|
6143
6197
|
let n;
|
|
6144
|
-
for (; (n =
|
|
6198
|
+
for (; (n = Be.exec(t)) !== null; )
|
|
6145
6199
|
r.push(n[2]);
|
|
6146
6200
|
return r;
|
|
6147
6201
|
}
|
|
6148
|
-
function
|
|
6202
|
+
function Ne(t, r) {
|
|
6149
6203
|
return t.replace(
|
|
6150
|
-
|
|
6204
|
+
Be,
|
|
6151
6205
|
(n, i, e) => {
|
|
6152
6206
|
const a = r.get(e);
|
|
6153
6207
|
return a ? `<xi:include href="${a}"/>` : n;
|
|
6154
6208
|
}
|
|
6155
6209
|
);
|
|
6156
6210
|
}
|
|
6157
|
-
function
|
|
6158
|
-
const n =
|
|
6211
|
+
function rs(t, r) {
|
|
6212
|
+
const n = Ze(t) || "division";
|
|
6159
6213
|
return n.startsWith(`${r}-`) ? n : `${r}-${n}`;
|
|
6160
6214
|
}
|
|
6161
|
-
function
|
|
6215
|
+
function is(t, r) {
|
|
6162
6216
|
let n = r, i = 2;
|
|
6163
6217
|
for (; t.has(n); )
|
|
6164
6218
|
n = `${r}-${i}`, i += 1;
|
|
6165
6219
|
return t.add(n), n;
|
|
6166
6220
|
}
|
|
6167
|
-
function
|
|
6221
|
+
function as(t, r) {
|
|
6168
6222
|
const n = `${r}-`;
|
|
6169
6223
|
return t.startsWith(n) ? t.slice(n.length) : t;
|
|
6170
6224
|
}
|
|
6171
|
-
function
|
|
6225
|
+
function Vr(t, r) {
|
|
6172
6226
|
const n = new Map(
|
|
6173
6227
|
t.divisions.map((f) => [f.xmlId, f])
|
|
6174
6228
|
), i = [], e = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
6175
6229
|
function o(f, p) {
|
|
6176
6230
|
let g = s.get(f);
|
|
6177
|
-
return g || (g = /* @__PURE__ */ new Set(), s.set(f, g)),
|
|
6231
|
+
return g || (g = /* @__PURE__ */ new Set(), s.set(f, g)), is(g, p);
|
|
6178
6232
|
}
|
|
6179
6233
|
function c(f, p, g, d) {
|
|
6180
6234
|
if (e.has(f.xmlId))
|
|
@@ -6182,9 +6236,9 @@ function Zr(t, r) {
|
|
|
6182
6236
|
e.add(f.xmlId);
|
|
6183
6237
|
const w = o(
|
|
6184
6238
|
p,
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6239
|
+
Xa(f.type) ? f.type : rs(
|
|
6240
|
+
as(f.xmlId, d),
|
|
6241
|
+
Ye(f.type)
|
|
6188
6242
|
)
|
|
6189
6243
|
);
|
|
6190
6244
|
a.set(f.xmlId, `${g}${w}.ptx`), i.push({ division: f, filePath: `${p}${w}.ptx` });
|
|
@@ -6203,46 +6257,46 @@ function Zr(t, r) {
|
|
|
6203
6257
|
f.isRoot || e.has(f.xmlId) || l.has(f.xmlId) || c(f, r.directory, "", r.parentXmlId);
|
|
6204
6258
|
return { placed: i, hrefByRef: a };
|
|
6205
6259
|
}
|
|
6206
|
-
const
|
|
6260
|
+
const ge = {
|
|
6207
6261
|
mainSourcePath: "source/main.ptx",
|
|
6208
6262
|
publicationPath: "publication/publication.ptx",
|
|
6209
6263
|
projectFilePath: "project.ptx"
|
|
6210
6264
|
};
|
|
6211
|
-
function
|
|
6212
|
-
const n = r.mainSourcePath ??
|
|
6265
|
+
function ss(t, r = {}) {
|
|
6266
|
+
const n = r.mainSourcePath ?? ge.mainSourcePath, i = r.publicationPath ?? ge.publicationPath, e = r.projectFilePath ?? ge.projectFilePath, a = r.includeScaffold ?? !0, s = {}, o = new Map(t.divisions.map((v) => [v.xmlId, v])), c = t.divisions.find((v) => v.isRoot);
|
|
6213
6267
|
if (!c)
|
|
6214
6268
|
throw new Error("Division pool has no root division.");
|
|
6215
|
-
const l = n.includes("/") ? n.slice(0, n.lastIndexOf("/") + 1) : "", { placed: f, hrefByRef: p } =
|
|
6269
|
+
const l = n.includes("/") ? n.slice(0, n.lastIndexOf("/") + 1) : "", { placed: f, hrefByRef: p } = Vr(t, {
|
|
6216
6270
|
entries: le(c.content).map((v) => o.get(v)).filter((v) => v !== void 0),
|
|
6217
6271
|
directory: l,
|
|
6218
6272
|
parentXmlId: c.xmlId
|
|
6219
6273
|
});
|
|
6220
6274
|
for (const { division: v, filePath: b } of f) {
|
|
6221
|
-
const x =
|
|
6222
|
-
s[b] =
|
|
6275
|
+
const x = Ne(v.content, p), S = x === v.content ? x : Le(x);
|
|
6276
|
+
s[b] = De(S);
|
|
6223
6277
|
}
|
|
6224
|
-
const g =
|
|
6278
|
+
const g = Ne(c.content, p), w = `<pretext>
|
|
6225
6279
|
${t.docinfo ? `${t.docinfo}
|
|
6226
6280
|
` : ""}${g}
|
|
6227
6281
|
</pretext>`;
|
|
6228
|
-
s[n] =
|
|
6229
|
-
g === c.content ? w :
|
|
6230
|
-
), a && (s[e] =
|
|
6282
|
+
s[n] = De(
|
|
6283
|
+
g === c.content ? w : Le(w)
|
|
6284
|
+
), a && (s[e] = sa({
|
|
6231
6285
|
mainSource: n,
|
|
6232
6286
|
publication: i
|
|
6233
|
-
}), s[i] =
|
|
6287
|
+
}), s[i] = Er());
|
|
6234
6288
|
const h = { [c.xmlId]: n };
|
|
6235
6289
|
for (const { division: v, filePath: b } of f)
|
|
6236
6290
|
h[v.xmlId] = b;
|
|
6237
6291
|
return { files: s, pathByRef: h };
|
|
6238
6292
|
}
|
|
6239
|
-
function
|
|
6240
|
-
const i =
|
|
6293
|
+
function os(t, r, n) {
|
|
6294
|
+
const i = ft(t, r);
|
|
6241
6295
|
if (!i) return t;
|
|
6242
6296
|
const e = t.slice(i.start, i.startTagEnd).replace(/^<\s*[^\s>/]+/, `<${n}`), a = t.slice(i.contentEnd, i.end).replace(/^<\/\s*[^\s>]+/, `</${n}`);
|
|
6243
6297
|
return t.slice(0, i.start) + e + t.slice(i.startTagEnd, i.contentEnd) + a + t.slice(i.end);
|
|
6244
6298
|
}
|
|
6245
|
-
function
|
|
6299
|
+
function cs(t, r) {
|
|
6246
6300
|
const n = new Map(t.divisions.map((a) => [a.xmlId, a])), i = t.divisions.find((a) => a.isRoot);
|
|
6247
6301
|
if (!i)
|
|
6248
6302
|
throw new Error("Division pool has no root division.");
|
|
@@ -6250,7 +6304,7 @@ function es(t, r) {
|
|
|
6250
6304
|
{
|
|
6251
6305
|
...i,
|
|
6252
6306
|
type: r.targetTag,
|
|
6253
|
-
content:
|
|
6307
|
+
content: os(
|
|
6254
6308
|
i.content,
|
|
6255
6309
|
i.type,
|
|
6256
6310
|
r.targetTag
|
|
@@ -6259,50 +6313,50 @@ function es(t, r) {
|
|
|
6259
6313
|
];
|
|
6260
6314
|
return { root: i, entries: e };
|
|
6261
6315
|
}
|
|
6262
|
-
function
|
|
6263
|
-
const { root: n, entries: i } =
|
|
6316
|
+
function ls(t, r) {
|
|
6317
|
+
const { root: n, entries: i } = cs(t, r), { placed: e, hrefByRef: a } = Vr(t, {
|
|
6264
6318
|
entries: i,
|
|
6265
6319
|
directory: r.hrefBase,
|
|
6266
6320
|
parentXmlId: n.xmlId
|
|
6267
6321
|
}), s = {}, o = {};
|
|
6268
6322
|
for (const { division: l, filePath: f } of e) {
|
|
6269
|
-
const p =
|
|
6270
|
-
s[f] =
|
|
6323
|
+
const p = Ne(l.content, a), g = p === l.content ? p : Le(p);
|
|
6324
|
+
s[f] = De(g), o[l.xmlId] = f;
|
|
6271
6325
|
}
|
|
6272
6326
|
const c = i.map((l) => a.get(l.xmlId)).filter((l) => l !== void 0).map((l) => `<xi:include href="${l}"/>`);
|
|
6273
6327
|
return { files: s, includes: c, pathByRef: o };
|
|
6274
6328
|
}
|
|
6275
|
-
function
|
|
6329
|
+
function Gr(t, r, n = {}) {
|
|
6276
6330
|
if (r.kind === "insert")
|
|
6277
|
-
return
|
|
6331
|
+
return ls(t, {
|
|
6278
6332
|
targetTag: r.targetTag,
|
|
6279
6333
|
hrefBase: r.hrefBase,
|
|
6280
6334
|
unwrapRoot: n.unwrapRoot ?? !1
|
|
6281
6335
|
});
|
|
6282
|
-
const { files: i, pathByRef: e } =
|
|
6336
|
+
const { files: i, pathByRef: e } = ss(t, n.layout);
|
|
6283
6337
|
return { files: i, includes: [], pathByRef: e };
|
|
6284
6338
|
}
|
|
6285
|
-
const
|
|
6286
|
-
function
|
|
6339
|
+
const us = { kind: "project" }, ds = ["ref", "first", "last"];
|
|
6340
|
+
function fs(t) {
|
|
6287
6341
|
let r = t.base, n = 2;
|
|
6288
6342
|
for (; t.isTaken(r) || r === ""; )
|
|
6289
6343
|
r = `${t.base || "id"}-${n}`, n += 1;
|
|
6290
6344
|
return r;
|
|
6291
6345
|
}
|
|
6292
|
-
function
|
|
6346
|
+
function hs(t) {
|
|
6293
6347
|
return t.split(/([\s,]+)/);
|
|
6294
6348
|
}
|
|
6295
|
-
function
|
|
6296
|
-
const n =
|
|
6349
|
+
function ps(t, r) {
|
|
6350
|
+
const n = Lr(t), i = new Set(r.takenIds), e = (c) => i.has(c), a = /* @__PURE__ */ new Map(), s = [];
|
|
6297
6351
|
for (const c of n) {
|
|
6298
6352
|
const l = c.attributes["xml:id"];
|
|
6299
6353
|
if (l === void 0 || a.has(l)) continue;
|
|
6300
|
-
const f =
|
|
6354
|
+
const f = Zt(l);
|
|
6301
6355
|
if (f === l && !i.has(l)) {
|
|
6302
6356
|
i.add(l);
|
|
6303
6357
|
continue;
|
|
6304
6358
|
}
|
|
6305
|
-
const p =
|
|
6359
|
+
const p = fs({
|
|
6306
6360
|
original: l,
|
|
6307
6361
|
base: f,
|
|
6308
6362
|
isTaken: e,
|
|
@@ -6320,10 +6374,10 @@ function os(t, r) {
|
|
|
6320
6374
|
/\bxml:id\s*=\s*(["'])[^"']*\1/,
|
|
6321
6375
|
(d, w) => `xml:id=${w}${g}${w}`
|
|
6322
6376
|
));
|
|
6323
|
-
for (const d of
|
|
6377
|
+
for (const d of ds) {
|
|
6324
6378
|
const w = c.attributes[d];
|
|
6325
6379
|
if (w === void 0) continue;
|
|
6326
|
-
const h =
|
|
6380
|
+
const h = hs(w).map((v) => a.get(v) ?? v).join("");
|
|
6327
6381
|
h !== w && (f = f.replace(
|
|
6328
6382
|
new RegExp(`\\b${d}\\s*=\\s*(["'])[^"']*\\1`),
|
|
6329
6383
|
(v, b) => `${d}=${b}${h}${b}`
|
|
@@ -6335,23 +6389,23 @@ function os(t, r) {
|
|
|
6335
6389
|
replacement: f
|
|
6336
6390
|
});
|
|
6337
6391
|
}
|
|
6338
|
-
return { source:
|
|
6392
|
+
return { source: Wt(t, o), renamed: s };
|
|
6339
6393
|
}
|
|
6340
|
-
function
|
|
6394
|
+
function gr(t) {
|
|
6341
6395
|
const r = t.indexOf(":");
|
|
6342
6396
|
return r < 0 ? { prefix: "", local: t } : {
|
|
6343
6397
|
prefix: t.slice(0, r + 1),
|
|
6344
6398
|
local: t.slice(r + 1)
|
|
6345
6399
|
};
|
|
6346
6400
|
}
|
|
6347
|
-
function
|
|
6348
|
-
return
|
|
6401
|
+
function Ro(t, r) {
|
|
6402
|
+
return Hr(t, Ut(r));
|
|
6349
6403
|
}
|
|
6350
|
-
function
|
|
6351
|
-
const n =
|
|
6404
|
+
function Hr(t, r) {
|
|
6405
|
+
const n = Lr(t);
|
|
6352
6406
|
let i = -1;
|
|
6353
6407
|
for (const l of n) {
|
|
6354
|
-
const f = Ut(
|
|
6408
|
+
const f = Ut(gr(l.name).local);
|
|
6355
6409
|
f >= 0 && (i < 0 || f < i) && (i = f);
|
|
6356
6410
|
}
|
|
6357
6411
|
if (i < 0 || r < 0)
|
|
@@ -6361,37 +6415,37 @@ function Vr(t, r) {
|
|
|
6361
6415
|
return { source: t, delta: 0, topTag: a, overflowed: [] };
|
|
6362
6416
|
const s = /* @__PURE__ */ new Set(), o = [];
|
|
6363
6417
|
for (const l of n) {
|
|
6364
|
-
const { prefix: f, local: p } =
|
|
6418
|
+
const { prefix: f, local: p } = gr(l.name), g = Ut(p);
|
|
6365
6419
|
if (g < 0) continue;
|
|
6366
|
-
const d =
|
|
6420
|
+
const d = Va(p, e);
|
|
6367
6421
|
if (d === p) continue;
|
|
6368
|
-
d ===
|
|
6422
|
+
d === zr && s.add(g);
|
|
6369
6423
|
const w = t.slice(l.start, l.end), h = l.kind === "close" ? w.replace(/^<\/\s*[^\s>/]+/, `</${f}${d}`) : w.replace(/^<\s*[^\s>/]+/, `<${f}${d}`);
|
|
6370
6424
|
o.push({ start: l.start, end: l.end, replacement: h });
|
|
6371
6425
|
}
|
|
6372
6426
|
const c = [...s].sort((l, f) => l - f).map((l) => Nt[l]);
|
|
6373
6427
|
return {
|
|
6374
|
-
source:
|
|
6428
|
+
source: Wt(t, o),
|
|
6375
6429
|
delta: e,
|
|
6376
6430
|
topTag: a,
|
|
6377
6431
|
overflowed: c
|
|
6378
6432
|
};
|
|
6379
6433
|
}
|
|
6380
|
-
function
|
|
6381
|
-
if (
|
|
6434
|
+
function ms(t) {
|
|
6435
|
+
if (ft(t, "title"))
|
|
6382
6436
|
return !1;
|
|
6383
|
-
const r =
|
|
6384
|
-
return r.length === 0 || !r.every((n) =>
|
|
6437
|
+
const r = Et(t, () => !0);
|
|
6438
|
+
return r.length === 0 || !r.every((n) => zt(n.name)) ? !1 : !Yr(t);
|
|
6385
6439
|
}
|
|
6386
|
-
function
|
|
6387
|
-
const r =
|
|
6440
|
+
function Yr(t) {
|
|
6441
|
+
const r = Et(t, zt);
|
|
6388
6442
|
let n = "", i = 0;
|
|
6389
6443
|
for (const e of r)
|
|
6390
6444
|
n += t.slice(i, e.start), i = e.end;
|
|
6391
6445
|
return n += t.slice(i), n.replace(/<!--[\s\S]*?-->/g, "").trim() !== "";
|
|
6392
6446
|
}
|
|
6393
|
-
function
|
|
6394
|
-
const r =
|
|
6447
|
+
function gs(t) {
|
|
6448
|
+
const r = ft(t, "pretext"), n = r ? r.inner : t, i = r ? r.startTagEnd : 0, e = fe(n);
|
|
6395
6449
|
return e ? {
|
|
6396
6450
|
...e,
|
|
6397
6451
|
start: e.start + i,
|
|
@@ -6400,11 +6454,11 @@ function ls(t) {
|
|
|
6400
6454
|
end: e.end + i
|
|
6401
6455
|
} : null;
|
|
6402
6456
|
}
|
|
6403
|
-
function
|
|
6404
|
-
const r =
|
|
6457
|
+
function bs(t) {
|
|
6458
|
+
const r = ft(t, "title");
|
|
6405
6459
|
return r ? r.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() : "";
|
|
6406
6460
|
}
|
|
6407
|
-
function
|
|
6461
|
+
function vs(t, r, n) {
|
|
6408
6462
|
const i = new Set(n), e = [];
|
|
6409
6463
|
for (const a of r) {
|
|
6410
6464
|
const s = a.attributes["xml:id"];
|
|
@@ -6412,7 +6466,7 @@ function ds(t, r, n) {
|
|
|
6412
6466
|
i.add(s);
|
|
6413
6467
|
continue;
|
|
6414
6468
|
}
|
|
6415
|
-
const o =
|
|
6469
|
+
const o = Zt(Ze(bs(a.inner))) || "imported";
|
|
6416
6470
|
let c = o, l = 2;
|
|
6417
6471
|
for (; i.has(c); )
|
|
6418
6472
|
c = `${o}-${l}`, l += 1;
|
|
@@ -6422,10 +6476,10 @@ function ds(t, r, n) {
|
|
|
6422
6476
|
replacement: t.slice(a.start, a.startTagEnd).replace(/^<([a-zA-Z_:][\w:.-]*)/, `<$1 xml:id="${c}"`)
|
|
6423
6477
|
});
|
|
6424
6478
|
}
|
|
6425
|
-
return e.length === 0 ? t :
|
|
6479
|
+
return e.length === 0 ? t : Wt(t, e);
|
|
6426
6480
|
}
|
|
6427
|
-
function
|
|
6428
|
-
return r ?
|
|
6481
|
+
function ws(t, r) {
|
|
6482
|
+
return r ? Et(t.inner, zt).map(
|
|
6429
6483
|
(n) => ({
|
|
6430
6484
|
...n,
|
|
6431
6485
|
start: n.start + t.startTagEnd,
|
|
@@ -6435,12 +6489,12 @@ function fs(t, r) {
|
|
|
6435
6489
|
})
|
|
6436
6490
|
) : [t];
|
|
6437
6491
|
}
|
|
6438
|
-
function
|
|
6492
|
+
function Jr(t) {
|
|
6439
6493
|
return t ? 1 : 0;
|
|
6440
6494
|
}
|
|
6441
|
-
function
|
|
6442
|
-
const i = [], e =
|
|
6443
|
-
o && !s && a !== null &&
|
|
6495
|
+
function Kr(t, r, n = {}) {
|
|
6496
|
+
const i = [], e = gs(t), a = e?.inner ?? null, s = a !== null && ms(a), o = a !== null && (n.hasSelection || s);
|
|
6497
|
+
o && !s && a !== null && Yr(a) && i.push({
|
|
6444
6498
|
action: "delete",
|
|
6445
6499
|
severity: "warning",
|
|
6446
6500
|
kind: "structure",
|
|
@@ -6449,14 +6503,14 @@ function Yr(t, r, n = {}) {
|
|
|
6449
6503
|
occurrences: 1,
|
|
6450
6504
|
message: "The selected divisions are inserted on their own, so the document's title and any text outside them are not carried across."
|
|
6451
6505
|
});
|
|
6452
|
-
const c = e ?
|
|
6506
|
+
const c = e ? vs(
|
|
6453
6507
|
t,
|
|
6454
|
-
|
|
6508
|
+
ws(e, o),
|
|
6455
6509
|
r.takenIds
|
|
6456
|
-
) : t, l = Ut(r.targetTag), f =
|
|
6510
|
+
) : t, l = Ut(r.targetTag), f = Hr(
|
|
6457
6511
|
c,
|
|
6458
6512
|
l < 0 ? -1 : o ? l : l + 1
|
|
6459
|
-
), { source: p, renamed: g } =
|
|
6513
|
+
), { source: p, renamed: g } = ps(f.source, {
|
|
6460
6514
|
takenIds: r.takenIds
|
|
6461
6515
|
});
|
|
6462
6516
|
return f.overflowed.length > 0 && i.push({
|
|
@@ -6475,7 +6529,7 @@ function Yr(t, r, n = {}) {
|
|
|
6475
6529
|
macro: "xml:id",
|
|
6476
6530
|
occurrences: g.length,
|
|
6477
6531
|
message: `${g.length} imported id${g.length === 1 ? "" : "s"} already existed in this project and ${g.length === 1 ? "was" : "were"} renamed: ${g.map((d) => `\`${d.from}\` → \`${d.to}\``).join(", ")}.`
|
|
6478
|
-
}), !o && a !== null && !
|
|
6532
|
+
}), !o && a !== null && !ft(a, "title") && i.push({
|
|
6479
6533
|
action: "anomaly",
|
|
6480
6534
|
severity: "warning",
|
|
6481
6535
|
kind: "structure",
|
|
@@ -6485,78 +6539,78 @@ function Yr(t, r, n = {}) {
|
|
|
6485
6539
|
message: `The imported document has no title, so the <${r.targetTag}> it becomes has none either. PreTeXt divisions need a title; add one before building.`
|
|
6486
6540
|
}), { source: p, unwrapRoot: o, retarget: f, renamed: g, warnings: i };
|
|
6487
6541
|
}
|
|
6488
|
-
const
|
|
6489
|
-
function
|
|
6490
|
-
const n =
|
|
6542
|
+
const _s = "source", ys = "publication", br = "main.ptx";
|
|
6543
|
+
function Pt(t, r) {
|
|
6544
|
+
const n = ft(t.inner, r);
|
|
6491
6545
|
if (!n)
|
|
6492
6546
|
return;
|
|
6493
6547
|
const i = n.inner.trim();
|
|
6494
6548
|
return i.length > 0 ? i : void 0;
|
|
6495
6549
|
}
|
|
6496
|
-
function
|
|
6497
|
-
const i =
|
|
6550
|
+
function be(t, r, n) {
|
|
6551
|
+
const i = Pt(t, r);
|
|
6498
6552
|
if (i !== void 0)
|
|
6499
6553
|
return mt(i);
|
|
6500
6554
|
const e = t.attributes[r];
|
|
6501
6555
|
if (e !== void 0 && e.trim().length > 0)
|
|
6502
6556
|
return kt(n, e.trim());
|
|
6503
6557
|
}
|
|
6504
|
-
function
|
|
6505
|
-
const n =
|
|
6558
|
+
function xs(t, r) {
|
|
6559
|
+
const n = ft(t, "project");
|
|
6506
6560
|
if (!n)
|
|
6507
6561
|
return null;
|
|
6508
|
-
const i =
|
|
6562
|
+
const i = Ke(mt(r)), e = n.attributes.source?.trim() || _s, a = n.attributes.publication?.trim() || ys, s = n.attributes.output?.trim() || "output", o = {
|
|
6509
6563
|
manifestPath: mt(r),
|
|
6510
6564
|
projectRoot: i,
|
|
6511
6565
|
ptxVersion: n.attributes["ptx-version"],
|
|
6512
6566
|
sourceDir: e,
|
|
6513
6567
|
publicationDir: a,
|
|
6514
6568
|
targets: []
|
|
6515
|
-
}, c =
|
|
6569
|
+
}, c = ft(n.inner, "targets"), l = c ? $r(c.inner, "target") : [];
|
|
6516
6570
|
for (const f of l)
|
|
6517
6571
|
o.targets.push({
|
|
6518
6572
|
name: f.attributes.name ?? "",
|
|
6519
6573
|
// v2 manifests carry the format as an attribute; legacy v1 manifests
|
|
6520
6574
|
// use a `<format>` child element.
|
|
6521
|
-
format: f.attributes.format ??
|
|
6522
|
-
source:
|
|
6523
|
-
publication:
|
|
6524
|
-
outputDir:
|
|
6575
|
+
format: f.attributes.format ?? Pt(f, "format") ?? "",
|
|
6576
|
+
source: be(f, "source", e) ?? kt(e, br),
|
|
6577
|
+
publication: be(f, "publication", a),
|
|
6578
|
+
outputDir: be(f, "output-dir", s),
|
|
6525
6579
|
standalone: f.attributes.standalone !== void 0 && f.attributes.standalone !== "no"
|
|
6526
6580
|
});
|
|
6527
6581
|
if (o.targets.length === 0) {
|
|
6528
|
-
const f =
|
|
6582
|
+
const f = Pt(n, "source");
|
|
6529
6583
|
o.targets.push({
|
|
6530
6584
|
name: "default",
|
|
6531
|
-
format:
|
|
6532
|
-
source: f ? mt(f) : kt(e,
|
|
6533
|
-
publication:
|
|
6585
|
+
format: Pt(n, "format") ?? "",
|
|
6586
|
+
source: f ? mt(f) : kt(e, br),
|
|
6587
|
+
publication: Pt(n, "publication"),
|
|
6534
6588
|
standalone: !1
|
|
6535
6589
|
});
|
|
6536
6590
|
}
|
|
6537
6591
|
return o;
|
|
6538
6592
|
}
|
|
6539
|
-
function
|
|
6593
|
+
function ks(t) {
|
|
6540
6594
|
const r = Object.keys(t).filter((n) => yt(n).toLowerCase() === "project.ptx").sort((n, i) => {
|
|
6541
6595
|
const e = n.split("/").length - i.split("/").length;
|
|
6542
6596
|
return e !== 0 ? e : n.localeCompare(i);
|
|
6543
6597
|
});
|
|
6544
6598
|
for (const n of r) {
|
|
6545
|
-
const i =
|
|
6599
|
+
const i = xs(t[n], n);
|
|
6546
6600
|
if (i)
|
|
6547
6601
|
return i;
|
|
6548
6602
|
}
|
|
6549
6603
|
return null;
|
|
6550
6604
|
}
|
|
6551
|
-
function
|
|
6605
|
+
function Ss(t) {
|
|
6552
6606
|
return t.targets.find((r) => !r.standalone) ?? t.targets[0];
|
|
6553
6607
|
}
|
|
6554
|
-
const
|
|
6608
|
+
const Es = /* @__PURE__ */ new Set(["md", "markdown"]), As = /* @__PURE__ */ new Set(["ptx", "xml"]), Is = /* @__PURE__ */ new Set([
|
|
6555
6609
|
"readme",
|
|
6556
6610
|
"changelog",
|
|
6557
6611
|
"contributing",
|
|
6558
6612
|
"license"
|
|
6559
|
-
]),
|
|
6613
|
+
]), vr = [
|
|
6560
6614
|
"main",
|
|
6561
6615
|
"book",
|
|
6562
6616
|
"index",
|
|
@@ -6567,53 +6621,53 @@ const vs = /* @__PURE__ */ new Set(["md", "markdown"]), ws = /* @__PURE__ */ new
|
|
|
6567
6621
|
"article",
|
|
6568
6622
|
"paper"
|
|
6569
6623
|
];
|
|
6570
|
-
function
|
|
6624
|
+
function nn(t, r) {
|
|
6571
6625
|
return Object.fromEntries(
|
|
6572
6626
|
Object.entries(t).filter(([n]) => r.has(St(n)))
|
|
6573
6627
|
);
|
|
6574
6628
|
}
|
|
6575
|
-
function
|
|
6576
|
-
const r =
|
|
6577
|
-
return
|
|
6629
|
+
function Qr(t) {
|
|
6630
|
+
const r = ft(t, "pretext") ?? ft(t, "book") ?? ft(t, "article"), n = r ? r.inner : t;
|
|
6631
|
+
return ft(n, "title")?.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() || void 0;
|
|
6578
6632
|
}
|
|
6579
|
-
function
|
|
6633
|
+
function Ts(t) {
|
|
6580
6634
|
const r = /^#\s+(.+)$/m.exec(t);
|
|
6581
6635
|
return r ? r[1].trim() : void 0;
|
|
6582
6636
|
}
|
|
6583
|
-
function
|
|
6637
|
+
function wr(t) {
|
|
6584
6638
|
return ae(t, "title") || void 0;
|
|
6585
6639
|
}
|
|
6586
|
-
function
|
|
6640
|
+
function Rs(t) {
|
|
6587
6641
|
return /\\documentclass\b/.test(t) || /\\begin *\{document\}/.test(t);
|
|
6588
6642
|
}
|
|
6589
|
-
const
|
|
6590
|
-
function
|
|
6591
|
-
const n =
|
|
6643
|
+
const Cs = /<(pretext|book|article)\b/;
|
|
6644
|
+
function Os(t, r) {
|
|
6645
|
+
const n = Ss(t), i = n ? [n, ...t.targets.filter((s) => s !== n)] : t.targets, e = /* @__PURE__ */ new Set(), a = [];
|
|
6592
6646
|
for (const s of i) {
|
|
6593
6647
|
const o = kt(t.projectRoot, s.source);
|
|
6594
6648
|
e.has(o) || !(o in r) || (e.add(o), a.push({
|
|
6595
6649
|
path: o,
|
|
6596
6650
|
format: "pretext",
|
|
6597
6651
|
reason: "manifest-target",
|
|
6598
|
-
title:
|
|
6652
|
+
title: Qr(r[o]),
|
|
6599
6653
|
targetName: s.name,
|
|
6600
6654
|
targetFormat: s.format
|
|
6601
6655
|
}));
|
|
6602
6656
|
}
|
|
6603
6657
|
return a;
|
|
6604
6658
|
}
|
|
6605
|
-
function
|
|
6606
|
-
const r =
|
|
6659
|
+
function zs(t) {
|
|
6660
|
+
const r = nn(t, /* @__PURE__ */ new Set(["tex", "ltx"])), n = Ya(r), i = Object.keys(r).filter((c) => !n.has(c) && Rs(r[c])).sort(), e = (c) => {
|
|
6607
6661
|
let l = 0;
|
|
6608
6662
|
const f = r[c].match(/\\(input|include) *\{[^{}]+\}/g) ?? [];
|
|
6609
6663
|
for (const p of f) {
|
|
6610
6664
|
const g = /\{([^{}]+)\}/.exec(p)?.[1];
|
|
6611
|
-
g &&
|
|
6665
|
+
g && Qe(g, c, r) && (l += 1);
|
|
6612
6666
|
}
|
|
6613
6667
|
return l;
|
|
6614
6668
|
}, a = (c) => {
|
|
6615
|
-
const l =
|
|
6616
|
-
return l >= 0 ? l :
|
|
6669
|
+
const l = vr.indexOf(se(c).toLowerCase());
|
|
6670
|
+
return l >= 0 ? l : vr.length;
|
|
6617
6671
|
}, o = [...i].sort((c, l) => {
|
|
6618
6672
|
const f = +!/\\documentclass\b/.test(r[c]) - +!/\\documentclass\b/.test(r[l]);
|
|
6619
6673
|
if (f !== 0) return f;
|
|
@@ -6625,41 +6679,41 @@ function Es(t) {
|
|
|
6625
6679
|
path: c,
|
|
6626
6680
|
format: "latex",
|
|
6627
6681
|
reason: "latex-root",
|
|
6628
|
-
title:
|
|
6682
|
+
title: wr(r[c])
|
|
6629
6683
|
}));
|
|
6630
6684
|
return o.length > 0 ? o : Object.keys(r).sort().map((c) => ({
|
|
6631
6685
|
path: c,
|
|
6632
6686
|
format: "latex",
|
|
6633
6687
|
reason: "fallback",
|
|
6634
|
-
title:
|
|
6688
|
+
title: wr(r[c])
|
|
6635
6689
|
}));
|
|
6636
6690
|
}
|
|
6637
|
-
function
|
|
6638
|
-
const r =
|
|
6691
|
+
function $s(t) {
|
|
6692
|
+
const r = nn(t, Es), n = Object.keys(r).sort(), i = (s) => Is.has(se(s).toLowerCase()), e = ["main", "index", "book", "article"], a = (s) => i(s) ? 2 : e.indexOf(se(s).toLowerCase()) >= 0 ? 0 : 1;
|
|
6639
6693
|
return [...n].sort((s, o) => a(s) - a(o) || s.localeCompare(o)).map((s) => ({
|
|
6640
6694
|
path: s,
|
|
6641
6695
|
format: "markdown",
|
|
6642
6696
|
reason: "markdown-root",
|
|
6643
|
-
title:
|
|
6697
|
+
title: Ts(r[s])
|
|
6644
6698
|
}));
|
|
6645
6699
|
}
|
|
6646
|
-
function
|
|
6647
|
-
const r =
|
|
6700
|
+
function Ls(t) {
|
|
6701
|
+
const r = nn(t, As), n = Qa(r);
|
|
6648
6702
|
return Object.keys(r).filter(
|
|
6649
|
-
(e) => !n.has(e) &&
|
|
6703
|
+
(e) => !n.has(e) && Cs.test(r[e]) && yt(e).toLowerCase() !== "project.ptx" && yt(e).toLowerCase() !== "publication.ptx"
|
|
6650
6704
|
).sort().map((e) => ({
|
|
6651
6705
|
path: e,
|
|
6652
6706
|
format: "pretext",
|
|
6653
6707
|
reason: "pretext-root",
|
|
6654
|
-
title:
|
|
6708
|
+
title: Qr(r[e])
|
|
6655
6709
|
}));
|
|
6656
6710
|
}
|
|
6657
|
-
function
|
|
6658
|
-
const n =
|
|
6659
|
-
...n ?
|
|
6660
|
-
...
|
|
6661
|
-
|
|
6662
|
-
...
|
|
6711
|
+
function Ds(t, r = {}) {
|
|
6712
|
+
const n = ks(t), i = [
|
|
6713
|
+
...n ? Os(n, t) : [],
|
|
6714
|
+
...zs(t),
|
|
6715
|
+
...$s(t),
|
|
6716
|
+
...Ls(t)
|
|
6663
6717
|
], e = [], a = /* @__PURE__ */ new Set();
|
|
6664
6718
|
for (const p of i)
|
|
6665
6719
|
a.has(p.path) || (a.add(p.path), e.push(p));
|
|
@@ -6671,7 +6725,7 @@ function Ts(t, r = {}) {
|
|
|
6671
6725
|
const p = r.mainFile;
|
|
6672
6726
|
c = s.find((g) => g.path === p) ?? e.find((g) => g.path === p) ?? (p in t ? {
|
|
6673
6727
|
path: p,
|
|
6674
|
-
format: r.sourceFormat ??
|
|
6728
|
+
format: r.sourceFormat ?? ve(t[p]),
|
|
6675
6729
|
reason: "fallback"
|
|
6676
6730
|
} : c);
|
|
6677
6731
|
}
|
|
@@ -6679,7 +6733,7 @@ function Ts(t, r = {}) {
|
|
|
6679
6733
|
const p = Object.keys(t).sort()[0];
|
|
6680
6734
|
c = p ? {
|
|
6681
6735
|
path: p,
|
|
6682
|
-
format: r.sourceFormat ??
|
|
6736
|
+
format: r.sourceFormat ?? ve(t[p]),
|
|
6683
6737
|
reason: "fallback"
|
|
6684
6738
|
} : null;
|
|
6685
6739
|
}
|
|
@@ -6688,11 +6742,11 @@ function Ts(t, r = {}) {
|
|
|
6688
6742
|
) : [];
|
|
6689
6743
|
return { manifest: n, candidates: s, formats: o, primary: c, extraRoots: f };
|
|
6690
6744
|
}
|
|
6691
|
-
const
|
|
6692
|
-
function
|
|
6745
|
+
const _r = "\\begin{document}", Ps = "\\end{document}", js = /\\documentclass\s*(?:\[[^\]]*\])?\s*\{(book|report|memoir|scrbook|scrreprt|amsbook)\}/;
|
|
6746
|
+
function ti(t) {
|
|
6693
6747
|
return se(t).replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (r) => r.toUpperCase()) || "Untitled";
|
|
6694
6748
|
}
|
|
6695
|
-
function
|
|
6749
|
+
function Ue(t, r) {
|
|
6696
6750
|
return {
|
|
6697
6751
|
action: "anomaly",
|
|
6698
6752
|
severity: "info",
|
|
@@ -6703,19 +6757,19 @@ function Be(t, r) {
|
|
|
6703
6757
|
message: r
|
|
6704
6758
|
};
|
|
6705
6759
|
}
|
|
6706
|
-
function
|
|
6707
|
-
const { preamble: r, body: n } =
|
|
6708
|
-
return
|
|
6760
|
+
function Fs(t) {
|
|
6761
|
+
const { preamble: r, body: n } = Bt(t);
|
|
6762
|
+
return js.test(r) || /\\chapter\b/.test(n) ? "chapter" : "section";
|
|
6709
6763
|
}
|
|
6710
|
-
function
|
|
6764
|
+
function qs(t, r) {
|
|
6711
6765
|
const n = t.replace(/^\s*(%[^\n]*\n\s*)*/, "");
|
|
6712
6766
|
return r === "chapter" ? /^\\(chapter|part)\b/.test(n) : /^\\(section|chapter|part)\b/.test(n);
|
|
6713
6767
|
}
|
|
6714
|
-
function
|
|
6768
|
+
function Bs(t, r, n) {
|
|
6715
6769
|
const i = r.filter((w) => w.include !== !1);
|
|
6716
6770
|
if (i.length === 0)
|
|
6717
6771
|
return { source: t, attached: [], warnings: [] };
|
|
6718
|
-
const e = t.includes(
|
|
6772
|
+
const e = t.includes(_r), { preamble: a, body: s } = Bt(t), o = Fs(t), c = [], l = [], f = [], p = [];
|
|
6719
6773
|
for (const w of i) {
|
|
6720
6774
|
const h = n[w.path];
|
|
6721
6775
|
if (h === void 0) {
|
|
@@ -6730,25 +6784,25 @@ function $s(t, r, n) {
|
|
|
6730
6784
|
});
|
|
6731
6785
|
continue;
|
|
6732
6786
|
}
|
|
6733
|
-
const v = w.level ?? o, b = w.title || ae(h, "title") ||
|
|
6787
|
+
const v = w.level ?? o, b = w.title || ae(h, "title") || ti(w.path), x = {
|
|
6734
6788
|
path: w.path,
|
|
6735
6789
|
title: b,
|
|
6736
6790
|
level: v
|
|
6737
|
-
}, S =
|
|
6791
|
+
}, S = Bt(h), { macros: I, warnings: A } = Cr(S.preamble);
|
|
6738
6792
|
I && f.push(I), l.push(...A);
|
|
6739
6793
|
const P = S.body.trim();
|
|
6740
6794
|
if (!P) {
|
|
6741
6795
|
l.push(
|
|
6742
|
-
|
|
6796
|
+
Ue(x, `\`${w.path}\` is empty; skipped.`)
|
|
6743
6797
|
);
|
|
6744
6798
|
continue;
|
|
6745
6799
|
}
|
|
6746
6800
|
p.push(
|
|
6747
|
-
|
|
6801
|
+
qs(P, v) ? P : `\\${v}{${b}}
|
|
6748
6802
|
|
|
6749
6803
|
${P}`
|
|
6750
6804
|
), c.push(x), l.push(
|
|
6751
|
-
|
|
6805
|
+
Ue(
|
|
6752
6806
|
x,
|
|
6753
6807
|
`Attached \`${w.path}\` as a ${v}: “${b}”.`
|
|
6754
6808
|
)
|
|
@@ -6762,9 +6816,9 @@ ${P}`
|
|
|
6762
6816
|
return e ? { source: [
|
|
6763
6817
|
[a, ...f].filter(Boolean).join(`
|
|
6764
6818
|
`),
|
|
6765
|
-
|
|
6819
|
+
_r,
|
|
6766
6820
|
g,
|
|
6767
|
-
|
|
6821
|
+
Ps
|
|
6768
6822
|
].join(`
|
|
6769
6823
|
`), attached: c, warnings: l } : {
|
|
6770
6824
|
source: [a, ...f, g].filter(Boolean).join(`
|
|
@@ -6774,7 +6828,7 @@ ${P}`
|
|
|
6774
6828
|
warnings: l
|
|
6775
6829
|
};
|
|
6776
6830
|
}
|
|
6777
|
-
function
|
|
6831
|
+
function Ns(t, r, n) {
|
|
6778
6832
|
const i = r.filter((o) => o.include !== !1), e = [], a = [], s = [];
|
|
6779
6833
|
for (const o of i) {
|
|
6780
6834
|
const c = n[o.path];
|
|
@@ -6793,7 +6847,7 @@ function Ls(t, r, n) {
|
|
|
6793
6847
|
const l = c.trim();
|
|
6794
6848
|
if (!l)
|
|
6795
6849
|
continue;
|
|
6796
|
-
const f = /^#\s+(.+)$/m.exec(l), p = o.title || f?.[1]?.trim() ||
|
|
6850
|
+
const f = /^#\s+(.+)$/m.exec(l), p = o.title || f?.[1]?.trim() || ti(o.path), g = {
|
|
6797
6851
|
path: o.path,
|
|
6798
6852
|
title: p,
|
|
6799
6853
|
level: o.level ?? "chapter"
|
|
@@ -6801,7 +6855,7 @@ function Ls(t, r, n) {
|
|
|
6801
6855
|
s.push(l.startsWith("# ") ? l : `# ${p}
|
|
6802
6856
|
|
|
6803
6857
|
${l}`), e.push(g), a.push(
|
|
6804
|
-
|
|
6858
|
+
Ue(g, `Attached \`${o.path}\`: “${p}”.`)
|
|
6805
6859
|
);
|
|
6806
6860
|
}
|
|
6807
6861
|
return s.length === 0 ? { source: t, attached: e, warnings: a } : {
|
|
@@ -6812,7 +6866,7 @@ ${l}`), e.push(g), a.push(
|
|
|
6812
6866
|
warnings: a
|
|
6813
6867
|
};
|
|
6814
6868
|
}
|
|
6815
|
-
const
|
|
6869
|
+
const Us = [
|
|
6816
6870
|
"output",
|
|
6817
6871
|
".git",
|
|
6818
6872
|
".github/workflows/.cache",
|
|
@@ -6822,13 +6876,13 @@ const Ds = [
|
|
|
6822
6876
|
".venv",
|
|
6823
6877
|
"__MACOSX"
|
|
6824
6878
|
];
|
|
6825
|
-
function
|
|
6879
|
+
function Ms(t, r) {
|
|
6826
6880
|
const n = t.toLowerCase();
|
|
6827
|
-
return [...
|
|
6881
|
+
return [...Us, ...r].some(
|
|
6828
6882
|
(i) => i.length > 0 && n.startsWith(`${i.toLowerCase()}/`)
|
|
6829
6883
|
);
|
|
6830
6884
|
}
|
|
6831
|
-
function
|
|
6885
|
+
function Ws(t) {
|
|
6832
6886
|
const { manifest: r, files: n, assets: i } = t, e = r.projectRoot, a = new Set(t.consumedPaths), s = [
|
|
6833
6887
|
...new Set(
|
|
6834
6888
|
r.targets.map((l) => l.outputDir?.split("/")[0]).filter((l) => !!l)
|
|
@@ -6836,9 +6890,9 @@ function js(t) {
|
|
|
6836
6890
|
], o = { files: {}, assets: {}, skipped: [] }, c = (l, f) => {
|
|
6837
6891
|
if (e && !l.startsWith(`${e}/`))
|
|
6838
6892
|
return;
|
|
6839
|
-
const p =
|
|
6893
|
+
const p = Ha(e, l);
|
|
6840
6894
|
if (!(a.has(l) || l === r.manifestPath)) {
|
|
6841
|
-
if (
|
|
6895
|
+
if (Ms(p, s)) {
|
|
6842
6896
|
o.skipped.push(p);
|
|
6843
6897
|
return;
|
|
6844
6898
|
}
|
|
@@ -6855,7 +6909,7 @@ function js(t) {
|
|
|
6855
6909
|
});
|
|
6856
6910
|
return o;
|
|
6857
6911
|
}
|
|
6858
|
-
function
|
|
6912
|
+
function Zs(t, r, n) {
|
|
6859
6913
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
6860
6914
|
<project ptx-version="2">
|
|
6861
6915
|
<targets>
|
|
@@ -6876,12 +6930,12 @@ ${t.targets.map((e) => {
|
|
|
6876
6930
|
</project>
|
|
6877
6931
|
`;
|
|
6878
6932
|
}
|
|
6879
|
-
const
|
|
6880
|
-
function
|
|
6933
|
+
const ei = "external";
|
|
6934
|
+
function Xs(t, r, n) {
|
|
6881
6935
|
const i = r.replace(/\/+$/, "");
|
|
6882
6936
|
return i ? `${t}${i}/${n}` : `${t}${n}`;
|
|
6883
6937
|
}
|
|
6884
|
-
function
|
|
6938
|
+
function Vs(t, r, n = ei) {
|
|
6885
6939
|
const i = {}, e = {}, a = /* @__PURE__ */ new Set();
|
|
6886
6940
|
for (const s of t) {
|
|
6887
6941
|
const o = yt(s);
|
|
@@ -6893,18 +6947,18 @@ function Bs(t, r, n = Qr) {
|
|
|
6893
6947
|
g += 1;
|
|
6894
6948
|
c = `${f}-${g}${p}`;
|
|
6895
6949
|
}
|
|
6896
|
-
a.add(c), i[s] =
|
|
6950
|
+
a.add(c), i[s] = Xs(r, n, c), o in e || (e[o] = c);
|
|
6897
6951
|
}
|
|
6898
6952
|
return { pathByOriginal: i, sourceByBaseName: e };
|
|
6899
6953
|
}
|
|
6900
|
-
const
|
|
6901
|
-
`(<(?:${
|
|
6954
|
+
const Gs = ["image", "video", "audio"], Hs = new RegExp(
|
|
6955
|
+
`(<(?:${Gs.join("|")})\\b[^>]*?\\bsource\\s*=\\s*)(["'])([^"']*)\\2`,
|
|
6902
6956
|
"g"
|
|
6903
6957
|
);
|
|
6904
|
-
function
|
|
6958
|
+
function Ys(t, r) {
|
|
6905
6959
|
const n = [], i = [];
|
|
6906
6960
|
return { source: t.replace(
|
|
6907
|
-
|
|
6961
|
+
Hs,
|
|
6908
6962
|
(a, s, o, c) => {
|
|
6909
6963
|
if (c === "" || /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(c))
|
|
6910
6964
|
return a;
|
|
@@ -6913,28 +6967,28 @@ function Ms(t, r) {
|
|
|
6913
6967
|
}
|
|
6914
6968
|
), rewritten: n, unresolved: i };
|
|
6915
6969
|
}
|
|
6916
|
-
function
|
|
6917
|
-
const r =
|
|
6970
|
+
function Js(t) {
|
|
6971
|
+
const r = ft(t, "pretext"), n = r ? r.inner : t, i = fe(n);
|
|
6918
6972
|
return i ? i.inner : n;
|
|
6919
6973
|
}
|
|
6920
|
-
function
|
|
6974
|
+
function Co(t) {
|
|
6921
6975
|
function r(n, i) {
|
|
6922
|
-
return
|
|
6976
|
+
return Et(n, zt).map(
|
|
6923
6977
|
(e, a) => {
|
|
6924
6978
|
const s = i ? `${i}.${a}` : String(a);
|
|
6925
6979
|
return {
|
|
6926
6980
|
path: s,
|
|
6927
6981
|
tag: e.name,
|
|
6928
|
-
title:
|
|
6982
|
+
title: Je(e.inner),
|
|
6929
6983
|
xmlId: e.attributes["xml:id"],
|
|
6930
6984
|
children: r(e.inner, s)
|
|
6931
6985
|
};
|
|
6932
6986
|
}
|
|
6933
6987
|
);
|
|
6934
6988
|
}
|
|
6935
|
-
return r(
|
|
6989
|
+
return r(Js(t), "");
|
|
6936
6990
|
}
|
|
6937
|
-
function
|
|
6991
|
+
function Ks(t, r) {
|
|
6938
6992
|
if (r.has(t))
|
|
6939
6993
|
return !0;
|
|
6940
6994
|
for (const n of r)
|
|
@@ -6942,16 +6996,16 @@ function Zs(t, r) {
|
|
|
6942
6996
|
return !0;
|
|
6943
6997
|
return !1;
|
|
6944
6998
|
}
|
|
6945
|
-
function
|
|
6999
|
+
function ni(t, r) {
|
|
6946
7000
|
if (!r || r.length === 0)
|
|
6947
7001
|
return { source: t, removed: [] };
|
|
6948
7002
|
const n = new Set(r), i = [];
|
|
6949
7003
|
function e(p, g, d) {
|
|
6950
7004
|
const w = [];
|
|
6951
|
-
return
|
|
7005
|
+
return Et(p, zt).forEach(
|
|
6952
7006
|
(h, v) => {
|
|
6953
7007
|
const b = g ? `${g}.${v}` : String(v);
|
|
6954
|
-
if (!
|
|
7008
|
+
if (!Ks(b, n)) {
|
|
6955
7009
|
i.push(b), w.push({
|
|
6956
7010
|
start: d + h.start,
|
|
6957
7011
|
end: d + h.end,
|
|
@@ -6965,13 +7019,13 @@ function ti(t, r) {
|
|
|
6965
7019
|
}
|
|
6966
7020
|
), w;
|
|
6967
7021
|
}
|
|
6968
|
-
const a =
|
|
7022
|
+
const a = ft(t, "pretext"), s = a ? a.inner : t, o = a ? a.startTagEnd : 0, c = fe(s), l = o + (c ? c.startTagEnd : 0), f = c ? c.inner : s;
|
|
6969
7023
|
return {
|
|
6970
|
-
source:
|
|
7024
|
+
source: Wt(t, e(f, "", l)),
|
|
6971
7025
|
removed: i
|
|
6972
7026
|
};
|
|
6973
7027
|
}
|
|
6974
|
-
const
|
|
7028
|
+
const Qs = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, to = [
|
|
6975
7029
|
"tex",
|
|
6976
7030
|
"md",
|
|
6977
7031
|
"markdown",
|
|
@@ -6985,7 +7039,7 @@ const Xs = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, Vs = [
|
|
|
6985
7039
|
"png",
|
|
6986
7040
|
"ps",
|
|
6987
7041
|
"bbl"
|
|
6988
|
-
],
|
|
7042
|
+
], eo = /* @__PURE__ */ new Set([
|
|
6989
7043
|
"png",
|
|
6990
7044
|
"jpg",
|
|
6991
7045
|
"jpeg",
|
|
@@ -6998,7 +7052,7 @@ const Xs = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, Vs = [
|
|
|
6998
7052
|
"tif",
|
|
6999
7053
|
"webp",
|
|
7000
7054
|
"ico"
|
|
7001
|
-
]),
|
|
7055
|
+
]), no = /* @__PURE__ */ new Set([
|
|
7002
7056
|
"png",
|
|
7003
7057
|
"jpg",
|
|
7004
7058
|
"jpeg",
|
|
@@ -7013,27 +7067,27 @@ const Xs = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, Vs = [
|
|
|
7013
7067
|
"eps",
|
|
7014
7068
|
"ps"
|
|
7015
7069
|
]);
|
|
7016
|
-
function
|
|
7017
|
-
return
|
|
7070
|
+
function ri(t) {
|
|
7071
|
+
return eo.has(t.toLowerCase());
|
|
7018
7072
|
}
|
|
7019
|
-
function
|
|
7020
|
-
return
|
|
7073
|
+
function ro(t) {
|
|
7074
|
+
return no.has(St(yt(t)));
|
|
7021
7075
|
}
|
|
7022
|
-
function
|
|
7076
|
+
function io(t) {
|
|
7023
7077
|
const r = yt(t);
|
|
7024
7078
|
return St(r) === "bib" ? `source/${r}` : null;
|
|
7025
7079
|
}
|
|
7026
|
-
function
|
|
7080
|
+
function At(t) {
|
|
7027
7081
|
return t.replace(/\r\n?/g, `
|
|
7028
7082
|
`).replace(/(\n *){3,}/g, `
|
|
7029
7083
|
|
|
7030
7084
|
`);
|
|
7031
7085
|
}
|
|
7032
|
-
function
|
|
7086
|
+
function ao(t) {
|
|
7033
7087
|
const r = t.toLowerCase();
|
|
7034
7088
|
return r.endsWith(".tar.gz") || r.endsWith(".tgz") ? "tar.gz" : r.endsWith(".zip") ? "zip" : r.endsWith(".tex") ? "tex" : r.endsWith(".md") || r.endsWith(".markdown") ? "markdown" : r.endsWith(".ptx") || r.endsWith(".xml") ? "pretext" : null;
|
|
7035
7089
|
}
|
|
7036
|
-
function
|
|
7090
|
+
function so(t) {
|
|
7037
7091
|
const r = (n, i) => new TextDecoder().decode(t.slice(n, i)).split("\0")[0];
|
|
7038
7092
|
return {
|
|
7039
7093
|
name: r(0, 100),
|
|
@@ -7041,7 +7095,7 @@ function Qs(t) {
|
|
|
7041
7095
|
type: r(156, 157)
|
|
7042
7096
|
};
|
|
7043
7097
|
}
|
|
7044
|
-
async function
|
|
7098
|
+
async function oo(t) {
|
|
7045
7099
|
if (typeof DecompressionStream > "u")
|
|
7046
7100
|
throw new Error("This runtime does not support gzip decompression.");
|
|
7047
7101
|
const i = new ReadableStream({
|
|
@@ -7063,30 +7117,30 @@ async function to(t) {
|
|
|
7063
7117
|
s.set(c, o), o += c.length;
|
|
7064
7118
|
return s.buffer;
|
|
7065
7119
|
}
|
|
7066
|
-
function
|
|
7120
|
+
function co(t) {
|
|
7067
7121
|
const r = {}, n = {};
|
|
7068
7122
|
let i = 0;
|
|
7069
7123
|
for (; i < t.length && !(i + 512 > t.length); ) {
|
|
7070
|
-
const e = t.slice(i, i + 512), a =
|
|
7124
|
+
const e = t.slice(i, i + 512), a = so(e);
|
|
7071
7125
|
if (!a.name)
|
|
7072
7126
|
break;
|
|
7073
7127
|
i += 512;
|
|
7074
7128
|
const s = a.size, o = Math.ceil(s / 512) * 512;
|
|
7075
7129
|
if (a.type === "0" || a.type === "") {
|
|
7076
7130
|
const c = t.slice(i, i + s), l = mt(a.name);
|
|
7077
|
-
if (
|
|
7131
|
+
if (ri(St(l)))
|
|
7078
7132
|
n[l] = c;
|
|
7079
7133
|
else {
|
|
7080
7134
|
const f = new TextDecoder().decode(c);
|
|
7081
|
-
r[l] =
|
|
7135
|
+
r[l] = At(f);
|
|
7082
7136
|
}
|
|
7083
7137
|
}
|
|
7084
7138
|
i += o;
|
|
7085
7139
|
}
|
|
7086
7140
|
return { files: r, assets: n };
|
|
7087
7141
|
}
|
|
7088
|
-
async function
|
|
7089
|
-
const r =
|
|
7142
|
+
async function lo(t) {
|
|
7143
|
+
const r = ao(t.name);
|
|
7090
7144
|
if (!r)
|
|
7091
7145
|
throw new Error(
|
|
7092
7146
|
"File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
|
|
@@ -7094,31 +7148,31 @@ async function no(t) {
|
|
|
7094
7148
|
if (r === "tex" || r === "markdown" || r === "pretext") {
|
|
7095
7149
|
const e = await t.text();
|
|
7096
7150
|
return {
|
|
7097
|
-
files: { [mt(t.name)]:
|
|
7151
|
+
files: { [mt(t.name)]: At(e) },
|
|
7098
7152
|
assets: {}
|
|
7099
7153
|
};
|
|
7100
7154
|
}
|
|
7101
7155
|
if (r === "zip") {
|
|
7102
|
-
const a = await new
|
|
7156
|
+
const a = await new Ba().loadAsync(t), s = {}, o = {};
|
|
7103
7157
|
for (const [c, l] of Object.entries(a.files)) {
|
|
7104
7158
|
if (l.dir)
|
|
7105
7159
|
continue;
|
|
7106
7160
|
const f = mt(c);
|
|
7107
|
-
if (
|
|
7161
|
+
if (ri(St(f)))
|
|
7108
7162
|
o[f] = await l.async("uint8array");
|
|
7109
7163
|
else {
|
|
7110
7164
|
const p = await l.async("string");
|
|
7111
|
-
s[f] =
|
|
7165
|
+
s[f] = At(p);
|
|
7112
7166
|
}
|
|
7113
7167
|
}
|
|
7114
7168
|
return { files: s, assets: o };
|
|
7115
7169
|
}
|
|
7116
|
-
const n = await t.arrayBuffer(), i = await
|
|
7117
|
-
return
|
|
7170
|
+
const n = await t.arrayBuffer(), i = await oo(n);
|
|
7171
|
+
return co(new Uint8Array(i));
|
|
7118
7172
|
}
|
|
7119
|
-
function
|
|
7173
|
+
function uo(t) {
|
|
7120
7174
|
const r = { other: 0 };
|
|
7121
|
-
for (const n of
|
|
7175
|
+
for (const n of to)
|
|
7122
7176
|
r[n] = 0;
|
|
7123
7177
|
for (const n of Object.keys(t)) {
|
|
7124
7178
|
const i = St(n);
|
|
@@ -7126,51 +7180,51 @@ function ro(t) {
|
|
|
7126
7180
|
}
|
|
7127
7181
|
return r;
|
|
7128
7182
|
}
|
|
7129
|
-
function
|
|
7130
|
-
const n =
|
|
7183
|
+
function fo(t, r) {
|
|
7184
|
+
const n = uo(r);
|
|
7131
7185
|
t.push({ type: "success", message: "File types:" });
|
|
7132
7186
|
for (const i of Object.keys(n).sort())
|
|
7133
7187
|
n[i] && t.push({ type: "success", message: `${i}: ${n[i]}` });
|
|
7134
7188
|
}
|
|
7135
|
-
function
|
|
7189
|
+
function ho(t) {
|
|
7136
7190
|
return t === "latex" ? "tex" : t === "markdown" ? "markdown" : "pretext";
|
|
7137
7191
|
}
|
|
7138
|
-
function
|
|
7192
|
+
function po(t, r) {
|
|
7139
7193
|
return t.targets.find(
|
|
7140
7194
|
(n) => n.source === r
|
|
7141
7195
|
);
|
|
7142
7196
|
}
|
|
7143
|
-
function
|
|
7197
|
+
function mo(t, r) {
|
|
7144
7198
|
return t === !1 ? [] : Array.isArray(t) ? t.filter((n) => n.include !== !1) : r.extraRoots.map((n) => ({ path: n.path }));
|
|
7145
7199
|
}
|
|
7146
|
-
function
|
|
7200
|
+
function go(t) {
|
|
7147
7201
|
if (t.reason === "manifest-target") {
|
|
7148
7202
|
const r = t.targetName ? ` (target \`${t.targetName}\`)` : "";
|
|
7149
7203
|
return `Main source file: ${t.path}${r}`;
|
|
7150
7204
|
}
|
|
7151
7205
|
return `Main source file: ${t.path}`;
|
|
7152
7206
|
}
|
|
7153
|
-
function
|
|
7154
|
-
const n = [], i = r.destination ??
|
|
7207
|
+
function bo(t, r = {}) {
|
|
7208
|
+
const n = [], i = r.destination ?? us;
|
|
7155
7209
|
let e = [];
|
|
7156
7210
|
try {
|
|
7157
7211
|
const a = Object.fromEntries(
|
|
7158
7212
|
Object.entries(t).map(([Q, Y]) => [
|
|
7159
7213
|
mt(Q),
|
|
7160
|
-
|
|
7214
|
+
At(Y)
|
|
7161
7215
|
])
|
|
7162
7216
|
), s = Object.keys(a).length;
|
|
7163
7217
|
n.push({
|
|
7164
7218
|
type: "success",
|
|
7165
7219
|
message: `Found ${s} file${s === 1 ? "" : "s"}.`
|
|
7166
|
-
}),
|
|
7167
|
-
const o =
|
|
7220
|
+
}), fo(n, a);
|
|
7221
|
+
const o = Ds(a, {
|
|
7168
7222
|
sourceFormat: r.sourceFormat,
|
|
7169
7223
|
mainFile: r.mainFile ? mt(r.mainFile) : void 0
|
|
7170
7224
|
}), c = o.primary;
|
|
7171
7225
|
if (!c)
|
|
7172
7226
|
throw new Error("No files were found in the uploaded source.");
|
|
7173
|
-
const l = c.path, f =
|
|
7227
|
+
const l = c.path, f = ho(c.format);
|
|
7174
7228
|
let p = a[l] ?? "";
|
|
7175
7229
|
const g = /* @__PURE__ */ new Set([l]);
|
|
7176
7230
|
if (o.manifest) {
|
|
@@ -7180,7 +7234,7 @@ function lo(t, r = {}) {
|
|
|
7180
7234
|
message: `Found ${o.manifest.manifestPath} with ${Q} target${Q === 1 ? "" : "s"}: ${o.manifest.targets.map((Y) => Y.name).join(", ")}.`
|
|
7181
7235
|
});
|
|
7182
7236
|
}
|
|
7183
|
-
const d =
|
|
7237
|
+
const d = mo(r.attachRoots, o);
|
|
7184
7238
|
let w = [];
|
|
7185
7239
|
const h = [], v = [];
|
|
7186
7240
|
if (c.format === "latex") {
|
|
@@ -7188,8 +7242,8 @@ function lo(t, r = {}) {
|
|
|
7188
7242
|
Object.entries(a).filter(
|
|
7189
7243
|
([rt]) => St(rt) === "tex"
|
|
7190
7244
|
)
|
|
7191
|
-
), Y =
|
|
7192
|
-
if (p =
|
|
7245
|
+
), Y = hr(p, l, Q);
|
|
7246
|
+
if (p = At(Y.expandedText), Y.consumedPaths.forEach((rt) => g.add(rt)), Y.expandedCount > 0 && n.push({
|
|
7193
7247
|
type: "success",
|
|
7194
7248
|
message: `Expanded ${Y.expandedCount} input/include reference${Y.expandedCount === 1 ? "" : "s"}.`
|
|
7195
7249
|
}), Y.missingInputs.length > 0 && n.push({
|
|
@@ -7201,7 +7255,7 @@ function lo(t, r = {}) {
|
|
|
7201
7255
|
const pt = a[st.path];
|
|
7202
7256
|
if (pt === void 0)
|
|
7203
7257
|
continue;
|
|
7204
|
-
const ht =
|
|
7258
|
+
const ht = hr(
|
|
7205
7259
|
pt,
|
|
7206
7260
|
st.path,
|
|
7207
7261
|
Q
|
|
@@ -7210,17 +7264,17 @@ function lo(t, r = {}) {
|
|
|
7210
7264
|
(u) => g.add(u)
|
|
7211
7265
|
), g.add(st.path);
|
|
7212
7266
|
}
|
|
7213
|
-
const ct =
|
|
7214
|
-
p =
|
|
7267
|
+
const ct = Bs(p, d, rt);
|
|
7268
|
+
p = At(ct.source), w = ct.attached, h.push(...ct.warnings);
|
|
7215
7269
|
}
|
|
7216
7270
|
} else if (c.format === "markdown") {
|
|
7217
7271
|
if (d.length > 0) {
|
|
7218
|
-
const Q =
|
|
7272
|
+
const Q = Ns(
|
|
7219
7273
|
p,
|
|
7220
7274
|
d,
|
|
7221
7275
|
a
|
|
7222
7276
|
);
|
|
7223
|
-
p =
|
|
7277
|
+
p = At(Q.source), w = Q.attached, h.push(...Q.warnings), w.forEach((Y) => g.add(Y.path));
|
|
7224
7278
|
}
|
|
7225
7279
|
} else {
|
|
7226
7280
|
const Q = Object.fromEntries(
|
|
@@ -7228,7 +7282,7 @@ function lo(t, r = {}) {
|
|
|
7228
7282
|
const ct = St(rt);
|
|
7229
7283
|
return ct === "ptx" || ct === "xml";
|
|
7230
7284
|
})
|
|
7231
|
-
), Y =
|
|
7285
|
+
), Y = Ka(p, l, Q);
|
|
7232
7286
|
p = Y.expandedText, Y.consumedPaths.forEach((rt) => g.add(rt)), Y.expandedCount > 0 && n.push({
|
|
7233
7287
|
type: "success",
|
|
7234
7288
|
message: `Expanded ${Y.expandedCount} xi:include reference${Y.expandedCount === 1 ? "" : "s"}.`
|
|
@@ -7246,13 +7300,17 @@ function lo(t, r = {}) {
|
|
|
7246
7300
|
message: `Missing xi:include targets: ${Y.missingIncludes.join(", ")}. This content is missing from the import.`
|
|
7247
7301
|
}));
|
|
7248
7302
|
}
|
|
7249
|
-
n.push({ type: "success", message:
|
|
7303
|
+
n.push({ type: "success", message: go(c) });
|
|
7250
7304
|
for (const Q of w)
|
|
7251
7305
|
n.push({
|
|
7252
7306
|
type: "success",
|
|
7253
7307
|
message: `Attached ${Q.path} as a ${Q.level}: ${Q.title}`
|
|
7254
7308
|
});
|
|
7255
|
-
const b =
|
|
7309
|
+
const b = Pa(
|
|
7310
|
+
p,
|
|
7311
|
+
c.format,
|
|
7312
|
+
r.documentKind
|
|
7313
|
+
);
|
|
7256
7314
|
if ("pretextError" in b)
|
|
7257
7315
|
return {
|
|
7258
7316
|
pretextError: b.pretextError,
|
|
@@ -7267,7 +7325,7 @@ function lo(t, r = {}) {
|
|
|
7267
7325
|
buildLayout: x = !0,
|
|
7268
7326
|
assets: S = {},
|
|
7269
7327
|
...I
|
|
7270
|
-
} = r, A = o.manifest, P = A && c.reason === "manifest-target" ?
|
|
7328
|
+
} = r, A = o.manifest, P = A && c.reason === "manifest-target" ? po(
|
|
7271
7329
|
A,
|
|
7272
7330
|
c.path.slice(
|
|
7273
7331
|
A.projectRoot ? A.projectRoot.length + 1 : 0
|
|
@@ -7277,10 +7335,10 @@ function lo(t, r = {}) {
|
|
|
7277
7335
|
publicationPath: I.publicationPath ?? (L && P?.publication ? P.publication : "publication/publication.ptx"),
|
|
7278
7336
|
projectFilePath: I.projectFilePath ?? "project.ptx",
|
|
7279
7337
|
preserved: L
|
|
7280
|
-
}, $ = {}, W = {}, J = {}, k = r.externalDir ??
|
|
7338
|
+
}, $ = {}, W = {}, J = {}, k = r.externalDir ?? ei;
|
|
7281
7339
|
let D;
|
|
7282
7340
|
if (L && A && P) {
|
|
7283
|
-
const Q =
|
|
7341
|
+
const Q = Ws({
|
|
7284
7342
|
manifest: A,
|
|
7285
7343
|
target: P,
|
|
7286
7344
|
files: a,
|
|
@@ -7298,9 +7356,9 @@ function lo(t, r = {}) {
|
|
|
7298
7356
|
message: `Skipped build output: ${Q.skipped.length} file${Q.skipped.length === 1 ? "" : "s"}.`
|
|
7299
7357
|
});
|
|
7300
7358
|
} else {
|
|
7301
|
-
D =
|
|
7302
|
-
Object.keys(S).filter(
|
|
7303
|
-
|
|
7359
|
+
D = Vs(
|
|
7360
|
+
Object.keys(S).filter(ro),
|
|
7361
|
+
wo(B.mainSourcePath),
|
|
7304
7362
|
k
|
|
7305
7363
|
);
|
|
7306
7364
|
for (const [Q, Y] of Object.entries(
|
|
@@ -7308,26 +7366,26 @@ function lo(t, r = {}) {
|
|
|
7308
7366
|
))
|
|
7309
7367
|
$[Y] = S[Q], W[Q] = S[Q];
|
|
7310
7368
|
}
|
|
7311
|
-
const m = I.documentKind ??
|
|
7369
|
+
const m = I.documentKind ?? Dr(b.pretextSource), F = D ? Ys(b.pretextSource, D.sourceByBaseName) : void 0, it = F?.source ?? b.pretextSource, U = ni(it, r.selection), nt = i.kind === "insert" ? Kr(U.source, i, {
|
|
7312
7370
|
hasSelection: (r.selection?.length ?? 0) > 0
|
|
7313
7371
|
}) : void 0, M = nt?.source ?? U.source, et = [
|
|
7314
|
-
...
|
|
7372
|
+
...ii(U),
|
|
7315
7373
|
...nt?.warnings ?? []
|
|
7316
7374
|
], O = x ? Math.max(
|
|
7317
|
-
|
|
7375
|
+
vo(I, {
|
|
7318
7376
|
format: b.sourceFormat,
|
|
7319
7377
|
latexSource: b.cleanedNativeSource,
|
|
7320
7378
|
documentKind: m
|
|
7321
7379
|
}),
|
|
7322
|
-
|
|
7323
|
-
) : 0, C =
|
|
7380
|
+
Jr(nt?.unwrapRoot ?? !1)
|
|
7381
|
+
) : 0, C = Mr(M, {
|
|
7324
7382
|
documentKind: m,
|
|
7325
7383
|
splitLevel: O,
|
|
7326
7384
|
assets: W,
|
|
7327
7385
|
takenIds: i.kind === "insert" ? i.takenIds : void 0
|
|
7328
7386
|
});
|
|
7329
7387
|
if (x) {
|
|
7330
|
-
const Q =
|
|
7388
|
+
const Q = Gr(C.project, i, {
|
|
7331
7389
|
layout: {
|
|
7332
7390
|
mainSourcePath: B.mainSourcePath,
|
|
7333
7391
|
publicationPath: B.publicationPath,
|
|
@@ -7338,28 +7396,28 @@ function lo(t, r = {}) {
|
|
|
7338
7396
|
},
|
|
7339
7397
|
unwrapRoot: nt?.unwrapRoot
|
|
7340
7398
|
});
|
|
7341
|
-
e = Q.includes, Object.assign(J, Q.files), i.kind === "project" && L && A && P && (J[B.projectFilePath] =
|
|
7399
|
+
e = Q.includes, Object.assign(J, Q.files), i.kind === "project" && L && A && P && (J[B.projectFilePath] = Zs(A, P, {
|
|
7342
7400
|
mainSource: B.mainSourcePath,
|
|
7343
7401
|
publication: B.publicationPath
|
|
7344
|
-
}), B.publicationPath in J || (J[B.publicationPath] =
|
|
7402
|
+
}), B.publicationPath in J || (J[B.publicationPath] = Er()));
|
|
7345
7403
|
} else
|
|
7346
7404
|
J["source/main.ptx"] = b.pretextSource;
|
|
7347
7405
|
for (const [Q, Y] of Object.entries(a)) {
|
|
7348
|
-
const rt =
|
|
7406
|
+
const rt = io(Q);
|
|
7349
7407
|
rt && !(rt in J) && (J[rt] = Y);
|
|
7350
7408
|
}
|
|
7351
7409
|
const K = C.project.documentKind, G = [
|
|
7352
7410
|
...b.warnings,
|
|
7353
7411
|
...h,
|
|
7354
7412
|
...v,
|
|
7355
|
-
...
|
|
7413
|
+
..._o(F),
|
|
7356
7414
|
...et,
|
|
7357
7415
|
...C.warnings
|
|
7358
7416
|
];
|
|
7359
|
-
let V,
|
|
7417
|
+
let V, lt;
|
|
7360
7418
|
return b.cleanedNativeSource !== void 0 && b.cleanedNativeSource.length > 0 && (b.sourceFormat === "latex" || b.sourceFormat === "markdown") && (V = {
|
|
7361
7419
|
[b.sourceFormat === "latex" ? "source/main.tex" : "source/main.md"]: b.cleanedNativeSource
|
|
7362
|
-
},
|
|
7420
|
+
}, lt = Wr(
|
|
7363
7421
|
b.cleanedNativeSource,
|
|
7364
7422
|
b.sourceFormat,
|
|
7365
7423
|
{
|
|
@@ -7396,7 +7454,7 @@ function lo(t, r = {}) {
|
|
|
7396
7454
|
attachedRoots: w,
|
|
7397
7455
|
projectLayout: B,
|
|
7398
7456
|
project: C.project,
|
|
7399
|
-
nativeProject:
|
|
7457
|
+
nativeProject: lt,
|
|
7400
7458
|
files: a,
|
|
7401
7459
|
assets: S,
|
|
7402
7460
|
outputFiles: J,
|
|
@@ -7416,9 +7474,9 @@ function lo(t, r = {}) {
|
|
|
7416
7474
|
};
|
|
7417
7475
|
}
|
|
7418
7476
|
}
|
|
7419
|
-
async function
|
|
7477
|
+
async function Oo(t, r = {}) {
|
|
7420
7478
|
const n = [], i = mt(t.name);
|
|
7421
|
-
if (!
|
|
7479
|
+
if (!Qs.test(i.toLowerCase()))
|
|
7422
7480
|
return {
|
|
7423
7481
|
pretextError: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz.",
|
|
7424
7482
|
statusMessages: [
|
|
@@ -7434,7 +7492,7 @@ async function Eo(t, r = {}) {
|
|
|
7434
7492
|
message: `Processing ${i}...`
|
|
7435
7493
|
});
|
|
7436
7494
|
try {
|
|
7437
|
-
const { files: e, assets: a } = await
|
|
7495
|
+
const { files: e, assets: a } = await lo(t), s = bo(e, { ...r, assets: a });
|
|
7438
7496
|
return {
|
|
7439
7497
|
...s,
|
|
7440
7498
|
statusMessages: [...n, ...s.statusMessages]
|
|
@@ -7448,17 +7506,17 @@ async function Eo(t, r = {}) {
|
|
|
7448
7506
|
};
|
|
7449
7507
|
}
|
|
7450
7508
|
}
|
|
7451
|
-
function
|
|
7452
|
-
return t.splitLevel !== void 0 ? Math.max(0, t.splitLevel) : t.splitChapters === !1 ? 0 : t.splitSections ? r.documentKind === "book" ? 2 : 1 : t.splitChapters ? 1 : r.format === "latex" && r.latexSource ?
|
|
7509
|
+
function vo(t, r) {
|
|
7510
|
+
return t.splitLevel !== void 0 ? Math.max(0, t.splitLevel) : t.splitChapters === !1 || r.documentKind === "slideshow" ? 0 : t.splitSections ? r.documentKind === "book" ? 2 : 1 : t.splitChapters ? 1 : r.format === "latex" && r.latexSource ? ga(
|
|
7453
7511
|
r.latexSource,
|
|
7454
7512
|
r.documentKind ?? (r.latexSource.includes("\\chapter") ? "book" : "article")
|
|
7455
7513
|
) : r.documentKind === "book" ? 1 : 0;
|
|
7456
7514
|
}
|
|
7457
|
-
function
|
|
7515
|
+
function wo(t) {
|
|
7458
7516
|
const r = t.lastIndexOf("/");
|
|
7459
7517
|
return r < 0 ? "" : t.slice(0, r + 1);
|
|
7460
7518
|
}
|
|
7461
|
-
function
|
|
7519
|
+
function _o(t) {
|
|
7462
7520
|
if (!t || t.unresolved.length === 0)
|
|
7463
7521
|
return [];
|
|
7464
7522
|
const r = [...new Set(t.unresolved)];
|
|
@@ -7474,7 +7532,7 @@ function ho(t) {
|
|
|
7474
7532
|
}
|
|
7475
7533
|
];
|
|
7476
7534
|
}
|
|
7477
|
-
function
|
|
7535
|
+
function ii(t) {
|
|
7478
7536
|
return t.removed.length === 0 ? [] : [
|
|
7479
7537
|
{
|
|
7480
7538
|
action: "delete",
|
|
@@ -7487,16 +7545,16 @@ function ni(t) {
|
|
|
7487
7545
|
}
|
|
7488
7546
|
];
|
|
7489
7547
|
}
|
|
7490
|
-
function
|
|
7491
|
-
const n = r.targetTag !== void 0 && t.destination.kind === "insert" ? { ...t.destination, targetTag: r.targetTag } : t.destination, i = r.selection ?? t.selection, e =
|
|
7548
|
+
function rn(t, r = {}) {
|
|
7549
|
+
const n = r.targetTag !== void 0 && t.destination.kind === "insert" ? { ...t.destination, targetTag: r.targetTag } : t.destination, i = r.selection ?? t.selection, e = ni(t.pretextSource, i), a = n.kind === "insert" ? Kr(e.source, n, {
|
|
7492
7550
|
hasSelection: (i?.length ?? 0) > 0
|
|
7493
7551
|
}) : void 0, s = Math.max(
|
|
7494
|
-
|
|
7552
|
+
Jr(a?.unwrapRoot ?? !1),
|
|
7495
7553
|
r.splitLevel ?? t.splitLevel
|
|
7496
7554
|
), o = t.destination.kind !== "insert" || n.kind !== "insert" || n.targetTag === t.destination.targetTag, c = (i ?? []).join(" ") === (t.selection ?? []).join(" ");
|
|
7497
7555
|
if (s === t.splitLevel && o && c)
|
|
7498
7556
|
return t;
|
|
7499
|
-
const l =
|
|
7557
|
+
const l = Mr(a?.source ?? e.source, {
|
|
7500
7558
|
documentKind: t.documentKind,
|
|
7501
7559
|
splitLevel: s,
|
|
7502
7560
|
assets: t.assets,
|
|
@@ -7504,8 +7562,8 @@ function en(t, r = {}) {
|
|
|
7504
7562
|
}), f = {};
|
|
7505
7563
|
if (n.kind === "project")
|
|
7506
7564
|
for (const [v, b] of Object.entries(t.outputFiles))
|
|
7507
|
-
|
|
7508
|
-
const p =
|
|
7565
|
+
yo(v, t.projectLayout.mainSourcePath) || (f[v] = b);
|
|
7566
|
+
const p = Gr(l.project, n, {
|
|
7509
7567
|
layout: {
|
|
7510
7568
|
mainSourcePath: t.projectLayout.mainSourcePath,
|
|
7511
7569
|
publicationPath: t.projectLayout.publicationPath,
|
|
@@ -7516,7 +7574,7 @@ function en(t, r = {}) {
|
|
|
7516
7574
|
});
|
|
7517
7575
|
Object.assign(f, p.files);
|
|
7518
7576
|
let g = t.nativeProject;
|
|
7519
|
-
t.cleanedNativeSource && (t.sourceFormat === "latex" || t.sourceFormat === "markdown") && (g =
|
|
7577
|
+
t.cleanedNativeSource && (t.sourceFormat === "latex" || t.sourceFormat === "markdown") && (g = Wr(
|
|
7520
7578
|
t.cleanedNativeSource,
|
|
7521
7579
|
t.sourceFormat,
|
|
7522
7580
|
{
|
|
@@ -7528,7 +7586,7 @@ function en(t, r = {}) {
|
|
|
7528
7586
|
}
|
|
7529
7587
|
).project);
|
|
7530
7588
|
const d = [
|
|
7531
|
-
...
|
|
7589
|
+
...ii(e),
|
|
7532
7590
|
...a?.warnings ?? []
|
|
7533
7591
|
], w = new Set(t.rebuiltWarnings), h = [
|
|
7534
7592
|
...t.warnings.filter((v) => !w.has(v)),
|
|
@@ -7553,97 +7611,97 @@ function en(t, r = {}) {
|
|
|
7553
7611
|
} : t.insert
|
|
7554
7612
|
};
|
|
7555
7613
|
}
|
|
7556
|
-
function
|
|
7557
|
-
return
|
|
7614
|
+
function zo(t, r) {
|
|
7615
|
+
return rn(t, { selection: r });
|
|
7558
7616
|
}
|
|
7559
|
-
function
|
|
7560
|
-
return
|
|
7617
|
+
function $o(t, r) {
|
|
7618
|
+
return rn(t, { splitLevel: r });
|
|
7561
7619
|
}
|
|
7562
|
-
function
|
|
7563
|
-
return
|
|
7620
|
+
function Lo(t, r) {
|
|
7621
|
+
return rn(t, { targetTag: r });
|
|
7564
7622
|
}
|
|
7565
|
-
function
|
|
7623
|
+
function yo(t, r) {
|
|
7566
7624
|
if (t === r) return !0;
|
|
7567
7625
|
const n = r.includes("/") ? r.slice(0, r.lastIndexOf("/") + 1) : "";
|
|
7568
7626
|
return t.startsWith(n) && t.endsWith(".ptx");
|
|
7569
7627
|
}
|
|
7570
7628
|
export {
|
|
7571
7629
|
Ut as $,
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7630
|
+
Io as A,
|
|
7631
|
+
_a as B,
|
|
7632
|
+
Ni as C,
|
|
7575
7633
|
Nt as D,
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7634
|
+
Me as E,
|
|
7635
|
+
$a as F,
|
|
7636
|
+
La as G,
|
|
7637
|
+
Pa as H,
|
|
7638
|
+
ps as I,
|
|
7639
|
+
Fs as J,
|
|
7640
|
+
Ss as K,
|
|
7641
|
+
zr as L,
|
|
7642
|
+
fi as M,
|
|
7643
|
+
ve as N,
|
|
7586
7644
|
le as O,
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7645
|
+
Ua as P,
|
|
7646
|
+
Pe as Q,
|
|
7647
|
+
Ka as R,
|
|
7648
|
+
Ye as S,
|
|
7649
|
+
Ft as T,
|
|
7650
|
+
Xe as U,
|
|
7651
|
+
ks as V,
|
|
7652
|
+
Rr as W,
|
|
7653
|
+
Da as X,
|
|
7654
|
+
Eo as Y,
|
|
7655
|
+
Oo as Z,
|
|
7656
|
+
zt as _,
|
|
7657
|
+
Er as a,
|
|
7658
|
+
Ve as a0,
|
|
7659
|
+
Ao as a1,
|
|
7660
|
+
To as a2,
|
|
7661
|
+
Ge as a3,
|
|
7662
|
+
Co as a4,
|
|
7663
|
+
Ir as a5,
|
|
7664
|
+
xs as a6,
|
|
7665
|
+
Kr as a7,
|
|
7666
|
+
ni as a8,
|
|
7667
|
+
rn as a9,
|
|
7668
|
+
$o as aa,
|
|
7669
|
+
Zs as ab,
|
|
7670
|
+
zo as ac,
|
|
7671
|
+
vo as ad,
|
|
7672
|
+
Fr as ae,
|
|
7673
|
+
Ro as af,
|
|
7674
|
+
Hr as ag,
|
|
7675
|
+
Lo as ah,
|
|
7676
|
+
Zt as ai,
|
|
7677
|
+
Gr as aj,
|
|
7678
|
+
ls as ak,
|
|
7679
|
+
ss as al,
|
|
7680
|
+
Va as am,
|
|
7681
|
+
ga as an,
|
|
7682
|
+
It as b,
|
|
7683
|
+
$r as c,
|
|
7684
|
+
Dr as d,
|
|
7685
|
+
Le as e,
|
|
7686
|
+
Et as f,
|
|
7687
|
+
Ze as g,
|
|
7688
|
+
lo as h,
|
|
7689
|
+
cs as i,
|
|
7690
|
+
Ds as j,
|
|
7691
|
+
bo as k,
|
|
7692
|
+
Ar as l,
|
|
7693
|
+
di as m,
|
|
7694
|
+
ma as n,
|
|
7695
|
+
Na as o,
|
|
7638
7696
|
ue as p,
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7697
|
+
us as q,
|
|
7698
|
+
sa as r,
|
|
7699
|
+
Wt as s,
|
|
7700
|
+
Qi as t,
|
|
7701
|
+
Bs as u,
|
|
7702
|
+
Ns as v,
|
|
7703
|
+
De as w,
|
|
7704
|
+
Mr as x,
|
|
7705
|
+
Wr as y,
|
|
7706
|
+
Ws as z
|
|
7649
7707
|
};
|