From e56e49bf7dd893b19bf058be4cd24d6cd5bc425e Mon Sep 17 00:00:00 2001 From: mderrier Date: Fri, 26 Jul 2019 16:31:26 +0200 Subject: [PATCH] feat(ios10): fix --- dist/mathlive.js | 918 +++++++++++++++++++++++++++++++++++++++++++- npm-shrinkwrap.json | 2 +- package.json | 6 +- 3 files changed, 921 insertions(+), 5 deletions(-) diff --git a/dist/mathlive.js b/dist/mathlive.js index 1b80b1806..4aa2cc905 100644 --- a/dist/mathlive.js +++ b/dist/mathlive.js @@ -1 +1,917 @@ -var global,factory;global=this,factory=function(){const t=0,e=1,i=2,s=3,a=4,o=5,n=6,r=7,l=8,c=9,h=10,d=11,p=12;function m(t,e){e=e||0;const i=t.charCodeAt(e);if(55296<=i&&i<=56319&&e=1){const s=t.charCodeAt(e-1),a=i;return 55296<=s&&s<=56319?1024*(s-55296)+(a-56320)+65536:a}return i}function u(u,g){if((g=g||0)<0)return 0;if(g>=u.length-1)return u.length;let y=f(m(u,g));for(let k=g+1;k=this.s.length}get(){return this.pos="0"&&i<="9"?parseInt(i):"?"):t=new y("literal","#")}}else"~"===this.peek()?(this.get(),t=new y("command","space")):"$"===this.peek()?(this.get(),"$"===this.peek()?(this.get(),t=new y("$$")):t=new y("$")):t=new y("literal",this.get());return t}}var x={tokenize:function(t){const e=[],i=t.toString().split(/\r?\n/);let s="",a="";for(const t of i){s+=a,a=" ";const e=t.match(/((?:\\%)|[^%])*/);e&&(s+=e[0])}const o=new b(s);for(;!o.end();){const t=o.makeToken();t&&e.push(t)}return e}},k={"AMS-Regular":{65:[0,.68889,0,0],66:[0,.68889,0,0],67:[0,.68889,0,0],68:[0,.68889,0,0],69:[0,.68889,0,0],70:[0,.68889,0,0],71:[0,.68889,0,0],72:[0,.68889,0,0],73:[0,.68889,0,0],74:[.16667,.68889,0,0],75:[0,.68889,0,0],76:[0,.68889,0,0],77:[0,.68889,0,0],78:[0,.68889,0,0],79:[.16667,.68889,0,0],80:[0,.68889,0,0],81:[.16667,.68889,0,0],82:[0,.68889,0,0],83:[0,.68889,0,0],84:[0,.68889,0,0],85:[0,.68889,0,0],86:[0,.68889,0,0],87:[0,.68889,0,0],88:[0,.68889,0,0],89:[0,.68889,0,0],90:[0,.68889,0,0],107:[0,.68889,0,0],165:[0,.675,.025,0],174:[.15559,.69224,0,0],240:[0,.68889,0,0],295:[0,.68889,0,0],710:[0,.825,0,0],732:[0,.9,0,0],770:[0,.825,0,0],771:[0,.9,0,0],989:[.08167,.58167,0,0],1008:[0,.43056,.04028,0],8245:[0,.54986,0,0],8463:[0,.68889,0,0],8487:[0,.68889,0,0],8498:[0,.68889,0,0],8502:[0,.68889,0,0],8503:[0,.68889,0,0],8504:[0,.68889,0,0],8513:[0,.68889,0,0],8592:[-.03598,.46402,0,0],8594:[-.03598,.46402,0,0],8602:[-.13313,.36687,0,0],8603:[-.13313,.36687,0,0],8606:[.01354,.52239,0,0],8608:[.01354,.52239,0,0],8610:[.01354,.52239,0,0],8611:[.01354,.52239,0,0],8619:[0,.54986,0,0],8620:[0,.54986,0,0],8621:[-.13313,.37788,0,0],8622:[-.13313,.36687,0,0],8624:[0,.69224,0,0],8625:[0,.69224,0,0],8630:[0,.43056,0,0],8631:[0,.43056,0,0],8634:[.08198,.58198,0,0],8635:[.08198,.58198,0,0],8638:[.19444,.69224,0,0],8639:[.19444,.69224,0,0],8642:[.19444,.69224,0,0],8643:[.19444,.69224,0,0],8644:[.1808,.675,0,0],8646:[.1808,.675,0,0],8647:[.1808,.675,0,0],8648:[.19444,.69224,0,0],8649:[.1808,.675,0,0],8650:[.19444,.69224,0,0],8651:[.01354,.52239,0,0],8652:[.01354,.52239,0,0],8653:[-.13313,.36687,0,0],8654:[-.13313,.36687,0,0],8655:[-.13313,.36687,0,0],8666:[.13667,.63667,0,0],8667:[.13667,.63667,0,0],8669:[-.13313,.37788,0,0],8672:[-.064,.437,0,0],8674:[-.064,.437,0,0],8705:[0,.825,0,0],8708:[0,.68889,0,0],8709:[.08167,.58167,0,0],8717:[0,.43056,0,0],8722:[-.03598,.46402,0,0],8724:[.08198,.69224,0,0],8726:[.08167,.58167,0,0],8733:[0,.69224,0,0],8736:[0,.69224,0,0],8737:[0,.69224,0,0],8738:[.03517,.52239,0,0],8739:[.08167,.58167,0,0],8740:[.25142,.74111,0,0],8741:[.08167,.58167,0,0],8742:[.25142,.74111,0,0],8756:[0,.69224,0,0],8757:[0,.69224,0,0],8764:[-.13313,.36687,0,0],8765:[-.13313,.37788,0,0],8769:[-.13313,.36687,0,0],8770:[-.03625,.46375,0,0],8774:[.30274,.79383,0,0],8776:[-.01688,.48312,0,0],8778:[.08167,.58167,0,0],8782:[.06062,.54986,0,0],8783:[.06062,.54986,0,0],8785:[.08198,.58198,0,0],8786:[.08198,.58198,0,0],8787:[.08198,.58198,0,0],8790:[0,.69224,0,0],8791:[.22958,.72958,0,0],8796:[.08198,.91667,0,0],8806:[.25583,.75583,0,0],8807:[.25583,.75583,0,0],8808:[.25142,.75726,0,0],8809:[.25142,.75726,0,0],8812:[.25583,.75583,0,0],8814:[.20576,.70576,0,0],8815:[.20576,.70576,0,0],8816:[.30274,.79383,0,0],8817:[.30274,.79383,0,0],8818:[.22958,.72958,0,0],8819:[.22958,.72958,0,0],8822:[.1808,.675,0,0],8823:[.1808,.675,0,0],8828:[.13667,.63667,0,0],8829:[.13667,.63667,0,0],8830:[.22958,.72958,0,0],8831:[.22958,.72958,0,0],8832:[.20576,.70576,0,0],8833:[.20576,.70576,0,0],8840:[.30274,.79383,0,0],8841:[.30274,.79383,0,0],8842:[.13597,.63597,0,0],8843:[.13597,.63597,0,0],8847:[.03517,.54986,0,0],8848:[.03517,.54986,0,0],8858:[.08198,.58198,0,0],8859:[.08198,.58198,0,0],8861:[.08198,.58198,0,0],8862:[0,.675,0,0],8863:[0,.675,0,0],8864:[0,.675,0,0],8865:[0,.675,0,0],8872:[0,.69224,0,0],8873:[0,.69224,0,0],8874:[0,.69224,0,0],8876:[0,.68889,0,0],8877:[0,.68889,0,0],8878:[0,.68889,0,0],8879:[0,.68889,0,0],8882:[.03517,.54986,0,0],8883:[.03517,.54986,0,0],8884:[.13667,.63667,0,0],8885:[.13667,.63667,0,0],8888:[0,.54986,0,0],8890:[.19444,.43056,0,0],8891:[.19444,.69224,0,0],8892:[.19444,.69224,0,0],8901:[0,.54986,0,0],8903:[.08167,.58167,0,0],8905:[.08167,.58167,0,0],8906:[.08167,.58167,0,0],8907:[0,.69224,0,0],8908:[0,.69224,0,0],8909:[-.03598,.46402,0,0],8910:[0,.54986,0,0],8911:[0,.54986,0,0],8912:[.03517,.54986,0,0],8913:[.03517,.54986,0,0],8914:[0,.54986,0,0],8915:[0,.54986,0,0],8916:[0,.69224,0,0],8918:[.0391,.5391,0,0],8919:[.0391,.5391,0,0],8920:[.03517,.54986,0,0],8921:[.03517,.54986,0,0],8922:[.38569,.88569,0,0],8923:[.38569,.88569,0,0],8926:[.13667,.63667,0,0],8927:[.13667,.63667,0,0],8928:[.30274,.79383,0,0],8929:[.30274,.79383,0,0],8934:[.23222,.74111,0,0],8935:[.23222,.74111,0,0],8936:[.23222,.74111,0,0],8937:[.23222,.74111,0,0],8938:[.20576,.70576,0,0],8939:[.20576,.70576,0,0],8940:[.30274,.79383,0,0],8941:[.30274,.79383,0,0],8994:[.19444,.69224,0,0],8995:[.19444,.69224,0,0],9416:[.15559,.69224,0,0],9484:[0,.69224,0,0],9488:[0,.69224,0,0],9492:[0,.37788,0,0],9496:[0,.37788,0,0],9585:[.19444,.68889,0,0],9586:[.19444,.74111,0,0],9632:[0,.675,0,0],9633:[0,.675,0,0],9650:[0,.54986,0,0],9651:[0,.54986,0,0],9654:[.03517,.54986,0,0],9660:[0,.54986,0,0],9661:[0,.54986,0,0],9664:[.03517,.54986,0,0],9674:[.11111,.69224,0,0],9733:[.19444,.69224,0,0],10003:[0,.69224,0,0],10016:[0,.69224,0,0],10731:[.11111,.69224,0,0],10846:[.19444,.75583,0,0],10877:[.13667,.63667,0,0],10878:[.13667,.63667,0,0],10885:[.25583,.75583,0,0],10886:[.25583,.75583,0,0],10887:[.13597,.63597,0,0],10888:[.13597,.63597,0,0],10889:[.26167,.75726,0,0],10890:[.26167,.75726,0,0],10891:[.48256,.98256,0,0],10892:[.48256,.98256,0,0],10901:[.13667,.63667,0,0],10902:[.13667,.63667,0,0],10933:[.25142,.75726,0,0],10934:[.25142,.75726,0,0],10935:[.26167,.75726,0,0],10936:[.26167,.75726,0,0],10937:[.26167,.75726,0,0],10938:[.26167,.75726,0,0],10949:[.25583,.75583,0,0],10950:[.25583,.75583,0,0],10955:[.28481,.79383,0,0],10956:[.28481,.79383,0,0],57350:[.08167,.58167,0,0],57351:[.08167,.58167,0,0],57352:[.08167,.58167,0,0],57353:[0,.43056,.04028,0],57356:[.25142,.75726,0,0],57357:[.25142,.75726,0,0],57358:[.41951,.91951,0,0],57359:[.30274,.79383,0,0],57360:[.30274,.79383,0,0],57361:[.41951,.91951,0,0],57366:[.25142,.75726,0,0],57367:[.25142,.75726,0,0],57368:[.25142,.75726,0,0],57369:[.25142,.75726,0,0],57370:[.13597,.63597,0,0],57371:[.13597,.63597,0,0]},"Caligraphic-Regular":{48:[0,.43056,0,0],49:[0,.43056,0,0],50:[0,.43056,0,0],51:[.19444,.43056,0,0],52:[.19444,.43056,0,0],53:[.19444,.43056,0,0],54:[0,.64444,0,0],55:[.19444,.43056,0,0],56:[0,.64444,0,0],57:[.19444,.43056,0,0],65:[0,.68333,0,.19445],66:[0,.68333,.03041,.13889],67:[0,.68333,.05834,.13889],68:[0,.68333,.02778,.08334],69:[0,.68333,.08944,.11111],70:[0,.68333,.09931,.11111],71:[.09722,.68333,.0593,.11111],72:[0,.68333,.00965,.11111],73:[0,.68333,.07382,0],74:[.09722,.68333,.18472,.16667],75:[0,.68333,.01445,.05556],76:[0,.68333,0,.13889],77:[0,.68333,0,.13889],78:[0,.68333,.14736,.08334],79:[0,.68333,.02778,.11111],80:[0,.68333,.08222,.08334],81:[.09722,.68333,0,.11111],82:[0,.68333,0,.08334],83:[0,.68333,.075,.13889],84:[0,.68333,.25417,0],85:[0,.68333,.09931,.08334],86:[0,.68333,.08222,0],87:[0,.68333,.08222,.08334],88:[0,.68333,.14643,.13889],89:[.09722,.68333,.08222,.08334],90:[0,.68333,.07944,.13889]},"Fraktur-Regular":{33:[0,.69141,0,0],34:[0,.69141,0,0],38:[0,.69141,0,0],39:[0,.69141,0,0],40:[.24982,.74947,0,0],41:[.24982,.74947,0,0],42:[0,.62119,0,0],43:[.08319,.58283,0,0],44:[0,.10803,0,0],45:[.08319,.58283,0,0],46:[0,.10803,0,0],47:[.24982,.74947,0,0],48:[0,.47534,0,0],49:[0,.47534,0,0],50:[0,.47534,0,0],51:[.18906,.47534,0,0],52:[.18906,.47534,0,0],53:[.18906,.47534,0,0],54:[0,.69141,0,0],55:[.18906,.47534,0,0],56:[0,.69141,0,0],57:[.18906,.47534,0,0],58:[0,.47534,0,0],59:[.12604,.47534,0,0],61:[-.13099,.36866,0,0],63:[0,.69141,0,0],65:[0,.69141,0,0],66:[0,.69141,0,0],67:[0,.69141,0,0],68:[0,.69141,0,0],69:[0,.69141,0,0],70:[.12604,.69141,0,0],71:[0,.69141,0,0],72:[.06302,.69141,0,0],73:[0,.69141,0,0],74:[.12604,.69141,0,0],75:[0,.69141,0,0],76:[0,.69141,0,0],77:[0,.69141,0,0],78:[0,.69141,0,0],79:[0,.69141,0,0],80:[.18906,.69141,0,0],81:[.03781,.69141,0,0],82:[0,.69141,0,0],83:[0,.69141,0,0],84:[0,.69141,0,0],85:[0,.69141,0,0],86:[0,.69141,0,0],87:[0,.69141,0,0],88:[0,.69141,0,0],89:[.18906,.69141,0,0],90:[.12604,.69141,0,0],91:[.24982,.74947,0,0],93:[.24982,.74947,0,0],94:[0,.69141,0,0],97:[0,.47534,0,0],98:[0,.69141,0,0],99:[0,.47534,0,0],100:[0,.62119,0,0],101:[0,.47534,0,0],102:[.18906,.69141,0,0],103:[.18906,.47534,0,0],104:[.18906,.69141,0,0],105:[0,.69141,0,0],106:[0,.69141,0,0],107:[0,.69141,0,0],108:[0,.69141,0,0],109:[0,.47534,0,0],110:[0,.47534,0,0],111:[0,.47534,0,0],112:[.18906,.52396,0,0],113:[.18906,.47534,0,0],114:[0,.47534,0,0],115:[0,.47534,0,0],116:[0,.62119,0,0],117:[0,.47534,0,0],118:[0,.52396,0,0],119:[0,.52396,0,0],120:[.18906,.47534,0,0],121:[.18906,.47534,0,0],122:[.18906,.47534,0,0],8216:[0,.69141,0,0],8217:[0,.69141,0,0],58112:[0,.62119,0,0],58113:[0,.62119,0,0],58114:[.18906,.69141,0,0],58115:[.18906,.69141,0,0],58116:[.18906,.47534,0,0],58117:[0,.69141,0,0],58118:[0,.62119,0,0],58119:[0,.47534,0,0]},"Main-Bold":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.13333,.63333,0,0],44:[.19444,.15556,0,0],45:[0,.44444,0,0],46:[0,.15556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.44444,0,0],59:[.19444,.44444,0,0],60:[.08556,.58556,0,0],61:[-.10889,.39111,0,0],62:[.08556,.58556,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,0,0],67:[0,.68611,0,0],68:[0,.68611,0,0],69:[0,.68611,0,0],70:[0,.68611,0,0],71:[0,.68611,0,0],72:[0,.68611,0,0],73:[0,.68611,0,0],74:[0,.68611,0,0],75:[0,.68611,0,0],76:[0,.68611,0,0],77:[0,.68611,0,0],78:[0,.68611,0,0],79:[0,.68611,0,0],80:[0,.68611,0,0],81:[.19444,.68611,0,0],82:[0,.68611,0,0],83:[0,.68611,0,0],84:[0,.68611,0,0],85:[0,.68611,0,0],86:[0,.68611,.01597,0],87:[0,.68611,.01597,0],88:[0,.68611,0,0],89:[0,.68611,.02875,0],90:[0,.68611,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.13444,.03194,0],96:[0,.69444,0,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.10903,0],103:[.19444,.44444,.01597,0],104:[0,.69444,0,0],105:[0,.69444,0,0],106:[.19444,.69444,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,0,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.01597,0],119:[0,.44444,.01597,0],120:[0,.44444,0,0],121:[.19444,.44444,.01597,0],122:[0,.44444,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.34444,0,0],168:[0,.69444,0,0],172:[0,.44444,0,0],175:[0,.59611,0,0],176:[0,.69444,0,0],177:[.13333,.63333,0,0],180:[0,.69444,0,0],215:[.13333,.63333,0,0],247:[.13333,.63333,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],710:[0,.69444,0,0],711:[0,.63194,0,0],713:[0,.59611,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.69444,0,0],730:[0,.69444,0,0],732:[0,.69444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.69444,0,0],772:[0,.59611,0,0],774:[0,.69444,0,0],775:[0,.69444,0,0],776:[0,.69444,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],824:[.19444,.69444,0,0],915:[0,.68611,0,0],916:[0,.68611,0,0],920:[0,.68611,0,0],923:[0,.68611,0,0],926:[0,.68611,0,0],928:[0,.68611,0,0],931:[0,.68611,0,0],933:[0,.68611,0,0],934:[0,.68611,0,0],936:[0,.68611,0,0],937:[0,.68611,0,0],8211:[0,.44444,.03194,0],8212:[0,.44444,.03194,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8242:[0,.55556,0,0],8407:[0,.72444,.15486,0],8463:[0,.69444,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,0],8472:[.19444,.44444,0,0],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.10889,.39111,0,0],8593:[.19444,.69444,0,0],8594:[-.10889,.39111,0,0],8595:[.19444,.69444,0,0],8596:[-.10889,.39111,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8636:[-.10889,.39111,0,0],8637:[-.10889,.39111,0,0],8640:[-.10889,.39111,0,0],8641:[-.10889,.39111,0,0],8656:[-.10889,.39111,0,0],8657:[.19444,.69444,0,0],8658:[-.10889,.39111,0,0],8659:[.19444,.69444,0,0],8660:[-.10889,.39111,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.06389,0],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68611,0,0],8712:[.08556,.58556,0,0],8715:[.08556,.58556,0,0],8722:[.13333,.63333,0,0],8723:[.13333,.63333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.02778,.47222,0,0],8728:[-.02639,.47361,0,0],8729:[-.02639,.47361,0,0],8730:[.18,.82,0,0],8733:[0,.44444,0,0],8734:[0,.44444,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.12778,0],8764:[-.10889,.39111,0,0],8768:[.19444,.69444,0,0],8771:[.00222,.50222,0,0],8776:[.02444,.52444,0,0],8781:[.00222,.50222,0,0],8801:[.00222,.50222,0,0],8804:[.19667,.69667,0,0],8805:[.19667,.69667,0,0],8810:[.08556,.58556,0,0],8811:[.08556,.58556,0,0],8826:[.08556,.58556,0,0],8827:[.08556,.58556,0,0],8834:[.08556,.58556,0,0],8835:[.08556,.58556,0,0],8838:[.19667,.69667,0,0],8839:[.19667,.69667,0,0],8846:[0,.55556,0,0],8849:[.19667,.69667,0,0],8850:[.19667,.69667,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.13333,.63333,0,0],8854:[.13333,.63333,0,0],8855:[.13333,.63333,0,0],8856:[.13333,.63333,0,0],8857:[.13333,.63333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8900:[-.02639,.47361,0,0],8901:[-.02639,.47361,0,0],8902:[-.02778,.47222,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.13889,.36111,0,0],8995:[-.13889,.36111,0,0],9651:[.19444,.69444,0,0],9657:[-.02778,.47222,0,0],9661:[.19444,.69444,0,0],9667:[-.02778,.47222,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10815:[0,.68611,0,0],10927:[.19667,.69667,0,0],10928:[.19667,.69667,0,0]},"Main-Italic":{33:[0,.69444,.12417,0],34:[0,.69444,.06961,0],35:[.19444,.69444,.06616,0],37:[.05556,.75,.13639,0],38:[0,.69444,.09694,0],39:[0,.69444,.12417,0],40:[.25,.75,.16194,0],41:[.25,.75,.03694,0],42:[0,.75,.14917,0],43:[.05667,.56167,.03694,0],44:[.19444,.10556,0,0],45:[0,.43056,.02826,0],46:[0,.10556,0,0],47:[.25,.75,.16194,0],48:[0,.64444,.13556,0],49:[0,.64444,.13556,0],50:[0,.64444,.13556,0],51:[0,.64444,.13556,0],52:[.19444,.64444,.13556,0],53:[0,.64444,.13556,0],54:[0,.64444,.13556,0],55:[.19444,.64444,.13556,0],56:[0,.64444,.13556,0],57:[0,.64444,.13556,0],58:[0,.43056,.0582,0],59:[.19444,.43056,.0582,0],61:[-.13313,.36687,.06616,0],63:[0,.69444,.1225,0],64:[0,.69444,.09597,0],65:[0,.68333,0,0],66:[0,.68333,.10257,0],67:[0,.68333,.14528,0],68:[0,.68333,.09403,0],69:[0,.68333,.12028,0],70:[0,.68333,.13305,0],71:[0,.68333,.08722,0],72:[0,.68333,.16389,0],73:[0,.68333,.15806,0],74:[0,.68333,.14028,0],75:[0,.68333,.14528,0],76:[0,.68333,0,0],77:[0,.68333,.16389,0],78:[0,.68333,.16389,0],79:[0,.68333,.09403,0],80:[0,.68333,.10257,0],81:[.19444,.68333,.09403,0],82:[0,.68333,.03868,0],83:[0,.68333,.11972,0],84:[0,.68333,.13305,0],85:[0,.68333,.16389,0],86:[0,.68333,.18361,0],87:[0,.68333,.18361,0],88:[0,.68333,.15806,0],89:[0,.68333,.19383,0],90:[0,.68333,.14528,0],91:[.25,.75,.1875,0],93:[.25,.75,.10528,0],94:[0,.69444,.06646,0],95:[.31,.12056,.09208,0],97:[0,.43056,.07671,0],98:[0,.69444,.06312,0],99:[0,.43056,.05653,0],100:[0,.69444,.10333,0],101:[0,.43056,.07514,0],102:[.19444,.69444,.21194,0],103:[.19444,.43056,.08847,0],104:[0,.69444,.07671,0],105:[0,.65536,.1019,0],106:[.19444,.65536,.14467,0],107:[0,.69444,.10764,0],108:[0,.69444,.10333,0],109:[0,.43056,.07671,0],110:[0,.43056,.07671,0],111:[0,.43056,.06312,0],112:[.19444,.43056,.06312,0],113:[.19444,.43056,.08847,0],114:[0,.43056,.10764,0],115:[0,.43056,.08208,0],116:[0,.61508,.09486,0],117:[0,.43056,.07671,0],118:[0,.43056,.10764,0],119:[0,.43056,.10764,0],120:[0,.43056,.12042,0],121:[.19444,.43056,.08847,0],122:[0,.43056,.12292,0],126:[.35,.31786,.11585,0],163:[0,.69444,0,0],305:[0,.43056,0,.02778],567:[.19444,.43056,0,.08334],768:[0,.69444,0,0],769:[0,.69444,.09694,0],770:[0,.69444,.06646,0],771:[0,.66786,.11585,0],772:[0,.56167,.10333,0],774:[0,.69444,.10806,0],775:[0,.66786,.11752,0],776:[0,.66786,.10474,0],778:[0,.69444,0,0],779:[0,.69444,.1225,0],780:[0,.62847,.08295,0],915:[0,.68333,.13305,0],916:[0,.68333,0,0],920:[0,.68333,.09403,0],923:[0,.68333,0,0],926:[0,.68333,.15294,0],928:[0,.68333,.16389,0],931:[0,.68333,.12028,0],933:[0,.68333,.11111,0],934:[0,.68333,.05986,0],936:[0,.68333,.11111,0],937:[0,.68333,.10257,0],8211:[0,.43056,.09208,0],8212:[0,.43056,.09208,0],8216:[0,.69444,.12417,0],8217:[0,.69444,.12417,0],8220:[0,.69444,.1685,0],8221:[0,.69444,.06961,0],8463:[0,.68889,0,0]},"Main-Regular":{32:[0,0,0,0],33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.19444,.10556,0,0],45:[0,.43056,0,0],46:[0,.10556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.43056,0,0],59:[.19444,.43056,0,0],60:[.0391,.5391,0,0],61:[-.13313,.36687,0,0],62:[.0391,.5391,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68333,0,0],66:[0,.68333,0,0],67:[0,.68333,0,0],68:[0,.68333,0,0],69:[0,.68333,0,0],70:[0,.68333,0,0],71:[0,.68333,0,0],72:[0,.68333,0,0],73:[0,.68333,0,0],74:[0,.68333,0,0],75:[0,.68333,0,0],76:[0,.68333,0,0],77:[0,.68333,0,0],78:[0,.68333,0,0],79:[0,.68333,0,0],80:[0,.68333,0,0],81:[.19444,.68333,0,0],82:[0,.68333,0,0],83:[0,.68333,0,0],84:[0,.68333,0,0],85:[0,.68333,0,0],86:[0,.68333,.01389,0],87:[0,.68333,.01389,0],88:[0,.68333,0,0],89:[0,.68333,.025,0],90:[0,.68333,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.12056,.02778,0],96:[0,.69444,0,0],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,0],100:[0,.69444,0,0],101:[0,.43056,0,0],102:[0,.69444,.07778,0],103:[.19444,.43056,.01389,0],104:[0,.69444,0,0],105:[0,.66786,0,0],106:[.19444,.66786,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.19444,.43056,0,0],113:[.19444,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.61508,0,0],117:[0,.43056,0,0],118:[0,.43056,.01389,0],119:[0,.43056,.01389,0],120:[0,.43056,0,0],121:[.19444,.43056,.01389,0],122:[0,.43056,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.31786,0,0],160:[0,0,0,0],168:[0,.66786,0,0],172:[0,.43056,0,0],175:[0,.56778,0,0],176:[0,.69444,0,0],177:[.08333,.58333,0,0],180:[0,.69444,0,0],215:[.08333,.58333,0,0],247:[.08333,.58333,0,0],305:[0,.43056,0,0],567:[.19444,.43056,0,0],710:[0,.69444,0,0],711:[0,.62847,0,0],713:[0,.56778,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.66786,0,0],730:[0,.69444,0,0],732:[0,.66786,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.66786,0,0],772:[0,.56778,0,0],774:[0,.69444,0,0],775:[0,.66786,0,0],776:[0,.66786,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.62847,0,0],824:[.19444,.69444,0,0],915:[0,.68333,0,0],916:[0,.68333,0,0],920:[0,.68333,0,0],923:[0,.68333,0,0],926:[0,.68333,0,0],928:[0,.68333,0,0],931:[0,.68333,0,0],933:[0,.68333,0,0],934:[0,.68333,0,0],936:[0,.68333,0,0],937:[0,.68333,0,0],8211:[0,.43056,.02778,0],8212:[0,.43056,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8230:[0,.12,0,0],8242:[0,.55556,0,0],8407:[0,.71444,.15382,0],8463:[0,.68889,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,.11111],8472:[.19444,.43056,0,.11111],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.13313,.36687,0,0],8593:[.19444,.69444,0,0],8594:[-.13313,.36687,0,0],8595:[.19444,.69444,0,0],8596:[-.13313,.36687,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8614:[.011,.511,0,0],8617:[.011,.511,0,0],8618:[.011,.511,0,0],8636:[-.13313,.36687,0,0],8637:[-.13313,.36687,0,0],8640:[-.13313,.36687,0,0],8641:[-.13313,.36687,0,0],8652:[.011,.671,0,0],8656:[-.13313,.36687,0,0],8657:[.19444,.69444,0,0],8658:[-.13313,.36687,0,0],8659:[.19444,.69444,0,0],8660:[-.13313,.36687,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.05556,.08334],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68333,0,0],8712:[.0391,.5391,0,0],8715:[.0391,.5391,0,0],8722:[.08333,.58333,0,0],8723:[.08333,.58333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.03472,.46528,0,0],8728:[-.05555,.44445,0,0],8729:[-.05555,.44445,0,0],8730:[.2,.8,0,0],8733:[0,.43056,0,0],8734:[0,.43056,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.11111,0],8764:[-.13313,.36687,0,0],8768:[.19444,.69444,0,0],8771:[-.03625,.46375,0,0],8773:[-.022,.589,0,0],8776:[-.01688,.48312,0,0],8781:[-.03625,.46375,0,0],8784:[-.133,.67,0,0],8800:[.215,.716,0,0],8801:[-.03625,.46375,0,0],8804:[.13597,.63597,0,0],8805:[.13597,.63597,0,0],8810:[.0391,.5391,0,0],8811:[.0391,.5391,0,0],8826:[.0391,.5391,0,0],8827:[.0391,.5391,0,0],8834:[.0391,.5391,0,0],8835:[.0391,.5391,0,0],8838:[.13597,.63597,0,0],8839:[.13597,.63597,0,0],8846:[0,.55556,0,0],8849:[.13597,.63597,0,0],8850:[.13597,.63597,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.08333,.58333,0,0],8854:[.08333,.58333,0,0],8855:[.08333,.58333,0,0],8856:[.08333,.58333,0,0],8857:[.08333,.58333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8872:[.249,.75,0,0],8900:[-.05555,.44445,0,0],8901:[-.05555,.44445,0,0],8902:[-.03472,.46528,0,0],8904:[.005,.505,0,0],8942:[.03,.9,0,0],8943:[-.19,.31,0,0],8945:[-.1,.82,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.14236,.35764,0,0],8995:[-.14236,.35764,0,0],9136:[.244,.744,0,0],9137:[.244,.744,0,0],9651:[.19444,.69444,0,0],9657:[-.03472,.46528,0,0],9661:[.19444,.69444,0,0],9667:[-.03472,.46528,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10222:[.244,.744,0,0],10223:[.244,.744,0,0],10229:[.011,.511,0,0],10230:[.011,.511,0,0],10231:[.011,.511,0,0],10232:[.024,.525,0,0],10233:[.024,.525,0,0],10234:[.024,.525,0,0],10236:[.011,.511,0,0],10815:[0,.68333,0,0],10927:[.13597,.63597,0,0],10928:[.13597,.63597,0,0]},"Math-BoldItalic":{47:[.19444,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,.04835,0],67:[0,.68611,.06979,0],68:[0,.68611,.03194,0],69:[0,.68611,.05451,0],70:[0,.68611,.15972,0],71:[0,.68611,0,0],72:[0,.68611,.08229,0],73:[0,.68611,.07778,0],74:[0,.68611,.10069,0],75:[0,.68611,.06979,0],76:[0,.68611,0,0],77:[0,.68611,.11424,0],78:[0,.68611,.11424,0],79:[0,.68611,.03194,0],80:[0,.68611,.15972,0],81:[.19444,.68611,0,0],82:[0,.68611,.00421,0],83:[0,.68611,.05382,0],84:[0,.68611,.15972,0],85:[0,.68611,.11424,0],86:[0,.68611,.25555,0],87:[0,.68611,.15972,0],88:[0,.68611,.07778,0],89:[0,.68611,.25555,0],90:[0,.68611,.06979,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[.19444,.69444,.11042,0],103:[.19444,.44444,.03704,0],104:[0,.69444,0,0],105:[0,.69326,0,0],106:[.19444,.69326,.0622,0],107:[0,.69444,.01852,0],108:[0,.69444,.0088,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,.03704,0],114:[0,.44444,.03194,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.03704,0],119:[0,.44444,.02778,0],120:[0,.44444,0,0],121:[.19444,.44444,.03704,0],122:[0,.44444,.04213,0],915:[0,.68611,.15972,0],916:[0,.68611,0,0],920:[0,.68611,.03194,0],923:[0,.68611,0,0],926:[0,.68611,.07458,0],928:[0,.68611,.08229,0],931:[0,.68611,.05451,0],933:[0,.68611,.15972,0],934:[0,.68611,0,0],936:[0,.68611,.11653,0],937:[0,.68611,.04835,0],945:[0,.44444,0,0],946:[.19444,.69444,.03403,0],947:[.19444,.44444,.06389,0],948:[0,.69444,.03819,0],949:[0,.44444,0,0],950:[.19444,.69444,.06215,0],951:[.19444,.44444,.03704,0],952:[0,.69444,.03194,0],953:[0,.44444,0,0],954:[0,.44444,0,0],955:[0,.69444,0,0],956:[.19444,.44444,0,0],957:[0,.44444,.06898,0],958:[.19444,.69444,.03021,0],959:[0,.44444,0,0],960:[0,.44444,.03704,0],961:[.19444,.44444,0,0],962:[.09722,.44444,.07917,0],963:[0,.44444,.03704,0],964:[0,.44444,.13472,0],965:[0,.44444,.03704,0],966:[.19444,.44444,0,0],967:[.19444,.44444,0,0],968:[.19444,.69444,.03704,0],969:[0,.44444,.03704,0],977:[0,.69444,0,0],981:[.19444,.69444,0,0],982:[0,.44444,.03194,0],1009:[.19444,.44444,0,0],1013:[0,.44444,0,0]},"Math-Italic":{47:[.19444,.69444,0,0],65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"Math-Regular":{65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"SansSerif-Regular":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.125,.08333,0,0],45:[0,.44444,0,0],46:[0,.08333,0,0],47:[.25,.75,0,0],48:[0,.65556,0,0],49:[0,.65556,0,0],50:[0,.65556,0,0],51:[0,.65556,0,0],52:[0,.65556,0,0],53:[0,.65556,0,0],54:[0,.65556,0,0],55:[0,.65556,0,0],56:[0,.65556,0,0],57:[0,.65556,0,0],58:[0,.44444,0,0],59:[.125,.44444,0,0],61:[-.13,.37,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.69444,0,0],66:[0,.69444,0,0],67:[0,.69444,0,0],68:[0,.69444,0,0],69:[0,.69444,0,0],70:[0,.69444,0,0],71:[0,.69444,0,0],72:[0,.69444,0,0],73:[0,.69444,0,0],74:[0,.69444,0,0],75:[0,.69444,0,0],76:[0,.69444,0,0],77:[0,.69444,0,0],78:[0,.69444,0,0],79:[0,.69444,0,0],80:[0,.69444,0,0],81:[.125,.69444,0,0],82:[0,.69444,0,0],83:[0,.69444,0,0],84:[0,.69444,0,0],85:[0,.69444,0,0],86:[0,.69444,.01389,0],87:[0,.69444,.01389,0],88:[0,.69444,0,0],89:[0,.69444,.025,0],90:[0,.69444,0,0],91:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.35,.09444,.02778,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.06944,0],103:[.19444,.44444,.01389,0],104:[0,.69444,0,0],105:[0,.67937,0,0],106:[.19444,.67937,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,.01389,0],115:[0,.44444,0,0],116:[0,.57143,0,0],117:[0,.44444,0,0],118:[0,.44444,.01389,0],119:[0,.44444,.01389,0],120:[0,.44444,0,0],121:[.19444,.44444,.01389,0],122:[0,.44444,0,0],126:[.35,.32659,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.67659,0,0],772:[0,.60889,0,0],774:[0,.69444,0,0],775:[0,.67937,0,0],776:[0,.67937,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],915:[0,.69444,0,0],916:[0,.69444,0,0],920:[0,.69444,0,0],923:[0,.69444,0,0],926:[0,.69444,0,0],928:[0,.69444,0,0],931:[0,.69444,0,0],933:[0,.69444,0,0],934:[0,.69444,0,0],936:[0,.69444,0,0],937:[0,.69444,0,0],8211:[0,.44444,.02778,0],8212:[0,.44444,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0]},"Script-Regular":{65:[0,.7,.22925,0],66:[0,.7,.04087,0],67:[0,.7,.1689,0],68:[0,.7,.09371,0],69:[0,.7,.18583,0],70:[0,.7,.13634,0],71:[0,.7,.17322,0],72:[0,.7,.29694,0],73:[0,.7,.19189,0],74:[.27778,.7,.19189,0],75:[0,.7,.31259,0],76:[0,.7,.19189,0],77:[0,.7,.15981,0],78:[0,.7,.3525,0],79:[0,.7,.08078,0],80:[0,.7,.08078,0],81:[0,.7,.03305,0],82:[0,.7,.06259,0],83:[0,.7,.19189,0],84:[0,.7,.29087,0],85:[0,.7,.25815,0],86:[0,.7,.27523,0],87:[0,.7,.27523,0],88:[0,.7,.26006,0],89:[0,.7,.2939,0],90:[0,.7,.24037,0]},"Size1-Regular":{40:[.35001,.85,0,0],41:[.35001,.85,0,0],47:[.35001,.85,0,0],91:[.35001,.85,0,0],92:[.35001,.85,0,0],93:[.35001,.85,0,0],123:[.35001,.85,0,0],125:[.35001,.85,0,0],710:[0,.72222,0,0],732:[0,.72222,0,0],770:[0,.72222,0,0],771:[0,.72222,0,0],8214:[-99e-5,.601,0,0],8593:[1e-5,.6,0,0],8595:[1e-5,.6,0,0],8657:[1e-5,.6,0,0],8659:[1e-5,.6,0,0],8719:[.25001,.75,0,0],8720:[.25001,.75,0,0],8721:[.25001,.75,0,0],8730:[.35001,.85,0,0],8739:[-.00599,.606,0,0],8741:[-.00599,.606,0,0],8747:[.30612,.805,.19445,0],8748:[.306,.805,.19445,0],8749:[.306,.805,.19445,0],8750:[.30612,.805,.19445,0],8896:[.25001,.75,0,0],8897:[.25001,.75,0,0],8898:[.25001,.75,0,0],8899:[.25001,.75,0,0],8968:[.35001,.85,0,0],8969:[.35001,.85,0,0],8970:[.35001,.85,0,0],8971:[.35001,.85,0,0],9168:[-99e-5,.601,0,0],10216:[.35001,.85,0,0],10217:[.35001,.85,0,0],10752:[.25001,.75,0,0],10753:[.25001,.75,0,0],10754:[.25001,.75,0,0],10756:[.25001,.75,0,0],10758:[.25001,.75,0,0]},"Size2-Regular":{40:[.65002,1.15,0,0],41:[.65002,1.15,0,0],47:[.65002,1.15,0,0],91:[.65002,1.15,0,0],92:[.65002,1.15,0,0],93:[.65002,1.15,0,0],123:[.65002,1.15,0,0],125:[.65002,1.15,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8719:[.55001,1.05,0,0],8720:[.55001,1.05,0,0],8721:[.55001,1.05,0,0],8730:[.65002,1.15,0,0],8747:[.86225,1.36,.44445,0],8748:[.862,1.36,.44445,0],8749:[.862,1.36,.44445,0],8750:[.86225,1.36,.44445,0],8896:[.55001,1.05,0,0],8897:[.55001,1.05,0,0],8898:[.55001,1.05,0,0],8899:[.55001,1.05,0,0],8968:[.65002,1.15,0,0],8969:[.65002,1.15,0,0],8970:[.65002,1.15,0,0],8971:[.65002,1.15,0,0],10216:[.65002,1.15,0,0],10217:[.65002,1.15,0,0],10752:[.55001,1.05,0,0],10753:[.55001,1.05,0,0],10754:[.55001,1.05,0,0],10756:[.55001,1.05,0,0],10758:[.55001,1.05,0,0]},"Size3-Regular":{40:[.95003,1.45,0,0],41:[.95003,1.45,0,0],47:[.95003,1.45,0,0],91:[.95003,1.45,0,0],92:[.95003,1.45,0,0],93:[.95003,1.45,0,0],123:[.95003,1.45,0,0],125:[.95003,1.45,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8730:[.95003,1.45,0,0],8968:[.95003,1.45,0,0],8969:[.95003,1.45,0,0],8970:[.95003,1.45,0,0],8971:[.95003,1.45,0,0],10216:[.95003,1.45,0,0],10217:[.95003,1.45,0,0]},"Size4-Regular":{40:[1.25003,1.75,0,0],41:[1.25003,1.75,0,0],47:[1.25003,1.75,0,0],91:[1.25003,1.75,0,0],92:[1.25003,1.75,0,0],93:[1.25003,1.75,0,0],123:[1.25003,1.75,0,0],125:[1.25003,1.75,0,0],710:[0,.825,0,0],732:[0,.825,0,0],770:[0,.825,0,0],771:[0,.825,0,0],8730:[1.25003,1.75,0,0],8968:[1.25003,1.75,0,0],8969:[1.25003,1.75,0,0],8970:[1.25003,1.75,0,0],8971:[1.25003,1.75,0,0],9115:[.64502,1.155,0,0],9116:[1e-5,.6,0,0],9117:[.64502,1.155,0,0],9118:[.64502,1.155,0,0],9119:[1e-5,.6,0,0],9120:[.64502,1.155,0,0],9121:[.64502,1.155,0,0],9122:[-99e-5,.601,0,0],9123:[.64502,1.155,0,0],9124:[.64502,1.155,0,0],9125:[-99e-5,.601,0,0],9126:[.64502,1.155,0,0],9127:[1e-5,.9,0,0],9128:[.65002,1.15,0,0],9129:[.90001,0,0,0],9130:[0,.3,0,0],9131:[1e-5,.9,0,0],9132:[.65002,1.15,0,0],9133:[.90001,0,0,0],9143:[.88502,.915,0,0],10216:[1.25003,1.75,0,0],10217:[1.25003,1.75,0,0],57344:[-.00499,.605,0,0],57345:[-.00499,.605,0,0],57680:[0,.12,0,0],57681:[0,.12,0,0],57682:[0,.12,0,0],57683:[0,.12,0,0]},"Typewriter-Regular":{33:[0,.61111,0,0],34:[0,.61111,0,0],35:[0,.61111,0,0],36:[.08333,.69444,0,0],37:[.08333,.69444,0,0],38:[0,.61111,0,0],39:[0,.61111,0,0],40:[.08333,.69444,0,0],41:[.08333,.69444,0,0],42:[0,.52083,0,0],43:[-.08056,.53055,0,0],44:[.13889,.125,0,0],45:[-.08056,.53055,0,0],46:[0,.125,0,0],47:[.08333,.69444,0,0],48:[0,.61111,0,0],49:[0,.61111,0,0],50:[0,.61111,0,0],51:[0,.61111,0,0],52:[0,.61111,0,0],53:[0,.61111,0,0],54:[0,.61111,0,0],55:[0,.61111,0,0],56:[0,.61111,0,0],57:[0,.61111,0,0],58:[0,.43056,0,0],59:[.13889,.43056,0,0],60:[-.05556,.55556,0,0],61:[-.19549,.41562,0,0],62:[-.05556,.55556,0,0],63:[0,.61111,0,0],64:[0,.61111,0,0],65:[0,.61111,0,0],66:[0,.61111,0,0],67:[0,.61111,0,0],68:[0,.61111,0,0],69:[0,.61111,0,0],70:[0,.61111,0,0],71:[0,.61111,0,0],72:[0,.61111,0,0],73:[0,.61111,0,0],74:[0,.61111,0,0],75:[0,.61111,0,0],76:[0,.61111,0,0],77:[0,.61111,0,0],78:[0,.61111,0,0],79:[0,.61111,0,0],80:[0,.61111,0,0],81:[.13889,.61111,0,0],82:[0,.61111,0,0],83:[0,.61111,0,0],84:[0,.61111,0,0],85:[0,.61111,0,0],86:[0,.61111,0,0],87:[0,.61111,0,0],88:[0,.61111,0,0],89:[0,.61111,0,0],90:[0,.61111,0,0],91:[.08333,.69444,0,0],92:[.08333,.69444,0,0],93:[.08333,.69444,0,0],94:[0,.61111,0,0],95:[.09514,0,0,0],96:[0,.61111,0,0],97:[0,.43056,0,0],98:[0,.61111,0,0],99:[0,.43056,0,0],100:[0,.61111,0,0],101:[0,.43056,0,0],102:[0,.61111,0,0],103:[.22222,.43056,0,0],104:[0,.61111,0,0],105:[0,.61111,0,0],106:[.22222,.61111,0,0],107:[0,.61111,0,0],108:[0,.61111,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.22222,.43056,0,0],113:[.22222,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.55358,0,0],117:[0,.43056,0,0],118:[0,.43056,0,0],119:[0,.43056,0,0],120:[0,.43056,0,0],121:[.22222,.43056,0,0],122:[0,.43056,0,0],123:[.08333,.69444,0,0],124:[.08333,.69444,0,0],125:[.08333,.69444,0,0],126:[0,.61111,0,0],127:[0,.61111,0,0],305:[0,.43056,0,0],567:[.22222,.43056,0,0],768:[0,.61111,0,0],769:[0,.61111,0,0],770:[0,.61111,0,0],771:[0,.61111,0,0],772:[0,.56555,0,0],774:[0,.61111,0,0],776:[0,.61111,0,0],778:[0,.61111,0,0],780:[0,.56597,0,0],915:[0,.61111,0,0],916:[0,.61111,0,0],920:[0,.61111,0,0],923:[0,.61111,0,0],926:[0,.61111,0,0],928:[0,.61111,0,0],931:[0,.61111,0,0],933:[0,.61111,0,0],934:[0,.61111,0,0],936:[0,.61111,0,0],937:[0,.61111,0,0],2018:[0,.61111,0,0],2019:[0,.61111,0,0],8242:[0,.61111,0,0]}};const v=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,w={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25]},S={defaultRuleThickness:.04,bigOpSpacing1:.111,bigOpSpacing2:.166,bigOpSpacing3:.2,bigOpSpacing4:.6,bigOpSpacing5:.1,ptPerEm:10,pxPerEm:40/3,doubleRuleSep:.2,arraycolsep:.5,baselineskip:1.2,arrayrulewidth:.04,fboxsep:.3,fboxrule:.04},A={" ":" ","​":" ","Å":"A","Ç":"C","Ð":"D","Þ":"o","å":"a","ç":"c","ð":"d","þ":"o","А":"A","Б":"B","В":"B","Г":"F","Д":"A","Е":"E","Ж":"K","З":"3","И":"N","Й":"N","К":"K","Л":"N","М":"M","Н":"H","О":"O","П":"N","Р":"P","С":"C","Т":"T","У":"y","Ф":"O","Х":"X","Ц":"U","Ч":"h","Ш":"W","Щ":"W","Ъ":"B","Ы":"X","Ь":"B","Э":"3","Ю":"X","Я":"R","а":"a","б":"b","в":"a","г":"r","д":"y","е":"e","ж":"m","з":"e","и":"n","й":"n","к":"n","л":"n","м":"m","н":"n","о":"o","п":"n","р":"p","с":"c","т":"o","у":"y","ф":"b","х":"x","ц":"n","ч":"n","ш":"w","щ":"w","ъ":"a","ы":"m","ь":"a","э":"e","ю":"m","я":"r"};function C(t,e,i){if("string"==typeof t){const i=t.match(/([-+]?[0-9.]*)\s*([a-zA-Z]+)/);i?(t=parseFloat(i[1]),e=i[2].toLowerCase()):t=parseFloat(t)}const s={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:.75,em:S.ptPerEm,bp:1.00375,dd:1238/1157,pc:12,in:72.27,mu:10/18}[e]||1;if(isFinite(i)){const e=Math.pow(10,i);return Math.round(t/S.ptPerEm*s*e)/e}return t/S.ptPerEm*s}var M={toEm:C,toPx:function(t,e){return C(t,e)*(4/3)*S.ptPerEm},METRICS:S,SIGMAS:w,getCharacterMetrics:function(t,e){const i={cal:"Caligraphic-Regular",ams:"AMS-Regular",frak:"Fraktur-Regular",bb:"AMS-Regular",scr:"Script-Regular",cmr:"Main-Regular",cmtt:"Typewriter-Regular",cmss:"SansSerif-Regular"}[e]||e;let s=t.charCodeAt(0);t[0]in A?s=A[t[0]].charCodeAt(0):v.test(t[0])&&(s=77);const a=k[i][s];return a?a?{depth:a[0],height:a[1],italic:a[2],skew:a[3]}:null:{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0}}};const _=[{},{},{}];let T;for(const t in w)if(w.hasOwnProperty(t))for(T=0;T<3;T++)_[T][t]=w[t][T];for(T=0;T<3;T++)_[T].emPerEx=w.xHeight[T]/w.quad[T];class L{constructor(t,e,i,s){this.id=t,this.size=e,this.cramped=s,this.sizeMultiplier=i,this.metrics=_[e>0?e-1:0]}sup(){return F[E[this.id]]}sub(){return F[q[this.id]]}fracNum(){return F[P[this.id]]}fracDen(){return F[I[this.id]]}cramp(){return F[B[this.id]]}cls(){return z[this.size]}adjustTo(t){let e=D[this.size][t.size];return e.length>0&&(e=" "+e),e}isTight(){return this.size>=2}}const F=[new L(0,0,1,!1),new L(1,0,1,!0),new L(2,1,1,!1),new L(3,1,1,!0),new L(4,2,.7,!1),new L(5,2,.7,!0),new L(6,3,.5,!1),new L(7,3,.5,!0)],z=["displaystyle textstyle","textstyle","scriptstyle","scriptscriptstyle"],D=[["","","reset-textstyle scriptstyle","reset-textstyle scriptscriptstyle"],["reset-textstyle displaystyle textstyle","","reset-textstyle scriptstyle","reset-textstyle scriptscriptstyle"],["reset-scriptstyle textstyle displaystyle","reset-scriptstyle textstyle","","reset-scriptstyle scriptscriptstyle"],["reset-scriptscriptstyle textstyle displaystyle","reset-scriptscriptstyle textstyle","reset-scriptscriptstyle scriptstyle",""]],E=[4,5,4,5,6,7,6,7],q=[5,5,5,5,7,7,7,7],P=[2,3,4,5,6,7,6,7],I=[3,3,5,5,7,7,7,7],B=[1,1,3,3,5,5,7,7];var O={DISPLAY:F[0],TEXT:F[2],SCRIPT:F[4],SCRIPTSCRIPT:F[6],toMathstyle:function(t){return t?"object"==typeof t?t:{displaystyle:F[0],textstyle:F[2],scriptstyle:F[4],scriptscriptstyle:F[6]}[t]:t}};class R{constructor(t){this.macros=t.macros||{},this.generateID=!!t.generateID&&t.generateID,this.mathstyle=O.toMathstyle(t.mathstyle||"displaystyle"),this.size=t.size||"size5",this.parentMathstyle=t.parentMathstyle||this.mathstyle,this.parentSize=t.parentSize||this.size,this.opacity=t.opacity}clone(t){const e=new R(this);return e.parentMathstyle=this.mathstyle,e.parentSize=this.size,e.macros=this.macros,t&&("auto"!==t.mathstyle&&t.mathstyle||delete t.mathstyle,Object.assign(e,t),"string"==typeof t.mathstyle&&(e.mathstyle=O.toMathstyle(t.mathstyle))),e}setMathstyle(t){t&&"auto"!==t&&(this.mathstyle=O.toMathstyle(t))}cramp(){return this.clone({mathstyle:this.mathstyle.cramp()})}sup(){return this.clone({mathstyle:this.mathstyle.sup()})}sub(){return this.clone({mathstyle:this.mathstyle.sup()})}}var K={Context:R};function N(t){let e="";if("number"==typeof t)e+=Math.floor(100*t)/100;else if("string"==typeof t)e+=t;else if(Array.isArray(t))for(const i of t)e+=N(i);else t&&(e+=t.toString());return e}class ${constructor(t,e){this.classes=e||"",Array.isArray(t)?this.children=[].concat.apply([],t):"string"==typeof t?this.body=t:t&&"object"==typeof t&&(this.children=[t]),this.style=null,this.updateDimensions()}updateDimensions(){let t=0,e=0,i=1;this.children&&this.children.forEach(s=>{s.height>t&&(t=s.height),s.depth>e&&(e=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}),this.height=t,this.depth=e,this.maxFontSize=i}selected(t){t&&!/ML__selected/.test(this.classes)&&(this.classes.length>0&&(this.classes+=" "),this.classes+="ML__selected"),!t&&/ML__selected/.test(this.classes)&&(this.classes=this.classes.replace("ML__selected","")),this.children&&this.children.forEach(e=>e.selected(t))}applyStyle(t){if(!t)return;if(t.color&&("none"!==t.color?this.setStyle("color",t.color):this.setStyle("color","")),t.backgroundColor&&("none"!==t.backgroundColor?this.setStyle("background-color",t.backgroundColor):this.setStyle("background-color","")),t.cssClass&&(this.classes+=" "+t.cssClass),!this.body)return;let e=t.fontFamily;"math"===e&&"n"===t.fontShape&&(e="cmr");let i="Main-Regular";if(e&&(i=function(t,e){if("string"!=typeof t||t.length>1||"​"===t)return Q[e];if("bb"===e||"scr"===e){if(!/^[A-Z ]$/.test(t))return null}else if("cal"===e){if(!/^[0-9A-Z ]$/.test(t))return null}else if("frak"===e){if(!/^[0-9A-Za-z ]$|^[!"#$%&'()*+,\-.\/:;=?[]^’‘]$/.test(t))return null}else if(("cmtt"===e||"cmss"===e)&&!/^[0-9A-Za-z ]$|^[!"&'()*+,\-.\/:;=?@[]^_~\u0131\u0237\u0393\u0394\u0398\u039b\u039e\u03A0\u03A3\u03A5\u03A8\u03a9’‘]$/.test(t))return null;return Q[e]}(this.body,e)),t.fontShape&&(this.classes+=" "+({it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[t.fontShape]||"")),t.fontSeries){const e=t.fontSeries.match(/(.?[lbm])?(.?[cx])?/);e&&(this.classes+=" "+({ul:"ML__series_ul",el:"ML__series_el",l:"ML__series_l",sl:"ML__series_sl",m:"",sb:"ML__series_sb",b:"ML__bold",eb:"ML__series_eb",ub:"ML__series_ub"}[e[1]||""]||""),this.classes+=" "+({uc:"ML__series_uc",ec:"ML__series_ec",c:"ML__series_c",sc:"ML__series_sc",n:"",sx:"ML__series_sx",x:"ML__series_x",ex:"ML__series_ex",ux:"ML__series_ux"}[e[2]||""]||""))}if(tt[e]?this.classes+=" "+tt[e]:e&&this.setStyle("font-family",e),this.body&&this.body.length>0&&i){this.height=0,this.depth=0,this.maxFontSize={size1:.5,size2:.7,size3:.8,size4:.9,size5:1,size6:1.2,size7:1.44,size8:1.73,size9:2.07,size10:2.49}[t.fontSize]||1,this.skew=0,this.italic=0;for(let t=0;t0&&(this.style||(this.style={}),this.style[t]=i)}setTop(t){t&&0!==t&&(this.style||(this.style={}),this.style.top=N(t)+"em",this.height-=t,this.depth+=t)}setLeft(t){t&&0!==t&&(this.style||(this.style={}),this.style["margin-left"]=N(t)+"em")}setRight(t){t&&0!==t&&(this.style||(this.style={}),this.style["margin-right"]=N(t)+"em")}setWidth(t){t&&0!==t&&(this.style||(this.style={}),this.style.width=N(t)+"em")}addMarginRight(t){if(t&&0!==t){if(!this.style&&!/qquad|quad|enspace|thickspace|mediumspace|thinspace|negativethinspace/.test(this.classes)){const e={2:"qquad",1:"quad",".5":"enspace",.277778:"thickspace",.222222:"mediumspace",.166667:"thinspace","-0.166667":"negativethinspace"}[t.toString()];if(e)return void(this.classes+=" rspace "+e)}this.style||(this.style={});const e=parseFloat(this.style["margin-right"]||"0");this.style["margin-right"]=N(e+t)+"em"}}toMarkup(t,e){t=t||0,e=e||1;let i="",s=this.body||"";if(this.children){let t="none";for(const i of this.children){let a=0;if(t){let s=i.type;s&&("textord"===s&&(s="mord"),"first"===s&&(s="none"),a=i.isTight?U[t+"+"+s]||0:W[t+"+"+s]||0,a=Math.floor(e*a))}s+=i.toMarkup(a,e),t=j(i)}}if("​"!==s&&s||this.classes&&"ML__selected"!==this.classes){if(i="1?e.filter(function(t,e,i){return t.length>0&&i.indexOf(t)===e}).join(" "):e[0]).length>0&&(i+=' class="'+a+'"'),t&&(this.style&&this.style["margin-left"]?this.style["margin-left"]=N(parseFloat(this.style["margin-left"])+t/18)+"em":t<0&&V[-t]?s=V[-t]+s:H[t]?s=H[t]+s:(this.style||(this.style={}),this.style["margin-left"]=N(t/18)+"em")),this.style){let t="";const e=/ML__selected/.test(this.classes);for(const i in this.style)this.style.hasOwnProperty(i)&&("background-color"===i&&e||(t+=i+":"+this.style[i]+";"));t.length>0&&(i+=' style="'+t+'"')}i+=">",this.svgOverlay?(i+='",i+=""):i+=s,i+=""}else i="";return this.caret&&"command"!==this.type&&("text"===this.caret?i+='':i+=''),i}tryCoalesceWith(t){if(this.tag!==t.tag)return!1;if(this.type!==t.type)return!1;if("error"===this.type||"placeholder"===this.type||"command"===this.type)return!1;const e=this.children&&this.children.length>0,i=t.children&&t.children.length>0;if(e||i)return!1;if((this.style?this.style.length:0)!==(t.style?t.style.length:0))return!1;const s=this.classes.trim().replace(/\s+/g," ").split(" "),a=t.classes.trim().replace(/\s+/g," ").split(" ");if(s.length!==a.length)return!1;s.sort(),a.sort();for(let t=0;tMath.max(t,e.height),0):t.height:0}function Z(t){return t?Array.isArray(t)?t.reduce((t,e)=>Math.max(t,e.depth),0):t.depth:0}function X(t,e){if(Array.isArray(t)){const i=[];for(const e of t)e&&i.push(e);if(1===i.length)return X(i[0],e)}return new $(t,e)}function J(t,e,i){const s=X(e,i);return s.type=t,s}function Y(t,e){if(!e||0===e.length){if(t instanceof $)return t;if(Array.isArray(t)&&1===t.length)return t[0]}const i=new $(t,e);let s=1;return s=t instanceof $?t.maxFontSize:t.reduce((t,e)=>Math.max(t,e.maxFontSize),0),i.height*=s,i.depth*=s,i}const Q={ams:"AMS-Regular",bb:"AMS-Regular",cal:"Caligraphic-Regular",frak:"Fraktur-Regular",scr:"Script-Regular",cmr:"Main-Regular",cmss:"SansSerif-Regular",cmtt:"Typewriter-Regular",math:"Math-Regular",mainit:"Main-Italic"},tt={ams:"ML__ams",bb:"ML__bb",cal:"ML__cal",frak:"ML__frak",scr:"ML__script",cmr:"ML__mathrm",cmss:"ML__sans",cmtt:"ML__tt",math:"ML__mathit",mainit:"ML__mainit"};var et={coalesce:function t(e){if(!e||0===e.length)return[];e[0].children=t(e[0].children);const i=[e[0]];for(let s=1;s0?"em":""),s.attributes={"aria-hidden":!0}),"size5"!==t.size?new $(s,"fontsize-ensurer reset-"+t.size+" size5"):0!==i?s:null}(t),l=[];o=a;for(const t of e)if("number"==typeof t)o+=t;else{const e=X([r,t]);e.setTop(-t.depth-o),l.push(e),o+=t.height+t.depth}const c=X(l,"vlist");return c.depth=Math.max(a,Z(c)||0),c.height=Math.max(-o,G(c)||0),c},makeHlist:Y,makeStyleWrap:function(t,e,i,s,a){a=a||"";const o=Y(e,(a+=" style-wrap ")+i.adjustTo(s));o.type=t;const n=s.sizeMultiplier/i.sizeMultiplier;return o.height*=n,o.depth*=n,o.maxFontSize=s.sizeMultiplier,o},makeSVG:function(t,e,i){return t.svgOverlay=e,t.svgStyle=i,t},height:G,depth:Z,skew:function(t){if(!t)return 0;if(Array.isArray(t)){let e=0;for(const i of t)e+=i.skew||0;return e}return t.skew},italic:function(t){return t?Array.isArray(t)?t[t.length-1].italic:t.italic:0}};let it="";const st={},at={},ot={},nt="CRYPTIC",rt="COMMON",lt="SUPERCOMMON",ct={CRYPTIC:0,ARCANE:200,VERY_RARE:600,RARE:1200,UNCOMMON:2e3,COMMON:3e3,SUPERCOMMON:4e3};function ht(t,...e){const i="string"==typeof t?ct[t]:t;for(const t of e)st[t]&&(st[t].frequency=i),at[t]&&(at[t]=Object.assign({},at[t]),at[t].frequency=i)}function dt(t,e,i,s,a){e&&/^(ams|cmr|bb|cal|frak|scr)$/.test(e),"string"==typeof a&&(a=ct[a]),st[t]={type:i===kt?vt:i,baseFontFamily:e,value:s,category:it,frequency:a}}function pt(t,e){for(let i=t;i<=e;i++){const t=String.fromCodePoint(i);dt(t,"","mord",t)}}const mt={8739:"|",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",8243:"\\doubleprime",8736:"\\angle",8450:"\\C",8469:"\\N",8473:"\\P",8474:"\\Q",8477:"\\R",8484:"\\Z"};function ut(t,e){const i=String.fromCodePoint(e);if("math"===t&&mt[i])return mt[i];if(e>32&&e<127)return i;let s="";if("math"===t){for(const t in st)if(st.hasOwnProperty(t)&&st[t].value===i){s=t;break}}else for(const t in qt)if(qt.hasOwnProperty(t)&&qt[t]===i){s=t;break}return s||i}const ft={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},gt=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120782,len:10,offset:48,variant:"",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function yt(t){let e=t;if("string"==typeof t&&(e=t.codePointAt(0)),(e<119808||e>120831)&&(e<8448||e>8527))return{char:t};for(const t in ft)if(ft.hasOwnProperty(t)&&ft[t]===e){e=t;break}for(let t=0;t=gt[t].start&&et.body).join("")}function Ft(t,e,i,s){"string"==typeof t&&(t=[t]),i||(i={});const a=Tt(e),o={category:it,params:a,parser:s,mathstyle:"displaystyle",tabular:i.tabular||!0,colFormat:i.colFormat||[]};for(const e of t)ot[e]=o}function zt(t,e,i,s){"string"==typeof t&&(t=[t]),i||(i={});const a={category:it,baseFontFamily:i.fontFamily,params:Tt(e),allowedInText:!!i.allowedInText,infix:!!i.infix,parse:s};for(const e of t)at[e]=a}it="Environments",Ft("math","",{frequency:0},function(){return{mathstyle:"textstyle"}}),Ft("displaymath","",{frequency:8},function(){return{mathstyle:"displaystyle"}}),Ft("array","{columns:colspec}",{frequency:rt},function(t,e){return{colFormat:e[0],mathstyle:"textstyle"}}),Ft("eqnarray","",{},function(){return{}}),Ft("equation","",{},function(){return{colFormat:[{align:"c"}]}}),Ft("subequations","",{},function(){return{colFormat:[{align:"c"}]}}),Ft("multline","",{},function(){return{firstRowFormat:[{align:"l"}],colFormat:[{align:"c"}],lastRowFormat:[{align:"r"}]}}),Ft(["align","aligned"],"",{},function(t,e,i){let s=0;for(const t of i)s=Math.max(s,t.length);const a=[{gap:0},{align:"r"},{gap:0},{align:"l"}];let o=2;for(;o({color:e[0]})),zt("\\textcolor","{:color}{content:auto*}",{allowedInText:!0},(t,e)=>({color:e[0]})),ht(3,"\\textcolor"),zt("\\overline","{:auto}",null,function(t,e){return{type:"line",position:"overline",skipBoundary:!0,body:e[0]}}),ht(rt,"\\overline"),zt("\\underline","{:auto}",null,function(t,e){return{type:"line",position:"underline",skipBoundary:!0,body:e[0]}}),ht(rt,"\\underline"),zt("\\overset","{annotation:auto}{symbol:auto}",null,function(t,e){return{type:"overunder",overscript:e[0],skipBoundary:!0,body:e[1]}}),ht(rt,"\\overset"),zt("\\underset","{annotation:auto}{symbol:auto}",null,function(t,e){return{type:"overunder",underscript:e[0],skipBoundary:!0,body:e[1]}}),ht(rt,"\\underset"),zt(["\\stackrel","\\stackbin"],"{annotation:auto}{symbol:auto}",null,function(t,e){return{type:"overunder",overscript:e[0],skipBoundary:!0,body:e[1],mathtype:"\\stackrel"===t?"mrel":"mbin"}}),ht(rt,"\\stackrel"),ht(0,"\\stackbin"),zt("\\rlap","{:auto}",null,function(t,e){return{type:"overlap",align:"right",skipBoundary:!0,body:e[0]}}),ht(270,"\\rlap"),zt("\\llap","{:auto}",null,function(t,e){return{type:"overlap",align:"left",skipBoundary:!0,body:e[0]}}),ht(18,"\\llap"),zt("\\mathrlap","{:auto}",null,function(t,e){return{type:"overlap",mode:"math",align:"right",skipBoundary:!0,body:e[0]}}),ht(nt,"\\mathrlap"),zt("\\mathllap","{:auto}",null,function(t,e){return{type:"overlap",mode:"math",align:"left",skipBoundary:!0,body:e[0]}}),ht(nt,"\\mathllap"),zt("\\boxed","{content:math}",null,function(t,e){return{type:"box",framecolor:"black",skipBoundary:!0,body:e[0]}}),ht(1236,"\\boxed"),zt("\\colorbox","{background-color:color}{content:auto}",{allowedInText:!0},function(t,e){return{type:"box",backgroundcolor:e[0],skipBoundary:!0,body:e[1]}}),ht(nt,"\\colorbox"),zt("\\fcolorbox","{frame-color:color}{background-color:color}{content:auto}",{allowedInText:!0},function(t,e){return{type:"box",framecolor:e[0],backgroundcolor:e[1],skipBoundary:!0,body:e[2]}}),ht(nt,"\\fcolorbox"),zt("\\bbox","[:bbox]{body:auto}",{allowedInText:!0},function(t,e){return e[0]?{type:"box",padding:e[0].padding,border:e[0].border,backgroundcolor:e[0].backgroundcolor,skipBoundary:!0,body:e[1]}:{type:"box",skipBoundary:!0,body:e[1]}}),ht(nt,"\\bbox"),zt("\\enclose","{notation:string}[style:string]{body:auto}",null,function(t,e){let i=e[0]||[];const s={type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"auto",captureSelection:!0,body:e[2]};if(e[1]){const t=e[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const e of t){const t=e.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(t)s.strokeWidth=M.toPx(t[1],"px"),isFinite(s.strokeWidth)||(s.strokeWidth=1),s.strokeStyle=t[2],s.strokeColor=t[3];else{const t=e.match(/\s*([a-z]*)\s*=\s*"(.*)"/);t&&("mathbackground"===t[1]?s.backgroundcolor=t[2]:"mathcolor"===t[1]?s.strokeColor=t[2]:"padding"===t[1]?s.padding=M.toPx(t[2],"px"):"shadow"===t[1]&&(s.shadow=t[2]))}}"dashed"===s.strokeStyle?s.svgStrokeStyle="5,5":"dotted"===s.strokeStyle&&(s.svgStrokeStyle="1,5")}s.borderStyle=s.strokeWidth+"px "+s.strokeStyle+" "+s.strokeColor,i=i.toString().split(/[, ]/).filter(t=>t.length>0).map(t=>t.toLowerCase()),s.notation={};for(const t of i)s.notation[t]=!0;return s.notation.updiagonalarrow&&(s.notation.updiagonalstrike=!1),s.notation.box&&(s.notation.left=!1,s.notation.right=!1,s.notation.bottom=!1,s.notation.top=!1),s}),ht(nt,"\\enclose"),zt("\\cancel","{body:auto}",null,function(t,e){return{type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"auto",notation:{updiagonalstrike:!0},body:e[0]}}),zt("\\bcancel","{body:auto}",null,function(t,e){return{type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"auto",notation:{downdiagonalstrike:!0},body:e[0]}}),zt("\\xcancel","{body:auto}",null,function(t,e){return{type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"auto",notation:{updiagonalstrike:!0,downdiagonalstrike:!0},body:e[0]}}),ht(nt,"\\cancel","\\bcancel","\\xcancel"),it="Styling",zt(["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],"",{allowedInText:!0},function(t,e){return{fontSize:{tiny:"size1",scriptsize:"size2",footnotesize:"size3",small:"size4",normalsize:"size5",large:"size6",Large:"size7",LARGE:"size8",huge:"size9",Huge:"size10"}[t.slice(1)]}}),zt("\\fontseries","{:text}",{allowedInText:!0},(t,e)=>({fontSeries:Lt(e[0])})),zt("\\bf","",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),zt("\\bm","{:math*}",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),zt("\\bold","",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"b"})),zt(["\\mathbf","\\boldsymbol"],"{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"b",fontShape:"n"})),zt("\\bfseries","",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),zt("\\textbf","{:text*}",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),zt("\\mathmd","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"m",fontShape:"n"})),zt("\\mdseries","",{allowedInText:!0},(t,e)=>({fontSeries:"m"})),zt("\\textmd","{:math*}",{allowedInText:!0},(t,e)=>({fontSeries:"m"})),zt("\\fontshape","{:text}",{allowedInText:!0},(t,e)=>({fontShape:Lt(e[0])})),zt("\\it","",{allowedInText:!0},(t,e)=>({fontShape:"it"})),zt("\\mathit","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"m",fontShape:"it"})),zt("\\upshape","",{allowedInText:!0},(t,e)=>({fontShape:"n"})),zt("\\textup","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"n"})),zt("\\textit","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"it"})),zt("\\slshape","",{allowedInText:!0},(t,e)=>({fontShape:"sl"})),zt("\\textsl","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"sl"})),zt("\\scshape","",{allowedInText:!0},(t,e)=>({mode:"text",fontShape:"sc"})),zt("\\textsc","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"sc"})),zt("\\fontfamily","{:text}",{allowedInText:!0},(t,e)=>({fontFamily:Lt(e[0])})),zt("\\mathrm","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontFamily:"cmr",fontSeries:"m",fontShape:"n"})),zt("\\rmfamily","",{allowedInText:!0},(t,e)=>({fontFamily:"cmr"})),zt("\\textrm","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmr"})),zt("\\mathsf","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"cmss",fontSeries:"m",fontShape:"n"})),zt("\\sffamily","",{allowedInText:!0},(t,e)=>({fontFamily:"cmss"})),zt("\\textsf","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmss"})),zt("\\mathtt","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"cmtt",fontSeries:"m",fontShape:"n"})),zt("\\ttfamily","",{allowedInText:!0},(t,e)=>({fontFamily:"cmtt"})),zt("\\texttt","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmtt"})),zt(["\\Bbb","\\mathbb"],"{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"bb"})),zt(["\\frak","\\mathfrak"],"{:math*}",{allowedInText:!0},(t,e)=>({baseFontFamily:"frak"})),zt("\\mathcal","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"cal",fontSeries:"m",fontShape:"n"})),zt("\\mathscr","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"scr",fontSeries:"m",fontShape:"n"})),ht(lt,"\\mathbb"),ht(1081,"\\Bbb"),ht(0,"\\mathcal"),ht(rt,"\\mathfrak"),ht(271,"\\frak"),ht(rt,"\\mathscr"),ht("UNCOMMON","\\mathsf"),ht(rt,"\\mathtt"),ht(rt,"\\boldsymbol"),zt("\\textnormal","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmr",fontShape:"n",fontSeries:"n"})),zt("\\mbox","{:text*}",null,(t,e)=>({fontFamily:"cmr"})),zt("\\text","{:text*}",{allowedInText:!0},(t,e)=>({})),zt("\\class","{name:text}{content:auto*}",{allowedInText:!0},(t,e)=>({cssClass:Lt(e[0])})),zt("\\cssId","{id:text}{content:auto}",{allowedInText:!0},(t,e)=>({cssId:Lt(e[0]),body:e[1],type:"group"})),zt("\\em","",{allowedInText:!0},(t,e)=>({cssClass:"ML__emph",type:"group"})),zt("\\emph","{:auto}",{allowedInText:!0},(t,e)=>({cssClass:"ML__emph",body:e[0],type:"group",skipBoundary:!0})),ht(rt,"\\textrm"),ht(rt,"\\textit"),ht(rt,"\\textsf"),ht(rt,"\\texttt"),ht(433,"\\textnormal"),ht(rt,"\\textbf"),ht(421,"\\textup"),ht(819,"\\emph"),ht(49,"\\em"),it="Operators",zt("\\sqrt","[index:auto]{radicand:auto}",null,function(t,e){return{type:"surd",body:e[1],index:e[0]}}),ht(lt,"\\sqrt"),it="Fractions",zt(["\\frac","\\dfrac","\\tfrac","\\cfrac","\\binom","\\dbinom","\\tbinom"],"{numerator}{denominator}",null,function(t,e){const i={type:"genfrac",numer:e[0],denom:e[1],mathstyle:"auto"};switch(t){case"\\dfrac":case"\\frac":case"\\tfrac":case"\\cfrac":i.hasBarLine=!0;break;case"\\\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")"}switch(t){case"\\dfrac":case"\\dbinom":i.mathstyle="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyle="textstyle"}return"\\cfrac"===t&&(i.continuousFraction=!0),i}),zt(["\\over","\\atop","\\choose"],"",{infix:!0},function(t,e){const i=e[0],s=e[1];let a=!1,o=null,n=null;switch(t){case"\\atop":break;case"\\over":a=!0;break;case"\\choose":a=!1,o="(",n=")";break;default:throw new Error("Unrecognized genfrac command")}return{type:"genfrac",numer:i,denom:s,hasBarLine:a,leftDelim:o,rightDelim:n,mathstyle:"auto"}}),ht(21,"\\over"),ht(12,"\\atop"),ht(1968,"\\choose"),zt(["\\overwithdelims","\\atopwithdelims"],"{left-delim:delim}{right-delim:delim}",{infix:!0},function(t,e){return{type:"genfrac",numer:e[0],denom:e[1],hasBarLine:!1,leftDelim:e[2],rightDelim:e[3],mathstyle:"auto"}}),ht(15,"\\overwithdelims"),ht(rt,"\\atopwithdelims"),it="Fractions",zt("\\pdiff","{numerator}{denominator}",null,function(t,e){return{type:"genfrac",numer:e[0],denom:e[1],numerPrefix:"∂",denomPrefix:"∂",hasBarLine:!0,leftDelim:null,rightDelim:null,mathstyle:"auto"}}),it="Quantifiers",dt("\\forall","",vt,"∀",lt),dt("\\exists","",vt,"∃",lt),dt("\\nexists",xt,vt,"∄",lt),dt("\\mid","",St,"∣",rt),dt("\\top","",vt,"⊤","RARE"),dt("\\bot","",vt,"⊥","RARE"),it="Variable Sized Symbols",zt(["\\sum","\\prod","\\bigcup","\\bigcap","\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\\intop"],"",null,function(t){return{type:"mop",limits:"auto",symbol:!0,baseFontFamily:"cmr",body:{coprod:"∐",bigvee:"⋁",bigwedge:"⋀",biguplus:"⨄",bigcap:"⋂",bigcup:"⋃",intop:"∫",prod:"∏",sum:"∑",bigotimes:"⨂",bigoplus:"⨁",bigodot:"⨀",bigsqcup:"⨆",smallint:"∫"}[t.slice(1)]}}),zt(["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"],"",null,function(t){return{type:"mop",limits:"nolimits",symbol:!0,body:{int:"∫",iint:"∬",iiint:"∭",oint:"∮",oiint:"∯",oiiint:"∰",intclockwise:"∱",varointclockwise:"∲",ointctrclockwise:"∳",intctrclockwise:"⨑"}[t.slice(1)]}}),ht(lt,"\\sum","\\prod","\\bigcap","\\bigcup","\\int"),ht(rt,"\\bigoplus","\\smallint","\\iint","\\oint"),ht("RARE","\\bigwedge","\\bigvee"),ht(756,"\\coprod"),ht(723,"\\bigsqcup"),ht(1241,"\\bigotimes"),ht(150,"\\bigodot"),ht(174,"\\biguplus"),ht(878,"\\iiint"),ht(97,"\\intop"),it="Various",dt("\\sharp","",vt,"♯",rt),dt("\\flat","",vt,"♭",590),dt("\\natural","",vt,"♮",278),dt("\\#","",vt,"#","RARE"),dt("\\&","",vt,"&","RARE"),dt("\\clubsuit","",vt,"♣",172),dt("\\heartsuit","",vt,"♡","ARCANE"),dt("\\spadesuit","",vt,"♠","ARCANE"),dt("\\diamondsuit","",vt,"♢",nt),dt("\\differencedelta","",St,"∆",rt),it="Letters and Letter Like Forms",zt("\\unicode","{charcode:number}",null,function(t,e){let i=parseInt(e[0]);return isFinite(i)||(i=10067),{type:"mord",body:String.fromCodePoint(i)}}),dt("\\backslash","",vt,"\\"),dt("?","",vt,"?"),dt("!","",vt,"!"),dt("\\nabla","",vt,"∇",lt),dt("\\partial","",vt,"∂",lt),dt("\\ell","",vt,"ℓ",rt),dt("\\imaginaryI","",vt,"i"),dt("\\imaginaryJ","",vt,"j"),zt(["\\Re","\\Im"],"",null,function(t){return{type:"mop",limits:"nolimits",symbol:!1,isFunction:!0,body:{"\\Re":"ℜ","\\Im":"ℑ"}[t],baseFontFamily:"frak"}}),dt("\\hbar","",vt,"ℏ",rt),dt("\\hslash",xt,vt,"ℏ",rt),dt("\\differentialD","cmr",vt,"d"),dt("\\rd","cmr",vt,"d"),dt("\\capitalDifferentialD","cmr",vt,"D"),dt("\\rD","cmr",vt,"D"),dt("\\exponentialE","cmr",vt,"e"),dt("\\Finv",xt,vt,"Ⅎ",3),dt("\\Game",xt,vt,"⅁",1),dt("\\wp","",vt,"℘",1306),dt("\\eth",xt,vt,"ð",77),dt("\\mho",xt,vt,"℧",138),dt("\\Bbbk",xt,vt,"k"),dt("\\doubleStruckCapitalN","bb",vt,"N"),dt("\\N","bb",vt,"N"),dt("\\doubleStruckCapitalR","bb",vt,"R"),dt("\\R","bb",vt,"R"),dt("\\doubleStruckCapitalQ","bb",vt,"Q"),dt("\\Q","bb",vt,"Q"),dt("\\doubleStruckCapitalC","bb",vt,"C"),dt("\\C","bb",vt,"C"),dt("\\doubleStruckCapitalZ","bb",vt,"Z"),dt("\\Z","bb",vt,"Z"),dt("\\doubleStruckCapitalP","bb",vt,"P"),dt("\\P","bb",vt,"P"),dt("\\scriptCapitalE","scr",vt,"E"),dt("\\scriptCapitalH","scr",vt,"H"),dt("\\scriptCapitalL","scr",vt,"L"),dt("\\gothicCapitalC","frak",vt,"C"),dt("\\gothicCapitalH","frak",vt,"H"),dt("\\gothicCapitalI","frak",vt,"I"),dt("\\gothicCapitalR","frak",vt,"R"),dt("\\pounds","",vt,"£",509),dt("\\yen",xt,vt,"¥",57),dt("\\euro","",vt,"€",4),it="Crosses",dt("\\textdagger","",wt,"†"),dt("\\dagger","",wt,"†",rt),dt("\\dag","",wt,"†",rt),dt("\\ddag","",wt,"‡",500),dt("\\textdaggerdbl","",wt,"‡"),dt("\\ddagger","",wt,"‡",353),dt("\\maltese",xt,vt,"✠",24),it="Arrows",dt("\\longrightarrow","",St,"⟶",lt),dt("\\rightarrow","",St,"→",lt),dt("\\Longrightarrow","",St,"⟹",lt),dt("\\Rightarrow","",St,"⇒",lt),dt("\\longmapsto","",St,"⟼",rt),dt("\\mapsto","",St,"↦",rt),dt("\\Longleftrightarrow","",St,"⟺",rt),dt("\\rightleftarrows",xt,St,"⇄",rt),dt("\\leftarrow","",St,"←",rt),dt("\\curvearrowleft",xt,St,"↶",rt),dt("\\uparrow","",St,"↑",rt),dt("\\downarrow","",St,"↓",rt),dt("\\hookrightarrow","",St,"↪",rt),dt("\\rightharpoonup","",St,"⇀",rt),dt("\\rightleftharpoons","",St,"⇌",rt),dt("\\Leftarrow","",St,"⇐",1695),dt("\\longleftrightarrow","",St,"⟷",1599),dt("\\longleftarrow","",St,"⟵",878),dt("\\Longleftarrow","",St,"⟸",296),dt("\\searrow","",St,"↘",1609),dt("\\nearrow","",St,"↗",1301),dt("\\swarrow","",St,"↙",167),dt("\\nwarrow","",St,"↖",108),dt("\\Uparrow","",St,"⇑",257),dt("\\Downarrow","",St,"⇓",556),dt("\\updownarrow","",St,"↕",192),dt("\\Updownarrow","",St,"⇕",161),dt("\\hookleftarrow","",St,"↩",115),dt("\\leftharpoonup","",St,"↼",93),dt("\\leftharpoondown","",St,"↽",42),dt("\\rightharpoondown","",St,"⇁",80),dt("\\leftrightarrows",xt,St,"⇆",765),dt("\\dashrightarrow",xt,St,"⇢",311),dt("\\dashleftarrow",xt,St,"⇠",5),dt("\\leftleftarrows",xt,St,"⇇",8),dt("\\Lleftarrow",xt,St,"⇚",7),dt("\\twoheadleftarrow",xt,St,"↞",32),dt("\\leftarrowtail",xt,St,"↢",25),dt("\\looparrowleft",xt,St,"↫",6),dt("\\leftrightharpoons",xt,St,"⇋",205),dt("\\circlearrowleft",xt,St,"↺",105),dt("\\Lsh",xt,St,"↰",11),dt("\\upuparrows",xt,St,"⇈",15),dt("\\downharpoonleft",xt,St,"⇃",21),dt("\\multimap",xt,St,"⊸",108),dt("\\leftrightsquigarrow",xt,St,"↭",31),dt("\\twoheadrightarrow",xt,St,"↠",835),dt("\\rightarrowtail",xt,St,"↣",195),dt("\\looparrowright",xt,St,"↬",37),dt("\\curvearrowright",xt,St,"↷",209),dt("\\circlearrowright",xt,St,"↻",63),dt("\\Rsh",xt,St,"↱",18),dt("\\downdownarrows",xt,St,"⇊",6),dt("\\upharpoonright",xt,St,"↾",579),dt("\\downharpoonright",xt,St,"⇂",39),dt("\\rightsquigarrow",xt,St,"⇝",674),dt("\\leadsto",xt,St,"⇝",709),dt("\\Rrightarrow",xt,St,"⇛",62),dt("\\restriction",xt,St,"↾",29),dt("\\upharpoonleft",xt,St,"↿",nt),dt("\\rightrightarrows",xt,St,"⇉",nt),it="Negated Arrows",dt("\\nrightarrow",xt,St,"↛",324),dt("\\nRightarrow",xt,St,"⇏",107),dt("\\nleftrightarrow",xt,St,"↮",36),dt("\\nLeftrightarrow",xt,St,"⇎",20),dt("\\nleftarrow",xt,St,"↚",7),dt("\\nLeftarrow",xt,St,"⇍",5),it="Negated Relations",dt("\\nless",xt,St,"≮",146),dt("\\nleqslant",xt,St,"",58),dt("\\lneq",xt,St,"⪇",54),dt("\\lneqq",xt,St,"≨",36),dt("\\nleqq",xt,St,"",18),dt("\\unlhd",xt,wt,"⊴",253),dt("\\unrhd",xt,wt,"⊵",66),dt("\\lvertneqq",xt,St,"",6),dt("\\lnsim",xt,St,"⋦",4),dt("\\lnapprox",xt,St,"⪉",nt),dt("\\nprec",xt,St,"⊀",71),dt("\\npreceq",xt,St,"⋠",57),dt("\\precnsim",xt,St,"⋨",4),dt("\\precnapprox",xt,St,"⪹",2),dt("\\nsim",xt,St,"≁",40),dt("\\nshortmid",xt,St,"",1),dt("\\nmid",xt,St,"∤",417),dt("\\nvdash",xt,St,"⊬",266),dt("\\nvDash",xt,St,"⊭",405),dt("\\ngtr",xt,St,"≯",90),dt("\\ngeqslant",xt,St,"",23),dt("\\ngeqq",xt,St,"",12),dt("\\gneq",xt,St,"⪈",29),dt("\\gneqq",xt,St,"≩",35),dt("\\gvertneqq",xt,St,"",6),dt("\\gnsim",xt,St,"⋧",3),dt("\\gnapprox",xt,St,"⪊",nt),dt("\\nsucc",xt,St,"⊁",44),dt("\\nsucceq",xt,St,"⋡",nt),dt("\\succnsim",xt,St,"⋩",4),dt("\\succnapprox",xt,St,"⪺",nt),dt("\\ncong",xt,St,"≆",128),dt("\\nshortparallel",xt,St,"",6),dt("\\nparallel",xt,St,"∦",54),dt("\\nVDash",xt,St,"⊯",5),dt("\\nsupseteqq",xt,St,"",1),dt("\\supsetneq",xt,St,"⊋",286),dt("\\varsupsetneq",xt,St,"",2),dt("\\supsetneqq",xt,St,"⫌",49),dt("\\varsupsetneqq",xt,St,"",3),dt("\\nVdash",xt,St,"⊮",179),dt("\\precneqq",xt,St,"⪵",11),dt("\\succneqq",xt,St,"⪶",3),dt("\\nsubseteqq",xt,St,"",16),it="Various",dt("\\checkmark",xt,vt,"✓",1025),dt("\\diagup",xt,vt,"╱",440),dt("\\diagdown",xt,vt,"╲",175),dt("\\measuredangle",xt,vt,"∡",271),dt("\\sphericalangle",xt,vt,"∢",156),dt("\\backprime",xt,vt,"‵",104),dt("\\backdoubleprime",xt,vt,"‶",nt),it="Shapes",dt("\\ast","",wt,"∗",lt),dt("\\star","",wt,"⋆",rt),dt("\\diamond","",wt,"⋄",1356),dt("\\Diamond",xt,vt,"◊",695),dt("\\lozenge",xt,vt,"◊",422),dt("\\blacklozenge",xt,vt,"⧫",344),dt("\\bigstar",xt,vt,"★",168),it="Hebrew",dt("\\aleph","",vt,"ℵ",1381),dt("\\beth",xt,vt,"ℶ",54),dt("\\daleth",xt,vt,"ℸ",43),dt("\\gimel",xt,vt,"ℷ",36),it="Fences",dt("\\lbrace","",At,"{",lt),dt("\\rbrace","",Ct,"}",lt),dt("\\langle","",At,"⟨",rt),dt("\\rangle","",Ct,"⟩",rt),dt("\\lfloor","",At,"⌊",rt),dt("\\rfloor","",Ct,"⌋",rt),dt("\\lceil","",At,"⌈",rt),dt("\\rceil","",Ct,"⌉",rt),dt("\\vert","",vt,"∣",lt),dt("\\mvert","",St,"∣"),dt("\\lvert","",At,"∣",496),dt("\\rvert","",Ct,"∣",496),dt("\\|","",vt,"∥"),dt("\\Vert","",vt,"∥",lt),dt("\\mVert","",vt,"∥"),dt("\\lVert","",At,"∥",287),dt("\\rVert","",Ct,"∥",nt),dt("\\lbrack","",At,"[",574),dt("\\rbrack","",Ct,"]",213),dt("\\{","",At,"{"),dt("\\}","",Ct,"}"),dt("(","",At,"("),dt(")","",Ct,")"),dt("[","",At,"["),dt("]","",Ct,"]"),dt("\\ulcorner",xt,At,"┌",296),dt("\\urcorner",xt,Ct,"┐",310),dt("\\llcorner",xt,At,"└",137),dt("\\lrcorner",xt,Ct,"┘",199),dt("\\lgroup","",At,"⟮",24),dt("\\rgroup","",Ct,"⟯",24),dt("\\lmoustache","",At,"⎰",nt),dt("\\rmoustache","",Ct,"⎱",nt),zt(["\\middle"],"{:delim}",null,function(t,e){return{type:"delim",delim:e[0]}}),it="Sizing";const Dt={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}};function Et(t){let e="",i=!0;for(const s of t)"string"==typeof s.body?e+=s.body:i=!1;return i?e:""}zt(["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],"{:delim}",null,function(t,e){return{type:"sizeddelim",size:Dt[t].size,cls:Dt[t].mclass,delim:e[0]}}),it="Relations",dt("=","",St,"=",lt),dt("\\ne","",St,"≠",lt),dt("\\neq","",St,"≠",rt),dt("<","",St,"<",lt),dt("\\lt","",St,"<",rt),dt(">","",St,">",lt),dt("\\gt","",St,">",rt),dt("\\le","",St,"≤",rt),dt("\\ge","",St,"≥",rt),dt("\\leqslant",xt,St,"⩽",lt),dt("\\geqslant",xt,St,"⩾",lt),dt("\\leq","",St,"≤",rt),dt("\\geq","",St,"≥",rt),dt("\\ll","",St,"≪"),dt("\\gg","",St,"≫",rt),dt("\\coloneq","",St,"≔",5),dt("\\measeq","",St,"≝"),dt("\\eqdef","",St,"≞"),dt("\\questeq","",St,"≟"),dt(":","",St,":"),dt("\\cong","",St,"≅",rt),dt("\\equiv","",St,"≡",rt),dt("\\prec","",St,"≺",rt),dt("\\preceq","",St,"⪯",rt),dt("\\succ","",St,"≻",rt),dt("\\succeq","",St,"⪰",1916),dt("\\perp","",St,"⊥",rt),dt("\\parallel","",St,"∥",rt),dt("\\propto","",St,"∝",rt),dt("\\Colon","",St,"∷"),dt("\\smile","",St,"⌣",rt),dt("\\frown","",St,"⌢",rt),dt("\\sim","",St,"∼",rt),dt("\\gtrsim",xt,St,"≳",rt),dt("\\approx","",St,"≈",lt),dt("\\approxeq",xt,St,"≊",147),dt("\\thickapprox",xt,St,"≈",377),dt("\\lessapprox",xt,St,"⪅",146),dt("\\gtrapprox",xt,St,"⪆",95),dt("\\precapprox",xt,St,"⪷",50),dt("\\succapprox",xt,St,"⪸",nt),dt("\\thicksim",xt,St,"∼",779),dt("\\succsim",xt,St,"≿",251),dt("\\precsim",xt,St,"≾",104),dt("\\backsim",xt,St,"∽",251),dt("\\eqsim",xt,St,"≂",62),dt("\\backsimeq",xt,St,"⋍",91),dt("\\simeq","",St,"≃",nt),dt("\\lesssim",xt,St,"≲",nt),dt("\\nleq",xt,St,"≰",369),dt("\\ngeq",xt,St,"≱",164),dt("\\smallsmile",xt,St,"⌣",31),dt("\\smallfrown",xt,St,"⌢",71),dt("\\bowtie","",St,"⋈",558),dt("\\asymp","",St,"≍",755),dt("\\sqsubseteq","",St,"⊑",1255),dt("\\sqsupseteq","",St,"⊒",183),dt("\\leqq",xt,St,"≦",1356),dt("\\eqslantless",xt,St,"⪕",15),dt("\\lll",xt,St,"⋘",157),dt("\\lessgtr",xt,St,"≶",281),dt("\\lesseqgtr",xt,St,"⋚",134),dt("\\lesseqqgtr",xt,St,"⪋",nt),dt("\\risingdotseq",xt,St,"≓",8),dt("\\fallingdotseq",xt,St,"≒",99),dt("\\subseteqq",xt,St,"⫅",82),dt("\\Subset",xt,St,"⋐"),dt("\\sqsubset",xt,St,"⊏",309),dt("\\preccurlyeq",xt,St,"≼",549),dt("\\curlyeqprec",xt,St,"⋞",14),dt("\\vDash",xt,St,"⊨",646),dt("\\Vvdash",xt,St,"⊪",20),dt("\\bumpeq",xt,St,"≏",13),dt("\\Bumpeq",xt,St,"≎",12),dt("\\geqq",xt,St,"≧",972),dt("\\eqslantgtr",xt,St,"⪖",13),dt("\\ggg",xt,St,"⋙",127),dt("\\gtrless",xt,St,"≷",417),dt("\\gtreqless",xt,St,"⋛",190),dt("\\gtreqqless",xt,St,"⪌",91),dt("\\supseteqq",xt,St,"⫆",6),dt("\\Supset",xt,St,"⋑",34),dt("\\sqsupset",xt,St,"⊐",71),dt("\\succcurlyeq",xt,St,"≽",442),dt("\\curlyeqsucc",xt,St,"⋟",10),dt("\\Vdash",xt,St,"⊩",276),dt("\\shortmid",xt,St,"∣",67),dt("\\shortparallel",xt,St,"∥",17),dt("\\between",xt,St,"≬",110),dt("\\pitchfork",xt,St,"⋔",66),dt("\\varpropto",xt,St,"∝",203),dt("\\backepsilon",xt,St,"∍",176),dt("\\llless",xt,St,"⋘",nt),dt("\\gggtr",xt,St,"⋙",nt),dt("\\lhd",xt,wt,"⊲",447),dt("\\rhd",xt,wt,"⊳",338),dt("\\Join","",St,"⋈",35),dt("\\doteq","",St,"≐",1450),dt("\\doteqdot",xt,St,"≑",60),dt("\\Doteq",xt,St,"≑",nt),dt("\\eqcirc",xt,St,"≖",6),dt("\\circeq",xt,St,"≗",31),dt("\\lessdot",xt,wt,"⋖",88),dt("\\gtrdot",xt,wt,"⋗",45),dt("\\~","",St,"~"),it="Logic",dt("\\leftrightarrow","",St,"↔",lt),dt("\\Leftrightarrow","",St,"⇔",lt),dt("\\to","",St,"→",lt),dt("\\models","",St,"⊨",rt),dt("\\vdash","",St,"⊢",rt),dt("\\therefore",xt,St,"∴",1129),dt("\\because",xt,St,"∵",388),dt("\\implies","",St,"⟹",1858),dt("\\gets","",St,"←",150),dt("\\dashv","",St,"⊣",299),dt("\\impliedby","",St,"⟸",nt),dt("\\biconditional","",St,"⟷",nt),dt("\\roundimplies","",St,"⥰",nt),it="Operators",dt("+","",wt,"+",lt),dt("-","",wt,"−",lt),dt("−","",wt,"−",lt),dt("\\pm","",wt,"±",rt),dt("\\mp","",wt,"∓",rt),dt("*","",wt,"∗",rt),dt("\\times","",wt,"×",rt),dt("\\div","",wt,"÷",rt),dt("\\surd","",vt,"√",rt),dt("\\divides","",wt,"∣",nt),dt("\\ltimes",xt,wt,"⋉",576),dt("\\rtimes",xt,wt,"⋊",946),dt("\\leftthreetimes",xt,wt,"⋋",34),dt("\\rightthreetimes",xt,wt,"⋌",14),dt("\\intercal",xt,wt,"⊺",478),dt("\\dotplus",xt,wt,"∔",81),dt("\\centerdot",xt,wt,"⋅",271),dt("\\doublebarwedge",xt,wt,"⩞",5),dt("\\divideontimes",xt,wt,"⋇",51),dt("\\cdot","",wt,"⋅",nt),it="Others",dt("\\infty","",vt,"∞",lt),dt("\\prime","",kt,"′",lt),dt("\\doubleprime","",vt,"″"),dt("\\angle","",vt,"∠",rt),dt("`","",vt,"‘"),dt("\\$","",vt,"$"),dt("\\%","",vt,"%"),dt("\\_","",vt,"_"),it="Greek",dt("\\alpha","",kt,"α",rt),dt("\\beta","",kt,"β",rt),dt("\\gamma","",kt,"γ",rt),dt("\\delta","",kt,"δ",rt),dt("\\epsilon","",kt,"ϵ",rt),dt("\\varepsilon","",kt,"ε"),dt("\\zeta","",kt,"ζ",rt),dt("\\eta","",kt,"η",rt),dt("\\theta","",kt,"θ",rt),dt("\\vartheta","",kt,"ϑ",rt),dt("\\iota","",kt,"ι",rt),dt("\\kappa","",kt,"κ",rt),dt("\\varkappa",xt,kt,"ϰ",rt),dt("\\lambda","",kt,"λ",rt),dt("\\mu","",kt,"μ",rt),dt("\\nu","",kt,"ν",rt),dt("\\xi","",kt,"ξ",rt),dt("\\omicron","",kt,"o"),dt("\\pi","",kt,"π",rt),dt("\\varpi","",kt,"ϖ",rt),dt("\\rho","",kt,"ρ",rt),dt("\\varrho","",kt,"ϱ",rt),dt("\\sigma","",kt,"σ",rt),dt("\\varsigma","",kt,"ς",rt),dt("\\tau","",kt,"τ",rt),dt("\\phi","",kt,"ϕ",rt),dt("\\varphi","",kt,"φ",rt),dt("\\upsilon","",kt,"υ",rt),dt("\\chi","",kt,"χ",rt),dt("\\psi","",kt,"ψ",rt),dt("\\omega","",kt,"ω",rt),dt("\\Gamma","",kt,"Γ",rt),dt("\\Delta","",kt,"Δ",rt),dt("\\Theta","",kt,"Θ",rt),dt("\\Lambda","",kt,"Λ",rt),dt("\\Xi","",kt,"Ξ",rt),dt("\\Pi","",kt,"Π",rt),dt("\\Sigma","",kt,"Σ",rt),dt("\\Upsilon","",kt,"Υ",rt),dt("\\Phi","",kt,"Φ",rt),dt("\\Psi","",kt,"Ψ",rt),dt("\\Omega","",kt,"Ω",rt),dt("\\digamma",xt,kt,"ϝ",248),it="Others",dt("\\emptyset","",vt,"∅",lt),dt("\\varnothing",xt,vt,"∅",lt),it="Set Operators",dt("\\cap","",wt,"∩",lt),dt("\\cup","",wt,"∪",lt),dt("\\setminus","",wt,"∖",rt),dt("\\smallsetminus",xt,wt,"∖",254),dt("\\complement",xt,vt,"∁",200),it="Set Relations",dt("\\in","",St,"∈",lt),dt("\\notin","",St,"∉",lt),dt("\\not","",St,"̸",rt),dt("\\ni","",St,"∋",rt),dt("\\owns","",St,"∋",18),dt("\\subset","",St,"⊂",lt),dt("\\supset","",St,"⊃",lt),dt("\\subseteq","",St,"⊆",lt),dt("\\supseteq","",St,"⊇",lt),dt("\\subsetneq",xt,St,"⊊",1945),dt("\\varsubsetneq",xt,St,"",198),dt("\\subsetneqq",xt,St,"⫋",314),dt("\\varsubsetneqq",xt,St,"",55),dt("\\nsubset",xt,St,"⊄",nt),dt("\\nsupset",xt,St,"⊅",nt),dt("\\nsubseteq",xt,St,"⊈",950),dt("\\nsupseteq",xt,St,"⊉",49),it="Spacing",dt("\\ ","",Mt," "),dt("~","",Mt," "),dt("\\space","",Mt," "),dt("\\!","",Mt,null),dt("\\,","",Mt,null),dt("\\:","",Mt,null),dt("\\;","",Mt,null),dt("\\enskip","",Mt,null),dt("\\enspace","",Mt,null,672),dt("\\quad","",Mt,null,rt),dt("\\qquad","",Mt,null,rt),zt(["\\hspace","\\hspace*"],"{width:skip}",{allowedInText:!0},function(t,e){return{type:"spacing",width:e[0]||0}}),zt(["\\mathop","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathord","\\mathinner"],"{:auto}",null,function(t,e){const i={type:{"\\mathop":"mop","\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[t],body:Et(e[0])||e[0],captureSelection:!0,baseFontFamily:"\\mathop"===t?"math":""};return"\\mathop"===t&&(i.limits="nolimits",i.isFunction=!0),i}),zt(["\\operatorname","\\operatorname*"],"{operator:string}",null,function(t,e){const i={type:"mop",skipBoundary:!0,body:e[0],isFunction:!0,baseFontFamily:"cmr"};return"\\operatorname"===t?i.limits="nolimits":"\\operatorname*"===t&&(i.limits="limits"),i}),it="Punctuation",dt("\\colon","","mpunct",":",rt),dt("\\cdotp","","mpunct","⋅",rt),dt("\\ldots","","minner","…",rt),dt("\\cdots","","minner","⋯",rt),dt("\\ddots","","minner","⋱",rt),dt("\\mathellipsis","","minner","…",91),dt("\\vdots","",vt,"⋮",rt),dt("\\ldotp","","mpunct",".",18),dt(",","","mpunct",","),dt(";","","mpunct",";"),it="Logical Operators",dt("\\wedge","",wt,"∧",lt),dt("\\vee","",wt,"∨",lt),dt("\\lnot","",vt,"¬",rt),dt("\\neg","",vt,"¬",lt),dt("\\land","",wt,"∧",659),dt("\\lor","",wt,"∨",364),dt("\\barwedge",xt,wt,"⊼",21),dt("\\veebar",xt,wt,"⊻",43),dt("\\nor",xt,wt,"⊻",7),dt("\\curlywedge",xt,wt,"⋏",58),dt("\\curlyvee",xt,wt,"⋎",57),it="Boxes",dt("\\square",xt,vt,"□",rt),dt("\\Box",xt,vt,"□",rt),dt("\\blacksquare",xt,vt,"■",1679),dt("\\boxminus",xt,wt,"⊟",79),dt("\\boxplus",xt,wt,"⊞",276),dt("\\boxtimes",xt,wt,"⊠",457),dt("\\boxdot",xt,wt,"⊡",120),it="Circles",dt("\\circ","",wt,"∘",lt),dt("\\bigcirc","",wt,"◯",903),dt("\\bullet","",wt,"∙",rt),dt("\\circleddash",xt,wt,"⊝",rt),dt("\\circledast",xt,wt,"⊛",339),dt("\\oplus","",wt,"⊕",rt),dt("\\ominus","",wt,"⊖",1568),dt("\\otimes","",wt,"⊗",rt),dt("\\odot","",wt,"⊙",rt),dt("\\circledcirc",xt,wt,"⊚",93),dt("\\oslash","",wt,"⊘",497),dt("\\circledS",xt,vt,"Ⓢ",31),dt("\\circledR",xt,vt,"®",1329),it="Triangles",dt("\\triangle","",vt,"△",rt),dt("\\triangleq",xt,St,"≜",rt),dt("\\bigtriangleup","",wt,"△",1773),dt("\\vartriangle",xt,St,"△",762),dt("\\triangledown",xt,vt,"▽",520),dt("\\bigtriangledown","",wt,"▽",661),dt("\\triangleleft","",wt,"◃",534),dt("\\vartriangleleft",xt,St,"⊲",281),dt("\\trianglelefteq",xt,St,"⊴",176),dt("\\ntriangleleft",xt,St,"⋪",13),dt("\\ntrianglelefteq",xt,St,"⋬",22),dt("\\triangleright","",wt,"▹",516),dt("\\vartriangleright",xt,St,"⊳",209),dt("\\trianglerighteq",xt,St,"⊵",45),dt("\\ntriangleright",xt,St,"⋫",15),dt("\\ntrianglerighteq",xt,St,"⋭",6),dt("\\blacktriangle",xt,vt,"▲",360),dt("\\blacktriangledown",xt,vt,"▼",159),dt("\\blacktriangleleft",xt,St,"◀",101),dt("\\blacktriangleright",xt,St,"▶",271),it="Others",dt("\\/","",kt,"/"),dt("|","","textord","∣"),it="Big Operators",dt("\\sqcup","",wt,"⊔",1717),dt("\\sqcap","",wt,"⊓",735),dt("\\uplus","",wt,"⊎",597),dt("\\wr","",wt,"≀",286),dt("\\Cap",xt,wt,"⋒",2),dt("\\Cup",xt,wt,"⋓",2),dt("\\doublecap",xt,wt,"⋒",1),dt("\\doublecup",xt,wt,"⋓",1),dt("\\amalg","",wt,"⨿",nt),dt("\\And","",wt,"&"),it="Accents",zt(["\\acute","\\grave","\\dot","\\ddot","\\mathring","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec"],"{body:auto}",null,function(t,e){return{type:"accent",accent:{"\\acute":"ˊ","\\grave":"ˋ","\\dot":"˙","\\ddot":"¨","\\mathring":"˚","\\tilde":"~","\\bar":"ˉ","\\breve":"˘","\\check":"ˇ","\\hat":"^","\\vec":"⃗"}[t],limits:"accent",skipBoundary:!0,body:e[0]}}),ht(rt,"\\bar","\\ddot","\\acute","\\tilde","\\check"),ht(1548,"\\breve"),ht(735,"\\grave"),ht(lt,"\\vec"),it="Letters and Letter Like Forms",dt("\\imath","",vt,"ı"),dt("\\jmath","",vt,"ȷ"),it="Others",dt("\\degree","",vt,"°",46),it="Others",dt("'","",vt,"′"),dt('"',"",vt,"”"),it="Others",zt("\\^","{:string}",{allowedInText:!0},function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"}[e[0]]||"^",baseFontFamily:"cmr"}}),zt("\\`","{:string}",{allowedInText:!0},function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"}[e[0]]||"`",baseFontFamily:"cmr"}}),zt("\\'","{:string}",{allowedInText:!0},function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{a:"á",e:"é",i:"í",o:"ó",u:"ú",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú"}[e[0]]||"^",baseFontFamily:"cmr"}}),zt("\\~","{:string}",{allowedInText:!0},function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{n:"ñ",N:"Ñ",a:"ã",o:"õ",A:"Ã",O:"Õ"}[e[0]]||"´",baseFontFamily:"cmr"}}),zt("\\c","{:string}",{allowedInText:!0},function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{c:"ç",C:"Ç"}[e[0]]||"",baseFontFamily:"cmr"}});const qt={"\\#":"#","\\&":"&","\\$":"$","\\%":"%","\\_":"_","\\euro":"€","\\maltese":"✠","\\{":"{","\\}":"}","\\nobreakspace":" ","\\ldots":"…","\\textellipsis":"…","\\backslash":"\\","`":"‘","'":"’","``":"“","''":"”","\\degree":"°","\\textasciicircum":"^","\\textasciitilde":"~","\\textasteriskcentered":"*","\\textbackslash":"\\","\\textbraceleft":"{","\\textbraceright":"}","\\textbullet":"•","\\textdollar":"$","\\textsterling":"£","–":"–","—":"—","‘":"‘","’":"’","“":"“","”":"”",'"':"”","\\ss":"ß","\\ae":"æ","\\oe":"œ","\\AE":"Æ","\\OE":"Œ","\\O":"Ø","\\i":"ı","\\j":"ȷ","\\aa":"å","\\AA":"Å"};var Pt={matchCodepoint:ut,commandAllowed:function(t,e){return!(!at[e]||"text"===t&&!at[e].allowedInText)||!!{text:qt,math:st}[t][e]},unicodeToMathVariant:yt,mathVariantToUnicode:function(t,e,i){if(!/[A-Za-z0-9]/.test(t))return t;if(!e&&!i)return t;const s=t.codePointAt(0);for(let t=0;t=gt[t].offset&&s=1;)s.params.push({optional:!1,type:"math",defaultValue:null,placeholder:null}),a-=1}}}else"math"===e?s=st[t]:qt[t]&&(s={value:qt[t]});return!s||"mord"!==s.type||"f"!==s.value&&"g"!==s.value&&"h"!==s.value||(s.isFunction=!0),s},getValue:function(t,e){return"math"===t?st[e]&&st[e].value?st[e].value:e:qt[e]?qt[e]:e},getEnvironmentInfo:function(t){let e=ot[t];return e||(e={params:"",parser:null,mathstyle:"displaystyle",tabular:!0,colFormat:[],lFence:".",rFence:"."}),e},suggest:function(t){if(t.length<=1)return[];const e=[];for(const i in at)at.hasOwnProperty(i)&&i.startsWith(t)&&!at[i].infix&&e.push({match:i,frequency:at[i].frequency});for(const i in st)st.hasOwnProperty(i)&&i.startsWith(t)&&e.push({match:i,frequency:st[i].frequency});return e.sort((t,e)=>t.frequency===e.frequency?t.match.length-e.match.length:(e.frequency||0)-(t.frequency||0)),e},FREQUENCY_VALUE:ct,TEXT_SYMBOLS:qt,MATH_SYMBOLS:st,ENVIRONMENTS:ot,RIGHT_DELIM:{"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},FUNCTIONS:at,MACROS:{iff:"\\;⟺\\;",nicefrac:"^{#1}\\!\\!/\\!_{#2}",bra:"\\mathinner{\\langle{#1}|}",ket:"\\mathinner{|{#1}\\rangle}",braket:"\\mathinner{\\langle{#1}\\rangle}",set:"\\mathinner{\\lbrace #1 \\rbrace}",Bra:"\\left\\langle #1\\right|",Ket:"\\left|#1\\right\\rangle",Braket:"\\left\\langle{#1}\\right\\rangle",Set:"\\left\\lbrace #1 \\right\\rbrace"},COMMAND_MODE_CHARACTERS:/[a-zA-Z0-9!@*()-=+{}[\]\\';:?\/.,~<>`|'$%#&^_" ]/,LETTER:/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/,LETTER_AND_DIGITS:/[0-9a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/};const It=et.makeSymbol,Bt=et.makeSpan,Ot=et.makeVlist;function Rt(t,e,i,s,a,o){const n=It("Size"+i+"-Regular",Pt.getValue("math",e)),r=et.makeStyleWrap(t,Bt(n,"delimsizing size"+i),a.mathstyle,O.TEXT,o);return s&&r.setTop((1-a.mathstyle.sizeMultiplier)*a.mathstyle.metrics.axisHeight),r.setStyle("color",a.color),"number"==typeof a.opacity&&r.setStyle("opacity",a.opacity),r}function Kt(t,e){let i="";return"Size1-Regular"===e?i=" delim-size1":"Size4-Regular"===e&&(i=" delim-size4"),Bt(It(e,Pt.getValue("math",t)),"delimsizinginner"+i)}function Nt(t,e,i,s,a,o){let n,r,l,c;n=l=c=Pt.getValue("math",e),r=null;let h="Size1-Regular";"\\vert"===e||"\\lvert"===e||"\\rvert"===e||"\\mvert"===e||"\\mid"===e?l=n=c="∣":"\\Vert"===e||"\\lVert"===e||"\\rVert"===e||"\\mVert"===e||"\\|"===e?l=n=c="∥":"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?n=l="⏐":"\\Downarrow"===e?n=l="‖":"\\updownarrow"===e?(n="↑",l="⏐",c="↓"):"\\Updownarrow"===e?(n="⇑",l="‖",c="⇓"):"["===e||"\\lbrack"===e?(n="⎡",l="⎢",c="⎣",h="Size4-Regular"):"]"===e||"\\rbrack"===e?(n="⎤",l="⎥",c="⎦",h="Size4-Regular"):"\\lfloor"===e?(l=n="⎢",c="⎣",h="Size4-Regular"):"\\lceil"===e?(n="⎡",l=c="⎢",h="Size4-Regular"):"\\rfloor"===e?(l=n="⎥",c="⎦",h="Size4-Regular"):"\\rceil"===e?(n="⎤",l=c="⎥",h="Size4-Regular"):"("===e?(n="⎛",l="⎜",c="⎝",h="Size4-Regular"):")"===e?(n="⎞",l="⎟",c="⎠",h="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(n="⎧",r="⎨",c="⎩",l="⎪",h="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(n="⎫",r="⎬",c="⎭",l="⎪",h="Size4-Regular"):"\\lgroup"===e?(n="⎧",c="⎩",l="⎪",h="Size4-Regular"):"\\rgroup"===e?(n="⎫",c="⎭",l="⎪",h="Size4-Regular"):"\\lmoustache"===e?(n="⎧",c="⎭",l="⎪",h="Size4-Regular"):"\\rmoustache"===e?(n="⎫",c="⎩",l="⎪",h="Size4-Regular"):"\\surd"===e?(n="",c="⎷",l="",h="Size4-Regular"):"\\ulcorner"===e?(n="┌",l=c=" "):"\\urcorner"===e?(n="┐",l=c=" "):"\\llcorner"===e?(c="└",l=n=" "):"\\lrcorner"===e&&(n="┘",l=n=" ");const d=M.getCharacterMetrics(Pt.getValue("math",n),h),p=d.height+d.depth,m=M.getCharacterMetrics(Pt.getValue("math",l),h),u=m.height+m.depth,f=M.getCharacterMetrics(Pt.getValue("math",c),h),g=f.height+f.depth;let y=0,b=1;if(null!==r){const t=M.getCharacterMetrics(Pt.getValue("math",r),h);y=t.height+t.depth,b=2}const x=p+g+y,k=Math.ceil((i-x)/(b*u)),v=x+k*b*u;let w=a.mathstyle.metrics.axisHeight;s&&(w*=a.mathstyle.sizeMultiplier);const S=v/2-w,A=[];if(A.push(Kt(c,h)),null===r)for(let t=0;t","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Vt=[0,1.2,1.8,2.4,3],Ut=[{type:"small",mathstyle:O.SCRIPTSCRIPT},{type:"small",mathstyle:O.SCRIPT},{type:"small",mathstyle:O.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],jt=[{type:"small",mathstyle:O.SCRIPTSCRIPT},{type:"small",mathstyle:O.SCRIPT},{type:"small",mathstyle:O.TEXT},{type:"stack"}],Gt=[{type:"small",mathstyle:O.SCRIPTSCRIPT},{type:"small",mathstyle:O.SCRIPT},{type:"small",mathstyle:O.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function Zt(t,e,i,s,a,o){if(!e||0===e.length||"."===e)return Xt(t,a,t);let n;"<"===e||"\\lt"===e?e="\\langle":">"!==e&&"\\gt"!==e||(e="\\rangle"),n=Ht.includes(e)?Ut:$t.includes(e)?Gt:jt;const r=function(t,e,i,s){for(let o=Math.min(2,3-s.mathstyle.size);oe)return i[o]}var a;return i[i.length-1]}(Pt.getValue("math",e),i,n,a);return"small"===r.type?function(t,e,i,s,a,o){const n=It("AMS-Regular",Pt.getValue("math",e)),r=et.makeStyleWrap(t,n,a.mathstyle,i,o);return s&&r.setTop((1-a.mathstyle.sizeMultiplier/i.sizeMultiplier)*a.mathstyle.metrics.axisHeight),r.setStyle("color",a.color),"number"==typeof a.opacity&&r.setStyle("opacity",a.opacity),r}(t,e,r.mathstyle,s,a,o):"large"===r.type?Rt(t,e,r.size,s,a,o):Nt(t,e,i,s,a,o)}function Xt(t,e,i){return et.makeSpanOfType(t,"","sizing"+e.mathstyle.adjustTo(O.TEXT)+" nulldelimiter "+(i||""))}var Jt={makeSizedDelim:function(t,e,i,s,a){return"."===e?Xt(t,s,a):("<"===e||"\\lt"===e?e="\\langle":">"!==e&&"\\gt"!==e||(e="\\rangle"),$t.includes(e)||Ht.includes(e)?Rt(t,e,i,!1,s,a):Wt.includes(e)?Nt(t,e,Vt[i],!1,s,a):null)},makeCustomSizedDelim:Zt,makeLeftRightDelim:function(t,e,i,s,a,o){if("."===e)return Xt(t,a,o);const n=a.mathstyle.metrics.axisHeight*a.mathstyle.sizeMultiplier,r=5/M.METRICS.ptPerEm;let l=s+n,c=i-n,h=901*(c=Math.max(l,c))/500;return l=2*c-r,Zt(t,e,h=Math.max(h,l),!0,a,o)}};const Yt=et.makeSpan,Qt=et.makeOrd,te=et.makeInner,ee=et.makeHlist,ie=et.makeVlist,se=/\u0393|\u0394|\u0398|\u039b|\u039E|\u03A0|\u03A3|\u03a5|\u03a6|\u03a8|\u03a9|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5/,ae=/^([A-Za-z]|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5)$/,oe={size1:.5,size2:.7,size3:.8,size4:.9,size5:1,size6:1.2,size7:1.44,size8:1.73,size9:2.07,size10:2.49};class ne{constructor(t,e,i,s){this.mode=t,this.type=e,this.body=i,this.applyStyle(s)}getStyle(){return{color:this.phantom?"transparent":this.color,backgroundColor:this.phantom?"transparent":this.backgroundColor,fontFamily:this.baseFontFamily||this.fontFamily||this.autoFontFamily,fontShape:this.fontShape,fontSeries:this.fontSeries,fontSize:this.fontSize,cssId:this.cssId,cssClass:this.cssClass}}applyStyle(t){if(Object.assign(this,t),"none"===this.fontFamily&&(this.fontFamily=""),"auto"===this.fontShape&&(this.fontShape=""),"auto"===this.fontSeries&&(this.fontSeries=""),"none"===this.color&&(this.color=""),"none"===this.backgroundColor&&(this.backgroundColor=""),"auto"===this.fontSize&&(this.fontSize=""),this.fontSize&&(this.maxFontSize=oe[this.fontSize]),"math"===this.mode){const t="string"==typeof this.body?this.body:"";this.autoFontFamily="cmr",ae.test(t)?this.autoFontFamily="math":/\\imath|\\jmath|\\pounds/.test(t)?this.autoFontFamily="mainit":se.test(t)||"math"!==this.baseFontFamily||(this.autoFontFamily="cmr")}else"text"===this.mode&&("root"!==this.type&&(this.type=""),delete this.baseFontFamily,delete this.autoFontFamily)}getInitialBaseElement(){let t=this;return Array.isArray(this.body)&&this.body.length>0&&("first"!==this.body[0].type?t=this.body[0].getInitialBaseElement():this.body[1]&&(t=this.body[1].getInitialBaseElement())),t}getFinalBaseElement(){return Array.isArray(this.body)&&this.body.length>0?this.body[this.body.length-1].getFinalBaseElement():this}isCharacterBox(){const t=this.getInitialBaseElement();return/minner|mbin|mrel|mpunct|mopen|mclose|textord/.test(t.type)}forEach(t){if(t(this),Array.isArray(this.body))for(const e of this.body)e&&e.forEach(t);else this.body&&"object"==typeof this.body&&t(this.body);if(this.superscript)for(const e of this.superscript)e&&e.forEach(t);if(this.subscript)for(const e of this.subscript)e&&e.forEach(t);if(this.overscript)for(const e of this.overscript)e&&e.forEach(t);if(this.underscript)for(const e of this.underscript)e&&e.forEach(t);if(this.numer)for(const e of this.numer)e&&e.forEach(t);if(this.denom)for(const e of this.denom)e&&e.forEach(t);if(this.index)for(const e of this.index)e&&e.forEach(t);if(this.array)for(const e of this.array)for(const i of e)for(const e of i)e.forEach(t)}filter(t){let e=[];t(this)&&e.push(this);for(const i of["body","superscript","subscript","overscript","underscript","numer","denom","index"])if(Array.isArray(this[i]))for(const s of this[i])s&&(e=e.concat(s.filter(t)));if(Array.isArray(this.array))for(const i of this.array)for(const s of i)s&&(e=e.concat(s.filter(t)));return e}decomposeGroup(t){const e=t.clone({mathstyle:this.mathstyle}),i=Qt(he(e,this.body));return this.cssId&&(i.cssId=this.cssId),i.applyStyle({backgroundColor:this.backgroundColor,cssClass:this.cssClass}),i}decomposeArray(t){let e=this.colFormat;e&&0===e.length&&(e=[{align:"l"}]),e||(e=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}]);const i=[];let s=0;for(const t of e)t.align&&s++;for(const t of this.array){let e=0;for(;e0&&(o<(m+=r)&&(o=m),m=0),p.height=a,p.depth=o,l+=a,p.pos=l,l+=o+m,h.push(p)}const p=l/2+a.metrics.axisHeight,m=[];for(let e=0;e0&&m.push(ie(t,i,"individualShift"))}const u=[];let f=!1,g=!1,y=0,b=!this.lFence;for(const i of e){if(i.align&&y>=m.length)break;if(i.align&&y0?3*c:7*S.defaultRuleThickness,p=e.metrics.denom1):(c>0?(h=e.metrics.num2,d=c):(h=e.metrics.num3,d=3*S.defaultRuleThickness),p=e.metrics.denom2);const m=o?o.depth:0,u=l?l.height:0;let f;if(0===c){const t=h-m-(u-p);tet.height(i)+et.depth(i)+o&&(o=(o+l-(et.height(i)+et.depth(i)))/2),r.setTop(r.height-et.height(i)-(o+s));const c=Yt(null,t.mathstyle.adjustTo(O.TEXT)+" sqrt-line");c.applyStyle(this.getStyle()),c.height=s;const h=ie(t,[i,o,c,s]);if(!this.index)return Qt([r,h],"sqrt");const d=t.clone({mathstyle:O.SCRIPTSCRIPT}),p=Yt(he(d,this.index),e.adjustTo(O.SCRIPTSCRIPT)),m=Math.max(r.height,h.height),u=Math.max(r.depth,h.depth),f=ie(t,[p],"shift",-.6*(m-u));return Qt([Yt(f,"root"),r,h],"sqrt")}decomposeAccent(t){const e=t.mathstyle;let i=he(t.cramp(),this.body);(this.superscript||this.subscript)&&(i=this.attachSupsub(t,Qt(i),"mord"));let s=0;Array.isArray(this.body)&&1===this.body.length&&this.body[0].isCharacterBox()&&(s=et.skew(i));const a=Math.min(et.height(i),e.metrics.xHeight),o=et.makeSymbol("Main-Regular",this.accent,"math");o.italic=0;const n="⃗"===this.accent?" accent-vec":"";let r=Yt(Yt(o),"accent-body"+n);return(r=ie(t,[i,-a,r])).children[1].setLeft(2*s),Qt(r,"accent")}decomposeLine(t){const e=t.mathstyle,i=he(t.cramp(),this.body),s=S.defaultRuleThickness/e.sizeMultiplier,a=Yt(null,t.mathstyle.adjustTo(O.TEXT)+" "+this.position+"-line");let o;if(a.height=s,a.maxFontSize=1,"overline"===this.position)o=ie(t,[i,3*s,a,s]);else{const e=Yt(i);o=ie(t,[s,a,3*s,e],"top",et.height(e))}return Qt(o,this.position)}decomposeOverunder(t){const e=he(t,this.body),i=t.clone({mathstyle:"scriptstyle"}),s=this.overscript?Yt(he(i,this.overscript),t.mathstyle.adjustTo(i.mathstyle)):null,a=this.underscript?Yt(he(i,this.underscript),t.mathstyle.adjustTo(i.mathstyle)):null;return ce(t,e,0,0,s,a,this.mathtype||"mrel")}decomposeOverlap(t){const e=Yt(he(t,this.body),"inner");return Qt([e,Yt(null,"fix")],"left"===this.align?"llap":"rlap")}decomposeRule(t){const e=t.mathstyle,i=Qt("","rule");let s=this.shift&&!isNaN(this.shift)?this.shift:0;s/=e.sizeMultiplier;const a=this.width/e.sizeMultiplier,o=this.height/e.sizeMultiplier;return i.setStyle("border-right-width",a,"em"),i.setStyle("border-top-width",o,"em"),i.setStyle("margin-top",-(o-s),"em"),i.setStyle("border-color",t.color),i.width=a,i.height=o+s,i.depth=-s,i}decomposeOp(t){const e=t.mathstyle;let i,s=!1;e.size===O.DISPLAY.size&&"string"==typeof this.body&&"\\smallint"!==this.body&&(s=!0);let a=0,o=0;if(this.symbol){const n=s?"Size2-Regular":"Size1-Regular";(i=et.makeSymbol(n,this.body,"op-symbol "+(s?"large-op":"small-op"))).type="mop",a=(i.height-i.depth)/2-e.metrics.axisHeight*e.sizeMultiplier,o=i.italic,this.bind(t,i)}else Array.isArray(this.body)?(i=et.makeOp(he(t,this.body)),this.bind(t,i)):i=this.makeSpan(t,this.body);if(this.superscript||this.subscript){const s=this.limits||"auto";return this.alwaysHandleSupSub||"limits"===s||"auto"===s&&e.size===O.DISPLAY.size?this.attachLimits(t,i,a,o):this.attachSupsub(t,i,"mop")}return this.symbol&&i.setTop(a),i}decomposeBox(t){const e=Qt(he(t,this.body)),i=Yt();i.setStyle("position","absolute");const s="number"==typeof this.padding?this.padding:S.fboxsep;i.setStyle("height",e.height+e.depth+2*s,"em"),0!==s?i.setStyle("width","calc(100% + "+2*s+"em)"):i.setStyle("width","100%"),i.setStyle("top",-s,"em"),i.setStyle("left",-s,"em"),i.setStyle("z-index","-1"),this.backgroundcolor&&i.setStyle("background-color",this.backgroundcolor),this.framecolor&&i.setStyle("border",S.fboxrule+"em solid "+this.framecolor),this.border&&i.setStyle("border",this.border),e.setStyle("display","inline-block"),e.setStyle("height",e.height+e.depth,"em"),e.setStyle("vertical-align",-e.depth+s,"em");const a=Yt([i,e]);return a.setStyle("position","relative"),a.setStyle("vertical-align",-s+e.depth,"em"),a.height=e.height+s,a.depth=e.depth+s,a.setLeft(s),a.setRight(s),a}decomposeEnclose(t){const e=Qt(he(t,this.body)),i="auto"===this.padding?.2:this.padding;e.setStyle("padding",i,"em"),e.setStyle("display","inline-block"),e.setStyle("height",e.height+e.depth,"em"),e.setStyle("left",-i,"em"),this.backgroundcolor&&"transparent"!==this.backgroundcolor&&e.setStyle("background-color",this.backgroundcolor);let s="";if(this.notation.box&&e.setStyle("border",this.borderStyle),this.notation.actuarial&&(e.setStyle("border-top",this.borderStyle),e.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(e.setStyle("border-bottom",this.borderStyle),e.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(e.setStyle("border-radius",(et.height(e)+et.depth(e))/2,"em"),e.setStyle("border",this.borderStyle)),this.notation.circle&&(e.setStyle("border-radius","50%"),e.setStyle("border",this.borderStyle)),this.notation.top&&e.setStyle("border-top",this.borderStyle),this.notation.left&&e.setStyle("border-left",this.borderStyle),this.notation.right&&e.setStyle("border-right",this.borderStyle),this.notation.bottom&&e.setStyle("border-bottom",this.borderStyle),this.notation.horizontalstrike&&(s+='0?i.setWidth(this.width):i.setStyle("margin-left",this.width,"em");else{const t={qquad:"qquad",quad:"quad",enspace:"enspace",";":"thickspace",":":"mediumspace",",":"thinspace","!":"negativethinspace"}[this.body]||"quad";i=Yt("​","mspace "+t)}else"mathstyle"===this.type?t.setMathstyle(this.mathstyle):"box"===this.type?i=this.decomposeBox(t):"enclose"===this.type?i=this.decomposeEnclose(t):"command"===this.type||"error"===this.type?((i=this.makeSpan(t,this.body)).classes="",this.error&&(i.classes+=" ML__error"),this.suggestion&&(i.classes+=" ML__suggestion")):"placeholder"===this.type?i=this.makeSpan(t,"⬚"):"first"===this.type&&(i=this.makeSpan(t,"​"));if(!i)return i;if(this.caret&&"styling"!==this.type&&"msubsup"!==this.type&&"command"!==this.type&&"placeholder"!==this.type&&"first"!==this.type&&(Array.isArray(i)?i[i.length-1].caret=this.caret:i.caret=this.caret),!this.limits&&(this.superscript||this.subscript))if(Array.isArray(i)){const e=i[i.length-1];i[i.length-1]=this.attachSupsub(t,e,e.type)}else i=[this.attachSupsub(t,i,i.type)];return Array.isArray(i)?i:[i]}attachSupsub(t,e,i){if(!this.superscript&&!this.subscript)return e;const s=t.mathstyle;let a=null,o=null;if(this.superscript){const e=he(t.sup(),this.superscript);a=Yt(e,s.adjustTo(s.sup()))}if(this.subscript){const e=he(t.sub(),this.subscript);o=Yt(e,s.adjustTo(s.sub()))}let n,r=0,l=0;this.isCharacterBox()||(r=et.height(e)-s.metrics.supDrop,l=et.depth(e)+s.metrics.subDrop),n=s===O.DISPLAY?s.metrics.sup1:s.cramped?s.metrics.sup3:s.metrics.sup2;const c=O.TEXT.sizeMultiplier*s.sizeMultiplier,h=.5/S.ptPerEm/c;let d=null;if(o&&a){r=Math.max(r,n,a.depth+.25*s.metrics.xHeight),l=Math.max(l,s.metrics.sub2);const i=S.defaultRuleThickness;if(r-et.depth(a)-(et.height(o)-l)<4*i){l=4*i-(r-a.depth)+et.height(o);const t=.8*s.metrics.xHeight-(r-et.depth(a));t>0&&(r+=t,l-=t)}d=ie(t,[o,l,a,-r],"individualShift"),this.symbol&&d.children[0].setLeft(-et.italic(e))}else o&&!a?(l=Math.max(l,s.metrics.sub1,et.height(o)-.8*s.metrics.xHeight),(d=ie(t,[o],"shift",l)).children[0].setRight(h),this.isCharacterBox()&&d.children[0].setLeft(-et.italic(e))):!o&&a&&(r=Math.max(r,n,a.depth+.25*s.metrics.xHeight),(d=ie(t,[a],"shift",-r)).children[0].setRight(h));const p=Yt(d,"msubsup");return this.caret&&(p.caret=this.caret),et.makeSpanOfType(i,[e,p])}attachLimits(t,e,i,s){const a=this.superscript?Yt(he(t.sup(),this.superscript),t.mathstyle.adjustTo(t.mathstyle.sup())):null,o=this.subscript?Yt(he(t.sub(),this.subscript),t.mathstyle.adjustTo(t.mathstyle.sub())):null;return ce(t,e,i,s,a,o,"mop")}bind(t,e){return"first"!==this.type&&"​"!==this.body&&(this.id=function(t){let e;return"boolean"==typeof t.generateID&&t.generateID?e=Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36):"boolean"!=typeof t.generateID&&(t.generateID.overrideID?e=t.generateID.overrideID:(e=t.generateID.seed.toString(36),t.generateID.seed+=1)),e}(t),this.id&&(e.attributes||(e.attributes={}),e.attributes["data-atom-id"]=this.id)),e}makeSpan(t,e){const i="textord"===this.type?"mord":this.type,s=et.makeSpanOfType(i,e),a=this.getStyle();s.applyStyle(a);const o=a&&a.fontSize?a.fontSize:"size5";return o!==t.parentSize?(s.classes+=" sizing reset-"+t.parentSize,s.classes+=" "+o):t.parentSize!==t.size&&(s.classes+=" sizing reset-"+t.parentSize,s.classes+=" "+t.size),s.maxFontSize=Math.max(s.maxFontSize,t.sizeMultiplier||1),"text"===this.mode&&(s.classes+=" ML__text"),t.mathstyle.isTight()&&(s.isTight=!0),"math"!==this.mode&&(s.italic=0),s.setRight(s.italic),"number"==typeof t.opacity&&s.setStyle("opacity",t.opacity),this.bind(t,s),this.caret&&(this.superscript||this.subscript||(s.caret=this.caret,t.mathstyle.isTight()&&(s.isTight=!0))),s}}function re(t){const e=Yt("​","arraycolsep");return e.setWidth(t,"em"),e}function le(t,e,i,s){const a=[];for(const o of e){const e=Yt(he(t,s));e.depth=o.depth,e.height=o.height,a.push(e),a.push(o.pos-i)}return ie(t,a,"individualShift")}function ce(t,e,i,s,a,o,n){if(!a&&!o)return e;e=Yt(e);let r=0,l=0;a&&(r=Math.max(S.bigOpSpacing1,S.bigOpSpacing3-a.depth)),o&&(l=Math.max(S.bigOpSpacing2,S.bigOpSpacing4-o.height));let c=null;if(o&&a){const n=S.bigOpSpacing5+et.height(o)+et.depth(o)+l+et.depth(e)+i;(c=ie(t,[S.bigOpSpacing5,o,l,e,r,a,S.bigOpSpacing5],"bottom",n)).children[0].setLeft(-s),c.children[2].setLeft(s)}else if(o&&!a){const a=et.height(e)-i;(c=ie(t,[S.bigOpSpacing5,o,l,e],"top",a)).children[0].setLeft(-s)}else if(!o&&a){const o=et.depth(e)+i;(c=ie(t,[e,r,a,S.bigOpSpacing5],"bottom",o)).children[1].setLeft(s)}return et.makeSpanOfType(n,c,"op-limits")}function he(t,e){t instanceof K.Context||(t=new K.Context(t));const i=!t.generateID||!t.generateID.groupNumbers;let s=[];if(Array.isArray(e)){if(0===e.length)return s;if(1===e.length)(s=e[0].decompose(t))&&i&&e[0].isSelected&&s.forEach(t=>t.selected(!0));else{let a="none",o=e[1].type,n=[],r=null,l=null;for(let c=0;ct.selected(!0)):(n.length>0&&(s=[...s,...n],n=[]),s=s.concat(a))}a=e[c].getFinalBaseElement().type,o=e[c+1]?e[c+1].getInitialBaseElement().type:"none"}n.length>0&&(s=[...s,...n],n=[])}}else e&&(s=e.decompose(t))&&i&&e.isSelected&&s.forEach(t=>t.selected(!0));if(!s||0===s.length)return null;if(t.mathstyle!==t.parentMathstyle){const e=t.mathstyle.sizeMultiplier/t.parentMathstyle.sizeMultiplier;for(const t of s)t.height*=e,t.depth*=e}if(t.size!==t.parentSize){const e=oe[t.size]/oe[t.parentSize];for(const t of s)t.height*=e,t.depth*=e}return s}var de={MathAtom:ne,decompose:he,makeRoot:function(t,e){const i=new ne(t=t||"math","root",e||[]);return 0!==i.body.length&&"first"===i.body[0].type||i.body.unshift(new ne("","first")),i},GREEK_REGEX:se};const pe={m0:"#3f3d99",m1:"#993d71",m2:"#998b3d",m3:"#3d9956",m4:"#3d5a99",m5:"#993d90",m6:"#996d3d",m7:"#43993d",m8:"#3d7999",m9:"#843d99"},me={apricot:"#FBB982",aquamarine:"#00B5BE",bittersweet:"#C04F17",black:"#221E1F",blue:"#2D2F92",bluegreen:"#00B3B8",blueviolet:"#473992",brickred:"#B6321C",brown:"#792500",burntorange:"#F7921D",cadetblue:"#74729A",carnationpink:"#F282B4",cerulean:"#00A2E3",cornflowerblue:"#41B0E4",cyan:"#00AEEF",dandelion:"#FDBC42",darkorchid:"#A4538A",emerald:"#00A99D",forestgreen:"#009B55",fuchsia:"#8C368C",goldenrod:"#FFDF42",gray:"#949698",green:"#00A64F",greenyellow:"#DFE674",junglegreen:"#00A99A",lavender:"#F49EC4",limegreen:"#8DC73E",magenta:"#EC008C",mahogany:"#A9341F",maroon:"#AF3235",melon:"#F89E7B",midnightblue:"#006795",mulberry:"#A93C93",navyblue:"#006EB8",olivegreen:"#3C8031",orange:"#F58137",orangered:"#ED135A",orchid:"#AF72B0",peach:"#F7965A",periwinkle:"#7977B8",pinegreen:"#008B72",plum:"#92268F",processblue:"#00B0F0",purple:"#99479B",rawsienna:"#974006",red:"#ED1B23",redorange:"#F26035",redviolet:"#A1246B",rhodamine:"#EF559F",royalblue:"#0071BC",royalpurple:"#613F99",rubinered:"#ED017D",salmon:"#F69289",seagreen:"#3FBC9D",sepia:"#671800",skyblue:"#46C5DD",springgreen:"#C6DC67",tan:"#DA9D76",tealblue:"#00AEB3",thistle:"#D883B7",turquoise:"#00B4CE",violet:"#58429B",violetred:"#EF58A0",white:"#FFFFFF",wildstrawberry:"#EE2967",yellow:"#FFF200",yellowgreen:"#98CC70",yelloworange:"#FAA21A"};var ue={stringToColor:function(t){const e=t.toLowerCase().split("!");let i,s,a,o=255,n=255,r=255,l=-1;const c=e.length>0&&"-"===e[0].charAt(0);c&&(e[0]=e[0].slice(1));for(let t=0;t=0&&(o=(1-l)*o+l*i,n=(1-l)*n+l*s,r=(1-l)*r+l*a,l=-1),t+1=0&&(o=l*o+(1-l)*i,n=l*n+(1-l)*s,r=l*r+(1-l)*a),c&&(o=255-o,n=255-n,r=255-r),"#"+("00"+Math.round(o).toString(16)).slice(-2)+("00"+Math.round(n).toString(16)).slice(-2)+("00"+Math.round(r).toString(16)).slice(-2)},colorToString:function(t){let e=t.toUpperCase();for(const t in me)if(me[t]===e){e=t;break}for(const t in pe)if(pe[t]===e){e=t;break}return e},AREA_COLORS:["#d35d60","#7293cb","#e1974d","#84bb5d","#9066a7","#aD6a58","#f5a4ce","#fff590","#212121","#818787","#d4d5d2","#ffffff"],LINE_COLORS:["#cc2428","#3769b1","#da7e30","#409852","#6b4c9a","#922426","#e7298a","#ffe907","#000000","#525055","#adafaa","#ffffff"]};const fe=de.MathAtom;class ge{constructor(t,e,i){this.tokens=t,this.index=0,this.args=e,this.macros=i,this.mathList=[],this.style={},this.parseMode="math",this.tabularMode=!1,this.endCount=0}swapMathList(t){const e=this.mathList;return this.mathList=t||[],e}swapParseMode(t){const e=this.parseMode;return this.parseMode=t,e}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}get(){return this.endCount=0,this.index=t.length}const a=t.toUpperCase()===s.toUpperCase();return a||(this.index=e),a}scanString(){let t="",e=this.end();for(;!e;){if(this.hasLiteral("]"))e=!0;else if(this.hasToken("literal"))t+=this.get().value;else if(this.skipWhitespace())t+=" ";else if(this.hasToken("command")){const e=this.get();"space"===e.value?t+=" ":t+=e.value}else e=!0;e=e||this.end()}return t}scanColor(){return ue.stringToColor(this.scanString())}scanNumber(t){const e=this.parseLiteral("-");e||this.parseLiteral("+"),this.skipWhitespace(),t=!!t;let i=10,s=/[0-9]/;this.parseLiteral("'")?(i=8,s=/[0-7]/,t=!0):(this.parseLiteral('"')||this.parseLiteral("x"))&&(i=16,s=/[0-9A-F]/,t=!0);let a="";for(;this.hasLiteralPattern(s);)a+=this.get().value;if(!t&&(this.parseLiteral(".")||this.parseLiteral(",")))for(a+=".";this.hasLiteralPattern(s);)a+=this.get().value;const o=t?parseInt(a,i):parseFloat(a);return e?-o:o}scanDimen(){const t=this.scanNumber(!1);return this.skipWhitespace(),this.parseKeyword("pt")?M.toEm(t,"pt"):this.parseKeyword("mm")?M.toEm(t,"mm"):this.parseKeyword("cm")?M.toEm(t,"cm"):this.parseKeyword("ex")?M.toEm(t,"ex"):this.parseKeyword("px")?M.toEm(t,"px"):this.parseKeyword("em")?M.toEm(t,"em"):this.parseKeyword("bp")?M.toEm(t,"bp"):this.parseKeyword("dd")?M.toEm(t,"dd"):this.parseKeyword("pc")?M.toEm(t,"pc"):this.parseKeyword("in")?M.toEm(t,"in"):this.parseKeyword("mu")?M.toEm(t,"mu"):M.toEm(t,"pt")}scanSkip(){const t=this.scanDimen();return this.skipWhitespace(),this.parseKeyword("plus")&&this.scanDimen(),this.skipWhitespace(),this.parseKeyword("minus")&&this.scanDimen(),t}scanColspec(){this.skipWhitespace();const t=[];for(;!this.end()&&!this.hasToken("}")&&!this.hasLiteral("]");)if(this.hasLiteral()){const e=this.get().value;if("lcr".includes(e))t.push({align:e});else if("|"===e)t.push({rule:!0});else if("@"===e){if(this.parseToken("{")){const e=this.swapParseMode("math");t.push({gap:this.scanImplicitGroup(t=>"}"===t.type)}),this.swapParseMode(e)}this.parseToken("}")}}return t}scanModeSet(){let t;if(this.parseCommand("(")&&(t=")"),!t&&this.parseCommand("[")&&(t="]"),!t)return null;const e=this.swapParseMode("math"),i=new fe("math","group");return i.mathstyle=")"===t?"textstyle":"displaystyle",i.body=this.scanImplicitGroup(e=>"command"===e.type&&e.value===t),this.parseCommand(t),this.swapParseMode(e),i.body&&0!==i.body.length?i:null}scanModeShift(){if(!this.hasToken("$")&&!this.hasToken("$$"))return null;const t=this.get().type,e=new fe("math","group");e.mathstyle="$"===t?"textstyle":"displaystyle",e.latexOpen="textstyle"===e.mathstyle?"$":"$$",e.latexClose=e.latexOpen;const i=this.swapParseMode("math");return e.body=this.scanImplicitGroup(e=>e.type===t),this.parseToken(t),this.swapParseMode(i),e.body&&0!==e.body.length?e:null}scanEnvironment(){if(!this.parseCommand("begin"))return null;const t=this.scanArg("string"),e=Pt.getEnvironmentInfo(t),i=[];if(e&&e.params)for(const t of e.params)if(t.optional){const e=this.scanOptionalArg(t.type);i.push(e)}else i.push(this.scanArg(t.type));const s=this.parseMode,a=this.tabularMode,o=this.swapMathList([]);this.tabularMode=e.tabular;const n=[],r=[];let l=[],c=!1;do{if(!(c=this.end())&&this.parseCommand("end")&&(c=this.scanArg("string")===t),!c)if(this.parseColumnSeparator())l.push(this.swapMathList([]));else if(this.parseRowSeparator()){l.push(this.swapMathList([]));let t=0;this.skipWhitespace(),this.parseLiteral("[")&&(t=this.scanDimen(),this.skipWhitespace(),this.parseLiteral("]")),r.push(t||0),n.push(l),l=[]}else this.mathList=this.mathList.concat(this.scanImplicitGroup())}while(!c);l.push(this.swapMathList([])),l.length>0&&n.push(l);const h=this.swapMathList(o);if(this.parseMode=s,this.tabularMode=a,!e.tabular&&0===h.length)return null;if(e.tabular&&0===n.length)return null;const d=new fe(this.parseMode,"array",h,e.parser?e.parser(t,i,n):{});return d.array=n,d.rowGaps=r,d.env={...e},d.env.name=t,d}scanImplicitGroup(t){const e=this.style;t||(t=(t=>"}"===t.type||"literal"===t.type&&"&"===t.value||"command"===t.type&&/^(end|cr|\\)$/.test(t.value)));let i=null,s=null;const a=this.swapMathList([]);for(;!this.end()&&!t(this.peek());)if(this.hasImplicitCommand(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"])){this.parseMode="math";const t=new fe("math","mathstyle");t.mathstyle=this.get().value,this.mathList.push(t)}else this.hasInfixCommand()&&!i?(i=this.get(),s=this.swapMathList([])):this.parseAtom();let o;if(i){const t=this.swapMathList(a),e=Pt.getInfo("\\"+i.value,"math",this.macros);o=e?[new fe(this.parseMode,e.type,e.value||i.value,e.parse?e.parse("\\"+i.value,[s,t]):null)]:[new fe(this.parseMode,"mop",i.value)]}else o=this.swapMathList(a);return this.style=e,o}scanGroup(){if(!this.parseToken("{"))return null;const t=new fe(this.parseMode,"group");return t.body=this.scanImplicitGroup(t=>"}"===t.type),this.parseToken("}"),t.latexOpen="{",t.latexClose="}",t}scanSmartFence(){if(this.skipWhitespace(),!this.parseLiteral("("))return null;const t=new fe(this.parseMode,"leftright");t.leftDelim="(",t.inner=!1;const e=this.swapMathList([]);let i=1;for(;!this.end()&&0!==i;)this.hasLiteral("(")&&(i+=1),this.hasLiteral(")")&&(i-=1),0!==i&&this.parseAtom();return 0===i&&this.parseLiteral(")"),t.rightDelim=0===i?")":"?",t.body=this.swapMathList(e),t}scanDelim(){this.skipWhitespace();const t=this.get();if(!t)return null;let e=".";"command"===t.type?e="\\"+t.value:"literal"===t.type&&(e=t.value);const i=Pt.getInfo(e,"math",this.macros);return i?"mopen"===i.type||"mclose"===i.type?e:/^(\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:null:null}scanLeftRight(){if(this.parseCommand("right")||this.parseCommand("mright")){const t=new fe(this.parseMode,"leftright");return t.rightDelim=this.scanDelim()||".",t}const t=this.style;let e="right";if(!this.parseCommand("left")){if(!this.parseCommand("mleft"))return null;e="mright"}const i=this.scanDelim()||".",s=this.swapMathList([]);for(;!this.end()&&!this.parseCommand(e);)this.parseAtom();this.style=t;const a=this.scanDelim(),o=new fe(this.parseMode,"leftright");return o.leftDelim=i,o.rightDelim=a,o.inner="right"===e,o.body=this.swapMathList(s),o}parseSupSub(){if("math"!==this.parseMode)return!1;let t=!1;for(;this.hasLiteral("^")||this.hasLiteral("_")||this.hasLiteral("'");){let e;if(this.hasLiteral("^")?e="superscript":this.hasLiteral("_")&&(e="subscript"),this.parseLiteral("^")||this.parseLiteral("_")){const i=this.scanArg();if(i){const s=this.lastMathAtom();s[e]=s[e]||[],s[e]=s[e].concat(i),t=!0}}else if(this.parseLiteral("'")){const e=this.lastMathAtom();e.superscript=e.superscript||[],e.superscript.push(new fe(e.parseMode,"mord","′")),t=!0}}return t}parseLimits(){if(this.parseCommand("limits")){const t=this.lastMathAtom();return t.limits="limits",t.explicitLimits=!0,!0}if(this.parseCommand("nolimits")){const t=this.lastMathAtom();return t.limits="nolimits",t.explicitLimits=!0,!0}return!1}scanOptionalArg(t){if(t=t&&"auto"!==t?t:this.parseMode,this.skipWhitespace(),!this.parseLiteral("["))return null;const e=this.parseMode;this.parseMode=t;const i=this.swapMathList();let s;for(;!this.end()&&!this.parseLiteral("]");)if("string"===t)s=this.scanString();else if("number"===t)s=this.scanNumber();else if("dimen"===t)s=this.scanDimen();else if("skip"===t)s=this.scanSkip();else if("colspec"===t)s=this.scanColspec();else if("color"===t)s=this.scanColor()||"#ffffff";else if("bbox"===t){const t=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const e of t){const t=ue.stringToColor(e);if(t)(s=s||{}).backgroundcolor=t;else{const t=e.match(/^\s*([0-9.]+)\s*([a-z][a-z])/);if(t)(s=s||{}).padding=M.toEm(t[1],t[2]);else{const t=e.match(/^\s*border\s*:\s*(.*)/);t&&((s=s||{}).border=t[1])}}}}else this.mathList=this.mathList.concat(this.scanImplicitGroup(t=>"literal"===t.type&&"]"===t.value));this.parseMode=e;const a=this.swapMathList(i);return s||a}scanArg(t){let e;if(t=t&&"auto"!==t?t:this.parseMode,this.parseFiller(),!this.parseToken("{")){if("delim"===t)return this.scanDelim()||".";if(/^(math|text)$/.test(t)){const e=this.parseMode;this.parseMode=t;const i=this.scanToken();return this.parseMode=e,Array.isArray(i)?i:i?[i]:null}}if(this.hasToken("#")){const t=this.get();return this.skipUntilToken("}"),"?"===t.value?this.placeholder():this.args?void 0===this.args[t.value]&&void 0!==this.args["?"]?this.placeholder():this.args[t.value]||null:null}const i=this.parseMode;this.parseMode=t;const s=this.swapMathList([]);if("string"===t)e=this.scanString(),this.skipUntilToken("}");else if("number"===t)e=this.scanNumber(),this.skipUntilToken("}");else if("dimen"===t)e=this.scanDimen(),this.skipUntilToken("}");else if("skip"===t)e=this.scanSkip(),this.skipUntilToken("}");else if("colspec"===t)e=this.scanColspec(),this.skipUntilToken("}");else if("color"===t)e=this.scanColor()||"#ffffff",this.skipUntilToken("}");else if("delim"===t)e=this.scanDelim()||".",this.skipUntilToken("}");else do{this.mathList=this.mathList.concat(this.scanImplicitGroup())}while(!this.parseToken("}")&&!this.end());this.parseMode=i;const a=this.swapMathList(s);return e||a}scanToken(){const t=this.get();if(!t)return null;let e=null;if("space"===t.type)"text"===this.parseMode&&(e=new fe("text",""," ",this.style));else if("placeholder"===t.type)(e=new fe(this.parseMode,"placeholder",t.value)).captureSelection=!0;else if("command"===t.type){if("placeholder"===t.value)(e=new fe(this.parseMode,"placeholder",this.scanArg("string"),this.style)).captureSelection=!0;else if("char"===t.value){let t=Math.floor(this.scanNumber(!0));(!isFinite(t)||t<0||t>1114111)&&(t=10067),(e=new fe(this.parseMode,"math"===this.parseMode?"mord":"",String.fromCodePoint(t))).latex='{\\char"'+("000000"+t.toString(16)).toUpperCase().substr(-6)+"}"}else if("hskip"===t.value||"kern"===t.value){const i=this.scanSkip();isFinite(i)&&((e=new fe(this.parseMode,"spacing",null,this.style)).width=i),e.latex="\\"+t.value}else if(!(e=this.scanMacro(t.value))){const i=Pt.getInfo("\\"+t.value,this.parseMode,this.macros),s=[];let a="",o="";if(i&&i.params)for(const t of i.params)if(t.optional){const e=this.scanOptionalArg(t.type);s.push(e)}else if(t.type.endsWith("*"))o=t.type.slice(0,-1);else{const e=this.scanArg(t.type);if(e&&1===e.length&&"placeholder"===e[0].type&&t.placeholder&&(e[0].value=t.placeholder),e)s.push(e);else if(t.placeholder){const e=new fe(this.parseMode,"placeholder",t.placeholder);e.captureSelection=!0,s.push([e])}else s.push(this.placeholder());"math"!==t.type&&"string"==typeof e&&(a+=e)}if(i&&!i.infix){if(i.parse){const a=i.parse("\\"+t.value,s);if(a.type)e=new fe(this.parseMode,i.type,o?this.scanArg(o):null,{...this.style,...a});else{const t=this.parseMode;if(a.mode&&(this.parseMode=a.mode,delete a.mode),o){const t=this.style;this.style={...this.style,...a},e=this.scanArg(o),this.style=t}else this.style={...this.style,...a};this.parseMode=t}}else{const s={...this.style};i.baseFontFamily&&(s.baseFontFamily=i.baseFontFamily),e=new fe(this.parseMode,i.type||"mop",i.value||t.value,s),i.skipBoundary&&(e.skipBoundary=!0)}if(e&&!/^(llap|rlap|class|cssId)$/.test(t.value)&&(e.latex="\\"+t.value,a&&(e.latex+="{"+a+"}"),e.isFunction&&this.smartFence)){const t=this.scanSmartFence();t&&(e=[e,t])}}i||((e=new fe(this.parseMode,"error","\\"+t.value)).latex="\\"+t.value)}}else if("literal"===t.type){const i=Pt.getInfo(t.value,this.parseMode,this.macros);if(i){const s={...this.style};i.baseFontFamily&&(s.baseFontFamily=i.baseFontFamily),e=new fe(this.parseMode,i.type,i.value||t.value,s),i.isFunction&&(e.isFunction=!0)}else e=new fe(this.parseMode,"math"===this.parseMode?"mord":"",t.value,this.style);if(e.latex=Pt.matchCodepoint(this.parseMode,t.value.codePointAt(0)),i&&i.isFunction&&this.smartFence){const t=this.scanSmartFence();t&&(e=[e,t])}}else if("#"===t.type)if("?"===t.value)e=this.placeholder();else if(this.args)if(e=this.args[t.value]||null,Array.isArray(e)&&1===e.length)e=e[0];else if(Array.isArray(e)){const t=new fe(this.parseMode,"group");t.body=e,e=t}else e=this.placeholder();return e}scanMacro(t){if(!this.macros||!this.macros[t])return null;const e={};let i,s=0;"string"==typeof this.macros[t]?(i=this.macros[t],/(^|[^\\])#1/.test(i)&&(s=1),/(^|[^\\])#2/.test(i)&&(s=2),/(^|[^\\])#3/.test(i)&&(s=3),/(^|[^\\])#4/.test(i)&&(s=4),/(^|[^\\])#5/.test(i)&&(s=5),/(^|[^\\])#6/.test(i)&&(s=6),/(^|[^\\])#7/.test(i)&&(s=7),/(^|[^\\])#8/.test(i)&&(s=8),/(^|[^\\])#9/.test(i)&&(s=9)):(i=this.macros[t].def,s=this.macros[t].args||0);for(let t=1;t<=s;t++)e[t]=this.scanArg();this.args&&"string"==typeof this.args["?"]&&(e["?"]=this.args["?"]);const a=new fe(this.parseMode,"group",ye(x.tokenize(i),this.parseMode,e,this.macros));a.captureSelection=!0,a.latex="\\"+t;let o="";for(let t=1;t<=s;t++){if(o+="{",Array.isArray(e[t]))for(let i=0;i1&&(e.extent=parseInt(i[1]));const s=i[0].split("/");for(const t of s){const i=t.match(/([^:]*):(.*)/);i&&e.path.push({relation:i[1],offset:parseInt(i[2])})}return e}var ve={pathFromString:ke,pathToString:xe,pathDistance:function(t,e){let i=-1,s=!1;for(;!s;)s=(s=(i+=1)>=t.length||i>=e.length)||!(t[i].relation===e[i].relation&&t[i].offset===e[i].offset);return i===t.length&&i===e.length?0:i+1===t.length&&i+1===e.length&&t[i].relation===e[i].relation?1:2},pathCommonAncestor:function(t,e){const i=[],s=Math.min(t.length-1,e.length-1);let a=0;for(;a<=s&&t[a].relation===e[a].relation&&t[a].offset===e[a].offset;)i.push(t[a]),a+=1;return i},clone:function(t){return ke(xe(t)).path}};const we={Left:"moveToPreviousChar",Right:"moveToNextChar",Up:"moveUp",Down:"moveDown","Shift-Left":"extendToPreviousChar","Shift-Right":"extendToNextChar","Shift-Up":"extendUp","Shift-Down":"extendDown",Backspace:"deletePreviousChar","Alt-Del":"deletePreviousChar",Del:"deleteNextChar","Alt-Backspace":"deleteNextChar","Alt-Left":"moveToPreviousWord","Alt-Right":"moveToNextWord","Alt-Shift-Left":"extendToPreviousWord","Alt-Shift-Right":"extendToNextWord","Ctrl-Left":"moveToGroupStart","Ctrl-Right":"moveToGroupEnd","Ctrl-Shift-Left":"extendToGroupStart","Ctrl-Shift-Right":"extendToGroupEnd","math:Spacebar":"moveAfterParent","math:Shift-Spacebar":"moveBeforeParent",Home:"moveToMathFieldStart","mac:Meta-Left":"moveToMathFieldStart","Shift-Home":"extendToMathFieldStart","mac:Meta-Shift-Left":"extendToMathFieldStart",End:"moveToMathFieldEnd","mac:Meta-Right":"moveToMathFieldEnd","Shift-End":"extendToMathFieldEnd","mac:Meta-Shift-Right":"extendToMathFieldEnd",PageUp:"moveToGroupStart",PageDown:"moveToGroupEnd","math:Tab":"moveToNextPlaceholder","math:F8":"moveToNextPlaceholder","math:Shift-Tab":"moveToPreviousPlaceholder","math:Shift-F8":"moveToPreviousPlaceholder","text:Tab":"moveToNextPlaceholder","text:F8":"moveToNextPlaceholder","text:Shift-Tab":"moveToPreviousPlaceholder","text:Shift-F8":"moveToPreviousPlaceholder","math:Esc":["switch-mode","command"],"math:Backslash":["switch-mode","command"],"math:IntlBackslash":["switch-mode","command"],"math:Alt-Equal":["apply-style",{mode:"text"}],"text:Alt-Equal":["apply-style",{mode:"math"}],"command:Esc":["complete",{discard:!0}],"command:Tab":["complete",{acceptSuggestion:!0}],"command:Return":"complete","command:Enter":"complete","command:Shift-Esc":["complete",{discard:!0}],"command:Down":"nextSuggestion","ios:command:Tab":"nextSuggestion","command:Up":"previousSuggestion","!mac:Ctrl-KeyA":"selectAll","mac:Meta-KeyA":"selectAll",Cut:"cut",Copy:"copy",Paste:"paste",Clear:"delete","!mac:Ctrl-KeyZ":"undo","mac:Meta-KeyZ":"undo",Undo:"undo","!mac:Ctrl-KeyY":"redo","mac:Meta-Shift-KeyY":"redo","!mac:Ctrl-Shift-KeyZ":"redo","mac:Meta-Shift-KeyZ":"redo",Redo:"redo",EraseEof:"deleteToGroupEnd","mac:Ctrl-KeyB":"moveToPreviousChar","mac:Ctrl-KeyF":"moveToNextChar","mac:Ctrl-KeyP":"moveUp","mac:Ctrl-KeyN":"moveDown","mac:Ctrl-KeyA":"moveToMathFieldStart","mac:Ctrl-KeyE":"moveToMathFieldEnd","mac:Ctrl-Shift-KeyB":"extendToPreviousChar","mac:Ctrl-Shift-KeyF":"extendToNextChar","mac:Ctrl-Shift-KeyP":"extendUp","mac:Ctrl-Shift-KeyN":"extendDown","mac:Ctrl-Shift-KeyA":"extendToMathFieldStart","mac:Ctrl-Shift-KeyE":"extendToMathFieldEnd","mac:Ctrl-Alt-KeyB":"moveToPreviousWord","mac:Ctrl-Alt-KeyF":"moveToNextWord","mac:Ctrl-Shift-Alt-KeyB":"extendToPreviousWord","mac:Ctrl-Shift-Alt-KeyF":"extendToNextWord","mac:Ctrl-KeyH":"deletePreviousChar","mac:Ctrl-KeyD":"deleteNextChar","mac:Ctrl-KeyL":"scrollIntoView","mac:Ctrl-KeyT":"transpose","math:Shift-Quote":["switch-mode","text","","“"],"text:Shift-Quote":["switch-mode","math","”",""],"math:Ctrl-Digit2":["insert","\\sqrt{#0}"],"math:Ctrl-Digit5":"moveToOpposite","math:Ctrl-Digit6":"moveToSuperscript","math:Ctrl-Minus":"moveToSubscript","math:Alt-BracketLeft":["insert","\\left\\lbrack #0 \\right\\rbrack"],"math:Alt-Shift-BracketLeft":["insert","\\left\\lbrace #0 \\right\\rbrace"],"math:Return":"addRowAfter","math:Enter":"addRowAfter","math:Ctrl-Comma":"addColumnAfter","math:Alt-KeyQ":["insert","\\theta"],"math:Alt-KeyP":["insert","\\pi"],"math:Alt-KeyV":["insert","\\sqrt{#0}"],"math:Alt-KeyW":["insert","\\sum_{i=#?}^{#?}"],"math:Alt-KeyB":["insert","\\int_{#?}^{#?}"],"math:Alt-KeyU":["insert","\\cup"],"math:Alt-KeyN":["insert","\\cap"],"math:Alt-KeyO":["insert","\\emptyset"],"math:Alt-KeyD":["insert","\\differentialD"],"math:Alt-Shift-KeyO":["insert","\\varnothing"],"math:Alt-Shift-KeyD":["insert","\\partial"],"math:Alt-Shift-KeyP":["insert","\\prod_{i=#?}^{#?}"],"math:Alt-Shift-KeyU":["insert","\\bigcup"],"math:Alt-Shift-KeyN":["insert","\\bigcap"],"math:Alt-Shift-KeyA":["insert","\\forall"],"math:Alt-Shift-KeyE":["insert","\\exists"],"math:Alt-Digit5":["insert","\\infty"],"math:Alt-Digit6":["insert","\\wedge"],"math:Alt-Shift-Digit6":["insert","\\vee"],"math:Alt-Digit9":["insert","("],"math:Alt-Digit0":["insert",")"],"math:Alt-Shift-Backslash":["insert","|"],"math:Alt-Backslash":["insert","\\backslash"],"math:Slash":["insert","\\frac{#@}{#?}"],"math:Alt-Slash":["insert","\\frac{#?}{#@}"],"math:NumpadDivide":["insert","\\frac{#@}{#?}"],"math:Alt-NumpadDivide":["insert","\\frac{#?}{#@}"],"math:Shift-Backquote":["insert","\\~"],"math:Alt-Shift-Slash":["insert","\\/"],"Alt-Shift-KeyK":"toggleKeystrokeCaption","Alt-Space":"toggleVirtualKeyboard","mac:Ctrl-Meta-Up":["speak","parent",{withHighlighting:!1}],"!mac:Ctrl-Alt-Up":["speak","parent",{withHighlighting:!1}],"mac:Ctrl-Meta-Down":["speak","group",{withHighlighting:!1}],"!mac:Ctrl-Alt-Down":["speak","group",{withHighlighting:!1}],"mac:Ctrl-Meta-Left":["speak","left",{withHighlighting:!1}],"!mac:Ctrl-Alt-Left":["speak","left",{withHighlighting:!1}],"mac:Ctrl-Meta-Right":["speak","right",{withHighlighting:!1}],"!mac:Ctrl-Alt-Right":["speak","right",{withHighlighting:!1}],"!mac:Ctrl-Alt-Period":["speak","selection",{withHighlighting:!1}],"mac:Ctrl-Meta-Period":["speak","selection",{withHighlighting:!1}],"mac:Ctrl-Meta-Shift-Up":["speak","parent",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Up":["speak","parent",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Down":["speak","group",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Down":["speak","group",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Left":["speak","left",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Left":["speak","left",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Right":["speak","right",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Right":["speak","right",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Period":["speak","selection",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Period":["speak","selection",{withHighlighting:!0}]},Se={"\\theta":"Alt-KeyQ","\\sqrt":["Alt-KeyV","Ctrl-Digit2"],"\\pi":"Alt-KeyP","\\prod":"Alt-Shift-KeyP","\\sum":"Alt-KeyW","\\int":"Alt-KeyB","\\cup":"Alt-KeyU","\\cap":"Alt-KeyN","\\bigcup":"Alt-Shift-KeyU","\\bigcap":"Alt-Shift-KeyN","\\forall":"Alt-Shift-KeyA","\\exists":"Alt-Shift-KeyE","\\infty":"Alt-Digit5","\\wedge":"Alt-Digit5","\\vee":"Alt-Shift-Digit6","\\differentialD":"Alt-keyD","\\partial":"Alt-Shift-KeyD","\\frac":"Slash","\\emptyset":"Alt-KeyO","\\varnothing":"Alt-Shift-KeyO","\\~":"~"},Ae={"''":{mode:"math",value:"^{\\doubleprime}"},alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:{mode:"math",value:"\\pi"},"pi ":{mode:"text",value:"\\pi "},"π":"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:{mode:"math",value:"\\nabla"},grad:{mode:"math",value:"\\nabla"},del:{mode:"math",value:"\\partial"},"∞":"\\infty",oo:{mode:"math",after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"∑":{mode:"math",value:"\\sum"},sum:{mode:"math",value:"\\sum_{#?}^{#?}"},prod:{mode:"math",value:"\\prod_{#?}^{#?}"},sqrt:{mode:"math",value:"\\sqrt"},"∆":{mode:"math",value:"\\differentialD"},"∂":{mode:"math",value:"\\differentialD"},sin:{mode:"math",value:"\\sin"},cos:{mode:"math",value:"\\cos"},tan:{mode:"math",value:"\\tan"},tanh:{mode:"math",value:"\\tanh"},log:{mode:"math",value:"\\log"},ln:{mode:"math",value:"\\ln"},exp:{mode:"math",value:"\\exp"},lim:{mode:"math",value:"\\lim_{#?}"},dx:"\\differentialD x",dy:"\\differentialD y",dt:"\\differentialD t",AA:{mode:"math",value:"\\forall"},EE:{mode:"math",value:"\\exists"},"!EE":{mode:"math",value:"\\nexists"},"&&":{mode:"math",value:"\\land"},xin:{mode:"math",after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},in:{mode:"math",after:"nothing+letter+closefence",value:"\\in"},"!in":{mode:"math",value:"\\notin"},NN:"\\N",ZZ:"\\Z",QQ:"\\Q",RR:"\\R",CC:"\\C",PP:"\\P",xx:"\\times","+-":"\\pm","!=":"\\ne",">=":"\\ge","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","≈":"\\approx","?=":"\\questeq","÷":"\\div","¬":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},"eta ":{mode:"text",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta "},gamma:"\\gamma",Gamma:"\\Gamma",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",Lambda:"\\Lambda",mu:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},"mu ":{mode:"text",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu "},nu:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},"nu ":{mode:"text",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu "},"µ":"\\mu",phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\phi"},Phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Phi"},varphi:"\\varphi",psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\psi"},Psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Psi"},rho:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\rho"},sigma:"\\sigma",Sigma:"\\Sigma",tau:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\tau"},vartheta:"\\vartheta",upsilon:"\\upsilon",xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\xi"},Xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Xi"},zeta:"\\zeta",omega:"\\omega",Omega:"\\Omega","Ω":"\\omega",forall:"\\forall",exists:{mode:"math",value:"\\exists"},"!exists":{mode:"math",value:"\\nexists"},":.":{mode:"math",value:"\\therefore"},liminf:"\\operatorname*{lim~inf}_{#?}",limsup:"\\operatorname*{lim~sup}_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:{mode:"math",value:"\\mod"},max:{mode:"math",value:"\\max"},min:{mode:"math",value:"\\min"},erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:{mode:"math",value:"\\operatorname{bessel}"},mean:{mode:"math",value:"\\operatorname{mean}"},median:{mode:"math",value:"\\operatorname{median}"},fft:{mode:"math",value:"\\operatorname{fft}"},lcm:{mode:"math",value:"\\operatorname{lcm}"},gcd:{mode:"math",value:"\\operatorname{gcd}"},randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:{mode:"math",value:"\\operatorname{Re}"},Im:{mode:"math",value:"\\operatorname{Im}"},mm:{mode:"math",after:"nothing+digit",value:"\\operatorname{mm}"},cm:{mode:"math",after:"nothing+digit",value:"\\operatorname{cm}"},km:{mode:"math",after:"nothing+digit",value:"\\operatorname{km}"},kg:{mode:"math",after:"nothing+digit",value:"\\operatorname{kg}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","->":"\\to","|->":"\\mapsto","--\x3e":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\Leftrightarrow","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","{":"\\{","}":"\\}","*":"\\cdot"};function Ce(t,e,i){if(!i)return i;if("string"==typeof i)return i;if("string"==typeof i.mode&&i.mode!==t)return null;if(!e)return i?i.value:void 0;let s=!1,a=!1,o=!1,n=!1,r=!1,l=!1,c=!1,h=!1,d=!1,p=!1,m=!1,u=!1,f=!1,g=!1,y=e[e.length-1],b=e.length-1;for(;y&&/msubsup|placeholder/.test(y.type);)y=e[b-=1];return s=!y||"first"===y.type,y&&(a=!(f="text"===y.mode)&&"mord"===y.type&&Pt.LETTER.test(y.body),o=!f&&"mord"===y.type&&/[0-9]+$/.test(y.body),n=!f&&y.isFunction,r="genfrac"===y.type,l="surd"===y.type,c="mbin"===y.type,h="mrel"===y.type,d="mpunct"===y.type||"minner"===y.type,p=y.array,m="mopen"===y.type,u="mclose"===y.type||"leftright"===y.type,g="space"===y.type),void 0!==i.after?/nothing/.test(i.after)&&s||/letter/.test(i.after)&&a||/digit/.test(i.after)&&o||/function/.test(i.after)&&n||/frac/.test(i.after)&&r||/surd/.test(i.after)&&l||/binop/.test(i.after)&&c||/relop/.test(i.after)&&h||/punct/.test(i.after)&&d||/array/.test(i.after)&&p||/openfence/.test(i.after)&&m||/closefence/.test(i.after)&&u||/text/.test(i.after)&&f||/space/.test(i.after)&&g?i.value:null:i.value}function Me(t){let e="other";return navigator&&navigator.platform&&navigator.userAgent&&(/^(mac)/i.test(navigator.platform)?e="mac":/^(win)/i.test(navigator.platform)?e="win":/(android)/i.test(navigator.userAgent)?e="android":/(iphone)/i.test(navigator.userAgent)||/(ipod)/i.test(navigator.userAgent)||/(ipad)/i.test(navigator.userAgent)?e="ios":/\bCrOS\b/i.test(navigator.userAgent)&&(e="chromeos")),e===t?t:"!"+t}function _e(t){let e=t;return Array.isArray(e)&&e.length>0&&(e=e[0]+"("+e.slice(1).join("")+")"),e}function Te(t,e){let i="";Array.isArray(t)||(t=[t]);for(const s of t){let t;const a=s.match(/(^[^:]*):/),o=a?a[1]:"";if(o===Me("mac")||o===Me("win")||o===Me("ios")||o===Me("android")||o===Me("chromeos")||o===Me("other")){const e=s.match(/:([^:]*)$/);t=e?e[1]:s}else if(!["mac","!mac","win","!win","ios","!ios","android","!android","chromeos","!chromeos","other","!other"].includes(o)){const e=s.match(/:([^:]*)$/);t=e?e[1]:s}if(t){const s="mac"===Me("mac")||"ios"===Me("ios"),a=t.length>1?t.split("-"):[t];let o="";for(const t of a)!s&&o.length>0&&(o+='+'),"Key"===t.substr(0,3)?o+=t.substr(3,1):"Digit"===t.substr(0,5)?o+=t.substr(5,1):o+={Meta:s?"⌘":"command",Shift:s?"⇧":"shift",Alt:s?"⌥":"alt",Ctrl:s?"⌃":"control","\n":s?"⏎":"return",Return:s?"⏎":"return",Enter:s?"⌤":"enter",Tab:s?"⇥":"tab",Esc:"esc",Backspace:s?"⌫":"backspace",Del:s?"⌦":"del",PageUp:s?"⇞":"page up",PageDown:s?"⇟":"page down",Home:s?"⤒":"home",End:s?"⤓":"end",Spacebar:"space",Semicolon:";",Period:".",Comma:",",Minus:"-",Equal:"=",Quote:"'",BracketLeft:"[",BracketRight:"]",Backslash:"\\",IntlBackslash:"\\",Backquote:"`",Slash:"/",NumpadMultiply:"* 🔢",NumpadDivide:"/ 🔢",NumpadSubtract:"- 🔢",NumpadAdd:"+ 🔢",NumpadDecimal:". 🔢",NumpadComma:", 🔢",Help:"help",Left:"⇠",Up:"⇡",Right:"⇢",Down:"⇣"}[t]||t;i.length>0&&(i+=e||" or "),i+=o}}return i}var Le={KEYBOARD_SHORTCUTS:we,INLINE_SHORTCUTS:Ae,stringify:Te,startsWithString:function(t,e){const i=[];for(let s=0;s<=t.length-1;s++){const a=t.substring(s);e&&e.overrideDefaultInlineShortcuts||Object.keys(Ae).forEach(t=>{t.startsWith(a)&&!i.includes(t)&&i.push(t)});const o=e&&e.inlineShortcuts?e.inlineShortcuts:null;o&&Object.keys(o).forEach(t=>{t.startsWith(a)&&i.push(t)})}return i},forString:function(t,e,i,s){let a="";s&&s.overrideDefaultInlineShortcuts||(a=Ce(t,e,Ae[i]));const o=s&&s.inlineShortcuts?s.inlineShortcuts:null;let n;return o&&(n=Ce(t,e,o[i])),n||a},selectorForKeystroke:function(t,e){for(const i of[Me("mac")+":"+t+":"+e,Me("win")+":"+t+":"+e,Me("ios")+":"+t+":"+e,Me("android")+":"+t+":"+e,Me("chromeos")+":"+t+":"+e,Me("other")+":"+t+":"+e,Me("mac")+":"+e,Me("win")+":"+e,Me("ios")+":"+e,Me("android")+":"+e,Me("chromeos")+":"+e,t+":"+e,e])if(we[i])return we[i];return""},forCommand:function(t){let e=[];if("string"==typeof t){const i=Se[t];Array.isArray(i)?e=i.slice():i&&e.push(i)}t=_e(t);const i=new RegExp("^"+t.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const t in we)if(we.hasOwnProperty(t)&&i.test(_e(we[t]))){const i=t.match(/:([^:]*)$/);i&&e.push(i[1])}return Te(e)}};function Fe(t,e){this.root=de.makeRoot(),this.path=[{relation:"body",offset:0}],this.extent=0,this.config=t?{...t}:{},this.target=e,this.suppressChangeNotifications=!1}function ze(t){const e=Object.assign(new Fe(t.config,t.target),t);return e.path=ve.clone(t.path),e}function De(t,e){let i=0;for(let s=0;s0;)i.col+=1,(!t[i.row]||i.col>=t[i.row].length)&&(i.col=0,i.row+=1),e-=1;return i}function qe(t,e){let i;return"object"!=typeof e&&(e=Ee(t,e)),Array.isArray(t[e.row])&&(i=t[e.row][e.col]||null),!i||0!==i.length&&"first"===i[0].type||i.unshift(Ve()),i}function Pe(t){let e=0,i=1;for(const s of t)e+=1,s.length>i&&(i=s.length);return e*i}function Ie(t,e,i){if(!t)return[];e||(e=",");let s,a=[];for(let o of t)o&&o.length>0&&"first"===o[0].type&&(o=o.slice(1)),o&&o.length>0&&(s?a.push(s):s=new de.MathAtom("math","mpunct",e,i),a=a.concat(o));return a}function Be(t,e,i){const s={...e};if(s.row+=i,s.row<0){if(s.col+=i,s.row=t.length-1,s.col<0)return null;for(;s.row>=0&&!qe(t,s);)s.row-=1;if(s.row<0)return null}else if(s.row>=t.length){for(s.col+=i,s.row=0;s.rowt.length-1)return null}return s}function Oe(t){return!!t&&("mord"===t.type&&/[0-9.]/.test(t.body)||"mpunct"===t.type&&","===t.body)}function Re(t,e){if(!t)return!1;if(Array.isArray(t)){for(const i of t)if(Re(i,e))return!0}else{if(t===e)return!0;if(["body","numer","denom","index","subscript","superscript","underscript","overscript"].some(function(i){return i===e||Re(t[i],e)}))return!0;if(t.array)for(let i=Pe(t.array);i>=0;i--)if(Re(qe(t.array,i),e))return!0}return!1}function Ke(t){if(t)return 1===t.length&&"leftright"===t[0].type&&"("===t[0].leftDelim&&(t=t[0].body),t}function Ne(t,e){return t?t.length<=1?t:(e&&"ASCIIMath"===e.format||(t=t.replace(/\\\\([^\s\n])/g,"\\$1")),e&&"ASCIIMath"===e.format||!/\\/.test(t)?$e(t=(t=(t=(t=(t=(t=t.replace(/\u2061/gu,"")).replace(/\u3016/gu,"{")).replace(/\u3017/gu,"}")).replace(/([^\\])sinx/g,"$1\\sin x")).replace(/([^\\])cosx/g,"$1\\cos x ")).replace(/\u2013/g,"-"),e):t):""}function $e(t,e){if(!t)return"";let i,s=!1;if(s||"^"!==t[0]&&"_"!==t[0]||(i=We(t.substr(1),{...e,noWrap:!0}),t=t[0]+"{"+i.match+"}",t+=$e(i.rest,e),s=!0),s||(i=t.match(/^(sqrt|\u221a)(.*)/))&&(t="\\sqrt{"+(i=We(i[2],{...e,noWrap:!0})).match+"}",t+=$e(i.rest,e),s=!0),s||(i=t.match(/^(\\cbrt|\u221b)(.*)/))&&(t="\\sqrt[3]{"+(i=We(i[2],{...e,noWrap:!0})).match+"}",t+=$e(i.rest,e),s=!0),s||(i=t.match(/^abs(.*)/))&&(t="\\left|"+(i=We(i[1],{...e,noWrap:!0})).match+"\\right|",t+=$e(i.rest,e),s=!0),s||(i=t.match(/^["”“](.*?)["”“](.*)/))&&(t="\\text{"+i[1]+"}",t+=$e(i[2],e),s=!0),s||(i=t.match(/^([^a-zA-Z({[_^\\\s"]+)(.*)/))&&(t=He(i[1],e),t+=$e(i[2],e),s=!0),!s&&/^(f|g|h)[^a-zA-Z]/.test(t)&&(i=We(t.substring(1),e),t=t[0],t+=i.match,t+=$e(i.rest,e),s=!0),s||(i=t.match(/^([a-zA-Z]+)(.*)/))&&(t=He(i[1],e),t+=$e(i[2],e),s=!0),!s)if((i=We(t,{...e,noWrap:!0})).match&&"/"===i.rest[0]){const a=We(i.rest.substr(1),{...e,noWrap:!0});a.match&&(t="\\frac{"+i.match+"}{"+a.match+"}"+$e(a.rest,e)),s=!0}else i.match&&/^(\(|\{|\[)$/.test(t[0])?(t="\\left"+t[0]+i.match+"\\right"+{"(":")","{":"}","[":"]"}[t[0]]+$e(i.rest,e),s=!0):i.match&&(t=i.match,t+=$e(i.rest,e),s=!0);return s||(i=t.match(/^(\s+)(.*)$/))&&(t=" "+$e(i[2],e),s=!0),t}function We(t,e){let i="",s=t=t.trim();const a=t.charAt(0),o={"(":")","{":"}","[":"]"}[a];if(o){let n=1,r=1;for(;r0;)t[r]===a&&n++,t[r]===o&&n--,r++;0===n?(i=e.noWrap&&"("===a&&")"===o?$e(t.substring(1,r-1),e):"\\mleft"+a+$e(t.substring(1,r-1),e)+"\\mright"+o,s=t.substring(r)):(i=t.substring(1,r),s="")}else{let a=t.match(/^([a-zA-Z]+)/);if(a){let i=Le.forString("math",null,t,e);if(i)return{match:i=(i=i.replace("_{#?}","")).replace("^{#?}",""),rest:t.substring(i.length)}}if(a=t.match(/^([a-zA-Z])/))return{match:a[1],rest:t.substring(1)};if(a=t.match(/^(-)?\d+(\.\d*)?/))return{match:a[0],rest:t.substring(a[0].length)};/^\\(left|right)/.test(t)||(a=t.match(/^(\\[a-zA-Z]+)/))&&(s=t.substring(a[1].length),i=a[1])}return{match:i,rest:s}}function He(t,e){let i=Le.forString("math",null,t,e);return i?(i=(i=i.replace("_{#?}","")).replace("^{#?}",""),i+=" "):i=t,i}function Ve(){return new de.MathAtom("","first")}Fe.prototype._announce=function(t,e,i){"function"==typeof this.config.onAnnounce&&this.config.onAnnounce(this.target,t,e,i)},Fe.prototype.filter=function(t,e){e=e<0?-1:1;const i=[],s=new Fe;s.path=ve.clone(this.path),s.extent=this.extent,s.root=this.root,e>=0?s.collapseForward():(s.collapseBackward(),s.move(1));const a=s.anchor();do{t.bind(s)(s.path,s.anchor())&&i.push(s.toString()),e>=0?s.next({iterateAll:!0}):s.previous({iterateAll:!0})}while(a!==s.anchor());return i},Fe.prototype.forEach=function(t){this.root.forEach(t)},Fe.prototype.forEachSelected=function(t,e){(e=e||{}).recursive=void 0!==e.recursive&&e.recursive;const i=this.siblings(),s=this.startOffset()+1,a=this.endOffset()+1;if(e.recursive)for(let e=s;e0?0:1)},Fe.prototype.setRange=function(t,e,i){i=i||{};const s=ve.pathDistance(t,e);if(0===s)return i.extendToWordBoundary?(t=this.wordBoundary(t,-1),e=this.wordBoundary(e,1),this.setRange(t,e)):this.setPath(ve.clone(t),0);if(1===s){const s=e[e.length-1].offset-t[t.length-1].offset;return i.extendToWordBoundary?(t=this.wordBoundary(t,s<0?1:-1),e=this.wordBoundary(e,s<0?-1:1),this.setRange(t,e)):this.setPath(ve.clone(t),s)}let a=ve.pathCommonAncestor(t,e);const o=a.length;if(t.length===o||e.length===o||t[o].relation!==e[o].relation)return this.setPath(a,-1);a.push(t[o]),a=ve.clone(a);let n=e[o].offset-t[o].offset+1;return n<=0?e.length>o+1?(a[o].relation=e[o].relation,a[o].offset=e[o].offset,a[a.length-1].offset-=1,n=2-n):(a[o].relation=e[o].relation,a[o].offset=e[o].offset,n=1-n):e.length<=t.length?a[a.length-1].offset-=1:e.length>t.length&&(a[o].offset-=1),this.setPath(a,n)},Fe.prototype.ancestor=function(t){if(t>this.path.length)return null;let e=this.root;for(let i=0;i0?this.path[this.path.length-1].relation:""},Fe.prototype.anchorOffset=function(){return this.path.length>0?this.path[this.path.length-1].offset:0},Fe.prototype.focusOffset=function(){return this.path.length>0?this.path[this.path.length-1].offset+this.extent:0},Fe.prototype.startOffset=function(){return Math.min(this.focusOffset(),this.anchorOffset())},Fe.prototype.endOffset=function(){return Math.max(this.focusOffset(),this.anchorOffset())},Fe.prototype.insertFirstAtom=function(){this.siblings()},Fe.prototype.siblings=function(){if(0===this.path.length)return[];let t;return this.parent().array?t=qe(this.parent().array,this.relation()):"string"==typeof(t=this.parent()[this.relation()]||[])&&(t=[]),0!==t.length&&"first"===t[0].type||t.unshift(Ve()),t},Fe.prototype.sibling=function(t){return this.siblings()[this.startOffset()+t]},Fe.prototype.isCollapsed=function(){return 0===this.extent},Fe.prototype.setExtent=function(t){this.extent=t},Fe.prototype.collapseForward=function(){return 0!==this.extent&&(this.setSelection(this.endOffset()),!0)},Fe.prototype.collapseBackward=function(){return 0!==this.extent&&(this.setSelection(this.startOffset()),!0)},Fe.prototype.selectGroup_=function(){const t=this.siblings();if("text"===this.anchorMode()){let e=this.startOffset(),i=this.endOffset();for(;t[e]&&"text"===t[e].mode&&Pt.LETTER_AND_DIGITS.test(t[e].body);)e-=1;for(;t[i]&&"text"===t[i].mode&&Pt.LETTER_AND_DIGITS.test(t[i].body);)i+=1;if(e>=(i-=1))return void this.setSelection(this.endOffset()-1,1);this.setSelection(e,i-e)}else if("mord"===this.sibling(0).type&&/[0-9,.]/.test(this.sibling(0).body)){let e=this.startOffset(),i=this.endOffset();for(;Oe(t[e]);)e-=1;for(;Oe(t[i]);)i+=1;i-=1,this.setSelection(e,i-e)}else this.setSelection(0,"end")},Fe.prototype.selectAll_=function(){this.path=[{relation:"body",offset:0}],this.setSelection(0,"end")},Fe.prototype.deleteAll_=function(){this.selectAll_(),this.delete_()},Fe.prototype.contains=function(t){if(this.isCollapsed())return!1;const e=this.siblings(),i=this.startOffset(),s=this.endOffset();for(let a=i;a0&&"command"===t[e].type;)e-=1;let i=this.startOffset()+1;for(;i<=t.length-1&&"command"===t[i].type;)i+=1;return i>e?{start:e+1,end:i}:null},Fe.prototype.extractCommandStringAroundInsertionPoint=function(t){let e="";const i=this.commandOffsets();if(i){const s=t?this.anchorOffset()+1:i.end,a=this.siblings();for(let t=i.start;t"placeholder"===t.type));this.setExtent(0),this.path[this.path.length-1].offset=e.start-1,0!==i.length&&this.leap(1,!1)||this.setSelection(e.start+t.length-1)}else this.siblings().splice(e.start,e.end-e.start),this.setSelection(e.start-1,0);this.contentDidChange()}},Fe.prototype.removeCommandString=function(){this.contentWillChange();const t=this.suppressChangeNotifications;this.suppressChangeNotifications=!0,function t(e){if(e)if(Array.isArray(e))for(let i=e.length-1;i>=0;i--)"command"===e[i].type?e.splice(i,1):t(e[i]);else if(t(e.body),t(e.superscript),t(e.subscript),t(e.underscript),t(e.overscript),t(e.numer),t(e.denom),t(e.index),e.array)for(let i=Pe(e.array);i>=0;i--)t(qe(e.array,i))}(this.root.body),this.suppressChangeNotifications=t,this.contentDidChange()},Fe.prototype.extractArgBeforeInsertionPoint=function(){const t=this.siblings();if(t.length<=1)return[];const e=[];let i=this.startOffset();if("text"===t[i].mode)for(;i>=1&&"text"===t[i].mode;)e.unshift(t[i]),i--;else for(;i>=1&&/^(mord|surd|msubsup|leftright|mop)$/.test(t[i].type);)e.unshift(t[i]),i--;return e},Fe.prototype.setSelection=function(t,e,i){t=t||0,e=e||0;const s=this.path[this.path.length-1].relation;i||(i=s);const a=this.parent();if(!a&&"body"!==i)return!1;const o=i.startsWith("cell");if(!o&&!a[i]||o&&!a.array)return!1;const n=i!==s;this.path[this.path.length-1].relation=i;const r=this.siblings().length;this.path[this.path.length-1].relation=s;const l=this.extent;"end"===e?e=r-t-1:"start"===e&&(e=-t),this.setExtent(e);const c=this.extent!==l;this.setExtent(l),t<0&&(t=r+t),t=Math.max(0,Math.min(t,r-1));const h=this.path[this.path.length-1].offset;return(n||h!==t||c)&&(n&&this.adjustPlaceholder(),this.selectionWillChange(),this.path[this.path.length-1].relation=i,this.path[this.path.length-1].offset=t,this.setExtent(e),this.selectionDidChange()),!0},Fe.prototype.next=function(t){t=t||{};const e={body:"numer",numer:"denom",denom:"index",index:"overscript",overscript:"underscript",underscript:"subscript",subscript:"superscript"};if(this.anchorOffset()===this.siblings().length-1){this.adjustPlaceholder();let i=e[this.relation()];const s=this.parent();for(;i&&!s[i];)i=e[i];if(i)return void this.setSelection(0,0,i);if(this.parent().array){const t=Pe(this.parent().array);let e=parseInt(this.relation().match(/cell([0-9]*)$/)[1])+1;for(;e=0;){if(qe(this.parent().array,t)&&this.setSelection(-1,0,"cell"+t))return void this.selectionDidChange();t-=1}}return 1===this.path.length?(this.suppressChangeNotifications||!this.config.onMoveOutOf||this.config.onMoveOutOf.bind(this)(-1))&&(this.path[0].offset=this.root.body.length-1):(this.path.pop(),this.setSelection(this.anchorOffset()-1)),void this.selectionDidChange()}const i=this.anchor();if(!i.captureSelection){let t;if(i.array){t="";const e=Pe(i.array);let s=e-1;for(;!t&&s0)for(this.collapseForward()&&t--;t>0;)this.next(),t--;else if(t<0)for(this.collapseBackward()&&t++;0!==t;)this.previous(),t++;this._announce("move",e)}},Fe.prototype.up=function(t){const e=(t=t||{extend:!1}).extend||!1;this.collapseBackward();const i=this.relation();if("denom"===i)e?(this.selectionWillChange(),this.path.pop(),this.path[this.path.length-1].offset-=1,this.setExtent(1),this.selectionDidChange()):this.setSelection(this.anchorOffset(),0,"numer"),this._announce("moveUp");else if(this.parent().array){let e=Ee(this.parent().array,i);(e=Be(this.parent().array,e,-1))&&qe(e)?(this.path[this.path.length-1].relation="cell"+De(this.parent().array,e),this.setSelection(this.anchorOffset()),this._announce("moveUp")):this.move(-1,t)}else this._announce("line")},Fe.prototype.down=function(t){const e=(t=t||{extend:!1}).extend||!1;this.collapseForward();const i=this.relation();if("numer"===i)e?(this.selectionWillChange(),this.path.pop(),this.path[this.path.length-1].offset-=1,this.setExtent(1),this.selectionDidChange()):this.setSelection(this.anchorOffset(),0,"denom"),this._announce("moveDown");else if(this.parent().array){let e=Ee(this.parent().array,i);(e=Be(this.parent().array,e,1))&&qe(e)?(this.path[this.path.length-1].relation="cell"+De(this.parent().array,e),this.setSelection(this.anchorOffset()),this._announce("moveDown")):this.move(1,t)}else this._announce("line")},Fe.prototype.extend=function(t){let e=this.path[this.path.length-1].offset,i=0;const s=ze(this),a=e+(i=this.extent+t);if(a<0&&0!==i){if(this.path.length>1)return this.selectionWillChange(),this.path.pop(),this.setExtent(-1),this.selectionDidChange(),void this._announce("move",s);e=this.path[this.path.length-1].offset,i=this.extent}else if(a>=this.siblings().length){if(this.path.length>1)return this.selectionWillChange(),this.path.pop(),this.path[this.path.length-1].offset-=1,this.setExtent(1),this.selectionDidChange(),void this._announce("move",s);this.isCollapsed()&&(e-=1),i-=1}this.setSelection(e,i),this._announce("move",s)},Fe.prototype.skip=function(t,e){const i=(e=e||{extend:!1}).extend||!1;t=t<0?-1:1;const s=ze(this),a=this.siblings(),o=this.focusOffset();let n=o+t;if(i&&(n=Math.min(Math.max(0,n),a.length-1)),n<0||n>=a.length)this.move(t,e);else{if(a[n]&&"text"===a[n].mode){if((n=this.wordBoundaryOffset(n,t))<0&&!i)return void this.setSelection(0);if(n>a.length)return this.setSelection(a.length-1),void this.move(t,e)}else{const e=a[n]?a[n].type:"";if("mopen"===e&&t>0||"mclose"===e&&t<0){let i="mopen"===e?1:-1;for(n+=t>0?1:-1;n>=0&&n0&&(n-=1)}else{for(;a[n]&&"math"===a[n].mode&&a[n].type===e;)n+=t;n-=t>0?1:0}}if(i){const t=this.anchorOffset();this.setSelection(t,n-t)}else this.setSelection(n);this._announce("move",s)}},Fe.prototype.jump=function(t,e){const i=(e=e||{extend:!1}).extend||!1;t=t<0?-1:1;const s=this.siblings();let a=this.focusOffset();t>0&&(a=Math.min(a+1,s.length-1));const o=t<0?0:s.length-1;i?this.extend(o-a):this.move(o-a)},Fe.prototype.jumpToMathFieldBoundary=function(t,e){const i=(e=e||{extend:!1}).extend||!1;t=(t=t||1)<0?-1:1;const s=ze(this),a=[{relation:"body",offset:this.path[0].offset}];let o;i?t<0?a[0].offset>0&&(o=-a[0].offset):a[0].offset"placeholder"===e.type||t.length>1&&1===this.siblings().length,t);if(0===o.length){if(this.setPath(s,a),e)if(this.config.onTabOutOf)this.config.onTabOutOf(this.target,t>0?"forward":"backward");else if(document.activeElement){const e='a[href]:not([disabled]),\n button:not([disabled]),\n textarea:not([disabled]),\n input[type=text]:not([disabled]),\n select:not([disabled]),\n [contentEditable="true"],\n [tabindex]:not([disabled]):not([tabindex="-1"])',i=Array.prototype.filter.call(document.querySelectorAll(e),t=>(t.offsetWidth>0||t.offsetHeight>0)&&!t.contains(document.activeElement)||t===document.activeElement);let s=i.indexOf(document.activeElement)+t;s<0&&(s=i.length-1),s>=i.length&&(s=0),i[s].focus()}return!1}return this.selectionWillChange(),this.setPath(o[0]),"placeholder"===this.anchor().type&&this.setExtent(-1),this._announce("move",s),this.selectionDidChange(),this.suppressChangeNotifications=i,!0},Fe.prototype.anchorMode=function(){const t=this.isCollapsed()?this.anchor():this.sibling(1);let e;if(t){if("commandliteral"===t.type||"command"===t.type)return"command";e=t.mode}let i=1,s=this.ancestor(i);for(;!e&&s;)s&&(e=s.mode),i+=1,s=this.ancestor(i);return e},Fe.prototype.anchorStyle=function(){const t=this.isCollapsed()?this.anchor():this.sibling(1);let e;if(t&&"first"!==t.type){if("commandliteral"===t.type||"command"===t.type)return{};e={color:t.color,backgroundColor:t.backgroundColor,fontFamily:t.fontFamily,fontShape:t.fontShape,fontSeries:t.fontSeries,fontSize:t.fontSize}}let i=1,s=this.ancestor(i);for(;!e&&s;)s&&(e={color:s.color,backgroundColor:s.backgroundColor,fontFamily:s.fontFamily,fontShape:s.fontShape,fontSeries:s.fontSeries,fontSize:s.fontSize}),i+=1,s=this.ancestor(i);return e},Fe.prototype.simplifyParen=function(t){if(t&&this.config.removeExtraneousParentheses){for(let e=0;t[e];e++)if("leftright"===t[e].type&&"("===t[e].leftDelim&&Array.isArray(t[e].body)){let i=0,s=0,a=0;for(let o=0;t[e].body;o++)"genfrac"===t[e].body[o].type&&(i++,s=o),"first"!==t[e].body[o].type&&a++;0===a&&1===i&&(t[e]=t[e].body[s])}t.forEach(t=>{if("genfrac"===t.type&&(this.simplifyParen(t.numer),this.simplifyParen(t.denom),t.numer=Ke(t.numer),t.denom=Ke(t.denom)),t.superscript&&(this.simplifyParen(t.superscript),t.superscript=Ke(t.superscript)),t.subscript&&(this.simplifyParen(t.subscript),t.subscript=Ke(t.subscript)),t.underscript&&(this.simplifyParen(t.underscript),t.underscript=Ke(t.underscript)),t.overscript&&(this.simplifyParen(t.overscript),t.overscript=Ke(t.overscript)),t.index&&(this.simplifyParen(t.index),t.index=Ke(t.index)),"surd"===t.type?(this.simplifyParen(t.body),t.body=Ke(t.body)):t.body&&Array.isArray(t.body)&&this.simplifyParen(t.body),t.array)for(let e=Pe(t.array);e>=0;e--)this.simplifyParen(qe(t.array,e))})}},Fe.prototype.insert=function(t,e){if((e=e||{}).smartFence&&this._insertSmartFence(t,e.style))return;const i=this.suppressChangeNotifications;e.suppressChangeNotifications&&(this.suppressChangeNotifications=!0),this.contentWillChange();const s=this.suppressChangeNotifications;this.suppressChangeNotifications=!0,e.insertionMode||(e.insertionMode="replaceSelection"),e.selectionMode||(e.selectionMode="placeholder"),e.format||(e.format="auto"),e.macros=e.macros||this.config.macros;const a=e.mode||this.anchorMode();let o;const n=[this.getSelectedAtoms()];void 0!==e.placeholder&&(n["?"]=e.placeholder),"replaceSelection"!==e.insertionMode||this.isCollapsed()?"replaceAll"===e.insertionMode?(this.root.body.splice(1),this.path=[{relation:"body",offset:0}],this.extent=0):"insertBefore"===e.insertionMode?this.collapseBackward():"insertAfter"===e.insertionMode&&this.collapseForward():this.delete_();const r=this.siblings(),l=this.startOffset();if(l+10&&r[l]&&"placeholder"===r[l].type&&this.delete_(-1),"math"===a&&"ASCIIMath"===e.format)t=Ne(t,{...this.config,format:"ASCIIMath"}),o=be.parseTokens(x.tokenize(t),"math",null,e.macros,!1),this.simplifyParen(o);else if("text"!==a&&"auto"===e.format)if("command"===a){o=[];for(const e of t)Pt.COMMAND_MODE_CHARACTERS.test(e)&&o.push(new de.MathAtom("command","command",e))}else""===t?o=[new de.MathAtom("command","command","\\")]:(t=Ne(t,this.config),n[0]?t=t.replace(/(^|[^\\])#@/g,"$1#0"):/(^|[^\\])#@/.test(t)?(t=t.replace(/(^|[^\\])#@/g,"$1#0"),n[0]=this.extractArgBeforeInsertionPoint(),this._deleteAtoms(-n[0].length),Array.isArray(n[0])&&0===n[0].length&&(n[0]=void 0)):t=t.replace(/(^|[^\\])#@/g,"$1#?"),o=be.parseTokens(x.tokenize(t),a,n,e.macros,e.smartFence),this.simplifyParen(o));else"latex"===e.format?o=be.parseTokens(x.tokenize(t),a,n,e.macros,e.smartFence):"text"!==a&&"text"!==e.format||(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"\\textbackslash ")).replace(/#/g,"\\#")).replace(/\$/g,"\\$")).replace(/%/g,"\\%")).replace(/&/g,"\\&")).replace(/_/g,"\\_")).replace(/{/g,"\\textbraceleft ")).replace(/}/g,"\\textbraceright ")).replace(/\^/g,"\\textasciicircum ")).replace(/~/g,"\\textasciitilde ")).replace(/£/g,"\\textsterling "),o=be.parseTokens(x.tokenize(t),"text",n,e.macros,!1));!function t(e,i){e&&i&&(Array.isArray(e)?e.forEach(e=>t(e,i)):"object"==typeof e&&(e.color||e.backgroundColor||e.fontFamily||e.fontShape||e.fontSeries||e.fontSize||(e.applyStyle(i),t(e.body,i),t(e.numer,i),t(e.denom,i),t(e.index,i),t(e.overscript,i),t(e.underscript,i),t(e.subscript,i),t(e.superscript,i))))}(o,e.style);const c=this.parent();if(this.config.removeExtraneousParentheses&&c&&"leftright"===c.type&&"("===c.leftDelim&&o&&1===o.length&&"genfrac"===o[0].type?(this.path.pop(),this.siblings()[this.anchorOffset()]=o[0]):Array.prototype.splice.apply(this.siblings(),[this.anchorOffset()+1,0].concat(o)),this.insertFirstAtom(),this.suppressChangeNotifications=s,"placeholder"===e.selectionMode){let t=[];for(const e of o)t=t.concat(e.filter(t=>"placeholder"===t.type));0!==t.length&&this.leap(1,!1)?this._announce("move"):this.setSelection(this.anchorOffset()+o.length)}else"before"===e.selectionMode||("after"===e.selectionMode?this.setSelection(this.anchorOffset()+o.length):"item"===e.selectionMode&&this.setSelection(this.anchorOffset(),o.length));this.contentDidChange(),this.suppressChangeNotifications=i},Fe.prototype._insertSmartFence=function(t,e){const i=this.parent();if("leftright"===i.type&&"|"!==i.leftDelim&&/\||\\vert|\\Vert|\\mvert|\\mid/.test(t))return this.insert("\\,\\middle"+t+"\\, ",{mode:"math",format:"latex",style:e}),!0;"{"!==t&&"\\{"!==t||(t="\\lbrace"),"}"!==t&&"\\}"!==t||(t="\\rbrace"),"["!==t&&"\\["!==t||(t="\\lbrack"),"]"!==t&&"\\]"!==t||(t="\\rbrack");const s=Pt.RIGHT_DELIM[t];if(s&&("leftright"!==i.type||"|"!==i.leftDelim)){let i="";const a=this.isCollapsed()||"placeholder"===this.anchor().type;i=this.sibling(0).isFunction?"\\mleft"+t+"\\mright":"\\left"+t+"\\right",i+=a?"?":s;let o=[];return a&&(o=this.siblings().splice(this.anchorOffset()+1,this.siblings().length)),this.insert(i,{mode:"math",format:"latex",style:e}),a&&(this.sibling(0).body=o,this.move(-1)),!0}let a;for(const e in Pt.RIGHT_DELIM)Pt.RIGHT_DELIM.hasOwnProperty(e)&&t===Pt.RIGHT_DELIM[e]&&(a=e);if(a){if(i&&"leftright"===i.type&&this.endOffset()===this.siblings().length-1)return this.contentWillChange(),i.rightDelim=t,this.move(1),this.contentDidChange(),!0;const s=this.siblings();let a;for(a=this.endOffset();a>=0&&("leftright"!==s[a].type||"?"!==s[a].rightDelim);a--);if(a>=0)return this.contentWillChange(),s[a].rightDelim=t,s[a].body=s[a].body.concat(s.slice(a+1,this.endOffset()+1)),s.splice(a+1,this.endOffset()-a),this.setSelection(a),this.contentDidChange(),!0;if(i&&"leftright"===i.type&&"?"===i.rightDelim){this.contentWillChange(),i.rightDelim=t;const e=s.slice(this.endOffset()+1);return s.splice(this.endOffset()+1),this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.endOffset()+1,0].concat(e)),this.contentDidChange(),!0}const o=this.ancestor(2);return o&&"leftright"===o.type&&"?"===o.rightDelim&&this.endOffset()===s.length-1?(this.move(1),this._insertSmartFence(t,e)):(this.insert(t,{mode:"math",format:"latex",style:e}),!0)}return!1},Fe.prototype.positionInsertionPointAfterCommitedCommand=function(){const t=this.siblings(),e=this.commandOffsets();let i=e.start;for(;i=0;e--)t[e].suggestion&&t.splice(e,1)},Fe.prototype.insertSuggestion=function(t,e){this.removeSuggestion();const i=[],s=t.substr(e);for(const t of s){const e=new de.MathAtom("command","command",t);e.suggestion=!0,i.push(e)}Array.prototype.splice.apply(this.siblings(),[this.anchorOffset()+1,0].concat(i))},Fe.prototype._deleteAtoms=function(t){t>0?this.siblings().splice(this.anchorOffset()+1,t):(this.siblings().splice(this.anchorOffset()+t+1,-t),this.setSelection(this.anchorOffset()+t))},Fe.prototype.delete=function(t){if(0===(t=t||0))this.delete_(0);else if(t>0)for(;t>0;)this.delete_(1),t--;else for(;t<0;)this.delete_(-1),t++},Fe.prototype.delete_=function(t){this.contentWillChange(),this.selectionWillChange();const e=this.suppressChangeNotifications;if(this.suppressChangeNotifications=!0,t=(t=t||0)<0?-1:t>0?1:t,this.removeSuggestion(),this.parent().array&&t<0&&0===this.startOffset()){const t=this.parent().array;if(function(t){const e={col:0,row:0};for(;e.row0){let t=e.length;"first"===e[0].type&&(t-=1),t>0&&(i+=1)}s.row+=1}return i}(t,e.col)){!function(t,e){let i=0;for(;i"placeholder"!==t.type&&"first"!==t.type);this.parent()[t]=null,this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),0].concat(e)),this.setSelection(this.anchorOffset()-1),this._announce("deleted: "+t)}else if("denom"===t){const t=this.parent().numer.filter(t=>"placeholder"!==t.type&&"first"!==t.type),e=this.parent().denom.filter(t=>"placeholder"!==t.type&&"first"!==t.type);this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),1].concat(e)),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),0].concat(t)),this.setSelection(this.anchorOffset()+t.length-1),this._announce("deleted: denominator")}else if("body"===t){const t=this.siblings().filter(t=>"placeholder"!==t.type);this.path.length>1&&(t.shift(),this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),1].concat(t)),this.setSelection(this.anchorOffset()-1),this._announce("deleted: root"))}else this.move(-1),this.delete(-1)}else if(t>0)if(e!==i.length-1)/^(group|array|genfrac|surd|leftright|overlap|overunder|box|mathstyle|sizing)$/.test(this.sibling(1).type)?this.move(1):(this._announce("delete",null,i.slice(e+1,e+2)),i.splice(e+1,1));else if("numer"===this.relation()){const t=this.parent().numer.filter(t=>"placeholder"!==t.type&&"first"!==t.type),e=this.parent().denom.filter(t=>"placeholder"!==t.type&&"first"!==t.type);this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),1].concat(e)),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),0].concat(t)),this.setSelection(this.anchorOffset()+t.length-1),this._announce("deleted: numerator")}else this.move(1),this.delete(1)}else{const t=this.startOffset()+1,e=this.endOffset()+1;this._announce("deleted",null,i.slice(t,e)),i.splice(t,e-t),this.setSelection(t-1)}this.suppressChangeNotifications=e,this.selectionDidChange(),this.contentDidChange()},Fe.prototype.moveToNextPlaceholder_=function(){this.leap(1)},Fe.prototype.moveToPreviousPlaceholder_=function(){this.leap(-1)},Fe.prototype.moveToNextChar_=function(){this.move(1)},Fe.prototype.moveToPreviousChar_=function(){this.move(-1)},Fe.prototype.moveUp_=function(){this.up()},Fe.prototype.moveDown_=function(){this.down()},Fe.prototype.moveToNextWord_=function(){this.skip(1)},Fe.prototype.moveToPreviousWord_=function(){this.skip(-1)},Fe.prototype.moveToGroupStart_=function(){this.setSelection(0)},Fe.prototype.moveToGroupEnd_=function(){this.setSelection(-1)},Fe.prototype.moveToMathFieldStart_=function(){this.jumpToMathFieldBoundary(-1)},Fe.prototype.moveToMathFieldEnd_=function(){this.jumpToMathFieldBoundary(1)},Fe.prototype.deleteNextChar_=function(){this.delete_(1)},Fe.prototype.deletePreviousChar_=function(){this.delete_(-1)},Fe.prototype.deleteNextWord_=function(){this.extendToNextBoundary(),this.delete_()},Fe.prototype.deletePreviousWord_=function(){this.extendToPreviousBoundary(),this.delete_()},Fe.prototype.deleteToGroupStart_=function(){this.extendToGroupStart(),this.delete_()},Fe.prototype.deleteToGroupEnd_=function(){this.extendToMathFieldStart(),this.delete_()},Fe.prototype.deleteToMathFieldEnd_=function(){this.extendToMathFieldEnd(),this.delete_()},Fe.prototype.transpose_=function(){},Fe.prototype.extendToNextChar_=function(){this.extend(1)},Fe.prototype.extendToPreviousChar_=function(){this.extend(-1)},Fe.prototype.extendToNextWord_=function(){this.skip(1,{extend:!0})},Fe.prototype.extendToPreviousWord_=function(){this.skip(-1,{extend:!0})},Fe.prototype.extendUp_=function(){this.up({extend:!0})},Fe.prototype.extendDown_=function(){this.down({extend:!0})},Fe.prototype.extendToNextBoundary_=function(){this.skip(1,{extend:!0})},Fe.prototype.extendToPreviousBoundary_=function(){this.skip(-1,{extend:!0})},Fe.prototype.extendToGroupStart_=function(){this.setExtent(-this.anchorOffset())},Fe.prototype.extendToGroupEnd_=function(){this.setExtent(this.siblings().length-this.anchorOffset())},Fe.prototype.extendToMathFieldStart_=function(){this.jumpToMathFieldBoundary(-1,{extend:!0})},Fe.prototype.extendToMathFieldEnd_=function(){this.jumpToMathFieldBoundary(1,{extend:!0})},Fe.prototype.moveToSuperscript_=function(){if(this.collapseForward(),!this.anchor().superscript)if(this.anchor().subscript)this.anchor().superscript=[Ve()];else{const t=this.sibling(1);t&&t.superscript?this.path[this.path.length-1].offset+=1:t&&t.subscript?(this.path[this.path.length-1].offset+=1,this.anchor().superscript=[Ve()]):("limits"!==this.anchor().limits&&(this.siblings().splice(this.anchorOffset()+1,0,new de.MathAtom(this.parent().anchorMode,"msubsup","​",this.anchorStyle())),this.path[this.path.length-1].offset+=1),this.anchor().superscript=[Ve()])}this.path.push({relation:"superscript",offset:0}),this.selectGroup_()},Fe.prototype.moveToSubscript_=function(){if(this.collapseForward(),!this.anchor().subscript)if(this.anchor().superscript)this.anchor().subscript=[Ve()];else{const t=this.sibling(1);t&&t.subscript?this.path[this.path.length-1].offset+=1:t&&t.superscript?(this.path[this.path.length-1].offset+=1,this.anchor().subscript=[Ve()]):("limits"!==this.anchor().limits&&(this.siblings().splice(this.anchorOffset()+1,0,new de.MathAtom(this.parent().anchorMode,"msubsup","​",this.anchorStyle())),this.path[this.path.length-1].offset+=1),this.anchor().subscript=[Ve()])}this.path.push({relation:"subscript",offset:0}),this.selectGroup_()},Fe.prototype.moveToOpposite_=function(){const t={superscript:"subscript",subscript:"superscript",denom:"numer",numer:"denom"}[this.relation()];t||this.moveToSuperscript_(),this.parent()[t]||(this.parent()[t]=[Ve()]),this.setSelection(0,"end",t)},Fe.prototype.moveBeforeParent_=function(){this.path.length>1?(this.path.pop(),this.setSelection(this.anchorOffset()-1)):this._announce("plonk")},Fe.prototype.moveAfterParent_=function(){if(this.path.length>1){const t=ze(this);this.path.pop(),this.setExtent(0),this._announce("move",t)}else this._announce("plonk")},Fe.prototype._addCell=function(t){const e=this.parent();if(e&&"array"===e.type&&Array.isArray(e.array)){const i=this.relation();if(e.array){const s=Ee(e.array,i);"after row"===t||"before row"===t?(s.col=0,s.row=s.row+("after row"===t?1:0),e.array.splice(s.row,0,[[]])):(s.col+="after column"===t?1:0,e.array[s.row].splice(s.col,0,[]));const a=De(e.array,s);this.path.pop(),this.path.push({relation:"cell"+a.toString(),offset:0}),this.insertFirstAtom()}}},Fe.prototype.convertParentToArray=function(){const t=this.parent();if("leftright"===t.type){t.type="array";const e={"(":"pmatrix","\\lbrack":"bmatrix","\\lbrace":"cases"}[t.leftDelim]||"matrix",i=Pt.getEnvironmentInfo(e),s=[[t.body]];i.parser&&Object.assign(t,i.parser(e,[],s)),t.tabularMode=i.tabular,t.parseMode=this.anchorMode(),t.env={...i},t.env.name=e,t.array=s,t.rowGaps=[0],delete t.body,this.path[this.path.length-1].relation="cell0"}},Fe.prototype.addRowAfter_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("after row"),this.contentDidChange()},Fe.prototype.addRowBefore_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("before row"),this.contentDidChange()},Fe.prototype.addColumnAfter_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("after column"),this.contentDidChange()},Fe.prototype.addColumnBefore_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("before column"),this.contentDidChange()},Fe.prototype._applyStyle=function(t){if(this.isCollapsed())return;const e=this;function i(t,i){let s=!0;return e.forEachSelected(e=>{s=s&&e[t]===i},{recursive:!0}),s}t.color&&i("color",t.color)&&(t.color="none"),t.backgroundColor&&i("backgroundColor",t.backgroundColor)&&(t.backgroundColor="none"),t.fontFamily&&i("fontFamily",t.fontFamily)&&(t.fontFamily="none"),t.series&&(t.fontSeries=t.series),t.fontSeries&&i("fontSeries",t.fontSeries)&&(t.fontSeries="auto"),t.shape&&(t.fontShape=t.shape),t.fontShape&&i("fontShape",t.fontShape)&&(t.fontShape="auto"),t.size&&(t.fontSize=t.size),t.fontSize&&i("fontSize",t.fontSize)&&(t.fontSize="size5"),this.contentWillChange(),this.forEachSelected(e=>e.applyStyle(t),{recursive:!0}),this.contentDidChange()};var Ue={EditableMathlist:Fe,parseMathString:Ne};const je={"#":"#","|":"|","[":"BracketLeft","]":"BracketRight","-":"Minus","+":"Plus","=":"Equal","/":"Slash","\\":"Backslash"},Ge={Space:"Spacebar"," ":"Spacebar",Escape:"Esc",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},Ze={q:"KeyQ",w:"KeyW",e:"KeyE",r:"KeyR",t:"KeyT",y:"KeyY",u:"KeyU",i:"KeyI",o:"KeyO",p:"KeyP",a:"KeyA",s:"KeyS",d:"KeyD",f:"KeyF",g:"KeyG",h:"KeyH",j:"KeyJ",k:"KeyK",l:"KeyL",z:"KeyZ",x:"KeyX",c:"KeyC",v:"KeyV",b:"KeyB",n:"KeyN",m:"KeyM",1:"Digit1",2:"Digit2",3:"Digit3",4:"Digit4",5:"Digit5",6:"Digit6",7:"Digit7",8:"Digit8",9:"Digit9",0:"Digit0","!":"Shift-Digit1","@":"Shift-Digit2","#":"Shift-Digit3",$:"Shift-Digit4","%":"Shift-Digit5","^":"Shift-Digit6","&":"Shift-Digit7","*":"Shift-Digit8","(":"Shift-Digit9",")":"Shift-Digit0","-":"Minus",_:"Shift-Minus","/":"Slash","\\":"Backslash","|":"Shift-Backslash","?":"Shift-Slash"," ":"Spacebar"};function Xe(t){let e,i=!0;"Unidentified"===t.key&&t.target&&(e=Ze[t.target.value]||t.target.value),!e&&t.code&&(e=Ge[t.code]||t.code),e||(je[t.key]?(e=je[t.key],i=!1):e=Ge[t.key],e||(e=Ze[t.key.toLowerCase()]||t.key));const s=[];return t.ctrlKey&&s.push("Ctrl"),t.metaKey&&s.push("Meta"),i&&t.altKey&&s.push("Alt"),i&&t.shiftKey&&s.push("Shift"),0===s.length?e:(s.push(e),s.join("-"))}function Je(t,e){let i,s=null,a=null,o=!1,n=!1;function r(t){clearTimeout(i),i=setTimeout(function(){clearTimeout(i),t()})}function l(){if(function(t){return t.selectionStart!==t.selectionEnd}(t))return;const i=t.value;t.value="",i.length>0&&e.typedText(i)}const c=t||e.container;c.addEventListener("keydown",function(i){if("function"==typeof e.allowDeadKey&&e.allowDeadKey()||"Dead"!==i.key&&"Unidentified"!==i.key&&229!==i.keyCode)n=!1;else{n=!0,o=!1;const i=e.blur,s=e.focus;e.blur=null,e.focus=null,t.blur(),t.focus(),e.blur=i,e.focus=s}return!(!o&&"CapsLock"!==i.code&&!/(Control|Meta|Alt|Shift)(Right|Left)/.test(i.code))||(s=i,a=null,e.keystroke(Xe(i),i))},!0),c.addEventListener("keypress",function(t){o||(s&&a&&e.keystroke(Xe(s),s),a=t,r(l))},!0),c.addEventListener("keyup",function(){o||!s||a||l()},!0),c.addEventListener("paste",function(){t.focus();const i=t.value;t.value="",i.length>0&&e.paste(i)},!0),c.addEventListener("copy",function(t){e.copy&&e.copy(t)},!0),c.addEventListener("cut",function(t){e.cut&&e.cut(t)},!0),c.addEventListener("blur",function(){s=null,a=null,e.blur&&e.blur()},!0),c.addEventListener("focus",function(){e.focus&&e.focus()},!0),c.addEventListener("compositionstart",()=>{o=!0},!0),c.addEventListener("compositionend",()=>{o=!1,r(l)},!0),c.addEventListener("input",()=>{if(n){const i=e.blur,s=e.focus;e.blur=null,e.focus=null,t.blur(),t.focus(),e.blur=i,e.focus=s,n=!1,o=!1,r(l)}else o||r(l)})}var Ye={delegateKeyboardEvents:Je,select:Je.select,keyboardEventToString:Xe,eventToChar:function(t){if(!t)return"";let e;return"Unidentified"===t.key&&t.target&&(e=t.target.value),e=e||t.key||t.code,/^(Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(e)&&(e=""),e},charToEvent:function(t){return{key:t,metaKey:!1,ctrlKey:!1,altKey:!1,shiftKey:!1}}},Qe={UndoManager:class{constructor(t){this.mathlist=t,this.maximumDepth=1e3,this.record=!1,this.canCoalesce=!1,this.reset()}reset(){this.stack=[],this.index=-1}startRecording(){this.record=!0}canUndo(){return this.index>0}canRedo(){return this.index!==this.stack.length-1}undo(t){this.canUndo()&&(t&&"function"==typeof t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"undo"),this.restore(this.stack[this.index-1],t),this.index-=1,t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"undo"),this.canCoalesce=!1)}redo(t){this.canRedo()&&(t&&"function"===t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"redo"),this.index+=1,this.restore(this.stack[this.index],t),t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"redo"),this.canCoalesce=!1)}pop(){this.canUndo()&&(this.index-=1,this.stack.pop())}snapshot(t){this.record&&(t&&"function"===t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"snapshot"),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push({latex:this.mathlist.root.toLatex(),selection:this.mathlist.toString()}),this.index++,this.stack.length>this.maximumDepth&&this.stack.shift(),t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"snapshot"),this.canCoalesce=!1)}snapshotAndCoalesce(t){this.canCoalesce&&this.pop(),this.snapshot(t),this.canCoalesce=!0}save(){return{latex:this.mathlist.root.toLatex(),selection:this.mathlist.toString()}}restore(t,e){const i=this.mathlist.suppressChangeNotifications;void 0!==e.suppressChangeNotifications&&(this.mathlist.suppressChangeNotifications=e.suppressChangeNotifications),this.mathlist.insert(t?t.latex:"",{mode:"math",insertionMode:"replaceAll",selectionMode:"after",format:"latex",...e}),this.mathlist.setPath(t?t.selection:[{relation:"body",offset:0}]),this.mathlist.suppressChangeNotifications=i}}};const ti={"\\mathrm":"\\mathrm{x=+3.14, x\\in A}","\\mathbf":"\\mathbf{x=+3.14, x\\in A}","\\bf":"\\bf{x=+3.14, x\\in A}","\\bm":"\\bm{x=+3.14, x\\in A}","\\bold":"\\bold{x=+3.14, x\\in A}","\\mathit":"\\mathbb{x=+3.14}","\\mathbb":"\\mathbb{ABCD}","\\Bbb":"\\mathbb{ABCD}","\\frak":"\\frak{ABCD}","\\mathfrak":"\\mathfrak{ABCD}","\\mathscr":"\\mathscr{ABCD}","\\mathsf":"\\mathsf{ABab01}","\\mathtt":"\\mathtt{x=+3.14, x\\in A}","\\mathcal":"\\mathcal{ABCD}","\\boldsymbol":"\\boldsymbol{ABab01+=}","\\text":"\\text{ABC abc}","\\textrm":"\\textrm{ABC abc}","\\textnormal":"\\textnormal{ABC abc}","\\textit":"\\textit{ABC abc}","\\textbf":"\\textbf{ABC abc}","\\texttt":"\\texttt{ABC abc}","\\textsf":"\\textsf{ABC abc}","\\textcolor":"{\\textcolor{m0}A}{\\textcolor{m1}B}{\\textcolor{m2}C }{\\textcolor{m3}a}{\\textcolor{m4}b}{\\textcolor{m5}c}{\\textcolor{m6}8}","\\color":"{\\color{m0}A}{\\color{m1}B}{\\color{m2}C}{\\color{m3}a}{\\color{m4}b}{\\color{m5}c}{\\color{m6}8}","\\underline":'\\underline{\\unicode{"2B1A}}',"\\overline":'\\overline{\\unicode{"2B1A}}',"\\vec":'\\vec{\\unicode{"25CC}}',"\\check":'\\check{\\unicode{"25CC}}',"\\acute":'\\acute{\\unicode{"25CC}}',"\\breve":'\\breve{\\unicode{"25CC}}',"\\tilde":'\\tilde{\\unicode{"25CC}}',"\\hat":'\\hat{\\unicode{"25CC}}',"\\ddot":'\\ddot{\\unicode{"25CC}}',"\\dot":'\\dot{\\unicode{"25CC}}',"\\bar":'\\bar{\\unicode{"25CC}}',"\\!":'\\unicode{"203A}\\!\\unicode{"2039}',"\\,":'\\unicode{"203A}\\,\\unicode{"2039}',"\\:":'\\unicode{"203A}\\:\\unicode{"2039}',"\\;":'\\unicode{"203A}\\;\\unicode{"2039}',"\\quad":'\\unicode{"203A}\\quad\\unicode{"2039}',"\\qquad":'\\unicode{"203A}\\qquad\\unicode{"2039}',"\\enskip":'\\unicode{"203A}\\enskip\\unicode{"2039}',"\\space":'\\unicode{"203A}\\space\\unicode{"2039}',"\\frac":'\\frac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\dfrac":'\\dfrac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\cfrac":'\\cfrac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\tfrac":'\\tfrac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\dbinom":'\\dbinom{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\tbinom":'\\tbinom{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\binom":'\\binom{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\pdiff":'\\pdiff{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\in":"n\\in\\N","\\notin":"n\\notin\\N","\\not":"B \\not A","\\ni":"N\\in n","\\owns":"N\\owns n","\\subset":"A\\subset B","\\supset":"B\\supset A","\\subseteq":"A\\subseteq B","\\supseteq":"B\\supseteq A","\\nsubseteq":"A\\nsubseteq B","\\nsupseteq":"B\\nsupseteq A","\\subsetneq":"A\\subsetneq B","\\supsetneq":"B\\supsetneq A","\\varsubsetneq":"A\\varsubsetneq B","\\varsupsetneq":"B\\varsupsetneq A","\\nsubseteqq":"A\\varsupsetneq B","\\subsetneqq":"A\\subsetneqq B","\\varsubsetneqq":"A\\varsubsetneqq B","\\nsubset":"A\\nsubset B","\\nsupset":"B\\nsupset A","\\complement":"A^\\complement","\\bigcup":'\\bigcup_{\\unicode{"2B1A}}',"\\bigcap":'\\bigcap_{\\unicode{"2B1A}}',"\\sqrt":'\\sqrt{\\unicode{"2B1A}}',"\\prod":'\\prod_{\\unicode{"2B1A}}^{\\unicode{"2B1A}}',"\\sum":'\\sum_{\\unicode{"2B1A}}^{\\unicode{"2B1A}}',"\\int":'\\int_{\\unicode{"2B1A}}^{\\unicode{"2B1A}}',"\\stackrel":'\\stackrel{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\stackbin":'\\stackbin{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\underset":'\\underset{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\overset":'\\overset{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\prime":'\\unicode{"2B1A}^{\\prime}',"\\boxed":'\\boxed{\\unicode{"2B1A}}',"\\colorbox":'\\colorbox{#fbc0bd}{\\unicode{"2B1A}}',"\\bbox":'\\bbox[#ffd400, solid 2px #ffd400]{\\unicode{"2B1A}}',"\\enclose":'\\enclose{updiagonalstrike,roundedbox}[1px solid red, mathbackground="#fbc0bd"]{23+45}',"\\fcolorbox":'\\fcolorbox{#cd0030}{#ffd400}{\\unicode{"2B1A}}',"\\ ":'\\char"2423',"\\top":"{\\color{red}P}\\top","\\bot":"{\\color{#0F0}P}\\bot","\\mid":"P(p\\mid q)","\\rlap":"\\rlap{x}o","\\llap":"o\\llap{/}"},ei={"\\text":"roman text","\\textrm":"roman text","\\textnormal":"roman text","\\textit":"italic text","\\textbf":"bold text","\\texttt":"monospaced text","\\textsf":"sans-serif text","\\mathrm":["roman","(upright)"],"\\mathbf":"bold","\\bf":"bold","\\bold":"bold","\\mathit":"italic","\\mathbb":"blackboard","\\Bbb":"blackboard","\\mathscr":"script","\\mathtt":["typewriter","(monospaced)"],"\\mathsf":"sans-serif","\\mathcal":"caligraphic","\\frak":["fraktur","(gothic)"],"\\mathfrak":["fraktur","(gothic)"],"\\textcolor":"text color","\\color":"color","\\forall":"for all","\\exists":"there exists","\\nexists":"there does not exist","\\frac":"fraction","\\dfrac":"display fraction","\\cfrac":"continuous fraction","\\tfrac":"text fraction","\\binom":"binomial coefficient","\\dbinom":"display binomial coefficient","\\tbinom":"text binomial coefficient","\\pdiff":"partial differential","\\vec":"vector","\\check":"caron","\\acute":"acute","\\breve":"breve","\\tilde":"tilde","\\dot":"dot","\\hat":["hat","circumflex"],"\\ddot":"double dot","\\bar":"bar","\\prime":"prime","\\doubleprime":"double prime","\\varnothing":"empty set","\\emptyset":"empty set","\\subseteq":"subset of or
equal to","\\supseteq":"superset of or
equal to","\\supset":"superset of","\\subset":"subset of","\\partial":"partial derivative","\\bigcup":"union","\\bigcap":"intersection","\\approx":"approximately equal to","\\notin":"not an element of","\\in":["element of","included in"],"\\infty":"infinity","\\land":"logical and","\\sqrt":"square root","\\prod":"product","\\sum":"summation","\\amalg":["amalgamation","coproduct","free product","disjoint union"],"\\cup":"union with","\\cap":"intersection with","\\int":"integral","\\iint":"surface integral","\\oint":"curve integral","\\iiint":"volume integral","\\iff":"if and only if","\\ln":"natural logarithm","\\boldsymbol":"bold","\\setminus":"set subtraction","\\stackrel":"relation with symbol above","\\stackbin":"operator with symbol above","\\underset":"symbol with annotation below","\\overset":"symbol with annotation above","\\hslash":["h-bar","Planck constant"],"\\gtrsim":"greater than or
similar to","\\propto":"proportional to","\\equiv":"equivalent to","\\!":["negative thin space","(-3 mu)"],"\\ ":["space","(6 mu)"],"\\,":["thin space","(3 mu)"],"\\:":["medium space","(4 mu)"],"\\;":["thick space","(5 mu)"],"\\quad":["1 em space","(18 mu)"],"\\qquad":["2 em space","(36 mu)"],"\\enskip":["½ em space","(9 mu)"],"\\mp":"minus or plus","\\pm":"plus or minus","\\Im":"Imaginary part of","\\Re":"Real part of","\\gothicCapitalR":"Real part of","\\gothicCapitalI":"Imaginary part part of","\\differentialD":"differential d","\\aleph":["aleph","infinite cardinal",'Wikipedia '],"\\beth":["beth","beth number",'Wikipedia '],"\\gimel":["gimel","gimel function",'Wikipedia '],"\\O":"empty set","\\N":"set of
natural numbers","\\Z":"set of
integers","\\Q":"set of
rational numbers","\\C":"set of
complex numbers","\\R":"set of
real numbers","\\P":"set of
prime numbers","\\lesseqqgtr":"less than, equal to or
greater than","\\gnapprox":"greater than and
not approximately","\\lnapprox":"lesser than and
not approximately","\\j":"dotless j","\\i":"dotless i","\\cdot":"centered dot","\\lmoustache":"left moustache","\\rmoustache":"right moustache","\\nabla":["nabla","del","differential vector operator"],"\\square":["square","d’Alembert operator",'Wikipedia '],"\\blacksquare":["black square","end of proof","tombstone","Halmos symbol"],"\\Box":"end of proof","\\colon":["such that","ratio"],"\\coloneq":["is defined by","is assigned"],"\\Colon":["is defined by","as"],"\\_":["underbar","underscore"],"\\ll":"much less than","\\gg":"much greater than","\\doteq":"approximately equal to","\\Doteq":"approximately equal to","\\doteqdot":"approximately equal to","\\cong":["isomorphism of","(for algebras, modules...)"],"\\det":["determinant of","(of a matrix)"],"\\dotplus":"Cartesian product algebra","\\otimes":["tensor product","(of algebras)","Kronecker product","(of matrices)"],"\\oplus":["direct sum","(of modules)"],"\\lb":"base-2 logarithm","\\lg":"base-10 logarithm","\\wp":["Weierstrass P",'Wikipedia '],"\\wr":["wreath product",'Wikipedia '],"\\top":["tautology","Proposition P is universally true"],"\\bot":["contradiction","Proposition P is contradictory"],"\\mid":["probability","of event A given B"],"\\mho":["Siemens","electrical conductance in SI unit",'Wikipedia '],"\\Longrightarrow":"implies","\\Longleftrightarrow":"if, and only if,","\\prec":"precedes","\\preceq":"precedes or is equal to","\\succ":"succeedes","\\succeq":"succeedes or is equal to","\\perp":["is perpendicular to","is independent of"],"\\models":["entails","double-turnstyle, models","is a semantic consequence of",'Wikipedia '],"\\vdash":["satisfies","turnstyle, assertion sign","syntactic inference",'Wikipedia '],"\\implies":["implies","logical consequence"],"\\impliedby":["implied by","logical consequence"],"\\surd":["surd","root of","checkmark"],"\\ltimes":["semi direct product",'Wikipedia '],"\\rtimes":["semi direct product",'Wikipedia '],"\\leftthreetimes":["semi direct product",'Wikipedia '],"\\rightthreetimes":["semi direct product",'Wikipedia '],"\\divideontimes":["divide on times"],"\\curlywedge":"nor","\\curlyvee":"nand","\\simeq":"is group isomorphic with","\\vartriangleleft":["is a normal subgroup of","is an ideal ring of"],"\\circ":["circle","ring","function composition"],"\\rlap":["overlap right","\\rlap{x}o"],"\\llap":["overlap left","o\\llap{/}"],"\\colorbox":["color box","\\colorbox{#fbc0bd}{...}"],"\\ast":["asterisk","reflexive closure (as a superscript)"],"\\bullet":"bullet","\\lim":"limit"};function ii(t){let e=ei[t]||"";return Array.isArray(e)&&(e=e.join("
")),e}function si(t,e){t.popover.innerHTML=e;const i=t._getCaretPosition();i&&(t.popover.style.left=i.x-t.popover.offsetWidth/2+"px",t.popover.style.top=i.y+5+"px"),t.popover.classList.add("is-visible")}function ai(t){t.popover.classList.remove("is-visible")}var oi={getNote:ii,SAMPLES:ti,NOTES:ei,showPopoverWithLatex:function(t,e,i){if(!e||0===e.length)return void ai(t);const s=e,a=function(t,e){const i=be.parseTokens(x.tokenize(t),"math",null,e.config.macros),s=de.decompose({mathstyle:"displaystyle",macros:e.config.macros},i),a=et.makeSpan(s,"ML__base"),o=et.makeSpan("","ML__strut");o.setStyle("height",a.height,"em");const n=et.makeSpan("","ML__strut--bottom");return n.setStyle("height",a.height+a.depth,"em"),n.setStyle("vertical-align",-a.depth,"em"),et.makeSpan([o,n,a],"ML__mathlive").toMarkup()}(ti[s]||e,t),o=ii(s),n=Le.forCommand(s);let r=i?'
':"";r+='',r+='
'+a+"
",o&&(r+='
'+o+"
"),n&&(r+='
'+n+"
"),r+="
",si(t,r+=i?'
':"");let l=t.popover.getElementsByClassName("ML__popover__content");l&&l.length>0&&t._attachButtonHandlers(l[0],["complete",{acceptSuggestion:!0}]),(l=t.popover.getElementsByClassName("ML__popover__prev-shortcut"))&&l.length>0&&t._attachButtonHandlers(l[0],"previousSuggestion"),(l=t.popover.getElementsByClassName("ML__popover__next-shortcut"))&&l.length>0&&t._attachButtonHandlers(l[0],"nextSuggestion")},showPopover:si,hidePopover:ai,updatePopoverPosition:function t(e,i){if(e.popover.classList.contains("is-visible"))if(i&&i.deferred)window.requestAnimationFrame(()=>t(e));else if(e.mathlist.anchor()&&"command"===e.mathlist.anchor().type){const t=e._getCaretPosition();t&&(e.popover.style.left=t.x-e.popover.offsetWidth/2+"px",e.popover.style.top=t.y+5+"px")}else ai(e)}};function ni(t,e,i){let s="";if(Array.isArray(e)&&e.length>0){if("first"===e[0].type&&0===(e=e.slice(1)).length)return"";s=function t(e,i,s,a){if(0===s.length)return"";if(0===i.length)return s.map(t=>t.toLatex(a)).join("");let o="",n="",r="";const l=i[0],c=function(t,e,i){let s=0;for(;t[s]&&("mop"===t[s].type||t[s][e]===i);)s++;return s}(s,l,s[0][l]);if("text"===s[0].mode){if("fontShape"===l&&s[0].fontShape)"it"===s[0].fontShape?(n="\\textit{",r="}"):"sl"===s[0].fontShape?(n="\\textsl{",r="}"):"sc"===s[0].fontShape?(n="\\textsc{",r="}"):"n"===s[0].fontShape?(n="\\textup{",r="}"):(n="\\text{\\fontshape{"+s[0].fontShape+"}",r="}");else if("fontSeries"===l&&s[0].fontSeries)"b"===s[0].fontSeries?(n="\\textbf{",r="}"):"l"===s[0].fontSeries?(n="\\textlf{",r="}"):"m"===s[0].fontSeries?(n="\\textmd{",r="}"):(n="\\text{\\fontseries{"+s[0].fontSeries+"}",r="}");else if("mode"===l){let t=!0;for(let e=0;e0&&(i+=" & "),i+=ni(this,this.array[s][e],t);s1&&(i+=" "),i+=ni(this,this.body,t),i+="\\right"+(this.rightDelim||"."),this.rightDelim&&this.rightDelim.length>1&&(i+=" ")):(i+="\\mleft"+(this.leftDelim||"."),this.leftDelim&&this.leftDelim.length>1&&(i+=" "),i+=ni(this,this.body,t),i+="\\mright"+(this.rightDelim||"."),this.rightDelim&&this.rightDelim.length>1&&(i+=" "));break;case"delim":case"sizeddelim":i+=n+"{"+this.delim+"}";break;case"rule":i+=n,this.shift&&(i+=`[${ni(this,this.shift,t)}em]`),i+=`{${ni(this,this.width,t)}em}{${ni(this,this.height,t)}em}`;break;case"line":case"overlap":case"accent":i+=`${n}{${ni(this,this.body,t)}}`;break;case"overunder":i+=`${n}{${ni(this,this.overscript||this.underscript,t)}}{${ni(parent,this.body,t)}}`;break;case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":case"textord":case"":/^\\(mathbin|mathrel|mathopen|mathclose|mathpunct|mathord|mathinner)/.test(n)?i+=n+"{"+ni(this,this.body,t)+"}":'\\char"'===n?i+=this.latex+" ":"\\unicode"===n?(i+='\\unicode{"',i+=("000000"+this.body.charCodeAt(0).toString(16)).toUpperCase().substr(-6),i+="}"):(this.latex||"string"==typeof this.body)&&(this.latex&&"\\"===this.latex[0]?(i+=this.latex,/[a-zA-Z0-9]$/.test(this.latex)&&(i+=" ")):i+=n||("​"!==this.body?this.latex||this.body:""));break;case"mop":"​"!==this.body&&("\\mathop"===n?i+=n+"{"+ni(this,this.body,t)+"}":"\\operatorname"===n?i+=n+"{"+this.body+"}":this.latex&&"\\"===this.latex[0]?(i+=this.latex,/[a-zA-Z0-9]$/.test(this.latex)&&(i+=" ")):i+=n||("​"!==this.body?this.latex||this.body:"")),this.explicitLimits&&("limits"===this.limits&&(i+="\\limits "),"nolimits"===this.limits&&(i+="\\nolimits "));break;case"box":if("\\bbox"===n){if(i+=n,isFinite(this.padding)||void 0!==this.border||void 0!==this.backgroundcolor){const t=[];isFinite(this.padding)&&t.push(Math.floor(100*this.padding)/100+"em"),this.border&&t.push("border:"+this.border),this.backgroundcolor&&t.push(ue.colorToString(this.backgroundcolor)),i+=`[${t.join(",")}]`}i+=`{${ni(this,this.body,t)}}`}else"\\boxed"===n?i+=`\\boxed{${ni(this,this.body,t)}}`:(i+=n,this.framecolor&&(i+=`{${ue.colorToString(this.framecolor)}}`),this.backgroundcolor&&(i+=`{${ue.colorToString(this.backgroundcolor)}}`),i+=`{${ni(this,this.body,t)}}`);break;case"spacing":i+=n,"\\hspace"===n||"\\hspace*"===n?(i+="{",this.width?i+=this.width+"em":i+="0em",i+="}"):(i+=" ",this.width&&(i+=this.width+"em "));break;case"enclose":if(i+=n,"\\enclose"===n){i+="{";let t="";for(const e in this.notation)this.notation.hasOwnProperty(e)&&this.notation[e]&&(i+=t+e,t=" ");i+="}";let e="";t="",this.backgroundcolor&&"transparent"!==this.backgroundcolor&&(e+=t+'mathbackground="'+ue.colorToString(this.backgroundcolor)+'"',t=","),this.shadow&&"auto"!==this.shadow&&(e+=t+'shadow="'+this.shadow+'"',t=","),1!==this.strokeWidth||"solid"!==this.strokeStyle?(e+=t+this.borderStyle,t=","):this.strokeColor&&"currentColor"!==this.strokeColor&&(e+=t+'mathcolor="'+ue.colorToString(this.strokeColor)+'"',t=","),e&&(i+=`[${e}]`)}i+=`{${ni(this,this.body,t)}}`;break;case"mathstyle":i+="\\"+this.mathstyle+" ";break;case"space":i+=this.latex;break;case"placeholder":i+="\\placeholder{"+(this.value||"")+"}";break;case"first":case"command":case"msubsup":break;case"error":i+=this.latex}if(this.superscript){let e=ni(this,this.superscript,t);1===e.length?("′"===e?e="\\prime ":"″"===e&&(e="\\doubleprime "),i+="^"+e):i+="^{"+e+"}"}if(this.subscript){const e=ni(this,this.subscript,t);1===e.length?i+="_"+e:i+="_{"+e+"}"}return i},ri.plural=function(t,e,i){(i=i||{}).type=i.type||"cardinal";const s=ri.locale.substring(0,2),a="ordinal"===i.type?ri.ordinal:ri.cardinal;let o,n="ordinal"===i.type?ri._ordinalPluralCategories.indexOf(a.select(t)):ri._cardinalPluralCategories.indexOf(a.select(t));return ri.strings[ri.locale]&&(o=ri.strings[ri.locale][e]),!o&&ri.strings[s]&&(o=ri.strings[s][e]),o||((o=ri.strings.en[e])||(o=e),n="ordinal"===i.type?ri._ordinalPluralCategories.indexOf(ri._ordinalEnglish.select(t)):ri._cardinalPluralCategories.indexOf(ri._cardinalEnglish.select(t))),o.split(";")[n]||o.split(";")[0]},ri.merge=function(t,e){if(t&&e){const i=ri._locale;ri.locale=t,ri.strings[t]={...ri.strings[t],...e},ri.locale=i}else if(t&&!e){e=t;for(const t in e)e.hasOwnProperty(t)&&ri.merge(t,e[t])}},Object.defineProperty(ri,"locale",{set(t){ri._locale=t,ri._ordinal=null,ri._cardinal=null},get:()=>(ri._locale||(ri._locale="undefined"==typeof navigator?"en":navigator.language.slice(0,5)),ri._locale)}),Object.defineProperty(ri,"ordinal",{get:()=>(ri._ordinal||(ri._ordinalEnglish=new Intl.PluralRules("en",{type:"ordinal"}),ri._ordinalEnglishPluralCategories=ri._ordinalEnglish.resolvedOptions().pluralCategories,ri._ordinal=new Intl.PluralRules(ri.locale,{type:"ordinal"}),ri._ordinalPluralCategories=ri._ordinal.resolvedOptions().pluralCategories),ri._ordinal)}),Object.defineProperty(ri,"cardinal",{get:()=>(ri._cardinal||(ri._cardinalEnglish=new Intl.PluralRules("en",{type:"cardinal"}),ri._cardinalEnglishPluralCategories=ri._cardinalEnglish.resolvedOptions().pluralCategories,ri._cardinal=new Intl.PluralRules(ri.locale,{type:"cardinal"}),ri._cardinaPluralCategories=ri._ordinal.resolvedOptions().pluralCategories),ri._cardinal)}),ri.strings={en:{"keyboard.tooltip.functions":"Functions","keyboard.tooltip.greek":"Greek Letters","keyboard.tooltip.command":"LaTeX Command Mode","keyboard.tooltip.numeric":"Numeric","keyboard.tooltip.roman":"Symbols and Roman Letters","tooltip.copy to clipboard":"Copy to Clipboard","tooltip.redo":"Redo","tooltip.toggle virtual keyboard":"Toggle Virtual Keyboard","tooltip.undo":"Undo"},ar:{"keyboard.tooltip.functions":"مهام","keyboard.tooltip.greek":"حروف يونانية","keyboard.tooltip.command":"حالة تلقي الأوامر اللاتك","keyboard.tooltip.numeric":"الرقمية","keyboard.tooltip.roman":"رموز الاحرف الرومانية","tooltip.copy to clipboard":"نسخ إلى الحافظة","tooltip.redo":"الإعادة","tooltip.toggle virtual keyboard":"تبديل لوحة المفاتيح الإفتراضية","tooltip.undo":"إلغاء"},de:{"keyboard.tooltip.functions":"Funktionen","keyboard.tooltip.greek":"Griechische Buchstaben","keyboard.tooltip.command":"LaTeX-Befehlsmodus","keyboard.tooltip.numeric":"Numerisch","keyboard.tooltip.roman":"Symbole und römische Buchstaben","tooltip.copy to clipboard":"In die Zwischenablage kopieren","tooltip.redo":"Wiederholen","tooltip.toggle virtual keyboard":"Virtuelle Tastatur umschalten","tooltip.undo":"Widerrufen"},es:{"keyboard.tooltip.functions":"Funciones","keyboard.tooltip.greek":"Letras griegas","keyboard.tooltip.command":"Modo Comando LaTeX","keyboard.tooltip.numeric":"Numérico","keyboard.tooltip.roman":"Símbolos y letras romanas","tooltip.copy to clipboard":"Copiar al portapapeles","tooltip.redo":"Rehacer","tooltip.toggle virtual keyboard":"Alternar teclado virtual","tooltip.undo":"Deshacer"},fa:{"keyboard.tooltip.functions":"توابع","keyboard.tooltip.greek":"حروف یونانی","keyboard.tooltip.command":"حالت دستور لاتک","keyboard.tooltip.numeric":"عددی","keyboard.tooltip.roman":"علائم و حروف لاتین","tooltip.copy to clipboard":"کپی به کلیپبورد","tooltip.redo":"بازگشت به بعد","tooltip.toggle virtual keyboard":"نمایش/نهفتن کیبورد مجازی","tooltip.undo":"بازگشت به قبل"},fr:{"keyboard.tooltip.functions":"Fonctions","keyboard.tooltip.greek":"Lettres grecques","keyboard.tooltip.command":"Mode de commandes LaTeX","keyboard.tooltip.numeric":"Numérique","keyboard.tooltip.roman":"Lettres et symboles romains","tooltip.copy to clipboard":"Copier dans le presse-papiers","tooltip.redo":"Rétablir","tooltip.toggle virtual keyboard":"Afficher/Masquer le clavier virtuel","tooltip.undo":"Annuler"},it:{"keyboard.tooltip.functions":"Funzioni","keyboard.tooltip.greek":"Lettere greche","keyboard.tooltip.command":"Modalità di comando LaTeX","keyboard.tooltip.numeric":"Numerico","keyboard.tooltip.roman":"Simboli e lettere romane","tooltip.copy to clipboard":"Copia negli appunti","tooltip.redo":"Rifare","tooltip.toggle virtual keyboard":"Attiva / disattiva la tastiera virtuale","tooltip.undo":"Disfare"},ja:{"keyboard.tooltip.functions":"関数","keyboard.tooltip.greek":"ギリシャ文字","keyboard.tooltip.command":"LaTeXコマンドモード","keyboard.tooltip.numeric":"数値","keyboard.tooltip.roman":"記号とローマ字","tooltip.copy to clipboard":"クリップボードにコピー","tooltip.redo":"やり直し","tooltip.toggle virtual keyboard":"仮想キーボードの切り替え","tooltip.undo":"元に戻す"},pl:{"keyboard.tooltip.functions":"Funkcje","keyboard.tooltip.greek":"Litery greckie","keyboard.tooltip.command":"Tryb poleceń LaTeX","keyboard.tooltip.numeric":"Numeryczne","keyboard.tooltip.roman":"Symbole i litery rzymskie","tooltip.copy to clipboard":"Kopiuj do Schowka","tooltip.redo":"Przywróć","tooltip.toggle virtual keyboard":"Przełącz wirtualną klawiaturę","tooltip.undo":"Cofnij"},ru:{"keyboard.tooltip.functions":"Функции","keyboard.tooltip.greek":"Греческие буквы","keyboard.tooltip.command":"Режим командной строки LaTeX","keyboard.tooltip.numeric":"числовой","keyboard.tooltip.roman":"Символы и римские буквы","tooltip.copy to clipboard":"Скопировать в буфер обмена","tooltip.redo":"переделывать","tooltip.toggle virtual keyboard":"Переключить виртуальную клавиатуру","tooltip.undo":"расстегивать"}};const li={numeric:{tooltip:"keyboard.tooltip.numeric",layer:"math",label:"123",layers:["math"]},roman:{tooltip:"keyboard.tooltip.roman",layer:"lower-roman",label:"ABC",layers:["lower-roman","upper-roman","symbols"]},greek:{tooltip:"keyboard.tooltip.greek",layer:"lower-greek",label:"αβγ",classes:"tex-math",layers:["lower-greek","upper-greek"]},functions:{tooltip:"keyboard.tooltip.functions",layer:"functions",label:"f ()",classes:"tex",layers:["functions"]},command:{tooltip:"keyboard.tooltip.command",command:"enterCommandMode",label:"",layers:["lower-command","upper-command","symbols-command"]},style:{tooltip:"keyboard.tooltip.style",layer:"style",label:"bi𝔹"}},ci={"\\varphi ":{label:"Φ",insert:"\\Phi "},"\\varsigma ":{label:"Σ",insert:"\\Sigma "},"\\epsilon ":{label:"Ɛ",insert:'{\\char"0190}'},"\\rho ":{label:"Ρ",insert:'{\\char"3A1}'},"\\tau ":{label:"Τ",insert:'{\\char"3A4}'},"\\upsilon ":{label:"Υ",insert:"\\Upsilon "},"\\theta ":{label:"Θ",insert:"\\Theta "},"\\iota ":{label:"Ι",insert:'{\\char"399}'},"\\omicron ":{label:"Ο",insert:'{\\char"39F}'},"\\pi ":{label:"Π",insert:"\\Pi "},"\\alpha ":{label:"Α",insert:'{\\char"391}'},"\\sigma ":{label:"Σ",insert:"\\Sigma "},"\\delta ":{label:"Δ",insert:"\\Delta "},"\\phi ":{label:"Φ",insert:"\\Phi "},"\\gamma ":{label:"Γ",insert:"\\Gamma "},"\\eta ":{label:"Η",insert:'{\\char"397}'},"\\xi ":{label:"Ξ",insert:"\\Xi "},"\\kappa ":{label:"Κ",insert:'{\\char"39A}'},"\\lambda ":{label:"Λ",insert:"\\Lambda "},"\\zeta ":{label:"Ζ",insert:'{\\char"396}'},"\\chi ":{label:"Χ",insert:'{\\char"3A7}'},"\\psi ":{label:"Ψ",insert:"\\Psi "},"\\omega ":{label:"Ω",insert:"\\Omega "},"\\beta ":{label:"Β",insert:'{\\char"392}'},"\\nu ":{label:"Ν",insert:'{\\char"39D}'},"\\mu ":{label:"Μ",insert:'{\\char"39C}'}},hi={0:["\\emptyset","\\varnothing","\\infty",{latex:"#?_0",insert:"#@_0"},"\\circ","\\bigcirc","\\bullet"],2:["\\frac{1}{2}",{latex:"#?^2",insert:"#@^2"}],3:["\\frac{1}{3}",{latex:"#?^3",insert:"#@^3"}],".":[",",";","\\colon",{latex:":",aside:"ratio"},{latex:"\\cdotp",aside:"center dot",classes:"box"},{latex:"\\cdots",aside:"center ellipsis",classes:"box"},{latex:"\\ldotp",aside:"low dot",classes:"box"},{latex:"\\ldots",aside:"low ellipsis",classes:"box"},{latex:"\\vdots",aside:"",classes:"box"},{latex:"\\ddots",aside:"",classes:"box"},"\\odot","\\oslash","\\circledcirc"],"*":["\\cdot","\\ast","\\star","\\bigstar","\\ltimes","\\rtimes","\\rightthreetimes","\\leftthreetimes","\\intercal","\\prod",{latex:"\\prod_{n\\mathop=0}^{\\infty}",classes:"small"}],"+":["\\pm","\\mp","\\sum",{latex:"\\sum_{n\\mathop=0}^{\\infty}",classes:"small"},"\\dotplus","\\oplus"],"-":["\\pm","\\mp","\\ominus","\\vert #0 \\vert"],"/":["\\divideontimes","/","\\div"],"(":["\\left( #0\\right)","\\left[ #0\\right]","\\left\\{ #0\\right\\}","\\left\\langle #0\\right\\rangle","\\lfloor","\\llcorner","(","\\lbrack","\\lvert","\\lVert","\\lgroup","\\langle","\\lceil","\\ulcorner","\\lmoustache","\\lbrace"],")":["\\rfloor","\\lrcorner",")","\\rbrack","\\rvert","\\rVert","\\rgroup","\\rangle","\\rceil","\\urcorner","\\rmoustache","\\rbrace"],"=":["\\cong","\\asymp","\\equiv","\\differencedelta","\\varpropto","\\thickapprox","\\approxeq","\\thicksim","\\backsim","\\eqsim","\\simeq","\\Bumpeq","\\bumpeq","\\doteq","\\Doteq","\\fallingdotseq","\\risingdotseq","\\coloneq","\\eqcirc","\\circeq","\\triangleq","\\between"],"!=":["\\neq","\\ncong","","\\nsim"],"<":["\\leq","\\leqq","\\lneqq","\\ll","\\nless","\\nleq","\\precsim","\\lesssim","\\lessgtr","\\prec","\\preccurlyeq","\\lessdot","\\nprec"],">":["\\geq","\\geqq","\\gneqq","\\gg","\\ngtr","\\ngeq","\\succsim","\\gtrsim","\\gtrless","\\succ","\\succcurlyeq","\\gtrdot","\\nsucc"],set:["\\in","\\owns","\\subset","\\nsubset","\\supset","\\nsupset"],"!set":["\\notin","\\backepsilon"],subset:[],supset:[],infinity:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"],"numeric-pi":["\\prod","\\theta","\\rho","\\sin","\\cos","\\tan"],ee:["\\times 10^{#?}","\\ln","\\ln_{10}","\\log"],"^":["_{#?}"],int:[{latex:"\\int_{#?}^{#?}",classes:"small"},{latex:"\\int",classes:"small"},{latex:"\\smallint",classes:"small"},{latex:"\\iint",classes:"small"},{latex:"\\iiint",classes:"small"},{latex:"\\oint",classes:"small"},{latex:"\\dfrac{\\rd}{\\rd x}",classes:"small"},{latex:"\\frac{\\partial}{\\partial x}",classes:"small"},"\\capitalDifferentialD","\\rd","\\partial"],nabla:["\\nabla\\times","\\nabla\\cdot","\\nabla^{2}"],"!":["!!","\\Gamma","\\Pi"],accents:["\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"],A:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"}],a:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"}],b:[{latex:"\\beth",aside:"beth"}],B:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"}],d:[{latex:"\\daleth",aside:"daleth"}],D:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"}],g:[{latex:"\\gimel",aside:"gimel"}],G:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"}],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\N",aside:"set of natural numbers"}],p:[{latex:"\\P",aside:"set of primes"}],q:[{latex:"\\Q",aside:"set of rational numbers"}],r:[{latex:"\\R",aside:"set of real numbers"}],z:[{latex:"\\Z",aside:"set of integers"}],"x-var":["y","z","t","r",{latex:"f(#?)",classes:"small"},{latex:"g(#?)",classes:"small"},"x^2","x^n","x_n","x_{n+1}","x_i","x_{i+1}"],"n-var":["i","j","p","k","a","u"],ii:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"],logic:[{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},{latex:"\\ni",aside:"such that"},{latex:"\\Colon",aside:"such that"},{latex:"\\implies",aside:"implies"},{latex:"\\impliedby",aside:"implied by"},{latex:"\\iff",aside:"if and only if"},{latex:"\\land",aside:"and"},{latex:"\\lor",aside:"or"},{latex:"\\oplus",aside:"xor"},{latex:"\\lnot",aside:"not"},{latex:"\\downarrow",aside:"nor"},{latex:"\\uparrow",aside:"nand"},{latex:"\\curlywedge",aside:"nor"},{latex:"\\bar\\curlywedge",aside:"nand"},{latex:"\\therefore",aside:"therefore"},{latex:"\\because",aside:"because"},{latex:"^\\biconditional",aside:"biconditional"},"\\leftrightarrow","\\Leftrightarrow","\\to","\\models","\\vdash","\\gets","\\dashv","\\roundimplies"],"set-operators":["\\cap","\\cup","\\setminus","\\smallsetminus","\\complement"],"set-relations":["\\in","\\notin","\\ni","\\owns","\\subset","\\supset","\\subseteq","\\supseteq","\\subsetneq","\\supsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsupset","\\nsubseteq","\\nsupseteq"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space
⁻³⧸₁₈ em"},{latex:'\\unicode{"203A}\\,\\unicode{"2039}',insert:"\\,",aside:"thin space
³⧸₁₈ em"},{latex:'\\unicode{"203A}\\:\\unicode{"2039}',insert:"\\:",aside:"medium space
⁴⧸₁₈ em"},{latex:'\\unicode{"203A}\\;\\unicode{"2039}',insert:"\\;",aside:"thick space
⁵⧸₁₈ em"},{latex:'\\unicode{"203A}\\ \\unicode{"2039}',insert:"\\ ",aside:"⅓ em"},{latex:'\\unicode{"203A}\\enspace\\unicode{"2039}',insert:"\\enspace",aside:"½ em"},{latex:'\\unicode{"203A}\\quad\\unicode{"2039}',insert:"\\quad",aside:"1 em"},{latex:'\\unicode{"203A}\\qquad\\unicode{"2039}',insert:"\\qquad",aside:"2 em"}],delete:[{label:'',command:'"deleteAll"'}],"->|":[]};let di={};const pi={math:"\n
\n
    \n
  • x
  • \n
  • n
  • \n
  • \n \n
  • \n
  • e
  • \n
  • i
  • \n
  • \n
\n
    \n
  • <
  • \n
  • >
  • \n
  • \n \n
  • \n
  • x ²
  • \n
  • x
  • \n
  • \n
\n
    \n
  • (
  • \n
  • )
  • \n
  • \n \n
  • \n
  • \n
  • \n
\n \n
    \n
  • \n
  • \n
  • \n \n
  • \n \n
\n
\n ","lower-roman":"\n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n
  • ∞≠
  • \n
  • ,
  • \n
  •  
  • \n \n
\n
","upper-roman":"\n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n
  • ∞≠
  • \n
  • ;
  • \n
  •  
  • \n \n
\n
",symbols:"\n
\n
    \n \n
  • {
  • \n
  • }
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • o
  • \n
  • \n
  • \n\n
\n
    \n \n
  • [
  • \n
  • ]
  • \n
  • \n
  • \n
  • \n
  • !
  • \n
  • o
  • \n
  • o
  • \n
  • \n
  • \n\n
\n
    \n \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n\n
  • \n
\n
    \n \n
  • abc
  • \n
  • \n
  • :
  • \n
  • \n
  • \n
  • \n
  • ±
  • \n \n
\n
","lower-greek":"\n
\n
  • φ
  • \n
  • ς
  • \n
  • ϵ
  • \n
  • ρ
  • \n
  • τ
  • \n
  • υ
  • \n
  • θ
  • \n
  • ι
  • \n
  • ο
  • \n
  • π
  • \n
\n
  • α
  • \n
  • σ
  • \n
  • δ
  • \n
  • ϕ
  • \n
  • γ
  • \n
  • η
  • \n
  • ξ
  • \n
  • κ
  • \n
  • λ
  • \n
\n
  • \n
  • ζ
  • \n
  • χ
  • \n
  • ψ
  • \n
  • ω
  • \n
  • β
  • \n
  • ν
  • \n
  • μ
  • \n
  • \n
\n
    \n
  •  
  • \n
  • ,
  • \n
  • ε
  • \n
  • ϑ
  • \n
  • ϰ
  • \n
  • ϖ
  • \n
  • ϱ
  • \n \n
\n
","upper-greek":"\n
\n
  • Φ
  • \n
  • Σ
  • \n
  • Ɛ
  • \n
  • Ρ
  • \n
  • Τ
  • \n
  • Υ
  • \n
  • Θ
  • \n
  • Ι
  • \n
  • Ο
  • \n
  • Π
\n
  • Α
  • \n
  • Σ
  • \n
  • Δ
  • \n
  • Φ
  • \n
  • Γ
  • \n
  • Η
  • \n
  • Ξ
  • \n
  • Κ
  • \n
  • Λ
\n
  • \n
  • Ζ
  • \n
  • Χ
  • \n
  • Ψ
  • \n
  • Ω
  • \n
  • Β
  • \n
  • Ν
  • \n
  • Μ
  • \n
\n
    \n
  •  
  • \n
  • .
  • \n
  •  
  • \n \n
\n
","lower-command":"\n
\n
\n
\n
\n
    \n
  • 01#
  • \n
  • {
  • \n
  • }
  • \n
  • ^
  • \n
  • _
  • \n
  •  
  • \n \n
\n
","upper-command":"\n
\n
\n
\n
\n
    \n
  • \n
  • [
  • \n
  • ]
  • \n
  • (
  • \n
  • )
  • \n
  •  
  • \n \n
\n
","symbols-command":"\n
\n
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 0
\n
  • !
  • @
  • #
  • $
  • %
  • ^
  • &
  • *
  • +
  • =
\n
    \n
  • \\
  • \n
  • |
  • \n
  • /
  • \n
  • `
  • \n
  • ;
  • \n
  • :
  • \n
  • ?
  • \n
  • '
  • \n
  • \"
  • \n
  • \n
\n
    \n
  • abc
  • \n
  • <
  • \n
  • >
  • \n
  • ~
  • \n
  • ,
  • \n
  • .
  • \n
  •  
  • \n \n
\n
",functions:"\n
\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
  • \n
  • (
  • \n
  • )
  • \n
  • \n
  • \n
  •  
  • \n \n
\n
",style:"\n
\n
    \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
    \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
    \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
    \n
  • \n
  • \n
  • \n\n
  • \n
  • \n
  • \n
  • \n
\n
"};function mi(t,e,i){t=t.replace(/(^|[^\\])#@/g,"$1#?");const s=be.parseTokens(x.tokenize(t),"math",e,i.config.macros),a=de.decompose({mathstyle:"displaystyle",macros:i.config.macros},s),o=et.makeSpan(a,"ML__base"),n=et.makeSpan("","ML__strut");n.setStyle("height",o.height,"em");const r=et.makeSpan("","ML__strut--bottom");return r.setStyle("height",o.height+o.depth,"em"),r.setStyle("vertical-align",-o.depth,"em"),et.makeSpan([n,r,o],"ML__mathlive").toMarkup()}function ui(t,e,i){let s="
";const a=e.replace(/\s+/g," ").split(" ");if(a.length>1){const e=Object.assign({},li,t.config.customVirtualKeyboards||{});for(const t of a){if(!e[t])break;s+="
"+e[t].label+"
"}}return s+="
",""}function fi(t,e,i){for(let s=0;s"+a.getAttribute("data-aside").replace(/"/g,'"')+""),a.getAttribute("data-classes")&&a.classList.add(a.getAttribute("data-classes"));let o,n=a.getAttribute("data-insert");if(n&&(n=n.replace(/"/g,'"')),n&&ci[n]&&(a.setAttribute("data-shifted",ci[n].label),a.setAttribute("data-shifted-command",JSON.stringify(["insertAndUnshiftKeyboardLayer",ci[n].insert]))),o=a.getAttribute("data-command")?JSON.parse(a.getAttribute("data-command")):a.getAttribute("data-insert")?["insert",a.getAttribute("data-insert"),{focus:!0,feedback:!0,mode:"math",format:"auto",resetStyle:!0}]:a.getAttribute("data-latex")?["insert",a.getAttribute("data-latex"),{focus:!0,feedback:!0,mode:"math",format:"auto",resetStyle:!0}]:["typedText",a.getAttribute("data-key")||a.textContent,{focus:!0,feedback:!0,simulateKeystroke:!0}],i&&(o=[i,o]),a.getAttribute("data-alt-keys")){const t=di[a.getAttribute("data-alt-keys")];t&&(o={default:o,pressAndHoldStart:["showAlternateKeys",a.getAttribute("data-alt-keys"),t],pressAndHoldEnd:"hideAlternateKeys"})}t._attachButtonHandlers(a,o)}}function gi(t,e){const i={qwerty:{"lower-1":"qwertyuiop","lower-2":" asdfghjkl ","lower-3":"^zxcvbnm~","upper-1":"QWERTYUIOP","upper-2":" ASDFGHJKL ","upper-3":"^ZXCVBNM~","numpad-1":"789/","numpad-2":"456*","numpad-3":"123-","numpad-4":"0.=+"},azerty:{"lower-1":"azertyuiop","lower-2":"qsdfghjklm","lower-3":"^ wxcvbn ~","upper-1":"AZERTYUIOP","upper-2":"QSDFGHJKLM","upper-3":"^ WXCVBN ~"},qwertz:{"lower-1":"qwertzuiop","lower-2":" asdfghjkl ","lower-3":"^yxcvbnm~","upper-1":"QWERTZUIOP","upper-2":" ASDFGHJKL","upper-3":"^YXCVBNM~"},dvorak:{"lower-1":"^ pyfgcrl ","lower-2":"aoeuidhtns","lower-3":"qjkxbmwvz~","upper-1":"^ PYFGCRL ","upper-2":"AOEUIDHTNS","upper-3":"QJKXBMWVZ~"},colemak:{"lower-1":" qwfpgjluy ","lower-2":"arstdhneio","lower-3":"^zxcvbkm~","upper-1":" QWFPGNLUY ","upper-2":"ARSTDHNEIO","upper-3":"^ZXCVBKM~"}},s=i[t.config.virtualKeyboardLayout]?i[t.config.virtualKeyboardLayout]:i.qwerty;let a,o=e,n=(o=o.replace(//g,"\n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n
  • ")).match(/()/);for(;n;){a="";const t=n[2].match(/[a-zA-Z][a-zA-Z0-9-]*=(['"])(.*?)\1/g),e={};for(const i of t){const t=i.match(/([a-zA-Z][a-zA-Z0-9-]*)=(['"])(.*?)\2/);e[t[1]]=t[3]}let r=s[e.name];if(r||(r=i.qwerty[e.name]),r)for(const t of r){let i=e.class||"";i&&(i=" "+i),"~"===t?(a+="
  • \'\n data-shifted-command=\'"deleteAll"\'\n data-alt-keys=\'delete\' data-command=\'["performWithFeedback","deletePreviousChar"]\'\n >⌫
  • '):" "===t?a+="
  • ":"^"===t?a+="
  • ":"/"===t?a+="
  • ÷
  • ":"*"===t?a+="
  • ×
  • ":"-"===t?a+="
  • ":/tt/.test(i)?a+="
  • '+t+"
  • ":a+="
  • "+t+"
  • "}n=(o=o.replace(new RegExp(n[1]+n[2]+n[3]),a)).match(/()/)}return o}var yi={make:function(t,e){let i='\n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ';hi["foreground-color"]=[];for(const t of ue.LINE_COLORS)hi["foreground-color"].push({classes:"small-button",content:'',command:'["applyStyle",{"color":"'+t+'"}]'});hi["background-color"]=[];for(const t of ue.AREA_COLORS)hi["background-color"].push({classes:"small-button",content:'',command:'["applyStyle",{"backgroundColor":"'+t+'"}]'});di={},di=Object.assign({},hi);for(const t in di)di.hasOwnProperty(t)&&(di[t]=di[t].slice());const s="abcdefghijklmnopqrstuvwxyz";for(let t=0;t<26;t++){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t];di[e]||(di[e]=[]),di[e].unshift({latex:"\\mathbb{"+e+"}",aside:"blackboard",insert:"\\mathbb{"+e+"}"}),di[e].unshift({latex:"\\mathbf{"+e+"}",aside:"bold",insert:"\\mathbf{"+e+"}"}),di[e].unshift({latex:"\\mathsf{"+e+"}",aside:"sans",insert:"\\mathsf{"+e+"}"}),di[e].unshift({latex:"\\mathtt{"+e+"}",aside:"monospace",insert:"\\mathtt{"+e+"}"}),di[e].unshift({latex:"\\mathcal{"+e+"}",aside:"script",insert:"\\mathcal{"+e+"}"}),di[e].unshift({latex:"\\mathfrak{"+e+"}",aside:"fraktur",insert:"\\mathfrak{"+e+"}"}),di[e].unshift({latex:"\\mathbb{"+s[t]+"}",aside:"blackboard",insert:"\\mathbb{"+s[t]+"}"}),di[e].unshift({latex:"\\mathbf{"+s[t]+"}",aside:"bold",insert:"\\mathbf{"+s[t]+"}"}),di[e].unshift({latex:"\\mathsf{"+s[t]+"}",aside:"sans",insert:"\\mathsf{"+s[t]+"}"}),di[e].unshift({latex:"\\mathcal{"+s[t]+"}",aside:"script",insert:"\\mathcal{"+s[t]+"}"}),di[e].unshift({latex:"\\mathfrak{"+s[t]+"}",aside:"fraktur",insert:"\\mathfrak{"+s[t]+"}"})}for(let t=0;t<=26;t++){const e=s[t];di[e]||(di[e]=[]),di[e].unshift({latex:"\\mathsf{"+e+"}",aside:"sans",insert:"\\mathbb{"+e+"}"}),di[e].unshift({latex:"\\mathbf{"+e+"}",aside:"bold",insert:"\\mathbf{"+e+"}"}),di[e].unshift({latex:"\\mathtt{"+e+"}",aside:"monospace",insert:"\\mathtt{"+e+"}"}),di[e].unshift({latex:"\\mathfrak{"+e+"}",aside:"fraktur",insert:"\\mathfrak{"+e+"}"})}for(let t=0;t<10;t++){const e="0123456789"[t];di[e]||(di[e]=[]),di[e].unshift({latex:"\\mathbf{"+e+"}",aside:"bold",insert:"\\mathbf{"+e+"}"}),di[e].unshift({latex:"\\mathsf{"+e+"}",aside:"sans",insert:"\\mathsf{"+e+"}"}),di[e].unshift({latex:"\\mathtt{"+e+"}",aside:"monospace",insert:"\\mathtt{"+e+"}"}),di[e].unshift({latex:"\\mathcal{"+e+"}",aside:"script",insert:"\\mathcal{"+e+"}"}),di[e].unshift({latex:"\\mathfrak{"+e+"}",aside:"fraktur",insert:"\\mathfrak{"+e+"}"})}let a=t.config.virtualKeyboards;a||(a="all"),a=a.replace(/\ball\b/i,"numeric roman greek functions command");const o=Object.assign({},pi,t.config.customVirtualKeyboardLayers||{}),n=Object.assign({},li,t.config.customVirtualKeyboards||{}),r=a.replace(/\s+/g," ").split(" ");for(const e of r){if(!n[e])break;let s=n[e].layers||[];n[e].layer&&s.push(n[e].layer),s=Array.from(new Set(s));for(const n of s){if(!o[n])break;if("object"==typeof o[n]){let t="";if(o[n].styles&&(t+=``),o[n].backdrop&&(t+=`
    `),o[n].container&&(t+=`
    `),o[n].rows){t+="
    ";for(const e of o[n].rows){t+="
      ";for(const i of e)t+="${i.label?i.label:""}`;t+="
    "}t+="
    ",o[n].container&&(t+=""),o[n].backdrop&&(t+="")}o[n]=t}i+="
    ",i+=ui(t,a,e);const s="function"==typeof o[n]?o[n]():o[n];i+=gi(t,s),i+="
    "}}const l=document.createElement("div");l.className="ML__keyboard",e?l.classList.add(e):t.config.virtualKeyboardTheme?l.classList.add(t.config.virtualKeyboardTheme):/android|cros/i.test(navigator.userAgent)&&l.classList.add("material"),l.innerHTML=i,fi(t,l.querySelectorAll(".keycap, .action, .fnbutton, .bigfnbutton"));const c=l.getElementsByClassName("layer-switch");for(let e=0;e{t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("touchstart",t=>{t.preventDefault(),t.stopPropagation()})}),h[0].classList.add("is-visible"),window.addEventListener("mouseup",function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()}),window.addEventListener("blur",function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()}),window.addEventListener("touchend",function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()}),window.addEventListener("touchcancel",function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()}),l},makeKeycap:fi};const bi={"−":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon","\\varepsilon":"varepsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta","\\vartheta":"vartheta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi","\\varphi":"varphi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega"},xi={"\\pm":"+-","\\times":"xx","\\colon":":","\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrace":"{","\\rbrace":"}","\\langle":"(:","\\rangle":":)"},ki={"\\pm":"±","\\times":"×","\\colon":":","\\vert":"|","\\Vert":"∥","\\mid":"∣","\\lbrace":"{","\\rbrace":"}","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉","\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};function vi(t){return t.replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function wi(t,e){return t&&e.generateID?' extid="'+t+'"':""}function Si(t,e,i){let s=!1;e=e||t.atoms.length;let a="",o="",n=-1,r=-1;const l=t.atoms[t.index];if(t.index0){if(s=!0,Ai(t)&&(n=t.index,t.index+=1),Ci(t)&&(r=t.index,t.index+=1),n>=0&&r>=0)a=""+o,a+=zi(t.atoms[r].subscript,0,0,i).mathML,a+=zi(t.atoms[n].superscript,0,0,i).mathML,a+="";else if(n>=0){if(a=""+o,Ai(t)){const e=zi(t.atoms[n].superscript,0,0,i).mathML,s=zi(t.atoms[n+1].superscript,0,0,i).mathML;a+=""!==e&&""!==e||""!==s&&""!==s?""===e||""===e?"":e:""}else a+=zi(t.atoms[n].superscript,0,0,i).mathML;a+=""}else r>=0?(a=""+o,a+=zi(t.atoms[r].subscript,0,0,i).mathML,a+=""):a=o;"mi"!==t.lastType&&"mn"!==t.lastType&&"mtext"!==t.lastType&&"fence"!==t.lastType||/^(.*)<\/mo>$/.test(a)||(a=""+a),o.endsWith(">f")||o.endsWith(">g")?(a+="",t.lastType="applyfunction"):t.lastType=/^(.*)<\/mo>$/.test(a)?"mo":"mi",t.mathML+=a}return s}function Ai(t){return t.index"+t,a+=zi(o.subscript,0,0,i).mathML,a+=zi(o.superscript,0,0,i).mathML,a+=""):o.superscript?(a=""+t,a+=zi(o.superscript,0,0,i).mathML,a+=""):o.subscript&&(a=""+t,a+=zi(o.subscript,0,0,i).mathML,a+=""),a.length>0&&(s=!0,e.mathML+=a,e.lastType=""),s))}function _i(t,e,i){let s=!1;e=e||t.atoms.length;const a=t.index;let o="";for(;t.index0&&(s=!0,o=""+o+"",t.mathML+=o,t.lastType="mtext"),s}function Ti(t,e,i){let s=!1;e=e||t.atoms.length;const a=t.index;let o="",n=function(t){let e=-1,i=t.index,s=!1,a=!1;for(;i=0&&n=0;)o+=t.atoms[t.index].body,t.index+=1;return o.length>0&&(s=!0,o=""+o+"",n<0&&Ai(t)&&(n=t.index,t.index+=1),n>=0&&(o=""+o,o+=zi(t.atoms[n].superscript,0,0,i).mathML,o+=""),t.mathML+=o,t.lastType="mn"),s}function Li(t,e,i){let s=!1;e=e||t.atoms.length;let a="",o="";if(t.index",a+=Di(t.atoms[l],i),a+=zi(t.atoms,l+1,c,i).mathML,a+=Di(t.atoms[c],i),a+="","mi"!==t.lastType&&"mn"!==t.lastType&&"mfrac"!==t.lastType&&"fence"!==t.lastType||(a=""+a),t.index=c+1,Mi(a,t,i)&&(s=!0,t.lastType="",a=""),o="fence")}return a.length>0&&(s=!0,t.mathML+=a,t.lastType=o),s}function Fi(t,e,i){let s=!1;e=e||t.atoms.length;let a="",o="";const n=t.atoms[t.index];if(t.index":"")+t,a+=zi(n.subscript,0,0,i).mathML,a+=zi(n.superscript,0,0,i).mathML,a+="nolimits"!==n.limits?"":""):n.superscript?(a+=("nolimits"!==n.limits?"":"")+t,a+=zi(n.superscript,0,0,i).mathML,a+="nolimits"!==n.limits?"":""):(a+=("nolimits"!==n.limits?"":"")+t,a+=zi(n.subscript,0,0,i).mathML,a+="nolimits"!==n.limits?"":""),o="mo"}else{const e=t.atoms[t.index],n=0===e.latex.indexOf("\\operatorname"),r=n?'"+Ei(e.body)+"":Di(e,i);a+=r,t.index+=1,Mi(a,t,i)&&(s=!0,t.lastType="",a=""),t.index-=1,n||/^(.*)<\/mo>$/.test(r)?o=n?"mi":"mo":(a+="",o="applyfunction")}"mi"!==t.lastType&&"mn"!==t.lastType||/^(.*)<\/mo>$/.test(a)||(a=""+a),t.index+=1}return a.length>0&&(s=!0,t.mathML+=a,t.lastType=o),s}function zi(t,e,i,s){const a={atoms:t,index:e||0,mathML:"",lastType:""};if(i=i||(t?t.length:0),"number"==typeof t||"boolean"==typeof t)a.mathML=t.toString();else if("string"==typeof t)a.mathML=t;else if(t&&"function"==typeof t.toMathML)a.mathML=t.toMathML(s);else if(Array.isArray(t)){let t=0;for(;a.index0&&"genfrac"===a.atoms[a.index].type&&(e=""+e),"genfrac"===a.atoms[a.index].type?a.lastType="mfrac":a.lastType="",e.length>0&&(a.mathML+=e,t+=1),a.index+=1}t>1&&(a.mathML=""+a.mathML+"")}return a}function Di(t,e){let i="";const s=Ei(t.body);return s&&(i=""+s+""),i}function Ei(t){if(!t)return"";if("string"==typeof t)return vi(t);if(!Array.isArray(t)&&"string"==typeof t.body)return vi(t.body);let e="";for(const i of t)"string"==typeof i.body&&(e+=i.body);return vi(e)}de.MathAtom.prototype.toMathML=function(t){const e={"\\exponentialE":"ⅇ","\\imaginaryI":"ⅈ","\\differentialD":"ⅆ","\\capitalDifferentialD":"ⅅ","\\alpha":"α","\\pi":"π","\\infty":"∞","\\forall":"∀","\\nexists":"∄","\\exists":"∃","\\hbar":"ℏ","\\cdotp":"⋅","\\ldots":"…","\\cdots":"⋯","\\ddots":"⋱","\\vdots":"⋮","\\ldotp":"."},i={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let s,a,o,n,r,l,c="",h="",d={cal:"script",frak:"fraktur",bb:"double-struck",scr:"script",cmtt:"monospace",cmss:"sans-serif"}[this.fontFamily||this.font]||"";d&&(d=' mathvariant="'+d+'"');const p=this.latex?this.latex.trim():null;let m;switch(this.type){case"group":case"root":c=zi(this.body,0,0,t).mathML;break;case"array":if((this.lFence&&"."!==this.lFence||this.rFence&&"."!==this.rFence)&&(c+="",this.lFence&&"."!==this.lFence&&(c+=""+(ki[this.lFence]||this.lFence)+"")),c+="",s=0;s"+zi(this.array[a][s],0,0,t).mathML+"";c+=""}c+="",(this.lFence&&"."!==this.lFence||this.rFence&&"."!==this.rFence)&&(this.rFence&&"."!==this.rFence&&(c+=""+(ki[this.lFence]||this.rFence)+""),c+="");break;case"genfrac":(this.leftDelim||this.rightDelim)&&(c+=""),this.leftDelim&&"."!==this.leftDelim&&(c+=""+(ki[this.leftDelim]||this.leftDelim)+""),this.hasBarLine?(c+="",c+=zi(this.numer,0,0,t).mathML||" ",c+=zi(this.denom,0,0,t).mathML||" ",c+=""):(c+="",c+=""+zi(this.numer,0,0,t).mathML+"",c+=""+zi(this.denom,0,0,t).mathML+"",c+=""),this.rightDelim&&"."!==this.rightDelim&&(c+=""+(ki[this.rightDelim]||this.rightDelim)+""),(this.leftDelim||this.rightDelim)&&(c+="");break;case"surd":this.index?(c+="",c+=zi(this.body,0,0,t).mathML,c+=zi(this.index,0,0,t).mathML,c+=""):(c+="",c+=zi(this.body,0,0,t).mathML,c+="");break;case"leftright":c="",this.leftDelim&&"."!==this.leftDelim&&(c+=""+(ki[this.leftDelim]||this.leftDelim)+""),this.body&&(c+=zi(this.body,0,0,t).mathML),this.rightDelim&&"."!==this.rightDelim&&(c+=""+(ki[this.rightDelim]||this.rightDelim)+""),c+="";break;case"sizeddelim":case"delim":c+='"+(ki[this.delim]||this.delim)+"";break;case"accent":c+='",c+=zi(this.body,0,0,t).mathML,c+=""+(ki[p]||this.accent)+"",c+="";break;case"line":case"overlap":break;case"overunder":r=this.overscript,n=this.underscript,r&&n?l=this.body:r?(l=this.body,this.body[0]&&this.body[0].underscript?(n=this.body[0].underscript,l=this.body[0].body):this.body[0]&&"first"===this.body[0].type&&this.body[1]&&this.body[1].underscript&&(n=this.body[1].underscript,l=this.body[1].body)):n&&(l=this.body,this.body[0]&&this.body[0].overscript?(r=this.body[0].overscript,l=this.body[0].body):this.body[0]&&"first"===this.body[0].type&&this.body[1]&&this.body[1].overscript&&(r=this.body[1].overscript,l=this.body[1].body)),r&&n?(c+=""+zi(l,0,0,t).mathML,c+=zi(n,0,0,t).mathML,c+=zi(r,0,0,t).mathML,c+=""):r?(c+=""+zi(l,t).mathML,c+=zi(r,0,0,t).mathML,c+=""):n&&(c+=""+zi(l,t).mathML,c+=zi(n,0,0,t).mathML,c+="");break;case"mord":c=e[p]||p||("string"==typeof this.body?this.body:""),(m=p?p.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):null)?c="&#x"+m[1]+";":c.length>0&&"\\"===c.charAt(0)&&(c="string"==typeof this.body&&this.body.charCodeAt(0)>255?"&#x"+("000000"+this.body.charCodeAt(0).toString(16)).substr(-4)+";":"string"==typeof this.body?this.body.charAt(0):this.body),c=""+vi(c)+"";break;case"mbin":case"mrel":case"textord":case"minner":c=p&&e[p]?""+e[p]+"":p&&ki[p]?""+ki[p]+"":Di(this,t);break;case"mpunct":c='"+(ki[p]||p)+"";break;case"mop":"​"!==this.body&&(c="",c+="\\operatorname"===p?this.body:p||this.body,c+="");break;case"mathstyle":break;case"box":c='"+zi(this.body,0,0,t).mathML+"";break;case"spacing":c+='';break;case"enclose":c=''+zi(this.body,0,0,t).mathML+"";break;case"space":c+=" "}return c},de.toMathML=function(t,e){return zi(t,0,0,e).mathML};const qi={"\\imaginaryI":"ⅈ","\\imaginaryJ":"ⅉ","\\pi":"π","\\exponentialE":"ℯ","﹢":"+","+":"+","−":"-","-":"-","﹣":"-","-":"-","\\times":"*","\\cdot":"*","⨉":"*","️✖":"*","️×":"*",".":"*","÷":"/","⁄":"/","/":"/","!":"factorial","\\mp":"minusplus","\\ne":"!=","\\coloneq":":=","\\questeq":"?=","\\approx":"approx","\\cong":"congruent","\\sim":"similar","\\equiv":"equiv","\\pm":"plusminus","\\land":"and","\\wedge":"and","\\lor":"or","\\vee":"or","\\oplus":"xor","\\veebar":"xor","\\lnot":"not","\\neg":"not","\\exists":"exists","\\nexists":"!exists","\\forall":"forAll","\\backepsilon":"suchThat","\\therefore":"therefore","\\because":"because","\\nabla":"nabla","\\circ":"circle","\\ominus":"ominus","\\odot":"odot","\\otimes":"otimes","\\zeta":"Zeta","\\Gamma":"Gamma","\\min":"min","\\max":"max","\\mod":"mod","\\lim":"lim","\\sum":"sum","\\prod":"prod","\\int":"integral","\\iint":"integral2","\\iiint":"integral3","\\Re":"Re","\\gothicCapitalR":"Re","\\Im":"Im","\\gothicCapitalI":"Im","\\binom":"nCr","\\partial":"partial","\\differentialD":"differentialD","\\capitalDifferentialD":"capitalDifferentialD","\\Finv":"Finv","\\Game":"Game","\\wp":"wp","\\ast":"ast","\\star":"star","\\asymp":"asymp","\\to":"to","\\gets":"gets","\\rightarrow":"shortLogicalImplies","\\leftarrow":"shortLogicalImpliedBy","\\leftrightarrow":"shortLogicalEquivalent","\\longrightarrow":"logicalImplies","\\longleftarrow":"logicalImpliedBy","\\longleftrightarrow":"logicalEquivalent","\\Rightarrow":"shortImplies","\\Leftarrow":"shortImpliedBy","\\Leftrightarrow":"shortEquivalent","\\implies":"implies","\\Longrightarrow":"implies","\\impliedby":"impliedBy","\\Longleftarrow":"impliedBy","\\iff":"equivalent","\\Longleftrightarrow":"equivalent"},Pi={"+":"add","*":"multiply","-":"subtract","/":"divide","=":"equal",":=":"assign","!=":"ne","?=":"questeq",approx:"approx",congruent:"congruent",similar:"similar",equiv:"equiv","<":"lt",">":"gt","<=":"le",">=":"ge","≤":"le","≥":"ge",">>":"gg","<<":"ll","**":"pow","++":"increment","--":"decrement"},Ii={equal:"%0 = %1",ne:"%0 \\ne %1",questeq:"%0 \\questeq %1",approx:"%0 \\approx %1",congruent:"%0 \\cong %1",similar:"%0 \\sim %1",equiv:"%0 \\equiv %1",assign:"%0 := %1",lt:"%0 < %1",gt:"%0 > %1",le:"%0 \\le %1",ge:"%0 \\ge %1",sin:"\\sin%_%^ %0",cos:"\\cos%_%^ %0",tan:"\\tan%_%^ %0",cot:"\\cot%_%^ %0",sec:"\\sec%_%^ %0",csc:"\\csc%_%^ %0",sinh:"\\sinh %0",cosh:"\\cosh %0",tanh:"\\tanh %0",csch:"\\csch %0",sech:"\\sech %0",coth:"\\coth %0",arcsin:"\\arcsin %0",arccos:"\\arccos %0",arctan:"\\arctan %0",arccot:"\\arcctg %0",arcsec:"\\arcsec %0",arccsc:"\\arccsc %0",arsinh:"\\arsinh %0",arcosh:"\\arcosh %0",artanh:"\\artanh %0",arcsch:"\\arcsch %0",arsech:"\\arsech %0",arcoth:"\\arcoth %0",ln:"\\ln%_%^ %",log:"\\log%_%^ %",lg:"\\lg %",lb:"\\lb %",sum:"\\sum%_%^ %0",prod:"\\prod%_%^ %0",Zeta:"\\zeta%_%^ %",Gamma:"\\Gamma %",min:"\\min%_%^ %",max:"\\max%_%^ %",mod:"\\mod%_%^ %",lim:"\\lim%_%^ %",binom:"\\binom %",nabla:"\\nabla %",curl:"\\nabla\\times %0",div:"\\nabla\\cdot %0",floor:"\\lfloor %0 \\rfloor%_%^",ceil:"\\lceil %0 \\rceil%_%^",abs:"\\left| %0 \\right|%_%^",norm:"\\lVert %0 \\rVert%_%^",ucorner:"\\ulcorner %0 \\urcorner%_%^",lcorner:"\\llcorner %0 \\lrcorner%_%^",angle:"\\langle %0 \\rangle%_%^",group:"\\lgroup %0 \\rgroup%_%^",moustache:"\\lmoustache %0 \\rmoustache%_%^",brace:"\\lbrace %0 \\rbrace%_%^","sqrt[]":"\\sqrt[%^]{%0}",sqrt:"\\sqrt{%0}",lcm:"\\operatorname{lcm}%",gcd:"\\operatorname{gcd}%",erf:"\\operatorname{erf}%",erfc:"\\operatorname{erfc}%",randomReal:"\\operatorname{randomReal}%",randomInteger:"\\operatorname{randomInteger}%",and:"%0 \\land %1",or:"%0 \\lor %1",xor:"%0 \\oplus %1",not:"%0 \\lnot %1",circle:"%0 \\circ %1",ast:"%0 \\ast %1",star:"%0 \\star %1",asymp:"%0 \\asymp %1","/":"\\frac{%0}{%1}",Re:"\\Re{%0}",Im:"\\Im{%0}",factorial:"%0!",factorial2:"%0!!"},Bi={degree:880,nabla:740,curl:740,partial:740,differentialD:740,capitalDifferentialD:740,"**":720,odot:710,not:680,div:660,solidus:660,"/":660,setminus:650,"%":640,otimes:410,union:350,intersection:350,"*":390,ast:390,".":390,oplus:300,ominus:300,"+":275,"-":275,"+-":275,"-+":275,circle:265,circledast:265,circledcirc:265,star:265,"..":263,to:262,in:262,"|":261,congruent:265,equiv:260,"=":260,"!=":255,"?=":255,similar:250,approx:247,"<":245,">":243,">=":242,"≥":242,"<=":241,complement:240,subset:240,superset:240,elementof:240,"!elementof":240,exists:230,"!exists":230,forall:230,and:200,xor:195,or:190,suchThat:110,":":100,assign:80,":=":80,therefore:70,because:70,shortLogicalImplies:52,shortImplies:51,logicalImplies:50,implies:49,shortLogicalImpliedBy:48,shortImpliedBy:47,logicalImpliedBy:46,impliedBy:45,shortLogicalEquivalent:44,shortEquivalent:43,logicalEquivalent:42,equivalent:41,",":40,";":30};function Oi(t,e){return Array.isArray(t.arg)?t.arg[e]:void 0}function Ri(t){return t&&Bi[t]||-1}function Ki(t){return/=|=>/.test(t)?"right":"left"}function Ni(t){if("f"===t||"g"===t)return!0;const e=Ii[t];return!!e&&!!/%[^01_^]?/.test(e)}function $i(t){t=(t||"").trim();let e=qi[t];if(!e)if(/^\\[^{}]+$/.test(t)){const i=Pt.getInfo(t,"math",{});e=i&&i.value||t.slice(1)}else e=t;return e}function Wi(t){if(!t)return null;const e=$i(Zi(t)),i=[Ri(e),Ki(e)];return i[0]<=0?null:i}function Hi(t){return null!==Wi(t)}const Vi={"\\lfloor\\rfloor":"floor","\\lceil\\rceil":"ceil","\\vert\\vert":"abs","\\lvert\\rvert":"abs","||":"abs","\\Vert\\Vert":"norm","\\lVert\\rVert":"norm","\\ulcorner\\urcorner":"ucorner","\\llcorner\\lrcorner":"lcorner","\\langle\\rangle":"angle","\\lgroup\\rgroup":"group","\\lmoustache\\rmoustache":"moustache","\\lbrace\\rbrace":"brace"},Ui={"!":"factorial","\\dag":"dagger","\\dagger":"dagger","\\ddagger":"dagger2","\\maltese":"maltese","\\backprime":"backprime","\\backdoubleprime":"backprime2","\\prime":"prime","\\doubleprime":"prime2","\\$":"$","\\%":"%","\\_":"_","\\degree":"degree"},ji={"+":"add","-":"add","*":"multiply","=":"equal",",":"list",";":"list2",and:"and",or:"or",xor:"xor",union:"union",shortLogicalEquivalent:"logicalEquivalent",logicalEquivalent:"logicalEquivalent",shortEquivalent:"equivalent",equivalent:"equivalent"},Gi={",":"list",";":"list2"};function Zi(t){if(Array.isArray(t)){let e="";for(const i of t)e+=Zi(i);return e}if(t.latex&&!/^\\math(op|bin|rel|open|punct|ord|inner)/.test(t.latex))return t.latex.trim();if("leftright"===t.type)return"";if("string"==typeof t.body)return t.body;if(Array.isArray(t.body)){let e="";for(const i of t.body)e+=Zi(i);return e}return""}function Xi(t){return parseFloat(t.num)}function Ji(t){return"object"==typeof t&&void 0!==t.num}function Yi(t){let e=0;return Ji(t)&&(e="object"==typeof t.num?void 0!==t.num.re?us(t.num.re):0:parseFloat(t.num)),e}function Qi(t){let e=0;return Ji(t)&&"object"==typeof t.num&&(e=void 0!==t.num.im?us(t.num.im):0),e}function ts(t){return t&&void 0!==t.sup}function es(t,e,i){let s=!1;const a=t.atoms[t.index];return a&&a.type===e&&(s=void 0===i||Zi(a)===i),s}function is(t,...e){const i={fn:t};if(e){const t=[];for(const i of e)i&&t.push(i);t.length>0&&(i.arg=t)}return i}function ss(t){return"number"==typeof t?{num:t.toString()}:"string"==typeof t?{num:t}:"object"==typeof t?{num:t}:void 0}function as(t){if(Ji(t)){const e=Yi(t),i=Qi(t);return 0!==i?(0!==e&&(t.num.re=(-e).toString()),t.num.im=(-i).toString()):t.num=(-e).toString(),t}return is("negate",t)}function os(t){const e=t.atoms[t.index+1];return e&&"msubsup"===e.type}function ns(t,e){let i=t.atoms[t.index];return!i||void 0===i.superscript&&void 0===i.subscript?i=null:t.index+=1,i||((i=t.atoms[t.index+1])&&"msubsup"===i.type&&(i.superscript||i.subscript)?t.index+=2:i=null),i?(void 0!==i.subscript&&(t.ast.sub=ms(i.subscript,e)),void 0!==i.superscript&&("msubsup"===i.type?/['\u2032]|\\prime/.test(Zi(i.superscript))?(t.index+=1,(i=t.atoms[t.index+1])&&"msubsup"===i.type&&/['\u2032]|\\prime/.test(Zi(i.superscript))?t.ast.sup={sym:"″"}:(t.ast.sup={sym:"′"},t.index-=1)):/['\u2033]|\\doubleprime/.test(Zi(i.superscript))?t.ast.sup={sym:"″"}:t.ast&&(t.ast.sup=ms(i.superscript,e)):t.ast.sup=ms(i.superscript,e))):t.index+=1,t}function rs(t,e){const i=t.ast;if(cs(t,"!!"))return t.index+=1,t.ast=is("factorial2",i),rs(t=ns(t,e),e);if(cs(t,"++"))return t.index+=1,t.ast=is("increment",i),rs(t=ns(t,e),e);if(cs(t,"--"))return t.index+=1,t.ast=is("decrement",i),rs(t=ns(t,e),e);const s=t.atoms[t.index];return s&&s.latex&&Ui[s.latex.trim()]&&(t.ast=is(Ui[s.latex.trim()],i),t=rs(t=ns(t,e),e)),t}function ls(t,e,i,s){if(t.index=t.index||0,0===t.atoms.length||t.index>=t.atoms.length)return t.ast=void 0,t;const a=t.minPrec;t.minPrec=0;let o=t.atoms[t.index];if(e){if("mopen"===o.type&&Zi(o)===e)t.index+=1,(o=(t=ds(t,s)).atoms[t.index])&&"mclose"===o.type&&Zi(o)===i&&(os(t)&&(t.ast={group:t.ast}),t=rs(t=ns(t,s),s));else if("textord"===o.type&&Zi(o)===e)t.index+=1,(o=(t=ds(t,s)).atoms[t.index])&&"textord"===o.type&&Zi(o)===i&&(t.index+=1,t=rs(t=ns(t,s),s));else if("\\lVert"===e&&"textord"===o.type&&"|"===o.latex){if((o=t.atoms[t.index+1])&&"textord"===o.type&&"|"===o.latex){t.index+=2,o=(t=ds(t,s)).atoms[t.index];const e=t.atoms[t.index+1];o&&"textord"===o.type&&"|"===o.latex&&e&&"textord"===e.type&&"|"===e.latex&&(t.index+=2,t=rs(t=ns(t,s),s))}}else if("sizeddelim"===o.type&&o.delim===e)t.index+=1,(o=(t=ds(t,s)).atoms[t.index])&&"sizeddelim"===o.type&&o.delim===i&&(t.index+=1,t=rs(t=ns(t,s),s));else{if("leftright"!==o.type||o.leftDelim!==e||"?"!==o.rightDelim&&o.rightDelim!==i)return;t.ast=ms(o.body,s),os(t)&&(t.ast={group:t.ast}),t=rs(t=ns(t,s),s)}return t.minPrec=a,t}{let s=!0;if("mopen"===o.type?(e=o.latex.trim(),i=Pt.RIGHT_DELIM[e]):"sizeddelim"===o.type?(e=o.delim,i=Pt.RIGHT_DELIM[e]):"leftright"===o.type?(s=!1,e=o.leftDelim,"?"===(i=o.rightDelim)&&(i=Pt.RIGHT_DELIM[e])):"textord"===o.type&&(e=o.latex.trim(),i=Pt.RIGHT_DELIM[e]),e&&i){if("|"===e&&"|"===i){const s=t.atoms[t.index+1];s&&"textord"===s.type&&"|"===s.latex&&(e="\\lVert",i="\\rVert")}if(t=ls(t,e,i))return s&&(t.index+=1),t.ast={fn:Vi[e+i]||e+i,arg:[t.ast]},t.minPrec=a,t}}}function cs(t,e){return t.index=t.index||0,!(t.atoms.length<=1||t.index>=t.atoms.length-1)&&e===Zi(t.atoms[t.index])+Zi(t.atoms[t.index+1])}function hs(t){if(t.index=t.index||0,!(t.atoms.length<=1||t.index>=t.atoms.length-1)){if(!es(t,"textord","\\nabla")){const e=t.atoms[t.index].latex+t.atoms[t.index+1].latex,i=/^(>=|<=|>>|<<|:=|!=|\*\*|\+\+|--)$/.test(e)?e:"";return i&&(t.index+=1),i}return t.index+=1,es(t,"mbin","\\times")?(t.index+=1,t.ast="curl",t):es(t,"mbin","\\cdot")?(t.index+=1,t.ast="div",t):void(t.index-=1)}}function ds(t,e){if(t.index=t.index||0,t.ast=void 0,0===t.atoms.length||t.index>=t.atoms.length)return t;t.minPrec=t.minPrec||0;let i=function t(e,i){if(e.index=e.index||0,e.ast=void 0,0===e.atoms.length||e.index>=e.atoms.length)return e;let s=e.atoms[e.index];const a=$i(Zi(s));if(hs(e))e.ast=is(e.ast,t(e,i).ast);else{if("root"===s.type)return e.index=0,e.atoms=s.body,t(e,i);if("mbin"===s.type&&"-"===a)e.index+=1,(e=t(e,i)).ast=as(e.ast);else if("mbin"===s.type&&"+"===a)e.index+=1,(e=t(e,i)).ast=is("add",e.ast);else if("mord"===s.type&&/^[0-9.]$/.test(s.latex)){let a="",o=!1,n=/^[0-9.eEdD]$/;for(;e.indext.map(t=>ps(t)))),e=[t])}return e}function ms(t,e){return function(t,e){t.index=t.index||0,t.ast=void 0;const i=[];for(;t.atoms[t.index];)if("text"===t.atoms[t.index].mode){let e="";for(;t.atoms[t.index]&&"text"===t.atoms[t.index].mode;)e+=t.atoms[t.index].body,t.index+=1;i.push(e)}else{const s=ds(t,e).ast;if(!s)return;i.push(s)}return i.length>1?is("text",...i):i[0]||void 0}({atoms:ps(t)},e)}function us(t){return parseFloat(parseFloat(t).toPrecision(15))}de.MathAtom.prototype.toAST=function(t){let e,i,s,a,o={},n="",r={bb:"double-struck",cal:"script",scr:"script",frak:"fraktur",cmrss:"sans-serif",cmrtt:"monospace"}[this.baseFontFamily||this.fontFamily],l="";"b"===this.fontSeries&&(l+="bold"),"it"===this.fontShape&&(l+="italic");const c=this.latex?this.latex.trim():null;switch(this.type){case"root":case"group":this.latex&&this.latex.startsWith("\\nicefrac")?(e=this.latex.slice(9).match(/({.*}|[^}])({.*}|[^}])/))?(i=1===e[1].length?e[1]:e[1].substr(1,e[1].length-2),i=be.parseTokens(x.tokenize(i),"math",null,t.macros),s=1===e[2].length?e[2]:e[2].substr(1,e[2].length-2),s=be.parseTokens(x.tokenize(s),"math",null,t.macros),o=is("divide",ms(i,t),ms(s,t))):o.fn="divide":o.group=ms(this.body,t);break;case"genfrac":o=is("divide",ms(this.numer,t),this.denom&&this.denom[0]&&"placeholder"===this.denom[0].type?ss(1):ms(this.denom,t));break;case"surd":o=this.index?is("pow",ms(this.body,t),is("divide",1,ms(this.index,t))):is("sqrt",ms(this.body,t));break;case"rule":break;case"line":case"overlap":case"accent":case"overunder":break;case"mord":case"textord":case"mbin":(e=c?c.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):void 0)?n=String.fromCodePoint(parseInt(e[1],16)):(n=$i(Zi(this))).length>0&&"\\"===n.charAt(0)&&"string"==typeof this.body&&(n=this.body),(a=Pt.mathVariantToUnicode(n,r,l).replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t"))!==n?(o={sym:a},r="normal"):o={sym:n};break;case"minner":case"mop":break;case"box":o=ms(this.body,t);break;case"enclose":break;case"array":if("cardinality"===this.env.name)o=is("card",ms(this.array,t));else if(/array|matrix|pmatrix|bmatrix/.test(this.env.name)){o={fn:"array",args:[]};for(const e of this.array)o.args.push(e.map(e=>ms(e,t)))}else if("cases"===this.env.name){o={fn:"cases",args:[]};for(const e of this.array)if(e[0]){const i=[];i.push(ms(e[0],t));let s=ms(e[1],t);s&&"text"===s.fn&&s.arg&&/^(if|when|for)$/i.test(s.arg[0].trim())&&(s=s.arg.filter(t=>"string"!=typeof t)),i.push(s||{}),o.args.push(i)}}break;case"spacing":case"space":case"mathstyle":break;default:o=void 0}return o&&r&&"normal"!==r&&(o.variant=r),o&&"string"==typeof this.cssClass&&(o.class=this.cssClass),o&&"string"==typeof this.cssId&&(o.id=this.cssId),o},de.toAST=function(t,e){return ms(t,e)};const fs={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"eye ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":' semi-colon ',",":' comma ',"|":'Vertical bar',"(":'Open paren. ',")":' Close paren. ',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","​":"","−":"minus ",":":' such that ',"\\colon":' such that ',"\\hbar":"etch bar ","\\iff":'if, and only if, ',"\\Longleftrightarrow":'if, and only if, ',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set n',"\\C":'the set c',"\\Z":'the set z',"\\Q":'the set q',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lbrace":'open brace',"\\{":'open brace',"\\rbrace":'close brace',"\\}":'close brace',"\\langle":'left angle bracket',"\\rangle":'right angle bracket',"\\lfloor":'open floor',"\\rfloor":'close floor',"\\lceil":'open ceiling',"\\rceil":'close ceiling',"\\vert":'vertical bar',"\\mvert":'divides',"\\lvert":'left vertical bar',"\\rvert":'right vertical bar',"\\lbrack":' open square bracket ',"\\rbrack":' close square bracket ',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"};function gs(t){let e=0;if(t&&Array.isArray(t))for(const i of t)"first"!==i.type&&(e+=1);return 1===e}function ys(t){let e="";if(t&&Array.isArray(t))for(const i of t)"first"!==i.type&&"string"==typeof i.body&&(e+=i.body);return e}function bs(t,e,i,s){e=e.split(" ");for(const a of e){const e=a.match(/(.*):(.*)/);if(e){const a=s||{};"active"===e[2]?a.passive=!1:a[e[2]]=!0,t.addEventListener(e[1],i,a)}else t.addEventListener(a,i,s)}}function xs(t,e,i,s){e=e.split(" ");for(const a of e){const e=a.match(/(.*):(.*)/);if(e){const a=s||{};"active"===e[2]?a.passive=!1:a[e[2]]=!0,t.removeEventListener(e[1],i,a)}else t.removeEventListener(a,i,s)}}function ks(t,e){let i=document.getElementById(t);return i?i.setAttribute("data-refcount",parseInt(i.getAttribute("data-refcount"))+1):((i=document.createElement("div")).setAttribute("aria-hidden","true"),i.setAttribute("data-refcount","1"),i.className=e,i.id=t,document.body.appendChild(i)),i}function vs(t){if(!t)return null;const e=parseInt(t.getAttribute("data-refcount"));return e&&1!==e?t.setAttribute("data-refcount",e-1):t.remove(),t}function ws(t,e){this.$setConfig(e||{}),this.element=t,t.mathfield=this,this.originalContent=t.innerHTML;let i=this.element.textContent;i&&(i=i.trim());let s="";this.config.substituteTextArea?"string"==typeof this.config.substituteTextArea?s+=this.config.substituteTextArea:s+="":/android|ipad|ipod|iphone/i.test(navigator.userAgent)?s+="\n \n \n ":s+='',s+='',this.config.virtualKeyboardMode||(this.config.virtualKeyboardMode=window.matchMedia&&window.matchMedia("(any-pointer: coarse)").matches?"onfocus":"off"),"manual"===this.config.virtualKeyboardMode?(s+=`"):s+="",s+="",s+='\n
    \n \n \n
    \n ',this.element.innerHTML=s;let a=0;"function"==typeof this.config.substituteTextArea?this.textarea=this.config.substituteTextArea():this.textarea=this.element.children[a++].firstElementChild,this.field=this.element.children[a].children[0],this.field.addEventListener("wheel",t=>{t.preventDefault(),t.stopPropagation();let e=void 0===t.deltaX?t.detail:-t.deltaX;isFinite(e)||(e=t.wheelDelta/10),this.field.scroll({top:0,left:this.field.scrollLeft-5*e})},{passive:!1}),this.virtualKeyboardToggleDOMNode=this.element.children[a++].children[1],this._attachButtonHandlers(this.virtualKeyboardToggleDOMNode,{default:"toggleVirtualKeyboard",alt:"toggleVirtualKeyboardAlt",shift:"toggleVirtualKeyboardShift"}),this.ariaLiveText=this.element.children[a].children[0],this.accessibleNode=this.element.children[a++].children[1],this.popover=ks("mathlive-popover-panel","ML__popover"),this.keystrokeCaption=ks("mathlive-keystroke-caption-panel","ML__keystroke-caption"),this.keystrokeCaptionVisible=!1,this.virtualKeyboardVisible=!1,this.keystrokeBuffer="",this.keystrokeBufferStates=[],this.keystrokeBufferResetTimer=null,this.suggestionIndex=0,this.mode=e.defaultMode||"math",this.smartModeSuppressed=!1,this.style={},this.blurred=!0,bs(this.element,"focus",this),bs(this.element,"blur",this),bs(this.textarea,"cut",this),bs(this.textarea,"copy",this),bs(this.textarea,"paste",this),Ye.delegateKeyboardEvents(this.textarea,{container:this.element,allowDeadKey:()=>"text"===this.mode,typedText:this._onTypedText.bind(this),paste:this._onPaste.bind(this),keystroke:this._onKeystroke.bind(this),focus:this._onFocus.bind(this),blur:this._onBlur.bind(this)}),window.PointerEvent?bs(this.field,"pointerdown",this):bs(this.field,"touchstart:active mousedown",this),bs(window,"resize",this);const o={...e};o.onSelectionDidChange=ws.prototype._onSelectionDidChange.bind(this),o.onContentDidChange=ws.prototype._onContentDidChange.bind(this),o.onAnnounce=this.config.onAnnounce,o.macros=this.config.macros,o.removeExtraneousParentheses=this.config.removeExtraneousParentheses,this.mathlist=new Ue.EditableMathlist(o,this),this.undoManager=new Qe.UndoManager(this.mathlist),i.length>0&&this.$latex(i),this.undoManager.startRecording(),this.undoManager.snapshot(this.config)}let Ss;de.toSpeakableFragment=function(t,e){function i(t){return""+t+""}if(!t)return"";let s="";if(t.id&&"math"===e.speechMode&&(s+=''),Array.isArray(t)){let a=!1;for(let o=0;o'+o+'. End fraction.';break;case"surd":if(n=de.toSpeakableFragment(t.body,e),t.index){let i=de.toSpeakableFragment(t.index,e);const a=(i=i.trim()).replace(//g,"");s+="3"===a?' the cube root of '+n+'. End cube root':"n"===a?' the nth root of '+n+'. End root':' the root with index: '+i+', of '+n+'. End root'}else gs(t.body)?s+=" the square root of "+n+" , ":s+=' the square root of '+n+'. End square root';break;case"accent":break;case"leftright":s+=fs[t.leftDelim]||t.leftDelim,s+=de.toSpeakableFragment(t.body,e),s+=fs[t.rightDelim]||t.rightDelim;break;case"line":case"rule":case"overunder":case"overlap":break;case"placeholder":s+="placeholder "+t.body;break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":case"textord":{const i=t.latex?t.latex.trim():"";if("\\mathbin"===i||"\\mathrel"===i||"\\mathopen"===i||"\\mathclose"===i||"\\mathpunct"===i||"\\mathord"===i||"\\mathinner"===i){s=de.toSpeakableFragment(t.body,e);break}let a=t.body,o=t.latex;if("delim"!==t.type&&"sizeddelim"!==t.type||(a=o=t.delim),"text"===e.speechMode)s+=a;else{if("mbin"===t.type&&(s+=''),a){const t=fs[a]||(o?fs[o.trim()]:"");if(t)s+=" "+t;else{const t=o?function(t){let e=oi.NOTES[t];return e||"\\"!==t.charAt(0)||(e=" "+t.replace("\\","")+" "),Array.isArray(e)&&(e=e[0]),e}(o.trim()):"";s+=t||function(t){let i="";return e.textToSpeechMarkup?/[a-z]/.test(t)?i+=' '+t+"":/[A-Z]/.test(t)?i+="capital "+t.toLowerCase():i+=t:/[a-z]/.test(t)?i+=" '"+t.toUpperCase()+"'":/[A-Z]/.test(t)?i+=" 'capital "+t.toUpperCase()+"'":i+=t,i}(a)}}else s+=de.toSpeakableFragment(t.body,e);"mbin"===t.type&&(s+='')}break}case"mop":if("​"!==t.body){const a=t.latex?t.latex.trim():"";if("\\sum"===a)if(t.superscript&&t.subscript){let i=de.toSpeakableFragment(t.superscript,e);i=i.trim();let a=de.toSpeakableFragment(t.subscript,e);s+=' the summation from '+(a=a.trim())+' to '+i+' of ',r=!0}else if(t.subscript){let i=de.toSpeakableFragment(t.subscript,e);s+=' the summation from '+(i=i.trim())+' of ',r=!0}else s+=" the summation of";else if("\\prod"===a)if(t.superscript&&t.subscript){let i=de.toSpeakableFragment(t.superscript,e);i=i.trim();let a=de.toSpeakableFragment(t.subscript,e);s+=' the product from '+(a=a.trim())+' to '+i+' of ',r=!0}else if(t.subscript){let i=de.toSpeakableFragment(t.subscript,e);s+=' the product from '+(i=i.trim())+' of ',r=!0}else s+=" the product of ";else if("\\int"===a)if(t.superscript&&t.subscript){let a=de.toSpeakableFragment(t.superscript,e);a=a.trim();let o=de.toSpeakableFragment(t.subscript,e);s+=' the integral from '+i(o=o.trim())+' to '+i(a)+' of ',r=!0}else s+=' the integral of ';else if("string"==typeof t.body){s+=fs[t.body]||fs[t.latex.trim()]||" "+t.body}else t.latex&&t.latex.length>0&&("\\"===t.latex[0]?s+=" "+t.latex.substr(1):s+=" "+t.latex)}break;case"enclose":n=de.toSpeakableFragment(t.body,e),gs(t.body)?s+=" crossed out "+n+" , ":s+=" crossed out "+n+". End cross out"}if(!r&&t.superscript){let i=de.toSpeakableFragment(t.superscript,e);const a=(i=i.trim()).replace(/<[^>]*>/g,"");if(gs(t.superscript)){if("math"===e.speechMode){const e=function(t){if(t&&Array.isArray(t))for(const e of t)if("first"!==e.type&&e.id)return e.id.toString();return""}(t.superscript);e&&(s+='')}"′"===a?s+=" prime ":"2"===a?s+=" squared ":"3"===a?s+=" cubed ":isNaN(parseInt(a))?s+=" to the "+i+"; ":s+=' to the '+a+" power; "}else isNaN(parseInt(a))?s+=" raised to the "+i+"; ":s+=' raised to the '+a+" power; "}if(!r&&t.subscript){let i=de.toSpeakableFragment(t.subscript,e);i=i.trim(),gs(t.subscript)?s+=" sub "+i:s+=" subscript "+i+". End subscript. "}}return s},de.toSpeakableText=function(t,e){if(e||(e={textToSpeechMarkup:"",textToSpeechRules:"mathlive"}),e.speechMode="math",window.sre&&"sre"===e.textToSpeechRules){e.generateID=!0;const i=de.toMathML(t,e);return i?(e.textToSpeechMarkup&&(e.textToSpeechRulesOptions=e.textToSpeechRulesOptions||{},e.textToSpeechRulesOptions.markup=e.textToSpeechMarkup,"ssml"===e.textToSpeechRulesOptions.markup&&(e.textToSpeechRulesOptions.markup="ssml_step"),e.textToSpeechRulesOptions.rate=e.speechEngineRate),e.textToSpeechRulesOptions&&window.sre.System.getInstance().setupEngine(e.textToSpeechRulesOptions),window.sre.System.getInstance().toSpeech(i)):""}let i=de.toSpeakableFragment(t,e);if("ssml"===e.textToSpeechMarkup){let t="";e.speechEngineRate&&(t=''),i=''+t+"

    "+i+"

    "+(t?"
    ":"")+""}else i="mac"===e.textToSpeechMarkup&&"mac"===function(t){let e="other";return navigator&&navigator.platform&&navigator.userAgent&&(/^(mac)/i.test(navigator.platform)?e="mac":/^(win)/i.test(navigator.platform)?e="win":/(android)/i.test(navigator.userAgent)?e="android":/(iphone)/i.test(navigator.userAgent)||/(ipod)/i.test(navigator.userAgent)||/(ipad)/i.test(navigator.userAgent)?e="ios":/\bCrOS\b/i.test(navigator.userAgent)&&(e="chromeos")),e===t?t:"!"+t}("mac")?i.replace(//g,"").replace(//g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(//g,"[[slc $1]]").replace(/]*>/g,"").replace(/<\/say-as>/g,""):i.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return i},ws.prototype.handleEvent=function(t){switch(t.type){case"focus":this._onFocus(t);break;case"blur":this._onBlur(t);break;case"touchstart":case"mousedown":case"pointerdown":this._onPointerDown(t);break;case"resize":this._resizeTimer&&window.cancelAnimationFrame(this._resizeTimer),this._resizeTimer=window.requestAnimationFrame(()=>this._onResize());break;case"cut":this._onCut(t);break;case"copy":this._onCopy(t);break;case"paste":this._onPaste(t)}},ws.prototype.revertToOriginalContent=ws.prototype.$revertToOriginalContent=function(){this.element.innerHTML=this.originalContent,this.element.mathfield=null,delete this.accessibleNode,delete this.ariaLiveText,delete this.field,xs(this.textarea,"cut",this),xs(this.textarea,"copy",this),xs(this.textarea,"paste",this),this.textarea.remove(),delete this.textarea,this.virtualKeyboardToggleDOMNode.remove(),delete this.virtualKeyboardToggleDOMNode,vs(this.popover),vs(this.keystrokeCaption),vs(this.virtualKeyboard),vs(document.getElementById("mathlive-alternate-keys-panel")),xs(this.element,"pointerdown",this),xs(this.element,"touchstart:active mousedown",this),xs(this.element,"focus",this),xs(this.element,"blur",this),xs(window,"resize",this)},ws.prototype._resetKeystrokeBuffer=function(){this.keystrokeBuffer="",this.keystrokeBufferStates=[],clearTimeout(this.keystrokeBufferResetTimer)},ws.prototype._getCaretPosition=function(){const t=function t(e){if(e.classList.contains("ML__caret")||e.classList.contains("ML__text-caret")||e.classList.contains("ML__command-caret"))return e;let i;return Array.from(e.children).forEach(function(e){i=i||t(e)}),i}(this.field);if(t){const e=t.getBoundingClientRect();return{x:e.right+window.scrollX,y:e.bottom+window.scrollY}}return null},ws.prototype._getSelectionBounds=function(){const t=this.field.querySelectorAll(".ML__selected");if(t&&t.length>0){const e={top:1/0,bottom:-1/0,left:1/0,right:-1/0};t.forEach(t=>{const i=t.getBoundingClientRect();i.lefte.right&&(e.right=i.right),i.bottom>e.bottom&&(e.bottom=i.bottom),i.top=t.left&&i<=t.right}else a.distance=Number.POSITIVE_INFINITY;return o&&e.children&&Array.from(e.children).forEach(function(e){const o=t(e,i,s);o.element&&o.distance<=a.distance&&(a=o)}),a}(this.field,t,e).element,o=a?a.getAttribute("data-atom-id"):null;if(o){const e=this.mathlist.filter(function(t,e){return e.captureSelection?e.filter(t=>t.id===o).length>0:e.id===o});if(e&&e.length>0)if(s=ve.pathFromString(e[0]).path,0===i.bias){const e=a.getBoundingClientRect();tvoid 0)),t._resetKeystrokeBuffer()):"delete"===e?a=Cs(t,"deleted: ",s):"focus"===e||/move/.test(e)?a=(t.mathlist.isCollapsed()?"":"selected: ")+t._nextAtomSpeechText(i):"replacement"===e?a=Cs(t,"",t.mathlist.sibling(0)):"line"===e?(a=Cs(t,"",t.mathlist.root),t.accessibleNode.innerHTML=''+de.toMathML(t.mathlist.root,t.config)+"",t.textarea.setAttribute("aria-label","after: "+a)):a=s?Cs(t,e+" ",s):e;const o=/\u00a0/.test(t.ariaLiveText.textContent)?"   ":"   ";t.ariaLiveText.textContent=a+o}ws.prototype._onPointerDown=function(t){const e=this;let i,s=!1,a=!1,o=!1;if(1!==t.buttons)return;function n(t){window.PointerEvent?(xs(e.field,"pointermove",h),xs(e.field,"pointerend pointerleave pointercancel",n),e.field.releasePointerCapture(t.pointerId)):(xs(e.field,"touchmove",h),xs(e.field,"touchend touchleave",n),xs(window,"mousemove",h),xs(window,"mouseup blur",n)),s=!1,clearInterval(c),e.element.querySelectorAll(".ML__scroller").forEach(t=>t.parentNode.removeChild(t)),t.preventDefault(),t.stopPropagation()}let r=!1,l=!1;const c=setInterval(()=>{r?e.field.scroll({top:0,left:e.field.scrollLeft-16}):l&&e.field.scroll({top:0,left:e.field.scrollLeft+16})},32);function h(t){const s=t.touches?t.touches[0].clientX:t.clientX,o=t.touches?t.touches[0].clientY:t.clientY,n="touch"===t.pointerType?20:5;if(Date.now()c.right,r=s=u.left&&d<=u.right&&p>=u.top&&p<=u.bottom){let r=document.createElement("div");r.className="ML__scroller",this.element.appendChild(r),r.style.left=u.left-200+"px",(r=document.createElement("div")).className="ML__scroller",this.element.appendChild(r),r.style.left=u.right+"px",this.hasFocus()||(o=!0,this.textarea.focus&&this.textarea.focus()),this._resetKeystrokeBuffer(),this.smartModeSuppressed=!1,(i=this._pathFromPoint(d,p,{bias:0}))&&(t.shiftKey?(this.mathlist.setRange(this.mathlist.path,i),(i=ve.clone(this.mathlist.path))[i.length-1].offset-=1):this.mathlist.setPath(i,0),o=!0,this.style={},3===t.detail||As>2?(n(t),3!==t.detail&&3!==As||this.mathlist.selectAll_()):s||(s=!0,window.PointerEvent?(bs(e.field,"pointermove",h),bs(e.field,"pointerend pointercancel pointerup",n),e.field.setPointerCapture(t.pointerId)):(bs(window,"blur",n),t.touches?(bs(t.target,"touchmove",h),bs(t.target,"touchend",n)):(bs(window,"mousemove",h),bs(window,"mouseup",n))),2!==t.detail&&2!==As||(a=!0,this.mathlist.selectGroup_())))}else Ss=null;o&&this._requestUpdate(),t.preventDefault()},ws.prototype._onSelectionDidChange=function(){this.mathlist.commitCommandStringBeforeInsertionPoint();let t="";this.mathlist.forEachSelected(e=>{t+=e.toLatex()}),t?(this.textarea.value=t,this.hasFocus()&&this.textarea.select&&this.textarea.select()):(this.textarea.value="",this.textarea.setAttribute("aria-label",""));{const t=this.mode;this.mode=this.mathlist.anchorMode()||this.config.defaultMode,this.mode!==t&&"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode),"command"===t&&"command"!==this.mode&&(oi.hidePopover(this),this.mathlist.removeCommandString())}oi.updatePopoverPosition(this,{deferred:!0}),"function"==typeof this.config.onSelectionDidChange&&this.config.onSelectionDidChange(this)},ws.prototype._onContentDidChange=function(){this.undoManager.canRedo()?this.element.classList.add("can-redo"):this.element.classList.remove("can-redo"),this.undoManager.canUndo()?this.element.classList.add("can-undo"):this.element.classList.remove("can-undo"),"function"==typeof this.config.onContentDidChange&&this.config.onContentDidChange(this)},ws.prototype._nextAtomSpeechText=function(t){function e(t,e){return"body"===e.relation?{enclose:"cross out",leftright:"fence",surd:"square root",root:"math field"}[t.type]:{numer:"numerator",denom:"denominator",index:"index",body:"parent",subscript:"subscript",superscript:"superscript"}[e.relation]}const i=t?t.path:[],s=this.mathlist.path,a=s[s.length-1];let o="";for(;i.length>s.length;)o+="out of "+e(t.parent(),i[i.length-1])+"; ",i.pop();if(!this.mathlist.isCollapsed())return Cs(this,"",this.mathlist.getSelectedAtoms());const n=e(this.mathlist.parent(),a);0===a.offset&&(o+=(n?"start of "+n:"unknown")+": ");const r=this.mathlist.sibling(Math.max(1,this.mathlist.extent));return r?o+=Cs(this,"",r):0!==a.offset&&(o+=n?"end of "+n:"unknown"),o},ws.prototype._announce=function(t,e,i){"function"==typeof this.config.onAnnounce&&this.config.onAnnounce(this,t,e,i)},ws.prototype._onFocus=function(){this.blurred&&(this.blurred=!1,this.textarea.focus&&this.textarea.focus(),"onfocus"===this.config.virtualKeyboardMode&&this.showVirtualKeyboard_(),oi.updatePopoverPosition(this),this.config.onFocus&&this.config.onFocus(this),this._requestUpdate())},ws.prototype._onBlur=function(){this.blurred||(this.blurred=!0,this.ariaLiveText.textContent="","onfocus"===this.config.virtualKeyboardMode&&this.hideVirtualKeyboard_(),this.complete_({discard:!0}),this._requestUpdate(),this.config.onBlur&&this.config.onBlur(this))},ws.prototype._onResize=function(){this.element.classList.remove("ML__isNarrowWidth","ML__isWideWidth","ML__isExtendedWidth"),window.innerWidth>=1024?this.element.classList.add("ML__isExtendedWidth"):window.innerWidth>=768?this.element.classList.add("ML__isWideWidth"):this.element.classList.add("ML__isNarrowWidth"),oi.updatePopoverPosition(this)},ws.prototype.toggleKeystrokeCaption_=function(){this.keystrokeCaptionVisible=!this.keystrokeCaptionVisible,this.keystrokeCaption.innerHTML="",this.keystrokeCaptionVisible||(this.keystrokeCaption.style.visibility="hidden")},ws.prototype._showKeystroke=function(t){const e=this.keystrokeCaption;if(e&&this.keystrokeCaptionVisible){const i=this.element.getBoundingClientRect();e.style.left=i.left+"px",e.style.top=i.top-64+"px",e.innerHTML=""+(Le.stringify(t)||t)+""+e.innerHTML,e.style.visibility="visible",setTimeout(function(){e.childNodes.length>0&&e.removeChild(e.childNodes[e.childNodes.length-1]),0===e.childNodes.length&&(e.style.visibility="hidden")},3e3)}},ws.prototype.perform=ws.prototype.$perform=function(t){if(!t)return!1;let e,i=!1,s=[],a=!1;if(Array.isArray(t)?(e=t[0],s=t.slice(1)):e=t,e=e.replace(/-\w/g,t=>t[1].toUpperCase()),e+="_","function"==typeof this.mathlist[e]){if(/^(delete|transpose|add)/.test(e)&&this._resetKeystrokeBuffer(),/^(delete|transpose|add)/.test(e)&&"command"!==this.mode&&(this.undoManager.pop(),this.undoManager.snapshot(this.config)),this.mathlist[e](...s),/^(delete|transpose|add)/.test(e)&&"command"!==this.mode&&this.undoManager.snapshot(this.config),/^(delete)/.test(e)&&"command"===this.mode){const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=Pt.suggest(t);0===e.length?oi.hidePopover(this):oi.showPopoverWithLatex(this,e[0].match,e.length>1)}a=!0,i=!0}else"function"==typeof this[e]&&(a=this[e](...s),i=!0);return this.mathlist.isCollapsed()&&!/^(transpose|paste|complete|((moveToNextChar|moveToPreviousChar|extend).*))_$/.test(e)||(this._resetKeystrokeBuffer(),this.style={}),a&&this._requestUpdate(),i},ws.prototype.performWithFeedback_=function(t){return this.focus(),this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),"moveToNextPlaceholder"===(t=t.replace(/-\w/g,t=>t[1].toUpperCase()))||"moveToPreviousPlaceholder"===t||"complete"===t?this.returnKeypressSound?(this.returnKeypressSound.load(),this.returnKeypressSound.play().catch(t=>void 0)):this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>void 0)):"deletePreviousChar"!==t&&"deleteNextChar"!==t&&"deletePreviousWord"!==t&&"deleteNextWord"!==t&&"deleteToGroupStart"!==t&&"deleteToGroupEnd"!==t&&"deleteToMathFieldStart"!==t&&"deleteToMathFieldEnd"!==t||!this.deleteKeypressSound?this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>void 0)):(this.deleteKeypressSound.load(),this.deleteKeypressSound.play().catch(t=>void 0)),this.perform(t)},ws.prototype.convertLastAtomsToText_=function(t,e){"function"==typeof t&&(e=t,t=1/0),void 0===t&&(t=1/0);let i=0,s=!1;for(this.mathlist.contentWillChange();!s;){const a=this.mathlist.sibling(i);(s=0===t||!a||"math"!==a.mode||!(/mord|textord|mpunct/.test(a.type)||"mop"===a.type&&/[a-zA-Z]+/.test(a.body))||a.superscript||a.subscript||e&&!e(a))||(a.applyStyle({mode:"text"}),a.latex=a.body),i-=1,t-=1}this.mathlist.contentDidChange()},ws.prototype.convertLastAtomsToMath_=function(t,e){"function"==typeof t&&(e=t,t=1/0),void 0===t&&(t=1/0),this.mathlist.contentWillChange();let i=0,s=!1;for(;!s;){const a=this.mathlist.sibling(i);(s=0===t||!a||"text"!==a.mode||" "===a.body||e&&!e(a))||a.applyStyle({mode:"math",type:"mord"}),i-=1,t-=1}this.removeIsolatedSpace_(),this.mathlist.contentDidChange()},ws.prototype.removeIsolatedSpace_=function(){let t=0;for(;this.mathlist.sibling(t)&&"math"===this.mathlist.sibling(t).mode;)t-=1;if(this.mathlist.sibling(t)&&"text"===this.mathlist.sibling(t).mode&&" "===this.mathlist.sibling(t).body&&(!this.mathlist.sibling(t-1)||"math"===this.mathlist.sibling(t-1).mode)){this.mathlist.contentWillChange(),this.mathlist.siblings().splice(t-1,1),this.mathlist.contentDidChange();const e=this.mathlist.suppressChangeNotifications;this.mathlist.suppressChangeNotifications=!0,this.mathlist.setSelection(this.mathlist.anchorOffset()-1),this.mathlist.suppressChangeNotifications=e}},ws.prototype.getTextBeforeAnchor_=function(){let t="",e=0,i=!1;for(;!i;){const s=this.mathlist.sibling(e);(i=!(s&&("text"===s.mode&&!s.type||"math"===s.mode&&/mord|textord|mpunct/.test(s.type))))||(t=s.body+t),e-=1}return t},ws.prototype.smartMode_=function(t,e){if(this.smartModeSuppressed)return!1;if(this.mathlist.endOffset()1)return!1;if(!this.mathlist.isCollapsed())return!("text"!==this.mode||!/[\/_^]/.test(i));const s=this.getTextBeforeAnchor_()+i;if("text"===this.mode){if("Esc"===t||/[\/\\]/.test(i))return!0;if(/[\^_]/.test(i))return/(^|\s)[a-zA-Z][^_]$/.test(s)&&this.convertLastAtomsToMath_(1),!0;const e={")":"(","}":"{","]":"["}[i];if(e&&this.mathlist.parent()&&"leftright"===this.mathlist.parent().type&&this.mathlist.parent().leftDelim===e)return!0;if(/(^|[^a-zA-Z])(a|I)[ ]$/.test(s))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(i))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z][ ]$/.test(s))return this.convertLastAtomsToMath_(1),!1;if(/[^0-9]\.[^0-9\s]$/.test(s)){this.convertLastAtomsToMath_(1);const t=this.mathlist.sibling(0);return t.body="⋅",t.autoFontFamily="cmr",t.latex="\\cdot",!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/\.[0-9]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/[(][0-9+\-.]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/[(][a-z][,;]$/.test(s))return this.convertLastAtomsToMath_(2),!0;if(/[0-9+\-=><*|]$/.test(i))return this.removeIsolatedSpace_(),!0}else{if("Spacebar"===t)return this.convertLastAtomsToText_(t=>/[a-z][:,;.]$/.test(t.body)),!0;if(/[a-zA-Z]{3,}$/.test(s)&&!/(dxd|abc|xyz|uvw)$/.test(s))return this.convertLastAtomsToText_(t=>/[a-zA-Z:,;.]/.test(t.body)),!0;if(/(^|\W)(if|If)$/i.test(s))return this.convertLastAtomsToText_(1),!0;if(/\?|\./.test(i))return!0}return!1},ws.prototype._onKeystroke=function(t,e){if(this._showKeystroke(t),clearTimeout(this.keystrokeBufferResetTimer),this.config.onKeystroke&&!this.config.onKeystroke(this,t,e))return e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!1;let i,s,a,o=!1;if("command"!==this.mode&&(!e||!e.ctrlKey&&!e.metaKey)){const t=Ye.eventToChar(e);if("Backspace"!==t)if(!t||t.length>1)this._resetKeystrokeBuffer();else{const e=this.keystrokeBuffer+t;let a=0;for(;!i&&a{this._resetKeystrokeBuffer()},this.config.inlineShortcutTimeout))}}if(this.config.smartMode){const s=this.mode;i?this.mode="math":this.smartMode_(t,e)&&(this.mode={math:"text",text:"math"}[this.mode],a=""),this.mode!==s&&"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode)}if(i||a||(a=Le.selectorForKeystroke(this.mode,t)),!i&&!a)return!0;this.mathlist.decorateCommandStringAroundInsertionPoint(!1);const n=this.mathlist.parent();if("moveAfterParent"===a&&n&&"leftright"===n.type&&this.mathlist.endOffset()===this.mathlist.siblings().length-1&&this.config.smartFence&&this.mathlist._insertSmartFence(".")&&(a="",this._requestUpdate()),"math"===this.mode&&"Spacebar"===t&&!i){const t=this.mathlist.sibling(1),e=this.mathlist.sibling(-1);(t&&"text"===t.mode||e&&"text"===e.mode)&&this.mathlist.insert(" ",{mode:"text"})}if((a&&!this.perform(a)||i)&&i){if(!/^(\\{|\\}|\\[|\\]|\\@|\\#|\\$|\\%|\\^|\\_|\\backslash)$/.test(i)){const t={...this.mathlist.anchorStyle(),...this.style};this.mathlist.insert(Ye.eventToChar(e),{suppressChangeNotifications:!0,mode:this.mode,style:t});const i=this.mode;this.undoManager.snapshotAndCoalesce(this.config),this.undoManager.restore(this.keystrokeBufferStates[s],{...this.config,suppressChangeNotifications:!0}),this.mode=i}this.mathlist.contentWillChange();const t=this.mathlist.suppressChangeNotifications;this.mathlist.suppressChangeNotifications=!0;const a={...this.mathlist.anchorStyle(),...this.style};this.mathlist.insert(i,{format:"latex",mode:this.mode,style:a,smartFence:!0}),this.removeIsolatedSpace_(),i.endsWith(" ")&&(this.mode="text",this.mathlist.insert(" ",{mode:"text",style:a})),this.mathlist.suppressChangeNotifications=t,this.mathlist.contentDidChange(),this.undoManager.snapshot(this.config),this._requestUpdate(),this._announce("replacement"),o&&this._resetKeystrokeBuffer()}return this.scrollIntoView(),e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!1},ws.prototype._onTypedText=function(t,e){if((e=e||{}).focus&&this.focus(),e.feedback&&(this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>void 0))),e.commandMode&&"command"!==this.mode&&this.switchMode_("command"),this.mathlist.decorateCommandStringAroundInsertionPoint(!1),e.simulateKeystroke){const e=t.charAt(0),i=Ye.charToEvent(e);if(!this.$keystroke(Ye.keyboardEventToString(i),i))return}let i="",s=!1;if(this.pasteInProgress)this.pasteInProgress=!1,this.mathlist.insert(t,{smartFence:this.config.smartFence,mode:"math"});else{const e={...this.mathlist.anchorStyle(),...this.style},a=g.splitGraphemes(t);for(const t of a)if("command"===this.mode){this.mathlist.removeSuggestion(),this.suggestionIndex=0;const e=this.mathlist.extractCommandStringAroundInsertionPoint(),a=Pt.suggest(e+t);s=a.length>1,0===a.length?(this.mathlist.insert(t,{mode:"command"}),/^\\[a-zA-Z\\*]+$/.test(e+t)&&this.mathlist.decorateCommandStringAroundInsertionPoint(!0),oi.hidePopover(this)):(this.mathlist.insert(t,{mode:"command"}),a[0].match!==e+t&&this.mathlist.insertSuggestion(a[0].match,-a[0].match.length+e.length+1),i=a[0].match)}else if("math"===this.mode){const i={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[t];if(i){if("moveToSuperscript"===i){if(this._superscriptDepth()>=this.config.scriptDepth[1])return void this._announce("plonk")}else if("moveToSubscript"===i&&this._subscriptDepth()>=this.config.scriptDepth[0])return void this._announce("plonk");this.perform(i)}else this.config.smartSuperscript&&"superscript"===this.mathlist.relation()&&/[0-9]/.test(t)&&0===this.mathlist.siblings().filter(t=>"first"!==t.type).length?(this.mathlist.insert(t,{mode:"math",style:e}),this.mathlist.moveAfterParent_()):this.mathlist.insert(t,{mode:"math",style:e,smartFence:this.config.smartFence})}else"text"===this.mode&&this.mathlist.insert(t,{mode:"text",style:e})}"command"!==this.mode&&this.undoManager.snapshotAndCoalesce(this.config),this._requestUpdate(),this.scrollIntoView(),oi.showPopoverWithLatex(this,i,s)},ws.prototype._hash=function(){let t=0;const e=this.mathlist.root.toLatex(!1);for(let i=0;ithis._render()))},ws.prototype._render=function(t){t=t||{},this.dirty=!1,window.mathlive||(window.mathlive={}),this.mathlist.anchor()||(this.mathlist.path=[{relation:"body",offset:0}]),this.mathlist.forEach(t=>{t.caret="",t.isSelected=!1});const e=this.hasFocus();this.mathlist.isCollapsed()?this.mathlist.anchor().caret=e?this.mode:"":this.mathlist.forEachSelected(t=>{t.isSelected=!0});const i=de.decompose({mathstyle:"displaystyle",generateID:{seed:this._hash(),groupNumbers:t.forHighlighting},macros:this.config.macros},this.mathlist.root),s=et.makeSpan(i,"ML__base");s.attributes={translate:"no","aria-hidden":"true"};const a=et.makeSpan("","ML__strut");a.setStyle("height",s.height,"em");const o=[a];if(0!==s.depth){const t=et.makeSpan("","ML__strut--bottom");t.setStyle("height",s.height+s.depth,"em"),t.setStyle("vertical-align",-s.depth,"em"),o.push(t)}o.push(s);const n=et.makeSpan(o,"ML__mathlive");this.field.innerHTML=n.toMarkup(0,this.config.horizontalSpacingScale),this.field.classList.toggle("ML__focused",e),this.accessibleNode.innerHTML=""+de.toMathML(this.mathlist.root,this.config)+"";const r=this._getSelectionBounds();if(r){const t=document.createElement("div");t.classList.add("ML__selection"),t.style.position="absolute",t.style.left=r.left+"px",t.style.top=r.top+"px",t.style.width=Math.ceil(r.right-r.left)+"px",t.style.height=Math.ceil(r.bottom-r.top-1)+"px",this.field.insertBefore(t,this.field.childNodes[0])}},ws.prototype._onPaste=function(){return this.pasteInProgress=!0,!0},ws.prototype._onCut=function(){return setTimeout(function(){this.clearSelection(),this._requestUpdate()}.bind(this),0),!0},ws.prototype._onCopy=function(t){this.mathlist.isCollapsed()?(t.clipboardData.setData("text/plain",this.$text("latex-expanded")),t.clipboardData.setData("application/json",this.$text("json")),t.clipboardData.setData("application/xml",this.$text("mathML"))):(t.clipboardData.setData("text/plain",this.$selectedText("latex-expanded")),t.clipboardData.setData("application/json",this.$selectedText("json")),t.clipboardData.setData("application/xml",this.$selectedText("mathML"))),t.preventDefault()},ws.prototype.formatMathlist=function(t,e){let i="";if("latex"===(e=e||"latex")||"latex-expanded"===e)i=t.toLatex("latex-expanded"===e);else if("mathML"===e)i=t.toMathML(this.config);else if("spoken"===e)i=de.toSpeakableText(t,this.config);else if("spoken-text"===e){const e=this.config.textToSpeechMarkup;this.config.textToSpeechMarkup="",i=de.toSpeakableText(t,this.config),this.config.textToSpeechMarkup=e}else if("spoken-ssml"===e){const e=this.config.textToSpeechMarkup;this.config.textToSpeechMarkup="ssml",i=de.toSpeakableText(t,this.config),this.config.textToSpeechMarkup=e}else if("json"===e){const e=de.toAST(t,this.config);i=JSON.stringify(e)}else"ASCIIMath"===e&&(i=function t(e,i){if(!e)return"";if(Array.isArray(e)){let s="";if(0===e.length)return"";if("first"===e[0].type&&e.shift(),"text"===e[0].mode){let a=0;for(s='"';e[a]&&"text"===e[a].mode;)s+=e[a].body,a++;s+='"'+t(e.slice(a),i)}else{let a=0;for(;e[a]&&"math"===e[a].mode;)s+=t(e[a],i),a++;s+=t(e.slice(a),i)}return s.trim()}let s="";const a=e.latex?e.latex.trim():null;let o;switch(e.type){case"group":case"root":s=t(e.body,i);break;case"array":break;case"genfrac":(e.leftDelim||e.rightDelim)&&(s+="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:"),e.hasBarLine?(s+="(",s+=t(e.numer,i),s+=")/(",s+=t(e.denom,i),s+=")"):(s+="("+t(e.numer,i)+"),",s+="("+t(e.denom,i)+")"),(e.leftDelim||e.rightDelim)&&(s+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:");break;case"surd":e.index?s+="root("+t(e.index,i)+")("+t(e.body,i)+")":s+="sqrt("+t(e.body,i)+")";break;case"leftright":s+="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:",s+=t(e.body,i),s+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:";break;case"sizeddelim":case"delim":case"accent":break;case"line":case"overlap":case"overunder":break;case"mord":"\\"===(s=bi[a]||a||("string"==typeof e.body?e.body:""))[0]&&(s+=""),(o=a?a.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):null)?s=String.fromCharCode(parseInt("0x"+o[1])):s.length>0&&"\\"===s.charAt(0)&&(s="string"==typeof e.body?e.body.charAt(0):e.latex);break;case"mbin":case"mrel":case"textord":case"minner":s=a&&bi[a]?bi[a]:a&&xi[a]?xi[a]:e.body;break;case"mopen":case"mclose":s+=e.body;break;case"mpunct":s=xi[a]||a;break;case"mop":"​"!==e.body&&(s="",s+="\\operatorname"===a?e.body:e.body||a,s+=" ");break;case"mathstyle":case"box":case"spacing":case"enclose":break;case"space":s=" "}if(e.subscript){s+="_";const a=t(e.subscript,i);a.length>1&&!/^(-)?\d+(\.\d*)?$/.test(a)?s+="("+a+")":s+=a}if(e.superscript){s+="^";const a=t(e.superscript,i);a.length>1&&!/^(-)?\d+(\.\d*)?$/.test(a)?s+="("+a+")":s+=a}return s}(t,this.config));return i},ws.prototype.text=ws.prototype.$text=function(t){return this.formatMathlist(this.mathlist.root,t)},ws.prototype.selectedText=ws.prototype.$selectedText=function(t){const e=this.mathlist.getSelectedAtoms();if(!e)return"";const i=de.makeRoot("math",e);return this.formatMathlist(i,t)},ws.prototype.selectionIsCollapsed=ws.prototype.$selectionIsCollapsed=function(){return this.mathlist.isCollapsed()},ws.prototype.selectionDepth=ws.prototype.$selectionDepth=function(){return this.mathlist.path.length},ws.prototype._superscriptDepth=function(){let t=0,e=0,i=this.mathlist.ancestor(e),s=!1;for(;i;)(i.superscript||i.subscript)&&(t+=1),i.superscript?s=!0:i.subscript&&(s=!1),e+=1,i=this.mathlist.ancestor(e);return s?t:0},ws.prototype._subscriptDepth=function(){let t=0,e=0,i=this.mathlist.ancestor(e),s=!1;for(;i;)(i.superscript||i.subscript)&&(t+=1),i.superscript?s=!1:i.subscript&&(s=!0),e+=1,i=this.mathlist.ancestor(e);return s?t:0},ws.prototype.selectionAtStart=ws.prototype.$selectionAtStart=function(){return 0===this.mathlist.startOffset()},ws.prototype.selectionAtEnd=ws.prototype.$selectionAtEnd=function(){return this.mathlist.endOffset()>=this.mathlist.siblings().length-1},ws.prototype.groupIsSelected=function(){return 0===this.mathlist.startOffset()&&this.mathlist.endOffset()>=this.mathlist.siblings().length-1},ws.prototype.latex=ws.prototype.$latex=function(t,e){return t?(t!==this.mathlist.root.toLatex()&&(e=e||{},this.mathlist.insert(t,Object.assign({},this.config,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",mode:"math",suppressChangeNotifications:e.suppressChangeNotifications})),this.undoManager.snapshot(this.config),this._requestUpdate()),t):this.mathlist.root.toLatex()},ws.prototype.el=ws.prototype.$el=function(){return this.element},ws.prototype.undo_=ws.prototype.undo=function(){return this.complete_(),this.undoManager.undo(this.config),!0},ws.prototype.redo_=ws.prototype.redo=function(){return this.complete_(),this.undoManager.redo(this.config),!0},ws.prototype.scrollIntoView_=ws.prototype.scrollIntoView=function(){this.dirty&&this._render();let t=this._getCaretPosition();const e=this.field.getBoundingClientRect();if(!t){const i=this._getSelectionBounds();i&&(t={x:i.right+e.left-this.field.scrollLeft,y:i.top+e.top-this.field.scrollTop})}if(t){const i=t.x-window.scrollX;ie.right&&this.field.scroll({top:0,left:i-e.right+this.field.scrollLeft+20,behavior:"smooth"})}},ws.prototype.scrollToStart_=ws.prototype.scrollToStart=function(){this.field.scroll(0,0)},ws.prototype.scrollToEnd_=ws.prototype.scrollToEnd=function(){const t=this.field.getBoundingClientRect();this.field.scroll(t.left-window.scrollX,0)},ws.prototype.enterCommandMode_=function(){this.switchMode_("command")},ws.prototype.copyToClipboard_=function(){return this.focus(),this.mathlist.isCollapsed()&&this.select(),document.execCommand("copy"),!1},ws.prototype.cutToClipboard_=function(){return this.focus(),document.execCommand("cut"),!0},ws.prototype.pasteFromClipboard_=function(){return this.focus(),document.execCommand("paste"),!0},ws.prototype.insert_=ws.prototype.insert=ws.prototype.$insert=function(t,e){if("string"==typeof t&&t.length>0){if((e=e||{}).focus&&this.focus(),e.feedback&&(this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play())),"\\\\"===t)this.mathlist.addRowAfter_();else if("&"===t)this.mathlist.addColumnAfter_();else{const i=this.style;this.mathlist.insert(t,{mode:this.mode,style:this.mathlist.anchorStyle(),...e}),e.resetStyle&&(this.style=i)}return this.undoManager.snapshot(this.config),this._requestUpdate(),!0}return!1},ws.prototype.switchMode_=function(t,e,i){this._resetKeystrokeBuffer(),this.smartModeSuppressed=/text|math/.test(this.mode)&&/text|math/.test(t),e&&this.insert(e,{format:"latex",mode:{math:"text",text:"math"}[t]}),this.mathlist.decorateCommandStringAroundInsertionPoint(!1),"command"===t?(this.mathlist.removeSuggestion(),oi.hidePopover(this),this.suggestionIndex=0,this.virtualKeyboardVisible&&this.switchKeyboardLayer_("lower-command"),this.mathlist.insert("",{mode:"math"})):this.mode=t,i&&this.insert(i,{format:"latex",mode:t}),"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode),this._requestUpdate()},ws.prototype.complete_=function(t){if(t=t||{},oi.hidePopover(this),t.discard)return this.mathlist.spliceCommandStringAroundInsertionPoint(null),this.switchMode_("math"),!0;const e=this.mathlist.extractCommandStringAroundInsertionPoint(!t.acceptSuggestion);if(e){if("\\("===e||"\\)"===e)this.mathlist.spliceCommandStringAroundInsertionPoint([]),this.mathlist.insert(e.slice(1),{mode:this.mode});else{const t="math";if(Pt.commandAllowed(t,e)){const i=be.parseTokens(x.tokenize(e),t,null,this.config.macros);this.mathlist.spliceCommandStringAroundInsertionPoint(i)}else{const i=be.parseTokens(x.tokenize(e),t,null,this.config.macros);i?this.mathlist.spliceCommandStringAroundInsertionPoint(i):this.mathlist.decorateCommandStringAroundInsertionPoint(!0)}}return this.undoManager.snapshot(this.config),this._announce("replacement"),!0}return!1},ws.prototype._updateSuggestion=function(){this.mathlist.positionInsertionPointAfterCommitedCommand(),this.mathlist.removeSuggestion();const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=Pt.suggest(t);if(0===e.length)oi.hidePopover(this),this.mathlist.decorateCommandStringAroundInsertionPoint(!0);else{const i=this.suggestionIndex%e.length,s=t.length-e[i].match.length;0!==s&&this.mathlist.insertSuggestion(e[i].match,s),oi.showPopoverWithLatex(this,e[i].match,e.length>1)}this._requestUpdate()},ws.prototype.nextSuggestion_=function(){return this.suggestionIndex+=1,this._updateSuggestion(),!1},ws.prototype.previousSuggestion_=function(){if(this.suggestionIndex-=1,this.suggestionIndex<0){this.mathlist.removeSuggestion();const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=Pt.suggest(t);this.suggestionIndex=e.length-1}return this._updateSuggestion(),!1},ws.prototype._attachButtonHandlers=function(t,e){const i=this;let s,a,o,n,r;"object"==typeof e&&(e.default||e.pressed)?(e.default&&t.setAttribute("data-"+this.config.namespace+"command",JSON.stringify(e.default)),e.alt&&t.setAttribute("data-"+this.config.namespace+"command-alt",JSON.stringify(e.alt)),e.altshift&&t.setAttribute("data-"+this.config.namespace+"command-altshift",JSON.stringify(e.altshift)),e.shift&&t.setAttribute("data-"+this.config.namespace+"command-shift",JSON.stringify(e.shift)),e.pressed&&t.setAttribute("data-"+this.config.namespace+"command-pressed",JSON.stringify(e.pressed)),e.pressAndHoldStart&&t.setAttribute("data-"+this.config.namespace+"command-pressAndHoldStart",JSON.stringify(e.pressAndHoldStart)),e.pressAndHoldEnd&&t.setAttribute("data-"+this.config.namespace+"command-pressAndHoldEnd",JSON.stringify(e.pressAndHoldEnd))):t.setAttribute("data-"+this.config.namespace+"command",JSON.stringify(e)),bs(t,"mousedown touchstart:passive",function(e){if("mousedown"!==e.type||1===e.buttons){e.stopPropagation(),e.preventDefault(),t.classList.add("pressed"),s=Date.now(),"touchstart"===e.type&&(o=e.changedTouches[0].identifier);const n=t.getAttribute("data-"+i.config.namespace+"command-pressed");n&&i.perform(JSON.parse(n));const l=t.getAttribute("data-"+i.config.namespace+"command-pressAndHoldStart");l&&(a=t,r&&clearTimeout(r),r=window.setTimeout(function(){t.classList.contains("pressed")&&i.perform(JSON.parse(l))},300))}}),bs(t,"mouseleave touchcancel",function(){t.classList.remove("pressed")}),bs(t,"touchmove:passive",function(t){t.preventDefault();for(let e=0;e=7?i.style.width="286px":4===e.length||2===e.length?i.style.width="146px":1===e.length?i.style.width="86px":i.style.width="146px",i.style.height="auto";let s="";for(const t of e)s+="";s="
      "+s+"
    ",i.innerHTML=s,yi.makeKeycap(this,i.getElementsByTagName("li"),"performAlternateKeys");const a=this.virtualKeyboard.querySelector('div.keyboard-layer.is-visible div.rows ul li[data-alt-keys="'+t+'"]').getBoundingClientRect();if(a){a.top-i.clientHeight<0&&(i.style.width="auto",e.length<=6?i.style.height="56px":e.length<=12?i.style.height="108px":i.style.height="205px");const t=(a.top-i.clientHeight+5).toString()+"px",s=Math.max(0,Math.min(window.innerWidth-i.offsetWidth,(a.left+a.right-i.offsetWidth)/2))+"px";i.style.transform="translate("+s+","+t+")",i.classList.add("is-visible")}return!1},ws.prototype.hideAlternateKeys_=function(){const t=document.getElementById("mathlive-alternate-keys-panel");return t&&(t.classList.remove("is-visible"),t.innerHTML="",vs(t)),!1},ws.prototype.performAlternateKeys_=function(t){return this.hideAlternateKeys_(),this.perform(t)},ws.prototype.switchKeyboardLayer_=function(t){if("off"!==this.config.virtualKeyboardMode){"lower-command"!==t&&"upper-command"!==t&&"symbols-command"!==t&&this.complete_(),this.showVirtualKeyboard_(),this.hideAlternateKeys_(),this.unshiftKeyboardLayer_();const e=this.virtualKeyboard.getElementsByClassName("keyboard-layer");let i=!1;for(let s=0;s=1){i=[];for(let t=1;t<=s;t++)i.push(e[t])}break}case"right":{const e=t.mathlist.siblings(),s=t.mathlist.endOffset()+1;if(s<=e.length-1){i=[];for(let t=s;t<=e.length-1;t++)i.push(e[t])}break}case"start":case"end":break;case"group":i=t.mathlist.siblings();break;case"parent":{const e=t.mathlist.parent();e&&"root"!==e.type&&(i=t.mathlist.parent());break}}return i}(this,t);if(null===i)return this.config.handleSpeak(function(t){let e="";switch(t){case"all":break;case"selection":e="no selection";break;case"left":e="at start";break;case"right":e="at end";break;case"group":break;case"parent":e="no parent"}return e}(t)),!1;const s=this.config;e.withHighlighting|"amazon"===s.speechEngine&&(s.textToSpeechMarkup=window.sre&&"sre"===s.textToSpeechRules?"ssml_step":"ssml");const a=de.toSpeakableText(i,s);return e.withHighlighting?(window.mathlive.readAloudMathField=this,this._render({forHighlighting:!0}),this.config.handleReadAloud&&this.config.handleReadAloud(this.field,a,this.config)):this.config.handleSpeak&&this.config.handleSpeak(a,s),!1};var _s={MathField:ws};function Ts(t,e,i){let s=i,a=0;const o=t.length;for(;s0&&a.push({type:"text",data:n.slice(0,c)}),l=!1);let h=!1;for(;!h;){if(l){if(-1===(r=n.indexOf(e,c))){h=!0;break}c!==r&&a.push({type:"text",data:n.slice(c,r)}),c=r}else{if(-1===(r=Ts(i,n,c+e.length))){h=!0;break}a.push({type:"math",data:n.slice(c+e.length,r),rawData:n.slice(c,r+i.length),mathstyle:s}),c=r+i.length}l=!l}c"+e.renderToMathML(t,e)+""}catch(e){i.textContent=t}return i.className="sr-only",i}(t,i)),/\bspeakable-text\b/i.test(i.renderAccessibleContent)&&i.renderToSpeakableText){const s=document.createElement("span");s.innerHTML=i.renderToSpeakableText(t,i),s.className="sr-only",e.appendChild(s)}return e.appendChild(a),e}return a}function Ds(t,e){let i=null;if(e.TeX.processEnvironments&&/^\s*\\begin/.test(t))(i=document.createDocumentFragment()).appendChild(zs(t,void 0,e,!0));else{const s=Fs(t,e.TeX.delimiters);if(1===s.length&&"text"===s[0].type)return null;i=document.createDocumentFragment();for(let t=0;tvoid 0)}})}}else e.speechEngine;else{const e=new SpeechSynthesisUtterance(t);window&&window.speechSynthesis.speak(e)}}function Rs(t,e,i){if(!window)return;if(!i&&window.mathlive&&(i=window.mathlive.config),"amazon"!==(i=i||{}).speechEngine)return void(i.handleSpeak&&i.handleSpeak(e));if(!window.AWS)return;const s=new window.AWS.Polly({apiVersion:"2016-06-10"}),a={OutputFormat:"json",VoiceId:i.speechEngineVoice||"Joanna",Text:e,TextType:"ssml",SpeechMarkTypes:["ssml"]};window.mathlive=window.mathlive||{},window.mathlive.readAloudElement=t;const o=i.onReadAloudStatus||window.mathlive.onReadAloudStatus;s.synthesizeSpeech(a,function(t,e){if(t);else if(e&&e.AudioStream){const t=new TextDecoder("utf-8").decode(new Uint8Array(e.AudioStream));window.mathlive.readAloudMarks=t.split("\n").map(t=>t?JSON.parse(t):{}),window.mathlive.readAloudTokens=[];for(const t of window.mathlive.readAloudMarks)t.value&&window.mathlive.readAloudTokens.push(t.value);window.mathlive.readAloudCurrentMark="",a.OutputFormat="mp3",a.SpeechMarkTypes=[],s.synthesizeSpeech(a,function(t,e){if(t);else if(e&&e.AudioStream){const t=new Uint8Array(e.AudioStream),i=new Blob([t.buffer],{type:"audio/mpeg"}),s=URL.createObjectURL(i);window.mathlive.readAloudAudio?window.mathlive.readAloudAudio.pause():(window.mathlive.readAloudAudio=new Audio,window.mathlive.readAloudAudio.addEventListener("ended",()=>{o&&o(window.mathlive.readAloudMathField,"ended"),window.mathlive.readAloudMathField?(window.mathlive.readAloudMathField._render(),window.mathlive.readAloudElement=null,window.mathlive.readAloudMathField=null,window.mathlive.readAloudTokens=[],window.mathlive.readAloudMarks=[],window.mathlive.readAloudCurrentMark=""):function t(e){e.classList.remove("highlight"),e.children&&Array.from(e.children).forEach(e=>{t(e)})}(window.mathlive.readAloudElement)}),window.mathlive.readAloudAudio.addEventListener("timeupdate",()=>{let t="";const e=1e3*window.mathlive.readAloudAudio.currentTime+100;for(const i of window.mathlive.readAloudMarks)i.time0&&Array.from(e.children).forEach(e=>{t(e,i)})):(e.classList.add("highlight"),e.children&&e.children.length>0&&Array.from(e.children).forEach(e=>{t(e)}))}(window.mathlive.readAloudElement,window.mathlive.readAloudCurrentMark)))})),window.mathlive.readAloudAudio.src=s,o&&o(window.mathlive.readAloudMathField,"playing"),window.mathlive.readAloudAudio.play()}})}})}function Ks(t){let e=t;if("string"==typeof t&&!(e=document.getElementById(t)))throw Error(`The element with ID "${t}" could not be found.`);return e}function Ns(t,e){qs&&((e=e||{}).renderToMarkup=e.renderToMarkup||Ps,e.renderToMathML=e.renderToMathML||Is,e.renderToSpeakableText=e.renderToSpeakableText||Bs,e.macros=e.macros||Pt.MACROS,qs.renderMathInElement(Ks(t),e))}function $s(t){if(t.namespace){if(!/^[a-z]+[-]?$/.test(t.namespace))throw Error("options.namespace must be a string of lowercase characters only");/-$/.test(t.namespace)||(t.namespace+="-")}}return{latexToMarkup:Ps,latexToMathML:Is,latexToSpeakableText:Bs,latexToAST:function(t,e){if(!de.toAST)return{};(e=e||{}).macros=e.macros||{},Object.assign(e.macros,Pt.MACROS);const i=be.parseTokens(x.tokenize(t),"math",null,e.macros);return de.toAST(i,e)},makeMathField:function(t,e){if(!_s)throw Error("The MathField module is not loaded.");return(e=e||{}).handleSpeak=e.handleSpeak||Os,e.handleReadAloud=e.handleReadAloud||Rs,new _s.MathField(Ks(t),e)},renderMathInDocument:function(t){Ns(document.body,t)},renderMathInElement:Ns,revertToOriginalContent:function(t,e){(t=(t=Ks(t)).children[1])instanceof _s.MathField?t.revertToOriginalContent():($s(e=e||{}),t.innerHTML=t.getAttribute("data-"+(e.namespace||"")+"original-content"))},getOriginalContent:function(t,e){return(t=(t=Ks(t)).children[1])instanceof _s.MathField?t.originalContent:($s(e=e||{}),t.getAttribute("data-"+(e.namespace||"")+"original-content"))},readAloud:Rs,readAloudStatus:function(){return window?(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio?window.mathlive.readAloudAudio.paused?"paused":window.mathlive.readAloudAudio.ended?"ready":"playing":"ready"):"unavailable"},pauseReadAloud:function(){window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio&&(window.mathlive.onReadAloudStatus&&window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField,"paused"),window.mathlive.readAloudAudio.pause()))},resumeReadAloud:function(){window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio&&(window.mathlive.onReadAloudStatus&&window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField,"playing"),window.mathlive.readAloudAudio.play()))},playReadAloud:function(t,e){if(window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio)){let i=0;if(window.mathlive.readAloudFinalToken=null,t){window.mathlive.readAloudMarks=window.mathlive.readAloudMarks||[];for(const e of window.mathlive.readAloudMarks)e.value===t&&(i=e.time/1e3);let s=window.mathlive.readAloudTokens.indexOf(t);s>=0&&(s+=e)12 + // to 12 + // + + + spans = _span.default.coalesce(spans); + if (format === 'span') return spans; // + // 5. Wrap the expression with struts + // + + var base = _span.default.makeSpan(spans, 'ML__base'); + + var topStrut = _span.default.makeSpan('', 'ML__strut'); + + topStrut.setStyle('height', base.height, 'em'); + var struts = [topStrut]; + + if (base.depth !== 0) { + var bottomStrut = _span.default.makeSpan('', 'ML__strut--bottom'); + + bottomStrut.setStyle('height', base.height + base.depth, 'em'); + bottomStrut.setStyle('vertical-align', -base.depth, 'em'); + struts.push(bottomStrut); + } + + struts.push(base); + + var wrapper = _span.default.makeSpan(struts, 'ML__mathlive'); // + // 6. Generate markup + // + + + return wrapper.toMarkup(); +} +/** + * Convert a DOM element into an editable math field. + * + * After the DOM element has been created, the value `element.mathfield` will + * return a reference to the mathfield object. This value is also returned + * by `makeMathField` + * + * @param {Element|string} element A DOM element, for example as obtained + * by `document.getElementById()`, or the ID of a DOM element as a string. + * + * @param {Object} [config={}] See {@tutorial CONFIG} for details. + * + * + * @return {MathField} + * + * Given the HTML markup: + * ```html + * $f(x)=sin(x)$ + * ``` + * The following code will turn the span into an editable mathfield. + * ``` + * import MathLive from 'dist/mathlive.mjs'; + * MathLive.makeMathField('equation'); + * ``` + * + * @function module:mathlive#makeMathField + */ + + +function makeMathField(element, config) { + if (!_editorMathfield.default) { + throw Error('The MathField module is not loaded.'); + } + + config = config || {}; + config.handleSpeak = config.handleSpeak || speak; + config.handleReadAloud = config.handleReadAloud || readAloud; + return new _editorMathfield.default.MathField(getElement(element), config); +} +/** + * Convert a LaTeX string to a string of MathML markup. + * + * @param {string} latex A string of valid LaTeX. It does not have to start + * with a mode token such as a `$$` or `\(`. + * @param {object} options + * @param {boolean} [options.generateID=false] - If true, add an `extid` attribute + * to the MathML nodes with a value matching the `atomID`. + * @return {string} + * @function module:mathlive#latexToMathML + */ + + +function toMathML(latex, options) { + if (!_mathAtom.default.toMathML) { + console.warn('The MathML module is not loaded.'); + return ''; + } + + options = options || {}; + options.macros = options.macros || {}; + Object.assign(options.macros, _definitions.default.MACROS); + + var mathlist = _parser.default.parseTokens(_lexer.default.tokenize(latex), 'math', null, options.macros); + + return _mathAtom.default.toMathML(mathlist, options); +} +/** + * Convert a LaTeX string to an Abstract Syntax Tree + * + * **See:** {@tutorial MASTON} + * + * @param {string} latex A string of valid LaTeX. It does not have to start + * with a mode token such as a `$$` or `\(`. + * + * @return {object} The Abstract Syntax Tree as a JavaScript object. + * @function module:mathlive#latexToAST + */ + + +function latexToAST(latex, options) { + if (!_mathAtom.default.toAST) { + console.warn('The AST module is not loaded.'); + return {}; + } + + options = options || {}; + options.macros = options.macros || {}; + Object.assign(options.macros, _definitions.default.MACROS); + + var mathlist = _parser.default.parseTokens(_lexer.default.tokenize(latex), 'math', null, options.macros); + + return _mathAtom.default.toAST(mathlist, options); +} +/** + * Convert a LaTeX string to a textual representation ready to be spoken + * + * @param {string} latex A string of valid LaTeX. It does not have to start + * with a mode token such as a `$$` or `\(`. + * + * @param {Object.} options - + * + * @param {string} [options.textToSpeechRules='mathlive'] Specify which + * set of text to speech rules to use. + * + * A value of `mathlive` indicates that + * the simple rules built into MathLive should be used. A value of `sre` + * indicates that the Speech Rule Engine from Volker Sorge should be used. + * Note that SRE is not included or loaded by MathLive and for this option to + * work SRE should be loaded separately. + * + * @param {string} [options.textToSpeechMarkup=''] The markup syntax to use + * for the output of conversion to spoken text. + * + * Possible values are `ssml` for + * the SSML markup or `mac` for the MacOS markup (e.g. `[[ltr]]`) + * + * @param {Object.} [options.textToSpeechRulesOptions={}] A set of + * key/value pairs that can be used to configure the speech rule engine. + * + * Which options are available depends on the speech rule engine in use. There + * are no options available with MathLive's built-in engine. The options for + * the SRE engine are documented [here]{@link:https://github.com/zorkow/speech-rule-engine} + * @return {string} The spoken representation of the input LaTeX. + * @example + * console.log(MathLive.latexToSpeakableText('\\frac{1}{2}')); + * // ➡︎'half' + * @function module:mathlive#latexToSpeakableText + */ + + +function latexToSpeakableText(latex, options) { + if (!_mathAtom.default.toSpeakableText) { + console.warn('The outputSpokenText module is not loaded.'); + return ""; + } + + options = options || {}; + options.macros = options.macros || {}; + Object.assign(options.macros, _definitions.default.MACROS); + + var mathlist = _parser.default.parseTokens(_lexer.default.tokenize(latex), 'math', null, options.macros); + + return _mathAtom.default.toSpeakableText(mathlist, options); +} + +function removeHighlight(node) { + node.classList.remove('highlight'); + + if (node.children) { + Array.from(node.children).forEach(function (x) { + removeHighlight(x); + }); + } +} +/** + * Highlight the span corresponding to the specified atomID + * This is used for TTS with synchronized highlighting (read aloud) + * + * @param {string} atomID + * + */ + + +function highlightAtomID(node, atomID) { + if (!atomID || node.dataset.atomId === atomID) { + node.classList.add('highlight'); + + if (node.children && node.children.length > 0) { + Array.from(node.children).forEach(function (x) { + highlightAtomID(x); + }); + } + } else { + node.classList.remove('highlight'); + + if (node.children && node.children.length > 0) { + Array.from(node.children).forEach(function (x) { + highlightAtomID(x, atomID); + }); + } + } +} + +function speak(text, config) { + if (!config && window && window.mathlive) { + config = window.mathlive.config; + } + + config = config || {}; + + if (!config.speechEngine || config.speechEngine === 'local') { + // On ChromeOS: chrome.accessibilityFeatures.spokenFeedback + // See also https://developer.chrome.com/apps/tts + var utterance = new SpeechSynthesisUtterance(text); + + if (window) { + window.speechSynthesis.speak(utterance); + } else { + console.log('Speak: ', text); + } + } else if (config.speechEngine === 'amazon') { + if (!window || !window.AWS) { + console.warn('AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk'); + } else { + var polly = new window.AWS.Polly({ + apiVersion: '2016-06-10' + }); + var params = { + OutputFormat: 'mp3', + VoiceId: config.speechEngineVoice || 'Joanna', + // SampleRate: '16000', + Text: text, + TextType: 'ssml' // SpeechMarkTypes: ['ssml]' + + }; + polly.synthesizeSpeech(params, function (err, data) { + if (err) { + console.warn('polly.synthesizeSpeech() error:', err, err.stack); + } else { + if (data && data.AudioStream) { + var uInt8Array = new Uint8Array(data.AudioStream); + var blob = new Blob([uInt8Array.buffer], { + type: 'audio/mpeg' + }); + var url = URL.createObjectURL(blob); + var audioElement = new Audio(url); + audioElement.play().catch(function (err) { + return console.log(err); + }); + } else { + console.log('polly.synthesizeSpeech():' + data); + } + } + }); // Can call AWS.Request() on the result of synthesizeSpeech() + } + } else if (config.speechEngine === 'google') { + console.warn('The Google speech engine is not supported yet. Please come again.'); // @todo: implement support for Google Text-to-Speech API, + // using config.speechEngineToken, config.speechEngineVoice and + // config.speechEngineAudioConfig + // curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \ + // -H "Content-Type: application/json; charset=utf-8" \ + // --data "{ + // 'input':{ + // 'text':'Android is a mobile operating system developed by Google, + // based on the Linux kernel and designed primarily for + // touchscreen mobile devices such as smartphones and tablets.' + // }, + // 'voice':{ + // 'languageCode':'en-gb', + // 'name':'en-GB-Standard-A', + // 'ssmlGender':'FEMALE' + // }, + // 'audioConfig':{ + // 'audioEncoding':'MP3' + // } + // }" "https://texttospeech.googleapis.com/v1beta1/text:synthesize" > synthesize-text.txt + } +} +/** + * "Read Aloud" is an asynchronous operation that reads the + * reading with synchronized highlighting + * + * @param {DOMElement} element - The DOM element to highlight + * @param {string} text - The text to speak + * @param {object} config + * @private + * @function module:mathlive#readAloud + */ + + +function readAloud(element, text, config) { + if (!window) { + return; + } + + if (!config && window.mathlive) { + config = window.mathlive.config; + } + + config = config || {}; + + if (config.speechEngine !== 'amazon') { + console.warn('Use Amazon TTS Engine for synchronized highlighting'); + if (config.handleSpeak) config.handleSpeak(text); + return; + } + + if (!window.AWS) { + console.warn('AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk'); + return; + } + + var polly = new window.AWS.Polly({ + apiVersion: '2016-06-10' + }); + var params = { + OutputFormat: 'json', + VoiceId: config.speechEngineVoice || 'Joanna', + Text: text, + TextType: 'ssml', + SpeechMarkTypes: ['ssml'] + }; + window.mathlive = window.mathlive || {}; + window.mathlive.readAloudElement = element; + var status = config.onReadAloudStatus || window.mathlive.onReadAloudStatus; // Request the mark points + + polly.synthesizeSpeech(params, function (err, data) { + if (err) { + console.warn('polly.synthesizeSpeech() error:', err, err.stack); + } else { + if (data && data.AudioStream) { + var response = new TextDecoder('utf-8').decode(new Uint8Array(data.AudioStream)); + window.mathlive.readAloudMarks = response.split('\n').map(function (x) { + return x ? JSON.parse(x) : {}; + }); + window.mathlive.readAloudTokens = []; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = window.mathlive.readAloudMarks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var mark = _step.value; + + if (mark.value) { + window.mathlive.readAloudTokens.push(mark.value); + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + window.mathlive.readAloudCurrentMark = ''; // Request the audio + + params.OutputFormat = 'mp3'; + params.SpeechMarkTypes = []; + polly.synthesizeSpeech(params, function (err, data) { + if (err) { + console.warn('polly.synthesizeSpeech(', text, ') error:', err, err.stack); + } else { + if (data && data.AudioStream) { + var uInt8Array = new Uint8Array(data.AudioStream); + var blob = new Blob([uInt8Array.buffer], { + type: 'audio/mpeg' + }); + var url = URL.createObjectURL(blob); + + if (!window.mathlive.readAloudAudio) { + window.mathlive.readAloudAudio = new Audio(); + window.mathlive.readAloudAudio.addEventListener('ended', function () { + if (status) status(window.mathlive.readAloudMathField, 'ended'); + + if (window.mathlive.readAloudMathField) { + window.mathlive.readAloudMathField._render(); + + window.mathlive.readAloudElement = null; + window.mathlive.readAloudMathField = null; + window.mathlive.readAloudTokens = []; + window.mathlive.readAloudMarks = []; + window.mathlive.readAloudCurrentMark = ''; + } else { + removeHighlight(window.mathlive.readAloudElement); + } + }); + window.mathlive.readAloudAudio.addEventListener('timeupdate', function () { + var value = ''; // The target, the atom we're looking for, is the one matching the current audio + // plus 100 ms. By anticipating it a little bit, it feels more natural, otherwise it + // feels like the highlighting is trailing the audio. + + var target = window.mathlive.readAloudAudio.currentTime * 1000 + 100; // Find the smallest element which is bigger than the target time + + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = window.mathlive.readAloudMarks[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var mark = _step2.value; + + if (mark.time < target) { + value = mark.value; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return != null) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + + if (window.mathlive.readAloudCurrentMark !== value) { + window.mathlive.readAloudCurrentToken = value; + + if (value && value === window.mathlive.readAloudFinalToken) { + window.mathlive.readAloudAudio.pause(); + } else { + window.mathlive.readAloudCurrentMark = value; + highlightAtomID(window.mathlive.readAloudElement, window.mathlive.readAloudCurrentMark); + } + } + }); + } else { + window.mathlive.readAloudAudio.pause(); + } + + window.mathlive.readAloudAudio.src = url; + + if (status) { + status(window.mathlive.readAloudMathField, 'playing'); + } + + window.mathlive.readAloudAudio.play(); + } else {// console.log('polly.synthesizeSpeech():' + data); + } + } + }); + } else { + console.log('polly.synthesizeSpeech():' + data); + } + } + }); +} +/** + * Return the status of a Read Aloud operation (reading with synchronized + * highlighting). + * + * Possible values include: + * - `ready` + * - `playing` + * - `paused` + * - `unavailable` + * + * **See** {@linkcode module:editor-mathfield#speakAllWithSynchronizedHighlighting speakAllWithSynchronizedHighlighting} + * @return {string} + * @function module:mathlive#readAloudStatus + */ + + +function readAloudStatus() { + if (!window) return 'unavailable'; + window.mathlive = window.mathlive || {}; + if (!window.mathlive.readAloudAudio) return 'ready'; + if (window.mathlive.readAloudAudio.paused) return 'paused'; + if (!window.mathlive.readAloudAudio.ended) return 'playing'; + return 'ready'; +} +/** + * If a Read Aloud operation is in progress, stop it. + * + * **See** {@linkcode module:editor/mathfield#speakAllWithSynchronizedHighlighting speakAllWithSynchronizedHighlighting} + * @function module:mathlive#pauseReadAloud + */ + + +function pauseReadAloud() { + if (!window) return; + window.mathlive = window.mathlive || {}; + + if (window.mathlive.readAloudAudio) { + if (window.mathlive.onReadAloudStatus) { + window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField, 'paused'); + } + + window.mathlive.readAloudAudio.pause(); + } +} +/** + * If a Read Aloud operation is paused, resume it + * + * **See** {@linkcode module:editor-mathfield#speakAllWithSynchronizedHighlighting speakAllWithSynchronizedHighlighting} + * @function module:mathlive#resumeReadAloud + */ + + +function resumeReadAloud() { + if (!window) return; + window.mathlive = window.mathlive || {}; + + if (window.mathlive.readAloudAudio) { + if (window.mathlive.onReadAloudStatus) { + window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField, 'playing'); + } + + window.mathlive.readAloudAudio.play(); + } +} +/** + * If a Read Aloud operation is in progress, read from a specified token + * + * **See** {@linkcode module:editor-mathfield#speakAllWithSynchronizedHighlighting speakAllWithSynchronizedHighlighting} + * + * @param {string} token + * @param {number} [count] + * @function module:mathlive#playReadAloud + */ + + +function playReadAloud(token, count) { + if (!window) return; + window.mathlive = window.mathlive || {}; + + if (window.mathlive.readAloudAudio) { + var timeIndex = 0; + window.mathlive.readAloudFinalToken = null; + + if (token) { + window.mathlive.readAloudMarks = window.mathlive.readAloudMarks || []; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + + try { + for (var _iterator3 = window.mathlive.readAloudMarks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var mark = _step3.value; + + if (mark.value === token) { + timeIndex = mark.time / 1000; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return != null) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + + var tokenIndex = window.mathlive.readAloudTokens.indexOf(token); + + if (tokenIndex >= 0) { + tokenIndex += count; + + if (tokenIndex < window.mathlive.readAloudTokens.length) { + window.mathlive.readAloudFinalToken = tokenIndex; + } + } + } + + window.mathlive.readAloudAudio.currentTime = timeIndex; + + if (window.mathlive.onReadAloudStatus) { + window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField, 'playing'); + } + + window.mathlive.readAloudAudio.play(); + } +} +/** + * Transform all the elements in the document body that contain LaTeX code + * into typeset math. + * + * **Note:** This is a very expensive call, as it needs to parse the entire + * DOM tree to determine which elements need to be processed. In most cases + * this should only be called once per document, once the DOM has been loaded. + * To render a specific element, use {@linkcode module:mathlive#renderMathInElement renderMathInElement()} + * + * **See:** {@tutorial USAGE_GUIDE} + * + * @param {object} [options={}] See {@linkcode module:mathlive#renderMathInElement renderMathInElement()} + * for details + * @example + * import MathLive from 'dist/mathlive.mjs'; + * document.addEventListener("load", () => { + * MathLive.renderMathInDocument(); + * }); + * + */ + + +function renderMathInDocument(options) { + renderMathInElement(document.body, options); +} + +function getElement(element) { + var result = element; + + if (typeof element === 'string') { + result = document.getElementById(element); + + if (!result) { + throw Error("The element with ID \"".concat(element, "\" could not be found.")); + } + } + + return result; +} +/** + * Transform all the children of `element`, recursively, that contain LaTeX code + * into typeset math. + * + * **See:** {@tutorial USAGE_GUIDE} + * + * @param {Element|string} element An HTML DOM element, or a string containing + * the ID of an element. + * @param {object} [options={}] + * + * @param {string} [options.namespace=''] - Namespace that is added to `data-` + * attributes to avoid collisions with other libraries. + * + * It is empty by default. + * + * The namespace should be a string of lowercase letters. + * + * @param {object[]} [options.macros={}] - Custom LaTeX macros + * + * @param {string[]} [options.skipTags=['noscript', 'style', 'textarea', 'pre', 'code', 'annotation', 'annotation-xml'] ] + * an array of tag names whose content will + * not be scanned for delimiters (unless their class matches the `processClass` + * pattern below. + * + * @param {string} [options.ignoreClass='tex2jax_ignore'] a string used as a + * regular expression of class names of elements whose content will not be + * scanned for delimiters + + * @param {string} [options.processClass='tex2jax_process'] a string used as a + * regular expression of class names of elements whose content **will** be + * scanned for delimiters, even if their tag name or parent class name would + * have prevented them from doing so. + * + * @param {string} [options.processScriptType="math/tex"] `