simple-html-tokenizer.js 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4. (factory((global.HTML5Tokenizer = {})));
  5. }(this, (function (exports) { 'use strict';
  6. /**
  7. * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json
  8. * do not edit
  9. */
  10. var namedCharRefs = {
  11. Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "​", NegativeThickSpace: "​", NegativeThinSpace: "​", NegativeVeryThinSpace: "​", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: "  ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "​", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c"
  12. };
  13. var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
  14. var CHARCODE = /^#([0-9]+)$/;
  15. var NAMED = /^([A-Za-z0-9]+)$/;
  16. var EntityParser = /** @class */ (function () {
  17. function EntityParser(named) {
  18. this.named = named;
  19. }
  20. EntityParser.prototype.parse = function (entity) {
  21. if (!entity) {
  22. return;
  23. }
  24. var matches = entity.match(HEXCHARCODE);
  25. if (matches) {
  26. return String.fromCharCode(parseInt(matches[1], 16));
  27. }
  28. matches = entity.match(CHARCODE);
  29. if (matches) {
  30. return String.fromCharCode(parseInt(matches[1], 10));
  31. }
  32. matches = entity.match(NAMED);
  33. if (matches) {
  34. return this.named[matches[1]];
  35. }
  36. };
  37. return EntityParser;
  38. }());
  39. var WSP = /[\t\n\f ]/;
  40. var ALPHA = /[A-Za-z]/;
  41. var CRLF = /\r\n?/g;
  42. function isSpace(char) {
  43. return WSP.test(char);
  44. }
  45. function isAlpha(char) {
  46. return ALPHA.test(char);
  47. }
  48. function preprocessInput(input) {
  49. return input.replace(CRLF, '\n');
  50. }
  51. var EventedTokenizer = /** @class */ (function () {
  52. function EventedTokenizer(delegate, entityParser, mode) {
  53. if (mode === void 0) { mode = 'precompile'; }
  54. this.delegate = delegate;
  55. this.entityParser = entityParser;
  56. this.mode = mode;
  57. this.state = "beforeData" /* beforeData */;
  58. this.line = -1;
  59. this.column = -1;
  60. this.input = '';
  61. this.index = -1;
  62. this.tagNameBuffer = '';
  63. this.states = {
  64. beforeData: function () {
  65. var char = this.peek();
  66. if (char === '<' && !this.isIgnoredEndTag()) {
  67. this.transitionTo("tagOpen" /* tagOpen */);
  68. this.markTagStart();
  69. this.consume();
  70. }
  71. else {
  72. if (this.mode === 'precompile' && char === '\n') {
  73. var tag = this.tagNameBuffer.toLowerCase();
  74. if (tag === 'pre' || tag === 'textarea') {
  75. this.consume();
  76. }
  77. }
  78. this.transitionTo("data" /* data */);
  79. this.delegate.beginData();
  80. }
  81. },
  82. data: function () {
  83. var char = this.peek();
  84. var tag = this.tagNameBuffer;
  85. if (char === '<' && !this.isIgnoredEndTag()) {
  86. this.delegate.finishData();
  87. this.transitionTo("tagOpen" /* tagOpen */);
  88. this.markTagStart();
  89. this.consume();
  90. }
  91. else if (char === '&' && tag !== 'script' && tag !== 'style') {
  92. this.consume();
  93. this.delegate.appendToData(this.consumeCharRef() || '&');
  94. }
  95. else {
  96. this.consume();
  97. this.delegate.appendToData(char);
  98. }
  99. },
  100. tagOpen: function () {
  101. var char = this.consume();
  102. if (char === '!') {
  103. this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */);
  104. }
  105. else if (char === '/') {
  106. this.transitionTo("endTagOpen" /* endTagOpen */);
  107. }
  108. else if (char === '@' || char === ':' || isAlpha(char)) {
  109. this.transitionTo("tagName" /* tagName */);
  110. this.tagNameBuffer = '';
  111. this.delegate.beginStartTag();
  112. this.appendToTagName(char);
  113. }
  114. },
  115. markupDeclarationOpen: function () {
  116. var char = this.consume();
  117. if (char === '-' && this.peek() === '-') {
  118. this.consume();
  119. this.transitionTo("commentStart" /* commentStart */);
  120. this.delegate.beginComment();
  121. }
  122. else {
  123. var maybeDoctype = char.toUpperCase() + this.input.substring(this.index, this.index + 6).toUpperCase();
  124. if (maybeDoctype === 'DOCTYPE') {
  125. this.consume();
  126. this.consume();
  127. this.consume();
  128. this.consume();
  129. this.consume();
  130. this.consume();
  131. this.transitionTo("doctype" /* doctype */);
  132. if (this.delegate.beginDoctype)
  133. this.delegate.beginDoctype();
  134. }
  135. }
  136. },
  137. doctype: function () {
  138. var char = this.consume();
  139. if (isSpace(char)) {
  140. this.transitionTo("beforeDoctypeName" /* beforeDoctypeName */);
  141. }
  142. },
  143. beforeDoctypeName: function () {
  144. var char = this.consume();
  145. if (isSpace(char)) {
  146. return;
  147. }
  148. else {
  149. this.transitionTo("doctypeName" /* doctypeName */);
  150. if (this.delegate.appendToDoctypeName)
  151. this.delegate.appendToDoctypeName(char.toLowerCase());
  152. }
  153. },
  154. doctypeName: function () {
  155. var char = this.consume();
  156. if (isSpace(char)) {
  157. this.transitionTo("afterDoctypeName" /* afterDoctypeName */);
  158. }
  159. else if (char === '>') {
  160. if (this.delegate.endDoctype)
  161. this.delegate.endDoctype();
  162. this.transitionTo("beforeData" /* beforeData */);
  163. }
  164. else {
  165. if (this.delegate.appendToDoctypeName)
  166. this.delegate.appendToDoctypeName(char.toLowerCase());
  167. }
  168. },
  169. afterDoctypeName: function () {
  170. var char = this.consume();
  171. if (isSpace(char)) {
  172. return;
  173. }
  174. else if (char === '>') {
  175. if (this.delegate.endDoctype)
  176. this.delegate.endDoctype();
  177. this.transitionTo("beforeData" /* beforeData */);
  178. }
  179. else {
  180. var nextSixChars = char.toUpperCase() + this.input.substring(this.index, this.index + 5).toUpperCase();
  181. var isPublic = nextSixChars.toUpperCase() === 'PUBLIC';
  182. var isSystem = nextSixChars.toUpperCase() === 'SYSTEM';
  183. if (isPublic || isSystem) {
  184. this.consume();
  185. this.consume();
  186. this.consume();
  187. this.consume();
  188. this.consume();
  189. this.consume();
  190. }
  191. if (isPublic) {
  192. this.transitionTo("afterDoctypePublicKeyword" /* afterDoctypePublicKeyword */);
  193. }
  194. else if (isSystem) {
  195. this.transitionTo("afterDoctypeSystemKeyword" /* afterDoctypeSystemKeyword */);
  196. }
  197. }
  198. },
  199. afterDoctypePublicKeyword: function () {
  200. var char = this.peek();
  201. if (isSpace(char)) {
  202. this.transitionTo("beforeDoctypePublicIdentifier" /* beforeDoctypePublicIdentifier */);
  203. this.consume();
  204. }
  205. else if (char === '"') {
  206. this.transitionTo("doctypePublicIdentifierDoubleQuoted" /* doctypePublicIdentifierDoubleQuoted */);
  207. this.consume();
  208. }
  209. else if (char === "'") {
  210. this.transitionTo("doctypePublicIdentifierSingleQuoted" /* doctypePublicIdentifierSingleQuoted */);
  211. this.consume();
  212. }
  213. else if (char === '>') {
  214. this.consume();
  215. if (this.delegate.endDoctype)
  216. this.delegate.endDoctype();
  217. this.transitionTo("beforeData" /* beforeData */);
  218. }
  219. },
  220. doctypePublicIdentifierDoubleQuoted: function () {
  221. var char = this.consume();
  222. if (char === '"') {
  223. this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */);
  224. }
  225. else if (char === '>') {
  226. if (this.delegate.endDoctype)
  227. this.delegate.endDoctype();
  228. this.transitionTo("beforeData" /* beforeData */);
  229. }
  230. else {
  231. if (this.delegate.appendToDoctypePublicIdentifier)
  232. this.delegate.appendToDoctypePublicIdentifier(char);
  233. }
  234. },
  235. doctypePublicIdentifierSingleQuoted: function () {
  236. var char = this.consume();
  237. if (char === "'") {
  238. this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */);
  239. }
  240. else if (char === '>') {
  241. if (this.delegate.endDoctype)
  242. this.delegate.endDoctype();
  243. this.transitionTo("beforeData" /* beforeData */);
  244. }
  245. else {
  246. if (this.delegate.appendToDoctypePublicIdentifier)
  247. this.delegate.appendToDoctypePublicIdentifier(char);
  248. }
  249. },
  250. afterDoctypePublicIdentifier: function () {
  251. var char = this.consume();
  252. if (isSpace(char)) {
  253. this.transitionTo("betweenDoctypePublicAndSystemIdentifiers" /* betweenDoctypePublicAndSystemIdentifiers */);
  254. }
  255. else if (char === '>') {
  256. if (this.delegate.endDoctype)
  257. this.delegate.endDoctype();
  258. this.transitionTo("beforeData" /* beforeData */);
  259. }
  260. else if (char === '"') {
  261. this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */);
  262. }
  263. else if (char === "'") {
  264. this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */);
  265. }
  266. },
  267. betweenDoctypePublicAndSystemIdentifiers: function () {
  268. var char = this.consume();
  269. if (isSpace(char)) {
  270. return;
  271. }
  272. else if (char === '>') {
  273. if (this.delegate.endDoctype)
  274. this.delegate.endDoctype();
  275. this.transitionTo("beforeData" /* beforeData */);
  276. }
  277. else if (char === '"') {
  278. this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */);
  279. }
  280. else if (char === "'") {
  281. this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */);
  282. }
  283. },
  284. doctypeSystemIdentifierDoubleQuoted: function () {
  285. var char = this.consume();
  286. if (char === '"') {
  287. this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */);
  288. }
  289. else if (char === '>') {
  290. if (this.delegate.endDoctype)
  291. this.delegate.endDoctype();
  292. this.transitionTo("beforeData" /* beforeData */);
  293. }
  294. else {
  295. if (this.delegate.appendToDoctypeSystemIdentifier)
  296. this.delegate.appendToDoctypeSystemIdentifier(char);
  297. }
  298. },
  299. doctypeSystemIdentifierSingleQuoted: function () {
  300. var char = this.consume();
  301. if (char === "'") {
  302. this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */);
  303. }
  304. else if (char === '>') {
  305. if (this.delegate.endDoctype)
  306. this.delegate.endDoctype();
  307. this.transitionTo("beforeData" /* beforeData */);
  308. }
  309. else {
  310. if (this.delegate.appendToDoctypeSystemIdentifier)
  311. this.delegate.appendToDoctypeSystemIdentifier(char);
  312. }
  313. },
  314. afterDoctypeSystemIdentifier: function () {
  315. var char = this.consume();
  316. if (isSpace(char)) {
  317. return;
  318. }
  319. else if (char === '>') {
  320. if (this.delegate.endDoctype)
  321. this.delegate.endDoctype();
  322. this.transitionTo("beforeData" /* beforeData */);
  323. }
  324. },
  325. commentStart: function () {
  326. var char = this.consume();
  327. if (char === '-') {
  328. this.transitionTo("commentStartDash" /* commentStartDash */);
  329. }
  330. else if (char === '>') {
  331. this.delegate.finishComment();
  332. this.transitionTo("beforeData" /* beforeData */);
  333. }
  334. else {
  335. this.delegate.appendToCommentData(char);
  336. this.transitionTo("comment" /* comment */);
  337. }
  338. },
  339. commentStartDash: function () {
  340. var char = this.consume();
  341. if (char === '-') {
  342. this.transitionTo("commentEnd" /* commentEnd */);
  343. }
  344. else if (char === '>') {
  345. this.delegate.finishComment();
  346. this.transitionTo("beforeData" /* beforeData */);
  347. }
  348. else {
  349. this.delegate.appendToCommentData('-');
  350. this.transitionTo("comment" /* comment */);
  351. }
  352. },
  353. comment: function () {
  354. var char = this.consume();
  355. if (char === '-') {
  356. this.transitionTo("commentEndDash" /* commentEndDash */);
  357. }
  358. else {
  359. this.delegate.appendToCommentData(char);
  360. }
  361. },
  362. commentEndDash: function () {
  363. var char = this.consume();
  364. if (char === '-') {
  365. this.transitionTo("commentEnd" /* commentEnd */);
  366. }
  367. else {
  368. this.delegate.appendToCommentData('-' + char);
  369. this.transitionTo("comment" /* comment */);
  370. }
  371. },
  372. commentEnd: function () {
  373. var char = this.consume();
  374. if (char === '>') {
  375. this.delegate.finishComment();
  376. this.transitionTo("beforeData" /* beforeData */);
  377. }
  378. else {
  379. this.delegate.appendToCommentData('--' + char);
  380. this.transitionTo("comment" /* comment */);
  381. }
  382. },
  383. tagName: function () {
  384. var char = this.consume();
  385. if (isSpace(char)) {
  386. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  387. }
  388. else if (char === '/') {
  389. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  390. }
  391. else if (char === '>') {
  392. this.delegate.finishTag();
  393. this.transitionTo("beforeData" /* beforeData */);
  394. }
  395. else {
  396. this.appendToTagName(char);
  397. }
  398. },
  399. endTagName: function () {
  400. var char = this.consume();
  401. if (isSpace(char)) {
  402. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  403. this.tagNameBuffer = '';
  404. }
  405. else if (char === '/') {
  406. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  407. this.tagNameBuffer = '';
  408. }
  409. else if (char === '>') {
  410. this.delegate.finishTag();
  411. this.transitionTo("beforeData" /* beforeData */);
  412. this.tagNameBuffer = '';
  413. }
  414. else {
  415. this.appendToTagName(char);
  416. }
  417. },
  418. beforeAttributeName: function () {
  419. var char = this.peek();
  420. if (isSpace(char)) {
  421. this.consume();
  422. return;
  423. }
  424. else if (char === '/') {
  425. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  426. this.consume();
  427. }
  428. else if (char === '>') {
  429. this.consume();
  430. this.delegate.finishTag();
  431. this.transitionTo("beforeData" /* beforeData */);
  432. }
  433. else if (char === '=') {
  434. this.delegate.reportSyntaxError('attribute name cannot start with equals sign');
  435. this.transitionTo("attributeName" /* attributeName */);
  436. this.delegate.beginAttribute();
  437. this.consume();
  438. this.delegate.appendToAttributeName(char);
  439. }
  440. else {
  441. this.transitionTo("attributeName" /* attributeName */);
  442. this.delegate.beginAttribute();
  443. }
  444. },
  445. attributeName: function () {
  446. var char = this.peek();
  447. if (isSpace(char)) {
  448. this.transitionTo("afterAttributeName" /* afterAttributeName */);
  449. this.consume();
  450. }
  451. else if (char === '/') {
  452. this.delegate.beginAttributeValue(false);
  453. this.delegate.finishAttributeValue();
  454. this.consume();
  455. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  456. }
  457. else if (char === '=') {
  458. this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
  459. this.consume();
  460. }
  461. else if (char === '>') {
  462. this.delegate.beginAttributeValue(false);
  463. this.delegate.finishAttributeValue();
  464. this.consume();
  465. this.delegate.finishTag();
  466. this.transitionTo("beforeData" /* beforeData */);
  467. }
  468. else if (char === '"' || char === "'" || char === '<') {
  469. this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names');
  470. this.consume();
  471. this.delegate.appendToAttributeName(char);
  472. }
  473. else {
  474. this.consume();
  475. this.delegate.appendToAttributeName(char);
  476. }
  477. },
  478. afterAttributeName: function () {
  479. var char = this.peek();
  480. if (isSpace(char)) {
  481. this.consume();
  482. return;
  483. }
  484. else if (char === '/') {
  485. this.delegate.beginAttributeValue(false);
  486. this.delegate.finishAttributeValue();
  487. this.consume();
  488. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  489. }
  490. else if (char === '=') {
  491. this.consume();
  492. this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
  493. }
  494. else if (char === '>') {
  495. this.delegate.beginAttributeValue(false);
  496. this.delegate.finishAttributeValue();
  497. this.consume();
  498. this.delegate.finishTag();
  499. this.transitionTo("beforeData" /* beforeData */);
  500. }
  501. else {
  502. this.delegate.beginAttributeValue(false);
  503. this.delegate.finishAttributeValue();
  504. this.transitionTo("attributeName" /* attributeName */);
  505. this.delegate.beginAttribute();
  506. this.consume();
  507. this.delegate.appendToAttributeName(char);
  508. }
  509. },
  510. beforeAttributeValue: function () {
  511. var char = this.peek();
  512. if (isSpace(char)) {
  513. this.consume();
  514. }
  515. else if (char === '"') {
  516. this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */);
  517. this.delegate.beginAttributeValue(true);
  518. this.consume();
  519. }
  520. else if (char === "'") {
  521. this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */);
  522. this.delegate.beginAttributeValue(true);
  523. this.consume();
  524. }
  525. else if (char === '>') {
  526. this.delegate.beginAttributeValue(false);
  527. this.delegate.finishAttributeValue();
  528. this.consume();
  529. this.delegate.finishTag();
  530. this.transitionTo("beforeData" /* beforeData */);
  531. }
  532. else {
  533. this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
  534. this.delegate.beginAttributeValue(false);
  535. this.consume();
  536. this.delegate.appendToAttributeValue(char);
  537. }
  538. },
  539. attributeValueDoubleQuoted: function () {
  540. var char = this.consume();
  541. if (char === '"') {
  542. this.delegate.finishAttributeValue();
  543. this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
  544. }
  545. else if (char === '&') {
  546. this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
  547. }
  548. else {
  549. this.delegate.appendToAttributeValue(char);
  550. }
  551. },
  552. attributeValueSingleQuoted: function () {
  553. var char = this.consume();
  554. if (char === "'") {
  555. this.delegate.finishAttributeValue();
  556. this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
  557. }
  558. else if (char === '&') {
  559. this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
  560. }
  561. else {
  562. this.delegate.appendToAttributeValue(char);
  563. }
  564. },
  565. attributeValueUnquoted: function () {
  566. var char = this.peek();
  567. if (isSpace(char)) {
  568. this.delegate.finishAttributeValue();
  569. this.consume();
  570. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  571. }
  572. else if (char === '/') {
  573. this.delegate.finishAttributeValue();
  574. this.consume();
  575. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  576. }
  577. else if (char === '&') {
  578. this.consume();
  579. this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
  580. }
  581. else if (char === '>') {
  582. this.delegate.finishAttributeValue();
  583. this.consume();
  584. this.delegate.finishTag();
  585. this.transitionTo("beforeData" /* beforeData */);
  586. }
  587. else {
  588. this.consume();
  589. this.delegate.appendToAttributeValue(char);
  590. }
  591. },
  592. afterAttributeValueQuoted: function () {
  593. var char = this.peek();
  594. if (isSpace(char)) {
  595. this.consume();
  596. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  597. }
  598. else if (char === '/') {
  599. this.consume();
  600. this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
  601. }
  602. else if (char === '>') {
  603. this.consume();
  604. this.delegate.finishTag();
  605. this.transitionTo("beforeData" /* beforeData */);
  606. }
  607. else {
  608. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  609. }
  610. },
  611. selfClosingStartTag: function () {
  612. var char = this.peek();
  613. if (char === '>') {
  614. this.consume();
  615. this.delegate.markTagAsSelfClosing();
  616. this.delegate.finishTag();
  617. this.transitionTo("beforeData" /* beforeData */);
  618. }
  619. else {
  620. this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
  621. }
  622. },
  623. endTagOpen: function () {
  624. var char = this.consume();
  625. if (char === '@' || char === ':' || isAlpha(char)) {
  626. this.transitionTo("endTagName" /* endTagName */);
  627. this.tagNameBuffer = '';
  628. this.delegate.beginEndTag();
  629. this.appendToTagName(char);
  630. }
  631. }
  632. };
  633. this.reset();
  634. }
  635. EventedTokenizer.prototype.reset = function () {
  636. this.transitionTo("beforeData" /* beforeData */);
  637. this.input = '';
  638. this.tagNameBuffer = '';
  639. this.index = 0;
  640. this.line = 1;
  641. this.column = 0;
  642. this.delegate.reset();
  643. };
  644. EventedTokenizer.prototype.transitionTo = function (state) {
  645. this.state = state;
  646. };
  647. EventedTokenizer.prototype.tokenize = function (input) {
  648. this.reset();
  649. this.tokenizePart(input);
  650. this.tokenizeEOF();
  651. };
  652. EventedTokenizer.prototype.tokenizePart = function (input) {
  653. this.input += preprocessInput(input);
  654. while (this.index < this.input.length) {
  655. var handler = this.states[this.state];
  656. if (handler !== undefined) {
  657. handler.call(this);
  658. }
  659. else {
  660. throw new Error("unhandled state " + this.state);
  661. }
  662. }
  663. };
  664. EventedTokenizer.prototype.tokenizeEOF = function () {
  665. this.flushData();
  666. };
  667. EventedTokenizer.prototype.flushData = function () {
  668. if (this.state === 'data') {
  669. this.delegate.finishData();
  670. this.transitionTo("beforeData" /* beforeData */);
  671. }
  672. };
  673. EventedTokenizer.prototype.peek = function () {
  674. return this.input.charAt(this.index);
  675. };
  676. EventedTokenizer.prototype.consume = function () {
  677. var char = this.peek();
  678. this.index++;
  679. if (char === '\n') {
  680. this.line++;
  681. this.column = 0;
  682. }
  683. else {
  684. this.column++;
  685. }
  686. return char;
  687. };
  688. EventedTokenizer.prototype.consumeCharRef = function () {
  689. var endIndex = this.input.indexOf(';', this.index);
  690. if (endIndex === -1) {
  691. return;
  692. }
  693. var entity = this.input.slice(this.index, endIndex);
  694. var chars = this.entityParser.parse(entity);
  695. if (chars) {
  696. var count = entity.length;
  697. // consume the entity chars
  698. while (count) {
  699. this.consume();
  700. count--;
  701. }
  702. // consume the `;`
  703. this.consume();
  704. return chars;
  705. }
  706. };
  707. EventedTokenizer.prototype.markTagStart = function () {
  708. this.delegate.tagOpen();
  709. };
  710. EventedTokenizer.prototype.appendToTagName = function (char) {
  711. this.tagNameBuffer += char;
  712. this.delegate.appendToTagName(char);
  713. };
  714. EventedTokenizer.prototype.isIgnoredEndTag = function () {
  715. var tag = this.tagNameBuffer;
  716. return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
  717. (tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
  718. (tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>');
  719. };
  720. return EventedTokenizer;
  721. }());
  722. var Tokenizer = /** @class */ (function () {
  723. function Tokenizer(entityParser, options) {
  724. if (options === void 0) { options = {}; }
  725. this.options = options;
  726. this.token = null;
  727. this.startLine = 1;
  728. this.startColumn = 0;
  729. this.tokens = [];
  730. this.tokenizer = new EventedTokenizer(this, entityParser, options.mode);
  731. this._currentAttribute = undefined;
  732. }
  733. Tokenizer.prototype.tokenize = function (input) {
  734. this.tokens = [];
  735. this.tokenizer.tokenize(input);
  736. return this.tokens;
  737. };
  738. Tokenizer.prototype.tokenizePart = function (input) {
  739. this.tokens = [];
  740. this.tokenizer.tokenizePart(input);
  741. return this.tokens;
  742. };
  743. Tokenizer.prototype.tokenizeEOF = function () {
  744. this.tokens = [];
  745. this.tokenizer.tokenizeEOF();
  746. return this.tokens[0];
  747. };
  748. Tokenizer.prototype.reset = function () {
  749. this.token = null;
  750. this.startLine = 1;
  751. this.startColumn = 0;
  752. };
  753. Tokenizer.prototype.current = function () {
  754. var token = this.token;
  755. if (token === null) {
  756. throw new Error('token was unexpectedly null');
  757. }
  758. if (arguments.length === 0) {
  759. return token;
  760. }
  761. for (var i = 0; i < arguments.length; i++) {
  762. if (token.type === arguments[i]) {
  763. return token;
  764. }
  765. }
  766. throw new Error("token type was unexpectedly " + token.type);
  767. };
  768. Tokenizer.prototype.push = function (token) {
  769. this.token = token;
  770. this.tokens.push(token);
  771. };
  772. Tokenizer.prototype.currentAttribute = function () {
  773. return this._currentAttribute;
  774. };
  775. Tokenizer.prototype.addLocInfo = function () {
  776. if (this.options.loc) {
  777. this.current().loc = {
  778. start: {
  779. line: this.startLine,
  780. column: this.startColumn
  781. },
  782. end: {
  783. line: this.tokenizer.line,
  784. column: this.tokenizer.column
  785. }
  786. };
  787. }
  788. this.startLine = this.tokenizer.line;
  789. this.startColumn = this.tokenizer.column;
  790. };
  791. // Data
  792. Tokenizer.prototype.beginDoctype = function () {
  793. this.push({
  794. type: "Doctype" /* Doctype */,
  795. name: '',
  796. });
  797. };
  798. Tokenizer.prototype.appendToDoctypeName = function (char) {
  799. this.current("Doctype" /* Doctype */).name += char;
  800. };
  801. Tokenizer.prototype.appendToDoctypePublicIdentifier = function (char) {
  802. var doctype = this.current("Doctype" /* Doctype */);
  803. if (doctype.publicIdentifier === undefined) {
  804. doctype.publicIdentifier = char;
  805. }
  806. else {
  807. doctype.publicIdentifier += char;
  808. }
  809. };
  810. Tokenizer.prototype.appendToDoctypeSystemIdentifier = function (char) {
  811. var doctype = this.current("Doctype" /* Doctype */);
  812. if (doctype.systemIdentifier === undefined) {
  813. doctype.systemIdentifier = char;
  814. }
  815. else {
  816. doctype.systemIdentifier += char;
  817. }
  818. };
  819. Tokenizer.prototype.endDoctype = function () {
  820. this.addLocInfo();
  821. };
  822. Tokenizer.prototype.beginData = function () {
  823. this.push({
  824. type: "Chars" /* Chars */,
  825. chars: ''
  826. });
  827. };
  828. Tokenizer.prototype.appendToData = function (char) {
  829. this.current("Chars" /* Chars */).chars += char;
  830. };
  831. Tokenizer.prototype.finishData = function () {
  832. this.addLocInfo();
  833. };
  834. // Comment
  835. Tokenizer.prototype.beginComment = function () {
  836. this.push({
  837. type: "Comment" /* Comment */,
  838. chars: ''
  839. });
  840. };
  841. Tokenizer.prototype.appendToCommentData = function (char) {
  842. this.current("Comment" /* Comment */).chars += char;
  843. };
  844. Tokenizer.prototype.finishComment = function () {
  845. this.addLocInfo();
  846. };
  847. // Tags - basic
  848. Tokenizer.prototype.tagOpen = function () { };
  849. Tokenizer.prototype.beginStartTag = function () {
  850. this.push({
  851. type: "StartTag" /* StartTag */,
  852. tagName: '',
  853. attributes: [],
  854. selfClosing: false
  855. });
  856. };
  857. Tokenizer.prototype.beginEndTag = function () {
  858. this.push({
  859. type: "EndTag" /* EndTag */,
  860. tagName: ''
  861. });
  862. };
  863. Tokenizer.prototype.finishTag = function () {
  864. this.addLocInfo();
  865. };
  866. Tokenizer.prototype.markTagAsSelfClosing = function () {
  867. this.current("StartTag" /* StartTag */).selfClosing = true;
  868. };
  869. // Tags - name
  870. Tokenizer.prototype.appendToTagName = function (char) {
  871. this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char;
  872. };
  873. // Tags - attributes
  874. Tokenizer.prototype.beginAttribute = function () {
  875. this._currentAttribute = ['', '', false];
  876. };
  877. Tokenizer.prototype.appendToAttributeName = function (char) {
  878. this.currentAttribute()[0] += char;
  879. };
  880. Tokenizer.prototype.beginAttributeValue = function (isQuoted) {
  881. this.currentAttribute()[2] = isQuoted;
  882. };
  883. Tokenizer.prototype.appendToAttributeValue = function (char) {
  884. this.currentAttribute()[1] += char;
  885. };
  886. Tokenizer.prototype.finishAttributeValue = function () {
  887. this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
  888. };
  889. Tokenizer.prototype.reportSyntaxError = function (message) {
  890. this.current().syntaxError = message;
  891. };
  892. return Tokenizer;
  893. }());
  894. function tokenize(input, options) {
  895. var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options);
  896. return tokenizer.tokenize(input);
  897. }
  898. exports.HTML5NamedCharRefs = namedCharRefs;
  899. exports.EntityParser = EntityParser;
  900. exports.EventedTokenizer = EventedTokenizer;
  901. exports.Tokenizer = Tokenizer;
  902. exports.tokenize = tokenize;
  903. Object.defineProperty(exports, '__esModule', { value: true });
  904. })));
  905. //# sourceMappingURL=simple-html-tokenizer.js.map