import { c as katex } from "./katex-C_XRmjAP.js";
katex.__defineMacro("\\ce", function(e) {
  return chemParse(e.consumeArgs(1)[0], "ce");
}), katex.__defineMacro("\\pu", function(e) {
  return chemParse(e.consumeArgs(1)[0], "pu");
}), katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
var chemParse = function(e, t) {
  for (var i = "", a = e.length && e[e.length - 1].loc.start, o = e.length - 1; o >= 0; o--) e[o].loc.start > a && (i += " ", a = e[o].loc.start), i += e[o].text, a += e[o].text.length;
  return texify.go(mhchemParser.go(i, t));
}, mhchemParser = {
  go: function(e, t) {
    if (!e) return [];
    t === void 0 && (t = "ce");
    var r = "0", i = {};
    i.parenthesisLevel = 0, e = e.replace(/\n/g, " "), e = e.replace(/[\u2212\u2013\u2014\u2010]/g, "-"), e = e.replace(/[\u2026]/g, "...");
    for (var a, o = 10, s = []; ; ) {
      a === e ? o-- : (o = 10, a = e);
      var c = mhchemParser.stateMachines[t], l = c.transitions[r] || c.transitions["*"];
      iterateTransitions: for (var u = 0; u < l.length; u++) {
        var d = mhchemParser.patterns.match_(l[u].pattern, e);
        if (d) {
          for (var f = l[u].task, p = 0; p < f.action_.length; p++) {
            var m;
            if (c.actions[f.action_[p].type_]) m = c.actions[f.action_[p].type_](i, d.match_, f.action_[p].option);
            else if (mhchemParser.actions[f.action_[p].type_]) m = mhchemParser.actions[f.action_[p].type_](i, d.match_, f.action_[p].option);
            else throw ["MhchemBugA", "mhchem bug A. Please report. (" + f.action_[p].type_ + ")"];
            mhchemParser.concatArray(s, m);
          }
          if (r = f.nextState || r, e.length > 0) {
            if (f.revisit || (e = d.remainder), !f.toContinue) break iterateTransitions;
          } else return s;
        }
      }
      if (o <= 0) throw ["MhchemBugU", "mhchem bug U. Please report."];
    }
  },
  concatArray: function(e, t) {
    if (t) if (Array.isArray(t)) for (var n = 0; n < t.length; n++) e.push(t[n]);
    else e.push(t);
  },
  patterns: {
    patterns: {
      empty: /^$/,
      else: /^./,
      else2: /^./,
      space: /^\s/,
      "space A": /^\s(?=[A-Z\\$])/,
      space$: /^\s$/,
      "a-z": /^[a-z]/,
      x: /^x/,
      x$: /^x$/,
      i$: /^i$/,
      letters: /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,
      "\\greek": /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,
      "one lowercase latin letter $": /^(?:([a-z])(?:$|[^a-zA-Z]))$/,
      "$one lowercase latin letter$ $": /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,
      "one lowercase greek letter $": /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,
      digits: /^[0-9]+/,
      "-9.,9": /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
      "-9.,9 no missing 0": /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
      "(-)(9.,9)(e)(99)": function(e) {
        var t = e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
        return t && t[0] ? {
          match_: t.splice(1),
          remainder: e.substr(t[0].length)
        } : null;
      },
      "(-)(9)^(-9)": function(e) {
        var t = e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
        return t && t[0] ? {
          match_: t.splice(1),
          remainder: e.substr(t[0].length)
        } : null;
      },
      "state of aggregation $": function(e) {
        var t = mhchemParser.patterns.findObserveGroups(e, "", /^\([a-z]{1,3}(?=[\),])/, ")", "");
        if (t && t.remainder.match(/^($|[\s,;\)\]\}])/)) return t;
        var r = e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);
        return r ? {
          match_: r[0],
          remainder: e.substr(r[0].length)
        } : null;
      },
      "_{(state of aggregation)}$": /^_\{(\([a-z]{1,3}\))\}/,
      "{[(": /^(?:\\\{|\[|\()/,
      ")]}": /^(?:\)|\]|\\\})/,
      ", ": /^[,;]\s*/,
      ",": /^[,;]/,
      ".": /^[.]/,
      ". ": /^([.\u22C5\u00B7\u2022])\s*/,
      "...": /^\.\.\.(?=$|[^.])/,
      "* ": /^([*])\s*/,
      "^{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "^{", "", "", "}");
      },
      "^($...$)": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "^", "$", "$", "");
      },
      "^a": /^\^([0-9]+|[^\\_])/,
      "^\\x{}{}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
      },
      "^\\x{}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "^", /^\\[a-zA-Z]+\{/, "}", "");
      },
      "^\\x": /^\^(\\[a-zA-Z]+)\s*/,
      "^(-1)": /^\^(-?\d+)/,
      "'": /^'/,
      "_{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "_{", "", "", "}");
      },
      "_($...$)": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "_", "$", "$", "");
      },
      _9: /^_([+\-]?[0-9]+|[^\\])/,
      "_\\x{}{}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
      },
      "_\\x{}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "_", /^\\[a-zA-Z]+\{/, "}", "");
      },
      "_\\x": /^_(\\[a-zA-Z]+)\s*/,
      "^_": /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
      "{}": /^\{\}/,
      "{...}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "", "{", "}", "");
      },
      "{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "{", "", "", "}");
      },
      "$...$": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "", "$", "$", "");
      },
      "${(...)}$": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "${", "", "", "}$");
      },
      "$(...)$": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "$", "", "", "$");
      },
      "=<>": /^[=<>]/,
      "#": /^[#\u2261]/,
      "+": /^\+/,
      "-$": /^-(?=[\s_},;\]/]|$|\([a-z]+\))/,
      "-9": /^-(?=[0-9])/,
      "- orbital overlap": /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,
      "-": /^-/,
      "pm-operator": /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
      operator: /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
      arrowUpDown: /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
      "\\bond{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\bond{", "", "", "}");
      },
      "->": /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
      CMT: /^[CMT](?=\[)/,
      "[(...)]": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "[", "", "", "]");
      },
      "1st-level escape": /^(&|\\\\|\\hline)\s*/,
      "\\,": /^(?:\\[,\ ;:])/,
      "\\x{}{}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
      },
      "\\x{}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "", /^\\[a-zA-Z]+\{/, "}", "");
      },
      "\\ca": /^\\ca(?:\s+|(?![a-zA-Z]))/,
      "\\x": /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,
      orbital: /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
      others: /^[\/~|]/,
      "\\frac{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\frac{", "", "", "}", "{", "", "", "}");
      },
      "\\overset{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\overset{", "", "", "}", "{", "", "", "}");
      },
      "\\underset{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\underset{", "", "", "}", "{", "", "", "}");
      },
      "\\underbrace{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\underbrace{", "", "", "}_", "{", "", "", "}");
      },
      "\\color{(...)}0": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\color{", "", "", "}");
      },
      "\\color{(...)}{(...)}1": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\color{", "", "", "}", "{", "", "", "}");
      },
      "\\color(...){(...)}2": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
      },
      "\\ce{(...)}": function(e) {
        return mhchemParser.patterns.findObserveGroups(e, "\\ce{", "", "", "}");
      },
      oxidation$: /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
      "d-oxidation$": /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
      "roman numeral": /^[IVX]+/,
      "1/2$": /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
      amount: function(e) {
        var t = e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);
        if (t) return {
          match_: t[0],
          remainder: e.substr(t[0].length)
        };
        var r = mhchemParser.patterns.findObserveGroups(e, "", "$", "$", "");
        return r && (t = r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/), t) ? {
          match_: t[0],
          remainder: e.substr(t[0].length)
        } : null;
      },
      amount2: function(e) {
        return this.amount(e);
      },
      "(KV letters),": /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
      formula$: function(e) {
        if (e.match(/^\([a-z]+\)$/)) return null;
        var t = e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
        return t ? {
          match_: t[0],
          remainder: e.substr(t[0].length)
        } : null;
      },
      uprightEntities: /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
      "/": /^\s*(\/)\s*/,
      "//": /^\s*(\/\/)\s*/,
      "*": /^\s*[*.]\s*/
    },
    findObserveGroups: function(e, t, n, r, i, a, o, s, c, l) {
      var u = function(e2, t2) {
        if (typeof t2 == "string") return e2.indexOf(t2) === 0 ? t2 : null;
        var n2 = e2.match(t2);
        return n2 ? n2[0] : null;
      }, d = function(e2, t2, n2) {
        for (var r2 = 0; t2 < e2.length; ) {
          var i2 = e2.charAt(t2), a2 = u(e2.substr(t2), n2);
          if (a2 !== null && r2 === 0) return {
            endMatchBegin: t2,
            endMatchEnd: t2 + a2.length
          };
          if (i2 === "{") r2++;
          else if (i2 === "}") {
            if (r2 === 0) throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
            r2--;
          }
          t2++;
        }
        return null;
      }, f = u(e, t);
      if (f === null || (e = e.substr(f.length), f = u(e, n), f === null)) return null;
      var p = d(e, f.length, r || i);
      if (p === null) return null;
      var m = e.substring(0, r ? p.endMatchEnd : p.endMatchBegin);
      if (a || o) {
        var h = this.findObserveGroups(e.substr(p.endMatchEnd), a, o, s, c);
        if (h === null) return null;
        var g = [m, h.match_];
        return {
          match_: l ? g.join("") : g,
          remainder: h.remainder
        };
      } else return {
        match_: m,
        remainder: e.substr(p.endMatchEnd)
      };
    },
    match_: function(e, t) {
      var r = mhchemParser.patterns.patterns[e];
      if (r === void 0) throw ["MhchemBugP", "mhchem bug P. Please report. (" + e + ")"];
      if (typeof r == "function") return mhchemParser.patterns.patterns[e](t);
      var i = t.match(r);
      return i ? {
        match_: i[2] ? [i[1], i[2]] : i[1] ? i[1] : i[0],
        remainder: t.substr(i[0].length)
      } : null;
    }
  },
  actions: {
    "a=": function(e, t) {
      e.a = (e.a || "") + t;
    },
    "b=": function(e, t) {
      e.b = (e.b || "") + t;
    },
    "p=": function(e, t) {
      e.p = (e.p || "") + t;
    },
    "o=": function(e, t) {
      e.o = (e.o || "") + t;
    },
    "q=": function(e, t) {
      e.q = (e.q || "") + t;
    },
    "d=": function(e, t) {
      e.d = (e.d || "") + t;
    },
    "rm=": function(e, t) {
      e.rm = (e.rm || "") + t;
    },
    "text=": function(e, t) {
      e.text_ = (e.text_ || "") + t;
    },
    insert: function(e, t, n) {
      return { type_: n };
    },
    "insert+p1": function(e, t, n) {
      return {
        type_: n,
        p1: t
      };
    },
    "insert+p1+p2": function(e, t, n) {
      return {
        type_: n,
        p1: t[0],
        p2: t[1]
      };
    },
    copy: function(e, t) {
      return t;
    },
    rm: function(e, t) {
      return {
        type_: "rm",
        p1: t || ""
      };
    },
    text: function(e, t) {
      return mhchemParser.go(t, "text");
    },
    "{text}": function(e, t) {
      var r = ["{"];
      return mhchemParser.concatArray(r, mhchemParser.go(t, "text")), r.push("}"), r;
    },
    "tex-math": function(e, t) {
      return mhchemParser.go(t, "tex-math");
    },
    "tex-math tight": function(e, t) {
      return mhchemParser.go(t, "tex-math tight");
    },
    bond: function(e, t, n) {
      return {
        type_: "bond",
        kind_: n || t
      };
    },
    "color0-output": function(e, t) {
      return {
        type_: "color0",
        color: t[0]
      };
    },
    ce: function(e, t) {
      return mhchemParser.go(t);
    },
    "1/2": function(e, t) {
      var n = [];
      t.match(/^[+\-]/) && (n.push(t.substr(0, 1)), t = t.substr(1));
      var r = t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
      return r[1] = r[1].replace(/\$/g, ""), n.push({
        type_: "frac",
        p1: r[1],
        p2: r[2]
      }), r[3] && (r[3] = r[3].replace(/\$/g, ""), n.push({
        type_: "tex-math",
        p1: r[3]
      })), n;
    },
    "9,9": function(e, t) {
      return mhchemParser.go(t, "9,9");
    }
  },
  createTransitions: function(e) {
    var t, n, r, i, a = {};
    for (t in e) for (n in e[t]) for (r = n.split("|"), e[t][n].stateArray = r, i = 0; i < r.length; i++) a[r[i]] = [];
    for (t in e) for (n in e[t]) for (r = e[t][n].stateArray || [], i = 0; i < r.length; i++) {
      var o = e[t][n];
      if (o.action_) {
        o.action_ = [].concat(o.action_);
        for (var s = 0; s < o.action_.length; s++) typeof o.action_[s] == "string" && (o.action_[s] = { type_: o.action_[s] });
      } else o.action_ = [];
      for (var c = t.split("|"), l = 0; l < c.length; l++) if (r[i] === "*") for (var u in a) a[u].push({
        pattern: c[l],
        task: o
      });
      else a[r[i]].push({
        pattern: c[l],
        task: o
      });
    }
    return a;
  },
  stateMachines: {}
};
mhchemParser.stateMachines = {
  ce: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": { action_: "output" } },
      else: { "0|1|2": {
        action_: "beginsWithBond=false",
        revisit: true,
        toContinue: true
      } },
      oxidation$: { 0: { action_: "oxidation-output" } },
      CMT: {
        r: {
          action_: "rdt=",
          nextState: "rt"
        },
        rd: {
          action_: "rqt=",
          nextState: "rdt"
        }
      },
      arrowUpDown: { "0|1|2|as": {
        action_: [
          "sb=false",
          "output",
          "operator"
        ],
        nextState: "1"
      } },
      uprightEntities: { "0|1|2": {
        action_: ["o=", "output"],
        nextState: "1"
      } },
      orbital: { "0|1|2|3": {
        action_: "o=",
        nextState: "o"
      } },
      "->": {
        "0|1|2|3": {
          action_: "r=",
          nextState: "r"
        },
        "a|as": {
          action_: ["output", "r="],
          nextState: "r"
        },
        "*": {
          action_: ["output", "r="],
          nextState: "r"
        }
      },
      "+": {
        o: {
          action_: "d= kv",
          nextState: "d"
        },
        "d|D": {
          action_: "d=",
          nextState: "d"
        },
        q: {
          action_: "d=",
          nextState: "qd"
        },
        "qd|qD": {
          action_: "d=",
          nextState: "qd"
        },
        dq: {
          action_: ["output", "d="],
          nextState: "d"
        },
        3: {
          action_: [
            "sb=false",
            "output",
            "operator"
          ],
          nextState: "0"
        }
      },
      amount: { "0|2": {
        action_: "a=",
        nextState: "a"
      } },
      "pm-operator": { "0|1|2|a|as": {
        action_: [
          "sb=false",
          "output",
          {
            type_: "operator",
            option: "\\pm"
          }
        ],
        nextState: "0"
      } },
      operator: { "0|1|2|a|as": {
        action_: [
          "sb=false",
          "output",
          "operator"
        ],
        nextState: "0"
      } },
      "-$": {
        "o|q": {
          action_: ["charge or bond", "output"],
          nextState: "qd"
        },
        d: {
          action_: "d=",
          nextState: "d"
        },
        D: {
          action_: ["output", {
            type_: "bond",
            option: "-"
          }],
          nextState: "3"
        },
        q: {
          action_: "d=",
          nextState: "qd"
        },
        qd: {
          action_: "d=",
          nextState: "qd"
        },
        "qD|dq": {
          action_: ["output", {
            type_: "bond",
            option: "-"
          }],
          nextState: "3"
        }
      },
      "-9": { "3|o": {
        action_: ["output", {
          type_: "insert",
          option: "hyphen"
        }],
        nextState: "3"
      } },
      "- orbital overlap": {
        o: {
          action_: ["output", {
            type_: "insert",
            option: "hyphen"
          }],
          nextState: "2"
        },
        d: {
          action_: ["output", {
            type_: "insert",
            option: "hyphen"
          }],
          nextState: "2"
        }
      },
      "-": {
        "0|1|2": {
          action_: [
            {
              type_: "output",
              option: 1
            },
            "beginsWithBond=true",
            {
              type_: "bond",
              option: "-"
            }
          ],
          nextState: "3"
        },
        3: { action_: {
          type_: "bond",
          option: "-"
        } },
        a: {
          action_: ["output", {
            type_: "insert",
            option: "hyphen"
          }],
          nextState: "2"
        },
        as: {
          action_: [{
            type_: "output",
            option: 2
          }, {
            type_: "bond",
            option: "-"
          }],
          nextState: "3"
        },
        b: { action_: "b=" },
        o: {
          action_: {
            type_: "- after o/d",
            option: false
          },
          nextState: "2"
        },
        q: {
          action_: {
            type_: "- after o/d",
            option: false
          },
          nextState: "2"
        },
        "d|qd|dq": {
          action_: {
            type_: "- after o/d",
            option: true
          },
          nextState: "2"
        },
        "D|qD|p": {
          action_: ["output", {
            type_: "bond",
            option: "-"
          }],
          nextState: "3"
        }
      },
      amount2: { "1|3": {
        action_: "a=",
        nextState: "a"
      } },
      letters: {
        "0|1|2|3|a|as|b|p|bp|o": {
          action_: "o=",
          nextState: "o"
        },
        "q|dq": {
          action_: ["output", "o="],
          nextState: "o"
        },
        "d|D|qd|qD": {
          action_: "o after d",
          nextState: "o"
        }
      },
      digits: {
        o: {
          action_: "q=",
          nextState: "q"
        },
        "d|D": {
          action_: "q=",
          nextState: "dq"
        },
        q: {
          action_: ["output", "o="],
          nextState: "o"
        },
        a: {
          action_: "o=",
          nextState: "o"
        }
      },
      "space A": { "b|p|bp": {} },
      space: {
        a: { nextState: "as" },
        0: { action_: "sb=false" },
        "1|2": { action_: "sb=true" },
        "r|rt|rd|rdt|rdq": {
          action_: "output",
          nextState: "0"
        },
        "*": {
          action_: ["output", "sb=true"],
          nextState: "1"
        }
      },
      "1st-level escape": {
        "1|2": { action_: ["output", {
          type_: "insert+p1",
          option: "1st-level escape"
        }] },
        "*": {
          action_: ["output", {
            type_: "insert+p1",
            option: "1st-level escape"
          }],
          nextState: "0"
        }
      },
      "[(...)]": {
        "r|rt": {
          action_: "rd=",
          nextState: "rd"
        },
        "rd|rdt": {
          action_: "rq=",
          nextState: "rdq"
        }
      },
      "...": {
        "o|d|D|dq|qd|qD": {
          action_: ["output", {
            type_: "bond",
            option: "..."
          }],
          nextState: "3"
        },
        "*": {
          action_: [{
            type_: "output",
            option: 1
          }, {
            type_: "insert",
            option: "ellipsis"
          }],
          nextState: "1"
        }
      },
      ". |* ": { "*": {
        action_: ["output", {
          type_: "insert",
          option: "addition compound"
        }],
        nextState: "1"
      } },
      "state of aggregation $": { "*": {
        action_: ["output", "state of aggregation"],
        nextState: "1"
      } },
      "{[(": {
        "a|as|o": {
          action_: [
            "o=",
            "output",
            "parenthesisLevel++"
          ],
          nextState: "2"
        },
        "0|1|2|3": {
          action_: [
            "o=",
            "output",
            "parenthesisLevel++"
          ],
          nextState: "2"
        },
        "*": {
          action_: [
            "output",
            "o=",
            "output",
            "parenthesisLevel++"
          ],
          nextState: "2"
        }
      },
      ")]}": {
        "0|1|2|3|b|p|bp|o": {
          action_: ["o=", "parenthesisLevel--"],
          nextState: "o"
        },
        "a|as|d|D|q|qd|qD|dq": {
          action_: [
            "output",
            "o=",
            "parenthesisLevel--"
          ],
          nextState: "o"
        }
      },
      ", ": { "*": {
        action_: ["output", "comma"],
        nextState: "0"
      } },
      "^_": { "*": {} },
      "^{(...)}|^($...$)": {
        "0|1|2|as": {
          action_: "b=",
          nextState: "b"
        },
        p: {
          action_: "b=",
          nextState: "bp"
        },
        "3|o": {
          action_: "d= kv",
          nextState: "D"
        },
        q: {
          action_: "d=",
          nextState: "qD"
        },
        "d|D|qd|qD|dq": {
          action_: ["output", "d="],
          nextState: "D"
        }
      },
      "^a|^\\x{}{}|^\\x{}|^\\x|'": {
        "0|1|2|as": {
          action_: "b=",
          nextState: "b"
        },
        p: {
          action_: "b=",
          nextState: "bp"
        },
        "3|o": {
          action_: "d= kv",
          nextState: "d"
        },
        q: {
          action_: "d=",
          nextState: "qd"
        },
        "d|qd|D|qD": { action_: "d=" },
        dq: {
          action_: ["output", "d="],
          nextState: "d"
        }
      },
      "_{(state of aggregation)}$": { "d|D|q|qd|qD|dq": {
        action_: ["output", "q="],
        nextState: "q"
      } },
      "_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x": {
        "0|1|2|as": {
          action_: "p=",
          nextState: "p"
        },
        b: {
          action_: "p=",
          nextState: "bp"
        },
        "3|o": {
          action_: "q=",
          nextState: "q"
        },
        "d|D": {
          action_: "q=",
          nextState: "dq"
        },
        "q|qd|qD|dq": {
          action_: ["output", "q="],
          nextState: "q"
        }
      },
      "=<>": { "0|1|2|3|a|as|o|q|d|D|qd|qD|dq": {
        action_: [{
          type_: "output",
          option: 2
        }, "bond"],
        nextState: "3"
      } },
      "#": { "0|1|2|3|a|as|o": {
        action_: [{
          type_: "output",
          option: 2
        }, {
          type_: "bond",
          option: "#"
        }],
        nextState: "3"
      } },
      "{}": { "*": {
        action_: {
          type_: "output",
          option: 1
        },
        nextState: "1"
      } },
      "{...}": {
        "0|1|2|3|a|as|b|p|bp": {
          action_: "o=",
          nextState: "o"
        },
        "o|d|D|q|qd|qD|dq": {
          action_: ["output", "o="],
          nextState: "o"
        }
      },
      "$...$": {
        a: { action_: "a=" },
        "0|1|2|3|as|b|p|bp|o": {
          action_: "o=",
          nextState: "o"
        },
        "as|o": { action_: "o=" },
        "q|d|D|qd|qD|dq": {
          action_: ["output", "o="],
          nextState: "o"
        }
      },
      "\\bond{(...)}": { "*": {
        action_: [{
          type_: "output",
          option: 2
        }, "bond"],
        nextState: "3"
      } },
      "\\frac{(...)}": { "*": {
        action_: [{
          type_: "output",
          option: 1
        }, "frac-output"],
        nextState: "3"
      } },
      "\\overset{(...)}": { "*": {
        action_: [{
          type_: "output",
          option: 2
        }, "overset-output"],
        nextState: "3"
      } },
      "\\underset{(...)}": { "*": {
        action_: [{
          type_: "output",
          option: 2
        }, "underset-output"],
        nextState: "3"
      } },
      "\\underbrace{(...)}": { "*": {
        action_: [{
          type_: "output",
          option: 2
        }, "underbrace-output"],
        nextState: "3"
      } },
      "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": {
        action_: [{
          type_: "output",
          option: 2
        }, "color-output"],
        nextState: "3"
      } },
      "\\color{(...)}0": { "*": { action_: [{
        type_: "output",
        option: 2
      }, "color0-output"] } },
      "\\ce{(...)}": { "*": {
        action_: [{
          type_: "output",
          option: 2
        }, "ce"],
        nextState: "3"
      } },
      "\\,": { "*": {
        action_: [{
          type_: "output",
          option: 1
        }, "copy"],
        nextState: "1"
      } },
      "\\x{}{}|\\x{}|\\x": {
        "0|1|2|3|a|as|b|p|bp|o|c0": {
          action_: ["o=", "output"],
          nextState: "3"
        },
        "*": {
          action_: [
            "output",
            "o=",
            "output"
          ],
          nextState: "3"
        }
      },
      others: { "*": {
        action_: [{
          type_: "output",
          option: 1
        }, "copy"],
        nextState: "3"
      } },
      else2: {
        a: {
          action_: "a to o",
          nextState: "o",
          revisit: true
        },
        as: {
          action_: ["output", "sb=true"],
          nextState: "1",
          revisit: true
        },
        "r|rt|rd|rdt|rdq": {
          action_: ["output"],
          nextState: "0",
          revisit: true
        },
        "*": {
          action_: ["output", "copy"],
          nextState: "3"
        }
      }
    }),
    actions: {
      "o after d": function(e, t) {
        var r;
        if ((e.d || "").match(/^[0-9]+$/)) {
          var i = e.d;
          e.d = void 0, r = this.output(e), e.b = i;
        } else r = this.output(e);
        return mhchemParser.actions["o="](e, t), r;
      },
      "d= kv": function(e, t) {
        e.d = t, e.dType = "kv";
      },
      "charge or bond": function(e, t) {
        if (e.beginsWithBond) {
          var r = [];
          return mhchemParser.concatArray(r, this.output(e)), mhchemParser.concatArray(r, mhchemParser.actions.bond(e, t, "-")), r;
        } else e.d = t;
      },
      "- after o/d": function(e, t, r) {
        var i = mhchemParser.patterns.match_("orbital", e.o || ""), a = mhchemParser.patterns.match_("one lowercase greek letter $", e.o || ""), o = mhchemParser.patterns.match_("one lowercase latin letter $", e.o || ""), s = mhchemParser.patterns.match_("$one lowercase latin letter$ $", e.o || ""), c = t === "-" && (i && i.remainder === "" || a || o || s);
        c && !e.a && !e.b && !e.p && !e.d && !e.q && !i && o && (e.o = "$" + e.o + "$");
        var l = [];
        return c ? (mhchemParser.concatArray(l, this.output(e)), l.push({ type_: "hyphen" })) : (i = mhchemParser.patterns.match_("digits", e.d || ""), r && i && i.remainder === "" ? (mhchemParser.concatArray(l, mhchemParser.actions["d="](e, t)), mhchemParser.concatArray(l, this.output(e))) : (mhchemParser.concatArray(l, this.output(e)), mhchemParser.concatArray(l, mhchemParser.actions.bond(e, t, "-")))), l;
      },
      "a to o": function(e) {
        e.o = e.a, e.a = void 0;
      },
      "sb=true": function(e) {
        e.sb = true;
      },
      "sb=false": function(e) {
        e.sb = false;
      },
      "beginsWithBond=true": function(e) {
        e.beginsWithBond = true;
      },
      "beginsWithBond=false": function(e) {
        e.beginsWithBond = false;
      },
      "parenthesisLevel++": function(e) {
        e.parenthesisLevel++;
      },
      "parenthesisLevel--": function(e) {
        e.parenthesisLevel--;
      },
      "state of aggregation": function(e, t) {
        return {
          type_: "state of aggregation",
          p1: mhchemParser.go(t, "o")
        };
      },
      comma: function(e, t) {
        var n = t.replace(/\s*$/, "");
        return n !== t && e.parenthesisLevel === 0 ? {
          type_: "comma enumeration L",
          p1: n
        } : {
          type_: "comma enumeration M",
          p1: n
        };
      },
      output: function(e, t, r) {
        var i;
        if (!e.r) i = [], !e.a && !e.b && !e.p && !e.o && !e.q && !e.d && !r || (e.sb && i.push({ type_: "entitySkip" }), !e.o && !e.q && !e.d && !e.b && !e.p && r !== 2 ? (e.o = e.a, e.a = void 0) : !e.o && !e.q && !e.d && (e.b || e.p) ? (e.o = e.a, e.d = e.b, e.q = e.p, e.a = e.b = e.p = void 0) : e.o && e.dType === "kv" && mhchemParser.patterns.match_("d-oxidation$", e.d || "") ? e.dType = "oxidation" : e.o && e.dType === "kv" && !e.q && (e.dType = void 0), i.push({
          type_: "chemfive",
          a: mhchemParser.go(e.a, "a"),
          b: mhchemParser.go(e.b, "bd"),
          p: mhchemParser.go(e.p, "pq"),
          o: mhchemParser.go(e.o, "o"),
          q: mhchemParser.go(e.q, "pq"),
          d: mhchemParser.go(e.d, e.dType === "oxidation" ? "oxidation" : "bd"),
          dType: e.dType
        }));
        else {
          var a = e.rdt === "M" ? mhchemParser.go(e.rd, "tex-math") : e.rdt === "T" ? [{
            type_: "text",
            p1: e.rd || ""
          }] : mhchemParser.go(e.rd), o = e.rqt === "M" ? mhchemParser.go(e.rq, "tex-math") : e.rqt === "T" ? [{
            type_: "text",
            p1: e.rq || ""
          }] : mhchemParser.go(e.rq);
          i = {
            type_: "arrow",
            r: e.r,
            rd: a,
            rq: o
          };
        }
        for (var s in e) s !== "parenthesisLevel" && s !== "beginsWithBond" && delete e[s];
        return i;
      },
      "oxidation-output": function(e, t) {
        var r = ["{"];
        return mhchemParser.concatArray(r, mhchemParser.go(t, "oxidation")), r.push("}"), r;
      },
      "frac-output": function(e, t) {
        return {
          type_: "frac-ce",
          p1: mhchemParser.go(t[0]),
          p2: mhchemParser.go(t[1])
        };
      },
      "overset-output": function(e, t) {
        return {
          type_: "overset",
          p1: mhchemParser.go(t[0]),
          p2: mhchemParser.go(t[1])
        };
      },
      "underset-output": function(e, t) {
        return {
          type_: "underset",
          p1: mhchemParser.go(t[0]),
          p2: mhchemParser.go(t[1])
        };
      },
      "underbrace-output": function(e, t) {
        return {
          type_: "underbrace",
          p1: mhchemParser.go(t[0]),
          p2: mhchemParser.go(t[1])
        };
      },
      "color-output": function(e, t) {
        return {
          type_: "color",
          color1: t[0],
          color2: mhchemParser.go(t[1])
        };
      },
      "r=": function(e, t) {
        e.r = t;
      },
      "rdt=": function(e, t) {
        e.rdt = t;
      },
      "rd=": function(e, t) {
        e.rd = t;
      },
      "rqt=": function(e, t) {
        e.rqt = t;
      },
      "rq=": function(e, t) {
        e.rq = t;
      },
      operator: function(e, t, n) {
        return {
          type_: "operator",
          kind_: n || t
        };
      }
    }
  },
  a: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": {} },
      "1/2$": { 0: { action_: "1/2" } },
      else: { 0: {
        nextState: "1",
        revisit: true
      } },
      "$(...)$": { "*": {
        action_: "tex-math tight",
        nextState: "1"
      } },
      ",": { "*": { action_: {
        type_: "insert",
        option: "commaDecimal"
      } } },
      else2: { "*": { action_: "copy" } }
    }),
    actions: {}
  },
  o: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": {} },
      "1/2$": { 0: { action_: "1/2" } },
      else: { 0: {
        nextState: "1",
        revisit: true
      } },
      letters: { "*": { action_: "rm" } },
      "\\ca": { "*": { action_: {
        type_: "insert",
        option: "circa"
      } } },
      "\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
      "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
      "{(...)}": { "*": { action_: "{text}" } },
      else2: { "*": { action_: "copy" } }
    }),
    actions: {}
  },
  text: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": { action_: "output" } },
      "{...}": { "*": { action_: "text=" } },
      "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
      "\\greek": { "*": { action_: ["output", "rm"] } },
      "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: ["output", "copy"] } },
      else: { "*": { action_: "text=" } }
    }),
    actions: { output: function(e) {
      if (e.text_) {
        var t = {
          type_: "text",
          p1: e.text_
        };
        for (var n in e) delete e[n];
        return t;
      }
    } }
  },
  pq: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": {} },
      "state of aggregation $": { "*": { action_: "state of aggregation" } },
      i$: { 0: {
        nextState: "!f",
        revisit: true
      } },
      "(KV letters),": { 0: {
        action_: "rm",
        nextState: "0"
      } },
      formula$: { 0: {
        nextState: "f",
        revisit: true
      } },
      "1/2$": { 0: { action_: "1/2" } },
      else: { 0: {
        nextState: "!f",
        revisit: true
      } },
      "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
      "{(...)}": { "*": { action_: "text" } },
      "a-z": { f: { action_: "tex-math" } },
      letters: { "*": { action_: "rm" } },
      "-9.,9": { "*": { action_: "9,9" } },
      ",": { "*": { action_: {
        type_: "insert+p1",
        option: "comma enumeration S"
      } } },
      "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } },
      "\\color{(...)}0": { "*": { action_: "color0-output" } },
      "\\ce{(...)}": { "*": { action_: "ce" } },
      "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
      else2: { "*": { action_: "copy" } }
    }),
    actions: {
      "state of aggregation": function(e, t) {
        return {
          type_: "state of aggregation subscript",
          p1: mhchemParser.go(t, "o")
        };
      },
      "color-output": function(e, t) {
        return {
          type_: "color",
          color1: t[0],
          color2: mhchemParser.go(t[1], "pq")
        };
      }
    }
  },
  bd: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": {} },
      x$: { 0: {
        nextState: "!f",
        revisit: true
      } },
      formula$: { 0: {
        nextState: "f",
        revisit: true
      } },
      else: { 0: {
        nextState: "!f",
        revisit: true
      } },
      "-9.,9 no missing 0": { "*": { action_: "9,9" } },
      ".": { "*": { action_: {
        type_: "insert",
        option: "electron dot"
      } } },
      "a-z": { f: { action_: "tex-math" } },
      x: { "*": { action_: {
        type_: "insert",
        option: "KV x"
      } } },
      letters: { "*": { action_: "rm" } },
      "'": { "*": { action_: {
        type_: "insert",
        option: "prime"
      } } },
      "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
      "{(...)}": { "*": { action_: "text" } },
      "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } },
      "\\color{(...)}0": { "*": { action_: "color0-output" } },
      "\\ce{(...)}": { "*": { action_: "ce" } },
      "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } },
      else2: { "*": { action_: "copy" } }
    }),
    actions: { "color-output": function(e, t) {
      return {
        type_: "color",
        color1: t[0],
        color2: mhchemParser.go(t[1], "bd")
      };
    } }
  },
  oxidation: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": {} },
      "roman numeral": { "*": { action_: "roman-numeral" } },
      "${(...)}$|$(...)$": { "*": { action_: "tex-math" } },
      else: { "*": { action_: "copy" } }
    }),
    actions: { "roman-numeral": function(e, t) {
      return {
        type_: "roman numeral",
        p1: t || ""
      };
    } }
  },
  "tex-math": {
    transitions: mhchemParser.createTransitions({
      empty: { "*": { action_: "output" } },
      "\\ce{(...)}": { "*": { action_: ["output", "ce"] } },
      "{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } },
      else: { "*": { action_: "o=" } }
    }),
    actions: { output: function(e) {
      if (e.o) {
        var t = {
          type_: "tex-math",
          p1: e.o
        };
        for (var n in e) delete e[n];
        return t;
      }
    } }
  },
  "tex-math tight": {
    transitions: mhchemParser.createTransitions({
      empty: { "*": { action_: "output" } },
      "\\ce{(...)}": { "*": { action_: ["output", "ce"] } },
      "{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } },
      "-|+": { "*": { action_: "tight operator" } },
      else: { "*": { action_: "o=" } }
    }),
    actions: {
      "tight operator": function(e, t) {
        e.o = (e.o || "") + "{" + t + "}";
      },
      output: function(e) {
        if (e.o) {
          var t = {
            type_: "tex-math",
            p1: e.o
          };
          for (var n in e) delete e[n];
          return t;
        }
      }
    }
  },
  "9,9": {
    transitions: mhchemParser.createTransitions({
      empty: { "*": {} },
      ",": { "*": { action_: "comma" } },
      else: { "*": { action_: "copy" } }
    }),
    actions: { comma: function() {
      return { type_: "commaDecimal" };
    } }
  },
  pu: {
    transitions: mhchemParser.createTransitions({
      empty: { "*": { action_: "output" } },
      space$: { "*": { action_: ["output", "space"] } },
      "{[(|)]}": { "0|a": { action_: "copy" } },
      "(-)(9)^(-9)": { 0: {
        action_: "number^",
        nextState: "a"
      } },
      "(-)(9.,9)(e)(99)": { 0: {
        action_: "enumber",
        nextState: "a"
      } },
      space: { "0|a": {} },
      "pm-operator": { "0|a": {
        action_: {
          type_: "operator",
          option: "\\pm"
        },
        nextState: "0"
      } },
      operator: { "0|a": {
        action_: "copy",
        nextState: "0"
      } },
      "//": { d: {
        action_: "o=",
        nextState: "/"
      } },
      "/": { d: {
        action_: "o=",
        nextState: "/"
      } },
      "{...}|else": {
        "0|d": {
          action_: "d=",
          nextState: "d"
        },
        a: {
          action_: ["space", "d="],
          nextState: "d"
        },
        "/|q": {
          action_: "q=",
          nextState: "q"
        }
      }
    }),
    actions: {
      enumber: function(e, t) {
        var r = [];
        return t[0] === "+-" || t[0] === "+/-" ? r.push("\\pm ") : t[0] && r.push(t[0]), t[1] && (mhchemParser.concatArray(r, mhchemParser.go(t[1], "pu-9,9")), t[2] && (t[2].match(/[,.]/) ? mhchemParser.concatArray(r, mhchemParser.go(t[2], "pu-9,9")) : r.push(t[2])), t[3] = t[4] || t[3], t[3] && (t[3] = t[3].trim(), t[3] === "e" || t[3].substr(0, 1) === "*" ? r.push({ type_: "cdot" }) : r.push({ type_: "times" }))), t[3] && r.push("10^{" + t[5] + "}"), r;
      },
      "number^": function(e, t) {
        var r = [];
        return t[0] === "+-" || t[0] === "+/-" ? r.push("\\pm ") : t[0] && r.push(t[0]), mhchemParser.concatArray(r, mhchemParser.go(t[1], "pu-9,9")), r.push("^{" + t[2] + "}"), r;
      },
      operator: function(e, t, n) {
        return {
          type_: "operator",
          kind_: n || t
        };
      },
      space: function() {
        return { type_: "pu-space-1" };
      },
      output: function(e) {
        var t, r = mhchemParser.patterns.match_("{(...)}", e.d || "");
        r && r.remainder === "" && (e.d = r.match_);
        var i = mhchemParser.patterns.match_("{(...)}", e.q || "");
        if (i && i.remainder === "" && (e.q = i.match_), e.d && (e.d = (e.d = e.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), e.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F"))), e.q) {
          e.q = e.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), e.q = e.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
          var a = {
            d: mhchemParser.go(e.d, "pu"),
            q: mhchemParser.go(e.q, "pu")
          };
          e.o === "//" ? t = {
            type_: "pu-frac",
            p1: a.d,
            p2: a.q
          } : (t = a.d, a.d.length > 1 || a.q.length > 1 ? t.push({ type_: " / " }) : t.push({ type_: "/" }), mhchemParser.concatArray(t, a.q));
        } else t = mhchemParser.go(e.d, "pu-2");
        for (var o in e) delete e[o];
        return t;
      }
    }
  },
  "pu-2": {
    transitions: mhchemParser.createTransitions({
      empty: { "*": { action_: "output" } },
      "*": { "*": {
        action_: ["output", "cdot"],
        nextState: "0"
      } },
      "\\x": { "*": { action_: "rm=" } },
      space: { "*": {
        action_: ["output", "space"],
        nextState: "0"
      } },
      "^{(...)}|^(-1)": { 1: { action_: "^(-1)" } },
      "-9.,9": {
        0: {
          action_: "rm=",
          nextState: "0"
        },
        1: {
          action_: "^(-1)",
          nextState: "0"
        }
      },
      "{...}|else": { "*": {
        action_: "rm=",
        nextState: "1"
      } }
    }),
    actions: {
      cdot: function() {
        return { type_: "tight cdot" };
      },
      "^(-1)": function(e, t) {
        e.rm += "^{" + t + "}";
      },
      space: function() {
        return { type_: "pu-space-2" };
      },
      output: function(e) {
        var t = [];
        if (e.rm) {
          var r = mhchemParser.patterns.match_("{(...)}", e.rm || "");
          t = r && r.remainder === "" ? mhchemParser.go(r.match_, "pu") : {
            type_: "rm",
            p1: e.rm
          };
        }
        for (var i in e) delete e[i];
        return t;
      }
    }
  },
  "pu-9,9": {
    transitions: mhchemParser.createTransitions({
      empty: {
        0: { action_: "output-0" },
        o: { action_: "output-o" }
      },
      ",": { 0: {
        action_: ["output-0", "comma"],
        nextState: "o"
      } },
      ".": { 0: {
        action_: ["output-0", "copy"],
        nextState: "o"
      } },
      else: { "*": { action_: "text=" } }
    }),
    actions: {
      comma: function() {
        return { type_: "commaDecimal" };
      },
      "output-0": function(e) {
        var t = [];
        if (e.text_ = e.text_ || "", e.text_.length > 4) {
          var n = e.text_.length % 3;
          n === 0 && (n = 3);
          for (var r = e.text_.length - 3; r > 0; r -= 3) t.push(e.text_.substr(r, 3)), t.push({ type_: "1000 separator" });
          t.push(e.text_.substr(0, n)), t.reverse();
        } else t.push(e.text_);
        for (var i in e) delete e[i];
        return t;
      },
      "output-o": function(e) {
        var t = [];
        if (e.text_ = e.text_ || "", e.text_.length > 4) {
          for (var n = e.text_.length - 3, r = 0; r < n; r += 3) t.push(e.text_.substr(r, 3)), t.push({ type_: "1000 separator" });
          t.push(e.text_.substr(r));
        } else t.push(e.text_);
        for (var i in e) delete e[i];
        return t;
      }
    }
  }
};
var texify = {
  go: function(e, t) {
    if (!e) return "";
    for (var n = "", i = false, a = 0; a < e.length; a++) {
      var o = e[a];
      typeof o == "string" ? n += o : (n += texify._go2(o), o.type_ === "1st-level escape" && (i = true));
    }
    return !t && !i && n && (n = "{" + n + "}"), n;
  },
  _goInner: function(e) {
    return e && texify.go(e, true);
  },
  _go2: function(e) {
    var t;
    switch (e.type_) {
      case "chemfive":
        t = "";
        var n = {
          a: texify._goInner(e.a),
          b: texify._goInner(e.b),
          p: texify._goInner(e.p),
          o: texify._goInner(e.o),
          q: texify._goInner(e.q),
          d: texify._goInner(e.d)
        };
        n.a && (n.a.match(/^[+\-]/) && (n.a = "{" + n.a + "}"), t += n.a + "\\,"), (n.b || n.p) && (t += "{\\vphantom{X}}", t += "^{\\hphantom{" + (n.b || "") + "}}_{\\hphantom{" + (n.p || "") + "}}", t += "{\\vphantom{X}}", t += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (n.b || "") + "}}", t += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (n.p || "") + "}}}"), n.o && (n.o.match(/^[+\-]/) && (n.o = "{" + n.o + "}"), t += n.o), e.dType === "kv" ? ((n.d || n.q) && (t += "{\\vphantom{X}}"), n.d && (t += "^{" + n.d + "}"), n.q && (t += "_{\\smash[t]{" + n.q + "}}")) : e.dType === "oxidation" ? (n.d && (t += "{\\vphantom{X}}", t += "^{" + n.d + "}"), n.q && (t += "{\\vphantom{X}}", t += "_{\\smash[t]{" + n.q + "}}")) : (n.q && (t += "{\\vphantom{X}}", t += "_{\\smash[t]{" + n.q + "}}"), n.d && (t += "{\\vphantom{X}}", t += "^{" + n.d + "}"));
        break;
      case "rm":
        t = "\\mathrm{" + e.p1 + "}";
        break;
      case "text":
        e.p1.match(/[\^_]/) ? (e.p1 = e.p1.replace(" ", "~").replace("-", "\\text{-}"), t = "\\mathrm{" + e.p1 + "}") : t = "\\text{" + e.p1 + "}";
        break;
      case "roman numeral":
        t = "\\mathrm{" + e.p1 + "}";
        break;
      case "state of aggregation":
        t = "\\mskip2mu " + texify._goInner(e.p1);
        break;
      case "state of aggregation subscript":
        t = "\\mskip1mu " + texify._goInner(e.p1);
        break;
      case "bond":
        if (t = texify._getBond(e.kind_), !t) throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + e.kind_ + ")"];
        break;
      case "frac":
        var i = "\\frac{" + e.p1 + "}{" + e.p2 + "}";
        t = "\\mathchoice{\\textstyle" + i + "}{" + i + "}{" + i + "}{" + i + "}";
        break;
      case "pu-frac":
        var a = "\\frac{" + texify._goInner(e.p1) + "}{" + texify._goInner(e.p2) + "}";
        t = "\\mathchoice{\\textstyle" + a + "}{" + a + "}{" + a + "}{" + a + "}";
        break;
      case "tex-math":
        t = e.p1 + " ";
        break;
      case "frac-ce":
        t = "\\frac{" + texify._goInner(e.p1) + "}{" + texify._goInner(e.p2) + "}";
        break;
      case "overset":
        t = "\\overset{" + texify._goInner(e.p1) + "}{" + texify._goInner(e.p2) + "}";
        break;
      case "underset":
        t = "\\underset{" + texify._goInner(e.p1) + "}{" + texify._goInner(e.p2) + "}";
        break;
      case "underbrace":
        t = "\\underbrace{" + texify._goInner(e.p1) + "}_{" + texify._goInner(e.p2) + "}";
        break;
      case "color":
        t = "{\\color{" + e.color1 + "}{" + texify._goInner(e.color2) + "}}";
        break;
      case "color0":
        t = "\\color{" + e.color + "}";
        break;
      case "arrow":
        var o = {
          rd: texify._goInner(e.rd),
          rq: texify._goInner(e.rq)
        }, s = "\\x" + texify._getArrow(e.r);
        o.rq && (s += "[{" + o.rq + "}]"), o.rd ? s += "{" + o.rd + "}" : s += "{}", t = s;
        break;
      case "operator":
        t = texify._getOperator(e.kind_);
        break;
      case "1st-level escape":
        t = e.p1 + " ";
        break;
      case "space":
        t = " ";
        break;
      case "entitySkip":
        t = "~";
        break;
      case "pu-space-1":
        t = "~";
        break;
      case "pu-space-2":
        t = "\\mkern3mu ";
        break;
      case "1000 separator":
        t = "\\mkern2mu ";
        break;
      case "commaDecimal":
        t = "{,}";
        break;
      case "comma enumeration L":
        t = "{" + e.p1 + "}\\mkern6mu ";
        break;
      case "comma enumeration M":
        t = "{" + e.p1 + "}\\mkern3mu ";
        break;
      case "comma enumeration S":
        t = "{" + e.p1 + "}\\mkern1mu ";
        break;
      case "hyphen":
        t = "\\text{-}";
        break;
      case "addition compound":
        t = "\\,{\\cdot}\\,";
        break;
      case "electron dot":
        t = "\\mkern1mu \\bullet\\mkern1mu ";
        break;
      case "KV x":
        t = "{\\times}";
        break;
      case "prime":
        t = "\\prime ";
        break;
      case "cdot":
        t = "\\cdot ";
        break;
      case "tight cdot":
        t = "\\mkern1mu{\\cdot}\\mkern1mu ";
        break;
      case "times":
        t = "\\times ";
        break;
      case "circa":
        t = "{\\sim}";
        break;
      case "^":
        t = "uparrow";
        break;
      case "v":
        t = "downarrow";
        break;
      case "ellipsis":
        t = "\\ldots ";
        break;
      case "/":
        t = "/";
        break;
      case " / ":
        t = "\\,/\\,";
        break;
      default:
        throw ["MhchemBugT", "mhchem bug T. Please report."];
    }
    return t;
  },
  _getArrow: function(e) {
    switch (e) {
      case "->":
        return "rightarrow";
      case "\u2192":
        return "rightarrow";
      case "\u27F6":
        return "rightarrow";
      case "<-":
        return "leftarrow";
      case "<->":
        return "leftrightarrow";
      case "<-->":
        return "rightleftarrows";
      case "<=>":
        return "rightleftharpoons";
      case "\u21CC":
        return "rightleftharpoons";
      case "<=>>":
        return "rightequilibrium";
      case "<<=>":
        return "leftequilibrium";
      default:
        throw ["MhchemBugT", "mhchem bug T. Please report."];
    }
  },
  _getBond: function(e) {
    switch (e) {
      case "-":
        return "{-}";
      case "1":
        return "{-}";
      case "=":
        return "{=}";
      case "2":
        return "{=}";
      case "#":
        return "{\\equiv}";
      case "3":
        return "{\\equiv}";
      case "~":
        return "{\\tripledash}";
      case "~-":
        return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
      case "~=":
        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
      case "~--":
        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
      case "-~-":
        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
      case "...":
        return "{{\\cdot}{\\cdot}{\\cdot}}";
      case "....":
        return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
      case "->":
        return "{\\rightarrow}";
      case "<-":
        return "{\\leftarrow}";
      case "<":
        return "{<}";
      case ">":
        return "{>}";
      default:
        throw ["MhchemBugT", "mhchem bug T. Please report."];
    }
  },
  _getOperator: function(e) {
    switch (e) {
      case "+":
        return " {}+{} ";
      case "-":
        return " {}-{} ";
      case "=":
        return " {}={} ";
      case "<":
        return " {}<{} ";
      case ">":
        return " {}>{} ";
      case "<<":
        return " {}\\ll{} ";
      case ">>":
        return " {}\\gg{} ";
      case "\\pm":
        return " {}\\pm{} ";
      case "\\approx":
        return " {}\\approx{} ";
      case "$\\approx$":
        return " {}\\approx{} ";
      case "v":
        return " \\downarrow{} ";
      case "(v)":
        return " \\downarrow{} ";
      case "^":
        return " \\uparrow{} ";
      case "(^)":
        return " \\uparrow{} ";
      default:
        throw ["MhchemBugT", "mhchem bug T. Please report."];
    }
  }
};
