function VT(r) {
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var oy = { exports: {} }, Kd = {}, sy = { exports: {} }, nr = {};
var l1;
function gZ() {
  if (l1) return nr;
  l1 = 1;
  var r = /* @__PURE__ */ Symbol.for("react.element"), e = /* @__PURE__ */ Symbol.for("react.portal"), t = /* @__PURE__ */ Symbol.for("react.fragment"), n = /* @__PURE__ */ Symbol.for("react.strict_mode"), i = /* @__PURE__ */ Symbol.for("react.profiler"), a = /* @__PURE__ */ Symbol.for("react.provider"), s = /* @__PURE__ */ Symbol.for("react.context"), u = /* @__PURE__ */ Symbol.for("react.forward_ref"), f = /* @__PURE__ */ Symbol.for("react.suspense"), p = /* @__PURE__ */ Symbol.for("react.memo"), y = /* @__PURE__ */ Symbol.for("react.lazy"), T = Symbol.iterator;
  function N(fe) {
    return fe === null || typeof fe != "object" ? null : (fe = T && fe[T] || fe["@@iterator"], typeof fe == "function" ? fe : null);
  }
  var O = { isMounted: function() {
    return !1;
  }, enqueueForceUpdate: function() {
  }, enqueueReplaceState: function() {
  }, enqueueSetState: function() {
  } }, A = Object.assign, q = {};
  function U(fe, Le, dt) {
    this.props = fe, this.context = Le, this.refs = q, this.updater = dt || O;
  }
  U.prototype.isReactComponent = {}, U.prototype.setState = function(fe, Le) {
    if (typeof fe != "object" && typeof fe != "function" && fe != null) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
    this.updater.enqueueSetState(this, fe, Le, "setState");
  }, U.prototype.forceUpdate = function(fe) {
    this.updater.enqueueForceUpdate(this, fe, "forceUpdate");
  };
  function j() {
  }
  j.prototype = U.prototype;
  function te(fe, Le, dt) {
    this.props = fe, this.context = Le, this.refs = q, this.updater = dt || O;
  }
  var se = te.prototype = new j();
  se.constructor = te, A(se, U.prototype), se.isPureReactComponent = !0;
  var me = Array.isArray, Ce = Object.prototype.hasOwnProperty, pe = { current: null }, ke = { key: !0, ref: !0, __self: !0, __source: !0 };
  function Ne(fe, Le, dt) {
    var vt, Ft = {}, Lt = null, $t = null;
    if (Le != null) for (vt in Le.ref !== void 0 && ($t = Le.ref), Le.key !== void 0 && (Lt = "" + Le.key), Le) Ce.call(Le, vt) && !ke.hasOwnProperty(vt) && (Ft[vt] = Le[vt]);
    var Te = arguments.length - 2;
    if (Te === 1) Ft.children = dt;
    else if (1 < Te) {
      for (var be = Array(Te), ue = 0; ue < Te; ue++) be[ue] = arguments[ue + 2];
      Ft.children = be;
    }
    if (fe && fe.defaultProps) for (vt in Te = fe.defaultProps, Te) Ft[vt] === void 0 && (Ft[vt] = Te[vt]);
    return { $$typeof: r, type: fe, key: Lt, ref: $t, props: Ft, _owner: pe.current };
  }
  function ze(fe, Le) {
    return { $$typeof: r, type: fe.type, key: Le, ref: fe.ref, props: fe.props, _owner: fe._owner };
  }
  function Ze(fe) {
    return typeof fe == "object" && fe !== null && fe.$$typeof === r;
  }
  function At(fe) {
    var Le = { "=": "=0", ":": "=2" };
    return "$" + fe.replace(/[=:]/g, function(dt) {
      return Le[dt];
    });
  }
  var et = /\/+/g;
  function Ht(fe, Le) {
    return typeof fe == "object" && fe !== null && fe.key != null ? At("" + fe.key) : Le.toString(36);
  }
  function Rt(fe, Le, dt, vt, Ft) {
    var Lt = typeof fe;
    (Lt === "undefined" || Lt === "boolean") && (fe = null);
    var $t = !1;
    if (fe === null) $t = !0;
    else switch (Lt) {
      case "string":
      case "number":
        $t = !0;
        break;
      case "object":
        switch (fe.$$typeof) {
          case r:
          case e:
            $t = !0;
        }
    }
    if ($t) return $t = fe, Ft = Ft($t), fe = vt === "" ? "." + Ht($t, 0) : vt, me(Ft) ? (dt = "", fe != null && (dt = fe.replace(et, "$&/") + "/"), Rt(Ft, Le, dt, "", function(ue) {
      return ue;
    })) : Ft != null && (Ze(Ft) && (Ft = ze(Ft, dt + (!Ft.key || $t && $t.key === Ft.key ? "" : ("" + Ft.key).replace(et, "$&/") + "/") + fe)), Le.push(Ft)), 1;
    if ($t = 0, vt = vt === "" ? "." : vt + ":", me(fe)) for (var Te = 0; Te < fe.length; Te++) {
      Lt = fe[Te];
      var be = vt + Ht(Lt, Te);
      $t += Rt(Lt, Le, dt, be, Ft);
    }
    else if (be = N(fe), typeof be == "function") for (fe = be.call(fe), Te = 0; !(Lt = fe.next()).done; ) Lt = Lt.value, be = vt + Ht(Lt, Te++), $t += Rt(Lt, Le, dt, be, Ft);
    else if (Lt === "object") throw Le = String(fe), Error("Objects are not valid as a React child (found: " + (Le === "[object Object]" ? "object with keys {" + Object.keys(fe).join(", ") + "}" : Le) + "). If you meant to render a collection of children, use an array instead.");
    return $t;
  }
  function Ut(fe, Le, dt) {
    if (fe == null) return fe;
    var vt = [], Ft = 0;
    return Rt(fe, vt, "", "", function(Lt) {
      return Le.call(dt, Lt, Ft++);
    }), vt;
  }
  function yt(fe) {
    if (fe._status === -1) {
      var Le = fe._result;
      Le = Le(), Le.then(function(dt) {
        (fe._status === 0 || fe._status === -1) && (fe._status = 1, fe._result = dt);
      }, function(dt) {
        (fe._status === 0 || fe._status === -1) && (fe._status = 2, fe._result = dt);
      }), fe._status === -1 && (fe._status = 0, fe._result = Le);
    }
    if (fe._status === 1) return fe._result.default;
    throw fe._result;
  }
  var It = { current: null }, Ke = { transition: null }, ct = { ReactCurrentDispatcher: It, ReactCurrentBatchConfig: Ke, ReactCurrentOwner: pe };
  function He() {
    throw Error("act(...) is not supported in production builds of React.");
  }
  return nr.Children = { map: Ut, forEach: function(fe, Le, dt) {
    Ut(fe, function() {
      Le.apply(this, arguments);
    }, dt);
  }, count: function(fe) {
    var Le = 0;
    return Ut(fe, function() {
      Le++;
    }), Le;
  }, toArray: function(fe) {
    return Ut(fe, function(Le) {
      return Le;
    }) || [];
  }, only: function(fe) {
    if (!Ze(fe)) throw Error("React.Children.only expected to receive a single React element child.");
    return fe;
  } }, nr.Component = U, nr.Fragment = t, nr.Profiler = i, nr.PureComponent = te, nr.StrictMode = n, nr.Suspense = f, nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ct, nr.act = He, nr.cloneElement = function(fe, Le, dt) {
    if (fe == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + fe + ".");
    var vt = A({}, fe.props), Ft = fe.key, Lt = fe.ref, $t = fe._owner;
    if (Le != null) {
      if (Le.ref !== void 0 && (Lt = Le.ref, $t = pe.current), Le.key !== void 0 && (Ft = "" + Le.key), fe.type && fe.type.defaultProps) var Te = fe.type.defaultProps;
      for (be in Le) Ce.call(Le, be) && !ke.hasOwnProperty(be) && (vt[be] = Le[be] === void 0 && Te !== void 0 ? Te[be] : Le[be]);
    }
    var be = arguments.length - 2;
    if (be === 1) vt.children = dt;
    else if (1 < be) {
      Te = Array(be);
      for (var ue = 0; ue < be; ue++) Te[ue] = arguments[ue + 2];
      vt.children = Te;
    }
    return { $$typeof: r, type: fe.type, key: Ft, ref: Lt, props: vt, _owner: $t };
  }, nr.createContext = function(fe) {
    return fe = { $$typeof: s, _currentValue: fe, _currentValue2: fe, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, fe.Provider = { $$typeof: a, _context: fe }, fe.Consumer = fe;
  }, nr.createElement = Ne, nr.createFactory = function(fe) {
    var Le = Ne.bind(null, fe);
    return Le.type = fe, Le;
  }, nr.createRef = function() {
    return { current: null };
  }, nr.forwardRef = function(fe) {
    return { $$typeof: u, render: fe };
  }, nr.isValidElement = Ze, nr.lazy = function(fe) {
    return { $$typeof: y, _payload: { _status: -1, _result: fe }, _init: yt };
  }, nr.memo = function(fe, Le) {
    return { $$typeof: p, type: fe, compare: Le === void 0 ? null : Le };
  }, nr.startTransition = function(fe) {
    var Le = Ke.transition;
    Ke.transition = {};
    try {
      fe();
    } finally {
      Ke.transition = Le;
    }
  }, nr.unstable_act = He, nr.useCallback = function(fe, Le) {
    return It.current.useCallback(fe, Le);
  }, nr.useContext = function(fe) {
    return It.current.useContext(fe);
  }, nr.useDebugValue = function() {
  }, nr.useDeferredValue = function(fe) {
    return It.current.useDeferredValue(fe);
  }, nr.useEffect = function(fe, Le) {
    return It.current.useEffect(fe, Le);
  }, nr.useId = function() {
    return It.current.useId();
  }, nr.useImperativeHandle = function(fe, Le, dt) {
    return It.current.useImperativeHandle(fe, Le, dt);
  }, nr.useInsertionEffect = function(fe, Le) {
    return It.current.useInsertionEffect(fe, Le);
  }, nr.useLayoutEffect = function(fe, Le) {
    return It.current.useLayoutEffect(fe, Le);
  }, nr.useMemo = function(fe, Le) {
    return It.current.useMemo(fe, Le);
  }, nr.useReducer = function(fe, Le, dt) {
    return It.current.useReducer(fe, Le, dt);
  }, nr.useRef = function(fe) {
    return It.current.useRef(fe);
  }, nr.useState = function(fe) {
    return It.current.useState(fe);
  }, nr.useSyncExternalStore = function(fe, Le, dt) {
    return It.current.useSyncExternalStore(fe, Le, dt);
  }, nr.useTransition = function() {
    return It.current.useTransition();
  }, nr.version = "18.3.1", nr;
}
var u1;
function U0() {
  return u1 || (u1 = 1, sy.exports = gZ()), sy.exports;
}
var c1;
function yZ() {
  if (c1) return Kd;
  c1 = 1;
  var r = U0(), e = /* @__PURE__ */ Symbol.for("react.element"), t = /* @__PURE__ */ Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
  function s(u, f, p) {
    var y, T = {}, N = null, O = null;
    p !== void 0 && (N = "" + p), f.key !== void 0 && (N = "" + f.key), f.ref !== void 0 && (O = f.ref);
    for (y in f) n.call(f, y) && !a.hasOwnProperty(y) && (T[y] = f[y]);
    if (u && u.defaultProps) for (y in f = u.defaultProps, f) T[y] === void 0 && (T[y] = f[y]);
    return { $$typeof: e, type: u, key: N, ref: O, props: T, _owner: i.current };
  }
  return Kd.Fragment = t, Kd.jsx = s, Kd.jsxs = s, Kd;
}
var f1;
function kZ() {
  return f1 || (f1 = 1, oy.exports = yZ()), oy.exports;
}
var Gv = kZ(), du = U0();
const Zc = /* @__PURE__ */ VT(du);
var wv = {}, ly = { exports: {} }, Ui = {}, uy = { exports: {} }, cy = {};
var d1;
function wZ() {
  return d1 || (d1 = 1, (function(r) {
    function e(Ke, ct) {
      var He = Ke.length;
      Ke.push(ct);
      e: for (; 0 < He; ) {
        var fe = He - 1 >>> 1, Le = Ke[fe];
        if (0 < i(Le, ct)) Ke[fe] = ct, Ke[He] = Le, He = fe;
        else break e;
      }
    }
    function t(Ke) {
      return Ke.length === 0 ? null : Ke[0];
    }
    function n(Ke) {
      if (Ke.length === 0) return null;
      var ct = Ke[0], He = Ke.pop();
      if (He !== ct) {
        Ke[0] = He;
        e: for (var fe = 0, Le = Ke.length, dt = Le >>> 1; fe < dt; ) {
          var vt = 2 * (fe + 1) - 1, Ft = Ke[vt], Lt = vt + 1, $t = Ke[Lt];
          if (0 > i(Ft, He)) Lt < Le && 0 > i($t, Ft) ? (Ke[fe] = $t, Ke[Lt] = He, fe = Lt) : (Ke[fe] = Ft, Ke[vt] = He, fe = vt);
          else if (Lt < Le && 0 > i($t, He)) Ke[fe] = $t, Ke[Lt] = He, fe = Lt;
          else break e;
        }
      }
      return ct;
    }
    function i(Ke, ct) {
      var He = Ke.sortIndex - ct.sortIndex;
      return He !== 0 ? He : Ke.id - ct.id;
    }
    if (typeof performance == "object" && typeof performance.now == "function") {
      var a = performance;
      r.unstable_now = function() {
        return a.now();
      };
    } else {
      var s = Date, u = s.now();
      r.unstable_now = function() {
        return s.now() - u;
      };
    }
    var f = [], p = [], y = 1, T = null, N = 3, O = !1, A = !1, q = !1, U = typeof setTimeout == "function" ? setTimeout : null, j = typeof clearTimeout == "function" ? clearTimeout : null, te = typeof setImmediate < "u" ? setImmediate : null;
    typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling);
    function se(Ke) {
      for (var ct = t(p); ct !== null; ) {
        if (ct.callback === null) n(p);
        else if (ct.startTime <= Ke) n(p), ct.sortIndex = ct.expirationTime, e(f, ct);
        else break;
        ct = t(p);
      }
    }
    function me(Ke) {
      if (q = !1, se(Ke), !A) if (t(f) !== null) A = !0, yt(Ce);
      else {
        var ct = t(p);
        ct !== null && It(me, ct.startTime - Ke);
      }
    }
    function Ce(Ke, ct) {
      A = !1, q && (q = !1, j(Ne), Ne = -1), O = !0;
      var He = N;
      try {
        for (se(ct), T = t(f); T !== null && (!(T.expirationTime > ct) || Ke && !At()); ) {
          var fe = T.callback;
          if (typeof fe == "function") {
            T.callback = null, N = T.priorityLevel;
            var Le = fe(T.expirationTime <= ct);
            ct = r.unstable_now(), typeof Le == "function" ? T.callback = Le : T === t(f) && n(f), se(ct);
          } else n(f);
          T = t(f);
        }
        if (T !== null) var dt = !0;
        else {
          var vt = t(p);
          vt !== null && It(me, vt.startTime - ct), dt = !1;
        }
        return dt;
      } finally {
        T = null, N = He, O = !1;
      }
    }
    var pe = !1, ke = null, Ne = -1, ze = 5, Ze = -1;
    function At() {
      return !(r.unstable_now() - Ze < ze);
    }
    function et() {
      if (ke !== null) {
        var Ke = r.unstable_now();
        Ze = Ke;
        var ct = !0;
        try {
          ct = ke(!0, Ke);
        } finally {
          ct ? Ht() : (pe = !1, ke = null);
        }
      } else pe = !1;
    }
    var Ht;
    if (typeof te == "function") Ht = function() {
      te(et);
    };
    else if (typeof MessageChannel < "u") {
      var Rt = new MessageChannel(), Ut = Rt.port2;
      Rt.port1.onmessage = et, Ht = function() {
        Ut.postMessage(null);
      };
    } else Ht = function() {
      U(et, 0);
    };
    function yt(Ke) {
      ke = Ke, pe || (pe = !0, Ht());
    }
    function It(Ke, ct) {
      Ne = U(function() {
        Ke(r.unstable_now());
      }, ct);
    }
    r.unstable_IdlePriority = 5, r.unstable_ImmediatePriority = 1, r.unstable_LowPriority = 4, r.unstable_NormalPriority = 3, r.unstable_Profiling = null, r.unstable_UserBlockingPriority = 2, r.unstable_cancelCallback = function(Ke) {
      Ke.callback = null;
    }, r.unstable_continueExecution = function() {
      A || O || (A = !0, yt(Ce));
    }, r.unstable_forceFrameRate = function(Ke) {
      0 > Ke || 125 < Ke ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : ze = 0 < Ke ? Math.floor(1e3 / Ke) : 5;
    }, r.unstable_getCurrentPriorityLevel = function() {
      return N;
    }, r.unstable_getFirstCallbackNode = function() {
      return t(f);
    }, r.unstable_next = function(Ke) {
      switch (N) {
        case 1:
        case 2:
        case 3:
          var ct = 3;
          break;
        default:
          ct = N;
      }
      var He = N;
      N = ct;
      try {
        return Ke();
      } finally {
        N = He;
      }
    }, r.unstable_pauseExecution = function() {
    }, r.unstable_requestPaint = function() {
    }, r.unstable_runWithPriority = function(Ke, ct) {
      switch (Ke) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
          break;
        default:
          Ke = 3;
      }
      var He = N;
      N = Ke;
      try {
        return ct();
      } finally {
        N = He;
      }
    }, r.unstable_scheduleCallback = function(Ke, ct, He) {
      var fe = r.unstable_now();
      switch (typeof He == "object" && He !== null ? (He = He.delay, He = typeof He == "number" && 0 < He ? fe + He : fe) : He = fe, Ke) {
        case 1:
          var Le = -1;
          break;
        case 2:
          Le = 250;
          break;
        case 5:
          Le = 1073741823;
          break;
        case 4:
          Le = 1e4;
          break;
        default:
          Le = 5e3;
      }
      return Le = He + Le, Ke = { id: y++, callback: ct, priorityLevel: Ke, startTime: He, expirationTime: Le, sortIndex: -1 }, He > fe ? (Ke.sortIndex = He, e(p, Ke), t(f) === null && Ke === t(p) && (q ? (j(Ne), Ne = -1) : q = !0, It(me, He - fe))) : (Ke.sortIndex = Le, e(f, Ke), A || O || (A = !0, yt(Ce))), Ke;
    }, r.unstable_shouldYield = At, r.unstable_wrapCallback = function(Ke) {
      var ct = N;
      return function() {
        var He = N;
        N = ct;
        try {
          return Ke.apply(this, arguments);
        } finally {
          N = He;
        }
      };
    };
  })(cy)), cy;
}
var h1;
function bZ() {
  return h1 || (h1 = 1, uy.exports = wZ()), uy.exports;
}
var p1;
function CZ() {
  if (p1) return Ui;
  p1 = 1;
  var r = U0(), e = bZ();
  function t(o) {
    for (var l = "https://reactjs.org/docs/error-decoder.html?invariant=" + o, c = 1; c < arguments.length; c++) l += "&args[]=" + encodeURIComponent(arguments[c]);
    return "Minified React error #" + o + "; visit " + l + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
  }
  var n = /* @__PURE__ */ new Set(), i = {};
  function a(o, l) {
    s(o, l), s(o + "Capture", l);
  }
  function s(o, l) {
    for (i[o] = l, o = 0; o < l.length; o++) n.add(l[o]);
  }
  var u = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"), f = Object.prototype.hasOwnProperty, p = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, y = {}, T = {};
  function N(o) {
    return f.call(T, o) ? !0 : f.call(y, o) ? !1 : p.test(o) ? T[o] = !0 : (y[o] = !0, !1);
  }
  function O(o, l, c, g) {
    if (c !== null && c.type === 0) return !1;
    switch (typeof l) {
      case "function":
      case "symbol":
        return !0;
      case "boolean":
        return g ? !1 : c !== null ? !c.acceptsBooleans : (o = o.toLowerCase().slice(0, 5), o !== "data-" && o !== "aria-");
      default:
        return !1;
    }
  }
  function A(o, l, c, g) {
    if (l === null || typeof l > "u" || O(o, l, c, g)) return !0;
    if (g) return !1;
    if (c !== null) switch (c.type) {
      case 3:
        return !l;
      case 4:
        return l === !1;
      case 5:
        return isNaN(l);
      case 6:
        return isNaN(l) || 1 > l;
    }
    return !1;
  }
  function q(o, l, c, g, x, L, $) {
    this.acceptsBooleans = l === 2 || l === 3 || l === 4, this.attributeName = g, this.attributeNamespace = x, this.mustUseProperty = c, this.propertyName = o, this.type = l, this.sanitizeURL = L, this.removeEmptyString = $;
  }
  var U = {};
  "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o) {
    U[o] = new q(o, 0, !1, o, null, !1, !1);
  }), [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(o) {
    var l = o[0];
    U[l] = new q(l, 1, !1, o[1], null, !1, !1);
  }), ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(o) {
    U[o] = new q(o, 2, !1, o.toLowerCase(), null, !1, !1);
  }), ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(o) {
    U[o] = new q(o, 2, !1, o, null, !1, !1);
  }), "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o) {
    U[o] = new q(o, 3, !1, o.toLowerCase(), null, !1, !1);
  }), ["checked", "multiple", "muted", "selected"].forEach(function(o) {
    U[o] = new q(o, 3, !0, o, null, !1, !1);
  }), ["capture", "download"].forEach(function(o) {
    U[o] = new q(o, 4, !1, o, null, !1, !1);
  }), ["cols", "rows", "size", "span"].forEach(function(o) {
    U[o] = new q(o, 6, !1, o, null, !1, !1);
  }), ["rowSpan", "start"].forEach(function(o) {
    U[o] = new q(o, 5, !1, o.toLowerCase(), null, !1, !1);
  });
  var j = /[\-:]([a-z])/g;
  function te(o) {
    return o[1].toUpperCase();
  }
  "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o) {
    var l = o.replace(
      j,
      te
    );
    U[l] = new q(l, 1, !1, o, null, !1, !1);
  }), "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o) {
    var l = o.replace(j, te);
    U[l] = new q(l, 1, !1, o, "http://www.w3.org/1999/xlink", !1, !1);
  }), ["xml:base", "xml:lang", "xml:space"].forEach(function(o) {
    var l = o.replace(j, te);
    U[l] = new q(l, 1, !1, o, "http://www.w3.org/XML/1998/namespace", !1, !1);
  }), ["tabIndex", "crossOrigin"].forEach(function(o) {
    U[o] = new q(o, 1, !1, o.toLowerCase(), null, !1, !1);
  }), U.xlinkHref = new q("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1), ["src", "href", "action", "formAction"].forEach(function(o) {
    U[o] = new q(o, 1, !1, o.toLowerCase(), null, !0, !0);
  });
  function se(o, l, c, g) {
    var x = U.hasOwnProperty(l) ? U[l] : null;
    (x !== null ? x.type !== 0 : g || !(2 < l.length) || l[0] !== "o" && l[0] !== "O" || l[1] !== "n" && l[1] !== "N") && (A(l, c, x, g) && (c = null), g || x === null ? N(l) && (c === null ? o.removeAttribute(l) : o.setAttribute(l, "" + c)) : x.mustUseProperty ? o[x.propertyName] = c === null ? x.type === 3 ? !1 : "" : c : (l = x.attributeName, g = x.attributeNamespace, c === null ? o.removeAttribute(l) : (x = x.type, c = x === 3 || x === 4 && c === !0 ? "" : "" + c, g ? o.setAttributeNS(g, l, c) : o.setAttribute(l, c))));
  }
  var me = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, Ce = /* @__PURE__ */ Symbol.for("react.element"), pe = /* @__PURE__ */ Symbol.for("react.portal"), ke = /* @__PURE__ */ Symbol.for("react.fragment"), Ne = /* @__PURE__ */ Symbol.for("react.strict_mode"), ze = /* @__PURE__ */ Symbol.for("react.profiler"), Ze = /* @__PURE__ */ Symbol.for("react.provider"), At = /* @__PURE__ */ Symbol.for("react.context"), et = /* @__PURE__ */ Symbol.for("react.forward_ref"), Ht = /* @__PURE__ */ Symbol.for("react.suspense"), Rt = /* @__PURE__ */ Symbol.for("react.suspense_list"), Ut = /* @__PURE__ */ Symbol.for("react.memo"), yt = /* @__PURE__ */ Symbol.for("react.lazy"), It = /* @__PURE__ */ Symbol.for("react.offscreen"), Ke = Symbol.iterator;
  function ct(o) {
    return o === null || typeof o != "object" ? null : (o = Ke && o[Ke] || o["@@iterator"], typeof o == "function" ? o : null);
  }
  var He = Object.assign, fe;
  function Le(o) {
    if (fe === void 0) try {
      throw Error();
    } catch (c) {
      var l = c.stack.trim().match(/\n( *(at )?)/);
      fe = l && l[1] || "";
    }
    return `
` + fe + o;
  }
  var dt = !1;
  function vt(o, l) {
    if (!o || dt) return "";
    dt = !0;
    var c = Error.prepareStackTrace;
    Error.prepareStackTrace = void 0;
    try {
      if (l) if (l = function() {
        throw Error();
      }, Object.defineProperty(l.prototype, "props", { set: function() {
        throw Error();
      } }), typeof Reflect == "object" && Reflect.construct) {
        try {
          Reflect.construct(l, []);
        } catch (Ie) {
          var g = Ie;
        }
        Reflect.construct(o, [], l);
      } else {
        try {
          l.call();
        } catch (Ie) {
          g = Ie;
        }
        o.call(l.prototype);
      }
      else {
        try {
          throw Error();
        } catch (Ie) {
          g = Ie;
        }
        o();
      }
    } catch (Ie) {
      if (Ie && g && typeof Ie.stack == "string") {
        for (var x = Ie.stack.split(`
`), L = g.stack.split(`
`), $ = x.length - 1, ie = L.length - 1; 1 <= $ && 0 <= ie && x[$] !== L[ie]; ) ie--;
        for (; 1 <= $ && 0 <= ie; $--, ie--) if (x[$] !== L[ie]) {
          if ($ !== 1 || ie !== 1)
            do
              if ($--, ie--, 0 > ie || x[$] !== L[ie]) {
                var de = `
` + x[$].replace(" at new ", " at ");
                return o.displayName && de.includes("<anonymous>") && (de = de.replace("<anonymous>", o.displayName)), de;
              }
            while (1 <= $ && 0 <= ie);
          break;
        }
      }
    } finally {
      dt = !1, Error.prepareStackTrace = c;
    }
    return (o = o ? o.displayName || o.name : "") ? Le(o) : "";
  }
  function Ft(o) {
    switch (o.tag) {
      case 5:
        return Le(o.type);
      case 16:
        return Le("Lazy");
      case 13:
        return Le("Suspense");
      case 19:
        return Le("SuspenseList");
      case 0:
      case 2:
      case 15:
        return o = vt(o.type, !1), o;
      case 11:
        return o = vt(o.type.render, !1), o;
      case 1:
        return o = vt(o.type, !0), o;
      default:
        return "";
    }
  }
  function Lt(o) {
    if (o == null) return null;
    if (typeof o == "function") return o.displayName || o.name || null;
    if (typeof o == "string") return o;
    switch (o) {
      case ke:
        return "Fragment";
      case pe:
        return "Portal";
      case ze:
        return "Profiler";
      case Ne:
        return "StrictMode";
      case Ht:
        return "Suspense";
      case Rt:
        return "SuspenseList";
    }
    if (typeof o == "object") switch (o.$$typeof) {
      case At:
        return (o.displayName || "Context") + ".Consumer";
      case Ze:
        return (o._context.displayName || "Context") + ".Provider";
      case et:
        var l = o.render;
        return o = o.displayName, o || (o = l.displayName || l.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
      case Ut:
        return l = o.displayName || null, l !== null ? l : Lt(o.type) || "Memo";
      case yt:
        l = o._payload, o = o._init;
        try {
          return Lt(o(l));
        } catch {
        }
    }
    return null;
  }
  function $t(o) {
    var l = o.type;
    switch (o.tag) {
      case 24:
        return "Cache";
      case 9:
        return (l.displayName || "Context") + ".Consumer";
      case 10:
        return (l._context.displayName || "Context") + ".Provider";
      case 18:
        return "DehydratedFragment";
      case 11:
        return o = l.render, o = o.displayName || o.name || "", l.displayName || (o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef");
      case 7:
        return "Fragment";
      case 5:
        return l;
      case 4:
        return "Portal";
      case 3:
        return "Root";
      case 6:
        return "Text";
      case 16:
        return Lt(l);
      case 8:
        return l === Ne ? "StrictMode" : "Mode";
      case 22:
        return "Offscreen";
      case 12:
        return "Profiler";
      case 21:
        return "Scope";
      case 13:
        return "Suspense";
      case 19:
        return "SuspenseList";
      case 25:
        return "TracingMarker";
      case 1:
      case 0:
      case 17:
      case 2:
      case 14:
      case 15:
        if (typeof l == "function") return l.displayName || l.name || null;
        if (typeof l == "string") return l;
    }
    return null;
  }
  function Te(o) {
    switch (typeof o) {
      case "boolean":
      case "number":
      case "string":
      case "undefined":
        return o;
      case "object":
        return o;
      default:
        return "";
    }
  }
  function be(o) {
    var l = o.type;
    return (o = o.nodeName) && o.toLowerCase() === "input" && (l === "checkbox" || l === "radio");
  }
  function ue(o) {
    var l = be(o) ? "checked" : "value", c = Object.getOwnPropertyDescriptor(o.constructor.prototype, l), g = "" + o[l];
    if (!o.hasOwnProperty(l) && typeof c < "u" && typeof c.get == "function" && typeof c.set == "function") {
      var x = c.get, L = c.set;
      return Object.defineProperty(o, l, { configurable: !0, get: function() {
        return x.call(this);
      }, set: function($) {
        g = "" + $, L.call(this, $);
      } }), Object.defineProperty(o, l, { enumerable: c.enumerable }), { getValue: function() {
        return g;
      }, setValue: function($) {
        g = "" + $;
      }, stopTracking: function() {
        o._valueTracker = null, delete o[l];
      } };
    }
  }
  function ge(o) {
    o._valueTracker || (o._valueTracker = ue(o));
  }
  function oe(o) {
    if (!o) return !1;
    var l = o._valueTracker;
    if (!l) return !0;
    var c = l.getValue(), g = "";
    return o && (g = be(o) ? o.checked ? "true" : "false" : o.value), o = g, o !== c ? (l.setValue(o), !0) : !1;
  }
  function Pe(o) {
    if (o = o || (typeof document < "u" ? document : void 0), typeof o > "u") return null;
    try {
      return o.activeElement || o.body;
    } catch {
      return o.body;
    }
  }
  function Ve(o, l) {
    var c = l.checked;
    return He({}, l, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: c ?? o._wrapperState.initialChecked });
  }
  function lt(o, l) {
    var c = l.defaultValue == null ? "" : l.defaultValue, g = l.checked != null ? l.checked : l.defaultChecked;
    c = Te(l.value != null ? l.value : c), o._wrapperState = { initialChecked: g, initialValue: c, controlled: l.type === "checkbox" || l.type === "radio" ? l.checked != null : l.value != null };
  }
  function Tt(o, l) {
    l = l.checked, l != null && se(o, "checked", l, !1);
  }
  function Yt(o, l) {
    Tt(o, l);
    var c = Te(l.value), g = l.type;
    if (c != null) g === "number" ? (c === 0 && o.value === "" || o.value != c) && (o.value = "" + c) : o.value !== "" + c && (o.value = "" + c);
    else if (g === "submit" || g === "reset") {
      o.removeAttribute("value");
      return;
    }
    l.hasOwnProperty("value") ? mr(o, l.type, c) : l.hasOwnProperty("defaultValue") && mr(o, l.type, Te(l.defaultValue)), l.checked == null && l.defaultChecked != null && (o.defaultChecked = !!l.defaultChecked);
  }
  function jt(o, l, c) {
    if (l.hasOwnProperty("value") || l.hasOwnProperty("defaultValue")) {
      var g = l.type;
      if (!(g !== "submit" && g !== "reset" || l.value !== void 0 && l.value !== null)) return;
      l = "" + o._wrapperState.initialValue, c || l === o.value || (o.value = l), o.defaultValue = l;
    }
    c = o.name, c !== "" && (o.name = ""), o.defaultChecked = !!o._wrapperState.initialChecked, c !== "" && (o.name = c);
  }
  function mr(o, l, c) {
    (l !== "number" || Pe(o.ownerDocument) !== o) && (c == null ? o.defaultValue = "" + o._wrapperState.initialValue : o.defaultValue !== "" + c && (o.defaultValue = "" + c));
  }
  var tr = Array.isArray;
  function yr(o, l, c, g) {
    if (o = o.options, l) {
      l = {};
      for (var x = 0; x < c.length; x++) l["$" + c[x]] = !0;
      for (c = 0; c < o.length; c++) x = l.hasOwnProperty("$" + o[c].value), o[c].selected !== x && (o[c].selected = x), x && g && (o[c].defaultSelected = !0);
    } else {
      for (c = "" + Te(c), l = null, x = 0; x < o.length; x++) {
        if (o[x].value === c) {
          o[x].selected = !0, g && (o[x].defaultSelected = !0);
          return;
        }
        l !== null || o[x].disabled || (l = o[x]);
      }
      l !== null && (l.selected = !0);
    }
  }
  function ar(o, l) {
    if (l.dangerouslySetInnerHTML != null) throw Error(t(91));
    return He({}, l, { value: void 0, defaultValue: void 0, children: "" + o._wrapperState.initialValue });
  }
  function Wr(o, l) {
    var c = l.value;
    if (c == null) {
      if (c = l.children, l = l.defaultValue, c != null) {
        if (l != null) throw Error(t(92));
        if (tr(c)) {
          if (1 < c.length) throw Error(t(93));
          c = c[0];
        }
        l = c;
      }
      l == null && (l = ""), c = l;
    }
    o._wrapperState = { initialValue: Te(c) };
  }
  function ki(o, l) {
    var c = Te(l.value), g = Te(l.defaultValue);
    c != null && (c = "" + c, c !== o.value && (o.value = c), l.defaultValue == null && o.defaultValue !== c && (o.defaultValue = c)), g != null && (o.defaultValue = "" + g);
  }
  function Hn(o) {
    var l = o.textContent;
    l === o._wrapperState.initialValue && l !== "" && l !== null && (o.value = l);
  }
  function _r(o) {
    switch (o) {
      case "svg":
        return "http://www.w3.org/2000/svg";
      case "math":
        return "http://www.w3.org/1998/Math/MathML";
      default:
        return "http://www.w3.org/1999/xhtml";
    }
  }
  function st(o, l) {
    return o == null || o === "http://www.w3.org/1999/xhtml" ? _r(l) : o === "http://www.w3.org/2000/svg" && l === "foreignObject" ? "http://www.w3.org/1999/xhtml" : o;
  }
  var ut, _t = (function(o) {
    return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(l, c, g, x) {
      MSApp.execUnsafeLocalFunction(function() {
        return o(l, c, g, x);
      });
    } : o;
  })(function(o, l) {
    if (o.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in o) o.innerHTML = l;
    else {
      for (ut = ut || document.createElement("div"), ut.innerHTML = "<svg>" + l.valueOf().toString() + "</svg>", l = ut.firstChild; o.firstChild; ) o.removeChild(o.firstChild);
      for (; l.firstChild; ) o.appendChild(l.firstChild);
    }
  });
  function Vt(o, l) {
    if (l) {
      var c = o.firstChild;
      if (c && c === o.lastChild && c.nodeType === 3) {
        c.nodeValue = l;
        return;
      }
    }
    o.textContent = l;
  }
  var Zt = {
    animationIterationCount: !0,
    aspectRatio: !0,
    borderImageOutset: !0,
    borderImageSlice: !0,
    borderImageWidth: !0,
    boxFlex: !0,
    boxFlexGroup: !0,
    boxOrdinalGroup: !0,
    columnCount: !0,
    columns: !0,
    flex: !0,
    flexGrow: !0,
    flexPositive: !0,
    flexShrink: !0,
    flexNegative: !0,
    flexOrder: !0,
    gridArea: !0,
    gridRow: !0,
    gridRowEnd: !0,
    gridRowSpan: !0,
    gridRowStart: !0,
    gridColumn: !0,
    gridColumnEnd: !0,
    gridColumnSpan: !0,
    gridColumnStart: !0,
    fontWeight: !0,
    lineClamp: !0,
    lineHeight: !0,
    opacity: !0,
    order: !0,
    orphans: !0,
    tabSize: !0,
    widows: !0,
    zIndex: !0,
    zoom: !0,
    fillOpacity: !0,
    floodOpacity: !0,
    stopOpacity: !0,
    strokeDasharray: !0,
    strokeDashoffset: !0,
    strokeMiterlimit: !0,
    strokeOpacity: !0,
    strokeWidth: !0
  }, tn = ["Webkit", "ms", "Moz", "O"];
  Object.keys(Zt).forEach(function(o) {
    tn.forEach(function(l) {
      l = l + o.charAt(0).toUpperCase() + o.substring(1), Zt[l] = Zt[o];
    });
  });
  function kr(o, l, c) {
    return l == null || typeof l == "boolean" || l === "" ? "" : c || typeof l != "number" || l === 0 || Zt.hasOwnProperty(o) && Zt[o] ? ("" + l).trim() : l + "px";
  }
  function xr(o, l) {
    o = o.style;
    for (var c in l) if (l.hasOwnProperty(c)) {
      var g = c.indexOf("--") === 0, x = kr(c, l[c], g);
      c === "float" && (c = "cssFloat"), g ? o.setProperty(c, x) : o[c] = x;
    }
  }
  var En = He({ menuitem: !0 }, { area: !0, base: !0, br: !0, col: !0, embed: !0, hr: !0, img: !0, input: !0, keygen: !0, link: !0, meta: !0, param: !0, source: !0, track: !0, wbr: !0 });
  function Vn(o, l) {
    if (l) {
      if (En[o] && (l.children != null || l.dangerouslySetInnerHTML != null)) throw Error(t(137, o));
      if (l.dangerouslySetInnerHTML != null) {
        if (l.children != null) throw Error(t(60));
        if (typeof l.dangerouslySetInnerHTML != "object" || !("__html" in l.dangerouslySetInnerHTML)) throw Error(t(61));
      }
      if (l.style != null && typeof l.style != "object") throw Error(t(62));
    }
  }
  function Rr(o, l) {
    if (o.indexOf("-") === -1) return typeof l.is == "string";
    switch (o) {
      case "annotation-xml":
      case "color-profile":
      case "font-face":
      case "font-face-src":
      case "font-face-uri":
      case "font-face-format":
      case "font-face-name":
      case "missing-glyph":
        return !1;
      default:
        return !0;
    }
  }
  var cn = null;
  function ri(o) {
    return o = o.target || o.srcElement || window, o.correspondingUseElement && (o = o.correspondingUseElement), o.nodeType === 3 ? o.parentNode : o;
  }
  var Un = null, rn = null, Xr = null;
  function gn(o) {
    if (o = Vl(o)) {
      if (typeof Un != "function") throw Error(t(280));
      var l = o.stateNode;
      l && (l = Yu(l), Un(o.stateNode, o.type, l));
    }
  }
  function qr(o) {
    rn ? Xr ? Xr.push(o) : Xr = [o] : rn = o;
  }
  function $n() {
    if (rn) {
      var o = rn, l = Xr;
      if (Xr = rn = null, gn(o), l) for (o = 0; o < l.length; o++) gn(l[o]);
    }
  }
  function wr(o, l) {
    return o(l);
  }
  function jr() {
  }
  var Q = !1;
  function X(o, l, c) {
    if (Q) return o(l, c);
    Q = !0;
    try {
      return wr(o, l, c);
    } finally {
      Q = !1, (rn !== null || Xr !== null) && (jr(), $n());
    }
  }
  function z(o, l) {
    var c = o.stateNode;
    if (c === null) return null;
    var g = Yu(c);
    if (g === null) return null;
    c = g[l];
    e: switch (l) {
      case "onClick":
      case "onClickCapture":
      case "onDoubleClick":
      case "onDoubleClickCapture":
      case "onMouseDown":
      case "onMouseDownCapture":
      case "onMouseMove":
      case "onMouseMoveCapture":
      case "onMouseUp":
      case "onMouseUpCapture":
      case "onMouseEnter":
        (g = !g.disabled) || (o = o.type, g = !(o === "button" || o === "input" || o === "select" || o === "textarea")), o = !g;
        break e;
      default:
        o = !1;
    }
    if (o) return null;
    if (c && typeof c != "function") throw Error(t(231, l, typeof c));
    return c;
  }
  var F = !1;
  if (u) try {
    var V = {};
    Object.defineProperty(V, "passive", { get: function() {
      F = !0;
    } }), window.addEventListener("test", V, V), window.removeEventListener("test", V, V);
  } catch {
    F = !1;
  }
  function G(o, l, c, g, x, L, $, ie, de) {
    var Ie = Array.prototype.slice.call(arguments, 3);
    try {
      l.apply(c, Ie);
    } catch (Je) {
      this.onError(Je);
    }
  }
  var re = !1, Ee = null, Be = !1, he = null, ne = { onError: function(o) {
    re = !0, Ee = o;
  } };
  function Ae(o, l, c, g, x, L, $, ie, de) {
    re = !1, Ee = null, G.apply(ne, arguments);
  }
  function Fe(o, l, c, g, x, L, $, ie, de) {
    if (Ae.apply(this, arguments), re) {
      if (re) {
        var Ie = Ee;
        re = !1, Ee = null;
      } else throw Error(t(198));
      Be || (Be = !0, he = Ie);
    }
  }
  function it(o) {
    var l = o, c = o;
    if (o.alternate) for (; l.return; ) l = l.return;
    else {
      o = l;
      do
        l = o, (l.flags & 4098) !== 0 && (c = l.return), o = l.return;
      while (o);
    }
    return l.tag === 3 ? c : null;
  }
  function Nt(o) {
    if (o.tag === 13) {
      var l = o.memoizedState;
      if (l === null && (o = o.alternate, o !== null && (l = o.memoizedState)), l !== null) return l.dehydrated;
    }
    return null;
  }
  function H(o) {
    if (it(o) !== o) throw Error(t(188));
  }
  function R(o) {
    var l = o.alternate;
    if (!l) {
      if (l = it(o), l === null) throw Error(t(188));
      return l !== o ? null : o;
    }
    for (var c = o, g = l; ; ) {
      var x = c.return;
      if (x === null) break;
      var L = x.alternate;
      if (L === null) {
        if (g = x.return, g !== null) {
          c = g;
          continue;
        }
        break;
      }
      if (x.child === L.child) {
        for (L = x.child; L; ) {
          if (L === c) return H(x), o;
          if (L === g) return H(x), l;
          L = L.sibling;
        }
        throw Error(t(188));
      }
      if (c.return !== g.return) c = x, g = L;
      else {
        for (var $ = !1, ie = x.child; ie; ) {
          if (ie === c) {
            $ = !0, c = x, g = L;
            break;
          }
          if (ie === g) {
            $ = !0, g = x, c = L;
            break;
          }
          ie = ie.sibling;
        }
        if (!$) {
          for (ie = L.child; ie; ) {
            if (ie === c) {
              $ = !0, c = L, g = x;
              break;
            }
            if (ie === g) {
              $ = !0, g = L, c = x;
              break;
            }
            ie = ie.sibling;
          }
          if (!$) throw Error(t(189));
        }
      }
      if (c.alternate !== g) throw Error(t(190));
    }
    if (c.tag !== 3) throw Error(t(188));
    return c.stateNode.current === c ? o : l;
  }
  function b(o) {
    return o = R(o), o !== null ? E(o) : null;
  }
  function E(o) {
    if (o.tag === 5 || o.tag === 6) return o;
    for (o = o.child; o !== null; ) {
      var l = E(o);
      if (l !== null) return l;
      o = o.sibling;
    }
    return null;
  }
  var B = e.unstable_scheduleCallback, K = e.unstable_cancelCallback, Z = e.unstable_shouldYield, ae = e.unstable_requestPaint, ye = e.unstable_now, Oe = e.unstable_getCurrentPriorityLevel, je = e.unstable_ImmediatePriority, $e = e.unstable_UserBlockingPriority, at = e.unstable_NormalPriority, Ot = e.unstable_LowPriority, er = e.unstable_IdlePriority, hr = null, Ir = null;
  function Qi(o) {
    if (Ir && typeof Ir.onCommitFiberRoot == "function") try {
      Ir.onCommitFiberRoot(hr, o, void 0, (o.current.flags & 128) === 128);
    } catch {
    }
  }
  var Yr = Math.clz32 ? Math.clz32 : Oa, Os = Math.log, zo = Math.LN2;
  function Oa(o) {
    return o >>>= 0, o === 0 ? 32 : 31 - (Os(o) / zo | 0) | 0;
  }
  var Wn = 64, jn = 4194304;
  function Xi(o) {
    switch (o & -o) {
      case 1:
        return 1;
      case 2:
        return 2;
      case 4:
        return 4;
      case 8:
        return 8;
      case 16:
        return 16;
      case 32:
        return 32;
      case 64:
      case 128:
      case 256:
      case 512:
      case 1024:
      case 2048:
      case 4096:
      case 8192:
      case 16384:
      case 32768:
      case 65536:
      case 131072:
      case 262144:
      case 524288:
      case 1048576:
      case 2097152:
        return o & 4194240;
      case 4194304:
      case 8388608:
      case 16777216:
      case 33554432:
      case 67108864:
        return o & 130023424;
      case 134217728:
        return 134217728;
      case 268435456:
        return 268435456;
      case 536870912:
        return 536870912;
      case 1073741824:
        return 1073741824;
      default:
        return o;
    }
  }
  function yn(o, l) {
    var c = o.pendingLanes;
    if (c === 0) return 0;
    var g = 0, x = o.suspendedLanes, L = o.pingedLanes, $ = c & 268435455;
    if ($ !== 0) {
      var ie = $ & ~x;
      ie !== 0 ? g = Xi(ie) : (L &= $, L !== 0 && (g = Xi(L)));
    } else $ = c & ~x, $ !== 0 ? g = Xi($) : L !== 0 && (g = Xi(L));
    if (g === 0) return 0;
    if (l !== 0 && l !== g && (l & x) === 0 && (x = g & -g, L = l & -l, x >= L || x === 16 && (L & 4194240) !== 0)) return l;
    if ((g & 4) !== 0 && (g |= c & 16), l = o.entangledLanes, l !== 0) for (o = o.entanglements, l &= g; 0 < l; ) c = 31 - Yr(l), x = 1 << c, g |= o[c], l &= ~x;
    return g;
  }
  function Ho(o, l) {
    switch (o) {
      case 1:
      case 2:
      case 4:
        return l + 250;
      case 8:
      case 16:
      case 32:
      case 64:
      case 128:
      case 256:
      case 512:
      case 1024:
      case 2048:
      case 4096:
      case 8192:
      case 16384:
      case 32768:
      case 65536:
      case 131072:
      case 262144:
      case 524288:
      case 1048576:
      case 2097152:
        return l + 5e3;
      case 4194304:
      case 8388608:
      case 16777216:
      case 33554432:
      case 67108864:
        return -1;
      case 134217728:
      case 268435456:
      case 536870912:
      case 1073741824:
        return -1;
      default:
        return -1;
    }
  }
  function no(o, l) {
    for (var c = o.suspendedLanes, g = o.pingedLanes, x = o.expirationTimes, L = o.pendingLanes; 0 < L; ) {
      var $ = 31 - Yr(L), ie = 1 << $, de = x[$];
      de === -1 ? ((ie & c) === 0 || (ie & g) !== 0) && (x[$] = Ho(ie, l)) : de <= l && (o.expiredLanes |= ie), L &= ~ie;
    }
  }
  function ha(o) {
    return o = o.pendingLanes & -1073741825, o !== 0 ? o : o & 1073741824 ? 1073741824 : 0;
  }
  function Da() {
    var o = Wn;
    return Wn <<= 1, (Wn & 4194240) === 0 && (Wn = 64), o;
  }
  function Aa(o) {
    for (var l = [], c = 0; 31 > c; c++) l.push(o);
    return l;
  }
  function Mn(o, l, c) {
    o.pendingLanes |= l, l !== 536870912 && (o.suspendedLanes = 0, o.pingedLanes = 0), o = o.eventTimes, l = 31 - Yr(l), o[l] = c;
  }
  function La(o, l) {
    var c = o.pendingLanes & ~l;
    o.pendingLanes = l, o.suspendedLanes = 0, o.pingedLanes = 0, o.expiredLanes &= l, o.mutableReadLanes &= l, o.entangledLanes &= l, l = o.entanglements;
    var g = o.eventTimes;
    for (o = o.expirationTimes; 0 < c; ) {
      var x = 31 - Yr(c), L = 1 << x;
      l[x] = 0, g[x] = -1, o[x] = -1, c &= ~L;
    }
  }
  function pa(o, l) {
    var c = o.entangledLanes |= l;
    for (o = o.entanglements; c; ) {
      var g = 31 - Yr(c), x = 1 << g;
      x & l | o[g] & l && (o[g] |= l), c &= ~x;
    }
  }
  var Qt = 0;
  function Vo(o) {
    return o &= -o, 1 < o ? 4 < o ? (o & 268435455) !== 0 ? 16 : 536870912 : 4 : 1;
  }
  var Uo, Ii, wi, bi, Ra, Yi = !1, Ci = [], Zr = null, ni = null, Pi = null, fn = /* @__PURE__ */ new Map(), va = /* @__PURE__ */ new Map(), Ti = [], io = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
  function $o(o, l) {
    switch (o) {
      case "focusin":
      case "focusout":
        Zr = null;
        break;
      case "dragenter":
      case "dragleave":
        ni = null;
        break;
      case "mouseover":
      case "mouseout":
        Pi = null;
        break;
      case "pointerover":
      case "pointerout":
        fn.delete(l.pointerId);
        break;
      case "gotpointercapture":
      case "lostpointercapture":
        va.delete(l.pointerId);
    }
  }
  function ii(o, l, c, g, x, L) {
    return o === null || o.nativeEvent !== L ? (o = { blockedOn: l, domEventName: c, eventSystemFlags: g, nativeEvent: L, targetContainers: [x] }, l !== null && (l = Vl(l), l !== null && Ii(l)), o) : (o.eventSystemFlags |= g, l = o.targetContainers, x !== null && l.indexOf(x) === -1 && l.push(x), o);
  }
  function ai(o, l, c, g, x) {
    switch (l) {
      case "focusin":
        return Zr = ii(Zr, o, l, c, g, x), !0;
      case "dragenter":
        return ni = ii(ni, o, l, c, g, x), !0;
      case "mouseover":
        return Pi = ii(Pi, o, l, c, g, x), !0;
      case "pointerover":
        var L = x.pointerId;
        return fn.set(L, ii(fn.get(L) || null, o, l, c, g, x)), !0;
      case "gotpointercapture":
        return L = x.pointerId, va.set(L, ii(va.get(L) || null, o, l, c, g, x)), !0;
    }
    return !1;
  }
  function ao(o) {
    var l = Yo(o.target);
    if (l !== null) {
      var c = it(l);
      if (c !== null) {
        if (l = c.tag, l === 13) {
          if (l = Nt(c), l !== null) {
            o.blockedOn = l, Ra(o.priority, function() {
              wi(c);
            });
            return;
          }
        } else if (l === 3 && c.stateNode.current.memoizedState.isDehydrated) {
          o.blockedOn = c.tag === 3 ? c.stateNode.containerInfo : null;
          return;
        }
      }
    }
    o.blockedOn = null;
  }
  function Ia(o) {
    if (o.blockedOn !== null) return !1;
    for (var l = o.targetContainers; 0 < l.length; ) {
      var c = Nn(o.domEventName, o.eventSystemFlags, l[0], o.nativeEvent);
      if (c === null) {
        c = o.nativeEvent;
        var g = new c.constructor(c.type, c);
        cn = g, c.target.dispatchEvent(g), cn = null;
      } else return l = Vl(c), l !== null && Ii(l), o.blockedOn = c, !1;
      l.shift();
    }
    return !0;
  }
  function Wo(o, l, c) {
    Ia(o) && c.delete(l);
  }
  function Sl() {
    Yi = !1, Zr !== null && Ia(Zr) && (Zr = null), ni !== null && Ia(ni) && (ni = null), Pi !== null && Ia(Pi) && (Pi = null), fn.forEach(Wo), va.forEach(Wo);
  }
  function St(o, l) {
    o.blockedOn === l && (o.blockedOn = null, Yi || (Yi = !0, e.unstable_scheduleCallback(e.unstable_NormalPriority, Sl)));
  }
  function Se(o) {
    function l(x) {
      return St(x, o);
    }
    if (0 < Ci.length) {
      St(Ci[0], o);
      for (var c = 1; c < Ci.length; c++) {
        var g = Ci[c];
        g.blockedOn === o && (g.blockedOn = null);
      }
    }
    for (Zr !== null && St(Zr, o), ni !== null && St(ni, o), Pi !== null && St(Pi, o), fn.forEach(l), va.forEach(l), c = 0; c < Ti.length; c++) g = Ti[c], g.blockedOn === o && (g.blockedOn = null);
    for (; 0 < Ti.length && (c = Ti[0], c.blockedOn === null); ) ao(c), c.blockedOn === null && Ti.shift();
  }
  var tt = me.ReactCurrentBatchConfig, wt = !0;
  function sr(o, l, c, g) {
    var x = Qt, L = tt.transition;
    tt.transition = null;
    try {
      Qt = 1, Pr(o, l, c, g);
    } finally {
      Qt = x, tt.transition = L;
    }
  }
  function Gr(o, l, c, g) {
    var x = Qt, L = tt.transition;
    tt.transition = null;
    try {
      Qt = 4, Pr(o, l, c, g);
    } finally {
      Qt = x, tt.transition = L;
    }
  }
  function Pr(o, l, c, g) {
    if (wt) {
      var x = Nn(o, l, c, g);
      if (x === null) ve(o, l, g, Mr, c), $o(o, g);
      else if (ai(x, o, l, c, g)) g.stopPropagation();
      else if ($o(o, g), l & 4 && -1 < io.indexOf(o)) {
        for (; x !== null; ) {
          var L = Vl(x);
          if (L !== null && Uo(L), L = Nn(o, l, c, g), L === null && ve(o, l, g, Mr, c), L === x) break;
          x = L;
        }
        x !== null && g.stopPropagation();
      } else ve(o, l, g, null, c);
    }
  }
  var Mr = null;
  function Nn(o, l, c, g) {
    if (Mr = null, o = ri(g), o = Yo(o), o !== null) if (l = it(o), l === null) o = null;
    else if (c = l.tag, c === 13) {
      if (o = Nt(l), o !== null) return o;
      o = null;
    } else if (c === 3) {
      if (l.stateNode.current.memoizedState.isDehydrated) return l.tag === 3 ? l.stateNode.containerInfo : null;
      o = null;
    } else l !== o && (o = null);
    return Mr = o, null;
  }
  function Zi(o) {
    switch (o) {
      case "cancel":
      case "click":
      case "close":
      case "contextmenu":
      case "copy":
      case "cut":
      case "auxclick":
      case "dblclick":
      case "dragend":
      case "dragstart":
      case "drop":
      case "focusin":
      case "focusout":
      case "input":
      case "invalid":
      case "keydown":
      case "keypress":
      case "keyup":
      case "mousedown":
      case "mouseup":
      case "paste":
      case "pause":
      case "play":
      case "pointercancel":
      case "pointerdown":
      case "pointerup":
      case "ratechange":
      case "reset":
      case "resize":
      case "seeked":
      case "submit":
      case "touchcancel":
      case "touchend":
      case "touchstart":
      case "volumechange":
      case "change":
      case "selectionchange":
      case "textInput":
      case "compositionstart":
      case "compositionend":
      case "compositionupdate":
      case "beforeblur":
      case "afterblur":
      case "beforeinput":
      case "blur":
      case "fullscreenchange":
      case "focus":
      case "hashchange":
      case "popstate":
      case "select":
      case "selectstart":
        return 1;
      case "drag":
      case "dragenter":
      case "dragexit":
      case "dragleave":
      case "dragover":
      case "mousemove":
      case "mouseout":
      case "mouseover":
      case "pointermove":
      case "pointerout":
      case "pointerover":
      case "scroll":
      case "toggle":
      case "touchmove":
      case "wheel":
      case "mouseenter":
      case "mouseleave":
      case "pointerenter":
      case "pointerleave":
        return 4;
      case "message":
        switch (Oe()) {
          case je:
            return 1;
          case $e:
            return 4;
          case at:
          case Ot:
            return 16;
          case er:
            return 536870912;
          default:
            return 16;
        }
      default:
        return 16;
    }
  }
  var oi = null, oo = null, Pa = null;
  function Ru() {
    if (Pa) return Pa;
    var o, l = oo, c = l.length, g, x = "value" in oi ? oi.value : oi.textContent, L = x.length;
    for (o = 0; o < c && l[o] === x[o]; o++) ;
    var $ = c - o;
    for (g = 1; g <= $ && l[c - g] === x[L - g]; g++) ;
    return Pa = x.slice(o, 1 < g ? 1 - g : void 0);
  }
  function Ds(o) {
    var l = o.keyCode;
    return "charCode" in o ? (o = o.charCode, o === 0 && l === 13 && (o = 13)) : o = l, o === 10 && (o = 13), 32 <= o || o === 13 ? o : 0;
  }
  function As() {
    return !0;
  }
  function Iu() {
    return !1;
  }
  function br(o) {
    function l(c, g, x, L, $) {
      this._reactName = c, this._targetInst = x, this.type = g, this.nativeEvent = L, this.target = $, this.currentTarget = null;
      for (var ie in o) o.hasOwnProperty(ie) && (c = o[ie], this[ie] = c ? c(L) : L[ie]);
      return this.isDefaultPrevented = (L.defaultPrevented != null ? L.defaultPrevented : L.returnValue === !1) ? As : Iu, this.isPropagationStopped = Iu, this;
    }
    return He(l.prototype, { preventDefault: function() {
      this.defaultPrevented = !0;
      var c = this.nativeEvent;
      c && (c.preventDefault ? c.preventDefault() : typeof c.returnValue != "unknown" && (c.returnValue = !1), this.isDefaultPrevented = As);
    }, stopPropagation: function() {
      var c = this.nativeEvent;
      c && (c.stopPropagation ? c.stopPropagation() : typeof c.cancelBubble != "unknown" && (c.cancelBubble = !0), this.isPropagationStopped = As);
    }, persist: function() {
    }, isPersistent: As }), l;
  }
  var zr = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(o) {
    return o.timeStamp || Date.now();
  }, defaultPrevented: 0, isTrusted: 0 }, xl = br(zr), jo = He({}, zr, { view: 0, detail: 0 }), bf = br(jo), Bi, El, Ba, so = He({}, jo, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: Rs, button: 0, buttons: 0, relatedTarget: function(o) {
    return o.relatedTarget === void 0 ? o.fromElement === o.srcElement ? o.toElement : o.fromElement : o.relatedTarget;
  }, movementX: function(o) {
    return "movementX" in o ? o.movementX : (o !== Ba && (Ba && o.type === "mousemove" ? (Bi = o.screenX - Ba.screenX, El = o.screenY - Ba.screenY) : El = Bi = 0, Ba = o), Bi);
  }, movementY: function(o) {
    return "movementY" in o ? o.movementY : El;
  } }), Pu = br(so), Cf = He({}, so, { dataTransfer: 0 }), Ls = br(Cf), Tf = He({}, jo, { relatedTarget: 0 }), Go = br(Tf), lo = He({}, zr, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), Sf = br(lo), xf = He({}, zr, { clipboardData: function(o) {
    return "clipboardData" in o ? o.clipboardData : window.clipboardData;
  } }), Ef = br(xf), Mf = He({}, zr, { data: 0 }), Bu = br(Mf), Nf = {
    Esc: "Escape",
    Spacebar: " ",
    Left: "ArrowLeft",
    Up: "ArrowUp",
    Right: "ArrowRight",
    Down: "ArrowDown",
    Del: "Delete",
    Win: "OS",
    Menu: "ContextMenu",
    Apps: "ContextMenu",
    Scroll: "ScrollLock",
    MozPrintableKey: "Unidentified"
  }, Ml = {
    8: "Backspace",
    9: "Tab",
    12: "Clear",
    13: "Enter",
    16: "Shift",
    17: "Control",
    18: "Alt",
    19: "Pause",
    20: "CapsLock",
    27: "Escape",
    32: " ",
    33: "PageUp",
    34: "PageDown",
    35: "End",
    36: "Home",
    37: "ArrowLeft",
    38: "ArrowUp",
    39: "ArrowRight",
    40: "ArrowDown",
    45: "Insert",
    46: "Delete",
    112: "F1",
    113: "F2",
    114: "F3",
    115: "F4",
    116: "F5",
    117: "F6",
    118: "F7",
    119: "F8",
    120: "F9",
    121: "F10",
    122: "F11",
    123: "F12",
    144: "NumLock",
    145: "ScrollLock",
    224: "Meta"
  }, Fu = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" };
  function Of(o) {
    var l = this.nativeEvent;
    return l.getModifierState ? l.getModifierState(o) : (o = Fu[o]) ? !!l[o] : !1;
  }
  function Rs() {
    return Of;
  }
  var Df = He({}, jo, { key: function(o) {
    if (o.key) {
      var l = Nf[o.key] || o.key;
      if (l !== "Unidentified") return l;
    }
    return o.type === "keypress" ? (o = Ds(o), o === 13 ? "Enter" : String.fromCharCode(o)) : o.type === "keydown" || o.type === "keyup" ? Ml[o.keyCode] || "Unidentified" : "";
  }, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: Rs, charCode: function(o) {
    return o.type === "keypress" ? Ds(o) : 0;
  }, keyCode: function(o) {
    return o.type === "keydown" || o.type === "keyup" ? o.keyCode : 0;
  }, which: function(o) {
    return o.type === "keypress" ? Ds(o) : o.type === "keydown" || o.type === "keyup" ? o.keyCode : 0;
  } }), Af = br(Df), _u = He({}, so, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Nl = br(_u), Lf = He({}, jo, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: Rs }), Rf = br(Lf), Ko = He({}, zr, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), If = br(Ko), Jo = He({}, so, {
    deltaX: function(o) {
      return "deltaX" in o ? o.deltaX : "wheelDeltaX" in o ? -o.wheelDeltaX : 0;
    },
    deltaY: function(o) {
      return "deltaY" in o ? o.deltaY : "wheelDeltaY" in o ? -o.wheelDeltaY : "wheelDelta" in o ? -o.wheelDelta : 0;
    },
    deltaZ: 0,
    deltaMode: 0
  }), Pf = br(Jo), Bf = [9, 13, 27, 32], Fa = u && "CompositionEvent" in window, uo = null;
  u && "documentMode" in document && (uo = document.documentMode);
  var qu = u && "TextEvent" in window && !uo, zu = u && (!Fa || uo && 8 < uo && 11 >= uo), Ol = " ", Hu = !1;
  function Dl(o, l) {
    switch (o) {
      case "keyup":
        return Bf.indexOf(l.keyCode) !== -1;
      case "keydown":
        return l.keyCode !== 229;
      case "keypress":
      case "mousedown":
      case "focusout":
        return !0;
      default:
        return !1;
    }
  }
  function co(o) {
    return o = o.detail, typeof o == "object" && "data" in o ? o.data : null;
  }
  var _a = !1;
  function Qo(o, l) {
    switch (o) {
      case "compositionend":
        return co(l);
      case "keypress":
        return l.which !== 32 ? null : (Hu = !0, Ol);
      case "textInput":
        return o = l.data, o === Ol && Hu ? null : o;
      default:
        return null;
    }
  }
  function Ff(o, l) {
    if (_a) return o === "compositionend" || !Fa && Dl(o, l) ? (o = Ru(), Pa = oo = oi = null, _a = !1, o) : null;
    switch (o) {
      case "paste":
        return null;
      case "keypress":
        if (!(l.ctrlKey || l.altKey || l.metaKey) || l.ctrlKey && l.altKey) {
          if (l.char && 1 < l.char.length) return l.char;
          if (l.which) return String.fromCharCode(l.which);
        }
        return null;
      case "compositionend":
        return zu && l.locale !== "ko" ? null : l.data;
      default:
        return null;
    }
  }
  var qa = { color: !0, date: !0, datetime: !0, "datetime-local": !0, email: !0, month: !0, number: !0, password: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0 };
  function za(o) {
    var l = o && o.nodeName && o.nodeName.toLowerCase();
    return l === "input" ? !!qa[o.type] : l === "textarea";
  }
  function ma(o, l, c, g) {
    qr(g), l = Ue(l, "onChange"), 0 < l.length && (c = new xl("onChange", "change", null, c, g), o.push({ event: c, listeners: l }));
  }
  var kn = null, Hr = null;
  function Vu(o) {
    P(o, 0);
  }
  function Is(o) {
    var l = Us(o);
    if (oe(l)) return o;
  }
  function Uu(o, l) {
    if (o === "change") return l;
  }
  var $u = !1;
  if (u) {
    var Ps;
    if (u) {
      var Bs = "oninput" in document;
      if (!Bs) {
        var Xo = document.createElement("div");
        Xo.setAttribute("oninput", "return;"), Bs = typeof Xo.oninput == "function";
      }
      Ps = Bs;
    } else Ps = !1;
    $u = Ps && (!document.documentMode || 9 < document.documentMode);
  }
  function ga() {
    kn && (kn.detachEvent("onpropertychange", Fs), Hr = kn = null);
  }
  function Fs(o) {
    if (o.propertyName === "value" && Is(Hr)) {
      var l = [];
      ma(l, Hr, o, ri(o)), X(Vu, l);
    }
  }
  function Wu(o, l, c) {
    o === "focusin" ? (ga(), kn = l, Hr = c, kn.attachEvent("onpropertychange", Fs)) : o === "focusout" && ga();
  }
  function Al(o) {
    if (o === "selectionchange" || o === "keyup" || o === "keydown") return Is(Hr);
  }
  function _f(o, l) {
    if (o === "click") return Is(l);
  }
  function qf(o, l) {
    if (o === "input" || o === "change") return Is(l);
  }
  function zf(o, l) {
    return o === l && (o !== 0 || 1 / o === 1 / l) || o !== o && l !== l;
  }
  var Si = typeof Object.is == "function" ? Object.is : zf;
  function fo(o, l) {
    if (Si(o, l)) return !0;
    if (typeof o != "object" || o === null || typeof l != "object" || l === null) return !1;
    var c = Object.keys(o), g = Object.keys(l);
    if (c.length !== g.length) return !1;
    for (g = 0; g < c.length; g++) {
      var x = c[g];
      if (!f.call(l, x) || !Si(o[x], l[x])) return !1;
    }
    return !0;
  }
  function Ll(o) {
    for (; o && o.firstChild; ) o = o.firstChild;
    return o;
  }
  function ju(o, l) {
    var c = Ll(o);
    o = 0;
    for (var g; c; ) {
      if (c.nodeType === 3) {
        if (g = o + c.textContent.length, o <= l && g >= l) return { node: c, offset: l - o };
        o = g;
      }
      e: {
        for (; c; ) {
          if (c.nextSibling) {
            c = c.nextSibling;
            break e;
          }
          c = c.parentNode;
        }
        c = void 0;
      }
      c = Ll(c);
    }
  }
  function Rl(o, l) {
    return o && l ? o === l ? !0 : o && o.nodeType === 3 ? !1 : l && l.nodeType === 3 ? Rl(o, l.parentNode) : "contains" in o ? o.contains(l) : o.compareDocumentPosition ? !!(o.compareDocumentPosition(l) & 16) : !1 : !1;
  }
  function Gu() {
    for (var o = window, l = Pe(); l instanceof o.HTMLIFrameElement; ) {
      try {
        var c = typeof l.contentWindow.location.href == "string";
      } catch {
        c = !1;
      }
      if (c) o = l.contentWindow;
      else break;
      l = Pe(o.document);
    }
    return l;
  }
  function Il(o) {
    var l = o && o.nodeName && o.nodeName.toLowerCase();
    return l && (l === "input" && (o.type === "text" || o.type === "search" || o.type === "tel" || o.type === "url" || o.type === "password") || l === "textarea" || o.contentEditable === "true");
  }
  function Hf(o) {
    var l = Gu(), c = o.focusedElem, g = o.selectionRange;
    if (l !== c && c && c.ownerDocument && Rl(c.ownerDocument.documentElement, c)) {
      if (g !== null && Il(c)) {
        if (l = g.start, o = g.end, o === void 0 && (o = l), "selectionStart" in c) c.selectionStart = l, c.selectionEnd = Math.min(o, c.value.length);
        else if (o = (l = c.ownerDocument || document) && l.defaultView || window, o.getSelection) {
          o = o.getSelection();
          var x = c.textContent.length, L = Math.min(g.start, x);
          g = g.end === void 0 ? L : Math.min(g.end, x), !o.extend && L > g && (x = g, g = L, L = x), x = ju(c, L);
          var $ = ju(
            c,
            g
          );
          x && $ && (o.rangeCount !== 1 || o.anchorNode !== x.node || o.anchorOffset !== x.offset || o.focusNode !== $.node || o.focusOffset !== $.offset) && (l = l.createRange(), l.setStart(x.node, x.offset), o.removeAllRanges(), L > g ? (o.addRange(l), o.extend($.node, $.offset)) : (l.setEnd($.node, $.offset), o.addRange(l)));
        }
      }
      for (l = [], o = c; o = o.parentNode; ) o.nodeType === 1 && l.push({ element: o, left: o.scrollLeft, top: o.scrollTop });
      for (typeof c.focus == "function" && c.focus(), c = 0; c < l.length; c++) o = l[c], o.element.scrollLeft = o.left, o.element.scrollTop = o.top;
    }
  }
  var Vf = u && "documentMode" in document && 11 >= document.documentMode, ho = null, Pl = null, po = null, Bl = !1;
  function Ku(o, l, c) {
    var g = c.window === c ? c.document : c.nodeType === 9 ? c : c.ownerDocument;
    Bl || ho == null || ho !== Pe(g) || (g = ho, "selectionStart" in g && Il(g) ? g = { start: g.selectionStart, end: g.selectionEnd } : (g = (g.ownerDocument && g.ownerDocument.defaultView || window).getSelection(), g = { anchorNode: g.anchorNode, anchorOffset: g.anchorOffset, focusNode: g.focusNode, focusOffset: g.focusOffset }), po && fo(po, g) || (po = g, g = Ue(Pl, "onSelect"), 0 < g.length && (l = new xl("onSelect", "select", null, l, c), o.push({ event: l, listeners: g }), l.target = ho)));
  }
  function vo(o, l) {
    var c = {};
    return c[o.toLowerCase()] = l.toLowerCase(), c["Webkit" + o] = "webkit" + l, c["Moz" + o] = "moz" + l, c;
  }
  var mo = { animationend: vo("Animation", "AnimationEnd"), animationiteration: vo("Animation", "AnimationIteration"), animationstart: vo("Animation", "AnimationStart"), transitionend: vo("Transition", "TransitionEnd") }, _s = {}, Ju = {};
  u && (Ju = document.createElement("div").style, "AnimationEvent" in window || (delete mo.animationend.animation, delete mo.animationiteration.animation, delete mo.animationstart.animation), "TransitionEvent" in window || delete mo.transitionend.transition);
  function qs(o) {
    if (_s[o]) return _s[o];
    if (!mo[o]) return o;
    var l = mo[o], c;
    for (c in l) if (l.hasOwnProperty(c) && c in Ju) return _s[o] = l[c];
    return o;
  }
  var Fl = qs("animationend"), _l = qs("animationiteration"), ql = qs("animationstart"), zl = qs("transitionend"), Qu = /* @__PURE__ */ new Map(), Hl = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
  function ya(o, l) {
    Qu.set(o, l), a(l, [o]);
  }
  for (var zs = 0; zs < Hl.length; zs++) {
    var d = Hl[zs], w = d.toLowerCase(), h = d[0].toUpperCase() + d.slice(1);
    ya(w, "on" + h);
  }
  ya(Fl, "onAnimationEnd"), ya(_l, "onAnimationIteration"), ya(ql, "onAnimationStart"), ya("dblclick", "onDoubleClick"), ya("focusin", "onFocus"), ya("focusout", "onBlur"), ya(zl, "onTransitionEnd"), s("onMouseEnter", ["mouseout", "mouseover"]), s("onMouseLeave", ["mouseout", "mouseover"]), s("onPointerEnter", ["pointerout", "pointerover"]), s("onPointerLeave", ["pointerout", "pointerover"]), a("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")), a("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")), a("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]), a("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")), a("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")), a("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
  var k = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "), S = new Set("cancel close invalid load scroll toggle".split(" ").concat(k));
  function M(o, l, c) {
    var g = o.type || "unknown-event";
    o.currentTarget = c, Fe(g, l, void 0, o), o.currentTarget = null;
  }
  function P(o, l) {
    l = (l & 4) !== 0;
    for (var c = 0; c < o.length; c++) {
      var g = o[c], x = g.event;
      g = g.listeners;
      e: {
        var L = void 0;
        if (l) for (var $ = g.length - 1; 0 <= $; $--) {
          var ie = g[$], de = ie.instance, Ie = ie.currentTarget;
          if (ie = ie.listener, de !== L && x.isPropagationStopped()) break e;
          M(x, ie, Ie), L = de;
        }
        else for ($ = 0; $ < g.length; $++) {
          if (ie = g[$], de = ie.instance, Ie = ie.currentTarget, ie = ie.listener, de !== L && x.isPropagationStopped()) break e;
          M(x, ie, Ie), L = de;
        }
      }
    }
    if (Be) throw o = he, Be = !1, he = null, o;
  }
  function I(o, l) {
    var c = l[Vs];
    c === void 0 && (c = l[Vs] = /* @__PURE__ */ new Set());
    var g = o + "__bubble";
    c.has(g) || (xe(l, o, 2, !1), c.add(g));
  }
  function W(o, l, c) {
    var g = 0;
    l && (g |= 4), xe(c, o, g, l);
  }
  var Y = "_reactListening" + Math.random().toString(36).slice(2);
  function le(o) {
    if (!o[Y]) {
      o[Y] = !0, n.forEach(function(c) {
        c !== "selectionchange" && (S.has(c) || W(c, !1, o), W(c, !0, o));
      });
      var l = o.nodeType === 9 ? o : o.ownerDocument;
      l === null || l[Y] || (l[Y] = !0, W("selectionchange", !1, l));
    }
  }
  function xe(o, l, c, g) {
    switch (Zi(l)) {
      case 1:
        var x = sr;
        break;
      case 4:
        x = Gr;
        break;
      default:
        x = Pr;
    }
    c = x.bind(null, l, c, o), x = void 0, !F || l !== "touchstart" && l !== "touchmove" && l !== "wheel" || (x = !0), g ? x !== void 0 ? o.addEventListener(l, c, { capture: !0, passive: x }) : o.addEventListener(l, c, !0) : x !== void 0 ? o.addEventListener(l, c, { passive: x }) : o.addEventListener(l, c, !1);
  }
  function ve(o, l, c, g, x) {
    var L = g;
    if ((l & 1) === 0 && (l & 2) === 0 && g !== null) e: for (; ; ) {
      if (g === null) return;
      var $ = g.tag;
      if ($ === 3 || $ === 4) {
        var ie = g.stateNode.containerInfo;
        if (ie === x || ie.nodeType === 8 && ie.parentNode === x) break;
        if ($ === 4) for ($ = g.return; $ !== null; ) {
          var de = $.tag;
          if ((de === 3 || de === 4) && (de = $.stateNode.containerInfo, de === x || de.nodeType === 8 && de.parentNode === x)) return;
          $ = $.return;
        }
        for (; ie !== null; ) {
          if ($ = Yo(ie), $ === null) return;
          if (de = $.tag, de === 5 || de === 6) {
            g = L = $;
            continue e;
          }
          ie = ie.parentNode;
        }
      }
      g = g.return;
    }
    X(function() {
      var Ie = L, Je = ri(c), Ye = [];
      e: {
        var Ge = Qu.get(o);
        if (Ge !== void 0) {
          var pt = xl, Ct = o;
          switch (o) {
            case "keypress":
              if (Ds(c) === 0) break e;
            case "keydown":
            case "keyup":
              pt = Af;
              break;
            case "focusin":
              Ct = "focus", pt = Go;
              break;
            case "focusout":
              Ct = "blur", pt = Go;
              break;
            case "beforeblur":
            case "afterblur":
              pt = Go;
              break;
            case "click":
              if (c.button === 2) break e;
            case "auxclick":
            case "dblclick":
            case "mousedown":
            case "mousemove":
            case "mouseup":
            case "mouseout":
            case "mouseover":
            case "contextmenu":
              pt = Pu;
              break;
            case "drag":
            case "dragend":
            case "dragenter":
            case "dragexit":
            case "dragleave":
            case "dragover":
            case "dragstart":
            case "drop":
              pt = Ls;
              break;
            case "touchcancel":
            case "touchend":
            case "touchmove":
            case "touchstart":
              pt = Rf;
              break;
            case Fl:
            case _l:
            case ql:
              pt = Sf;
              break;
            case zl:
              pt = If;
              break;
            case "scroll":
              pt = bf;
              break;
            case "wheel":
              pt = Pf;
              break;
            case "copy":
            case "cut":
            case "paste":
              pt = Ef;
              break;
            case "gotpointercapture":
            case "lostpointercapture":
            case "pointercancel":
            case "pointerdown":
            case "pointermove":
            case "pointerout":
            case "pointerover":
            case "pointerup":
              pt = Nl;
          }
          var xt = (l & 4) !== 0, Kr = !xt && o === "scroll", Me = xt ? Ge !== null ? Ge + "Capture" : null : Ge;
          xt = [];
          for (var we = Ie, De; we !== null; ) {
            De = we;
            var rt = De.stateNode;
            if (De.tag === 5 && rt !== null && (De = rt, Me !== null && (rt = z(we, Me), rt != null && xt.push(Re(we, rt, De)))), Kr) break;
            we = we.return;
          }
          0 < xt.length && (Ge = new pt(Ge, Ct, null, c, Je), Ye.push({ event: Ge, listeners: xt }));
        }
      }
      if ((l & 7) === 0) {
        e: {
          if (Ge = o === "mouseover" || o === "pointerover", pt = o === "mouseout" || o === "pointerout", Ge && c !== cn && (Ct = c.relatedTarget || c.fromElement) && (Yo(Ct) || Ct[Or])) break e;
          if ((pt || Ge) && (Ge = Je.window === Je ? Je : (Ge = Je.ownerDocument) ? Ge.defaultView || Ge.parentWindow : window, pt ? (Ct = c.relatedTarget || c.toElement, pt = Ie, Ct = Ct ? Yo(Ct) : null, Ct !== null && (Kr = it(Ct), Ct !== Kr || Ct.tag !== 5 && Ct.tag !== 6) && (Ct = null)) : (pt = null, Ct = Ie), pt !== Ct)) {
            if (xt = Pu, rt = "onMouseLeave", Me = "onMouseEnter", we = "mouse", (o === "pointerout" || o === "pointerover") && (xt = Nl, rt = "onPointerLeave", Me = "onPointerEnter", we = "pointer"), Kr = pt == null ? Ge : Us(pt), De = Ct == null ? Ge : Us(Ct), Ge = new xt(rt, we + "leave", pt, c, Je), Ge.target = Kr, Ge.relatedTarget = De, rt = null, Yo(Je) === Ie && (xt = new xt(Me, we + "enter", Ct, c, Je), xt.target = De, xt.relatedTarget = Kr, rt = xt), Kr = rt, pt && Ct) t: {
              for (xt = pt, Me = Ct, we = 0, De = xt; De; De = nt(De)) we++;
              for (De = 0, rt = Me; rt; rt = nt(rt)) De++;
              for (; 0 < we - De; ) xt = nt(xt), we--;
              for (; 0 < De - we; ) Me = nt(Me), De--;
              for (; we--; ) {
                if (xt === Me || Me !== null && xt === Me.alternate) break t;
                xt = nt(xt), Me = nt(Me);
              }
              xt = null;
            }
            else xt = null;
            pt !== null && gt(Ye, Ge, pt, xt, !1), Ct !== null && Kr !== null && gt(Ye, Kr, Ct, xt, !0);
          }
        }
        e: {
          if (Ge = Ie ? Us(Ie) : window, pt = Ge.nodeName && Ge.nodeName.toLowerCase(), pt === "select" || pt === "input" && Ge.type === "file") var Et = Uu;
          else if (za(Ge)) if ($u) Et = qf;
          else {
            Et = Al;
            var qt = Wu;
          }
          else (pt = Ge.nodeName) && pt.toLowerCase() === "input" && (Ge.type === "checkbox" || Ge.type === "radio") && (Et = _f);
          if (Et && (Et = Et(o, Ie))) {
            ma(Ye, Et, c, Je);
            break e;
          }
          qt && qt(o, Ge, Ie), o === "focusout" && (qt = Ge._wrapperState) && qt.controlled && Ge.type === "number" && mr(Ge, "number", Ge.value);
        }
        switch (qt = Ie ? Us(Ie) : window, o) {
          case "focusin":
            (za(qt) || qt.contentEditable === "true") && (ho = qt, Pl = Ie, po = null);
            break;
          case "focusout":
            po = Pl = ho = null;
            break;
          case "mousedown":
            Bl = !0;
            break;
          case "contextmenu":
          case "mouseup":
          case "dragend":
            Bl = !1, Ku(Ye, c, Je);
            break;
          case "selectionchange":
            if (Vf) break;
          case "keydown":
          case "keyup":
            Ku(Ye, c, Je);
        }
        var zt;
        if (Fa) e: {
          switch (o) {
            case "compositionstart":
              var Wt = "onCompositionStart";
              break e;
            case "compositionend":
              Wt = "onCompositionEnd";
              break e;
            case "compositionupdate":
              Wt = "onCompositionUpdate";
              break e;
          }
          Wt = void 0;
        }
        else _a ? Dl(o, c) && (Wt = "onCompositionEnd") : o === "keydown" && c.keyCode === 229 && (Wt = "onCompositionStart");
        Wt && (zu && c.locale !== "ko" && (_a || Wt !== "onCompositionStart" ? Wt === "onCompositionEnd" && _a && (zt = Ru()) : (oi = Je, oo = "value" in oi ? oi.value : oi.textContent, _a = !0)), qt = Ue(Ie, Wt), 0 < qt.length && (Wt = new Bu(Wt, o, null, c, Je), Ye.push({ event: Wt, listeners: qt }), zt ? Wt.data = zt : (zt = co(c), zt !== null && (Wt.data = zt)))), (zt = qu ? Qo(o, c) : Ff(o, c)) && (Ie = Ue(Ie, "onBeforeInput"), 0 < Ie.length && (Je = new Bu("onBeforeInput", "beforeinput", null, c, Je), Ye.push({ event: Je, listeners: Ie }), Je.data = zt));
      }
      P(Ye, l);
    });
  }
  function Re(o, l, c) {
    return { instance: o, listener: l, currentTarget: c };
  }
  function Ue(o, l) {
    for (var c = l + "Capture", g = []; o !== null; ) {
      var x = o, L = x.stateNode;
      x.tag === 5 && L !== null && (x = L, L = z(o, c), L != null && g.unshift(Re(o, L, x)), L = z(o, l), L != null && g.push(Re(o, L, x))), o = o.return;
    }
    return g;
  }
  function nt(o) {
    if (o === null) return null;
    do
      o = o.return;
    while (o && o.tag !== 5);
    return o || null;
  }
  function gt(o, l, c, g, x) {
    for (var L = l._reactName, $ = []; c !== null && c !== g; ) {
      var ie = c, de = ie.alternate, Ie = ie.stateNode;
      if (de !== null && de === g) break;
      ie.tag === 5 && Ie !== null && (ie = Ie, x ? (de = z(c, L), de != null && $.unshift(Re(c, de, ie))) : x || (de = z(c, L), de != null && $.push(Re(c, de, ie)))), c = c.return;
    }
    $.length !== 0 && o.push({ event: l, listeners: $ });
  }
  var Xe = /\r\n?/g, rr = /\u0000|\uFFFD/g;
  function Jt(o) {
    return (typeof o == "string" ? o : "" + o).replace(Xe, `
`).replace(rr, "");
  }
  function Dt(o, l, c) {
    if (l = Jt(l), Jt(o) !== l && c) throw Error(t(425));
  }
  function Gt() {
  }
  var lr = null, or = null;
  function Nr(o, l) {
    return o === "textarea" || o === "noscript" || typeof l.children == "string" || typeof l.children == "number" || typeof l.dangerouslySetInnerHTML == "object" && l.dangerouslySetInnerHTML !== null && l.dangerouslySetInnerHTML.__html != null;
  }
  var Ar = typeof setTimeout == "function" ? setTimeout : void 0, Vr = typeof clearTimeout == "function" ? clearTimeout : void 0, xi = typeof Promise == "function" ? Promise : void 0, Hs = typeof queueMicrotask == "function" ? queueMicrotask : typeof xi < "u" ? function(o) {
    return xi.resolve(null).then(o).catch(ea);
  } : Ar;
  function ea(o) {
    setTimeout(function() {
      throw o;
    });
  }
  function ta(o, l) {
    var c = l, g = 0;
    do {
      var x = c.nextSibling;
      if (o.removeChild(c), x && x.nodeType === 8) if (c = x.data, c === "/$") {
        if (g === 0) {
          o.removeChild(x), Se(l);
          return;
        }
        g--;
      } else c !== "$" && c !== "$?" && c !== "$!" || g++;
      c = x;
    } while (c);
    Se(l);
  }
  function On(o) {
    for (; o != null; o = o.nextSibling) {
      var l = o.nodeType;
      if (l === 1 || l === 3) break;
      if (l === 8) {
        if (l = o.data, l === "$" || l === "$!" || l === "$?") break;
        if (l === "/$") return null;
      }
    }
    return o;
  }
  function go(o) {
    o = o.previousSibling;
    for (var l = 0; o; ) {
      if (o.nodeType === 8) {
        var c = o.data;
        if (c === "$" || c === "$!" || c === "$?") {
          if (l === 0) return o;
          l--;
        } else c === "/$" && l++;
      }
      o = o.previousSibling;
    }
    return null;
  }
  var Cr = Math.random().toString(36).slice(2), si = "__reactFiber$" + Cr, Dn = "__reactProps$" + Cr, Or = "__reactContainer$" + Cr, Vs = "__reactEvents$" + Cr, Xu = "__reactListeners$" + Cr, Gm = "__reactHandles$" + Cr;
  function Yo(o) {
    var l = o[si];
    if (l) return l;
    for (var c = o.parentNode; c; ) {
      if (l = c[Or] || c[si]) {
        if (c = l.alternate, l.child !== null || c !== null && c.child !== null) for (o = go(o); o !== null; ) {
          if (c = o[si]) return c;
          o = go(o);
        }
        return l;
      }
      o = c, c = o.parentNode;
    }
    return null;
  }
  function Vl(o) {
    return o = o[si] || o[Or], !o || o.tag !== 5 && o.tag !== 6 && o.tag !== 13 && o.tag !== 3 ? null : o;
  }
  function Us(o) {
    if (o.tag === 5 || o.tag === 6) return o.stateNode;
    throw Error(t(33));
  }
  function Yu(o) {
    return o[Dn] || null;
  }
  var Uf = [], $s = -1;
  function yo(o) {
    return { current: o };
  }
  function Dr(o) {
    0 > $s || (o.current = Uf[$s], Uf[$s] = null, $s--);
  }
  function Er(o, l) {
    $s++, Uf[$s] = o.current, o.current = l;
  }
  var ko = {}, An = yo(ko), li = yo(!1), Zo = ko;
  function Ws(o, l) {
    var c = o.type.contextTypes;
    if (!c) return ko;
    var g = o.stateNode;
    if (g && g.__reactInternalMemoizedUnmaskedChildContext === l) return g.__reactInternalMemoizedMaskedChildContext;
    var x = {}, L;
    for (L in c) x[L] = l[L];
    return g && (o = o.stateNode, o.__reactInternalMemoizedUnmaskedChildContext = l, o.__reactInternalMemoizedMaskedChildContext = x), x;
  }
  function ui(o) {
    return o = o.childContextTypes, o != null;
  }
  function Zu() {
    Dr(li), Dr(An);
  }
  function Oh(o, l, c) {
    if (An.current !== ko) throw Error(t(168));
    Er(An, l), Er(li, c);
  }
  function Dh(o, l, c) {
    var g = o.stateNode;
    if (l = l.childContextTypes, typeof g.getChildContext != "function") return c;
    g = g.getChildContext();
    for (var x in g) if (!(x in l)) throw Error(t(108, $t(o) || "Unknown", x));
    return He({}, c, g);
  }
  function ec(o) {
    return o = (o = o.stateNode) && o.__reactInternalMemoizedMergedChildContext || ko, Zo = An.current, Er(An, o), Er(li, li.current), !0;
  }
  function Ah(o, l, c) {
    var g = o.stateNode;
    if (!g) throw Error(t(169));
    c ? (o = Dh(o, l, Zo), g.__reactInternalMemoizedMergedChildContext = o, Dr(li), Dr(An), Er(An, o)) : Dr(li), Er(li, c);
  }
  var Ha = null, tc = !1, $f = !1;
  function Lh(o) {
    Ha === null ? Ha = [o] : Ha.push(o);
  }
  function Km(o) {
    tc = !0, Lh(o);
  }
  function wo() {
    if (!$f && Ha !== null) {
      $f = !0;
      var o = 0, l = Qt;
      try {
        var c = Ha;
        for (Qt = 1; o < c.length; o++) {
          var g = c[o];
          do
            g = g(!0);
          while (g !== null);
        }
        Ha = null, tc = !1;
      } catch (x) {
        throw Ha !== null && (Ha = Ha.slice(o + 1)), B(je, wo), x;
      } finally {
        Qt = l, $f = !1;
      }
    }
    return null;
  }
  var js = [], Gs = 0, rc = null, nc = 0, Fi = [], _i = 0, es = null, Va = 1, Ua = "";
  function ts(o, l) {
    js[Gs++] = nc, js[Gs++] = rc, rc = o, nc = l;
  }
  function Rh(o, l, c) {
    Fi[_i++] = Va, Fi[_i++] = Ua, Fi[_i++] = es, es = o;
    var g = Va;
    o = Ua;
    var x = 32 - Yr(g) - 1;
    g &= ~(1 << x), c += 1;
    var L = 32 - Yr(l) + x;
    if (30 < L) {
      var $ = x - x % 5;
      L = (g & (1 << $) - 1).toString(32), g >>= $, x -= $, Va = 1 << 32 - Yr(l) + x | c << x | g, Ua = L + o;
    } else Va = 1 << L | c << x | g, Ua = o;
  }
  function Wf(o) {
    o.return !== null && (ts(o, 1), Rh(o, 1, 0));
  }
  function jf(o) {
    for (; o === rc; ) rc = js[--Gs], js[Gs] = null, nc = js[--Gs], js[Gs] = null;
    for (; o === es; ) es = Fi[--_i], Fi[_i] = null, Ua = Fi[--_i], Fi[_i] = null, Va = Fi[--_i], Fi[_i] = null;
  }
  var Ei = null, Mi = null, Lr = !1, ra = null;
  function Ih(o, l) {
    var c = Vi(5, null, null, 0);
    c.elementType = "DELETED", c.stateNode = l, c.return = o, l = o.deletions, l === null ? (o.deletions = [c], o.flags |= 16) : l.push(c);
  }
  function Ph(o, l) {
    switch (o.tag) {
      case 5:
        var c = o.type;
        return l = l.nodeType !== 1 || c.toLowerCase() !== l.nodeName.toLowerCase() ? null : l, l !== null ? (o.stateNode = l, Ei = o, Mi = On(l.firstChild), !0) : !1;
      case 6:
        return l = o.pendingProps === "" || l.nodeType !== 3 ? null : l, l !== null ? (o.stateNode = l, Ei = o, Mi = null, !0) : !1;
      case 13:
        return l = l.nodeType !== 8 ? null : l, l !== null ? (c = es !== null ? { id: Va, overflow: Ua } : null, o.memoizedState = { dehydrated: l, treeContext: c, retryLane: 1073741824 }, c = Vi(18, null, null, 0), c.stateNode = l, c.return = o, o.child = c, Ei = o, Mi = null, !0) : !1;
      default:
        return !1;
    }
  }
  function Gf(o) {
    return (o.mode & 1) !== 0 && (o.flags & 128) === 0;
  }
  function Kf(o) {
    if (Lr) {
      var l = Mi;
      if (l) {
        var c = l;
        if (!Ph(o, l)) {
          if (Gf(o)) throw Error(t(418));
          l = On(c.nextSibling);
          var g = Ei;
          l && Ph(o, l) ? Ih(g, c) : (o.flags = o.flags & -4097 | 2, Lr = !1, Ei = o);
        }
      } else {
        if (Gf(o)) throw Error(t(418));
        o.flags = o.flags & -4097 | 2, Lr = !1, Ei = o;
      }
    }
  }
  function Bh(o) {
    for (o = o.return; o !== null && o.tag !== 5 && o.tag !== 3 && o.tag !== 13; ) o = o.return;
    Ei = o;
  }
  function ic(o) {
    if (o !== Ei) return !1;
    if (!Lr) return Bh(o), Lr = !0, !1;
    var l;
    if ((l = o.tag !== 3) && !(l = o.tag !== 5) && (l = o.type, l = l !== "head" && l !== "body" && !Nr(o.type, o.memoizedProps)), l && (l = Mi)) {
      if (Gf(o)) throw Fh(), Error(t(418));
      for (; l; ) Ih(o, l), l = On(l.nextSibling);
    }
    if (Bh(o), o.tag === 13) {
      if (o = o.memoizedState, o = o !== null ? o.dehydrated : null, !o) throw Error(t(317));
      e: {
        for (o = o.nextSibling, l = 0; o; ) {
          if (o.nodeType === 8) {
            var c = o.data;
            if (c === "/$") {
              if (l === 0) {
                Mi = On(o.nextSibling);
                break e;
              }
              l--;
            } else c !== "$" && c !== "$!" && c !== "$?" || l++;
          }
          o = o.nextSibling;
        }
        Mi = null;
      }
    } else Mi = Ei ? On(o.stateNode.nextSibling) : null;
    return !0;
  }
  function Fh() {
    for (var o = Mi; o; ) o = On(o.nextSibling);
  }
  function Ks() {
    Mi = Ei = null, Lr = !1;
  }
  function Jf(o) {
    ra === null ? ra = [o] : ra.push(o);
  }
  var Jm = me.ReactCurrentBatchConfig;
  function Ul(o, l, c) {
    if (o = c.ref, o !== null && typeof o != "function" && typeof o != "object") {
      if (c._owner) {
        if (c = c._owner, c) {
          if (c.tag !== 1) throw Error(t(309));
          var g = c.stateNode;
        }
        if (!g) throw Error(t(147, o));
        var x = g, L = "" + o;
        return l !== null && l.ref !== null && typeof l.ref == "function" && l.ref._stringRef === L ? l.ref : (l = function($) {
          var ie = x.refs;
          $ === null ? delete ie[L] : ie[L] = $;
        }, l._stringRef = L, l);
      }
      if (typeof o != "string") throw Error(t(284));
      if (!c._owner) throw Error(t(290, o));
    }
    return o;
  }
  function ac(o, l) {
    throw o = Object.prototype.toString.call(l), Error(t(31, o === "[object Object]" ? "object with keys {" + Object.keys(l).join(", ") + "}" : o));
  }
  function _h(o) {
    var l = o._init;
    return l(o._payload);
  }
  function qh(o) {
    function l(Me, we) {
      if (o) {
        var De = Me.deletions;
        De === null ? (Me.deletions = [we], Me.flags |= 16) : De.push(we);
      }
    }
    function c(Me, we) {
      if (!o) return null;
      for (; we !== null; ) l(Me, we), we = we.sibling;
      return null;
    }
    function g(Me, we) {
      for (Me = /* @__PURE__ */ new Map(); we !== null; ) we.key !== null ? Me.set(we.key, we) : Me.set(we.index, we), we = we.sibling;
      return Me;
    }
    function x(Me, we) {
      return Me = No(Me, we), Me.index = 0, Me.sibling = null, Me;
    }
    function L(Me, we, De) {
      return Me.index = De, o ? (De = Me.alternate, De !== null ? (De = De.index, De < we ? (Me.flags |= 2, we) : De) : (Me.flags |= 2, we)) : (Me.flags |= 1048576, we);
    }
    function $(Me) {
      return o && Me.alternate === null && (Me.flags |= 2), Me;
    }
    function ie(Me, we, De, rt) {
      return we === null || we.tag !== 6 ? (we = zd(De, Me.mode, rt), we.return = Me, we) : (we = x(we, De), we.return = Me, we);
    }
    function de(Me, we, De, rt) {
      var Et = De.type;
      return Et === ke ? Je(Me, we, De.props.children, rt, De.key) : we !== null && (we.elementType === Et || typeof Et == "object" && Et !== null && Et.$$typeof === yt && _h(Et) === we.type) ? (rt = x(we, De.props), rt.ref = Ul(Me, we, De), rt.return = Me, rt) : (rt = Oc(De.type, De.key, De.props, null, Me.mode, rt), rt.ref = Ul(Me, we, De), rt.return = Me, rt);
    }
    function Ie(Me, we, De, rt) {
      return we === null || we.tag !== 4 || we.stateNode.containerInfo !== De.containerInfo || we.stateNode.implementation !== De.implementation ? (we = Hd(De, Me.mode, rt), we.return = Me, we) : (we = x(we, De.children || []), we.return = Me, we);
    }
    function Je(Me, we, De, rt, Et) {
      return we === null || we.tag !== 7 ? (we = cs(De, Me.mode, rt, Et), we.return = Me, we) : (we = x(we, De), we.return = Me, we);
    }
    function Ye(Me, we, De) {
      if (typeof we == "string" && we !== "" || typeof we == "number") return we = zd("" + we, Me.mode, De), we.return = Me, we;
      if (typeof we == "object" && we !== null) {
        switch (we.$$typeof) {
          case Ce:
            return De = Oc(we.type, we.key, we.props, null, Me.mode, De), De.ref = Ul(Me, null, we), De.return = Me, De;
          case pe:
            return we = Hd(we, Me.mode, De), we.return = Me, we;
          case yt:
            var rt = we._init;
            return Ye(Me, rt(we._payload), De);
        }
        if (tr(we) || ct(we)) return we = cs(we, Me.mode, De, null), we.return = Me, we;
        ac(Me, we);
      }
      return null;
    }
    function Ge(Me, we, De, rt) {
      var Et = we !== null ? we.key : null;
      if (typeof De == "string" && De !== "" || typeof De == "number") return Et !== null ? null : ie(Me, we, "" + De, rt);
      if (typeof De == "object" && De !== null) {
        switch (De.$$typeof) {
          case Ce:
            return De.key === Et ? de(Me, we, De, rt) : null;
          case pe:
            return De.key === Et ? Ie(Me, we, De, rt) : null;
          case yt:
            return Et = De._init, Ge(
              Me,
              we,
              Et(De._payload),
              rt
            );
        }
        if (tr(De) || ct(De)) return Et !== null ? null : Je(Me, we, De, rt, null);
        ac(Me, De);
      }
      return null;
    }
    function pt(Me, we, De, rt, Et) {
      if (typeof rt == "string" && rt !== "" || typeof rt == "number") return Me = Me.get(De) || null, ie(we, Me, "" + rt, Et);
      if (typeof rt == "object" && rt !== null) {
        switch (rt.$$typeof) {
          case Ce:
            return Me = Me.get(rt.key === null ? De : rt.key) || null, de(we, Me, rt, Et);
          case pe:
            return Me = Me.get(rt.key === null ? De : rt.key) || null, Ie(we, Me, rt, Et);
          case yt:
            var qt = rt._init;
            return pt(Me, we, De, qt(rt._payload), Et);
        }
        if (tr(rt) || ct(rt)) return Me = Me.get(De) || null, Je(we, Me, rt, Et, null);
        ac(we, rt);
      }
      return null;
    }
    function Ct(Me, we, De, rt) {
      for (var Et = null, qt = null, zt = we, Wt = we = 0, pn = null; zt !== null && Wt < De.length; Wt++) {
        zt.index > Wt ? (pn = zt, zt = null) : pn = zt.sibling;
        var fr = Ge(Me, zt, De[Wt], rt);
        if (fr === null) {
          zt === null && (zt = pn);
          break;
        }
        o && zt && fr.alternate === null && l(Me, zt), we = L(fr, we, Wt), qt === null ? Et = fr : qt.sibling = fr, qt = fr, zt = pn;
      }
      if (Wt === De.length) return c(Me, zt), Lr && ts(Me, Wt), Et;
      if (zt === null) {
        for (; Wt < De.length; Wt++) zt = Ye(Me, De[Wt], rt), zt !== null && (we = L(zt, we, Wt), qt === null ? Et = zt : qt.sibling = zt, qt = zt);
        return Lr && ts(Me, Wt), Et;
      }
      for (zt = g(Me, zt); Wt < De.length; Wt++) pn = pt(zt, Me, Wt, De[Wt], rt), pn !== null && (o && pn.alternate !== null && zt.delete(pn.key === null ? Wt : pn.key), we = L(pn, we, Wt), qt === null ? Et = pn : qt.sibling = pn, qt = pn);
      return o && zt.forEach(function(Oo) {
        return l(Me, Oo);
      }), Lr && ts(Me, Wt), Et;
    }
    function xt(Me, we, De, rt) {
      var Et = ct(De);
      if (typeof Et != "function") throw Error(t(150));
      if (De = Et.call(De), De == null) throw Error(t(151));
      for (var qt = Et = null, zt = we, Wt = we = 0, pn = null, fr = De.next(); zt !== null && !fr.done; Wt++, fr = De.next()) {
        zt.index > Wt ? (pn = zt, zt = null) : pn = zt.sibling;
        var Oo = Ge(Me, zt, fr.value, rt);
        if (Oo === null) {
          zt === null && (zt = pn);
          break;
        }
        o && zt && Oo.alternate === null && l(Me, zt), we = L(Oo, we, Wt), qt === null ? Et = Oo : qt.sibling = Oo, qt = Oo, zt = pn;
      }
      if (fr.done) return c(
        Me,
        zt
      ), Lr && ts(Me, Wt), Et;
      if (zt === null) {
        for (; !fr.done; Wt++, fr = De.next()) fr = Ye(Me, fr.value, rt), fr !== null && (we = L(fr, we, Wt), qt === null ? Et = fr : qt.sibling = fr, qt = fr);
        return Lr && ts(Me, Wt), Et;
      }
      for (zt = g(Me, zt); !fr.done; Wt++, fr = De.next()) fr = pt(zt, Me, Wt, fr.value, rt), fr !== null && (o && fr.alternate !== null && zt.delete(fr.key === null ? Wt : fr.key), we = L(fr, we, Wt), qt === null ? Et = fr : qt.sibling = fr, qt = fr);
      return o && zt.forEach(function(Ng) {
        return l(Me, Ng);
      }), Lr && ts(Me, Wt), Et;
    }
    function Kr(Me, we, De, rt) {
      if (typeof De == "object" && De !== null && De.type === ke && De.key === null && (De = De.props.children), typeof De == "object" && De !== null) {
        switch (De.$$typeof) {
          case Ce:
            e: {
              for (var Et = De.key, qt = we; qt !== null; ) {
                if (qt.key === Et) {
                  if (Et = De.type, Et === ke) {
                    if (qt.tag === 7) {
                      c(Me, qt.sibling), we = x(qt, De.props.children), we.return = Me, Me = we;
                      break e;
                    }
                  } else if (qt.elementType === Et || typeof Et == "object" && Et !== null && Et.$$typeof === yt && _h(Et) === qt.type) {
                    c(Me, qt.sibling), we = x(qt, De.props), we.ref = Ul(Me, qt, De), we.return = Me, Me = we;
                    break e;
                  }
                  c(Me, qt);
                  break;
                } else l(Me, qt);
                qt = qt.sibling;
              }
              De.type === ke ? (we = cs(De.props.children, Me.mode, rt, De.key), we.return = Me, Me = we) : (rt = Oc(De.type, De.key, De.props, null, Me.mode, rt), rt.ref = Ul(Me, we, De), rt.return = Me, Me = rt);
            }
            return $(Me);
          case pe:
            e: {
              for (qt = De.key; we !== null; ) {
                if (we.key === qt) if (we.tag === 4 && we.stateNode.containerInfo === De.containerInfo && we.stateNode.implementation === De.implementation) {
                  c(Me, we.sibling), we = x(we, De.children || []), we.return = Me, Me = we;
                  break e;
                } else {
                  c(Me, we);
                  break;
                }
                else l(Me, we);
                we = we.sibling;
              }
              we = Hd(De, Me.mode, rt), we.return = Me, Me = we;
            }
            return $(Me);
          case yt:
            return qt = De._init, Kr(Me, we, qt(De._payload), rt);
        }
        if (tr(De)) return Ct(Me, we, De, rt);
        if (ct(De)) return xt(Me, we, De, rt);
        ac(Me, De);
      }
      return typeof De == "string" && De !== "" || typeof De == "number" ? (De = "" + De, we !== null && we.tag === 6 ? (c(Me, we.sibling), we = x(we, De), we.return = Me, Me = we) : (c(Me, we), we = zd(De, Me.mode, rt), we.return = Me, Me = we), $(Me)) : c(Me, we);
    }
    return Kr;
  }
  var Js = qh(!0), zh = qh(!1), oc = yo(null), sc = null, Qs = null, Qf = null;
  function Xf() {
    Qf = Qs = sc = null;
  }
  function Yf(o) {
    var l = oc.current;
    Dr(oc), o._currentValue = l;
  }
  function Zf(o, l, c) {
    for (; o !== null; ) {
      var g = o.alternate;
      if ((o.childLanes & l) !== l ? (o.childLanes |= l, g !== null && (g.childLanes |= l)) : g !== null && (g.childLanes & l) !== l && (g.childLanes |= l), o === c) break;
      o = o.return;
    }
  }
  function Xs(o, l) {
    sc = o, Qf = Qs = null, o = o.dependencies, o !== null && o.firstContext !== null && ((o.lanes & l) !== 0 && (ci = !0), o.firstContext = null);
  }
  function qi(o) {
    var l = o._currentValue;
    if (Qf !== o) if (o = { context: o, memoizedValue: l, next: null }, Qs === null) {
      if (sc === null) throw Error(t(308));
      Qs = o, sc.dependencies = { lanes: 0, firstContext: o };
    } else Qs = Qs.next = o;
    return l;
  }
  var rs = null;
  function ed(o) {
    rs === null ? rs = [o] : rs.push(o);
  }
  function Hh(o, l, c, g) {
    var x = l.interleaved;
    return x === null ? (c.next = c, ed(l)) : (c.next = x.next, x.next = c), l.interleaved = c, $a(o, g);
  }
  function $a(o, l) {
    o.lanes |= l;
    var c = o.alternate;
    for (c !== null && (c.lanes |= l), c = o, o = o.return; o !== null; ) o.childLanes |= l, c = o.alternate, c !== null && (c.childLanes |= l), c = o, o = o.return;
    return c.tag === 3 ? c.stateNode : null;
  }
  var bo = !1;
  function td(o) {
    o.updateQueue = { baseState: o.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null };
  }
  function Vh(o, l) {
    o = o.updateQueue, l.updateQueue === o && (l.updateQueue = { baseState: o.baseState, firstBaseUpdate: o.firstBaseUpdate, lastBaseUpdate: o.lastBaseUpdate, shared: o.shared, effects: o.effects });
  }
  function Wa(o, l) {
    return { eventTime: o, lane: l, tag: 0, payload: null, callback: null, next: null };
  }
  function Co(o, l, c) {
    var g = o.updateQueue;
    if (g === null) return null;
    if (g = g.shared, (ur & 2) !== 0) {
      var x = g.pending;
      return x === null ? l.next = l : (l.next = x.next, x.next = l), g.pending = l, $a(o, c);
    }
    return x = g.interleaved, x === null ? (l.next = l, ed(g)) : (l.next = x.next, x.next = l), g.interleaved = l, $a(o, c);
  }
  function lc(o, l, c) {
    if (l = l.updateQueue, l !== null && (l = l.shared, (c & 4194240) !== 0)) {
      var g = l.lanes;
      g &= o.pendingLanes, c |= g, l.lanes = c, pa(o, c);
    }
  }
  function Uh(o, l) {
    var c = o.updateQueue, g = o.alternate;
    if (g !== null && (g = g.updateQueue, c === g)) {
      var x = null, L = null;
      if (c = c.firstBaseUpdate, c !== null) {
        do {
          var $ = { eventTime: c.eventTime, lane: c.lane, tag: c.tag, payload: c.payload, callback: c.callback, next: null };
          L === null ? x = L = $ : L = L.next = $, c = c.next;
        } while (c !== null);
        L === null ? x = L = l : L = L.next = l;
      } else x = L = l;
      c = { baseState: g.baseState, firstBaseUpdate: x, lastBaseUpdate: L, shared: g.shared, effects: g.effects }, o.updateQueue = c;
      return;
    }
    o = c.lastBaseUpdate, o === null ? c.firstBaseUpdate = l : o.next = l, c.lastBaseUpdate = l;
  }
  function uc(o, l, c, g) {
    var x = o.updateQueue;
    bo = !1;
    var L = x.firstBaseUpdate, $ = x.lastBaseUpdate, ie = x.shared.pending;
    if (ie !== null) {
      x.shared.pending = null;
      var de = ie, Ie = de.next;
      de.next = null, $ === null ? L = Ie : $.next = Ie, $ = de;
      var Je = o.alternate;
      Je !== null && (Je = Je.updateQueue, ie = Je.lastBaseUpdate, ie !== $ && (ie === null ? Je.firstBaseUpdate = Ie : ie.next = Ie, Je.lastBaseUpdate = de));
    }
    if (L !== null) {
      var Ye = x.baseState;
      $ = 0, Je = Ie = de = null, ie = L;
      do {
        var Ge = ie.lane, pt = ie.eventTime;
        if ((g & Ge) === Ge) {
          Je !== null && (Je = Je.next = {
            eventTime: pt,
            lane: 0,
            tag: ie.tag,
            payload: ie.payload,
            callback: ie.callback,
            next: null
          });
          e: {
            var Ct = o, xt = ie;
            switch (Ge = l, pt = c, xt.tag) {
              case 1:
                if (Ct = xt.payload, typeof Ct == "function") {
                  Ye = Ct.call(pt, Ye, Ge);
                  break e;
                }
                Ye = Ct;
                break e;
              case 3:
                Ct.flags = Ct.flags & -65537 | 128;
              case 0:
                if (Ct = xt.payload, Ge = typeof Ct == "function" ? Ct.call(pt, Ye, Ge) : Ct, Ge == null) break e;
                Ye = He({}, Ye, Ge);
                break e;
              case 2:
                bo = !0;
            }
          }
          ie.callback !== null && ie.lane !== 0 && (o.flags |= 64, Ge = x.effects, Ge === null ? x.effects = [ie] : Ge.push(ie));
        } else pt = { eventTime: pt, lane: Ge, tag: ie.tag, payload: ie.payload, callback: ie.callback, next: null }, Je === null ? (Ie = Je = pt, de = Ye) : Je = Je.next = pt, $ |= Ge;
        if (ie = ie.next, ie === null) {
          if (ie = x.shared.pending, ie === null) break;
          Ge = ie, ie = Ge.next, Ge.next = null, x.lastBaseUpdate = Ge, x.shared.pending = null;
        }
      } while (!0);
      if (Je === null && (de = Ye), x.baseState = de, x.firstBaseUpdate = Ie, x.lastBaseUpdate = Je, l = x.shared.interleaved, l !== null) {
        x = l;
        do
          $ |= x.lane, x = x.next;
        while (x !== l);
      } else L === null && (x.shared.lanes = 0);
      as |= $, o.lanes = $, o.memoizedState = Ye;
    }
  }
  function $h(o, l, c) {
    if (o = l.effects, l.effects = null, o !== null) for (l = 0; l < o.length; l++) {
      var g = o[l], x = g.callback;
      if (x !== null) {
        if (g.callback = null, g = c, typeof x != "function") throw Error(t(191, x));
        x.call(g);
      }
    }
  }
  var $l = {}, ka = yo($l), Wl = yo($l), jl = yo($l);
  function ns(o) {
    if (o === $l) throw Error(t(174));
    return o;
  }
  function rd(o, l) {
    switch (Er(jl, l), Er(Wl, o), Er(ka, $l), o = l.nodeType, o) {
      case 9:
      case 11:
        l = (l = l.documentElement) ? l.namespaceURI : st(null, "");
        break;
      default:
        o = o === 8 ? l.parentNode : l, l = o.namespaceURI || null, o = o.tagName, l = st(l, o);
    }
    Dr(ka), Er(ka, l);
  }
  function Ys() {
    Dr(ka), Dr(Wl), Dr(jl);
  }
  function Wh(o) {
    ns(jl.current);
    var l = ns(ka.current), c = st(l, o.type);
    l !== c && (Er(Wl, o), Er(ka, c));
  }
  function nd(o) {
    Wl.current === o && (Dr(ka), Dr(Wl));
  }
  var Br = yo(0);
  function cc(o) {
    for (var l = o; l !== null; ) {
      if (l.tag === 13) {
        var c = l.memoizedState;
        if (c !== null && (c = c.dehydrated, c === null || c.data === "$?" || c.data === "$!")) return l;
      } else if (l.tag === 19 && l.memoizedProps.revealOrder !== void 0) {
        if ((l.flags & 128) !== 0) return l;
      } else if (l.child !== null) {
        l.child.return = l, l = l.child;
        continue;
      }
      if (l === o) break;
      for (; l.sibling === null; ) {
        if (l.return === null || l.return === o) return null;
        l = l.return;
      }
      l.sibling.return = l.return, l = l.sibling;
    }
    return null;
  }
  var id = [];
  function ad() {
    for (var o = 0; o < id.length; o++) id[o]._workInProgressVersionPrimary = null;
    id.length = 0;
  }
  var fc = me.ReactCurrentDispatcher, od = me.ReactCurrentBatchConfig, is = 0, Fr = null, nn = null, dn = null, dc = !1, Gl = !1, Kl = 0, Qm = 0;
  function Ln() {
    throw Error(t(321));
  }
  function sd(o, l) {
    if (l === null) return !1;
    for (var c = 0; c < l.length && c < o.length; c++) if (!Si(o[c], l[c])) return !1;
    return !0;
  }
  function ld(o, l, c, g, x, L) {
    if (is = L, Fr = l, l.memoizedState = null, l.updateQueue = null, l.lanes = 0, fc.current = o === null || o.memoizedState === null ? eg : tg, o = c(g, x), Gl) {
      L = 0;
      do {
        if (Gl = !1, Kl = 0, 25 <= L) throw Error(t(301));
        L += 1, dn = nn = null, l.updateQueue = null, fc.current = rg, o = c(g, x);
      } while (Gl);
    }
    if (fc.current = vc, l = nn !== null && nn.next !== null, is = 0, dn = nn = Fr = null, dc = !1, l) throw Error(t(300));
    return o;
  }
  function ud() {
    var o = Kl !== 0;
    return Kl = 0, o;
  }
  function wa() {
    var o = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null };
    return dn === null ? Fr.memoizedState = dn = o : dn = dn.next = o, dn;
  }
  function zi() {
    if (nn === null) {
      var o = Fr.alternate;
      o = o !== null ? o.memoizedState : null;
    } else o = nn.next;
    var l = dn === null ? Fr.memoizedState : dn.next;
    if (l !== null) dn = l, nn = o;
    else {
      if (o === null) throw Error(t(310));
      nn = o, o = { memoizedState: nn.memoizedState, baseState: nn.baseState, baseQueue: nn.baseQueue, queue: nn.queue, next: null }, dn === null ? Fr.memoizedState = dn = o : dn = dn.next = o;
    }
    return dn;
  }
  function Jl(o, l) {
    return typeof l == "function" ? l(o) : l;
  }
  function cd(o) {
    var l = zi(), c = l.queue;
    if (c === null) throw Error(t(311));
    c.lastRenderedReducer = o;
    var g = nn, x = g.baseQueue, L = c.pending;
    if (L !== null) {
      if (x !== null) {
        var $ = x.next;
        x.next = L.next, L.next = $;
      }
      g.baseQueue = x = L, c.pending = null;
    }
    if (x !== null) {
      L = x.next, g = g.baseState;
      var ie = $ = null, de = null, Ie = L;
      do {
        var Je = Ie.lane;
        if ((is & Je) === Je) de !== null && (de = de.next = { lane: 0, action: Ie.action, hasEagerState: Ie.hasEagerState, eagerState: Ie.eagerState, next: null }), g = Ie.hasEagerState ? Ie.eagerState : o(g, Ie.action);
        else {
          var Ye = {
            lane: Je,
            action: Ie.action,
            hasEagerState: Ie.hasEagerState,
            eagerState: Ie.eagerState,
            next: null
          };
          de === null ? (ie = de = Ye, $ = g) : de = de.next = Ye, Fr.lanes |= Je, as |= Je;
        }
        Ie = Ie.next;
      } while (Ie !== null && Ie !== L);
      de === null ? $ = g : de.next = ie, Si(g, l.memoizedState) || (ci = !0), l.memoizedState = g, l.baseState = $, l.baseQueue = de, c.lastRenderedState = g;
    }
    if (o = c.interleaved, o !== null) {
      x = o;
      do
        L = x.lane, Fr.lanes |= L, as |= L, x = x.next;
      while (x !== o);
    } else x === null && (c.lanes = 0);
    return [l.memoizedState, c.dispatch];
  }
  function fd(o) {
    var l = zi(), c = l.queue;
    if (c === null) throw Error(t(311));
    c.lastRenderedReducer = o;
    var g = c.dispatch, x = c.pending, L = l.memoizedState;
    if (x !== null) {
      c.pending = null;
      var $ = x = x.next;
      do
        L = o(L, $.action), $ = $.next;
      while ($ !== x);
      Si(L, l.memoizedState) || (ci = !0), l.memoizedState = L, l.baseQueue === null && (l.baseState = L), c.lastRenderedState = L;
    }
    return [L, g];
  }
  function jh() {
  }
  function Gh(o, l) {
    var c = Fr, g = zi(), x = l(), L = !Si(g.memoizedState, x);
    if (L && (g.memoizedState = x, ci = !0), g = g.queue, dd(Qh.bind(null, c, g, o), [o]), g.getSnapshot !== l || L || dn !== null && dn.memoizedState.tag & 1) {
      if (c.flags |= 2048, Ql(9, Jh.bind(null, c, g, x, l), void 0, null), hn === null) throw Error(t(349));
      (is & 30) !== 0 || Kh(c, l, x);
    }
    return x;
  }
  function Kh(o, l, c) {
    o.flags |= 16384, o = { getSnapshot: l, value: c }, l = Fr.updateQueue, l === null ? (l = { lastEffect: null, stores: null }, Fr.updateQueue = l, l.stores = [o]) : (c = l.stores, c === null ? l.stores = [o] : c.push(o));
  }
  function Jh(o, l, c, g) {
    l.value = c, l.getSnapshot = g, Xh(l) && Yh(o);
  }
  function Qh(o, l, c) {
    return c(function() {
      Xh(l) && Yh(o);
    });
  }
  function Xh(o) {
    var l = o.getSnapshot;
    o = o.value;
    try {
      var c = l();
      return !Si(o, c);
    } catch {
      return !0;
    }
  }
  function Yh(o) {
    var l = $a(o, 1);
    l !== null && oa(l, o, 1, -1);
  }
  function Zh(o) {
    var l = wa();
    return typeof o == "function" && (o = o()), l.memoizedState = l.baseState = o, o = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: Jl, lastRenderedState: o }, l.queue = o, o = o.dispatch = Zm.bind(null, Fr, o), [l.memoizedState, o];
  }
  function Ql(o, l, c, g) {
    return o = { tag: o, create: l, destroy: c, deps: g, next: null }, l = Fr.updateQueue, l === null ? (l = { lastEffect: null, stores: null }, Fr.updateQueue = l, l.lastEffect = o.next = o) : (c = l.lastEffect, c === null ? l.lastEffect = o.next = o : (g = c.next, c.next = o, o.next = g, l.lastEffect = o)), o;
  }
  function ep() {
    return zi().memoizedState;
  }
  function hc(o, l, c, g) {
    var x = wa();
    Fr.flags |= o, x.memoizedState = Ql(1 | l, c, void 0, g === void 0 ? null : g);
  }
  function pc(o, l, c, g) {
    var x = zi();
    g = g === void 0 ? null : g;
    var L = void 0;
    if (nn !== null) {
      var $ = nn.memoizedState;
      if (L = $.destroy, g !== null && sd(g, $.deps)) {
        x.memoizedState = Ql(l, c, L, g);
        return;
      }
    }
    Fr.flags |= o, x.memoizedState = Ql(1 | l, c, L, g);
  }
  function tp(o, l) {
    return hc(8390656, 8, o, l);
  }
  function dd(o, l) {
    return pc(2048, 8, o, l);
  }
  function rp(o, l) {
    return pc(4, 2, o, l);
  }
  function np(o, l) {
    return pc(4, 4, o, l);
  }
  function ip(o, l) {
    if (typeof l == "function") return o = o(), l(o), function() {
      l(null);
    };
    if (l != null) return o = o(), l.current = o, function() {
      l.current = null;
    };
  }
  function ap(o, l, c) {
    return c = c != null ? c.concat([o]) : null, pc(4, 4, ip.bind(null, l, o), c);
  }
  function hd() {
  }
  function op(o, l) {
    var c = zi();
    l = l === void 0 ? null : l;
    var g = c.memoizedState;
    return g !== null && l !== null && sd(l, g[1]) ? g[0] : (c.memoizedState = [o, l], o);
  }
  function sp(o, l) {
    var c = zi();
    l = l === void 0 ? null : l;
    var g = c.memoizedState;
    return g !== null && l !== null && sd(l, g[1]) ? g[0] : (o = o(), c.memoizedState = [o, l], o);
  }
  function lp(o, l, c) {
    return (is & 21) === 0 ? (o.baseState && (o.baseState = !1, ci = !0), o.memoizedState = c) : (Si(c, l) || (c = Da(), Fr.lanes |= c, as |= c, o.baseState = !0), l);
  }
  function Xm(o, l) {
    var c = Qt;
    Qt = c !== 0 && 4 > c ? c : 4, o(!0);
    var g = od.transition;
    od.transition = {};
    try {
      o(!1), l();
    } finally {
      Qt = c, od.transition = g;
    }
  }
  function up() {
    return zi().memoizedState;
  }
  function Ym(o, l, c) {
    var g = Eo(o);
    if (c = { lane: g, action: c, hasEagerState: !1, eagerState: null, next: null }, cp(o)) fp(l, c);
    else if (c = Hh(o, l, c, g), c !== null) {
      var x = Kn();
      oa(c, o, g, x), dp(c, l, g);
    }
  }
  function Zm(o, l, c) {
    var g = Eo(o), x = { lane: g, action: c, hasEagerState: !1, eagerState: null, next: null };
    if (cp(o)) fp(l, x);
    else {
      var L = o.alternate;
      if (o.lanes === 0 && (L === null || L.lanes === 0) && (L = l.lastRenderedReducer, L !== null)) try {
        var $ = l.lastRenderedState, ie = L($, c);
        if (x.hasEagerState = !0, x.eagerState = ie, Si(ie, $)) {
          var de = l.interleaved;
          de === null ? (x.next = x, ed(l)) : (x.next = de.next, de.next = x), l.interleaved = x;
          return;
        }
      } catch {
      }
      c = Hh(o, l, x, g), c !== null && (x = Kn(), oa(c, o, g, x), dp(c, l, g));
    }
  }
  function cp(o) {
    var l = o.alternate;
    return o === Fr || l !== null && l === Fr;
  }
  function fp(o, l) {
    Gl = dc = !0;
    var c = o.pending;
    c === null ? l.next = l : (l.next = c.next, c.next = l), o.pending = l;
  }
  function dp(o, l, c) {
    if ((c & 4194240) !== 0) {
      var g = l.lanes;
      g &= o.pendingLanes, c |= g, l.lanes = c, pa(o, c);
    }
  }
  var vc = { readContext: qi, useCallback: Ln, useContext: Ln, useEffect: Ln, useImperativeHandle: Ln, useInsertionEffect: Ln, useLayoutEffect: Ln, useMemo: Ln, useReducer: Ln, useRef: Ln, useState: Ln, useDebugValue: Ln, useDeferredValue: Ln, useTransition: Ln, useMutableSource: Ln, useSyncExternalStore: Ln, useId: Ln, unstable_isNewReconciler: !1 }, eg = { readContext: qi, useCallback: function(o, l) {
    return wa().memoizedState = [o, l === void 0 ? null : l], o;
  }, useContext: qi, useEffect: tp, useImperativeHandle: function(o, l, c) {
    return c = c != null ? c.concat([o]) : null, hc(
      4194308,
      4,
      ip.bind(null, l, o),
      c
    );
  }, useLayoutEffect: function(o, l) {
    return hc(4194308, 4, o, l);
  }, useInsertionEffect: function(o, l) {
    return hc(4, 2, o, l);
  }, useMemo: function(o, l) {
    var c = wa();
    return l = l === void 0 ? null : l, o = o(), c.memoizedState = [o, l], o;
  }, useReducer: function(o, l, c) {
    var g = wa();
    return l = c !== void 0 ? c(l) : l, g.memoizedState = g.baseState = l, o = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: o, lastRenderedState: l }, g.queue = o, o = o.dispatch = Ym.bind(null, Fr, o), [g.memoizedState, o];
  }, useRef: function(o) {
    var l = wa();
    return o = { current: o }, l.memoizedState = o;
  }, useState: Zh, useDebugValue: hd, useDeferredValue: function(o) {
    return wa().memoizedState = o;
  }, useTransition: function() {
    var o = Zh(!1), l = o[0];
    return o = Xm.bind(null, o[1]), wa().memoizedState = o, [l, o];
  }, useMutableSource: function() {
  }, useSyncExternalStore: function(o, l, c) {
    var g = Fr, x = wa();
    if (Lr) {
      if (c === void 0) throw Error(t(407));
      c = c();
    } else {
      if (c = l(), hn === null) throw Error(t(349));
      (is & 30) !== 0 || Kh(g, l, c);
    }
    x.memoizedState = c;
    var L = { value: c, getSnapshot: l };
    return x.queue = L, tp(Qh.bind(
      null,
      g,
      L,
      o
    ), [o]), g.flags |= 2048, Ql(9, Jh.bind(null, g, L, c, l), void 0, null), c;
  }, useId: function() {
    var o = wa(), l = hn.identifierPrefix;
    if (Lr) {
      var c = Ua, g = Va;
      c = (g & ~(1 << 32 - Yr(g) - 1)).toString(32) + c, l = ":" + l + "R" + c, c = Kl++, 0 < c && (l += "H" + c.toString(32)), l += ":";
    } else c = Qm++, l = ":" + l + "r" + c.toString(32) + ":";
    return o.memoizedState = l;
  }, unstable_isNewReconciler: !1 }, tg = {
    readContext: qi,
    useCallback: op,
    useContext: qi,
    useEffect: dd,
    useImperativeHandle: ap,
    useInsertionEffect: rp,
    useLayoutEffect: np,
    useMemo: sp,
    useReducer: cd,
    useRef: ep,
    useState: function() {
      return cd(Jl);
    },
    useDebugValue: hd,
    useDeferredValue: function(o) {
      var l = zi();
      return lp(l, nn.memoizedState, o);
    },
    useTransition: function() {
      var o = cd(Jl)[0], l = zi().memoizedState;
      return [o, l];
    },
    useMutableSource: jh,
    useSyncExternalStore: Gh,
    useId: up,
    unstable_isNewReconciler: !1
  }, rg = { readContext: qi, useCallback: op, useContext: qi, useEffect: dd, useImperativeHandle: ap, useInsertionEffect: rp, useLayoutEffect: np, useMemo: sp, useReducer: fd, useRef: ep, useState: function() {
    return fd(Jl);
  }, useDebugValue: hd, useDeferredValue: function(o) {
    var l = zi();
    return nn === null ? l.memoizedState = o : lp(l, nn.memoizedState, o);
  }, useTransition: function() {
    var o = fd(Jl)[0], l = zi().memoizedState;
    return [o, l];
  }, useMutableSource: jh, useSyncExternalStore: Gh, useId: up, unstable_isNewReconciler: !1 };
  function na(o, l) {
    if (o && o.defaultProps) {
      l = He({}, l), o = o.defaultProps;
      for (var c in o) l[c] === void 0 && (l[c] = o[c]);
      return l;
    }
    return l;
  }
  function pd(o, l, c, g) {
    l = o.memoizedState, c = c(g, l), c = c == null ? l : He({}, l, c), o.memoizedState = c, o.lanes === 0 && (o.updateQueue.baseState = c);
  }
  var mc = { isMounted: function(o) {
    return (o = o._reactInternals) ? it(o) === o : !1;
  }, enqueueSetState: function(o, l, c) {
    o = o._reactInternals;
    var g = Kn(), x = Eo(o), L = Wa(g, x);
    L.payload = l, c != null && (L.callback = c), l = Co(o, L, x), l !== null && (oa(l, o, x, g), lc(l, o, x));
  }, enqueueReplaceState: function(o, l, c) {
    o = o._reactInternals;
    var g = Kn(), x = Eo(o), L = Wa(g, x);
    L.tag = 1, L.payload = l, c != null && (L.callback = c), l = Co(o, L, x), l !== null && (oa(l, o, x, g), lc(l, o, x));
  }, enqueueForceUpdate: function(o, l) {
    o = o._reactInternals;
    var c = Kn(), g = Eo(o), x = Wa(c, g);
    x.tag = 2, l != null && (x.callback = l), l = Co(o, x, g), l !== null && (oa(l, o, g, c), lc(l, o, g));
  } };
  function hp(o, l, c, g, x, L, $) {
    return o = o.stateNode, typeof o.shouldComponentUpdate == "function" ? o.shouldComponentUpdate(g, L, $) : l.prototype && l.prototype.isPureReactComponent ? !fo(c, g) || !fo(x, L) : !0;
  }
  function pp(o, l, c) {
    var g = !1, x = ko, L = l.contextType;
    return typeof L == "object" && L !== null ? L = qi(L) : (x = ui(l) ? Zo : An.current, g = l.contextTypes, L = (g = g != null) ? Ws(o, x) : ko), l = new l(c, L), o.memoizedState = l.state !== null && l.state !== void 0 ? l.state : null, l.updater = mc, o.stateNode = l, l._reactInternals = o, g && (o = o.stateNode, o.__reactInternalMemoizedUnmaskedChildContext = x, o.__reactInternalMemoizedMaskedChildContext = L), l;
  }
  function vp(o, l, c, g) {
    o = l.state, typeof l.componentWillReceiveProps == "function" && l.componentWillReceiveProps(c, g), typeof l.UNSAFE_componentWillReceiveProps == "function" && l.UNSAFE_componentWillReceiveProps(c, g), l.state !== o && mc.enqueueReplaceState(l, l.state, null);
  }
  function vd(o, l, c, g) {
    var x = o.stateNode;
    x.props = c, x.state = o.memoizedState, x.refs = {}, td(o);
    var L = l.contextType;
    typeof L == "object" && L !== null ? x.context = qi(L) : (L = ui(l) ? Zo : An.current, x.context = Ws(o, L)), x.state = o.memoizedState, L = l.getDerivedStateFromProps, typeof L == "function" && (pd(o, l, L, c), x.state = o.memoizedState), typeof l.getDerivedStateFromProps == "function" || typeof x.getSnapshotBeforeUpdate == "function" || typeof x.UNSAFE_componentWillMount != "function" && typeof x.componentWillMount != "function" || (l = x.state, typeof x.componentWillMount == "function" && x.componentWillMount(), typeof x.UNSAFE_componentWillMount == "function" && x.UNSAFE_componentWillMount(), l !== x.state && mc.enqueueReplaceState(x, x.state, null), uc(o, c, x, g), x.state = o.memoizedState), typeof x.componentDidMount == "function" && (o.flags |= 4194308);
  }
  function Zs(o, l) {
    try {
      var c = "", g = l;
      do
        c += Ft(g), g = g.return;
      while (g);
      var x = c;
    } catch (L) {
      x = `
Error generating stack: ` + L.message + `
` + L.stack;
    }
    return { value: o, source: l, stack: x, digest: null };
  }
  function md(o, l, c) {
    return { value: o, source: null, stack: c ?? null, digest: l ?? null };
  }
  function gd(o, l) {
    try {
      console.error(l.value);
    } catch (c) {
      setTimeout(function() {
        throw c;
      });
    }
  }
  var ng = typeof WeakMap == "function" ? WeakMap : Map;
  function mp(o, l, c) {
    c = Wa(-1, c), c.tag = 3, c.payload = { element: null };
    var g = l.value;
    return c.callback = function() {
      Tc || (Tc = !0, Ld = g), gd(o, l);
    }, c;
  }
  function gp(o, l, c) {
    c = Wa(-1, c), c.tag = 3;
    var g = o.type.getDerivedStateFromError;
    if (typeof g == "function") {
      var x = l.value;
      c.payload = function() {
        return g(x);
      }, c.callback = function() {
        gd(o, l);
      };
    }
    var L = o.stateNode;
    return L !== null && typeof L.componentDidCatch == "function" && (c.callback = function() {
      gd(o, l), typeof g != "function" && (So === null ? So = /* @__PURE__ */ new Set([this]) : So.add(this));
      var $ = l.stack;
      this.componentDidCatch(l.value, { componentStack: $ !== null ? $ : "" });
    }), c;
  }
  function yp(o, l, c) {
    var g = o.pingCache;
    if (g === null) {
      g = o.pingCache = new ng();
      var x = /* @__PURE__ */ new Set();
      g.set(l, x);
    } else x = g.get(l), x === void 0 && (x = /* @__PURE__ */ new Set(), g.set(l, x));
    x.has(c) || (x.add(c), o = gg.bind(null, o, l, c), l.then(o, o));
  }
  function kp(o) {
    do {
      var l;
      if ((l = o.tag === 13) && (l = o.memoizedState, l = l !== null ? l.dehydrated !== null : !0), l) return o;
      o = o.return;
    } while (o !== null);
    return null;
  }
  function wp(o, l, c, g, x) {
    return (o.mode & 1) === 0 ? (o === l ? o.flags |= 65536 : (o.flags |= 128, c.flags |= 131072, c.flags &= -52805, c.tag === 1 && (c.alternate === null ? c.tag = 17 : (l = Wa(-1, 1), l.tag = 2, Co(c, l, 1))), c.lanes |= 1), o) : (o.flags |= 65536, o.lanes = x, o);
  }
  var ig = me.ReactCurrentOwner, ci = !1;
  function Gn(o, l, c, g) {
    l.child = o === null ? zh(l, null, c, g) : Js(l, o.child, c, g);
  }
  function bp(o, l, c, g, x) {
    c = c.render;
    var L = l.ref;
    return Xs(l, x), g = ld(o, l, c, g, L, x), c = ud(), o !== null && !ci ? (l.updateQueue = o.updateQueue, l.flags &= -2053, o.lanes &= ~x, ja(o, l, x)) : (Lr && c && Wf(l), l.flags |= 1, Gn(o, l, g, x), l.child);
  }
  function Cp(o, l, c, g, x) {
    if (o === null) {
      var L = c.type;
      return typeof L == "function" && !qd(L) && L.defaultProps === void 0 && c.compare === null && c.defaultProps === void 0 ? (l.tag = 15, l.type = L, Tp(o, l, L, g, x)) : (o = Oc(c.type, null, g, l, l.mode, x), o.ref = l.ref, o.return = l, l.child = o);
    }
    if (L = o.child, (o.lanes & x) === 0) {
      var $ = L.memoizedProps;
      if (c = c.compare, c = c !== null ? c : fo, c($, g) && o.ref === l.ref) return ja(o, l, x);
    }
    return l.flags |= 1, o = No(L, g), o.ref = l.ref, o.return = l, l.child = o;
  }
  function Tp(o, l, c, g, x) {
    if (o !== null) {
      var L = o.memoizedProps;
      if (fo(L, g) && o.ref === l.ref) if (ci = !1, l.pendingProps = g = L, (o.lanes & x) !== 0) (o.flags & 131072) !== 0 && (ci = !0);
      else return l.lanes = o.lanes, ja(o, l, x);
    }
    return yd(o, l, c, g, x);
  }
  function Sp(o, l, c) {
    var g = l.pendingProps, x = g.children, L = o !== null ? o.memoizedState : null;
    if (g.mode === "hidden") if ((l.mode & 1) === 0) l.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, Er(tl, Ni), Ni |= c;
    else {
      if ((c & 1073741824) === 0) return o = L !== null ? L.baseLanes | c : c, l.lanes = l.childLanes = 1073741824, l.memoizedState = { baseLanes: o, cachePool: null, transitions: null }, l.updateQueue = null, Er(tl, Ni), Ni |= o, null;
      l.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, g = L !== null ? L.baseLanes : c, Er(tl, Ni), Ni |= g;
    }
    else L !== null ? (g = L.baseLanes | c, l.memoizedState = null) : g = c, Er(tl, Ni), Ni |= g;
    return Gn(o, l, x, c), l.child;
  }
  function xp(o, l) {
    var c = l.ref;
    (o === null && c !== null || o !== null && o.ref !== c) && (l.flags |= 512, l.flags |= 2097152);
  }
  function yd(o, l, c, g, x) {
    var L = ui(c) ? Zo : An.current;
    return L = Ws(l, L), Xs(l, x), c = ld(o, l, c, g, L, x), g = ud(), o !== null && !ci ? (l.updateQueue = o.updateQueue, l.flags &= -2053, o.lanes &= ~x, ja(o, l, x)) : (Lr && g && Wf(l), l.flags |= 1, Gn(o, l, c, x), l.child);
  }
  function Ep(o, l, c, g, x) {
    if (ui(c)) {
      var L = !0;
      ec(l);
    } else L = !1;
    if (Xs(l, x), l.stateNode === null) yc(o, l), pp(l, c, g), vd(l, c, g, x), g = !0;
    else if (o === null) {
      var $ = l.stateNode, ie = l.memoizedProps;
      $.props = ie;
      var de = $.context, Ie = c.contextType;
      typeof Ie == "object" && Ie !== null ? Ie = qi(Ie) : (Ie = ui(c) ? Zo : An.current, Ie = Ws(l, Ie));
      var Je = c.getDerivedStateFromProps, Ye = typeof Je == "function" || typeof $.getSnapshotBeforeUpdate == "function";
      Ye || typeof $.UNSAFE_componentWillReceiveProps != "function" && typeof $.componentWillReceiveProps != "function" || (ie !== g || de !== Ie) && vp(l, $, g, Ie), bo = !1;
      var Ge = l.memoizedState;
      $.state = Ge, uc(l, g, $, x), de = l.memoizedState, ie !== g || Ge !== de || li.current || bo ? (typeof Je == "function" && (pd(l, c, Je, g), de = l.memoizedState), (ie = bo || hp(l, c, ie, g, Ge, de, Ie)) ? (Ye || typeof $.UNSAFE_componentWillMount != "function" && typeof $.componentWillMount != "function" || (typeof $.componentWillMount == "function" && $.componentWillMount(), typeof $.UNSAFE_componentWillMount == "function" && $.UNSAFE_componentWillMount()), typeof $.componentDidMount == "function" && (l.flags |= 4194308)) : (typeof $.componentDidMount == "function" && (l.flags |= 4194308), l.memoizedProps = g, l.memoizedState = de), $.props = g, $.state = de, $.context = Ie, g = ie) : (typeof $.componentDidMount == "function" && (l.flags |= 4194308), g = !1);
    } else {
      $ = l.stateNode, Vh(o, l), ie = l.memoizedProps, Ie = l.type === l.elementType ? ie : na(l.type, ie), $.props = Ie, Ye = l.pendingProps, Ge = $.context, de = c.contextType, typeof de == "object" && de !== null ? de = qi(de) : (de = ui(c) ? Zo : An.current, de = Ws(l, de));
      var pt = c.getDerivedStateFromProps;
      (Je = typeof pt == "function" || typeof $.getSnapshotBeforeUpdate == "function") || typeof $.UNSAFE_componentWillReceiveProps != "function" && typeof $.componentWillReceiveProps != "function" || (ie !== Ye || Ge !== de) && vp(l, $, g, de), bo = !1, Ge = l.memoizedState, $.state = Ge, uc(l, g, $, x);
      var Ct = l.memoizedState;
      ie !== Ye || Ge !== Ct || li.current || bo ? (typeof pt == "function" && (pd(l, c, pt, g), Ct = l.memoizedState), (Ie = bo || hp(l, c, Ie, g, Ge, Ct, de) || !1) ? (Je || typeof $.UNSAFE_componentWillUpdate != "function" && typeof $.componentWillUpdate != "function" || (typeof $.componentWillUpdate == "function" && $.componentWillUpdate(g, Ct, de), typeof $.UNSAFE_componentWillUpdate == "function" && $.UNSAFE_componentWillUpdate(g, Ct, de)), typeof $.componentDidUpdate == "function" && (l.flags |= 4), typeof $.getSnapshotBeforeUpdate == "function" && (l.flags |= 1024)) : (typeof $.componentDidUpdate != "function" || ie === o.memoizedProps && Ge === o.memoizedState || (l.flags |= 4), typeof $.getSnapshotBeforeUpdate != "function" || ie === o.memoizedProps && Ge === o.memoizedState || (l.flags |= 1024), l.memoizedProps = g, l.memoizedState = Ct), $.props = g, $.state = Ct, $.context = de, g = Ie) : (typeof $.componentDidUpdate != "function" || ie === o.memoizedProps && Ge === o.memoizedState || (l.flags |= 4), typeof $.getSnapshotBeforeUpdate != "function" || ie === o.memoizedProps && Ge === o.memoizedState || (l.flags |= 1024), g = !1);
    }
    return kd(o, l, c, g, L, x);
  }
  function kd(o, l, c, g, x, L) {
    xp(o, l);
    var $ = (l.flags & 128) !== 0;
    if (!g && !$) return x && Ah(l, c, !1), ja(o, l, L);
    g = l.stateNode, ig.current = l;
    var ie = $ && typeof c.getDerivedStateFromError != "function" ? null : g.render();
    return l.flags |= 1, o !== null && $ ? (l.child = Js(l, o.child, null, L), l.child = Js(l, null, ie, L)) : Gn(o, l, ie, L), l.memoizedState = g.state, x && Ah(l, c, !0), l.child;
  }
  function Mp(o) {
    var l = o.stateNode;
    l.pendingContext ? Oh(o, l.pendingContext, l.pendingContext !== l.context) : l.context && Oh(o, l.context, !1), rd(o, l.containerInfo);
  }
  function Np(o, l, c, g, x) {
    return Ks(), Jf(x), l.flags |= 256, Gn(o, l, c, g), l.child;
  }
  var wd = { dehydrated: null, treeContext: null, retryLane: 0 };
  function bd(o) {
    return { baseLanes: o, cachePool: null, transitions: null };
  }
  function Op(o, l, c) {
    var g = l.pendingProps, x = Br.current, L = !1, $ = (l.flags & 128) !== 0, ie;
    if ((ie = $) || (ie = o !== null && o.memoizedState === null ? !1 : (x & 2) !== 0), ie ? (L = !0, l.flags &= -129) : (o === null || o.memoizedState !== null) && (x |= 1), Er(Br, x & 1), o === null)
      return Kf(l), o = l.memoizedState, o !== null && (o = o.dehydrated, o !== null) ? ((l.mode & 1) === 0 ? l.lanes = 1 : o.data === "$!" ? l.lanes = 8 : l.lanes = 1073741824, null) : ($ = g.children, o = g.fallback, L ? (g = l.mode, L = l.child, $ = { mode: "hidden", children: $ }, (g & 1) === 0 && L !== null ? (L.childLanes = 0, L.pendingProps = $) : L = Dc($, g, 0, null), o = cs(o, g, c, null), L.return = l, o.return = l, L.sibling = o, l.child = L, l.child.memoizedState = bd(c), l.memoizedState = wd, o) : Cd(l, $));
    if (x = o.memoizedState, x !== null && (ie = x.dehydrated, ie !== null)) return ag(o, l, $, g, ie, x, c);
    if (L) {
      L = g.fallback, $ = l.mode, x = o.child, ie = x.sibling;
      var de = { mode: "hidden", children: g.children };
      return ($ & 1) === 0 && l.child !== x ? (g = l.child, g.childLanes = 0, g.pendingProps = de, l.deletions = null) : (g = No(x, de), g.subtreeFlags = x.subtreeFlags & 14680064), ie !== null ? L = No(ie, L) : (L = cs(L, $, c, null), L.flags |= 2), L.return = l, g.return = l, g.sibling = L, l.child = g, g = L, L = l.child, $ = o.child.memoizedState, $ = $ === null ? bd(c) : { baseLanes: $.baseLanes | c, cachePool: null, transitions: $.transitions }, L.memoizedState = $, L.childLanes = o.childLanes & ~c, l.memoizedState = wd, g;
    }
    return L = o.child, o = L.sibling, g = No(L, { mode: "visible", children: g.children }), (l.mode & 1) === 0 && (g.lanes = c), g.return = l, g.sibling = null, o !== null && (c = l.deletions, c === null ? (l.deletions = [o], l.flags |= 16) : c.push(o)), l.child = g, l.memoizedState = null, g;
  }
  function Cd(o, l) {
    return l = Dc({ mode: "visible", children: l }, o.mode, 0, null), l.return = o, o.child = l;
  }
  function gc(o, l, c, g) {
    return g !== null && Jf(g), Js(l, o.child, null, c), o = Cd(l, l.pendingProps.children), o.flags |= 2, l.memoizedState = null, o;
  }
  function ag(o, l, c, g, x, L, $) {
    if (c)
      return l.flags & 256 ? (l.flags &= -257, g = md(Error(t(422))), gc(o, l, $, g)) : l.memoizedState !== null ? (l.child = o.child, l.flags |= 128, null) : (L = g.fallback, x = l.mode, g = Dc({ mode: "visible", children: g.children }, x, 0, null), L = cs(L, x, $, null), L.flags |= 2, g.return = l, L.return = l, g.sibling = L, l.child = g, (l.mode & 1) !== 0 && Js(l, o.child, null, $), l.child.memoizedState = bd($), l.memoizedState = wd, L);
    if ((l.mode & 1) === 0) return gc(o, l, $, null);
    if (x.data === "$!") {
      if (g = x.nextSibling && x.nextSibling.dataset, g) var ie = g.dgst;
      return g = ie, L = Error(t(419)), g = md(L, g, void 0), gc(o, l, $, g);
    }
    if (ie = ($ & o.childLanes) !== 0, ci || ie) {
      if (g = hn, g !== null) {
        switch ($ & -$) {
          case 4:
            x = 2;
            break;
          case 16:
            x = 8;
            break;
          case 64:
          case 128:
          case 256:
          case 512:
          case 1024:
          case 2048:
          case 4096:
          case 8192:
          case 16384:
          case 32768:
          case 65536:
          case 131072:
          case 262144:
          case 524288:
          case 1048576:
          case 2097152:
          case 4194304:
          case 8388608:
          case 16777216:
          case 33554432:
          case 67108864:
            x = 32;
            break;
          case 536870912:
            x = 268435456;
            break;
          default:
            x = 0;
        }
        x = (x & (g.suspendedLanes | $)) !== 0 ? 0 : x, x !== 0 && x !== L.retryLane && (L.retryLane = x, $a(o, x), oa(g, o, x, -1));
      }
      return _d(), g = md(Error(t(421))), gc(o, l, $, g);
    }
    return x.data === "$?" ? (l.flags |= 128, l.child = o.child, l = yg.bind(null, o), x._reactRetry = l, null) : (o = L.treeContext, Mi = On(x.nextSibling), Ei = l, Lr = !0, ra = null, o !== null && (Fi[_i++] = Va, Fi[_i++] = Ua, Fi[_i++] = es, Va = o.id, Ua = o.overflow, es = l), l = Cd(l, g.children), l.flags |= 4096, l);
  }
  function Dp(o, l, c) {
    o.lanes |= l;
    var g = o.alternate;
    g !== null && (g.lanes |= l), Zf(o.return, l, c);
  }
  function Td(o, l, c, g, x) {
    var L = o.memoizedState;
    L === null ? o.memoizedState = { isBackwards: l, rendering: null, renderingStartTime: 0, last: g, tail: c, tailMode: x } : (L.isBackwards = l, L.rendering = null, L.renderingStartTime = 0, L.last = g, L.tail = c, L.tailMode = x);
  }
  function Ap(o, l, c) {
    var g = l.pendingProps, x = g.revealOrder, L = g.tail;
    if (Gn(o, l, g.children, c), g = Br.current, (g & 2) !== 0) g = g & 1 | 2, l.flags |= 128;
    else {
      if (o !== null && (o.flags & 128) !== 0) e: for (o = l.child; o !== null; ) {
        if (o.tag === 13) o.memoizedState !== null && Dp(o, c, l);
        else if (o.tag === 19) Dp(o, c, l);
        else if (o.child !== null) {
          o.child.return = o, o = o.child;
          continue;
        }
        if (o === l) break e;
        for (; o.sibling === null; ) {
          if (o.return === null || o.return === l) break e;
          o = o.return;
        }
        o.sibling.return = o.return, o = o.sibling;
      }
      g &= 1;
    }
    if (Er(Br, g), (l.mode & 1) === 0) l.memoizedState = null;
    else switch (x) {
      case "forwards":
        for (c = l.child, x = null; c !== null; ) o = c.alternate, o !== null && cc(o) === null && (x = c), c = c.sibling;
        c = x, c === null ? (x = l.child, l.child = null) : (x = c.sibling, c.sibling = null), Td(l, !1, x, c, L);
        break;
      case "backwards":
        for (c = null, x = l.child, l.child = null; x !== null; ) {
          if (o = x.alternate, o !== null && cc(o) === null) {
            l.child = x;
            break;
          }
          o = x.sibling, x.sibling = c, c = x, x = o;
        }
        Td(l, !0, c, null, L);
        break;
      case "together":
        Td(l, !1, null, null, void 0);
        break;
      default:
        l.memoizedState = null;
    }
    return l.child;
  }
  function yc(o, l) {
    (l.mode & 1) === 0 && o !== null && (o.alternate = null, l.alternate = null, l.flags |= 2);
  }
  function ja(o, l, c) {
    if (o !== null && (l.dependencies = o.dependencies), as |= l.lanes, (c & l.childLanes) === 0) return null;
    if (o !== null && l.child !== o.child) throw Error(t(153));
    if (l.child !== null) {
      for (o = l.child, c = No(o, o.pendingProps), l.child = c, c.return = l; o.sibling !== null; ) o = o.sibling, c = c.sibling = No(o, o.pendingProps), c.return = l;
      c.sibling = null;
    }
    return l.child;
  }
  function og(o, l, c) {
    switch (l.tag) {
      case 3:
        Mp(l), Ks();
        break;
      case 5:
        Wh(l);
        break;
      case 1:
        ui(l.type) && ec(l);
        break;
      case 4:
        rd(l, l.stateNode.containerInfo);
        break;
      case 10:
        var g = l.type._context, x = l.memoizedProps.value;
        Er(oc, g._currentValue), g._currentValue = x;
        break;
      case 13:
        if (g = l.memoizedState, g !== null)
          return g.dehydrated !== null ? (Er(Br, Br.current & 1), l.flags |= 128, null) : (c & l.child.childLanes) !== 0 ? Op(o, l, c) : (Er(Br, Br.current & 1), o = ja(o, l, c), o !== null ? o.sibling : null);
        Er(Br, Br.current & 1);
        break;
      case 19:
        if (g = (c & l.childLanes) !== 0, (o.flags & 128) !== 0) {
          if (g) return Ap(o, l, c);
          l.flags |= 128;
        }
        if (x = l.memoizedState, x !== null && (x.rendering = null, x.tail = null, x.lastEffect = null), Er(Br, Br.current), g) break;
        return null;
      case 22:
      case 23:
        return l.lanes = 0, Sp(o, l, c);
    }
    return ja(o, l, c);
  }
  var Lp, Sd, Rp, Ip;
  Lp = function(o, l) {
    for (var c = l.child; c !== null; ) {
      if (c.tag === 5 || c.tag === 6) o.appendChild(c.stateNode);
      else if (c.tag !== 4 && c.child !== null) {
        c.child.return = c, c = c.child;
        continue;
      }
      if (c === l) break;
      for (; c.sibling === null; ) {
        if (c.return === null || c.return === l) return;
        c = c.return;
      }
      c.sibling.return = c.return, c = c.sibling;
    }
  }, Sd = function() {
  }, Rp = function(o, l, c, g) {
    var x = o.memoizedProps;
    if (x !== g) {
      o = l.stateNode, ns(ka.current);
      var L = null;
      switch (c) {
        case "input":
          x = Ve(o, x), g = Ve(o, g), L = [];
          break;
        case "select":
          x = He({}, x, { value: void 0 }), g = He({}, g, { value: void 0 }), L = [];
          break;
        case "textarea":
          x = ar(o, x), g = ar(o, g), L = [];
          break;
        default:
          typeof x.onClick != "function" && typeof g.onClick == "function" && (o.onclick = Gt);
      }
      Vn(c, g);
      var $;
      c = null;
      for (Ie in x) if (!g.hasOwnProperty(Ie) && x.hasOwnProperty(Ie) && x[Ie] != null) if (Ie === "style") {
        var ie = x[Ie];
        for ($ in ie) ie.hasOwnProperty($) && (c || (c = {}), c[$] = "");
      } else Ie !== "dangerouslySetInnerHTML" && Ie !== "children" && Ie !== "suppressContentEditableWarning" && Ie !== "suppressHydrationWarning" && Ie !== "autoFocus" && (i.hasOwnProperty(Ie) ? L || (L = []) : (L = L || []).push(Ie, null));
      for (Ie in g) {
        var de = g[Ie];
        if (ie = x?.[Ie], g.hasOwnProperty(Ie) && de !== ie && (de != null || ie != null)) if (Ie === "style") if (ie) {
          for ($ in ie) !ie.hasOwnProperty($) || de && de.hasOwnProperty($) || (c || (c = {}), c[$] = "");
          for ($ in de) de.hasOwnProperty($) && ie[$] !== de[$] && (c || (c = {}), c[$] = de[$]);
        } else c || (L || (L = []), L.push(
          Ie,
          c
        )), c = de;
        else Ie === "dangerouslySetInnerHTML" ? (de = de ? de.__html : void 0, ie = ie ? ie.__html : void 0, de != null && ie !== de && (L = L || []).push(Ie, de)) : Ie === "children" ? typeof de != "string" && typeof de != "number" || (L = L || []).push(Ie, "" + de) : Ie !== "suppressContentEditableWarning" && Ie !== "suppressHydrationWarning" && (i.hasOwnProperty(Ie) ? (de != null && Ie === "onScroll" && I("scroll", o), L || ie === de || (L = [])) : (L = L || []).push(Ie, de));
      }
      c && (L = L || []).push("style", c);
      var Ie = L;
      (l.updateQueue = Ie) && (l.flags |= 4);
    }
  }, Ip = function(o, l, c, g) {
    c !== g && (l.flags |= 4);
  };
  function Xl(o, l) {
    if (!Lr) switch (o.tailMode) {
      case "hidden":
        l = o.tail;
        for (var c = null; l !== null; ) l.alternate !== null && (c = l), l = l.sibling;
        c === null ? o.tail = null : c.sibling = null;
        break;
      case "collapsed":
        c = o.tail;
        for (var g = null; c !== null; ) c.alternate !== null && (g = c), c = c.sibling;
        g === null ? l || o.tail === null ? o.tail = null : o.tail.sibling = null : g.sibling = null;
    }
  }
  function Rn(o) {
    var l = o.alternate !== null && o.alternate.child === o.child, c = 0, g = 0;
    if (l) for (var x = o.child; x !== null; ) c |= x.lanes | x.childLanes, g |= x.subtreeFlags & 14680064, g |= x.flags & 14680064, x.return = o, x = x.sibling;
    else for (x = o.child; x !== null; ) c |= x.lanes | x.childLanes, g |= x.subtreeFlags, g |= x.flags, x.return = o, x = x.sibling;
    return o.subtreeFlags |= g, o.childLanes = c, l;
  }
  function sg(o, l, c) {
    var g = l.pendingProps;
    switch (jf(l), l.tag) {
      case 2:
      case 16:
      case 15:
      case 0:
      case 11:
      case 7:
      case 8:
      case 12:
      case 9:
      case 14:
        return Rn(l), null;
      case 1:
        return ui(l.type) && Zu(), Rn(l), null;
      case 3:
        return g = l.stateNode, Ys(), Dr(li), Dr(An), ad(), g.pendingContext && (g.context = g.pendingContext, g.pendingContext = null), (o === null || o.child === null) && (ic(l) ? l.flags |= 4 : o === null || o.memoizedState.isDehydrated && (l.flags & 256) === 0 || (l.flags |= 1024, ra !== null && (Pd(ra), ra = null))), Sd(o, l), Rn(l), null;
      case 5:
        nd(l);
        var x = ns(jl.current);
        if (c = l.type, o !== null && l.stateNode != null) Rp(o, l, c, g, x), o.ref !== l.ref && (l.flags |= 512, l.flags |= 2097152);
        else {
          if (!g) {
            if (l.stateNode === null) throw Error(t(166));
            return Rn(l), null;
          }
          if (o = ns(ka.current), ic(l)) {
            g = l.stateNode, c = l.type;
            var L = l.memoizedProps;
            switch (g[si] = l, g[Dn] = L, o = (l.mode & 1) !== 0, c) {
              case "dialog":
                I("cancel", g), I("close", g);
                break;
              case "iframe":
              case "object":
              case "embed":
                I("load", g);
                break;
              case "video":
              case "audio":
                for (x = 0; x < k.length; x++) I(k[x], g);
                break;
              case "source":
                I("error", g);
                break;
              case "img":
              case "image":
              case "link":
                I(
                  "error",
                  g
                ), I("load", g);
                break;
              case "details":
                I("toggle", g);
                break;
              case "input":
                lt(g, L), I("invalid", g);
                break;
              case "select":
                g._wrapperState = { wasMultiple: !!L.multiple }, I("invalid", g);
                break;
              case "textarea":
                Wr(g, L), I("invalid", g);
            }
            Vn(c, L), x = null;
            for (var $ in L) if (L.hasOwnProperty($)) {
              var ie = L[$];
              $ === "children" ? typeof ie == "string" ? g.textContent !== ie && (L.suppressHydrationWarning !== !0 && Dt(g.textContent, ie, o), x = ["children", ie]) : typeof ie == "number" && g.textContent !== "" + ie && (L.suppressHydrationWarning !== !0 && Dt(
                g.textContent,
                ie,
                o
              ), x = ["children", "" + ie]) : i.hasOwnProperty($) && ie != null && $ === "onScroll" && I("scroll", g);
            }
            switch (c) {
              case "input":
                ge(g), jt(g, L, !0);
                break;
              case "textarea":
                ge(g), Hn(g);
                break;
              case "select":
              case "option":
                break;
              default:
                typeof L.onClick == "function" && (g.onclick = Gt);
            }
            g = x, l.updateQueue = g, g !== null && (l.flags |= 4);
          } else {
            $ = x.nodeType === 9 ? x : x.ownerDocument, o === "http://www.w3.org/1999/xhtml" && (o = _r(c)), o === "http://www.w3.org/1999/xhtml" ? c === "script" ? (o = $.createElement("div"), o.innerHTML = "<script><\/script>", o = o.removeChild(o.firstChild)) : typeof g.is == "string" ? o = $.createElement(c, { is: g.is }) : (o = $.createElement(c), c === "select" && ($ = o, g.multiple ? $.multiple = !0 : g.size && ($.size = g.size))) : o = $.createElementNS(o, c), o[si] = l, o[Dn] = g, Lp(o, l, !1, !1), l.stateNode = o;
            e: {
              switch ($ = Rr(c, g), c) {
                case "dialog":
                  I("cancel", o), I("close", o), x = g;
                  break;
                case "iframe":
                case "object":
                case "embed":
                  I("load", o), x = g;
                  break;
                case "video":
                case "audio":
                  for (x = 0; x < k.length; x++) I(k[x], o);
                  x = g;
                  break;
                case "source":
                  I("error", o), x = g;
                  break;
                case "img":
                case "image":
                case "link":
                  I(
                    "error",
                    o
                  ), I("load", o), x = g;
                  break;
                case "details":
                  I("toggle", o), x = g;
                  break;
                case "input":
                  lt(o, g), x = Ve(o, g), I("invalid", o);
                  break;
                case "option":
                  x = g;
                  break;
                case "select":
                  o._wrapperState = { wasMultiple: !!g.multiple }, x = He({}, g, { value: void 0 }), I("invalid", o);
                  break;
                case "textarea":
                  Wr(o, g), x = ar(o, g), I("invalid", o);
                  break;
                default:
                  x = g;
              }
              Vn(c, x), ie = x;
              for (L in ie) if (ie.hasOwnProperty(L)) {
                var de = ie[L];
                L === "style" ? xr(o, de) : L === "dangerouslySetInnerHTML" ? (de = de ? de.__html : void 0, de != null && _t(o, de)) : L === "children" ? typeof de == "string" ? (c !== "textarea" || de !== "") && Vt(o, de) : typeof de == "number" && Vt(o, "" + de) : L !== "suppressContentEditableWarning" && L !== "suppressHydrationWarning" && L !== "autoFocus" && (i.hasOwnProperty(L) ? de != null && L === "onScroll" && I("scroll", o) : de != null && se(o, L, de, $));
              }
              switch (c) {
                case "input":
                  ge(o), jt(o, g, !1);
                  break;
                case "textarea":
                  ge(o), Hn(o);
                  break;
                case "option":
                  g.value != null && o.setAttribute("value", "" + Te(g.value));
                  break;
                case "select":
                  o.multiple = !!g.multiple, L = g.value, L != null ? yr(o, !!g.multiple, L, !1) : g.defaultValue != null && yr(
                    o,
                    !!g.multiple,
                    g.defaultValue,
                    !0
                  );
                  break;
                default:
                  typeof x.onClick == "function" && (o.onclick = Gt);
              }
              switch (c) {
                case "button":
                case "input":
                case "select":
                case "textarea":
                  g = !!g.autoFocus;
                  break e;
                case "img":
                  g = !0;
                  break e;
                default:
                  g = !1;
              }
            }
            g && (l.flags |= 4);
          }
          l.ref !== null && (l.flags |= 512, l.flags |= 2097152);
        }
        return Rn(l), null;
      case 6:
        if (o && l.stateNode != null) Ip(o, l, o.memoizedProps, g);
        else {
          if (typeof g != "string" && l.stateNode === null) throw Error(t(166));
          if (c = ns(jl.current), ns(ka.current), ic(l)) {
            if (g = l.stateNode, c = l.memoizedProps, g[si] = l, (L = g.nodeValue !== c) && (o = Ei, o !== null)) switch (o.tag) {
              case 3:
                Dt(g.nodeValue, c, (o.mode & 1) !== 0);
                break;
              case 5:
                o.memoizedProps.suppressHydrationWarning !== !0 && Dt(g.nodeValue, c, (o.mode & 1) !== 0);
            }
            L && (l.flags |= 4);
          } else g = (c.nodeType === 9 ? c : c.ownerDocument).createTextNode(g), g[si] = l, l.stateNode = g;
        }
        return Rn(l), null;
      case 13:
        if (Dr(Br), g = l.memoizedState, o === null || o.memoizedState !== null && o.memoizedState.dehydrated !== null) {
          if (Lr && Mi !== null && (l.mode & 1) !== 0 && (l.flags & 128) === 0) Fh(), Ks(), l.flags |= 98560, L = !1;
          else if (L = ic(l), g !== null && g.dehydrated !== null) {
            if (o === null) {
              if (!L) throw Error(t(318));
              if (L = l.memoizedState, L = L !== null ? L.dehydrated : null, !L) throw Error(t(317));
              L[si] = l;
            } else Ks(), (l.flags & 128) === 0 && (l.memoizedState = null), l.flags |= 4;
            Rn(l), L = !1;
          } else ra !== null && (Pd(ra), ra = null), L = !0;
          if (!L) return l.flags & 65536 ? l : null;
        }
        return (l.flags & 128) !== 0 ? (l.lanes = c, l) : (g = g !== null, g !== (o !== null && o.memoizedState !== null) && g && (l.child.flags |= 8192, (l.mode & 1) !== 0 && (o === null || (Br.current & 1) !== 0 ? an === 0 && (an = 3) : _d())), l.updateQueue !== null && (l.flags |= 4), Rn(l), null);
      case 4:
        return Ys(), Sd(o, l), o === null && le(l.stateNode.containerInfo), Rn(l), null;
      case 10:
        return Yf(l.type._context), Rn(l), null;
      case 17:
        return ui(l.type) && Zu(), Rn(l), null;
      case 19:
        if (Dr(Br), L = l.memoizedState, L === null) return Rn(l), null;
        if (g = (l.flags & 128) !== 0, $ = L.rendering, $ === null) if (g) Xl(L, !1);
        else {
          if (an !== 0 || o !== null && (o.flags & 128) !== 0) for (o = l.child; o !== null; ) {
            if ($ = cc(o), $ !== null) {
              for (l.flags |= 128, Xl(L, !1), g = $.updateQueue, g !== null && (l.updateQueue = g, l.flags |= 4), l.subtreeFlags = 0, g = c, c = l.child; c !== null; ) L = c, o = g, L.flags &= 14680066, $ = L.alternate, $ === null ? (L.childLanes = 0, L.lanes = o, L.child = null, L.subtreeFlags = 0, L.memoizedProps = null, L.memoizedState = null, L.updateQueue = null, L.dependencies = null, L.stateNode = null) : (L.childLanes = $.childLanes, L.lanes = $.lanes, L.child = $.child, L.subtreeFlags = 0, L.deletions = null, L.memoizedProps = $.memoizedProps, L.memoizedState = $.memoizedState, L.updateQueue = $.updateQueue, L.type = $.type, o = $.dependencies, L.dependencies = o === null ? null : { lanes: o.lanes, firstContext: o.firstContext }), c = c.sibling;
              return Er(Br, Br.current & 1 | 2), l.child;
            }
            o = o.sibling;
          }
          L.tail !== null && ye() > rl && (l.flags |= 128, g = !0, Xl(L, !1), l.lanes = 4194304);
        }
        else {
          if (!g) if (o = cc($), o !== null) {
            if (l.flags |= 128, g = !0, c = o.updateQueue, c !== null && (l.updateQueue = c, l.flags |= 4), Xl(L, !0), L.tail === null && L.tailMode === "hidden" && !$.alternate && !Lr) return Rn(l), null;
          } else 2 * ye() - L.renderingStartTime > rl && c !== 1073741824 && (l.flags |= 128, g = !0, Xl(L, !1), l.lanes = 4194304);
          L.isBackwards ? ($.sibling = l.child, l.child = $) : (c = L.last, c !== null ? c.sibling = $ : l.child = $, L.last = $);
        }
        return L.tail !== null ? (l = L.tail, L.rendering = l, L.tail = l.sibling, L.renderingStartTime = ye(), l.sibling = null, c = Br.current, Er(Br, g ? c & 1 | 2 : c & 1), l) : (Rn(l), null);
      case 22:
      case 23:
        return Fd(), g = l.memoizedState !== null, o !== null && o.memoizedState !== null !== g && (l.flags |= 8192), g && (l.mode & 1) !== 0 ? (Ni & 1073741824) !== 0 && (Rn(l), l.subtreeFlags & 6 && (l.flags |= 8192)) : Rn(l), null;
      case 24:
        return null;
      case 25:
        return null;
    }
    throw Error(t(156, l.tag));
  }
  function lg(o, l) {
    switch (jf(l), l.tag) {
      case 1:
        return ui(l.type) && Zu(), o = l.flags, o & 65536 ? (l.flags = o & -65537 | 128, l) : null;
      case 3:
        return Ys(), Dr(li), Dr(An), ad(), o = l.flags, (o & 65536) !== 0 && (o & 128) === 0 ? (l.flags = o & -65537 | 128, l) : null;
      case 5:
        return nd(l), null;
      case 13:
        if (Dr(Br), o = l.memoizedState, o !== null && o.dehydrated !== null) {
          if (l.alternate === null) throw Error(t(340));
          Ks();
        }
        return o = l.flags, o & 65536 ? (l.flags = o & -65537 | 128, l) : null;
      case 19:
        return Dr(Br), null;
      case 4:
        return Ys(), null;
      case 10:
        return Yf(l.type._context), null;
      case 22:
      case 23:
        return Fd(), null;
      case 24:
        return null;
      default:
        return null;
    }
  }
  var kc = !1, In = !1, ug = typeof WeakSet == "function" ? WeakSet : Set, kt = null;
  function el(o, l) {
    var c = o.ref;
    if (c !== null) if (typeof c == "function") try {
      c(null);
    } catch (g) {
      Ur(o, l, g);
    }
    else c.current = null;
  }
  function xd(o, l, c) {
    try {
      c();
    } catch (g) {
      Ur(o, l, g);
    }
  }
  var Pp = !1;
  function cg(o, l) {
    if (lr = wt, o = Gu(), Il(o)) {
      if ("selectionStart" in o) var c = { start: o.selectionStart, end: o.selectionEnd };
      else e: {
        c = (c = o.ownerDocument) && c.defaultView || window;
        var g = c.getSelection && c.getSelection();
        if (g && g.rangeCount !== 0) {
          c = g.anchorNode;
          var x = g.anchorOffset, L = g.focusNode;
          g = g.focusOffset;
          try {
            c.nodeType, L.nodeType;
          } catch {
            c = null;
            break e;
          }
          var $ = 0, ie = -1, de = -1, Ie = 0, Je = 0, Ye = o, Ge = null;
          t: for (; ; ) {
            for (var pt; Ye !== c || x !== 0 && Ye.nodeType !== 3 || (ie = $ + x), Ye !== L || g !== 0 && Ye.nodeType !== 3 || (de = $ + g), Ye.nodeType === 3 && ($ += Ye.nodeValue.length), (pt = Ye.firstChild) !== null; )
              Ge = Ye, Ye = pt;
            for (; ; ) {
              if (Ye === o) break t;
              if (Ge === c && ++Ie === x && (ie = $), Ge === L && ++Je === g && (de = $), (pt = Ye.nextSibling) !== null) break;
              Ye = Ge, Ge = Ye.parentNode;
            }
            Ye = pt;
          }
          c = ie === -1 || de === -1 ? null : { start: ie, end: de };
        } else c = null;
      }
      c = c || { start: 0, end: 0 };
    } else c = null;
    for (or = { focusedElem: o, selectionRange: c }, wt = !1, kt = l; kt !== null; ) if (l = kt, o = l.child, (l.subtreeFlags & 1028) !== 0 && o !== null) o.return = l, kt = o;
    else for (; kt !== null; ) {
      l = kt;
      try {
        var Ct = l.alternate;
        if ((l.flags & 1024) !== 0) switch (l.tag) {
          case 0:
          case 11:
          case 15:
            break;
          case 1:
            if (Ct !== null) {
              var xt = Ct.memoizedProps, Kr = Ct.memoizedState, Me = l.stateNode, we = Me.getSnapshotBeforeUpdate(l.elementType === l.type ? xt : na(l.type, xt), Kr);
              Me.__reactInternalSnapshotBeforeUpdate = we;
            }
            break;
          case 3:
            var De = l.stateNode.containerInfo;
            De.nodeType === 1 ? De.textContent = "" : De.nodeType === 9 && De.documentElement && De.removeChild(De.documentElement);
            break;
          case 5:
          case 6:
          case 4:
          case 17:
            break;
          default:
            throw Error(t(163));
        }
      } catch (rt) {
        Ur(l, l.return, rt);
      }
      if (o = l.sibling, o !== null) {
        o.return = l.return, kt = o;
        break;
      }
      kt = l.return;
    }
    return Ct = Pp, Pp = !1, Ct;
  }
  function Yl(o, l, c) {
    var g = l.updateQueue;
    if (g = g !== null ? g.lastEffect : null, g !== null) {
      var x = g = g.next;
      do {
        if ((x.tag & o) === o) {
          var L = x.destroy;
          x.destroy = void 0, L !== void 0 && xd(l, c, L);
        }
        x = x.next;
      } while (x !== g);
    }
  }
  function wc(o, l) {
    if (l = l.updateQueue, l = l !== null ? l.lastEffect : null, l !== null) {
      var c = l = l.next;
      do {
        if ((c.tag & o) === o) {
          var g = c.create;
          c.destroy = g();
        }
        c = c.next;
      } while (c !== l);
    }
  }
  function Ed(o) {
    var l = o.ref;
    if (l !== null) {
      var c = o.stateNode;
      o.tag, o = c, typeof l == "function" ? l(o) : l.current = o;
    }
  }
  function Bp(o) {
    var l = o.alternate;
    l !== null && (o.alternate = null, Bp(l)), o.child = null, o.deletions = null, o.sibling = null, o.tag === 5 && (l = o.stateNode, l !== null && (delete l[si], delete l[Dn], delete l[Vs], delete l[Xu], delete l[Gm])), o.stateNode = null, o.return = null, o.dependencies = null, o.memoizedProps = null, o.memoizedState = null, o.pendingProps = null, o.stateNode = null, o.updateQueue = null;
  }
  function Fp(o) {
    return o.tag === 5 || o.tag === 3 || o.tag === 4;
  }
  function _p(o) {
    e: for (; ; ) {
      for (; o.sibling === null; ) {
        if (o.return === null || Fp(o.return)) return null;
        o = o.return;
      }
      for (o.sibling.return = o.return, o = o.sibling; o.tag !== 5 && o.tag !== 6 && o.tag !== 18; ) {
        if (o.flags & 2 || o.child === null || o.tag === 4) continue e;
        o.child.return = o, o = o.child;
      }
      if (!(o.flags & 2)) return o.stateNode;
    }
  }
  function Md(o, l, c) {
    var g = o.tag;
    if (g === 5 || g === 6) o = o.stateNode, l ? c.nodeType === 8 ? c.parentNode.insertBefore(o, l) : c.insertBefore(o, l) : (c.nodeType === 8 ? (l = c.parentNode, l.insertBefore(o, c)) : (l = c, l.appendChild(o)), c = c._reactRootContainer, c != null || l.onclick !== null || (l.onclick = Gt));
    else if (g !== 4 && (o = o.child, o !== null)) for (Md(o, l, c), o = o.sibling; o !== null; ) Md(o, l, c), o = o.sibling;
  }
  function Nd(o, l, c) {
    var g = o.tag;
    if (g === 5 || g === 6) o = o.stateNode, l ? c.insertBefore(o, l) : c.appendChild(o);
    else if (g !== 4 && (o = o.child, o !== null)) for (Nd(o, l, c), o = o.sibling; o !== null; ) Nd(o, l, c), o = o.sibling;
  }
  var wn = null, ia = !1;
  function To(o, l, c) {
    for (c = c.child; c !== null; ) qp(o, l, c), c = c.sibling;
  }
  function qp(o, l, c) {
    if (Ir && typeof Ir.onCommitFiberUnmount == "function") try {
      Ir.onCommitFiberUnmount(hr, c);
    } catch {
    }
    switch (c.tag) {
      case 5:
        In || el(c, l);
      case 6:
        var g = wn, x = ia;
        wn = null, To(o, l, c), wn = g, ia = x, wn !== null && (ia ? (o = wn, c = c.stateNode, o.nodeType === 8 ? o.parentNode.removeChild(c) : o.removeChild(c)) : wn.removeChild(c.stateNode));
        break;
      case 18:
        wn !== null && (ia ? (o = wn, c = c.stateNode, o.nodeType === 8 ? ta(o.parentNode, c) : o.nodeType === 1 && ta(o, c), Se(o)) : ta(wn, c.stateNode));
        break;
      case 4:
        g = wn, x = ia, wn = c.stateNode.containerInfo, ia = !0, To(o, l, c), wn = g, ia = x;
        break;
      case 0:
      case 11:
      case 14:
      case 15:
        if (!In && (g = c.updateQueue, g !== null && (g = g.lastEffect, g !== null))) {
          x = g = g.next;
          do {
            var L = x, $ = L.destroy;
            L = L.tag, $ !== void 0 && ((L & 2) !== 0 || (L & 4) !== 0) && xd(c, l, $), x = x.next;
          } while (x !== g);
        }
        To(o, l, c);
        break;
      case 1:
        if (!In && (el(c, l), g = c.stateNode, typeof g.componentWillUnmount == "function")) try {
          g.props = c.memoizedProps, g.state = c.memoizedState, g.componentWillUnmount();
        } catch (ie) {
          Ur(c, l, ie);
        }
        To(o, l, c);
        break;
      case 21:
        To(o, l, c);
        break;
      case 22:
        c.mode & 1 ? (In = (g = In) || c.memoizedState !== null, To(o, l, c), In = g) : To(o, l, c);
        break;
      default:
        To(o, l, c);
    }
  }
  function zp(o) {
    var l = o.updateQueue;
    if (l !== null) {
      o.updateQueue = null;
      var c = o.stateNode;
      c === null && (c = o.stateNode = new ug()), l.forEach(function(g) {
        var x = kg.bind(null, o, g);
        c.has(g) || (c.add(g), g.then(x, x));
      });
    }
  }
  function aa(o, l) {
    var c = l.deletions;
    if (c !== null) for (var g = 0; g < c.length; g++) {
      var x = c[g];
      try {
        var L = o, $ = l, ie = $;
        e: for (; ie !== null; ) {
          switch (ie.tag) {
            case 5:
              wn = ie.stateNode, ia = !1;
              break e;
            case 3:
              wn = ie.stateNode.containerInfo, ia = !0;
              break e;
            case 4:
              wn = ie.stateNode.containerInfo, ia = !0;
              break e;
          }
          ie = ie.return;
        }
        if (wn === null) throw Error(t(160));
        qp(L, $, x), wn = null, ia = !1;
        var de = x.alternate;
        de !== null && (de.return = null), x.return = null;
      } catch (Ie) {
        Ur(x, l, Ie);
      }
    }
    if (l.subtreeFlags & 12854) for (l = l.child; l !== null; ) Hp(l, o), l = l.sibling;
  }
  function Hp(o, l) {
    var c = o.alternate, g = o.flags;
    switch (o.tag) {
      case 0:
      case 11:
      case 14:
      case 15:
        if (aa(l, o), ba(o), g & 4) {
          try {
            Yl(3, o, o.return), wc(3, o);
          } catch (xt) {
            Ur(o, o.return, xt);
          }
          try {
            Yl(5, o, o.return);
          } catch (xt) {
            Ur(o, o.return, xt);
          }
        }
        break;
      case 1:
        aa(l, o), ba(o), g & 512 && c !== null && el(c, c.return);
        break;
      case 5:
        if (aa(l, o), ba(o), g & 512 && c !== null && el(c, c.return), o.flags & 32) {
          var x = o.stateNode;
          try {
            Vt(x, "");
          } catch (xt) {
            Ur(o, o.return, xt);
          }
        }
        if (g & 4 && (x = o.stateNode, x != null)) {
          var L = o.memoizedProps, $ = c !== null ? c.memoizedProps : L, ie = o.type, de = o.updateQueue;
          if (o.updateQueue = null, de !== null) try {
            ie === "input" && L.type === "radio" && L.name != null && Tt(x, L), Rr(ie, $);
            var Ie = Rr(ie, L);
            for ($ = 0; $ < de.length; $ += 2) {
              var Je = de[$], Ye = de[$ + 1];
              Je === "style" ? xr(x, Ye) : Je === "dangerouslySetInnerHTML" ? _t(x, Ye) : Je === "children" ? Vt(x, Ye) : se(x, Je, Ye, Ie);
            }
            switch (ie) {
              case "input":
                Yt(x, L);
                break;
              case "textarea":
                ki(x, L);
                break;
              case "select":
                var Ge = x._wrapperState.wasMultiple;
                x._wrapperState.wasMultiple = !!L.multiple;
                var pt = L.value;
                pt != null ? yr(x, !!L.multiple, pt, !1) : Ge !== !!L.multiple && (L.defaultValue != null ? yr(
                  x,
                  !!L.multiple,
                  L.defaultValue,
                  !0
                ) : yr(x, !!L.multiple, L.multiple ? [] : "", !1));
            }
            x[Dn] = L;
          } catch (xt) {
            Ur(o, o.return, xt);
          }
        }
        break;
      case 6:
        if (aa(l, o), ba(o), g & 4) {
          if (o.stateNode === null) throw Error(t(162));
          x = o.stateNode, L = o.memoizedProps;
          try {
            x.nodeValue = L;
          } catch (xt) {
            Ur(o, o.return, xt);
          }
        }
        break;
      case 3:
        if (aa(l, o), ba(o), g & 4 && c !== null && c.memoizedState.isDehydrated) try {
          Se(l.containerInfo);
        } catch (xt) {
          Ur(o, o.return, xt);
        }
        break;
      case 4:
        aa(l, o), ba(o);
        break;
      case 13:
        aa(l, o), ba(o), x = o.child, x.flags & 8192 && (L = x.memoizedState !== null, x.stateNode.isHidden = L, !L || x.alternate !== null && x.alternate.memoizedState !== null || (Ad = ye())), g & 4 && zp(o);
        break;
      case 22:
        if (Je = c !== null && c.memoizedState !== null, o.mode & 1 ? (In = (Ie = In) || Je, aa(l, o), In = Ie) : aa(l, o), ba(o), g & 8192) {
          if (Ie = o.memoizedState !== null, (o.stateNode.isHidden = Ie) && !Je && (o.mode & 1) !== 0) for (kt = o, Je = o.child; Je !== null; ) {
            for (Ye = kt = Je; kt !== null; ) {
              switch (Ge = kt, pt = Ge.child, Ge.tag) {
                case 0:
                case 11:
                case 14:
                case 15:
                  Yl(4, Ge, Ge.return);
                  break;
                case 1:
                  el(Ge, Ge.return);
                  var Ct = Ge.stateNode;
                  if (typeof Ct.componentWillUnmount == "function") {
                    g = Ge, c = Ge.return;
                    try {
                      l = g, Ct.props = l.memoizedProps, Ct.state = l.memoizedState, Ct.componentWillUnmount();
                    } catch (xt) {
                      Ur(g, c, xt);
                    }
                  }
                  break;
                case 5:
                  el(Ge, Ge.return);
                  break;
                case 22:
                  if (Ge.memoizedState !== null) {
                    $p(Ye);
                    continue;
                  }
              }
              pt !== null ? (pt.return = Ge, kt = pt) : $p(Ye);
            }
            Je = Je.sibling;
          }
          e: for (Je = null, Ye = o; ; ) {
            if (Ye.tag === 5) {
              if (Je === null) {
                Je = Ye;
                try {
                  x = Ye.stateNode, Ie ? (L = x.style, typeof L.setProperty == "function" ? L.setProperty("display", "none", "important") : L.display = "none") : (ie = Ye.stateNode, de = Ye.memoizedProps.style, $ = de != null && de.hasOwnProperty("display") ? de.display : null, ie.style.display = kr("display", $));
                } catch (xt) {
                  Ur(o, o.return, xt);
                }
              }
            } else if (Ye.tag === 6) {
              if (Je === null) try {
                Ye.stateNode.nodeValue = Ie ? "" : Ye.memoizedProps;
              } catch (xt) {
                Ur(o, o.return, xt);
              }
            } else if ((Ye.tag !== 22 && Ye.tag !== 23 || Ye.memoizedState === null || Ye === o) && Ye.child !== null) {
              Ye.child.return = Ye, Ye = Ye.child;
              continue;
            }
            if (Ye === o) break e;
            for (; Ye.sibling === null; ) {
              if (Ye.return === null || Ye.return === o) break e;
              Je === Ye && (Je = null), Ye = Ye.return;
            }
            Je === Ye && (Je = null), Ye.sibling.return = Ye.return, Ye = Ye.sibling;
          }
        }
        break;
      case 19:
        aa(l, o), ba(o), g & 4 && zp(o);
        break;
      case 21:
        break;
      default:
        aa(
          l,
          o
        ), ba(o);
    }
  }
  function ba(o) {
    var l = o.flags;
    if (l & 2) {
      try {
        e: {
          for (var c = o.return; c !== null; ) {
            if (Fp(c)) {
              var g = c;
              break e;
            }
            c = c.return;
          }
          throw Error(t(160));
        }
        switch (g.tag) {
          case 5:
            var x = g.stateNode;
            g.flags & 32 && (Vt(x, ""), g.flags &= -33);
            var L = _p(o);
            Nd(o, L, x);
            break;
          case 3:
          case 4:
            var $ = g.stateNode.containerInfo, ie = _p(o);
            Md(o, ie, $);
            break;
          default:
            throw Error(t(161));
        }
      } catch (de) {
        Ur(o, o.return, de);
      }
      o.flags &= -3;
    }
    l & 4096 && (o.flags &= -4097);
  }
  function fg(o, l, c) {
    kt = o, Vp(o);
  }
  function Vp(o, l, c) {
    for (var g = (o.mode & 1) !== 0; kt !== null; ) {
      var x = kt, L = x.child;
      if (x.tag === 22 && g) {
        var $ = x.memoizedState !== null || kc;
        if (!$) {
          var ie = x.alternate, de = ie !== null && ie.memoizedState !== null || In;
          ie = kc;
          var Ie = In;
          if (kc = $, (In = de) && !Ie) for (kt = x; kt !== null; ) $ = kt, de = $.child, $.tag === 22 && $.memoizedState !== null ? Wp(x) : de !== null ? (de.return = $, kt = de) : Wp(x);
          for (; L !== null; ) kt = L, Vp(L), L = L.sibling;
          kt = x, kc = ie, In = Ie;
        }
        Up(o);
      } else (x.subtreeFlags & 8772) !== 0 && L !== null ? (L.return = x, kt = L) : Up(o);
    }
  }
  function Up(o) {
    for (; kt !== null; ) {
      var l = kt;
      if ((l.flags & 8772) !== 0) {
        var c = l.alternate;
        try {
          if ((l.flags & 8772) !== 0) switch (l.tag) {
            case 0:
            case 11:
            case 15:
              In || wc(5, l);
              break;
            case 1:
              var g = l.stateNode;
              if (l.flags & 4 && !In) if (c === null) g.componentDidMount();
              else {
                var x = l.elementType === l.type ? c.memoizedProps : na(l.type, c.memoizedProps);
                g.componentDidUpdate(x, c.memoizedState, g.__reactInternalSnapshotBeforeUpdate);
              }
              var L = l.updateQueue;
              L !== null && $h(l, L, g);
              break;
            case 3:
              var $ = l.updateQueue;
              if ($ !== null) {
                if (c = null, l.child !== null) switch (l.child.tag) {
                  case 5:
                    c = l.child.stateNode;
                    break;
                  case 1:
                    c = l.child.stateNode;
                }
                $h(l, $, c);
              }
              break;
            case 5:
              var ie = l.stateNode;
              if (c === null && l.flags & 4) {
                c = ie;
                var de = l.memoizedProps;
                switch (l.type) {
                  case "button":
                  case "input":
                  case "select":
                  case "textarea":
                    de.autoFocus && c.focus();
                    break;
                  case "img":
                    de.src && (c.src = de.src);
                }
              }
              break;
            case 6:
              break;
            case 4:
              break;
            case 12:
              break;
            case 13:
              if (l.memoizedState === null) {
                var Ie = l.alternate;
                if (Ie !== null) {
                  var Je = Ie.memoizedState;
                  if (Je !== null) {
                    var Ye = Je.dehydrated;
                    Ye !== null && Se(Ye);
                  }
                }
              }
              break;
            case 19:
            case 17:
            case 21:
            case 22:
            case 23:
            case 25:
              break;
            default:
              throw Error(t(163));
          }
          In || l.flags & 512 && Ed(l);
        } catch (Ge) {
          Ur(l, l.return, Ge);
        }
      }
      if (l === o) {
        kt = null;
        break;
      }
      if (c = l.sibling, c !== null) {
        c.return = l.return, kt = c;
        break;
      }
      kt = l.return;
    }
  }
  function $p(o) {
    for (; kt !== null; ) {
      var l = kt;
      if (l === o) {
        kt = null;
        break;
      }
      var c = l.sibling;
      if (c !== null) {
        c.return = l.return, kt = c;
        break;
      }
      kt = l.return;
    }
  }
  function Wp(o) {
    for (; kt !== null; ) {
      var l = kt;
      try {
        switch (l.tag) {
          case 0:
          case 11:
          case 15:
            var c = l.return;
            try {
              wc(4, l);
            } catch (de) {
              Ur(l, c, de);
            }
            break;
          case 1:
            var g = l.stateNode;
            if (typeof g.componentDidMount == "function") {
              var x = l.return;
              try {
                g.componentDidMount();
              } catch (de) {
                Ur(l, x, de);
              }
            }
            var L = l.return;
            try {
              Ed(l);
            } catch (de) {
              Ur(l, L, de);
            }
            break;
          case 5:
            var $ = l.return;
            try {
              Ed(l);
            } catch (de) {
              Ur(l, $, de);
            }
        }
      } catch (de) {
        Ur(l, l.return, de);
      }
      if (l === o) {
        kt = null;
        break;
      }
      var ie = l.sibling;
      if (ie !== null) {
        ie.return = l.return, kt = ie;
        break;
      }
      kt = l.return;
    }
  }
  var dg = Math.ceil, bc = me.ReactCurrentDispatcher, Od = me.ReactCurrentOwner, Hi = me.ReactCurrentBatchConfig, ur = 0, hn = null, en = null, bn = 0, Ni = 0, tl = yo(0), an = 0, Zl = null, as = 0, Cc = 0, Dd = 0, eu = null, fi = null, Ad = 0, rl = 1 / 0, Ga = null, Tc = !1, Ld = null, So = null, Sc = !1, xo = null, xc = 0, tu = 0, Rd = null, Ec = -1, Mc = 0;
  function Kn() {
    return (ur & 6) !== 0 ? ye() : Ec !== -1 ? Ec : Ec = ye();
  }
  function Eo(o) {
    return (o.mode & 1) === 0 ? 1 : (ur & 2) !== 0 && bn !== 0 ? bn & -bn : Jm.transition !== null ? (Mc === 0 && (Mc = Da()), Mc) : (o = Qt, o !== 0 || (o = window.event, o = o === void 0 ? 16 : Zi(o.type)), o);
  }
  function oa(o, l, c, g) {
    if (50 < tu) throw tu = 0, Rd = null, Error(t(185));
    Mn(o, c, g), ((ur & 2) === 0 || o !== hn) && (o === hn && ((ur & 2) === 0 && (Cc |= c), an === 4 && Mo(o, bn)), di(o, g), c === 1 && ur === 0 && (l.mode & 1) === 0 && (rl = ye() + 500, tc && wo()));
  }
  function di(o, l) {
    var c = o.callbackNode;
    no(o, l);
    var g = yn(o, o === hn ? bn : 0);
    if (g === 0) c !== null && K(c), o.callbackNode = null, o.callbackPriority = 0;
    else if (l = g & -g, o.callbackPriority !== l) {
      if (c != null && K(c), l === 1) o.tag === 0 ? Km(Gp.bind(null, o)) : Lh(Gp.bind(null, o)), Hs(function() {
        (ur & 6) === 0 && wo();
      }), c = null;
      else {
        switch (Vo(g)) {
          case 1:
            c = je;
            break;
          case 4:
            c = $e;
            break;
          case 16:
            c = at;
            break;
          case 536870912:
            c = er;
            break;
          default:
            c = at;
        }
        c = tv(c, jp.bind(null, o));
      }
      o.callbackPriority = l, o.callbackNode = c;
    }
  }
  function jp(o, l) {
    if (Ec = -1, Mc = 0, (ur & 6) !== 0) throw Error(t(327));
    var c = o.callbackNode;
    if (nl() && o.callbackNode !== c) return null;
    var g = yn(o, o === hn ? bn : 0);
    if (g === 0) return null;
    if ((g & 30) !== 0 || (g & o.expiredLanes) !== 0 || l) l = Nc(o, g);
    else {
      l = g;
      var x = ur;
      ur |= 2;
      var L = Jp();
      (hn !== o || bn !== l) && (Ga = null, rl = ye() + 500, ls(o, l));
      do
        try {
          vg();
          break;
        } catch (ie) {
          Kp(o, ie);
        }
      while (!0);
      Xf(), bc.current = L, ur = x, en !== null ? l = 0 : (hn = null, bn = 0, l = an);
    }
    if (l !== 0) {
      if (l === 2 && (x = ha(o), x !== 0 && (g = x, l = Id(o, x))), l === 1) throw c = Zl, ls(o, 0), Mo(o, g), di(o, ye()), c;
      if (l === 6) Mo(o, g);
      else {
        if (x = o.current.alternate, (g & 30) === 0 && !hg(x) && (l = Nc(o, g), l === 2 && (L = ha(o), L !== 0 && (g = L, l = Id(o, L))), l === 1)) throw c = Zl, ls(o, 0), Mo(o, g), di(o, ye()), c;
        switch (o.finishedWork = x, o.finishedLanes = g, l) {
          case 0:
          case 1:
            throw Error(t(345));
          case 2:
            us(o, fi, Ga);
            break;
          case 3:
            if (Mo(o, g), (g & 130023424) === g && (l = Ad + 500 - ye(), 10 < l)) {
              if (yn(o, 0) !== 0) break;
              if (x = o.suspendedLanes, (x & g) !== g) {
                Kn(), o.pingedLanes |= o.suspendedLanes & x;
                break;
              }
              o.timeoutHandle = Ar(us.bind(null, o, fi, Ga), l);
              break;
            }
            us(o, fi, Ga);
            break;
          case 4:
            if (Mo(o, g), (g & 4194240) === g) break;
            for (l = o.eventTimes, x = -1; 0 < g; ) {
              var $ = 31 - Yr(g);
              L = 1 << $, $ = l[$], $ > x && (x = $), g &= ~L;
            }
            if (g = x, g = ye() - g, g = (120 > g ? 120 : 480 > g ? 480 : 1080 > g ? 1080 : 1920 > g ? 1920 : 3e3 > g ? 3e3 : 4320 > g ? 4320 : 1960 * dg(g / 1960)) - g, 10 < g) {
              o.timeoutHandle = Ar(us.bind(null, o, fi, Ga), g);
              break;
            }
            us(o, fi, Ga);
            break;
          case 5:
            us(o, fi, Ga);
            break;
          default:
            throw Error(t(329));
        }
      }
    }
    return di(o, ye()), o.callbackNode === c ? jp.bind(null, o) : null;
  }
  function Id(o, l) {
    var c = eu;
    return o.current.memoizedState.isDehydrated && (ls(o, l).flags |= 256), o = Nc(o, l), o !== 2 && (l = fi, fi = c, l !== null && Pd(l)), o;
  }
  function Pd(o) {
    fi === null ? fi = o : fi.push.apply(fi, o);
  }
  function hg(o) {
    for (var l = o; ; ) {
      if (l.flags & 16384) {
        var c = l.updateQueue;
        if (c !== null && (c = c.stores, c !== null)) for (var g = 0; g < c.length; g++) {
          var x = c[g], L = x.getSnapshot;
          x = x.value;
          try {
            if (!Si(L(), x)) return !1;
          } catch {
            return !1;
          }
        }
      }
      if (c = l.child, l.subtreeFlags & 16384 && c !== null) c.return = l, l = c;
      else {
        if (l === o) break;
        for (; l.sibling === null; ) {
          if (l.return === null || l.return === o) return !0;
          l = l.return;
        }
        l.sibling.return = l.return, l = l.sibling;
      }
    }
    return !0;
  }
  function Mo(o, l) {
    for (l &= ~Dd, l &= ~Cc, o.suspendedLanes |= l, o.pingedLanes &= ~l, o = o.expirationTimes; 0 < l; ) {
      var c = 31 - Yr(l), g = 1 << c;
      o[c] = -1, l &= ~g;
    }
  }
  function Gp(o) {
    if ((ur & 6) !== 0) throw Error(t(327));
    nl();
    var l = yn(o, 0);
    if ((l & 1) === 0) return di(o, ye()), null;
    var c = Nc(o, l);
    if (o.tag !== 0 && c === 2) {
      var g = ha(o);
      g !== 0 && (l = g, c = Id(o, g));
    }
    if (c === 1) throw c = Zl, ls(o, 0), Mo(o, l), di(o, ye()), c;
    if (c === 6) throw Error(t(345));
    return o.finishedWork = o.current.alternate, o.finishedLanes = l, us(o, fi, Ga), di(o, ye()), null;
  }
  function Bd(o, l) {
    var c = ur;
    ur |= 1;
    try {
      return o(l);
    } finally {
      ur = c, ur === 0 && (rl = ye() + 500, tc && wo());
    }
  }
  function ss(o) {
    xo !== null && xo.tag === 0 && (ur & 6) === 0 && nl();
    var l = ur;
    ur |= 1;
    var c = Hi.transition, g = Qt;
    try {
      if (Hi.transition = null, Qt = 1, o) return o();
    } finally {
      Qt = g, Hi.transition = c, ur = l, (ur & 6) === 0 && wo();
    }
  }
  function Fd() {
    Ni = tl.current, Dr(tl);
  }
  function ls(o, l) {
    o.finishedWork = null, o.finishedLanes = 0;
    var c = o.timeoutHandle;
    if (c !== -1 && (o.timeoutHandle = -1, Vr(c)), en !== null) for (c = en.return; c !== null; ) {
      var g = c;
      switch (jf(g), g.tag) {
        case 1:
          g = g.type.childContextTypes, g != null && Zu();
          break;
        case 3:
          Ys(), Dr(li), Dr(An), ad();
          break;
        case 5:
          nd(g);
          break;
        case 4:
          Ys();
          break;
        case 13:
          Dr(Br);
          break;
        case 19:
          Dr(Br);
          break;
        case 10:
          Yf(g.type._context);
          break;
        case 22:
        case 23:
          Fd();
      }
      c = c.return;
    }
    if (hn = o, en = o = No(o.current, null), bn = Ni = l, an = 0, Zl = null, Dd = Cc = as = 0, fi = eu = null, rs !== null) {
      for (l = 0; l < rs.length; l++) if (c = rs[l], g = c.interleaved, g !== null) {
        c.interleaved = null;
        var x = g.next, L = c.pending;
        if (L !== null) {
          var $ = L.next;
          L.next = x, g.next = $;
        }
        c.pending = g;
      }
      rs = null;
    }
    return o;
  }
  function Kp(o, l) {
    do {
      var c = en;
      try {
        if (Xf(), fc.current = vc, dc) {
          for (var g = Fr.memoizedState; g !== null; ) {
            var x = g.queue;
            x !== null && (x.pending = null), g = g.next;
          }
          dc = !1;
        }
        if (is = 0, dn = nn = Fr = null, Gl = !1, Kl = 0, Od.current = null, c === null || c.return === null) {
          an = 1, Zl = l, en = null;
          break;
        }
        e: {
          var L = o, $ = c.return, ie = c, de = l;
          if (l = bn, ie.flags |= 32768, de !== null && typeof de == "object" && typeof de.then == "function") {
            var Ie = de, Je = ie, Ye = Je.tag;
            if ((Je.mode & 1) === 0 && (Ye === 0 || Ye === 11 || Ye === 15)) {
              var Ge = Je.alternate;
              Ge ? (Je.updateQueue = Ge.updateQueue, Je.memoizedState = Ge.memoizedState, Je.lanes = Ge.lanes) : (Je.updateQueue = null, Je.memoizedState = null);
            }
            var pt = kp($);
            if (pt !== null) {
              pt.flags &= -257, wp(pt, $, ie, L, l), pt.mode & 1 && yp(L, Ie, l), l = pt, de = Ie;
              var Ct = l.updateQueue;
              if (Ct === null) {
                var xt = /* @__PURE__ */ new Set();
                xt.add(de), l.updateQueue = xt;
              } else Ct.add(de);
              break e;
            } else {
              if ((l & 1) === 0) {
                yp(L, Ie, l), _d();
                break e;
              }
              de = Error(t(426));
            }
          } else if (Lr && ie.mode & 1) {
            var Kr = kp($);
            if (Kr !== null) {
              (Kr.flags & 65536) === 0 && (Kr.flags |= 256), wp(Kr, $, ie, L, l), Jf(Zs(de, ie));
              break e;
            }
          }
          L = de = Zs(de, ie), an !== 4 && (an = 2), eu === null ? eu = [L] : eu.push(L), L = $;
          do {
            switch (L.tag) {
              case 3:
                L.flags |= 65536, l &= -l, L.lanes |= l;
                var Me = mp(L, de, l);
                Uh(L, Me);
                break e;
              case 1:
                ie = de;
                var we = L.type, De = L.stateNode;
                if ((L.flags & 128) === 0 && (typeof we.getDerivedStateFromError == "function" || De !== null && typeof De.componentDidCatch == "function" && (So === null || !So.has(De)))) {
                  L.flags |= 65536, l &= -l, L.lanes |= l;
                  var rt = gp(L, ie, l);
                  Uh(L, rt);
                  break e;
                }
            }
            L = L.return;
          } while (L !== null);
        }
        Xp(c);
      } catch (Et) {
        l = Et, en === c && c !== null && (en = c = c.return);
        continue;
      }
      break;
    } while (!0);
  }
  function Jp() {
    var o = bc.current;
    return bc.current = vc, o === null ? vc : o;
  }
  function _d() {
    (an === 0 || an === 3 || an === 2) && (an = 4), hn === null || (as & 268435455) === 0 && (Cc & 268435455) === 0 || Mo(hn, bn);
  }
  function Nc(o, l) {
    var c = ur;
    ur |= 2;
    var g = Jp();
    (hn !== o || bn !== l) && (Ga = null, ls(o, l));
    do
      try {
        pg();
        break;
      } catch (x) {
        Kp(o, x);
      }
    while (!0);
    if (Xf(), ur = c, bc.current = g, en !== null) throw Error(t(261));
    return hn = null, bn = 0, an;
  }
  function pg() {
    for (; en !== null; ) Qp(en);
  }
  function vg() {
    for (; en !== null && !Z(); ) Qp(en);
  }
  function Qp(o) {
    var l = ev(o.alternate, o, Ni);
    o.memoizedProps = o.pendingProps, l === null ? Xp(o) : en = l, Od.current = null;
  }
  function Xp(o) {
    var l = o;
    do {
      var c = l.alternate;
      if (o = l.return, (l.flags & 32768) === 0) {
        if (c = sg(c, l, Ni), c !== null) {
          en = c;
          return;
        }
      } else {
        if (c = lg(c, l), c !== null) {
          c.flags &= 32767, en = c;
          return;
        }
        if (o !== null) o.flags |= 32768, o.subtreeFlags = 0, o.deletions = null;
        else {
          an = 6, en = null;
          return;
        }
      }
      if (l = l.sibling, l !== null) {
        en = l;
        return;
      }
      en = l = o;
    } while (l !== null);
    an === 0 && (an = 5);
  }
  function us(o, l, c) {
    var g = Qt, x = Hi.transition;
    try {
      Hi.transition = null, Qt = 1, mg(o, l, c, g);
    } finally {
      Hi.transition = x, Qt = g;
    }
    return null;
  }
  function mg(o, l, c, g) {
    do
      nl();
    while (xo !== null);
    if ((ur & 6) !== 0) throw Error(t(327));
    c = o.finishedWork;
    var x = o.finishedLanes;
    if (c === null) return null;
    if (o.finishedWork = null, o.finishedLanes = 0, c === o.current) throw Error(t(177));
    o.callbackNode = null, o.callbackPriority = 0;
    var L = c.lanes | c.childLanes;
    if (La(o, L), o === hn && (en = hn = null, bn = 0), (c.subtreeFlags & 2064) === 0 && (c.flags & 2064) === 0 || Sc || (Sc = !0, tv(at, function() {
      return nl(), null;
    })), L = (c.flags & 15990) !== 0, (c.subtreeFlags & 15990) !== 0 || L) {
      L = Hi.transition, Hi.transition = null;
      var $ = Qt;
      Qt = 1;
      var ie = ur;
      ur |= 4, Od.current = null, cg(o, c), Hp(c, o), Hf(or), wt = !!lr, or = lr = null, o.current = c, fg(c), ae(), ur = ie, Qt = $, Hi.transition = L;
    } else o.current = c;
    if (Sc && (Sc = !1, xo = o, xc = x), L = o.pendingLanes, L === 0 && (So = null), Qi(c.stateNode), di(o, ye()), l !== null) for (g = o.onRecoverableError, c = 0; c < l.length; c++) x = l[c], g(x.value, { componentStack: x.stack, digest: x.digest });
    if (Tc) throw Tc = !1, o = Ld, Ld = null, o;
    return (xc & 1) !== 0 && o.tag !== 0 && nl(), L = o.pendingLanes, (L & 1) !== 0 ? o === Rd ? tu++ : (tu = 0, Rd = o) : tu = 0, wo(), null;
  }
  function nl() {
    if (xo !== null) {
      var o = Vo(xc), l = Hi.transition, c = Qt;
      try {
        if (Hi.transition = null, Qt = 16 > o ? 16 : o, xo === null) var g = !1;
        else {
          if (o = xo, xo = null, xc = 0, (ur & 6) !== 0) throw Error(t(331));
          var x = ur;
          for (ur |= 4, kt = o.current; kt !== null; ) {
            var L = kt, $ = L.child;
            if ((kt.flags & 16) !== 0) {
              var ie = L.deletions;
              if (ie !== null) {
                for (var de = 0; de < ie.length; de++) {
                  var Ie = ie[de];
                  for (kt = Ie; kt !== null; ) {
                    var Je = kt;
                    switch (Je.tag) {
                      case 0:
                      case 11:
                      case 15:
                        Yl(8, Je, L);
                    }
                    var Ye = Je.child;
                    if (Ye !== null) Ye.return = Je, kt = Ye;
                    else for (; kt !== null; ) {
                      Je = kt;
                      var Ge = Je.sibling, pt = Je.return;
                      if (Bp(Je), Je === Ie) {
                        kt = null;
                        break;
                      }
                      if (Ge !== null) {
                        Ge.return = pt, kt = Ge;
                        break;
                      }
                      kt = pt;
                    }
                  }
                }
                var Ct = L.alternate;
                if (Ct !== null) {
                  var xt = Ct.child;
                  if (xt !== null) {
                    Ct.child = null;
                    do {
                      var Kr = xt.sibling;
                      xt.sibling = null, xt = Kr;
                    } while (xt !== null);
                  }
                }
                kt = L;
              }
            }
            if ((L.subtreeFlags & 2064) !== 0 && $ !== null) $.return = L, kt = $;
            else e: for (; kt !== null; ) {
              if (L = kt, (L.flags & 2048) !== 0) switch (L.tag) {
                case 0:
                case 11:
                case 15:
                  Yl(9, L, L.return);
              }
              var Me = L.sibling;
              if (Me !== null) {
                Me.return = L.return, kt = Me;
                break e;
              }
              kt = L.return;
            }
          }
          var we = o.current;
          for (kt = we; kt !== null; ) {
            $ = kt;
            var De = $.child;
            if (($.subtreeFlags & 2064) !== 0 && De !== null) De.return = $, kt = De;
            else e: for ($ = we; kt !== null; ) {
              if (ie = kt, (ie.flags & 2048) !== 0) try {
                switch (ie.tag) {
                  case 0:
                  case 11:
                  case 15:
                    wc(9, ie);
                }
              } catch (Et) {
                Ur(ie, ie.return, Et);
              }
              if (ie === $) {
                kt = null;
                break e;
              }
              var rt = ie.sibling;
              if (rt !== null) {
                rt.return = ie.return, kt = rt;
                break e;
              }
              kt = ie.return;
            }
          }
          if (ur = x, wo(), Ir && typeof Ir.onPostCommitFiberRoot == "function") try {
            Ir.onPostCommitFiberRoot(hr, o);
          } catch {
          }
          g = !0;
        }
        return g;
      } finally {
        Qt = c, Hi.transition = l;
      }
    }
    return !1;
  }
  function Yp(o, l, c) {
    l = Zs(c, l), l = mp(o, l, 1), o = Co(o, l, 1), l = Kn(), o !== null && (Mn(o, 1, l), di(o, l));
  }
  function Ur(o, l, c) {
    if (o.tag === 3) Yp(o, o, c);
    else for (; l !== null; ) {
      if (l.tag === 3) {
        Yp(l, o, c);
        break;
      } else if (l.tag === 1) {
        var g = l.stateNode;
        if (typeof l.type.getDerivedStateFromError == "function" || typeof g.componentDidCatch == "function" && (So === null || !So.has(g))) {
          o = Zs(c, o), o = gp(l, o, 1), l = Co(l, o, 1), o = Kn(), l !== null && (Mn(l, 1, o), di(l, o));
          break;
        }
      }
      l = l.return;
    }
  }
  function gg(o, l, c) {
    var g = o.pingCache;
    g !== null && g.delete(l), l = Kn(), o.pingedLanes |= o.suspendedLanes & c, hn === o && (bn & c) === c && (an === 4 || an === 3 && (bn & 130023424) === bn && 500 > ye() - Ad ? ls(o, 0) : Dd |= c), di(o, l);
  }
  function Zp(o, l) {
    l === 0 && ((o.mode & 1) === 0 ? l = 1 : (l = jn, jn <<= 1, (jn & 130023424) === 0 && (jn = 4194304)));
    var c = Kn();
    o = $a(o, l), o !== null && (Mn(o, l, c), di(o, c));
  }
  function yg(o) {
    var l = o.memoizedState, c = 0;
    l !== null && (c = l.retryLane), Zp(o, c);
  }
  function kg(o, l) {
    var c = 0;
    switch (o.tag) {
      case 13:
        var g = o.stateNode, x = o.memoizedState;
        x !== null && (c = x.retryLane);
        break;
      case 19:
        g = o.stateNode;
        break;
      default:
        throw Error(t(314));
    }
    g !== null && g.delete(l), Zp(o, c);
  }
  var ev;
  ev = function(o, l, c) {
    if (o !== null) if (o.memoizedProps !== l.pendingProps || li.current) ci = !0;
    else {
      if ((o.lanes & c) === 0 && (l.flags & 128) === 0) return ci = !1, og(o, l, c);
      ci = (o.flags & 131072) !== 0;
    }
    else ci = !1, Lr && (l.flags & 1048576) !== 0 && Rh(l, nc, l.index);
    switch (l.lanes = 0, l.tag) {
      case 2:
        var g = l.type;
        yc(o, l), o = l.pendingProps;
        var x = Ws(l, An.current);
        Xs(l, c), x = ld(null, l, g, o, x, c);
        var L = ud();
        return l.flags |= 1, typeof x == "object" && x !== null && typeof x.render == "function" && x.$$typeof === void 0 ? (l.tag = 1, l.memoizedState = null, l.updateQueue = null, ui(g) ? (L = !0, ec(l)) : L = !1, l.memoizedState = x.state !== null && x.state !== void 0 ? x.state : null, td(l), x.updater = mc, l.stateNode = x, x._reactInternals = l, vd(l, g, o, c), l = kd(null, l, g, !0, L, c)) : (l.tag = 0, Lr && L && Wf(l), Gn(null, l, x, c), l = l.child), l;
      case 16:
        g = l.elementType;
        e: {
          switch (yc(o, l), o = l.pendingProps, x = g._init, g = x(g._payload), l.type = g, x = l.tag = bg(g), o = na(g, o), x) {
            case 0:
              l = yd(null, l, g, o, c);
              break e;
            case 1:
              l = Ep(null, l, g, o, c);
              break e;
            case 11:
              l = bp(null, l, g, o, c);
              break e;
            case 14:
              l = Cp(null, l, g, na(g.type, o), c);
              break e;
          }
          throw Error(t(
            306,
            g,
            ""
          ));
        }
        return l;
      case 0:
        return g = l.type, x = l.pendingProps, x = l.elementType === g ? x : na(g, x), yd(o, l, g, x, c);
      case 1:
        return g = l.type, x = l.pendingProps, x = l.elementType === g ? x : na(g, x), Ep(o, l, g, x, c);
      case 3:
        e: {
          if (Mp(l), o === null) throw Error(t(387));
          g = l.pendingProps, L = l.memoizedState, x = L.element, Vh(o, l), uc(l, g, null, c);
          var $ = l.memoizedState;
          if (g = $.element, L.isDehydrated) if (L = { element: g, isDehydrated: !1, cache: $.cache, pendingSuspenseBoundaries: $.pendingSuspenseBoundaries, transitions: $.transitions }, l.updateQueue.baseState = L, l.memoizedState = L, l.flags & 256) {
            x = Zs(Error(t(423)), l), l = Np(o, l, g, c, x);
            break e;
          } else if (g !== x) {
            x = Zs(Error(t(424)), l), l = Np(o, l, g, c, x);
            break e;
          } else for (Mi = On(l.stateNode.containerInfo.firstChild), Ei = l, Lr = !0, ra = null, c = zh(l, null, g, c), l.child = c; c; ) c.flags = c.flags & -3 | 4096, c = c.sibling;
          else {
            if (Ks(), g === x) {
              l = ja(o, l, c);
              break e;
            }
            Gn(o, l, g, c);
          }
          l = l.child;
        }
        return l;
      case 5:
        return Wh(l), o === null && Kf(l), g = l.type, x = l.pendingProps, L = o !== null ? o.memoizedProps : null, $ = x.children, Nr(g, x) ? $ = null : L !== null && Nr(g, L) && (l.flags |= 32), xp(o, l), Gn(o, l, $, c), l.child;
      case 6:
        return o === null && Kf(l), null;
      case 13:
        return Op(o, l, c);
      case 4:
        return rd(l, l.stateNode.containerInfo), g = l.pendingProps, o === null ? l.child = Js(l, null, g, c) : Gn(o, l, g, c), l.child;
      case 11:
        return g = l.type, x = l.pendingProps, x = l.elementType === g ? x : na(g, x), bp(o, l, g, x, c);
      case 7:
        return Gn(o, l, l.pendingProps, c), l.child;
      case 8:
        return Gn(o, l, l.pendingProps.children, c), l.child;
      case 12:
        return Gn(o, l, l.pendingProps.children, c), l.child;
      case 10:
        e: {
          if (g = l.type._context, x = l.pendingProps, L = l.memoizedProps, $ = x.value, Er(oc, g._currentValue), g._currentValue = $, L !== null) if (Si(L.value, $)) {
            if (L.children === x.children && !li.current) {
              l = ja(o, l, c);
              break e;
            }
          } else for (L = l.child, L !== null && (L.return = l); L !== null; ) {
            var ie = L.dependencies;
            if (ie !== null) {
              $ = L.child;
              for (var de = ie.firstContext; de !== null; ) {
                if (de.context === g) {
                  if (L.tag === 1) {
                    de = Wa(-1, c & -c), de.tag = 2;
                    var Ie = L.updateQueue;
                    if (Ie !== null) {
                      Ie = Ie.shared;
                      var Je = Ie.pending;
                      Je === null ? de.next = de : (de.next = Je.next, Je.next = de), Ie.pending = de;
                    }
                  }
                  L.lanes |= c, de = L.alternate, de !== null && (de.lanes |= c), Zf(
                    L.return,
                    c,
                    l
                  ), ie.lanes |= c;
                  break;
                }
                de = de.next;
              }
            } else if (L.tag === 10) $ = L.type === l.type ? null : L.child;
            else if (L.tag === 18) {
              if ($ = L.return, $ === null) throw Error(t(341));
              $.lanes |= c, ie = $.alternate, ie !== null && (ie.lanes |= c), Zf($, c, l), $ = L.sibling;
            } else $ = L.child;
            if ($ !== null) $.return = L;
            else for ($ = L; $ !== null; ) {
              if ($ === l) {
                $ = null;
                break;
              }
              if (L = $.sibling, L !== null) {
                L.return = $.return, $ = L;
                break;
              }
              $ = $.return;
            }
            L = $;
          }
          Gn(o, l, x.children, c), l = l.child;
        }
        return l;
      case 9:
        return x = l.type, g = l.pendingProps.children, Xs(l, c), x = qi(x), g = g(x), l.flags |= 1, Gn(o, l, g, c), l.child;
      case 14:
        return g = l.type, x = na(g, l.pendingProps), x = na(g.type, x), Cp(o, l, g, x, c);
      case 15:
        return Tp(o, l, l.type, l.pendingProps, c);
      case 17:
        return g = l.type, x = l.pendingProps, x = l.elementType === g ? x : na(g, x), yc(o, l), l.tag = 1, ui(g) ? (o = !0, ec(l)) : o = !1, Xs(l, c), pp(l, g, x), vd(l, g, x, c), kd(null, l, g, !0, o, c);
      case 19:
        return Ap(o, l, c);
      case 22:
        return Sp(o, l, c);
    }
    throw Error(t(156, l.tag));
  };
  function tv(o, l) {
    return B(o, l);
  }
  function wg(o, l, c, g) {
    this.tag = o, this.key = c, this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null, this.index = 0, this.ref = null, this.pendingProps = l, this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null, this.mode = g, this.subtreeFlags = this.flags = 0, this.deletions = null, this.childLanes = this.lanes = 0, this.alternate = null;
  }
  function Vi(o, l, c, g) {
    return new wg(o, l, c, g);
  }
  function qd(o) {
    return o = o.prototype, !(!o || !o.isReactComponent);
  }
  function bg(o) {
    if (typeof o == "function") return qd(o) ? 1 : 0;
    if (o != null) {
      if (o = o.$$typeof, o === et) return 11;
      if (o === Ut) return 14;
    }
    return 2;
  }
  function No(o, l) {
    var c = o.alternate;
    return c === null ? (c = Vi(o.tag, l, o.key, o.mode), c.elementType = o.elementType, c.type = o.type, c.stateNode = o.stateNode, c.alternate = o, o.alternate = c) : (c.pendingProps = l, c.type = o.type, c.flags = 0, c.subtreeFlags = 0, c.deletions = null), c.flags = o.flags & 14680064, c.childLanes = o.childLanes, c.lanes = o.lanes, c.child = o.child, c.memoizedProps = o.memoizedProps, c.memoizedState = o.memoizedState, c.updateQueue = o.updateQueue, l = o.dependencies, c.dependencies = l === null ? null : { lanes: l.lanes, firstContext: l.firstContext }, c.sibling = o.sibling, c.index = o.index, c.ref = o.ref, c;
  }
  function Oc(o, l, c, g, x, L) {
    var $ = 2;
    if (g = o, typeof o == "function") qd(o) && ($ = 1);
    else if (typeof o == "string") $ = 5;
    else e: switch (o) {
      case ke:
        return cs(c.children, x, L, l);
      case Ne:
        $ = 8, x |= 8;
        break;
      case ze:
        return o = Vi(12, c, l, x | 2), o.elementType = ze, o.lanes = L, o;
      case Ht:
        return o = Vi(13, c, l, x), o.elementType = Ht, o.lanes = L, o;
      case Rt:
        return o = Vi(19, c, l, x), o.elementType = Rt, o.lanes = L, o;
      case It:
        return Dc(c, x, L, l);
      default:
        if (typeof o == "object" && o !== null) switch (o.$$typeof) {
          case Ze:
            $ = 10;
            break e;
          case At:
            $ = 9;
            break e;
          case et:
            $ = 11;
            break e;
          case Ut:
            $ = 14;
            break e;
          case yt:
            $ = 16, g = null;
            break e;
        }
        throw Error(t(130, o == null ? o : typeof o, ""));
    }
    return l = Vi($, c, l, x), l.elementType = o, l.type = g, l.lanes = L, l;
  }
  function cs(o, l, c, g) {
    return o = Vi(7, o, g, l), o.lanes = c, o;
  }
  function Dc(o, l, c, g) {
    return o = Vi(22, o, g, l), o.elementType = It, o.lanes = c, o.stateNode = { isHidden: !1 }, o;
  }
  function zd(o, l, c) {
    return o = Vi(6, o, null, l), o.lanes = c, o;
  }
  function Hd(o, l, c) {
    return l = Vi(4, o.children !== null ? o.children : [], o.key, l), l.lanes = c, l.stateNode = { containerInfo: o.containerInfo, pendingChildren: null, implementation: o.implementation }, l;
  }
  function Cg(o, l, c, g, x) {
    this.tag = l, this.containerInfo = o, this.finishedWork = this.pingCache = this.current = this.pendingChildren = null, this.timeoutHandle = -1, this.callbackNode = this.pendingContext = this.context = null, this.callbackPriority = 0, this.eventTimes = Aa(0), this.expirationTimes = Aa(-1), this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0, this.entanglements = Aa(0), this.identifierPrefix = g, this.onRecoverableError = x, this.mutableSourceEagerHydrationData = null;
  }
  function Vd(o, l, c, g, x, L, $, ie, de) {
    return o = new Cg(o, l, c, ie, de), l === 1 ? (l = 1, L === !0 && (l |= 8)) : l = 0, L = Vi(3, null, null, l), o.current = L, L.stateNode = o, L.memoizedState = { element: g, isDehydrated: c, cache: null, transitions: null, pendingSuspenseBoundaries: null }, td(L), o;
  }
  function Tg(o, l, c) {
    var g = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
    return { $$typeof: pe, key: g == null ? null : "" + g, children: o, containerInfo: l, implementation: c };
  }
  function rv(o) {
    if (!o) return ko;
    o = o._reactInternals;
    e: {
      if (it(o) !== o || o.tag !== 1) throw Error(t(170));
      var l = o;
      do {
        switch (l.tag) {
          case 3:
            l = l.stateNode.context;
            break e;
          case 1:
            if (ui(l.type)) {
              l = l.stateNode.__reactInternalMemoizedMergedChildContext;
              break e;
            }
        }
        l = l.return;
      } while (l !== null);
      throw Error(t(171));
    }
    if (o.tag === 1) {
      var c = o.type;
      if (ui(c)) return Dh(o, c, l);
    }
    return l;
  }
  function nv(o, l, c, g, x, L, $, ie, de) {
    return o = Vd(c, g, !0, o, x, L, $, ie, de), o.context = rv(null), c = o.current, g = Kn(), x = Eo(c), L = Wa(g, x), L.callback = l ?? null, Co(c, L, x), o.current.lanes = x, Mn(o, x, g), di(o, g), o;
  }
  function Ac(o, l, c, g) {
    var x = l.current, L = Kn(), $ = Eo(x);
    return c = rv(c), l.context === null ? l.context = c : l.pendingContext = c, l = Wa(L, $), l.payload = { element: o }, g = g === void 0 ? null : g, g !== null && (l.callback = g), o = Co(x, l, $), o !== null && (oa(o, x, $, L), lc(o, x, $)), $;
  }
  function Lc(o) {
    return o = o.current, o.child ? (o.child.tag === 5, o.child.stateNode) : null;
  }
  function iv(o, l) {
    if (o = o.memoizedState, o !== null && o.dehydrated !== null) {
      var c = o.retryLane;
      o.retryLane = c !== 0 && c < l ? c : l;
    }
  }
  function Ud(o, l) {
    iv(o, l), (o = o.alternate) && iv(o, l);
  }
  function Sg() {
    return null;
  }
  var av = typeof reportError == "function" ? reportError : function(o) {
    console.error(o);
  };
  function $d(o) {
    this._internalRoot = o;
  }
  Rc.prototype.render = $d.prototype.render = function(o) {
    var l = this._internalRoot;
    if (l === null) throw Error(t(409));
    Ac(o, l, null, null);
  }, Rc.prototype.unmount = $d.prototype.unmount = function() {
    var o = this._internalRoot;
    if (o !== null) {
      this._internalRoot = null;
      var l = o.containerInfo;
      ss(function() {
        Ac(null, o, null, null);
      }), l[Or] = null;
    }
  };
  function Rc(o) {
    this._internalRoot = o;
  }
  Rc.prototype.unstable_scheduleHydration = function(o) {
    if (o) {
      var l = bi();
      o = { blockedOn: null, target: o, priority: l };
      for (var c = 0; c < Ti.length && l !== 0 && l < Ti[c].priority; c++) ;
      Ti.splice(c, 0, o), c === 0 && ao(o);
    }
  };
  function Wd(o) {
    return !(!o || o.nodeType !== 1 && o.nodeType !== 9 && o.nodeType !== 11);
  }
  function Ic(o) {
    return !(!o || o.nodeType !== 1 && o.nodeType !== 9 && o.nodeType !== 11 && (o.nodeType !== 8 || o.nodeValue !== " react-mount-point-unstable "));
  }
  function ov() {
  }
  function xg(o, l, c, g, x) {
    if (x) {
      if (typeof g == "function") {
        var L = g;
        g = function() {
          var Ie = Lc($);
          L.call(Ie);
        };
      }
      var $ = nv(l, g, o, 0, null, !1, !1, "", ov);
      return o._reactRootContainer = $, o[Or] = $.current, le(o.nodeType === 8 ? o.parentNode : o), ss(), $;
    }
    for (; x = o.lastChild; ) o.removeChild(x);
    if (typeof g == "function") {
      var ie = g;
      g = function() {
        var Ie = Lc(de);
        ie.call(Ie);
      };
    }
    var de = Vd(o, 0, !1, null, null, !1, !1, "", ov);
    return o._reactRootContainer = de, o[Or] = de.current, le(o.nodeType === 8 ? o.parentNode : o), ss(function() {
      Ac(l, de, c, g);
    }), de;
  }
  function Pc(o, l, c, g, x) {
    var L = c._reactRootContainer;
    if (L) {
      var $ = L;
      if (typeof x == "function") {
        var ie = x;
        x = function() {
          var de = Lc($);
          ie.call(de);
        };
      }
      Ac(l, $, o, x);
    } else $ = xg(c, l, o, x, g);
    return Lc($);
  }
  Uo = function(o) {
    switch (o.tag) {
      case 3:
        var l = o.stateNode;
        if (l.current.memoizedState.isDehydrated) {
          var c = Xi(l.pendingLanes);
          c !== 0 && (pa(l, c | 1), di(l, ye()), (ur & 6) === 0 && (rl = ye() + 500, wo()));
        }
        break;
      case 13:
        ss(function() {
          var g = $a(o, 1);
          if (g !== null) {
            var x = Kn();
            oa(g, o, 1, x);
          }
        }), Ud(o, 1);
    }
  }, Ii = function(o) {
    if (o.tag === 13) {
      var l = $a(o, 134217728);
      if (l !== null) {
        var c = Kn();
        oa(l, o, 134217728, c);
      }
      Ud(o, 134217728);
    }
  }, wi = function(o) {
    if (o.tag === 13) {
      var l = Eo(o), c = $a(o, l);
      if (c !== null) {
        var g = Kn();
        oa(c, o, l, g);
      }
      Ud(o, l);
    }
  }, bi = function() {
    return Qt;
  }, Ra = function(o, l) {
    var c = Qt;
    try {
      return Qt = o, l();
    } finally {
      Qt = c;
    }
  }, Un = function(o, l, c) {
    switch (l) {
      case "input":
        if (Yt(o, c), l = c.name, c.type === "radio" && l != null) {
          for (c = o; c.parentNode; ) c = c.parentNode;
          for (c = c.querySelectorAll("input[name=" + JSON.stringify("" + l) + '][type="radio"]'), l = 0; l < c.length; l++) {
            var g = c[l];
            if (g !== o && g.form === o.form) {
              var x = Yu(g);
              if (!x) throw Error(t(90));
              oe(g), Yt(g, x);
            }
          }
        }
        break;
      case "textarea":
        ki(o, c);
        break;
      case "select":
        l = c.value, l != null && yr(o, !!c.multiple, l, !1);
    }
  }, wr = Bd, jr = ss;
  var Eg = { usingClientEntryPoint: !1, Events: [Vl, Us, Yu, qr, $n, Bd] }, ru = { findFiberByHostInstance: Yo, bundleType: 0, version: "18.3.1", rendererPackageName: "react-dom" }, Mg = { bundleType: ru.bundleType, version: ru.version, rendererPackageName: ru.rendererPackageName, rendererConfig: ru.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, overrideProps: null, overridePropsDeletePath: null, overridePropsRenamePath: null, setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, currentDispatcherRef: me.ReactCurrentDispatcher, findHostInstanceByFiber: function(o) {
    return o = b(o), o === null ? null : o.stateNode;
  }, findFiberByHostInstance: ru.findFiberByHostInstance || Sg, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, reconcilerVersion: "18.3.1-next-f1338f8080-20240426" };
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u") {
    var Bc = __REACT_DEVTOOLS_GLOBAL_HOOK__;
    if (!Bc.isDisabled && Bc.supportsFiber) try {
      hr = Bc.inject(Mg), Ir = Bc;
    } catch {
    }
  }
  return Ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Eg, Ui.createPortal = function(o, l) {
    var c = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
    if (!Wd(l)) throw Error(t(200));
    return Tg(o, l, null, c);
  }, Ui.createRoot = function(o, l) {
    if (!Wd(o)) throw Error(t(299));
    var c = !1, g = "", x = av;
    return l != null && (l.unstable_strictMode === !0 && (c = !0), l.identifierPrefix !== void 0 && (g = l.identifierPrefix), l.onRecoverableError !== void 0 && (x = l.onRecoverableError)), l = Vd(o, 1, !1, null, null, c, !1, g, x), o[Or] = l.current, le(o.nodeType === 8 ? o.parentNode : o), new $d(l);
  }, Ui.findDOMNode = function(o) {
    if (o == null) return null;
    if (o.nodeType === 1) return o;
    var l = o._reactInternals;
    if (l === void 0)
      throw typeof o.render == "function" ? Error(t(188)) : (o = Object.keys(o).join(","), Error(t(268, o)));
    return o = b(l), o = o === null ? null : o.stateNode, o;
  }, Ui.flushSync = function(o) {
    return ss(o);
  }, Ui.hydrate = function(o, l, c) {
    if (!Ic(l)) throw Error(t(200));
    return Pc(null, o, l, !0, c);
  }, Ui.hydrateRoot = function(o, l, c) {
    if (!Wd(o)) throw Error(t(405));
    var g = c != null && c.hydratedSources || null, x = !1, L = "", $ = av;
    if (c != null && (c.unstable_strictMode === !0 && (x = !0), c.identifierPrefix !== void 0 && (L = c.identifierPrefix), c.onRecoverableError !== void 0 && ($ = c.onRecoverableError)), l = nv(l, null, o, 1, c ?? null, x, !1, L, $), o[Or] = l.current, le(o), g) for (o = 0; o < g.length; o++) c = g[o], x = c._getVersion, x = x(c._source), l.mutableSourceEagerHydrationData == null ? l.mutableSourceEagerHydrationData = [c, x] : l.mutableSourceEagerHydrationData.push(
      c,
      x
    );
    return new Rc(l);
  }, Ui.render = function(o, l, c) {
    if (!Ic(l)) throw Error(t(200));
    return Pc(null, o, l, !1, c);
  }, Ui.unmountComponentAtNode = function(o) {
    if (!Ic(o)) throw Error(t(40));
    return o._reactRootContainer ? (ss(function() {
      Pc(null, null, o, !1, function() {
        o._reactRootContainer = null, o[Or] = null;
      });
    }), !0) : !1;
  }, Ui.unstable_batchedUpdates = Bd, Ui.unstable_renderSubtreeIntoContainer = function(o, l, c, g) {
    if (!Ic(c)) throw Error(t(200));
    if (o == null || o._reactInternals === void 0) throw Error(t(38));
    return Pc(o, l, c, !1, g);
  }, Ui.version = "18.3.1-next-f1338f8080-20240426", Ui;
}
var v1;
function TZ() {
  if (v1) return ly.exports;
  v1 = 1;
  function r() {
    if (!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function"))
      try {
        __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r);
      } catch (e) {
        console.error(e);
      }
  }
  return r(), ly.exports = CZ(), ly.exports;
}
var m1;
function SZ() {
  if (m1) return wv;
  m1 = 1;
  var r = TZ();
  return wv.createRoot = r.createRoot, wv.hydrateRoot = r.hydrateRoot, wv;
}
var xZ = SZ();
function Jn(r) {
  this.content = r;
}
Jn.prototype = {
  constructor: Jn,
  find: function(r) {
    for (var e = 0; e < this.content.length; e += 2)
      if (this.content[e] === r) return e;
    return -1;
  },
  // :: (string) → ?any
  // Retrieve the value stored under `key`, or return undefined when
  // no such key exists.
  get: function(r) {
    var e = this.find(r);
    return e == -1 ? void 0 : this.content[e + 1];
  },
  // :: (string, any, ?string) → OrderedMap
  // Create a new map by replacing the value of `key` with a new
  // value, or adding a binding to the end of the map. If `newKey` is
  // given, the key of the binding will be replaced with that key.
  update: function(r, e, t) {
    var n = t && t != r ? this.remove(t) : this, i = n.find(r), a = n.content.slice();
    return i == -1 ? a.push(t || r, e) : (a[i + 1] = e, t && (a[i] = t)), new Jn(a);
  },
  // :: (string) → OrderedMap
  // Return a map with the given key removed, if it existed.
  remove: function(r) {
    var e = this.find(r);
    if (e == -1) return this;
    var t = this.content.slice();
    return t.splice(e, 2), new Jn(t);
  },
  // :: (string, any) → OrderedMap
  // Add a new key to the start of the map.
  addToStart: function(r, e) {
    return new Jn([r, e].concat(this.remove(r).content));
  },
  // :: (string, any) → OrderedMap
  // Add a new key to the end of the map.
  addToEnd: function(r, e) {
    var t = this.remove(r).content.slice();
    return t.push(r, e), new Jn(t);
  },
  // :: (string, string, any) → OrderedMap
  // Add a key after the given key. If `place` is not found, the new
  // key is added to the end.
  addBefore: function(r, e, t) {
    var n = this.remove(e), i = n.content.slice(), a = n.find(r);
    return i.splice(a == -1 ? i.length : a, 0, e, t), new Jn(i);
  },
  // :: ((key: string, value: any))
  // Call the given function for each key/value pair in the map, in
  // order.
  forEach: function(r) {
    for (var e = 0; e < this.content.length; e += 2)
      r(this.content[e], this.content[e + 1]);
  },
  // :: (union<Object, OrderedMap>) → OrderedMap
  // Create a new map by prepending the keys in this map that don't
  // appear in `map` before the keys in `map`.
  prepend: function(r) {
    return r = Jn.from(r), r.size ? new Jn(r.content.concat(this.subtract(r).content)) : this;
  },
  // :: (union<Object, OrderedMap>) → OrderedMap
  // Create a new map by appending the keys in this map that don't
  // appear in `map` after the keys in `map`.
  append: function(r) {
    return r = Jn.from(r), r.size ? new Jn(this.subtract(r).content.concat(r.content)) : this;
  },
  // :: (union<Object, OrderedMap>) → OrderedMap
  // Create a map containing all the keys in this map that don't
  // appear in `map`.
  subtract: function(r) {
    var e = this;
    r = Jn.from(r);
    for (var t = 0; t < r.content.length; t += 2)
      e = e.remove(r.content[t]);
    return e;
  },
  // :: () → Object
  // Turn ordered map into a plain object.
  toObject: function() {
    var r = {};
    return this.forEach(function(e, t) {
      r[e] = t;
    }), r;
  },
  // :: number
  // The amount of keys in this map.
  get size() {
    return this.content.length >> 1;
  }
};
Jn.from = function(r) {
  if (r instanceof Jn) return r;
  var e = [];
  if (r) for (var t in r) e.push(t, r[t]);
  return new Jn(e);
};
function UT(r, e, t) {
  for (let n = 0; ; n++) {
    if (n == r.childCount || n == e.childCount)
      return r.childCount == e.childCount ? null : t;
    let i = r.child(n), a = e.child(n);
    if (i == a) {
      t += i.nodeSize;
      continue;
    }
    if (!i.sameMarkup(a))
      return t;
    if (i.isText && i.text != a.text) {
      for (let s = 0; i.text[s] == a.text[s]; s++)
        t++;
      return t;
    }
    if (i.content.size || a.content.size) {
      let s = UT(i.content, a.content, t + 1);
      if (s != null)
        return s;
    }
    t += i.nodeSize;
  }
}
function $T(r, e, t, n) {
  for (let i = r.childCount, a = e.childCount; ; ) {
    if (i == 0 || a == 0)
      return i == a ? null : { a: t, b: n };
    let s = r.child(--i), u = e.child(--a), f = s.nodeSize;
    if (s == u) {
      t -= f, n -= f;
      continue;
    }
    if (!s.sameMarkup(u))
      return { a: t, b: n };
    if (s.isText && s.text != u.text) {
      let p = 0, y = Math.min(s.text.length, u.text.length);
      for (; p < y && s.text[s.text.length - p - 1] == u.text[u.text.length - p - 1]; )
        p++, t--, n--;
      return { a: t, b: n };
    }
    if (s.content.size || u.content.size) {
      let p = $T(s.content, u.content, t - 1, n - 1);
      if (p)
        return p;
    }
    t -= f, n -= f;
  }
}
class Qe {
  /**
  @internal
  */
  constructor(e, t) {
    if (this.content = e, this.size = t || 0, t == null)
      for (let n = 0; n < e.length; n++)
        this.size += e[n].nodeSize;
  }
  /**
  Invoke a callback for all descendant nodes between the given two
  positions (relative to start of this fragment). Doesn't descend
  into a node when the callback returns `false`.
  */
  nodesBetween(e, t, n, i = 0, a) {
    for (let s = 0, u = 0; u < t; s++) {
      let f = this.content[s], p = u + f.nodeSize;
      if (p > e && n(f, i + u, a || null, s) !== !1 && f.content.size) {
        let y = u + 1;
        f.nodesBetween(Math.max(0, e - y), Math.min(f.content.size, t - y), n, i + y);
      }
      u = p;
    }
  }
  /**
  Call the given callback for every descendant node. `pos` will be
  relative to the start of the fragment. The callback may return
  `false` to prevent traversal of a given node's children.
  */
  descendants(e) {
    this.nodesBetween(0, this.size, e);
  }
  /**
  Extract the text between `from` and `to`. See the same method on
  [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
  */
  textBetween(e, t, n, i) {
    let a = "", s = !0;
    return this.nodesBetween(e, t, (u, f) => {
      let p = u.isText ? u.text.slice(Math.max(e, f) - f, t - f) : u.isLeaf ? i ? typeof i == "function" ? i(u) : i : u.type.spec.leafText ? u.type.spec.leafText(u) : "" : "";
      u.isBlock && (u.isLeaf && p || u.isTextblock) && n && (s ? s = !1 : a += n), a += p;
    }, 0), a;
  }
  /**
  Create a new fragment containing the combined content of this
  fragment and the other.
  */
  append(e) {
    if (!e.size)
      return this;
    if (!this.size)
      return e;
    let t = this.lastChild, n = e.firstChild, i = this.content.slice(), a = 0;
    for (t.isText && t.sameMarkup(n) && (i[i.length - 1] = t.withText(t.text + n.text), a = 1); a < e.content.length; a++)
      i.push(e.content[a]);
    return new Qe(i, this.size + e.size);
  }
  /**
  Cut out the sub-fragment between the two given positions.
  */
  cut(e, t = this.size) {
    if (e == 0 && t == this.size)
      return this;
    let n = [], i = 0;
    if (t > e)
      for (let a = 0, s = 0; s < t; a++) {
        let u = this.content[a], f = s + u.nodeSize;
        f > e && ((s < e || f > t) && (u.isText ? u = u.cut(Math.max(0, e - s), Math.min(u.text.length, t - s)) : u = u.cut(Math.max(0, e - s - 1), Math.min(u.content.size, t - s - 1))), n.push(u), i += u.nodeSize), s = f;
      }
    return new Qe(n, i);
  }
  /**
  @internal
  */
  cutByIndex(e, t) {
    return e == t ? Qe.empty : e == 0 && t == this.content.length ? this : new Qe(this.content.slice(e, t));
  }
  /**
  Create a new fragment in which the node at the given index is
  replaced by the given node.
  */
  replaceChild(e, t) {
    let n = this.content[e];
    if (n == t)
      return this;
    let i = this.content.slice(), a = this.size + t.nodeSize - n.nodeSize;
    return i[e] = t, new Qe(i, a);
  }
  /**
  Create a new fragment by prepending the given node to this
  fragment.
  */
  addToStart(e) {
    return new Qe([e].concat(this.content), this.size + e.nodeSize);
  }
  /**
  Create a new fragment by appending the given node to this
  fragment.
  */
  addToEnd(e) {
    return new Qe(this.content.concat(e), this.size + e.nodeSize);
  }
  /**
  Compare this fragment to another one.
  */
  eq(e) {
    if (this.content.length != e.content.length)
      return !1;
    for (let t = 0; t < this.content.length; t++)
      if (!this.content[t].eq(e.content[t]))
        return !1;
    return !0;
  }
  /**
  The first child of the fragment, or `null` if it is empty.
  */
  get firstChild() {
    return this.content.length ? this.content[0] : null;
  }
  /**
  The last child of the fragment, or `null` if it is empty.
  */
  get lastChild() {
    return this.content.length ? this.content[this.content.length - 1] : null;
  }
  /**
  The number of child nodes in this fragment.
  */
  get childCount() {
    return this.content.length;
  }
  /**
  Get the child node at the given index. Raise an error when the
  index is out of range.
  */
  child(e) {
    let t = this.content[e];
    if (!t)
      throw new RangeError("Index " + e + " out of range for " + this);
    return t;
  }
  /**
  Get the child node at the given index, if it exists.
  */
  maybeChild(e) {
    return this.content[e] || null;
  }
  /**
  Call `f` for every child node, passing the node, its offset
  into this parent node, and its index.
  */
  forEach(e) {
    for (let t = 0, n = 0; t < this.content.length; t++) {
      let i = this.content[t];
      e(i, n, t), n += i.nodeSize;
    }
  }
  /**
  Find the first position at which this fragment and another
  fragment differ, or `null` if they are the same.
  */
  findDiffStart(e, t = 0) {
    return UT(this, e, t);
  }
  /**
  Find the first position, searching from the end, at which this
  fragment and the given fragment differ, or `null` if they are
  the same. Since this position will not be the same in both
  nodes, an object with two separate positions is returned.
  */
  findDiffEnd(e, t = this.size, n = e.size) {
    return $T(this, e, t, n);
  }
  /**
  Find the index and inner offset corresponding to a given relative
  position in this fragment. The result object will be reused
  (overwritten) the next time the function is called. @internal
  */
  findIndex(e) {
    if (e == 0)
      return bv(0, e);
    if (e == this.size)
      return bv(this.content.length, e);
    if (e > this.size || e < 0)
      throw new RangeError(`Position ${e} outside of fragment (${this})`);
    for (let t = 0, n = 0; ; t++) {
      let i = this.child(t), a = n + i.nodeSize;
      if (a >= e)
        return a == e ? bv(t + 1, a) : bv(t, n);
      n = a;
    }
  }
  /**
  Return a debugging string that describes this fragment.
  */
  toString() {
    return "<" + this.toStringInner() + ">";
  }
  /**
  @internal
  */
  toStringInner() {
    return this.content.join(", ");
  }
  /**
  Create a JSON-serializeable representation of this fragment.
  */
  toJSON() {
    return this.content.length ? this.content.map((e) => e.toJSON()) : null;
  }
  /**
  Deserialize a fragment from its JSON representation.
  */
  static fromJSON(e, t) {
    if (!t)
      return Qe.empty;
    if (!Array.isArray(t))
      throw new RangeError("Invalid input for Fragment.fromJSON");
    return new Qe(t.map(e.nodeFromJSON));
  }
  /**
  Build a fragment from an array of nodes. Ensures that adjacent
  text nodes with the same marks are joined together.
  */
  static fromArray(e) {
    if (!e.length)
      return Qe.empty;
    let t, n = 0;
    for (let i = 0; i < e.length; i++) {
      let a = e[i];
      n += a.nodeSize, i && a.isText && e[i - 1].sameMarkup(a) ? (t || (t = e.slice(0, i)), t[t.length - 1] = a.withText(t[t.length - 1].text + a.text)) : t && t.push(a);
    }
    return new Qe(t || e, n);
  }
  /**
  Create a fragment from something that can be interpreted as a
  set of nodes. For `null`, it returns the empty fragment. For a
  fragment, the fragment itself. For a node or array of nodes, a
  fragment containing those nodes.
  */
  static from(e) {
    if (!e)
      return Qe.empty;
    if (e instanceof Qe)
      return e;
    if (Array.isArray(e))
      return this.fromArray(e);
    if (e.attrs)
      return new Qe([e], e.nodeSize);
    throw new RangeError("Can not convert " + e + " to a Fragment" + (e.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
  }
}
Qe.empty = new Qe([], 0);
const fy = { index: 0, offset: 0 };
function bv(r, e) {
  return fy.index = r, fy.offset = e, fy;
}
function Kv(r, e) {
  if (r === e)
    return !0;
  if (!(r && typeof r == "object") || !(e && typeof e == "object"))
    return !1;
  let t = Array.isArray(r);
  if (Array.isArray(e) != t)
    return !1;
  if (t) {
    if (r.length != e.length)
      return !1;
    for (let n = 0; n < r.length; n++)
      if (!Kv(r[n], e[n]))
        return !1;
  } else {
    for (let n in r)
      if (!(n in e) || !Kv(r[n], e[n]))
        return !1;
    for (let n in e)
      if (!(n in r))
        return !1;
  }
  return !0;
}
let Tr = class e0 {
  /**
  @internal
  */
  constructor(e, t) {
    this.type = e, this.attrs = t;
  }
  /**
  Given a set of marks, create a new set which contains this one as
  well, in the right position. If this mark is already in the set,
  the set itself is returned. If any marks that are set to be
  [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
  those are replaced by this one.
  */
  addToSet(e) {
    let t, n = !1;
    for (let i = 0; i < e.length; i++) {
      let a = e[i];
      if (this.eq(a))
        return e;
      if (this.type.excludes(a.type))
        t || (t = e.slice(0, i));
      else {
        if (a.type.excludes(this.type))
          return e;
        !n && a.type.rank > this.type.rank && (t || (t = e.slice(0, i)), t.push(this), n = !0), t && t.push(a);
      }
    }
    return t || (t = e.slice()), n || t.push(this), t;
  }
  /**
  Remove this mark from the given set, returning a new set. If this
  mark is not in the set, the set itself is returned.
  */
  removeFromSet(e) {
    for (let t = 0; t < e.length; t++)
      if (this.eq(e[t]))
        return e.slice(0, t).concat(e.slice(t + 1));
    return e;
  }
  /**
  Test whether this mark is in the given set of marks.
  */
  isInSet(e) {
    for (let t = 0; t < e.length; t++)
      if (this.eq(e[t]))
        return !0;
    return !1;
  }
  /**
  Test whether this mark has the same type and attributes as
  another mark.
  */
  eq(e) {
    return this == e || this.type == e.type && Kv(this.attrs, e.attrs);
  }
  /**
  Convert this mark to a JSON-serializeable representation.
  */
  toJSON() {
    let e = { type: this.type.name };
    for (let t in this.attrs) {
      e.attrs = this.attrs;
      break;
    }
    return e;
  }
  /**
  Deserialize a mark from JSON.
  */
  static fromJSON(e, t) {
    if (!t)
      throw new RangeError("Invalid input for Mark.fromJSON");
    let n = e.marks[t.type];
    if (!n)
      throw new RangeError(`There is no mark type ${t.type} in this schema`);
    let i = n.create(t.attrs);
    return n.checkAttrs(i.attrs), i;
  }
  /**
  Test whether two sets of marks are identical.
  */
  static sameSet(e, t) {
    if (e == t)
      return !0;
    if (e.length != t.length)
      return !1;
    for (let n = 0; n < e.length; n++)
      if (!e[n].eq(t[n]))
        return !1;
    return !0;
  }
  /**
  Create a properly sorted mark set from null, a single mark, or an
  unsorted array of marks.
  */
  static setFrom(e) {
    if (!e || Array.isArray(e) && e.length == 0)
      return e0.none;
    if (e instanceof e0)
      return [e];
    let t = e.slice();
    return t.sort((n, i) => n.type.rank - i.type.rank), t;
  }
};
Tr.none = [];
class Jv extends Error {
}
class ht {
  /**
  Create a slice. When specifying a non-zero open depth, you must
  make sure that there are nodes of at least that depth at the
  appropriate side of the fragment—i.e. if the fragment is an
  empty paragraph node, `openStart` and `openEnd` can't be greater
  than 1.
  
  It is not necessary for the content of open nodes to conform to
  the schema's content constraints, though it should be a valid
  start/end/middle for such a node, depending on which sides are
  open.
  */
  constructor(e, t, n) {
    this.content = e, this.openStart = t, this.openEnd = n;
  }
  /**
  The size this slice would add when inserted into a document.
  */
  get size() {
    return this.content.size - this.openStart - this.openEnd;
  }
  /**
  @internal
  */
  insertAt(e, t) {
    let n = jT(this.content, e + this.openStart, t);
    return n && new ht(n, this.openStart, this.openEnd);
  }
  /**
  @internal
  */
  removeBetween(e, t) {
    return new ht(WT(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
  }
  /**
  Tests whether this slice is equal to another slice.
  */
  eq(e) {
    return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
  }
  /**
  @internal
  */
  toString() {
    return this.content + "(" + this.openStart + "," + this.openEnd + ")";
  }
  /**
  Convert a slice to a JSON-serializable representation.
  */
  toJSON() {
    if (!this.content.size)
      return null;
    let e = { content: this.content.toJSON() };
    return this.openStart > 0 && (e.openStart = this.openStart), this.openEnd > 0 && (e.openEnd = this.openEnd), e;
  }
  /**
  Deserialize a slice from its JSON representation.
  */
  static fromJSON(e, t) {
    if (!t)
      return ht.empty;
    let n = t.openStart || 0, i = t.openEnd || 0;
    if (typeof n != "number" || typeof i != "number")
      throw new RangeError("Invalid input for Slice.fromJSON");
    return new ht(Qe.fromJSON(e, t.content), n, i);
  }
  /**
  Create a slice from a fragment by taking the maximum possible
  open value on both side of the fragment.
  */
  static maxOpen(e, t = !0) {
    let n = 0, i = 0;
    for (let a = e.firstChild; a && !a.isLeaf && (t || !a.type.spec.isolating); a = a.firstChild)
      n++;
    for (let a = e.lastChild; a && !a.isLeaf && (t || !a.type.spec.isolating); a = a.lastChild)
      i++;
    return new ht(e, n, i);
  }
}
ht.empty = new ht(Qe.empty, 0, 0);
function WT(r, e, t) {
  let { index: n, offset: i } = r.findIndex(e), a = r.maybeChild(n), { index: s, offset: u } = r.findIndex(t);
  if (i == e || a.isText) {
    if (u != t && !r.child(s).isText)
      throw new RangeError("Removing non-flat range");
    return r.cut(0, e).append(r.cut(t));
  }
  if (n != s)
    throw new RangeError("Removing non-flat range");
  return r.replaceChild(n, a.copy(WT(a.content, e - i - 1, t - i - 1)));
}
function jT(r, e, t, n) {
  let { index: i, offset: a } = r.findIndex(e), s = r.maybeChild(i);
  if (a == e || s.isText)
    return n && !n.canReplace(i, i, t) ? null : r.cut(0, e).append(t).append(r.cut(e));
  let u = jT(s.content, e - a - 1, t, s);
  return u && r.replaceChild(i, s.copy(u));
}
function EZ(r, e, t) {
  if (t.openStart > r.depth)
    throw new Jv("Inserted content deeper than insertion position");
  if (r.depth - t.openStart != e.depth - t.openEnd)
    throw new Jv("Inconsistent open depths");
  return GT(r, e, t, 0);
}
function GT(r, e, t, n) {
  let i = r.index(n), a = r.node(n);
  if (i == e.index(n) && n < r.depth - t.openStart) {
    let s = GT(r, e, t, n + 1);
    return a.copy(a.content.replaceChild(i, s));
  } else if (t.content.size)
    if (!t.openStart && !t.openEnd && r.depth == n && e.depth == n) {
      let s = r.parent, u = s.content;
      return yu(s, u.cut(0, r.parentOffset).append(t.content).append(u.cut(e.parentOffset)));
    } else {
      let { start: s, end: u } = MZ(t, r);
      return yu(a, JT(r, s, u, e, n));
    }
  else return yu(a, Qv(r, e, n));
}
function KT(r, e) {
  if (!e.type.compatibleContent(r.type))
    throw new Jv("Cannot join " + e.type.name + " onto " + r.type.name);
}
function t0(r, e, t) {
  let n = r.node(t);
  return KT(n, e.node(t)), n;
}
function gu(r, e) {
  let t = e.length - 1;
  t >= 0 && r.isText && r.sameMarkup(e[t]) ? e[t] = r.withText(e[t].text + r.text) : e.push(r);
}
function oh(r, e, t, n) {
  let i = (e || r).node(t), a = 0, s = e ? e.index(t) : i.childCount;
  r && (a = r.index(t), r.depth > t ? a++ : r.textOffset && (gu(r.nodeAfter, n), a++));
  for (let u = a; u < s; u++)
    gu(i.child(u), n);
  e && e.depth == t && e.textOffset && gu(e.nodeBefore, n);
}
function yu(r, e) {
  return r.type.checkContent(e), r.copy(e);
}
function JT(r, e, t, n, i) {
  let a = r.depth > i && t0(r, e, i + 1), s = n.depth > i && t0(t, n, i + 1), u = [];
  return oh(null, r, i, u), a && s && e.index(i) == t.index(i) ? (KT(a, s), gu(yu(a, JT(r, e, t, n, i + 1)), u)) : (a && gu(yu(a, Qv(r, e, i + 1)), u), oh(e, t, i, u), s && gu(yu(s, Qv(t, n, i + 1)), u)), oh(n, null, i, u), new Qe(u);
}
function Qv(r, e, t) {
  let n = [];
  if (oh(null, r, t, n), r.depth > t) {
    let i = t0(r, e, t + 1);
    gu(yu(i, Qv(r, e, t + 1)), n);
  }
  return oh(e, null, t, n), new Qe(n);
}
function MZ(r, e) {
  let t = e.depth - r.openStart, i = e.node(t).copy(r.content);
  for (let a = t - 1; a >= 0; a--)
    i = e.node(a).copy(Qe.from(i));
  return {
    start: i.resolveNoCache(r.openStart + t),
    end: i.resolveNoCache(i.content.size - r.openEnd - t)
  };
}
class dh {
  /**
  @internal
  */
  constructor(e, t, n) {
    this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
  }
  /**
  @internal
  */
  resolveDepth(e) {
    return e == null ? this.depth : e < 0 ? this.depth + e : e;
  }
  /**
  The parent node that the position points into. Note that even if
  a position points into a text node, that node is not considered
  the parent—text nodes are ‘flat’ in this model, and have no content.
  */
  get parent() {
    return this.node(this.depth);
  }
  /**
  The root node in which the position was resolved.
  */
  get doc() {
    return this.node(0);
  }
  /**
  The ancestor node at the given level. `p.node(p.depth)` is the
  same as `p.parent`.
  */
  node(e) {
    return this.path[this.resolveDepth(e) * 3];
  }
  /**
  The index into the ancestor at the given level. If this points
  at the 3rd node in the 2nd paragraph on the top level, for
  example, `p.index(0)` is 1 and `p.index(1)` is 2.
  */
  index(e) {
    return this.path[this.resolveDepth(e) * 3 + 1];
  }
  /**
  The index pointing after this position into the ancestor at the
  given level.
  */
  indexAfter(e) {
    return e = this.resolveDepth(e), this.index(e) + (e == this.depth && !this.textOffset ? 0 : 1);
  }
  /**
  The (absolute) position at the start of the node at the given
  level.
  */
  start(e) {
    return e = this.resolveDepth(e), e == 0 ? 0 : this.path[e * 3 - 1] + 1;
  }
  /**
  The (absolute) position at the end of the node at the given
  level.
  */
  end(e) {
    return e = this.resolveDepth(e), this.start(e) + this.node(e).content.size;
  }
  /**
  The (absolute) position directly before the wrapping node at the
  given level, or, when `depth` is `this.depth + 1`, the original
  position.
  */
  before(e) {
    if (e = this.resolveDepth(e), !e)
      throw new RangeError("There is no position before the top-level node");
    return e == this.depth + 1 ? this.pos : this.path[e * 3 - 1];
  }
  /**
  The (absolute) position directly after the wrapping node at the
  given level, or the original position when `depth` is `this.depth + 1`.
  */
  after(e) {
    if (e = this.resolveDepth(e), !e)
      throw new RangeError("There is no position after the top-level node");
    return e == this.depth + 1 ? this.pos : this.path[e * 3 - 1] + this.path[e * 3].nodeSize;
  }
  /**
  When this position points into a text node, this returns the
  distance between the position and the start of the text node.
  Will be zero for positions that point between nodes.
  */
  get textOffset() {
    return this.pos - this.path[this.path.length - 1];
  }
  /**
  Get the node directly after the position, if any. If the position
  points into a text node, only the part of that node after the
  position is returned.
  */
  get nodeAfter() {
    let e = this.parent, t = this.index(this.depth);
    if (t == e.childCount)
      return null;
    let n = this.pos - this.path[this.path.length - 1], i = e.child(t);
    return n ? e.child(t).cut(n) : i;
  }
  /**
  Get the node directly before the position, if any. If the
  position points into a text node, only the part of that node
  before the position is returned.
  */
  get nodeBefore() {
    let e = this.index(this.depth), t = this.pos - this.path[this.path.length - 1];
    return t ? this.parent.child(e).cut(0, t) : e == 0 ? null : this.parent.child(e - 1);
  }
  /**
  Get the position at the given index in the parent node at the
  given depth (which defaults to `this.depth`).
  */
  posAtIndex(e, t) {
    t = this.resolveDepth(t);
    let n = this.path[t * 3], i = t == 0 ? 0 : this.path[t * 3 - 1] + 1;
    for (let a = 0; a < e; a++)
      i += n.child(a).nodeSize;
    return i;
  }
  /**
  Get the marks at this position, factoring in the surrounding
  marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
  position is at the start of a non-empty node, the marks of the
  node after it (if any) are returned.
  */
  marks() {
    let e = this.parent, t = this.index();
    if (e.content.size == 0)
      return Tr.none;
    if (this.textOffset)
      return e.child(t).marks;
    let n = e.maybeChild(t - 1), i = e.maybeChild(t);
    if (!n) {
      let u = n;
      n = i, i = u;
    }
    let a = n.marks;
    for (var s = 0; s < a.length; s++)
      a[s].type.spec.inclusive === !1 && (!i || !a[s].isInSet(i.marks)) && (a = a[s--].removeFromSet(a));
    return a;
  }
  /**
  Get the marks after the current position, if any, except those
  that are non-inclusive and not present at position `$end`. This
  is mostly useful for getting the set of marks to preserve after a
  deletion. Will return `null` if this position is at the end of
  its parent node or its parent node isn't a textblock (in which
  case no marks should be preserved).
  */
  marksAcross(e) {
    let t = this.parent.maybeChild(this.index());
    if (!t || !t.isInline)
      return null;
    let n = t.marks, i = e.parent.maybeChild(e.index());
    for (var a = 0; a < n.length; a++)
      n[a].type.spec.inclusive === !1 && (!i || !n[a].isInSet(i.marks)) && (n = n[a--].removeFromSet(n));
    return n;
  }
  /**
  The depth up to which this position and the given (non-resolved)
  position share the same parent nodes.
  */
  sharedDepth(e) {
    for (let t = this.depth; t > 0; t--)
      if (this.start(t) <= e && this.end(t) >= e)
        return t;
    return 0;
  }
  /**
  Returns a range based on the place where this position and the
  given position diverge around block content. If both point into
  the same textblock, for example, a range around that textblock
  will be returned. If they point into different blocks, the range
  around those blocks in their shared ancestor is returned. You can
  pass in an optional predicate that will be called with a parent
  node to see if a range into that parent is acceptable.
  */
  blockRange(e = this, t) {
    if (e.pos < this.pos)
      return e.blockRange(this);
    for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--)
      if (e.pos <= this.end(n) && (!t || t(this.node(n))))
        return new Xv(this, e, n);
    return null;
  }
  /**
  Query whether the given position shares the same parent node.
  */
  sameParent(e) {
    return this.pos - this.parentOffset == e.pos - e.parentOffset;
  }
  /**
  Return the greater of this and the given position.
  */
  max(e) {
    return e.pos > this.pos ? e : this;
  }
  /**
  Return the smaller of this and the given position.
  */
  min(e) {
    return e.pos < this.pos ? e : this;
  }
  /**
  @internal
  */
  toString() {
    let e = "";
    for (let t = 1; t <= this.depth; t++)
      e += (e ? "/" : "") + this.node(t).type.name + "_" + this.index(t - 1);
    return e + ":" + this.parentOffset;
  }
  /**
  @internal
  */
  static resolve(e, t) {
    if (!(t >= 0 && t <= e.content.size))
      throw new RangeError("Position " + t + " out of range");
    let n = [], i = 0, a = t;
    for (let s = e; ; ) {
      let { index: u, offset: f } = s.content.findIndex(a), p = a - f;
      if (n.push(s, u, i + f), !p || (s = s.child(u), s.isText))
        break;
      a = p - 1, i += f + 1;
    }
    return new dh(t, n, a);
  }
  /**
  @internal
  */
  static resolveCached(e, t) {
    let n = g1.get(e);
    if (n)
      for (let a = 0; a < n.elts.length; a++) {
        let s = n.elts[a];
        if (s.pos == t)
          return s;
      }
    else
      g1.set(e, n = new NZ());
    let i = n.elts[n.i] = dh.resolve(e, t);
    return n.i = (n.i + 1) % OZ, i;
  }
}
class NZ {
  constructor() {
    this.elts = [], this.i = 0;
  }
}
const OZ = 12, g1 = /* @__PURE__ */ new WeakMap();
class Xv {
  /**
  Construct a node range. `$from` and `$to` should point into the
  same node until at least the given `depth`, since a node range
  denotes an adjacent set of nodes in a single parent node.
  */
  constructor(e, t, n) {
    this.$from = e, this.$to = t, this.depth = n;
  }
  /**
  The position at the start of the range.
  */
  get start() {
    return this.$from.before(this.depth + 1);
  }
  /**
  The position at the end of the range.
  */
  get end() {
    return this.$to.after(this.depth + 1);
  }
  /**
  The parent node that the range points into.
  */
  get parent() {
    return this.$from.node(this.depth);
  }
  /**
  The start index of the range in the parent node.
  */
  get startIndex() {
    return this.$from.index(this.depth);
  }
  /**
  The end index of the range in the parent node.
  */
  get endIndex() {
    return this.$to.indexAfter(this.depth);
  }
}
const DZ = /* @__PURE__ */ Object.create(null);
let hl = class r0 {
  /**
  @internal
  */
  constructor(e, t, n, i = Tr.none) {
    this.type = e, this.attrs = t, this.marks = i, this.content = n || Qe.empty;
  }
  /**
  The array of this node's child nodes.
  */
  get children() {
    return this.content.content;
  }
  /**
  The size of this node, as defined by the integer-based [indexing
  scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
  amount of characters. For other leaf nodes, it is one. For
  non-leaf nodes, it is the size of the content plus two (the
  start and end token).
  */
  get nodeSize() {
    return this.isLeaf ? 1 : 2 + this.content.size;
  }
  /**
  The number of children that the node has.
  */
  get childCount() {
    return this.content.childCount;
  }
  /**
  Get the child node at the given index. Raises an error when the
  index is out of range.
  */
  child(e) {
    return this.content.child(e);
  }
  /**
  Get the child node at the given index, if it exists.
  */
  maybeChild(e) {
    return this.content.maybeChild(e);
  }
  /**
  Call `f` for every child node, passing the node, its offset
  into this parent node, and its index.
  */
  forEach(e) {
    this.content.forEach(e);
  }
  /**
  Invoke a callback for all descendant nodes recursively between
  the given two positions that are relative to start of this
  node's content. The callback is invoked with the node, its
  position relative to the original node (method receiver),
  its parent node, and its child index. When the callback returns
  false for a given node, that node's children will not be
  recursed over. The last parameter can be used to specify a
  starting position to count from.
  */
  nodesBetween(e, t, n, i = 0) {
    this.content.nodesBetween(e, t, n, i, this);
  }
  /**
  Call the given callback for every descendant node. Doesn't
  descend into a node when the callback returns `false`.
  */
  descendants(e) {
    this.nodesBetween(0, this.content.size, e);
  }
  /**
  Concatenates all the text nodes found in this fragment and its
  children.
  */
  get textContent() {
    return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
  }
  /**
  Get all text between positions `from` and `to`. When
  `blockSeparator` is given, it will be inserted to separate text
  from different block nodes. If `leafText` is given, it'll be
  inserted for every non-text leaf node encountered, otherwise
  [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
  */
  textBetween(e, t, n, i) {
    return this.content.textBetween(e, t, n, i);
  }
  /**
  Returns this node's first child, or `null` if there are no
  children.
  */
  get firstChild() {
    return this.content.firstChild;
  }
  /**
  Returns this node's last child, or `null` if there are no
  children.
  */
  get lastChild() {
    return this.content.lastChild;
  }
  /**
  Test whether two nodes represent the same piece of document.
  */
  eq(e) {
    return this == e || this.sameMarkup(e) && this.content.eq(e.content);
  }
  /**
  Compare the markup (type, attributes, and marks) of this node to
  those of another. Returns `true` if both have the same markup.
  */
  sameMarkup(e) {
    return this.hasMarkup(e.type, e.attrs, e.marks);
  }
  /**
  Check whether this node's markup correspond to the given type,
  attributes, and marks.
  */
  hasMarkup(e, t, n) {
    return this.type == e && Kv(this.attrs, t || e.defaultAttrs || DZ) && Tr.sameSet(this.marks, n || Tr.none);
  }
  /**
  Create a new node with the same markup as this node, containing
  the given content (or empty, if no content is given).
  */
  copy(e = null) {
    return e == this.content ? this : new r0(this.type, this.attrs, e, this.marks);
  }
  /**
  Create a copy of this node, with the given set of marks instead
  of the node's own marks.
  */
  mark(e) {
    return e == this.marks ? this : new r0(this.type, this.attrs, this.content, e);
  }
  /**
  Create a copy of this node with only the content between the
  given positions. If `to` is not given, it defaults to the end of
  the node.
  */
  cut(e, t = this.content.size) {
    return e == 0 && t == this.content.size ? this : this.copy(this.content.cut(e, t));
  }
  /**
  Cut out the part of the document between the given positions, and
  return it as a `Slice` object.
  */
  slice(e, t = this.content.size, n = !1) {
    if (e == t)
      return ht.empty;
    let i = this.resolve(e), a = this.resolve(t), s = n ? 0 : i.sharedDepth(t), u = i.start(s), p = i.node(s).content.cut(i.pos - u, a.pos - u);
    return new ht(p, i.depth - s, a.depth - s);
  }
  /**
  Replace the part of the document between the given positions with
  the given slice. The slice must 'fit', meaning its open sides
  must be able to connect to the surrounding content, and its
  content nodes must be valid children for the node they are placed
  into. If any of this is violated, an error of type
  [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
  */
  replace(e, t, n) {
    return EZ(this.resolve(e), this.resolve(t), n);
  }
  /**
  Find the node directly after the given position.
  */
  nodeAt(e) {
    for (let t = this; ; ) {
      let { index: n, offset: i } = t.content.findIndex(e);
      if (t = t.maybeChild(n), !t)
        return null;
      if (i == e || t.isText)
        return t;
      e -= i + 1;
    }
  }
  /**
  Find the (direct) child node after the given offset, if any,
  and return it along with its index and offset relative to this
  node.
  */
  childAfter(e) {
    let { index: t, offset: n } = this.content.findIndex(e);
    return { node: this.content.maybeChild(t), index: t, offset: n };
  }
  /**
  Find the (direct) child node before the given offset, if any,
  and return it along with its index and offset relative to this
  node.
  */
  childBefore(e) {
    if (e == 0)
      return { node: null, index: 0, offset: 0 };
    let { index: t, offset: n } = this.content.findIndex(e);
    if (n < e)
      return { node: this.content.child(t), index: t, offset: n };
    let i = this.content.child(t - 1);
    return { node: i, index: t - 1, offset: n - i.nodeSize };
  }
  /**
  Resolve the given position in the document, returning an
  [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
  */
  resolve(e) {
    return dh.resolveCached(this, e);
  }
  /**
  @internal
  */
  resolveNoCache(e) {
    return dh.resolve(this, e);
  }
  /**
  Test whether a given mark or mark type occurs in this document
  between the two given positions.
  */
  rangeHasMark(e, t, n) {
    let i = !1;
    return t > e && this.nodesBetween(e, t, (a) => (n.isInSet(a.marks) && (i = !0), !i)), i;
  }
  /**
  True when this is a block (non-inline node)
  */
  get isBlock() {
    return this.type.isBlock;
  }
  /**
  True when this is a textblock node, a block node with inline
  content.
  */
  get isTextblock() {
    return this.type.isTextblock;
  }
  /**
  True when this node allows inline content.
  */
  get inlineContent() {
    return this.type.inlineContent;
  }
  /**
  True when this is an inline node (a text node or a node that can
  appear among text).
  */
  get isInline() {
    return this.type.isInline;
  }
  /**
  True when this is a text node.
  */
  get isText() {
    return this.type.isText;
  }
  /**
  True when this is a leaf node.
  */
  get isLeaf() {
    return this.type.isLeaf;
  }
  /**
  True when this is an atom, i.e. when it does not have directly
  editable content. This is usually the same as `isLeaf`, but can
  be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
  on a node's spec (typically used when the node is displayed as
  an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
  */
  get isAtom() {
    return this.type.isAtom;
  }
  /**
  Return a string representation of this node for debugging
  purposes.
  */
  toString() {
    if (this.type.spec.toDebugString)
      return this.type.spec.toDebugString(this);
    let e = this.type.name;
    return this.content.size && (e += "(" + this.content.toStringInner() + ")"), QT(this.marks, e);
  }
  /**
  Get the content match in this node at the given index.
  */
  contentMatchAt(e) {
    let t = this.type.contentMatch.matchFragment(this.content, 0, e);
    if (!t)
      throw new Error("Called contentMatchAt on a node with invalid content");
    return t;
  }
  /**
  Test whether replacing the range between `from` and `to` (by
  child index) with the given replacement fragment (which defaults
  to the empty fragment) would leave the node's content valid. You
  can optionally pass `start` and `end` indices into the
  replacement fragment.
  */
  canReplace(e, t, n = Qe.empty, i = 0, a = n.childCount) {
    let s = this.contentMatchAt(e).matchFragment(n, i, a), u = s && s.matchFragment(this.content, t);
    if (!u || !u.validEnd)
      return !1;
    for (let f = i; f < a; f++)
      if (!this.type.allowsMarks(n.child(f).marks))
        return !1;
    return !0;
  }
  /**
  Test whether replacing the range `from` to `to` (by index) with
  a node of the given type would leave the node's content valid.
  */
  canReplaceWith(e, t, n, i) {
    if (i && !this.type.allowsMarks(i))
      return !1;
    let a = this.contentMatchAt(e).matchType(n), s = a && a.matchFragment(this.content, t);
    return s ? s.validEnd : !1;
  }
  /**
  Test whether the given node's content could be appended to this
  node. If that node is empty, this will only return true if there
  is at least one node type that can appear in both nodes (to avoid
  merging completely incompatible nodes).
  */
  canAppend(e) {
    return e.content.size ? this.canReplace(this.childCount, this.childCount, e.content) : this.type.compatibleContent(e.type);
  }
  /**
  Check whether this node and its descendants conform to the
  schema, and raise an exception when they do not.
  */
  check() {
    this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
    let e = Tr.none;
    for (let t = 0; t < this.marks.length; t++) {
      let n = this.marks[t];
      n.type.checkAttrs(n.attrs), e = n.addToSet(e);
    }
    if (!Tr.sameSet(e, this.marks))
      throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t) => t.type.name)}`);
    this.content.forEach((t) => t.check());
  }
  /**
  Return a JSON-serializeable representation of this node.
  */
  toJSON() {
    let e = { type: this.type.name };
    for (let t in this.attrs) {
      e.attrs = this.attrs;
      break;
    }
    return this.content.size && (e.content = this.content.toJSON()), this.marks.length && (e.marks = this.marks.map((t) => t.toJSON())), e;
  }
  /**
  Deserialize a node from its JSON representation.
  */
  static fromJSON(e, t) {
    if (!t)
      throw new RangeError("Invalid input for Node.fromJSON");
    let n;
    if (t.marks) {
      if (!Array.isArray(t.marks))
        throw new RangeError("Invalid mark data for Node.fromJSON");
      n = t.marks.map(e.markFromJSON);
    }
    if (t.type == "text") {
      if (typeof t.text != "string")
        throw new RangeError("Invalid text node in JSON");
      return e.text(t.text, n);
    }
    let i = Qe.fromJSON(e, t.content), a = e.nodeType(t.type).create(t.attrs, i, n);
    return a.type.checkAttrs(a.attrs), a;
  }
};
hl.prototype.text = void 0;
class Yv extends hl {
  /**
  @internal
  */
  constructor(e, t, n, i) {
    if (super(e, t, null, i), !n)
      throw new RangeError("Empty text nodes are not allowed");
    this.text = n;
  }
  toString() {
    return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : QT(this.marks, JSON.stringify(this.text));
  }
  get textContent() {
    return this.text;
  }
  textBetween(e, t) {
    return this.text.slice(e, t);
  }
  get nodeSize() {
    return this.text.length;
  }
  mark(e) {
    return e == this.marks ? this : new Yv(this.type, this.attrs, this.text, e);
  }
  withText(e) {
    return e == this.text ? this : new Yv(this.type, this.attrs, e, this.marks);
  }
  cut(e = 0, t = this.text.length) {
    return e == 0 && t == this.text.length ? this : this.withText(this.text.slice(e, t));
  }
  eq(e) {
    return this.sameMarkup(e) && this.text == e.text;
  }
  toJSON() {
    let e = super.toJSON();
    return e.text = this.text, e;
  }
}
function QT(r, e) {
  for (let t = r.length - 1; t >= 0; t--)
    e = r[t].type.name + "(" + e + ")";
  return e;
}
class Cu {
  /**
  @internal
  */
  constructor(e) {
    this.validEnd = e, this.next = [], this.wrapCache = [];
  }
  /**
  @internal
  */
  static parse(e, t) {
    let n = new AZ(e, t);
    if (n.next == null)
      return Cu.empty;
    let i = XT(n);
    n.next && n.err("Unexpected trailing text");
    let a = _Z(FZ(i));
    return qZ(a, n), a;
  }
  /**
  Match a node type, returning a match after that node if
  successful.
  */
  matchType(e) {
    for (let t = 0; t < this.next.length; t++)
      if (this.next[t].type == e)
        return this.next[t].next;
    return null;
  }
  /**
  Try to match a fragment. Returns the resulting match when
  successful.
  */
  matchFragment(e, t = 0, n = e.childCount) {
    let i = this;
    for (let a = t; i && a < n; a++)
      i = i.matchType(e.child(a).type);
    return i;
  }
  /**
  @internal
  */
  get inlineContent() {
    return this.next.length != 0 && this.next[0].type.isInline;
  }
  /**
  Get the first matching node type at this match position that can
  be generated.
  */
  get defaultType() {
    for (let e = 0; e < this.next.length; e++) {
      let { type: t } = this.next[e];
      if (!(t.isText || t.hasRequiredAttrs()))
        return t;
    }
    return null;
  }
  /**
  @internal
  */
  compatible(e) {
    for (let t = 0; t < this.next.length; t++)
      for (let n = 0; n < e.next.length; n++)
        if (this.next[t].type == e.next[n].type)
          return !0;
    return !1;
  }
  /**
  Try to match the given fragment, and if that fails, see if it can
  be made to match by inserting nodes in front of it. When
  successful, return a fragment of inserted nodes (which may be
  empty if nothing had to be inserted). When `toEnd` is true, only
  return a fragment if the resulting match goes to the end of the
  content expression.
  */
  fillBefore(e, t = !1, n = 0) {
    let i = [this];
    function a(s, u) {
      let f = s.matchFragment(e, n);
      if (f && (!t || f.validEnd))
        return Qe.from(u.map((p) => p.createAndFill()));
      for (let p = 0; p < s.next.length; p++) {
        let { type: y, next: T } = s.next[p];
        if (!(y.isText || y.hasRequiredAttrs()) && i.indexOf(T) == -1) {
          i.push(T);
          let N = a(T, u.concat(y));
          if (N)
            return N;
        }
      }
      return null;
    }
    return a(this, []);
  }
  /**
  Find a set of wrapping node types that would allow a node of the
  given type to appear at this position. The result may be empty
  (when it fits directly) and will be null when no such wrapping
  exists.
  */
  findWrapping(e) {
    for (let n = 0; n < this.wrapCache.length; n += 2)
      if (this.wrapCache[n] == e)
        return this.wrapCache[n + 1];
    let t = this.computeWrapping(e);
    return this.wrapCache.push(e, t), t;
  }
  /**
  @internal
  */
  computeWrapping(e) {
    let t = /* @__PURE__ */ Object.create(null), n = [{ match: this, type: null, via: null }];
    for (; n.length; ) {
      let i = n.shift(), a = i.match;
      if (a.matchType(e)) {
        let s = [];
        for (let u = i; u.type; u = u.via)
          s.push(u.type);
        return s.reverse();
      }
      for (let s = 0; s < a.next.length; s++) {
        let { type: u, next: f } = a.next[s];
        !u.isLeaf && !u.hasRequiredAttrs() && !(u.name in t) && (!i.type || f.validEnd) && (n.push({ match: u.contentMatch, type: u, via: i }), t[u.name] = !0);
      }
    }
    return null;
  }
  /**
  The number of outgoing edges this node has in the finite
  automaton that describes the content expression.
  */
  get edgeCount() {
    return this.next.length;
  }
  /**
  Get the _n_​th outgoing edge from this node in the finite
  automaton that describes the content expression.
  */
  edge(e) {
    if (e >= this.next.length)
      throw new RangeError(`There's no ${e}th edge in this content match`);
    return this.next[e];
  }
  /**
  @internal
  */
  toString() {
    let e = [];
    function t(n) {
      e.push(n);
      for (let i = 0; i < n.next.length; i++)
        e.indexOf(n.next[i].next) == -1 && t(n.next[i].next);
    }
    return t(this), e.map((n, i) => {
      let a = i + (n.validEnd ? "*" : " ") + " ";
      for (let s = 0; s < n.next.length; s++)
        a += (s ? ", " : "") + n.next[s].type.name + "->" + e.indexOf(n.next[s].next);
      return a;
    }).join(`
`);
  }
}
Cu.empty = new Cu(!0);
class AZ {
  constructor(e, t) {
    this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
  }
  get next() {
    return this.tokens[this.pos];
  }
  eat(e) {
    return this.next == e && (this.pos++ || !0);
  }
  err(e) {
    throw new SyntaxError(e + " (in content expression '" + this.string + "')");
  }
}
function XT(r) {
  let e = [];
  do
    e.push(LZ(r));
  while (r.eat("|"));
  return e.length == 1 ? e[0] : { type: "choice", exprs: e };
}
function LZ(r) {
  let e = [];
  do
    e.push(RZ(r));
  while (r.next && r.next != ")" && r.next != "|");
  return e.length == 1 ? e[0] : { type: "seq", exprs: e };
}
function RZ(r) {
  let e = BZ(r);
  for (; ; )
    if (r.eat("+"))
      e = { type: "plus", expr: e };
    else if (r.eat("*"))
      e = { type: "star", expr: e };
    else if (r.eat("?"))
      e = { type: "opt", expr: e };
    else if (r.eat("{"))
      e = IZ(r, e);
    else
      break;
  return e;
}
function y1(r) {
  /\D/.test(r.next) && r.err("Expected number, got '" + r.next + "'");
  let e = Number(r.next);
  return r.pos++, e;
}
function IZ(r, e) {
  let t = y1(r), n = t;
  return r.eat(",") && (r.next != "}" ? n = y1(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: t, max: n, expr: e };
}
function PZ(r, e) {
  let t = r.nodeTypes, n = t[e];
  if (n)
    return [n];
  let i = [];
  for (let a in t) {
    let s = t[a];
    s.isInGroup(e) && i.push(s);
  }
  return i.length == 0 && r.err("No node type or group '" + e + "' found"), i;
}
function BZ(r) {
  if (r.eat("(")) {
    let e = XT(r);
    return r.eat(")") || r.err("Missing closing paren"), e;
  } else if (/\W/.test(r.next))
    r.err("Unexpected token '" + r.next + "'");
  else {
    let e = PZ(r, r.next).map((t) => (r.inline == null ? r.inline = t.isInline : r.inline != t.isInline && r.err("Mixing inline and block content"), { type: "name", value: t }));
    return r.pos++, e.length == 1 ? e[0] : { type: "choice", exprs: e };
  }
}
function FZ(r) {
  let e = [[]];
  return i(a(r, 0), t()), e;
  function t() {
    return e.push([]) - 1;
  }
  function n(s, u, f) {
    let p = { term: f, to: u };
    return e[s].push(p), p;
  }
  function i(s, u) {
    s.forEach((f) => f.to = u);
  }
  function a(s, u) {
    if (s.type == "choice")
      return s.exprs.reduce((f, p) => f.concat(a(p, u)), []);
    if (s.type == "seq")
      for (let f = 0; ; f++) {
        let p = a(s.exprs[f], u);
        if (f == s.exprs.length - 1)
          return p;
        i(p, u = t());
      }
    else if (s.type == "star") {
      let f = t();
      return n(u, f), i(a(s.expr, f), f), [n(f)];
    } else if (s.type == "plus") {
      let f = t();
      return i(a(s.expr, u), f), i(a(s.expr, f), f), [n(f)];
    } else {
      if (s.type == "opt")
        return [n(u)].concat(a(s.expr, u));
      if (s.type == "range") {
        let f = u;
        for (let p = 0; p < s.min; p++) {
          let y = t();
          i(a(s.expr, f), y), f = y;
        }
        if (s.max == -1)
          i(a(s.expr, f), f);
        else
          for (let p = s.min; p < s.max; p++) {
            let y = t();
            n(f, y), i(a(s.expr, f), y), f = y;
          }
        return [n(f)];
      } else {
        if (s.type == "name")
          return [n(u, void 0, s.value)];
        throw new Error("Unknown expr type");
      }
    }
  }
}
function YT(r, e) {
  return e - r;
}
function k1(r, e) {
  let t = [];
  return n(e), t.sort(YT);
  function n(i) {
    let a = r[i];
    if (a.length == 1 && !a[0].term)
      return n(a[0].to);
    t.push(i);
    for (let s = 0; s < a.length; s++) {
      let { term: u, to: f } = a[s];
      !u && t.indexOf(f) == -1 && n(f);
    }
  }
}
function _Z(r) {
  let e = /* @__PURE__ */ Object.create(null);
  return t(k1(r, 0));
  function t(n) {
    let i = [];
    n.forEach((s) => {
      r[s].forEach(({ term: u, to: f }) => {
        if (!u)
          return;
        let p;
        for (let y = 0; y < i.length; y++)
          i[y][0] == u && (p = i[y][1]);
        k1(r, f).forEach((y) => {
          p || i.push([u, p = []]), p.indexOf(y) == -1 && p.push(y);
        });
      });
    });
    let a = e[n.join(",")] = new Cu(n.indexOf(r.length - 1) > -1);
    for (let s = 0; s < i.length; s++) {
      let u = i[s][1].sort(YT);
      a.next.push({ type: i[s][0], next: e[u.join(",")] || t(u) });
    }
    return a;
  }
}
function qZ(r, e) {
  for (let t = 0, n = [r]; t < n.length; t++) {
    let i = n[t], a = !i.validEnd, s = [];
    for (let u = 0; u < i.next.length; u++) {
      let { type: f, next: p } = i.next[u];
      s.push(f.name), a && !(f.isText || f.hasRequiredAttrs()) && (a = !1), n.indexOf(p) == -1 && n.push(p);
    }
    a && e.err("Only non-generatable nodes (" + s.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
  }
}
function ZT(r) {
  let e = /* @__PURE__ */ Object.create(null);
  for (let t in r) {
    let n = r[t];
    if (!n.hasDefault)
      return null;
    e[t] = n.default;
  }
  return e;
}
function eS(r, e) {
  let t = /* @__PURE__ */ Object.create(null);
  for (let n in r) {
    let i = e && e[n];
    if (i === void 0) {
      let a = r[n];
      if (a.hasDefault)
        i = a.default;
      else
        throw new RangeError("No value supplied for attribute " + n);
    }
    t[n] = i;
  }
  return t;
}
function tS(r, e, t, n) {
  for (let i in e)
    if (!(i in r))
      throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);
  for (let i in r) {
    let a = r[i];
    a.validate && a.validate(e[i]);
  }
}
function rS(r, e) {
  let t = /* @__PURE__ */ Object.create(null);
  if (e)
    for (let n in e)
      t[n] = new HZ(r, n, e[n]);
  return t;
}
let w1 = class nS {
  /**
  @internal
  */
  constructor(e, t, n) {
    this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = rS(e, n.attrs), this.defaultAttrs = ZT(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
  }
  /**
  True if this is an inline type.
  */
  get isInline() {
    return !this.isBlock;
  }
  /**
  True if this is a textblock type, a block that contains inline
  content.
  */
  get isTextblock() {
    return this.isBlock && this.inlineContent;
  }
  /**
  True for node types that allow no content.
  */
  get isLeaf() {
    return this.contentMatch == Cu.empty;
  }
  /**
  True when this node is an atom, i.e. when it does not have
  directly editable content.
  */
  get isAtom() {
    return this.isLeaf || !!this.spec.atom;
  }
  /**
  Return true when this node type is part of the given
  [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
  */
  isInGroup(e) {
    return this.groups.indexOf(e) > -1;
  }
  /**
  The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
  */
  get whitespace() {
    return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
  }
  /**
  Tells you whether this node type has any required attributes.
  */
  hasRequiredAttrs() {
    for (let e in this.attrs)
      if (this.attrs[e].isRequired)
        return !0;
    return !1;
  }
  /**
  Indicates whether this node allows some of the same content as
  the given node type.
  */
  compatibleContent(e) {
    return this == e || this.contentMatch.compatible(e.contentMatch);
  }
  /**
  @internal
  */
  computeAttrs(e) {
    return !e && this.defaultAttrs ? this.defaultAttrs : eS(this.attrs, e);
  }
  /**
  Create a `Node` of this type. The given attributes are
  checked and defaulted (you can pass `null` to use the type's
  defaults entirely, if no required attributes exist). `content`
  may be a `Fragment`, a node, an array of nodes, or
  `null`. Similarly `marks` may be `null` to default to the empty
  set of marks.
  */
  create(e = null, t, n) {
    if (this.isText)
      throw new Error("NodeType.create can't construct text nodes");
    return new hl(this, this.computeAttrs(e), Qe.from(t), Tr.setFrom(n));
  }
  /**
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
  against the node type's content restrictions, and throw an error
  if it doesn't match.
  */
  createChecked(e = null, t, n) {
    return t = Qe.from(t), this.checkContent(t), new hl(this, this.computeAttrs(e), t, Tr.setFrom(n));
  }
  /**
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
  necessary to add nodes to the start or end of the given fragment
  to make it fit the node. If no fitting wrapping can be found,
  return null. Note that, due to the fact that required nodes can
  always be created, this will always succeed if you pass null or
  `Fragment.empty` as content.
  */
  createAndFill(e = null, t, n) {
    if (e = this.computeAttrs(e), t = Qe.from(t), t.size) {
      let s = this.contentMatch.fillBefore(t);
      if (!s)
        return null;
      t = s.append(t);
    }
    let i = this.contentMatch.matchFragment(t), a = i && i.fillBefore(Qe.empty, !0);
    return a ? new hl(this, e, t.append(a), Tr.setFrom(n)) : null;
  }
  /**
  Returns true if the given fragment is valid content for this node
  type.
  */
  validContent(e) {
    let t = this.contentMatch.matchFragment(e);
    if (!t || !t.validEnd)
      return !1;
    for (let n = 0; n < e.childCount; n++)
      if (!this.allowsMarks(e.child(n).marks))
        return !1;
    return !0;
  }
  /**
  Throws a RangeError if the given fragment is not valid content for this
  node type.
  @internal
  */
  checkContent(e) {
    if (!this.validContent(e))
      throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0, 50)}`);
  }
  /**
  @internal
  */
  checkAttrs(e) {
    tS(this.attrs, e, "node", this.name);
  }
  /**
  Check whether the given mark type is allowed in this node.
  */
  allowsMarkType(e) {
    return this.markSet == null || this.markSet.indexOf(e) > -1;
  }
  /**
  Test whether the given set of marks are allowed in this node.
  */
  allowsMarks(e) {
    if (this.markSet == null)
      return !0;
    for (let t = 0; t < e.length; t++)
      if (!this.allowsMarkType(e[t].type))
        return !1;
    return !0;
  }
  /**
  Removes the marks that are not allowed in this node from the given set.
  */
  allowedMarks(e) {
    if (this.markSet == null)
      return e;
    let t;
    for (let n = 0; n < e.length; n++)
      this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t || (t = e.slice(0, n));
    return t ? t.length ? t : Tr.none : e;
  }
  /**
  @internal
  */
  static compile(e, t) {
    let n = /* @__PURE__ */ Object.create(null);
    e.forEach((a, s) => n[a] = new nS(a, t, s));
    let i = t.spec.topNode || "doc";
    if (!n[i])
      throw new RangeError("Schema is missing its top node type ('" + i + "')");
    if (!n.text)
      throw new RangeError("Every schema needs a 'text' type");
    for (let a in n.text.attrs)
      throw new RangeError("The text node type should not have attributes");
    return n;
  }
};
function zZ(r, e, t) {
  let n = t.split("|");
  return (i) => {
    let a = i === null ? "null" : typeof i;
    if (n.indexOf(a) < 0)
      throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${a}`);
  };
}
class HZ {
  constructor(e, t, n) {
    this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? zZ(e, t, n.validate) : n.validate;
  }
  get isRequired() {
    return !this.hasDefault;
  }
}
class Sm {
  /**
  @internal
  */
  constructor(e, t, n, i) {
    this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = rS(e, i.attrs), this.excluded = null;
    let a = ZT(this.attrs);
    this.instance = a ? new Tr(this, a) : null;
  }
  /**
  Create a mark of this type. `attrs` may be `null` or an object
  containing only some of the mark's attributes. The others, if
  they have defaults, will be added.
  */
  create(e = null) {
    return !e && this.instance ? this.instance : new Tr(this, eS(this.attrs, e));
  }
  /**
  @internal
  */
  static compile(e, t) {
    let n = /* @__PURE__ */ Object.create(null), i = 0;
    return e.forEach((a, s) => n[a] = new Sm(a, i++, t, s)), n;
  }
  /**
  When there is a mark of this type in the given set, a new set
  without it is returned. Otherwise, the input set is returned.
  */
  removeFromSet(e) {
    for (var t = 0; t < e.length; t++)
      e[t].type == this && (e = e.slice(0, t).concat(e.slice(t + 1)), t--);
    return e;
  }
  /**
  Tests whether there is a mark of this type in the given set.
  */
  isInSet(e) {
    for (let t = 0; t < e.length; t++)
      if (e[t].type == this)
        return e[t];
  }
  /**
  @internal
  */
  checkAttrs(e) {
    tS(this.attrs, e, "mark", this.name);
  }
  /**
  Queries whether a given mark type is
  [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
  */
  excludes(e) {
    return this.excluded.indexOf(e) > -1;
  }
}
class iS {
  /**
  Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
  */
  constructor(e) {
    this.linebreakReplacement = null, this.cached = /* @__PURE__ */ Object.create(null);
    let t = this.spec = {};
    for (let i in e)
      t[i] = e[i];
    t.nodes = Jn.from(e.nodes), t.marks = Jn.from(e.marks || {}), this.nodes = w1.compile(this.spec.nodes, this), this.marks = Sm.compile(this.spec.marks, this);
    let n = /* @__PURE__ */ Object.create(null);
    for (let i in this.nodes) {
      if (i in this.marks)
        throw new RangeError(i + " can not be both a node and a mark");
      let a = this.nodes[i], s = a.spec.content || "", u = a.spec.marks;
      if (a.contentMatch = n[s] || (n[s] = Cu.parse(s, this.nodes)), a.inlineContent = a.contentMatch.inlineContent, a.spec.linebreakReplacement) {
        if (this.linebreakReplacement)
          throw new RangeError("Multiple linebreak nodes defined");
        if (!a.isInline || !a.isLeaf)
          throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
        this.linebreakReplacement = a;
      }
      a.markSet = u == "_" ? null : u ? b1(this, u.split(" ")) : u == "" || !a.inlineContent ? [] : null;
    }
    for (let i in this.marks) {
      let a = this.marks[i], s = a.spec.excludes;
      a.excluded = s == null ? [a] : s == "" ? [] : b1(this, s.split(" "));
    }
    this.nodeFromJSON = (i) => hl.fromJSON(this, i), this.markFromJSON = (i) => Tr.fromJSON(this, i), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
  }
  /**
  Create a node in this schema. The `type` may be a string or a
  `NodeType` instance. Attributes will be extended with defaults,
  `content` may be a `Fragment`, `null`, a `Node`, or an array of
  nodes.
  */
  node(e, t = null, n, i) {
    if (typeof e == "string")
      e = this.nodeType(e);
    else if (e instanceof w1) {
      if (e.schema != this)
        throw new RangeError("Node type from different schema used (" + e.name + ")");
    } else throw new RangeError("Invalid node type: " + e);
    return e.createChecked(t, n, i);
  }
  /**
  Create a text node in the schema. Empty text nodes are not
  allowed.
  */
  text(e, t) {
    let n = this.nodes.text;
    return new Yv(n, n.defaultAttrs, e, Tr.setFrom(t));
  }
  /**
  Create a mark with the given type and attributes.
  */
  mark(e, t) {
    return typeof e == "string" && (e = this.marks[e]), e.create(t);
  }
  /**
  @internal
  */
  nodeType(e) {
    let t = this.nodes[e];
    if (!t)
      throw new RangeError("Unknown node type: " + e);
    return t;
  }
}
function b1(r, e) {
  let t = [];
  for (let n = 0; n < e.length; n++) {
    let i = e[n], a = r.marks[i], s = a;
    if (a)
      t.push(a);
    else
      for (let u in r.marks) {
        let f = r.marks[u];
        (i == "_" || f.spec.group && f.spec.group.split(" ").indexOf(i) > -1) && t.push(s = f);
      }
    if (!s)
      throw new SyntaxError("Unknown mark type: '" + e[n] + "'");
  }
  return t;
}
function VZ(r) {
  return r.tag != null;
}
function UZ(r) {
  return r.style != null;
}
class Tu {
  /**
  Create a parser that targets the given schema, using the given
  parsing rules.
  */
  constructor(e, t) {
    this.schema = e, this.rules = t, this.tags = [], this.styles = [];
    let n = this.matchedStyles = [];
    t.forEach((i) => {
      if (VZ(i))
        this.tags.push(i);
      else if (UZ(i)) {
        let a = /[^=]*/.exec(i.style)[0];
        n.indexOf(a) < 0 && n.push(a), this.styles.push(i);
      }
    }), this.normalizeLists = !this.tags.some((i) => {
      if (!/^(ul|ol)\b/.test(i.tag) || !i.node)
        return !1;
      let a = e.nodes[i.node];
      return a.contentMatch.matchType(a);
    });
  }
  /**
  Parse a document from the content of a DOM node.
  */
  parse(e, t = {}) {
    let n = new T1(this, t, !1);
    return n.addAll(e, Tr.none, t.from, t.to), n.finish();
  }
  /**
  Parses the content of the given DOM node, like
  [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
  options. But unlike that method, which produces a whole node,
  this one returns a slice that is open at the sides, meaning that
  the schema constraints aren't applied to the start of nodes to
  the left of the input and the end of nodes at the end.
  */
  parseSlice(e, t = {}) {
    let n = new T1(this, t, !0);
    return n.addAll(e, Tr.none, t.from, t.to), ht.maxOpen(n.finish());
  }
  /**
  @internal
  */
  matchTag(e, t, n) {
    for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
      let a = this.tags[i];
      if (jZ(e, a.tag) && (a.namespace === void 0 || e.namespaceURI == a.namespace) && (!a.context || t.matchesContext(a.context))) {
        if (a.getAttrs) {
          let s = a.getAttrs(e);
          if (s === !1)
            continue;
          a.attrs = s || void 0;
        }
        return a;
      }
    }
  }
  /**
  @internal
  */
  matchStyle(e, t, n, i) {
    for (let a = i ? this.styles.indexOf(i) + 1 : 0; a < this.styles.length; a++) {
      let s = this.styles[a], u = s.style;
      if (!(u.indexOf(e) != 0 || s.context && !n.matchesContext(s.context) || // Test that the style string either precisely matches the prop,
      // or has an '=' sign after the prop, followed by the given
      // value.
      u.length > e.length && (u.charCodeAt(e.length) != 61 || u.slice(e.length + 1) != t))) {
        if (s.getAttrs) {
          let f = s.getAttrs(t);
          if (f === !1)
            continue;
          s.attrs = f || void 0;
        }
        return s;
      }
    }
  }
  /**
  @internal
  */
  static schemaRules(e) {
    let t = [];
    function n(i) {
      let a = i.priority == null ? 50 : i.priority, s = 0;
      for (; s < t.length; s++) {
        let u = t[s];
        if ((u.priority == null ? 50 : u.priority) < a)
          break;
      }
      t.splice(s, 0, i);
    }
    for (let i in e.marks) {
      let a = e.marks[i].spec.parseDOM;
      a && a.forEach((s) => {
        n(s = S1(s)), s.mark || s.ignore || s.clearMark || (s.mark = i);
      });
    }
    for (let i in e.nodes) {
      let a = e.nodes[i].spec.parseDOM;
      a && a.forEach((s) => {
        n(s = S1(s)), s.node || s.ignore || s.mark || (s.node = i);
      });
    }
    return t;
  }
  /**
  Construct a DOM parser using the parsing rules listed in a
  schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
  [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
  */
  static fromSchema(e) {
    return e.cached.domParser || (e.cached.domParser = new Tu(e, Tu.schemaRules(e)));
  }
}
const aS = {
  address: !0,
  article: !0,
  aside: !0,
  blockquote: !0,
  canvas: !0,
  dd: !0,
  div: !0,
  dl: !0,
  fieldset: !0,
  figcaption: !0,
  figure: !0,
  footer: !0,
  form: !0,
  h1: !0,
  h2: !0,
  h3: !0,
  h4: !0,
  h5: !0,
  h6: !0,
  header: !0,
  hgroup: !0,
  hr: !0,
  li: !0,
  noscript: !0,
  ol: !0,
  output: !0,
  p: !0,
  pre: !0,
  section: !0,
  table: !0,
  tfoot: !0,
  ul: !0
}, $Z = {
  head: !0,
  noscript: !0,
  object: !0,
  script: !0,
  style: !0,
  title: !0
}, oS = { ol: !0, ul: !0 }, hh = 1, n0 = 2, sh = 4;
function C1(r, e, t) {
  return e != null ? (e ? hh : 0) | (e === "full" ? n0 : 0) : r && r.whitespace == "pre" ? hh | n0 : t & ~sh;
}
class Cv {
  constructor(e, t, n, i, a, s) {
    this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = s, this.content = [], this.activeMarks = Tr.none, this.match = a || (s & sh ? null : e.contentMatch);
  }
  findWrapping(e) {
    if (!this.match) {
      if (!this.type)
        return [];
      let t = this.type.contentMatch.fillBefore(Qe.from(e));
      if (t)
        this.match = this.type.contentMatch.matchFragment(t);
      else {
        let n = this.type.contentMatch, i;
        return (i = n.findWrapping(e.type)) ? (this.match = n, i) : null;
      }
    }
    return this.match.findWrapping(e.type);
  }
  finish(e) {
    if (!(this.options & hh)) {
      let n = this.content[this.content.length - 1], i;
      if (n && n.isText && (i = /[ \t\r\n\u000c]+$/.exec(n.text))) {
        let a = n;
        n.text.length == i[0].length ? this.content.pop() : this.content[this.content.length - 1] = a.withText(a.text.slice(0, a.text.length - i[0].length));
      }
    }
    let t = Qe.from(this.content);
    return !e && this.match && (t = t.append(this.match.fillBefore(Qe.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
  }
  inlineContext(e) {
    return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !aS.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
  }
}
class T1 {
  constructor(e, t, n) {
    this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
    let i = t.topNode, a, s = C1(null, t.preserveWhitespace, 0) | (n ? sh : 0);
    i ? a = new Cv(i.type, i.attrs, Tr.none, !0, t.topMatch || i.type.contentMatch, s) : n ? a = new Cv(null, null, Tr.none, !0, null, s) : a = new Cv(e.schema.topNodeType, null, Tr.none, !0, null, s), this.nodes = [a], this.find = t.findPositions, this.needsBlock = !1;
  }
  get top() {
    return this.nodes[this.open];
  }
  // Add a DOM node to the content. Text is inserted as text node,
  // otherwise, the node is passed to `addElement` or, if it has a
  // `style` attribute, `addElementWithStyles`.
  addDOM(e, t) {
    e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
  }
  addTextNode(e, t) {
    let n = e.nodeValue, i = this.top, a = i.options & n0 ? "full" : this.localPreserveWS || (i.options & hh) > 0, { schema: s } = this.parser;
    if (a === "full" || i.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
      if (a)
        if (a === "full")
          n = n.replace(/\r\n?/g, `
`);
        else if (s.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(s.linebreakReplacement.create())) {
          let u = n.split(/\r?\n|\r/);
          for (let f = 0; f < u.length; f++)
            f && this.insertNode(s.linebreakReplacement.create(), t, !0), u[f] && this.insertNode(s.text(u[f]), t, !/\S/.test(u[f]));
          n = "";
        } else
          n = n.replace(/\r?\n|\r/g, " ");
      else if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
        let u = i.content[i.content.length - 1], f = e.previousSibling;
        (!u || f && f.nodeName == "BR" || u.isText && /[ \t\r\n\u000c]$/.test(u.text)) && (n = n.slice(1));
      }
      n && this.insertNode(s.text(n), t, !/\S/.test(n)), this.findInText(e);
    } else
      this.findInside(e);
  }
  // Try to find a handler for the given tag and use that to parse. If
  // none is found, the element's content nodes are added directly.
  addElement(e, t, n) {
    let i = this.localPreserveWS, a = this.top;
    (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
    let s = e.nodeName.toLowerCase(), u;
    oS.hasOwnProperty(s) && this.parser.normalizeLists && WZ(e);
    let f = this.options.ruleFromNode && this.options.ruleFromNode(e) || (u = this.parser.matchTag(e, this, n));
    e: if (f ? f.ignore : $Z.hasOwnProperty(s))
      this.findInside(e), this.ignoreFallback(e, t);
    else if (!f || f.skip || f.closeParent) {
      f && f.closeParent ? this.open = Math.max(0, this.open - 1) : f && f.skip.nodeType && (e = f.skip);
      let p, y = this.needsBlock;
      if (aS.hasOwnProperty(s))
        a.content.length && a.content[0].isInline && this.open && (this.open--, a = this.top), p = !0, a.type || (this.needsBlock = !0);
      else if (!e.firstChild) {
        this.leafFallback(e, t);
        break e;
      }
      let T = f && f.skip ? t : this.readStyles(e, t);
      T && this.addAll(e, T), p && this.sync(a), this.needsBlock = y;
    } else {
      let p = this.readStyles(e, t);
      p && this.addElementByRule(e, f, p, f.consuming === !1 ? u : void 0);
    }
    this.localPreserveWS = i;
  }
  // Called for leaf DOM nodes that would otherwise be ignored
  leafFallback(e, t) {
    e.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(e.ownerDocument.createTextNode(`
`), t);
  }
  // Called for ignored nodes
  ignoreFallback(e, t) {
    e.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), t, !0);
  }
  // Run any style parser associated with the node's styles. Either
  // return an updated array of marks, or null to indicate some of the
  // styles had a rule with `ignore` set.
  readStyles(e, t) {
    let n = e.style;
    if (n && n.length)
      for (let i = 0; i < this.parser.matchedStyles.length; i++) {
        let a = this.parser.matchedStyles[i], s = n.getPropertyValue(a);
        if (s)
          for (let u = void 0; ; ) {
            let f = this.parser.matchStyle(a, s, this, u);
            if (!f)
              break;
            if (f.ignore)
              return null;
            if (f.clearMark ? t = t.filter((p) => !f.clearMark(p)) : t = t.concat(this.parser.schema.marks[f.mark].create(f.attrs)), f.consuming === !1)
              u = f;
            else
              break;
          }
      }
    return t;
  }
  // Look up a handler for the given node. If none are found, return
  // false. Otherwise, apply it, use its return value to drive the way
  // the node's content is wrapped, and return true.
  addElementByRule(e, t, n, i) {
    let a, s;
    if (t.node)
      if (s = this.parser.schema.nodes[t.node], s.isLeaf)
        this.insertNode(s.create(t.attrs), n, e.nodeName == "BR") || this.leafFallback(e, n);
      else {
        let f = this.enter(s, t.attrs || null, n, t.preserveWhitespace);
        f && (a = !0, n = f);
      }
    else {
      let f = this.parser.schema.marks[t.mark];
      n = n.concat(f.create(t.attrs));
    }
    let u = this.top;
    if (s && s.isLeaf)
      this.findInside(e);
    else if (i)
      this.addElement(e, n, i);
    else if (t.getContent)
      this.findInside(e), t.getContent(e, this.parser.schema).forEach((f) => this.insertNode(f, n, !1));
    else {
      let f = e;
      typeof t.contentElement == "string" ? f = e.querySelector(t.contentElement) : typeof t.contentElement == "function" ? f = t.contentElement(e) : t.contentElement && (f = t.contentElement), this.findAround(e, f, !0), this.addAll(f, n), this.findAround(e, f, !1);
    }
    a && this.sync(u) && this.open--;
  }
  // Add all child nodes between `startIndex` and `endIndex` (or the
  // whole node, if not given). If `sync` is passed, use it to
  // synchronize after every block element.
  addAll(e, t, n, i) {
    let a = n || 0;
    for (let s = n ? e.childNodes[n] : e.firstChild, u = i == null ? null : e.childNodes[i]; s != u; s = s.nextSibling, ++a)
      this.findAtPoint(e, a), this.addDOM(s, t);
    this.findAtPoint(e, a);
  }
  // Try to find a way to fit the given node type into the current
  // context. May add intermediate wrappers and/or leave non-solid
  // nodes that we're in.
  findPlace(e, t, n) {
    let i, a;
    for (let s = this.open, u = 0; s >= 0; s--) {
      let f = this.nodes[s], p = f.findWrapping(e);
      if (p && (!i || i.length > p.length + u) && (i = p, a = f, !p.length))
        break;
      if (f.solid) {
        if (n)
          break;
        u += 2;
      }
    }
    if (!i)
      return null;
    this.sync(a);
    for (let s = 0; s < i.length; s++)
      t = this.enterInner(i[s], null, t, !1);
    return t;
  }
  // Try to insert the given node, adjusting the context when needed.
  insertNode(e, t, n) {
    if (e.isInline && this.needsBlock && !this.top.type) {
      let a = this.textblockFromContext();
      a && (t = this.enterInner(a, null, t));
    }
    let i = this.findPlace(e, t, n);
    if (i) {
      this.closeExtra();
      let a = this.top;
      a.match && (a.match = a.match.matchType(e.type));
      let s = Tr.none;
      for (let u of i.concat(e.marks))
        (a.type ? a.type.allowsMarkType(u.type) : x1(u.type, e.type)) && (s = u.addToSet(s));
      return a.content.push(e.mark(s)), !0;
    }
    return !1;
  }
  // Try to start a node of the given type, adjusting the context when
  // necessary.
  enter(e, t, n, i) {
    let a = this.findPlace(e.create(t), n, !1);
    return a && (a = this.enterInner(e, t, n, !0, i)), a;
  }
  // Open a node of the given type
  enterInner(e, t, n, i = !1, a) {
    this.closeExtra();
    let s = this.top;
    s.match = s.match && s.match.matchType(e);
    let u = C1(e, a, s.options);
    s.options & sh && s.content.length == 0 && (u |= sh);
    let f = Tr.none;
    return n = n.filter((p) => (s.type ? s.type.allowsMarkType(p.type) : x1(p.type, e)) ? (f = p.addToSet(f), !1) : !0), this.nodes.push(new Cv(e, t, f, i, null, u)), this.open++, n;
  }
  // Make sure all nodes above this.open are finished and added to
  // their parents
  closeExtra(e = !1) {
    let t = this.nodes.length - 1;
    if (t > this.open) {
      for (; t > this.open; t--)
        this.nodes[t - 1].content.push(this.nodes[t].finish(e));
      this.nodes.length = this.open + 1;
    }
  }
  finish() {
    return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
  }
  sync(e) {
    for (let t = this.open; t >= 0; t--) {
      if (this.nodes[t] == e)
        return this.open = t, !0;
      this.localPreserveWS && (this.nodes[t].options |= hh);
    }
    return !1;
  }
  get currentPos() {
    this.closeExtra();
    let e = 0;
    for (let t = this.open; t >= 0; t--) {
      let n = this.nodes[t].content;
      for (let i = n.length - 1; i >= 0; i--)
        e += n[i].nodeSize;
      t && e++;
    }
    return e;
  }
  findAtPoint(e, t) {
    if (this.find)
      for (let n = 0; n < this.find.length; n++)
        this.find[n].node == e && this.find[n].offset == t && (this.find[n].pos = this.currentPos);
  }
  findInside(e) {
    if (this.find)
      for (let t = 0; t < this.find.length; t++)
        this.find[t].pos == null && e.nodeType == 1 && e.contains(this.find[t].node) && (this.find[t].pos = this.currentPos);
  }
  findAround(e, t, n) {
    if (e != t && this.find)
      for (let i = 0; i < this.find.length; i++)
        this.find[i].pos == null && e.nodeType == 1 && e.contains(this.find[i].node) && t.compareDocumentPosition(this.find[i].node) & (n ? 2 : 4) && (this.find[i].pos = this.currentPos);
  }
  findInText(e) {
    if (this.find)
      for (let t = 0; t < this.find.length; t++)
        this.find[t].node == e && (this.find[t].pos = this.currentPos - (e.nodeValue.length - this.find[t].offset));
  }
  // Determines whether the given context string matches this context.
  matchesContext(e) {
    if (e.indexOf("|") > -1)
      return e.split(/\s*\|\s*/).some(this.matchesContext, this);
    let t = e.split("/"), n = this.options.context, i = !this.isOpen && (!n || n.parent.type == this.nodes[0].type), a = -(n ? n.depth + 1 : 0) + (i ? 0 : 1), s = (u, f) => {
      for (; u >= 0; u--) {
        let p = t[u];
        if (p == "") {
          if (u == t.length - 1 || u == 0)
            continue;
          for (; f >= a; f--)
            if (s(u - 1, f))
              return !0;
          return !1;
        } else {
          let y = f > 0 || f == 0 && i ? this.nodes[f].type : n && f >= a ? n.node(f - a).type : null;
          if (!y || y.name != p && !y.isInGroup(p))
            return !1;
          f--;
        }
      }
      return !0;
    };
    return s(t.length - 1, this.open);
  }
  textblockFromContext() {
    let e = this.options.context;
    if (e)
      for (let t = e.depth; t >= 0; t--) {
        let n = e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;
        if (n && n.isTextblock && n.defaultAttrs)
          return n;
      }
    for (let t in this.parser.schema.nodes) {
      let n = this.parser.schema.nodes[t];
      if (n.isTextblock && n.defaultAttrs)
        return n;
    }
  }
}
function WZ(r) {
  for (let e = r.firstChild, t = null; e; e = e.nextSibling) {
    let n = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
    n && oS.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
  }
}
function jZ(r, e) {
  return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, e);
}
function S1(r) {
  let e = {};
  for (let t in r)
    e[t] = r[t];
  return e;
}
function x1(r, e) {
  let t = e.schema.nodes;
  for (let n in t) {
    let i = t[n];
    if (!i.allowsMarkType(r))
      continue;
    let a = [], s = (u) => {
      a.push(u);
      for (let f = 0; f < u.edgeCount; f++) {
        let { type: p, next: y } = u.edge(f);
        if (p == e || a.indexOf(y) < 0 && s(y))
          return !0;
      }
    };
    if (s(i.contentMatch))
      return !0;
  }
}
class kf {
  /**
  Create a serializer. `nodes` should map node names to functions
  that take a node and return a description of the corresponding
  DOM. `marks` does the same for mark names, but also gets an
  argument that tells it whether the mark's content is block or
  inline content (for typical use, it'll always be inline). A mark
  serializer may be `null` to indicate that marks of that type
  should not be serialized.
  */
  constructor(e, t) {
    this.nodes = e, this.marks = t;
  }
  /**
  Serialize the content of this fragment to a DOM fragment. When
  not in the browser, the `document` option, containing a DOM
  document, should be passed so that the serializer can create
  nodes.
  */
  serializeFragment(e, t = {}, n) {
    n || (n = dy(t).createDocumentFragment());
    let i = n, a = [];
    return e.forEach((s) => {
      if (a.length || s.marks.length) {
        let u = 0, f = 0;
        for (; u < a.length && f < s.marks.length; ) {
          let p = s.marks[f];
          if (!this.marks[p.type.name]) {
            f++;
            continue;
          }
          if (!p.eq(a[u][0]) || p.type.spec.spanning === !1)
            break;
          u++, f++;
        }
        for (; u < a.length; )
          i = a.pop()[1];
        for (; f < s.marks.length; ) {
          let p = s.marks[f++], y = this.serializeMark(p, s.isInline, t);
          y && (a.push([p, i]), i.appendChild(y.dom), i = y.contentDOM || y.dom);
        }
      }
      i.appendChild(this.serializeNodeInner(s, t));
    }), n;
  }
  /**
  @internal
  */
  serializeNodeInner(e, t) {
    let { dom: n, contentDOM: i } = Fv(dy(t), this.nodes[e.type.name](e), null, e.attrs);
    if (i) {
      if (e.isLeaf)
        throw new RangeError("Content hole not allowed in a leaf node spec");
      this.serializeFragment(e.content, t, i);
    }
    return n;
  }
  /**
  Serialize this node to a DOM node. This can be useful when you
  need to serialize a part of a document, as opposed to the whole
  document. To serialize a whole document, use
  [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
  its [content](https://prosemirror.net/docs/ref/#model.Node.content).
  */
  serializeNode(e, t = {}) {
    let n = this.serializeNodeInner(e, t);
    for (let i = e.marks.length - 1; i >= 0; i--) {
      let a = this.serializeMark(e.marks[i], e.isInline, t);
      a && ((a.contentDOM || a.dom).appendChild(n), n = a.dom);
    }
    return n;
  }
  /**
  @internal
  */
  serializeMark(e, t, n = {}) {
    let i = this.marks[e.type.name];
    return i && Fv(dy(n), i(e, t), null, e.attrs);
  }
  static renderSpec(e, t, n = null, i) {
    return Fv(e, t, n, i);
  }
  /**
  Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
  properties in a schema's node and mark specs.
  */
  static fromSchema(e) {
    return e.cached.domSerializer || (e.cached.domSerializer = new kf(this.nodesFromSchema(e), this.marksFromSchema(e)));
  }
  /**
  Gather the serializers in a schema's node specs into an object.
  This can be useful as a base to build a custom serializer from.
  */
  static nodesFromSchema(e) {
    let t = E1(e.nodes);
    return t.text || (t.text = (n) => n.text), t;
  }
  /**
  Gather the serializers in a schema's mark specs into an object.
  */
  static marksFromSchema(e) {
    return E1(e.marks);
  }
}
function E1(r) {
  let e = {};
  for (let t in r) {
    let n = r[t].spec.toDOM;
    n && (e[t] = n);
  }
  return e;
}
function dy(r) {
  return r.document || window.document;
}
const M1 = /* @__PURE__ */ new WeakMap();
function GZ(r) {
  let e = M1.get(r);
  return e === void 0 && M1.set(r, e = KZ(r)), e;
}
function KZ(r) {
  let e = null;
  function t(n) {
    if (n && typeof n == "object")
      if (Array.isArray(n))
        if (typeof n[0] == "string")
          e || (e = []), e.push(n);
        else
          for (let i = 0; i < n.length; i++)
            t(n[i]);
      else
        for (let i in n)
          t(n[i]);
  }
  return t(r), e;
}
function Fv(r, e, t, n) {
  if (typeof e == "string")
    return { dom: r.createTextNode(e) };
  if (e.nodeType != null)
    return { dom: e };
  if (e.dom && e.dom.nodeType != null)
    return e;
  let i = e[0], a;
  if (typeof i != "string")
    throw new RangeError("Invalid array passed to renderSpec");
  if (n && (a = GZ(n)) && a.indexOf(e) > -1)
    throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
  let s = i.indexOf(" ");
  s > 0 && (t = i.slice(0, s), i = i.slice(s + 1));
  let u, f = t ? r.createElementNS(t, i) : r.createElement(i), p = e[1], y = 1;
  if (p && typeof p == "object" && p.nodeType == null && !Array.isArray(p)) {
    y = 2;
    for (let T in p)
      if (p[T] != null) {
        let N = T.indexOf(" ");
        N > 0 ? f.setAttributeNS(T.slice(0, N), T.slice(N + 1), p[T]) : T == "style" && f.style ? f.style.cssText = p[T] : f.setAttribute(T, p[T]);
      }
  }
  for (let T = y; T < e.length; T++) {
    let N = e[T];
    if (N === 0) {
      if (T < e.length - 1 || T > y)
        throw new RangeError("Content hole must be the only child of its parent node");
      return { dom: f, contentDOM: f };
    } else {
      let { dom: O, contentDOM: A } = Fv(r, N, t, n);
      if (f.appendChild(O), A) {
        if (u)
          throw new RangeError("Multiple content holes");
        u = A;
      }
    }
  }
  return { dom: f, contentDOM: u };
}
const sS = 65535, lS = Math.pow(2, 16);
function JZ(r, e) {
  return r + e * lS;
}
function N1(r) {
  return r & sS;
}
function QZ(r) {
  return (r - (r & sS)) / lS;
}
const uS = 1, cS = 2, _v = 4, fS = 8;
class i0 {
  /**
  @internal
  */
  constructor(e, t, n) {
    this.pos = e, this.delInfo = t, this.recover = n;
  }
  /**
  Tells you whether the position was deleted, that is, whether the
  step removed the token on the side queried (via the `assoc`)
  argument from the document.
  */
  get deleted() {
    return (this.delInfo & fS) > 0;
  }
  /**
  Tells you whether the token before the mapped position was deleted.
  */
  get deletedBefore() {
    return (this.delInfo & (uS | _v)) > 0;
  }
  /**
  True when the token after the mapped position was deleted.
  */
  get deletedAfter() {
    return (this.delInfo & (cS | _v)) > 0;
  }
  /**
  Tells whether any of the steps mapped through deletes across the
  position (including both the token before and after the
  position).
  */
  get deletedAcross() {
    return (this.delInfo & _v) > 0;
  }
}
class Wi {
  /**
  Create a position map. The modifications to the document are
  represented as an array of numbers, in which each group of three
  represents a modified chunk as `[start, oldSize, newSize]`.
  */
  constructor(e, t = !1) {
    if (this.ranges = e, this.inverted = t, !e.length && Wi.empty)
      return Wi.empty;
  }
  /**
  @internal
  */
  recover(e) {
    let t = 0, n = N1(e);
    if (!this.inverted)
      for (let i = 0; i < n; i++)
        t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
    return this.ranges[n * 3] + t + QZ(e);
  }
  mapResult(e, t = 1) {
    return this._map(e, t, !1);
  }
  map(e, t = 1) {
    return this._map(e, t, !0);
  }
  /**
  @internal
  */
  _map(e, t, n) {
    let i = 0, a = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
    for (let u = 0; u < this.ranges.length; u += 3) {
      let f = this.ranges[u] - (this.inverted ? i : 0);
      if (f > e)
        break;
      let p = this.ranges[u + a], y = this.ranges[u + s], T = f + p;
      if (e <= T) {
        let N = p ? e == f ? -1 : e == T ? 1 : t : t, O = f + i + (N < 0 ? 0 : y);
        if (n)
          return O;
        let A = e == (t < 0 ? f : T) ? null : JZ(u / 3, e - f), q = e == f ? cS : e == T ? uS : _v;
        return (t < 0 ? e != f : e != T) && (q |= fS), new i0(O, q, A);
      }
      i += y - p;
    }
    return n ? e + i : new i0(e + i, 0, null);
  }
  /**
  @internal
  */
  touches(e, t) {
    let n = 0, i = N1(t), a = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
    for (let u = 0; u < this.ranges.length; u += 3) {
      let f = this.ranges[u] - (this.inverted ? n : 0);
      if (f > e)
        break;
      let p = this.ranges[u + a], y = f + p;
      if (e <= y && u == i * 3)
        return !0;
      n += this.ranges[u + s] - p;
    }
    return !1;
  }
  /**
  Calls the given function on each of the changed ranges included in
  this map.
  */
  forEach(e) {
    let t = this.inverted ? 2 : 1, n = this.inverted ? 1 : 2;
    for (let i = 0, a = 0; i < this.ranges.length; i += 3) {
      let s = this.ranges[i], u = s - (this.inverted ? a : 0), f = s + (this.inverted ? 0 : a), p = this.ranges[i + t], y = this.ranges[i + n];
      e(u, u + p, f, f + y), a += y - p;
    }
  }
  /**
  Create an inverted version of this map. The result can be used to
  map positions in the post-step document to the pre-step document.
  */
  invert() {
    return new Wi(this.ranges, !this.inverted);
  }
  /**
  @internal
  */
  toString() {
    return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
  }
  /**
  Create a map that moves all positions by offset `n` (which may be
  negative). This can be useful when applying steps meant for a
  sub-document to a larger document, or vice-versa.
  */
  static offset(e) {
    return e == 0 ? Wi.empty : new Wi(e < 0 ? [0, -e, 0] : [0, 0, e]);
  }
}
Wi.empty = new Wi([]);
class ph {
  /**
  Create a new mapping with the given position maps.
  */
  constructor(e, t, n = 0, i = e ? e.length : 0) {
    this.mirror = t, this.from = n, this.to = i, this._maps = e || [], this.ownData = !(e || t);
  }
  /**
  The step maps in this mapping.
  */
  get maps() {
    return this._maps;
  }
  /**
  Create a mapping that maps only through a part of this one.
  */
  slice(e = 0, t = this.maps.length) {
    return new ph(this._maps, this.mirror, e, t);
  }
  /**
  Add a step map to the end of this mapping. If `mirrors` is
  given, it should be the index of the step map that is the mirror
  image of this one.
  */
  appendMap(e, t) {
    this.ownData || (this._maps = this._maps.slice(), this.mirror = this.mirror && this.mirror.slice(), this.ownData = !0), this.to = this._maps.push(e), t != null && this.setMirror(this._maps.length - 1, t);
  }
  /**
  Add all the step maps in a given mapping to this one (preserving
  mirroring information).
  */
  appendMapping(e) {
    for (let t = 0, n = this._maps.length; t < e._maps.length; t++) {
      let i = e.getMirror(t);
      this.appendMap(e._maps[t], i != null && i < t ? n + i : void 0);
    }
  }
  /**
  Finds the offset of the step map that mirrors the map at the
  given offset, in this mapping (as per the second argument to
  `appendMap`).
  */
  getMirror(e) {
    if (this.mirror) {
      for (let t = 0; t < this.mirror.length; t++)
        if (this.mirror[t] == e)
          return this.mirror[t + (t % 2 ? -1 : 1)];
    }
  }
  /**
  @internal
  */
  setMirror(e, t) {
    this.mirror || (this.mirror = []), this.mirror.push(e, t);
  }
  /**
  Append the inverse of the given mapping to this one.
  */
  appendMappingInverted(e) {
    for (let t = e.maps.length - 1, n = this._maps.length + e._maps.length; t >= 0; t--) {
      let i = e.getMirror(t);
      this.appendMap(e._maps[t].invert(), i != null && i > t ? n - i - 1 : void 0);
    }
  }
  /**
  Create an inverted version of this mapping.
  */
  invert() {
    let e = new ph();
    return e.appendMappingInverted(this), e;
  }
  /**
  Map a position through this mapping.
  */
  map(e, t = 1) {
    if (this.mirror)
      return this._map(e, t, !0);
    for (let n = this.from; n < this.to; n++)
      e = this._maps[n].map(e, t);
    return e;
  }
  /**
  Map a position through this mapping, returning a mapping
  result.
  */
  mapResult(e, t = 1) {
    return this._map(e, t, !1);
  }
  /**
  @internal
  */
  _map(e, t, n) {
    let i = 0;
    for (let a = this.from; a < this.to; a++) {
      let s = this._maps[a], u = s.mapResult(e, t);
      if (u.recover != null) {
        let f = this.getMirror(a);
        if (f != null && f > a && f < this.to) {
          a = f, e = this._maps[f].recover(u.recover);
          continue;
        }
      }
      i |= u.delInfo, e = u.pos;
    }
    return n ? e : new i0(e, i, null);
  }
}
const hy = /* @__PURE__ */ Object.create(null);
class gi {
  /**
  Get the step map that represents the changes made by this step,
  and which can be used to transform between positions in the old
  and the new document.
  */
  getMap() {
    return Wi.empty;
  }
  /**
  Try to merge this step with another one, to be applied directly
  after it. Returns the merged step when possible, null if the
  steps can't be merged.
  */
  merge(e) {
    return null;
  }
  /**
  Deserialize a step from its JSON representation. Will call
  through to the step class' own implementation of this method.
  */
  static fromJSON(e, t) {
    if (!t || !t.stepType)
      throw new RangeError("Invalid input for Step.fromJSON");
    let n = hy[t.stepType];
    if (!n)
      throw new RangeError(`No step type ${t.stepType} defined`);
    return n.fromJSON(e, t);
  }
  /**
  To be able to serialize steps to JSON, each step needs a string
  ID to attach to its JSON representation. Use this method to
  register an ID for your step classes. Try to pick something
  that's unlikely to clash with steps from other modules.
  */
  static jsonID(e, t) {
    if (e in hy)
      throw new RangeError("Duplicate use of step JSON ID " + e);
    return hy[e] = t, t.prototype.jsonID = e, t;
  }
}
class vn {
  /**
  @internal
  */
  constructor(e, t) {
    this.doc = e, this.failed = t;
  }
  /**
  Create a successful step result.
  */
  static ok(e) {
    return new vn(e, null);
  }
  /**
  Create a failed step result.
  */
  static fail(e) {
    return new vn(null, e);
  }
  /**
  Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
  arguments. Create a successful result if it succeeds, and a
  failed one if it throws a `ReplaceError`.
  */
  static fromReplace(e, t, n, i) {
    try {
      return vn.ok(e.replace(t, n, i));
    } catch (a) {
      if (a instanceof Jv)
        return vn.fail(a.message);
      throw a;
    }
  }
}
function $0(r, e, t) {
  let n = [];
  for (let i = 0; i < r.childCount; i++) {
    let a = r.child(i);
    a.content.size && (a = a.copy($0(a.content, e, a))), a.isInline && (a = e(a, t, i)), n.push(a);
  }
  return Qe.fromArray(n);
}
class cl extends gi {
  /**
  Create a mark step.
  */
  constructor(e, t, n) {
    super(), this.from = e, this.to = t, this.mark = n;
  }
  apply(e) {
    let t = e.slice(this.from, this.to), n = e.resolve(this.from), i = n.node(n.sharedDepth(this.to)), a = new ht($0(t.content, (s, u) => !s.isAtom || !u.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), i), t.openStart, t.openEnd);
    return vn.fromReplace(e, this.from, this.to, a);
  }
  invert() {
    return new Ro(this.from, this.to, this.mark);
  }
  map(e) {
    let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
    return t.deleted && n.deleted || t.pos >= n.pos ? null : new cl(t.pos, n.pos, this.mark);
  }
  merge(e) {
    return e instanceof cl && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new cl(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
  }
  toJSON() {
    return {
      stepType: "addMark",
      mark: this.mark.toJSON(),
      from: this.from,
      to: this.to
    };
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.from != "number" || typeof t.to != "number")
      throw new RangeError("Invalid input for AddMarkStep.fromJSON");
    return new cl(t.from, t.to, e.markFromJSON(t.mark));
  }
}
gi.jsonID("addMark", cl);
class Ro extends gi {
  /**
  Create a mark-removing step.
  */
  constructor(e, t, n) {
    super(), this.from = e, this.to = t, this.mark = n;
  }
  apply(e) {
    let t = e.slice(this.from, this.to), n = new ht($0(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
    return vn.fromReplace(e, this.from, this.to, n);
  }
  invert() {
    return new cl(this.from, this.to, this.mark);
  }
  map(e) {
    let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
    return t.deleted && n.deleted || t.pos >= n.pos ? null : new Ro(t.pos, n.pos, this.mark);
  }
  merge(e) {
    return e instanceof Ro && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new Ro(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
  }
  toJSON() {
    return {
      stepType: "removeMark",
      mark: this.mark.toJSON(),
      from: this.from,
      to: this.to
    };
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.from != "number" || typeof t.to != "number")
      throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
    return new Ro(t.from, t.to, e.markFromJSON(t.mark));
  }
}
gi.jsonID("removeMark", Ro);
class fl extends gi {
  /**
  Create a node mark step.
  */
  constructor(e, t) {
    super(), this.pos = e, this.mark = t;
  }
  apply(e) {
    let t = e.nodeAt(this.pos);
    if (!t)
      return vn.fail("No node at mark step's position");
    let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
    return vn.fromReplace(e, this.pos, this.pos + 1, new ht(Qe.from(n), 0, t.isLeaf ? 0 : 1));
  }
  invert(e) {
    let t = e.nodeAt(this.pos);
    if (t) {
      let n = this.mark.addToSet(t.marks);
      if (n.length == t.marks.length) {
        for (let i = 0; i < t.marks.length; i++)
          if (!t.marks[i].isInSet(n))
            return new fl(this.pos, t.marks[i]);
        return new fl(this.pos, this.mark);
      }
    }
    return new Su(this.pos, this.mark);
  }
  map(e) {
    let t = e.mapResult(this.pos, 1);
    return t.deletedAfter ? null : new fl(t.pos, this.mark);
  }
  toJSON() {
    return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.pos != "number")
      throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
    return new fl(t.pos, e.markFromJSON(t.mark));
  }
}
gi.jsonID("addNodeMark", fl);
class Su extends gi {
  /**
  Create a mark-removing step.
  */
  constructor(e, t) {
    super(), this.pos = e, this.mark = t;
  }
  apply(e) {
    let t = e.nodeAt(this.pos);
    if (!t)
      return vn.fail("No node at mark step's position");
    let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
    return vn.fromReplace(e, this.pos, this.pos + 1, new ht(Qe.from(n), 0, t.isLeaf ? 0 : 1));
  }
  invert(e) {
    let t = e.nodeAt(this.pos);
    return !t || !this.mark.isInSet(t.marks) ? this : new fl(this.pos, this.mark);
  }
  map(e) {
    let t = e.mapResult(this.pos, 1);
    return t.deletedAfter ? null : new Su(t.pos, this.mark);
  }
  toJSON() {
    return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.pos != "number")
      throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
    return new Su(t.pos, e.markFromJSON(t.mark));
  }
}
gi.jsonID("removeNodeMark", Su);
class pi extends gi {
  /**
  The given `slice` should fit the 'gap' between `from` and
  `to`—the depths must line up, and the surrounding nodes must be
  able to be joined with the open sides of the slice. When
  `structure` is true, the step will fail if the content between
  from and to is not just a sequence of closing and then opening
  tokens (this is to guard against rebased replace steps
  overwriting something they weren't supposed to).
  */
  constructor(e, t, n, i = !1) {
    super(), this.from = e, this.to = t, this.slice = n, this.structure = i;
  }
  apply(e) {
    return this.structure && a0(e, this.from, this.to) ? vn.fail("Structure replace would overwrite content") : vn.fromReplace(e, this.from, this.to, this.slice);
  }
  getMap() {
    return new Wi([this.from, this.to - this.from, this.slice.size]);
  }
  invert(e) {
    return new pi(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
  }
  map(e) {
    let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
    return t.deletedAcross && n.deletedAcross ? null : new pi(t.pos, Math.max(t.pos, n.pos), this.slice, this.structure);
  }
  merge(e) {
    if (!(e instanceof pi) || e.structure || this.structure)
      return null;
    if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
      let t = this.slice.size + e.slice.size == 0 ? ht.empty : new ht(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
      return new pi(this.from, this.to + (e.to - e.from), t, this.structure);
    } else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
      let t = this.slice.size + e.slice.size == 0 ? ht.empty : new ht(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
      return new pi(e.from, this.to, t, this.structure);
    } else
      return null;
  }
  toJSON() {
    let e = { stepType: "replace", from: this.from, to: this.to };
    return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.from != "number" || typeof t.to != "number")
      throw new RangeError("Invalid input for ReplaceStep.fromJSON");
    return new pi(t.from, t.to, ht.fromJSON(e, t.slice), !!t.structure);
  }
}
gi.jsonID("replace", pi);
class _n extends gi {
  /**
  Create a replace-around step with the given range and gap.
  `insert` should be the point in the slice into which the content
  of the gap should be moved. `structure` has the same meaning as
  it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
  */
  constructor(e, t, n, i, a, s, u = !1) {
    super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = i, this.slice = a, this.insert = s, this.structure = u;
  }
  apply(e) {
    if (this.structure && (a0(e, this.from, this.gapFrom) || a0(e, this.gapTo, this.to)))
      return vn.fail("Structure gap-replace would overwrite content");
    let t = e.slice(this.gapFrom, this.gapTo);
    if (t.openStart || t.openEnd)
      return vn.fail("Gap is not a flat range");
    let n = this.slice.insertAt(this.insert, t.content);
    return n ? vn.fromReplace(e, this.from, this.to, n) : vn.fail("Content does not fit in gap");
  }
  getMap() {
    return new Wi([
      this.from,
      this.gapFrom - this.from,
      this.insert,
      this.gapTo,
      this.to - this.gapTo,
      this.slice.size - this.insert
    ]);
  }
  invert(e) {
    let t = this.gapTo - this.gapFrom;
    return new _n(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
  }
  map(e) {
    let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1), i = this.from == this.gapFrom ? t.pos : e.map(this.gapFrom, -1), a = this.to == this.gapTo ? n.pos : e.map(this.gapTo, 1);
    return t.deletedAcross && n.deletedAcross || i < t.pos || a > n.pos ? null : new _n(t.pos, n.pos, i, a, this.slice, this.insert, this.structure);
  }
  toJSON() {
    let e = {
      stepType: "replaceAround",
      from: this.from,
      to: this.to,
      gapFrom: this.gapFrom,
      gapTo: this.gapTo,
      insert: this.insert
    };
    return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
      throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
    return new _n(t.from, t.to, t.gapFrom, t.gapTo, ht.fromJSON(e, t.slice), t.insert, !!t.structure);
  }
}
gi.jsonID("replaceAround", _n);
function a0(r, e, t) {
  let n = r.resolve(e), i = t - e, a = n.depth;
  for (; i > 0 && a > 0 && n.indexAfter(a) == n.node(a).childCount; )
    a--, i--;
  if (i > 0) {
    let s = n.node(a).maybeChild(n.indexAfter(a));
    for (; i > 0; ) {
      if (!s || s.isLeaf)
        return !0;
      s = s.firstChild, i--;
    }
  }
  return !1;
}
function XZ(r, e, t, n) {
  let i = [], a = [], s, u;
  r.doc.nodesBetween(e, t, (f, p, y) => {
    if (!f.isInline)
      return;
    let T = f.marks;
    if (!n.isInSet(T) && y.type.allowsMarkType(n.type)) {
      let N = Math.max(p, e), O = Math.min(p + f.nodeSize, t), A = n.addToSet(T);
      for (let q = 0; q < T.length; q++)
        T[q].isInSet(A) || (s && s.to == N && s.mark.eq(T[q]) ? s.to = O : i.push(s = new Ro(N, O, T[q])));
      u && u.to == N ? u.to = O : a.push(u = new cl(N, O, n));
    }
  }), i.forEach((f) => r.step(f)), a.forEach((f) => r.step(f));
}
function YZ(r, e, t, n) {
  let i = [], a = 0;
  r.doc.nodesBetween(e, t, (s, u) => {
    if (!s.isInline)
      return;
    a++;
    let f = null;
    if (n instanceof Sm) {
      let p = s.marks, y;
      for (; y = n.isInSet(p); )
        (f || (f = [])).push(y), p = y.removeFromSet(p);
    } else n ? n.isInSet(s.marks) && (f = [n]) : f = s.marks;
    if (f && f.length) {
      let p = Math.min(u + s.nodeSize, t);
      for (let y = 0; y < f.length; y++) {
        let T = f[y], N;
        for (let O = 0; O < i.length; O++) {
          let A = i[O];
          A.step == a - 1 && T.eq(i[O].style) && (N = A);
        }
        N ? (N.to = p, N.step = a) : i.push({ style: T, from: Math.max(u, e), to: p, step: a });
      }
    }
  }), i.forEach((s) => r.step(new Ro(s.from, s.to, s.style)));
}
function W0(r, e, t, n = t.contentMatch, i = !0) {
  let a = r.doc.nodeAt(e), s = [], u = e + 1;
  for (let f = 0; f < a.childCount; f++) {
    let p = a.child(f), y = u + p.nodeSize, T = n.matchType(p.type);
    if (!T)
      s.push(new pi(u, y, ht.empty));
    else {
      n = T;
      for (let N = 0; N < p.marks.length; N++)
        t.allowsMarkType(p.marks[N].type) || r.step(new Ro(u, y, p.marks[N]));
      if (i && p.isText && t.whitespace != "pre") {
        let N, O = /\r?\n|\r/g, A;
        for (; N = O.exec(p.text); )
          A || (A = new ht(Qe.from(t.schema.text(" ", t.allowedMarks(p.marks))), 0, 0)), s.push(new pi(u + N.index, u + N.index + N[0].length, A));
      }
    }
    u = y;
  }
  if (!n.validEnd) {
    let f = n.fillBefore(Qe.empty, !0);
    r.replace(u, u, new ht(f, 0, 0));
  }
  for (let f = s.length - 1; f >= 0; f--)
    r.step(s[f]);
}
function ZZ(r, e, t) {
  return (e == 0 || r.canReplace(e, r.childCount)) && (t == r.childCount || r.canReplace(0, t));
}
function xm(r) {
  let t = r.parent.content.cutByIndex(r.startIndex, r.endIndex);
  for (let n = r.depth, i = 0, a = 0; ; --n) {
    let s = r.$from.node(n), u = r.$from.index(n) + i, f = r.$to.indexAfter(n) - a;
    if (n < r.depth && s.canReplace(u, f, t))
      return n;
    if (n == 0 || s.type.spec.isolating || !ZZ(s, u, f))
      break;
    u && (i = 1), f < s.childCount && (a = 1);
  }
  return null;
}
function eee(r, e, t) {
  let { $from: n, $to: i, depth: a } = e, s = n.before(a + 1), u = i.after(a + 1), f = s, p = u, y = Qe.empty, T = 0;
  for (let A = a, q = !1; A > t; A--)
    q || n.index(A) > 0 ? (q = !0, y = Qe.from(n.node(A).copy(y)), T++) : f--;
  let N = Qe.empty, O = 0;
  for (let A = a, q = !1; A > t; A--)
    q || i.after(A + 1) < i.end(A) ? (q = !0, N = Qe.from(i.node(A).copy(N)), O++) : p++;
  r.step(new _n(f, p, s, u, new ht(y.append(N), T, O), y.size - T, !0));
}
function tee(r, e, t = null, n = r) {
  let i = ree(r, e), a = i && nee(n, e);
  return a ? i.map(O1).concat({ type: e, attrs: t }).concat(a.map(O1)) : null;
}
function O1(r) {
  return { type: r, attrs: null };
}
function ree(r, e) {
  let { parent: t, startIndex: n, endIndex: i } = r, a = t.contentMatchAt(n).findWrapping(e);
  if (!a)
    return null;
  let s = a.length ? a[0] : e;
  return t.canReplaceWith(n, i, s) ? a : null;
}
function nee(r, e) {
  let { parent: t, startIndex: n, endIndex: i } = r, a = t.child(n), s = e.contentMatch.findWrapping(a.type);
  if (!s)
    return null;
  let f = (s.length ? s[s.length - 1] : e).contentMatch;
  for (let p = n; f && p < i; p++)
    f = f.matchType(t.child(p).type);
  return !f || !f.validEnd ? null : s;
}
function iee(r, e, t) {
  let n = Qe.empty;
  for (let s = t.length - 1; s >= 0; s--) {
    if (n.size) {
      let u = t[s].type.contentMatch.matchFragment(n);
      if (!u || !u.validEnd)
        throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
    }
    n = Qe.from(t[s].type.create(t[s].attrs, n));
  }
  let i = e.start, a = e.end;
  r.step(new _n(i, a, i, a, new ht(n, 0, 0), t.length, !0));
}
function aee(r, e, t, n, i) {
  if (!n.isTextblock)
    throw new RangeError("Type given to setBlockType should be a textblock");
  let a = r.steps.length;
  r.doc.nodesBetween(e, t, (s, u) => {
    let f = typeof i == "function" ? i(s) : i;
    if (s.isTextblock && !s.hasMarkup(n, f) && oee(r.doc, r.mapping.slice(a).map(u), n)) {
      let p = null;
      if (n.schema.linebreakReplacement) {
        let O = n.whitespace == "pre", A = !!n.contentMatch.matchType(n.schema.linebreakReplacement);
        O && !A ? p = !1 : !O && A && (p = !0);
      }
      p === !1 && hS(r, s, u, a), W0(r, r.mapping.slice(a).map(u, 1), n, void 0, p === null);
      let y = r.mapping.slice(a), T = y.map(u, 1), N = y.map(u + s.nodeSize, 1);
      return r.step(new _n(T, N, T + 1, N - 1, new ht(Qe.from(n.create(f, null, s.marks)), 0, 0), 1, !0)), p === !0 && dS(r, s, u, a), !1;
    }
  });
}
function dS(r, e, t, n) {
  e.forEach((i, a) => {
    if (i.isText) {
      let s, u = /\r?\n|\r/g;
      for (; s = u.exec(i.text); ) {
        let f = r.mapping.slice(n).map(t + 1 + a + s.index);
        r.replaceWith(f, f + 1, e.type.schema.linebreakReplacement.create());
      }
    }
  });
}
function hS(r, e, t, n) {
  e.forEach((i, a) => {
    if (i.type == i.type.schema.linebreakReplacement) {
      let s = r.mapping.slice(n).map(t + 1 + a);
      r.replaceWith(s, s + 1, e.type.schema.text(`
`));
    }
  });
}
function oee(r, e, t) {
  let n = r.resolve(e), i = n.index();
  return n.parent.canReplaceWith(i, i + 1, t);
}
function see(r, e, t, n, i) {
  let a = r.doc.nodeAt(e);
  if (!a)
    throw new RangeError("No node at given position");
  t || (t = a.type);
  let s = t.create(n, null, i || a.marks);
  if (a.isLeaf)
    return r.replaceWith(e, e + a.nodeSize, s);
  if (!t.validContent(a.content))
    throw new RangeError("Invalid content for node type " + t.name);
  r.step(new _n(e, e + a.nodeSize, e + 1, e + a.nodeSize - 1, new ht(Qe.from(s), 0, 0), 1, !0));
}
function ef(r, e, t = 1, n) {
  let i = r.resolve(e), a = i.depth - t, s = n && n[n.length - 1] || i.parent;
  if (a < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !s.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount)))
    return !1;
  for (let p = i.depth - 1, y = t - 2; p > a; p--, y--) {
    let T = i.node(p), N = i.index(p);
    if (T.type.spec.isolating)
      return !1;
    let O = T.content.cutByIndex(N, T.childCount), A = n && n[y + 1];
    A && (O = O.replaceChild(0, A.type.create(A.attrs)));
    let q = n && n[y] || T;
    if (!T.canReplace(N + 1, T.childCount) || !q.type.validContent(O))
      return !1;
  }
  let u = i.indexAfter(a), f = n && n[0];
  return i.node(a).canReplaceWith(u, u, f ? f.type : i.node(a + 1).type);
}
function lee(r, e, t = 1, n) {
  let i = r.doc.resolve(e), a = Qe.empty, s = Qe.empty;
  for (let u = i.depth, f = i.depth - t, p = t - 1; u > f; u--, p--) {
    a = Qe.from(i.node(u).copy(a));
    let y = n && n[p];
    s = Qe.from(y ? y.type.create(y.attrs, s) : i.node(u).copy(s));
  }
  r.step(new pi(e, e, new ht(a.append(s), t, t), !0));
}
function pS(r, e) {
  let t = r.resolve(e), n = t.index();
  return cee(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
}
function uee(r, e) {
  e.content.size || r.type.compatibleContent(e.type);
  let t = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
  for (let i = 0; i < e.childCount; i++) {
    let a = e.child(i), s = a.type == n ? r.type.schema.nodes.text : a.type;
    if (t = t.matchType(s), !t || !r.type.allowsMarks(a.marks))
      return !1;
  }
  return t.validEnd;
}
function cee(r, e) {
  return !!(r && e && !r.isLeaf && uee(r, e));
}
function fee(r, e, t) {
  let n = null, { linebreakReplacement: i } = r.doc.type.schema, a = r.doc.resolve(e - t), s = a.node().type;
  if (i && s.inlineContent) {
    let y = s.whitespace == "pre", T = !!s.contentMatch.matchType(i);
    y && !T ? n = !1 : !y && T && (n = !0);
  }
  let u = r.steps.length;
  if (n === !1) {
    let y = r.doc.resolve(e + t);
    hS(r, y.node(), y.before(), u);
  }
  s.inlineContent && W0(r, e + t - 1, s, a.node().contentMatchAt(a.index()), n == null);
  let f = r.mapping.slice(u), p = f.map(e - t);
  if (r.step(new pi(p, f.map(e + t, -1), ht.empty, !0)), n === !0) {
    let y = r.doc.resolve(p);
    dS(r, y.node(), y.before(), r.steps.length);
  }
  return r;
}
function dee(r, e, t) {
  let n = r.resolve(e);
  if (n.parent.canReplaceWith(n.index(), n.index(), t))
    return e;
  if (n.parentOffset == 0)
    for (let i = n.depth - 1; i >= 0; i--) {
      let a = n.index(i);
      if (n.node(i).canReplaceWith(a, a, t))
        return n.before(i + 1);
      if (a > 0)
        return null;
    }
  if (n.parentOffset == n.parent.content.size)
    for (let i = n.depth - 1; i >= 0; i--) {
      let a = n.indexAfter(i);
      if (n.node(i).canReplaceWith(a, a, t))
        return n.after(i + 1);
      if (a < n.node(i).childCount)
        return null;
    }
  return null;
}
function hee(r, e, t) {
  let n = r.resolve(e);
  if (!t.content.size)
    return e;
  let i = t.content;
  for (let a = 0; a < t.openStart; a++)
    i = i.firstChild.content;
  for (let a = 1; a <= (t.openStart == 0 && t.size ? 2 : 1); a++)
    for (let s = n.depth; s >= 0; s--) {
      let u = s == n.depth ? 0 : n.pos <= (n.start(s + 1) + n.end(s + 1)) / 2 ? -1 : 1, f = n.index(s) + (u > 0 ? 1 : 0), p = n.node(s), y = !1;
      if (a == 1)
        y = p.canReplace(f, f, i);
      else {
        let T = p.contentMatchAt(f).findWrapping(i.firstChild.type);
        y = T && p.canReplaceWith(f, f, T[0]);
      }
      if (y)
        return u == 0 ? n.pos : u < 0 ? n.before(s + 1) : n.after(s + 1);
    }
  return null;
}
function j0(r, e, t = e, n = ht.empty) {
  if (e == t && !n.size)
    return null;
  let i = r.resolve(e), a = r.resolve(t);
  return vS(i, a, n) ? new pi(e, t, n) : new pee(i, a, n).fit();
}
function vS(r, e, t) {
  return !t.openStart && !t.openEnd && r.start() == e.start() && r.parent.canReplace(r.index(), e.index(), t.content);
}
class pee {
  constructor(e, t, n) {
    this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = Qe.empty;
    for (let i = 0; i <= e.depth; i++) {
      let a = e.node(i);
      this.frontier.push({
        type: a.type,
        match: a.contentMatchAt(e.indexAfter(i))
      });
    }
    for (let i = e.depth; i > 0; i--)
      this.placed = Qe.from(e.node(i).copy(this.placed));
  }
  get depth() {
    return this.frontier.length - 1;
  }
  fit() {
    for (; this.unplaced.size; ) {
      let p = this.findFittable();
      p ? this.placeNodes(p) : this.openMore() || this.dropNode();
    }
    let e = this.mustMoveInline(), t = this.placed.size - this.depth - this.$from.depth, n = this.$from, i = this.close(e < 0 ? this.$to : n.doc.resolve(e));
    if (!i)
      return null;
    let a = this.placed, s = n.depth, u = i.depth;
    for (; s && u && a.childCount == 1; )
      a = a.firstChild.content, s--, u--;
    let f = new ht(a, s, u);
    return e > -1 ? new _n(n.pos, e, this.$to.pos, this.$to.end(), f, t) : f.size || n.pos != this.$to.pos ? new pi(n.pos, i.pos, f) : null;
  }
  // Find a position on the start spine of `this.unplaced` that has
  // content that can be moved somewhere on the frontier. Returns two
  // depths, one for the slice and one for the frontier.
  findFittable() {
    let e = this.unplaced.openStart;
    for (let t = this.unplaced.content, n = 0, i = this.unplaced.openEnd; n < e; n++) {
      let a = t.firstChild;
      if (t.childCount > 1 && (i = 0), a.type.spec.isolating && i <= n) {
        e = n;
        break;
      }
      t = a.content;
    }
    for (let t = 1; t <= 2; t++)
      for (let n = t == 1 ? e : this.unplaced.openStart; n >= 0; n--) {
        let i, a = null;
        n ? (a = py(this.unplaced.content, n - 1).firstChild, i = a.content) : i = this.unplaced.content;
        let s = i.firstChild;
        for (let u = this.depth; u >= 0; u--) {
          let { type: f, match: p } = this.frontier[u], y, T = null;
          if (t == 1 && (s ? p.matchType(s.type) || (T = p.fillBefore(Qe.from(s), !1)) : a && f.compatibleContent(a.type)))
            return { sliceDepth: n, frontierDepth: u, parent: a, inject: T };
          if (t == 2 && s && (y = p.findWrapping(s.type)))
            return { sliceDepth: n, frontierDepth: u, parent: a, wrap: y };
          if (a && p.matchType(a.type))
            break;
        }
      }
  }
  openMore() {
    let { content: e, openStart: t, openEnd: n } = this.unplaced, i = py(e, t);
    return !i.childCount || i.firstChild.isLeaf ? !1 : (this.unplaced = new ht(e, t + 1, Math.max(n, i.size + t >= e.size - n ? t + 1 : 0)), !0);
  }
  dropNode() {
    let { content: e, openStart: t, openEnd: n } = this.unplaced, i = py(e, t);
    if (i.childCount <= 1 && t > 0) {
      let a = e.size - t <= t + i.size;
      this.unplaced = new ht(th(e, t - 1, 1), t - 1, a ? t - 1 : n);
    } else
      this.unplaced = new ht(th(e, t, 1), t, n);
  }
  // Move content from the unplaced slice at `sliceDepth` to the
  // frontier node at `frontierDepth`. Close that frontier node when
  // applicable.
  placeNodes({ sliceDepth: e, frontierDepth: t, parent: n, inject: i, wrap: a }) {
    for (; this.depth > t; )
      this.closeFrontierNode();
    if (a)
      for (let q = 0; q < a.length; q++)
        this.openFrontierNode(a[q]);
    let s = this.unplaced, u = n ? n.content : s.content, f = s.openStart - e, p = 0, y = [], { match: T, type: N } = this.frontier[t];
    if (i) {
      for (let q = 0; q < i.childCount; q++)
        y.push(i.child(q));
      T = T.matchFragment(i);
    }
    let O = u.size + e - (s.content.size - s.openEnd);
    for (; p < u.childCount; ) {
      let q = u.child(p), U = T.matchType(q.type);
      if (!U)
        break;
      p++, (p > 1 || f == 0 || q.content.size) && (T = U, y.push(mS(q.mark(N.allowedMarks(q.marks)), p == 1 ? f : 0, p == u.childCount ? O : -1)));
    }
    let A = p == u.childCount;
    A || (O = -1), this.placed = rh(this.placed, t, Qe.from(y)), this.frontier[t].match = T, A && O < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
    for (let q = 0, U = u; q < O; q++) {
      let j = U.lastChild;
      this.frontier.push({ type: j.type, match: j.contentMatchAt(j.childCount) }), U = j.content;
    }
    this.unplaced = A ? e == 0 ? ht.empty : new ht(th(s.content, e - 1, 1), e - 1, O < 0 ? s.openEnd : e - 1) : new ht(th(s.content, e, p), s.openStart, s.openEnd);
  }
  mustMoveInline() {
    if (!this.$to.parent.isTextblock)
      return -1;
    let e = this.frontier[this.depth], t;
    if (!e.type.isTextblock || !vy(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth)
      return -1;
    let { depth: n } = this.$to, i = this.$to.after(n);
    for (; n > 1 && i == this.$to.end(--n); )
      ++i;
    return i;
  }
  findCloseLevel(e) {
    e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
      let { match: n, type: i } = this.frontier[t], a = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), s = vy(e, t, i, n, a);
      if (s) {
        for (let u = t - 1; u >= 0; u--) {
          let { match: f, type: p } = this.frontier[u], y = vy(e, u, p, f, !0);
          if (!y || y.childCount)
            continue e;
        }
        return { depth: t, fit: s, move: a ? e.doc.resolve(e.after(t + 1)) : e };
      }
    }
  }
  close(e) {
    let t = this.findCloseLevel(e);
    if (!t)
      return null;
    for (; this.depth > t.depth; )
      this.closeFrontierNode();
    t.fit.childCount && (this.placed = rh(this.placed, t.depth, t.fit)), e = t.move;
    for (let n = t.depth + 1; n <= e.depth; n++) {
      let i = e.node(n), a = i.type.contentMatch.fillBefore(i.content, !0, e.index(n));
      this.openFrontierNode(i.type, i.attrs, a);
    }
    return e;
  }
  openFrontierNode(e, t = null, n) {
    let i = this.frontier[this.depth];
    i.match = i.match.matchType(e), this.placed = rh(this.placed, this.depth, Qe.from(e.create(t, n))), this.frontier.push({ type: e, match: e.contentMatch });
  }
  closeFrontierNode() {
    let t = this.frontier.pop().match.fillBefore(Qe.empty, !0);
    t.childCount && (this.placed = rh(this.placed, this.frontier.length, t));
  }
}
function th(r, e, t) {
  return e == 0 ? r.cutByIndex(t, r.childCount) : r.replaceChild(0, r.firstChild.copy(th(r.firstChild.content, e - 1, t)));
}
function rh(r, e, t) {
  return e == 0 ? r.append(t) : r.replaceChild(r.childCount - 1, r.lastChild.copy(rh(r.lastChild.content, e - 1, t)));
}
function py(r, e) {
  for (let t = 0; t < e; t++)
    r = r.firstChild.content;
  return r;
}
function mS(r, e, t) {
  if (e <= 0)
    return r;
  let n = r.content;
  return e > 1 && (n = n.replaceChild(0, mS(n.firstChild, e - 1, n.childCount == 1 ? t - 1 : 0))), e > 0 && (n = r.type.contentMatch.fillBefore(n).append(n), t <= 0 && (n = n.append(r.type.contentMatch.matchFragment(n).fillBefore(Qe.empty, !0)))), r.copy(n);
}
function vy(r, e, t, n, i) {
  let a = r.node(e), s = i ? r.indexAfter(e) : r.index(e);
  if (s == a.childCount && !t.compatibleContent(a.type))
    return null;
  let u = n.fillBefore(a.content, !0, s);
  return u && !vee(t, a.content, s) ? u : null;
}
function vee(r, e, t) {
  for (let n = t; n < e.childCount; n++)
    if (!r.allowsMarks(e.child(n).marks))
      return !0;
  return !1;
}
function mee(r) {
  return r.spec.defining || r.spec.definingForContent;
}
function gee(r, e, t, n) {
  if (!n.size)
    return r.deleteRange(e, t);
  let i = r.doc.resolve(e), a = r.doc.resolve(t);
  if (vS(i, a, n))
    return r.step(new pi(e, t, n));
  let s = yS(i, a);
  s[s.length - 1] == 0 && s.pop();
  let u = -(i.depth + 1);
  s.unshift(u);
  for (let N = i.depth, O = i.pos - 1; N > 0; N--, O--) {
    let A = i.node(N).type.spec;
    if (A.defining || A.definingAsContext || A.isolating)
      break;
    s.indexOf(N) > -1 ? u = N : i.before(N) == O && s.splice(1, 0, -N);
  }
  let f = s.indexOf(u), p = [], y = n.openStart;
  for (let N = n.content, O = 0; ; O++) {
    let A = N.firstChild;
    if (p.push(A), O == n.openStart)
      break;
    N = A.content;
  }
  for (let N = y - 1; N >= 0; N--) {
    let O = p[N], A = mee(O.type);
    if (A && !O.sameMarkup(i.node(Math.abs(u) - 1)))
      y = N;
    else if (A || !O.type.isTextblock)
      break;
  }
  for (let N = n.openStart; N >= 0; N--) {
    let O = (N + y + 1) % (n.openStart + 1), A = p[O];
    if (A)
      for (let q = 0; q < s.length; q++) {
        let U = s[(q + f) % s.length], j = !0;
        U < 0 && (j = !1, U = -U);
        let te = i.node(U - 1), se = i.index(U - 1);
        if (te.canReplaceWith(se, se, A.type, A.marks))
          return r.replace(i.before(U), j ? a.after(U) : t, new ht(gS(n.content, 0, n.openStart, O), O, n.openEnd));
      }
  }
  let T = r.steps.length;
  for (let N = s.length - 1; N >= 0 && (r.replace(e, t, n), !(r.steps.length > T)); N--) {
    let O = s[N];
    O < 0 || (e = i.before(O), t = a.after(O));
  }
}
function gS(r, e, t, n, i) {
  if (e < t) {
    let a = r.firstChild;
    r = r.replaceChild(0, a.copy(gS(a.content, e + 1, t, n, a)));
  }
  if (e > n) {
    let a = i.contentMatchAt(0), s = a.fillBefore(r).append(r);
    r = s.append(a.matchFragment(s).fillBefore(Qe.empty, !0));
  }
  return r;
}
function yee(r, e, t, n) {
  if (!n.isInline && e == t && r.doc.resolve(e).parent.content.size) {
    let i = dee(r.doc, e, n.type);
    i != null && (e = t = i);
  }
  r.replaceRange(e, t, new ht(Qe.from(n), 0, 0));
}
function kee(r, e, t) {
  let n = r.doc.resolve(e), i = r.doc.resolve(t), a = yS(n, i);
  for (let s = 0; s < a.length; s++) {
    let u = a[s], f = s == a.length - 1;
    if (f && u == 0 || n.node(u).type.contentMatch.validEnd)
      return r.delete(n.start(u), i.end(u));
    if (u > 0 && (f || n.node(u - 1).canReplace(n.index(u - 1), i.indexAfter(u - 1))))
      return r.delete(n.before(u), i.after(u));
  }
  for (let s = 1; s <= n.depth && s <= i.depth; s++)
    if (e - n.start(s) == n.depth - s && t > n.end(s) && i.end(s) - t != i.depth - s && n.start(s - 1) == i.start(s - 1) && n.node(s - 1).canReplace(n.index(s - 1), i.index(s - 1)))
      return r.delete(n.before(s), t);
  r.delete(e, t);
}
function yS(r, e) {
  let t = [], n = Math.min(r.depth, e.depth);
  for (let i = n; i >= 0; i--) {
    let a = r.start(i);
    if (a < r.pos - (r.depth - i) || e.end(i) > e.pos + (e.depth - i) || r.node(i).type.spec.isolating || e.node(i).type.spec.isolating)
      break;
    (a == e.start(i) || i == r.depth && i == e.depth && r.parent.inlineContent && e.parent.inlineContent && i && e.start(i - 1) == a - 1) && t.push(i);
  }
  return t;
}
class tf extends gi {
  /**
  Construct an attribute step.
  */
  constructor(e, t, n) {
    super(), this.pos = e, this.attr = t, this.value = n;
  }
  apply(e) {
    let t = e.nodeAt(this.pos);
    if (!t)
      return vn.fail("No node at attribute step's position");
    let n = /* @__PURE__ */ Object.create(null);
    for (let a in t.attrs)
      n[a] = t.attrs[a];
    n[this.attr] = this.value;
    let i = t.type.create(n, null, t.marks);
    return vn.fromReplace(e, this.pos, this.pos + 1, new ht(Qe.from(i), 0, t.isLeaf ? 0 : 1));
  }
  getMap() {
    return Wi.empty;
  }
  invert(e) {
    return new tf(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
  }
  map(e) {
    let t = e.mapResult(this.pos, 1);
    return t.deletedAfter ? null : new tf(t.pos, this.attr, this.value);
  }
  toJSON() {
    return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
  }
  static fromJSON(e, t) {
    if (typeof t.pos != "number" || typeof t.attr != "string")
      throw new RangeError("Invalid input for AttrStep.fromJSON");
    return new tf(t.pos, t.attr, t.value);
  }
}
gi.jsonID("attr", tf);
class vh extends gi {
  /**
  Construct an attribute step.
  */
  constructor(e, t) {
    super(), this.attr = e, this.value = t;
  }
  apply(e) {
    let t = /* @__PURE__ */ Object.create(null);
    for (let i in e.attrs)
      t[i] = e.attrs[i];
    t[this.attr] = this.value;
    let n = e.type.create(t, e.content, e.marks);
    return vn.ok(n);
  }
  getMap() {
    return Wi.empty;
  }
  invert(e) {
    return new vh(this.attr, e.attrs[this.attr]);
  }
  map(e) {
    return this;
  }
  toJSON() {
    return { stepType: "docAttr", attr: this.attr, value: this.value };
  }
  static fromJSON(e, t) {
    if (typeof t.attr != "string")
      throw new RangeError("Invalid input for DocAttrStep.fromJSON");
    return new vh(t.attr, t.value);
  }
}
gi.jsonID("docAttr", vh);
let nf = class extends Error {
};
nf = function r(e) {
  let t = Error.call(this, e);
  return t.__proto__ = r.prototype, t;
};
nf.prototype = Object.create(Error.prototype);
nf.prototype.constructor = nf;
nf.prototype.name = "TransformError";
class wee {
  /**
  Create a transform that starts with the given document.
  */
  constructor(e) {
    this.doc = e, this.steps = [], this.docs = [], this.mapping = new ph();
  }
  /**
  The starting document.
  */
  get before() {
    return this.docs.length ? this.docs[0] : this.doc;
  }
  /**
  Apply a new step in this transform, saving the result. Throws an
  error when the step fails.
  */
  step(e) {
    let t = this.maybeStep(e);
    if (t.failed)
      throw new nf(t.failed);
    return this;
  }
  /**
  Try to apply a step in this transformation, ignoring it if it
  fails. Returns the step result.
  */
  maybeStep(e) {
    let t = e.apply(this.doc);
    return t.failed || this.addStep(e, t.doc), t;
  }
  /**
  True when the document has been changed (when there are any
  steps).
  */
  get docChanged() {
    return this.steps.length > 0;
  }
  /**
  @internal
  */
  addStep(e, t) {
    this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
  }
  /**
  Replace the part of the document between `from` and `to` with the
  given `slice`.
  */
  replace(e, t = e, n = ht.empty) {
    let i = j0(this.doc, e, t, n);
    return i && this.step(i), this;
  }
  /**
  Replace the given range with the given content, which may be a
  fragment, node, or array of nodes.
  */
  replaceWith(e, t, n) {
    return this.replace(e, t, new ht(Qe.from(n), 0, 0));
  }
  /**
  Delete the content between the given positions.
  */
  delete(e, t) {
    return this.replace(e, t, ht.empty);
  }
  /**
  Insert the given content at the given position.
  */
  insert(e, t) {
    return this.replaceWith(e, e, t);
  }
  /**
  Replace a range of the document with a given slice, using
  `from`, `to`, and the slice's
  [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather
  than fixed start and end points. This method may grow the
  replaced area or close open nodes in the slice in order to get a
  fit that is more in line with WYSIWYG expectations, by dropping
  fully covered parent nodes of the replaced region when they are
  marked [non-defining as
  context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an
  open parent node from the slice that _is_ marked as [defining
  its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
  
  This is the method, for example, to handle paste. The similar
  [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more
  primitive tool which will _not_ move the start and end of its given
  range, and is useful in situations where you need more precise
  control over what happens.
  */
  replaceRange(e, t, n) {
    return gee(this, e, t, n), this;
  }
  /**
  Replace the given range with a node, but use `from` and `to` as
  hints, rather than precise positions. When from and to are the same
  and are at the start or end of a parent node in which the given
  node doesn't fit, this method may _move_ them out towards a parent
  that does allow the given node to be placed. When the given range
  completely covers a parent node, this method may completely replace
  that parent node.
  */
  replaceRangeWith(e, t, n) {
    return yee(this, e, t, n), this;
  }
  /**
  Delete the given range, expanding it to cover fully covered
  parent nodes until a valid replace is found.
  */
  deleteRange(e, t) {
    return kee(this, e, t), this;
  }
  /**
  Split the content in the given range off from its parent, if there
  is sibling content before or after it, and move it up the tree to
  the depth specified by `target`. You'll probably want to use
  [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
  sure the lift is valid.
  */
  lift(e, t) {
    return eee(this, e, t), this;
  }
  /**
  Join the blocks around the given position. If depth is 2, their
  last and first siblings are also joined, and so on.
  */
  join(e, t = 1) {
    return fee(this, e, t), this;
  }
  /**
  Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
  The wrappers are assumed to be valid in this position, and should
  probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
  */
  wrap(e, t) {
    return iee(this, e, t), this;
  }
  /**
  Set the type of all textblocks (partly) between `from` and `to` to
  the given node type with the given attributes.
  */
  setBlockType(e, t = e, n, i = null) {
    return aee(this, e, t, n, i), this;
  }
  /**
  Change the type, attributes, and/or marks of the node at `pos`.
  When `type` isn't given, the existing node type is preserved,
  */
  setNodeMarkup(e, t, n = null, i) {
    return see(this, e, t, n, i), this;
  }
  /**
  Set a single attribute on a given node to a new value.
  The `pos` addresses the document content. Use `setDocAttribute`
  to set attributes on the document itself.
  */
  setNodeAttribute(e, t, n) {
    return this.step(new tf(e, t, n)), this;
  }
  /**
  Set a single attribute on the document to a new value.
  */
  setDocAttribute(e, t) {
    return this.step(new vh(e, t)), this;
  }
  /**
  Add a mark to the node at position `pos`.
  */
  addNodeMark(e, t) {
    return this.step(new fl(e, t)), this;
  }
  /**
  Remove a mark (or all marks of the given type) from the node at
  position `pos`.
  */
  removeNodeMark(e, t) {
    let n = this.doc.nodeAt(e);
    if (!n)
      throw new RangeError("No node at position " + e);
    if (t instanceof Tr)
      t.isInSet(n.marks) && this.step(new Su(e, t));
    else {
      let i = n.marks, a, s = [];
      for (; a = t.isInSet(i); )
        s.push(new Su(e, a)), i = a.removeFromSet(i);
      for (let u = s.length - 1; u >= 0; u--)
        this.step(s[u]);
    }
    return this;
  }
  /**
  Split the node at the given position, and optionally, if `depth` is
  greater than one, any number of nodes above that. By default, the
  parts split off will inherit the node type of the original node.
  This can be changed by passing an array of types and attributes to
  use after the split (with the outermost nodes coming first).
  */
  split(e, t = 1, n) {
    return lee(this, e, t, n), this;
  }
  /**
  Add the given mark to the inline content between `from` and `to`.
  */
  addMark(e, t, n) {
    return XZ(this, e, t, n), this;
  }
  /**
  Remove marks from inline nodes between `from` and `to`. When
  `mark` is a single mark, remove precisely that mark. When it is
  a mark type, remove all marks of that type. When it is null,
  remove all marks of any type.
  */
  removeMark(e, t, n) {
    return YZ(this, e, t, n), this;
  }
  /**
  Removes all marks and nodes from the content of the node at
  `pos` that don't match the given new parent node type. Accepts
  an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
  third argument.
  */
  clearIncompatible(e, t, n) {
    return W0(this, e, t, n), this;
  }
}
const my = /* @__PURE__ */ Object.create(null);
class cr {
  /**
  Initialize a selection with the head and anchor and ranges. If no
  ranges are given, constructs a single range across `$anchor` and
  `$head`.
  */
  constructor(e, t, n) {
    this.$anchor = e, this.$head = t, this.ranges = n || [new kS(e.min(t), e.max(t))];
  }
  /**
  The selection's anchor, as an unresolved position.
  */
  get anchor() {
    return this.$anchor.pos;
  }
  /**
  The selection's head.
  */
  get head() {
    return this.$head.pos;
  }
  /**
  The lower bound of the selection's main range.
  */
  get from() {
    return this.$from.pos;
  }
  /**
  The upper bound of the selection's main range.
  */
  get to() {
    return this.$to.pos;
  }
  /**
  The resolved lower  bound of the selection's main range.
  */
  get $from() {
    return this.ranges[0].$from;
  }
  /**
  The resolved upper bound of the selection's main range.
  */
  get $to() {
    return this.ranges[0].$to;
  }
  /**
  Indicates whether the selection contains any content.
  */
  get empty() {
    let e = this.ranges;
    for (let t = 0; t < e.length; t++)
      if (e[t].$from.pos != e[t].$to.pos)
        return !1;
    return !0;
  }
  /**
  Get the content of this selection as a slice.
  */
  content() {
    return this.$from.doc.slice(this.from, this.to, !0);
  }
  /**
  Replace the selection with a slice or, if no slice is given,
  delete the selection. Will append to the given transaction.
  */
  replace(e, t = ht.empty) {
    let n = t.content.lastChild, i = null;
    for (let u = 0; u < t.openEnd; u++)
      i = n, n = n.lastChild;
    let a = e.steps.length, s = this.ranges;
    for (let u = 0; u < s.length; u++) {
      let { $from: f, $to: p } = s[u], y = e.mapping.slice(a);
      e.replaceRange(y.map(f.pos), y.map(p.pos), u ? ht.empty : t), u == 0 && L1(e, a, (n ? n.isInline : i && i.isTextblock) ? -1 : 1);
    }
  }
  /**
  Replace the selection with the given node, appending the changes
  to the given transaction.
  */
  replaceWith(e, t) {
    let n = e.steps.length, i = this.ranges;
    for (let a = 0; a < i.length; a++) {
      let { $from: s, $to: u } = i[a], f = e.mapping.slice(n), p = f.map(s.pos), y = f.map(u.pos);
      a ? e.deleteRange(p, y) : (e.replaceRangeWith(p, y, t), L1(e, n, t.isInline ? -1 : 1));
    }
  }
  /**
  Find a valid cursor or leaf node selection starting at the given
  position and searching back if `dir` is negative, and forward if
  positive. When `textOnly` is true, only consider cursor
  selections. Will return null when no valid selection position is
  found.
  */
  static findFrom(e, t, n = !1) {
    let i = e.parent.inlineContent ? new dr(e) : Kc(e.node(0), e.parent, e.pos, e.index(), t, n);
    if (i)
      return i;
    for (let a = e.depth - 1; a >= 0; a--) {
      let s = t < 0 ? Kc(e.node(0), e.node(a), e.before(a + 1), e.index(a), t, n) : Kc(e.node(0), e.node(a), e.after(a + 1), e.index(a) + 1, t, n);
      if (s)
        return s;
    }
    return null;
  }
  /**
  Find a valid cursor or leaf node selection near the given
  position. Searches forward first by default, but if `bias` is
  negative, it will search backwards first.
  */
  static near(e, t = 1) {
    return this.findFrom(e, t) || this.findFrom(e, -t) || new Di(e.node(0));
  }
  /**
  Find the cursor or leaf node selection closest to the start of
  the given document. Will return an
  [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
  exists.
  */
  static atStart(e) {
    return Kc(e, e, 0, 0, 1) || new Di(e);
  }
  /**
  Find the cursor or leaf node selection closest to the end of the
  given document.
  */
  static atEnd(e) {
    return Kc(e, e, e.content.size, e.childCount, -1) || new Di(e);
  }
  /**
  Deserialize the JSON representation of a selection. Must be
  implemented for custom classes (as a static class method).
  */
  static fromJSON(e, t) {
    if (!t || !t.type)
      throw new RangeError("Invalid input for Selection.fromJSON");
    let n = my[t.type];
    if (!n)
      throw new RangeError(`No selection type ${t.type} defined`);
    return n.fromJSON(e, t);
  }
  /**
  To be able to deserialize selections from JSON, custom selection
  classes must register themselves with an ID string, so that they
  can be disambiguated. Try to pick something that's unlikely to
  clash with classes from other modules.
  */
  static jsonID(e, t) {
    if (e in my)
      throw new RangeError("Duplicate use of selection JSON ID " + e);
    return my[e] = t, t.prototype.jsonID = e, t;
  }
  /**
  Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
  which is a value that can be mapped without having access to a
  current document, and later resolved to a real selection for a
  given document again. (This is used mostly by the history to
  track and restore old selections.) The default implementation of
  this method just converts the selection to a text selection and
  returns the bookmark for that.
  */
  getBookmark() {
    return dr.between(this.$anchor, this.$head).getBookmark();
  }
}
cr.prototype.visible = !0;
class kS {
  /**
  Create a range.
  */
  constructor(e, t) {
    this.$from = e, this.$to = t;
  }
}
let D1 = !1;
function A1(r) {
  !D1 && !r.parent.inlineContent && (D1 = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
}
class dr extends cr {
  /**
  Construct a text selection between the given points.
  */
  constructor(e, t = e) {
    A1(e), A1(t), super(e, t);
  }
  /**
  Returns a resolved position if this is a cursor selection (an
  empty text selection), and null otherwise.
  */
  get $cursor() {
    return this.$anchor.pos == this.$head.pos ? this.$head : null;
  }
  map(e, t) {
    let n = e.resolve(t.map(this.head));
    if (!n.parent.inlineContent)
      return cr.near(n);
    let i = e.resolve(t.map(this.anchor));
    return new dr(i.parent.inlineContent ? i : n, n);
  }
  replace(e, t = ht.empty) {
    if (super.replace(e, t), t == ht.empty) {
      let n = this.$from.marksAcross(this.$to);
      n && e.ensureMarks(n);
    }
  }
  eq(e) {
    return e instanceof dr && e.anchor == this.anchor && e.head == this.head;
  }
  getBookmark() {
    return new Em(this.anchor, this.head);
  }
  toJSON() {
    return { type: "text", anchor: this.anchor, head: this.head };
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.anchor != "number" || typeof t.head != "number")
      throw new RangeError("Invalid input for TextSelection.fromJSON");
    return new dr(e.resolve(t.anchor), e.resolve(t.head));
  }
  /**
  Create a text selection from non-resolved positions.
  */
  static create(e, t, n = t) {
    let i = e.resolve(t);
    return new this(i, n == t ? i : e.resolve(n));
  }
  /**
  Return a text selection that spans the given positions or, if
  they aren't text positions, find a text selection near them.
  `bias` determines whether the method searches forward (default)
  or backwards (negative number) first. Will fall back to calling
  [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
  doesn't contain a valid text position.
  */
  static between(e, t, n) {
    let i = e.pos - t.pos;
    if ((!n || i) && (n = i >= 0 ? 1 : -1), !t.parent.inlineContent) {
      let a = cr.findFrom(t, n, !0) || cr.findFrom(t, -n, !0);
      if (a)
        t = a.$head;
      else
        return cr.near(t, n);
    }
    return e.parent.inlineContent || (i == 0 ? e = t : (e = (cr.findFrom(e, -n, !0) || cr.findFrom(e, n, !0)).$anchor, e.pos < t.pos != i < 0 && (e = t))), new dr(e, t);
  }
}
cr.jsonID("text", dr);
class Em {
  constructor(e, t) {
    this.anchor = e, this.head = t;
  }
  map(e) {
    return new Em(e.map(this.anchor), e.map(this.head));
  }
  resolve(e) {
    return dr.between(e.resolve(this.anchor), e.resolve(this.head));
  }
}
class Kt extends cr {
  /**
  Create a node selection. Does not verify the validity of its
  argument.
  */
  constructor(e) {
    let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
    super(e, n), this.node = t;
  }
  map(e, t) {
    let { deleted: n, pos: i } = t.mapResult(this.anchor), a = e.resolve(i);
    return n ? cr.near(a) : new Kt(a);
  }
  content() {
    return new ht(Qe.from(this.node), 0, 0);
  }
  eq(e) {
    return e instanceof Kt && e.anchor == this.anchor;
  }
  toJSON() {
    return { type: "node", anchor: this.anchor };
  }
  getBookmark() {
    return new G0(this.anchor);
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.anchor != "number")
      throw new RangeError("Invalid input for NodeSelection.fromJSON");
    return new Kt(e.resolve(t.anchor));
  }
  /**
  Create a node selection from non-resolved positions.
  */
  static create(e, t) {
    return new Kt(e.resolve(t));
  }
  /**
  Determines whether the given node may be selected as a node
  selection.
  */
  static isSelectable(e) {
    return !e.isText && e.type.spec.selectable !== !1;
  }
}
Kt.prototype.visible = !1;
cr.jsonID("node", Kt);
class G0 {
  constructor(e) {
    this.anchor = e;
  }
  map(e) {
    let { deleted: t, pos: n } = e.mapResult(this.anchor);
    return t ? new Em(n, n) : new G0(n);
  }
  resolve(e) {
    let t = e.resolve(this.anchor), n = t.nodeAfter;
    return n && Kt.isSelectable(n) ? new Kt(t) : cr.near(t);
  }
}
class Di extends cr {
  /**
  Create an all-selection over the given document.
  */
  constructor(e) {
    super(e.resolve(0), e.resolve(e.content.size));
  }
  replace(e, t = ht.empty) {
    if (t == ht.empty) {
      e.delete(0, e.doc.content.size);
      let n = cr.atStart(e.doc);
      n.eq(e.selection) || e.setSelection(n);
    } else
      super.replace(e, t);
  }
  toJSON() {
    return { type: "all" };
  }
  /**
  @internal
  */
  static fromJSON(e) {
    return new Di(e);
  }
  map(e) {
    return new Di(e);
  }
  eq(e) {
    return e instanceof Di;
  }
  getBookmark() {
    return bee;
  }
}
cr.jsonID("all", Di);
const bee = {
  map() {
    return this;
  },
  resolve(r) {
    return new Di(r);
  }
};
function Kc(r, e, t, n, i, a = !1) {
  if (e.inlineContent)
    return dr.create(r, t);
  for (let s = n - (i > 0 ? 0 : 1); i > 0 ? s < e.childCount : s >= 0; s += i) {
    let u = e.child(s);
    if (u.isAtom) {
      if (!a && Kt.isSelectable(u))
        return Kt.create(r, t - (i < 0 ? u.nodeSize : 0));
    } else {
      let f = Kc(r, u, t + i, i < 0 ? u.childCount : 0, i, a);
      if (f)
        return f;
    }
    t += u.nodeSize * i;
  }
  return null;
}
function L1(r, e, t) {
  let n = r.steps.length - 1;
  if (n < e)
    return;
  let i = r.steps[n];
  if (!(i instanceof pi || i instanceof _n))
    return;
  let a = r.mapping.maps[n], s;
  a.forEach((u, f, p, y) => {
    s == null && (s = y);
  }), r.setSelection(cr.near(r.doc.resolve(s), t));
}
const R1 = 1, Tv = 2, I1 = 4;
class Cee extends wee {
  /**
  @internal
  */
  constructor(e) {
    super(e.doc), this.curSelectionFor = 0, this.updated = 0, this.meta = /* @__PURE__ */ Object.create(null), this.time = Date.now(), this.curSelection = e.selection, this.storedMarks = e.storedMarks;
  }
  /**
  The transaction's current selection. This defaults to the editor
  selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the
  transaction, but can be overwritten with
  [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).
  */
  get selection() {
    return this.curSelectionFor < this.steps.length && (this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor)), this.curSelectionFor = this.steps.length), this.curSelection;
  }
  /**
  Update the transaction's current selection. Will determine the
  selection that the editor gets when the transaction is applied.
  */
  setSelection(e) {
    if (e.$from.doc != this.doc)
      throw new RangeError("Selection passed to setSelection must point at the current document");
    return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | R1) & ~Tv, this.storedMarks = null, this;
  }
  /**
  Whether the selection was explicitly updated by this transaction.
  */
  get selectionSet() {
    return (this.updated & R1) > 0;
  }
  /**
  Set the current stored marks.
  */
  setStoredMarks(e) {
    return this.storedMarks = e, this.updated |= Tv, this;
  }
  /**
  Make sure the current stored marks or, if that is null, the marks
  at the selection, match the given set of marks. Does nothing if
  this is already the case.
  */
  ensureMarks(e) {
    return Tr.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
  }
  /**
  Add a mark to the set of stored marks.
  */
  addStoredMark(e) {
    return this.ensureMarks(e.addToSet(this.storedMarks || this.selection.$head.marks()));
  }
  /**
  Remove a mark or mark type from the set of stored marks.
  */
  removeStoredMark(e) {
    return this.ensureMarks(e.removeFromSet(this.storedMarks || this.selection.$head.marks()));
  }
  /**
  Whether the stored marks were explicitly set for this transaction.
  */
  get storedMarksSet() {
    return (this.updated & Tv) > 0;
  }
  /**
  @internal
  */
  addStep(e, t) {
    super.addStep(e, t), this.updated = this.updated & ~Tv, this.storedMarks = null;
  }
  /**
  Update the timestamp for the transaction.
  */
  setTime(e) {
    return this.time = e, this;
  }
  /**
  Replace the current selection with the given slice.
  */
  replaceSelection(e) {
    return this.selection.replace(this, e), this;
  }
  /**
  Replace the selection with the given node. When `inheritMarks` is
  true and the content is inline, it inherits the marks from the
  place where it is inserted.
  */
  replaceSelectionWith(e, t = !0) {
    let n = this.selection;
    return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) || Tr.none))), n.replaceWith(this, e), this;
  }
  /**
  Delete the selection.
  */
  deleteSelection() {
    return this.selection.replace(this), this;
  }
  /**
  Replace the given range, or the selection if no range is given,
  with a text node containing the given string.
  */
  insertText(e, t, n) {
    let i = this.doc.type.schema;
    if (t == null)
      return e ? this.replaceSelectionWith(i.text(e), !0) : this.deleteSelection();
    {
      if (n == null && (n = t), !e)
        return this.deleteRange(t, n);
      let a = this.storedMarks;
      if (!a) {
        let s = this.doc.resolve(t);
        a = n == t ? s.marks() : s.marksAcross(this.doc.resolve(n));
      }
      return this.replaceRangeWith(t, n, i.text(e, a)), !this.selection.empty && this.selection.to == t + e.length && this.setSelection(cr.near(this.selection.$to)), this;
    }
  }
  /**
  Store a metadata property in this transaction, keyed either by
  name or by plugin.
  */
  setMeta(e, t) {
    return this.meta[typeof e == "string" ? e : e.key] = t, this;
  }
  /**
  Retrieve a metadata property for a given name or plugin.
  */
  getMeta(e) {
    return this.meta[typeof e == "string" ? e : e.key];
  }
  /**
  Returns true if this transaction doesn't contain any metadata,
  and can thus safely be extended.
  */
  get isGeneric() {
    for (let e in this.meta)
      return !1;
    return !0;
  }
  /**
  Indicate that the editor should scroll the selection into view
  when updated to the state produced by this transaction.
  */
  scrollIntoView() {
    return this.updated |= I1, this;
  }
  /**
  True when this transaction has had `scrollIntoView` called on it.
  */
  get scrolledIntoView() {
    return (this.updated & I1) > 0;
  }
}
function P1(r, e) {
  return !e || !r ? r : r.bind(e);
}
class nh {
  constructor(e, t, n) {
    this.name = e, this.init = P1(t.init, n), this.apply = P1(t.apply, n);
  }
}
const Tee = [
  new nh("doc", {
    init(r) {
      return r.doc || r.schema.topNodeType.createAndFill();
    },
    apply(r) {
      return r.doc;
    }
  }),
  new nh("selection", {
    init(r, e) {
      return r.selection || cr.atStart(e.doc);
    },
    apply(r) {
      return r.selection;
    }
  }),
  new nh("storedMarks", {
    init(r) {
      return r.storedMarks || null;
    },
    apply(r, e, t, n) {
      return n.selection.$cursor ? r.storedMarks : null;
    }
  }),
  new nh("scrollToSelection", {
    init() {
      return 0;
    },
    apply(r, e) {
      return r.scrolledIntoView ? e + 1 : e;
    }
  })
];
class gy {
  constructor(e, t) {
    this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = Tee.slice(), t && t.forEach((n) => {
      if (this.pluginsByKey[n.key])
        throw new RangeError("Adding different instances of a keyed plugin (" + n.key + ")");
      this.plugins.push(n), this.pluginsByKey[n.key] = n, n.spec.state && this.fields.push(new nh(n.key, n.spec.state, n));
    });
  }
}
class pu {
  /**
  @internal
  */
  constructor(e) {
    this.config = e;
  }
  /**
  The schema of the state's document.
  */
  get schema() {
    return this.config.schema;
  }
  /**
  The plugins that are active in this state.
  */
  get plugins() {
    return this.config.plugins;
  }
  /**
  Apply the given transaction to produce a new state.
  */
  apply(e) {
    return this.applyTransaction(e).state;
  }
  /**
  @internal
  */
  filterTransaction(e, t = -1) {
    for (let n = 0; n < this.config.plugins.length; n++)
      if (n != t) {
        let i = this.config.plugins[n];
        if (i.spec.filterTransaction && !i.spec.filterTransaction.call(i, e, this))
          return !1;
      }
    return !0;
  }
  /**
  Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that
  returns the precise transactions that were applied (which might
  be influenced by the [transaction
  hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of
  plugins) along with the new state.
  */
  applyTransaction(e) {
    if (!this.filterTransaction(e))
      return { state: this, transactions: [] };
    let t = [e], n = this.applyInner(e), i = null;
    for (; ; ) {
      let a = !1;
      for (let s = 0; s < this.config.plugins.length; s++) {
        let u = this.config.plugins[s];
        if (u.spec.appendTransaction) {
          let f = i ? i[s].n : 0, p = i ? i[s].state : this, y = f < t.length && u.spec.appendTransaction.call(u, f ? t.slice(f) : t, p, n);
          if (y && n.filterTransaction(y, s)) {
            if (y.setMeta("appendedTransaction", e), !i) {
              i = [];
              for (let T = 0; T < this.config.plugins.length; T++)
                i.push(T < s ? { state: n, n: t.length } : { state: this, n: 0 });
            }
            t.push(y), n = n.applyInner(y), a = !0;
          }
          i && (i[s] = { state: n, n: t.length });
        }
      }
      if (!a)
        return { state: n, transactions: t };
    }
  }
  /**
  @internal
  */
  applyInner(e) {
    if (!e.before.eq(this.doc))
      throw new RangeError("Applying a mismatched transaction");
    let t = new pu(this.config), n = this.config.fields;
    for (let i = 0; i < n.length; i++) {
      let a = n[i];
      t[a.name] = a.apply(e, this[a.name], this, t);
    }
    return t;
  }
  /**
  Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
  */
  get tr() {
    return new Cee(this);
  }
  /**
  Create a new state.
  */
  static create(e) {
    let t = new gy(e.doc ? e.doc.type.schema : e.schema, e.plugins), n = new pu(t);
    for (let i = 0; i < t.fields.length; i++)
      n[t.fields[i].name] = t.fields[i].init(e, n);
    return n;
  }
  /**
  Create a new state based on this one, but with an adjusted set
  of active plugins. State fields that exist in both sets of
  plugins are kept unchanged. Those that no longer exist are
  dropped, and those that are new are initialized using their
  [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
  configuration object..
  */
  reconfigure(e) {
    let t = new gy(this.schema, e.plugins), n = t.fields, i = new pu(t);
    for (let a = 0; a < n.length; a++) {
      let s = n[a].name;
      i[s] = this.hasOwnProperty(s) ? this[s] : n[a].init(e, i);
    }
    return i;
  }
  /**
  Serialize this state to JSON. If you want to serialize the state
  of plugins, pass an object mapping property names to use in the
  resulting JSON object to plugin objects. The argument may also be
  a string or number, in which case it is ignored, to support the
  way `JSON.stringify` calls `toString` methods.
  */
  toJSON(e) {
    let t = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };
    if (this.storedMarks && (t.storedMarks = this.storedMarks.map((n) => n.toJSON())), e && typeof e == "object")
      for (let n in e) {
        if (n == "doc" || n == "selection")
          throw new RangeError("The JSON fields `doc` and `selection` are reserved");
        let i = e[n], a = i.spec.state;
        a && a.toJSON && (t[n] = a.toJSON.call(i, this[i.key]));
      }
    return t;
  }
  /**
  Deserialize a JSON representation of a state. `config` should
  have at least a `schema` field, and should contain array of
  plugins to initialize the state with. `pluginFields` can be used
  to deserialize the state of plugins, by associating plugin
  instances with the property names they use in the JSON object.
  */
  static fromJSON(e, t, n) {
    if (!t)
      throw new RangeError("Invalid input for EditorState.fromJSON");
    if (!e.schema)
      throw new RangeError("Required config field 'schema' missing");
    let i = new gy(e.schema, e.plugins), a = new pu(i);
    return i.fields.forEach((s) => {
      if (s.name == "doc")
        a.doc = hl.fromJSON(e.schema, t.doc);
      else if (s.name == "selection")
        a.selection = cr.fromJSON(a.doc, t.selection);
      else if (s.name == "storedMarks")
        t.storedMarks && (a.storedMarks = t.storedMarks.map(e.schema.markFromJSON));
      else {
        if (n)
          for (let u in n) {
            let f = n[u], p = f.spec.state;
            if (f.key == s.name && p && p.fromJSON && Object.prototype.hasOwnProperty.call(t, u)) {
              a[s.name] = p.fromJSON.call(f, e, t[u], a);
              return;
            }
          }
        a[s.name] = s.init(e, a);
      }
    }), a;
  }
}
function wS(r, e, t) {
  for (let n in r) {
    let i = r[n];
    i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = wS(i, e, {})), t[n] = i;
  }
  return t;
}
class Ji {
  /**
  Create a plugin.
  */
  constructor(e) {
    this.spec = e, this.props = {}, e.props && wS(e.props, this, this.props), this.key = e.key ? e.key.key : bS("plugin");
  }
  /**
  Extract the plugin's state field from an editor state.
  */
  getState(e) {
    return e[this.key];
  }
}
const yy = /* @__PURE__ */ Object.create(null);
function bS(r) {
  return r in yy ? r + "$" + ++yy[r] : (yy[r] = 0, r + "$");
}
class Ch {
  /**
  Create a plugin key.
  */
  constructor(e = "key") {
    this.key = bS(e);
  }
  /**
  Get the active plugin with this key, if any, from an editor
  state.
  */
  get(e) {
    return e.config.pluginsByKey[this.key];
  }
  /**
  Get the plugin's state from an editor state.
  */
  getState(e) {
    return e[this.key];
  }
}
const Yn = function(r) {
  for (var e = 0; ; e++)
    if (r = r.previousSibling, !r)
      return e;
}, af = function(r) {
  let e = r.assignedSlot || r.parentNode;
  return e && e.nodeType == 11 ? e.host : e;
};
let o0 = null;
const ys = function(r, e, t) {
  let n = o0 || (o0 = document.createRange());
  return n.setEnd(r, t ?? r.nodeValue.length), n.setStart(r, e || 0), n;
}, See = function() {
  o0 = null;
}, xu = function(r, e, t, n) {
  return t && (B1(r, e, t, n, -1) || B1(r, e, t, n, 1));
}, xee = /^(img|br|input|textarea|hr)$/i;
function B1(r, e, t, n, i) {
  for (var a; ; ) {
    if (r == t && e == n)
      return !0;
    if (e == (i < 0 ? 0 : Sa(r))) {
      let s = r.parentNode;
      if (!s || s.nodeType != 1 || Th(r) || xee.test(r.nodeName) || r.contentEditable == "false")
        return !1;
      e = Yn(r) + (i < 0 ? 0 : 1), r = s;
    } else if (r.nodeType == 1) {
      let s = r.childNodes[e + (i < 0 ? -1 : 0)];
      if (s.nodeType == 1 && s.contentEditable == "false")
        if (!((a = s.pmViewDesc) === null || a === void 0) && a.ignoreForSelection)
          e += i;
        else
          return !1;
      else
        r = s, e = i < 0 ? Sa(r) : 0;
    } else
      return !1;
  }
}
function Sa(r) {
  return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
}
function Eee(r, e) {
  for (; ; ) {
    if (r.nodeType == 3 && e)
      return r;
    if (r.nodeType == 1 && e > 0) {
      if (r.contentEditable == "false")
        return null;
      r = r.childNodes[e - 1], e = Sa(r);
    } else if (r.parentNode && !Th(r))
      e = Yn(r), r = r.parentNode;
    else
      return null;
  }
}
function Mee(r, e) {
  for (; ; ) {
    if (r.nodeType == 3 && e < r.nodeValue.length)
      return r;
    if (r.nodeType == 1 && e < r.childNodes.length) {
      if (r.contentEditable == "false")
        return null;
      r = r.childNodes[e], e = 0;
    } else if (r.parentNode && !Th(r))
      e = Yn(r) + 1, r = r.parentNode;
    else
      return null;
  }
}
function Nee(r, e, t) {
  for (let n = e == 0, i = e == Sa(r); n || i; ) {
    if (r == t)
      return !0;
    let a = Yn(r);
    if (r = r.parentNode, !r)
      return !1;
    n = n && a == 0, i = i && a == Sa(r);
  }
}
function Th(r) {
  let e;
  for (let t = r; t && !(e = t.pmViewDesc); t = t.parentNode)
    ;
  return e && e.node && e.node.isBlock && (e.dom == r || e.contentDOM == r);
}
const Mm = function(r) {
  return r.focusNode && xu(r.focusNode, r.focusOffset, r.anchorNode, r.anchorOffset);
};
function hu(r, e) {
  let t = document.createEvent("Event");
  return t.initEvent("keydown", !0, !0), t.keyCode = r, t.key = t.code = e, t;
}
function Oee(r) {
  let e = r.activeElement;
  for (; e && e.shadowRoot; )
    e = e.shadowRoot.activeElement;
  return e;
}
function Dee(r, e, t) {
  if (r.caretPositionFromPoint)
    try {
      let n = r.caretPositionFromPoint(e, t);
      if (n)
        return { node: n.offsetNode, offset: Math.min(Sa(n.offsetNode), n.offset) };
    } catch {
    }
  if (r.caretRangeFromPoint) {
    let n = r.caretRangeFromPoint(e, t);
    if (n)
      return { node: n.startContainer, offset: Math.min(Sa(n.startContainer), n.startOffset) };
  }
}
const Bo = typeof navigator < "u" ? navigator : null, F1 = typeof document < "u" ? document : null, Cl = Bo && Bo.userAgent || "", s0 = /Edge\/(\d+)/.exec(Cl), CS = /MSIE \d/.exec(Cl), l0 = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Cl), Gi = !!(CS || l0 || s0), pl = CS ? document.documentMode : l0 ? +l0[1] : s0 ? +s0[1] : 0, xa = !Gi && /gecko\/(\d+)/i.test(Cl);
xa && +(/Firefox\/(\d+)/.exec(Cl) || [0, 0])[1];
const u0 = !Gi && /Chrome\/(\d+)/.exec(Cl), Fn = !!u0, TS = u0 ? +u0[1] : 0, mi = !Gi && !!Bo && /Apple Computer/.test(Bo.vendor), of = mi && (/Mobile\/\w+/.test(Cl) || !!Bo && Bo.maxTouchPoints > 2), Ta = of || (Bo ? /Mac/.test(Bo.platform) : !1), SS = Bo ? /Win/.test(Bo.platform) : !1, bs = /Android \d/.test(Cl), Sh = !!F1 && "webkitFontSmoothing" in F1.documentElement.style, Aee = Sh ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
function Lee(r) {
  let e = r.defaultView && r.defaultView.visualViewport;
  return e ? {
    left: 0,
    right: e.width,
    top: 0,
    bottom: e.height
  } : {
    left: 0,
    right: r.documentElement.clientWidth,
    top: 0,
    bottom: r.documentElement.clientHeight
  };
}
function ms(r, e) {
  return typeof r == "number" ? r : r[e];
}
function Ree(r) {
  let e = r.getBoundingClientRect(), t = e.width / r.offsetWidth || 1, n = e.height / r.offsetHeight || 1;
  return {
    left: e.left,
    right: e.left + r.clientWidth * t,
    top: e.top,
    bottom: e.top + r.clientHeight * n
  };
}
function _1(r, e, t) {
  let n = r.someProp("scrollThreshold") || 0, i = r.someProp("scrollMargin") || 5, a = r.dom.ownerDocument;
  for (let s = t || r.dom; s; ) {
    if (s.nodeType != 1) {
      s = af(s);
      continue;
    }
    let u = s, f = u == a.body, p = f ? Lee(a) : Ree(u), y = 0, T = 0;
    if (e.top < p.top + ms(n, "top") ? T = -(p.top - e.top + ms(i, "top")) : e.bottom > p.bottom - ms(n, "bottom") && (T = e.bottom - e.top > p.bottom - p.top ? e.top + ms(i, "top") - p.top : e.bottom - p.bottom + ms(i, "bottom")), e.left < p.left + ms(n, "left") ? y = -(p.left - e.left + ms(i, "left")) : e.right > p.right - ms(n, "right") && (y = e.right - p.right + ms(i, "right")), y || T)
      if (f)
        a.defaultView.scrollBy(y, T);
      else {
        let O = u.scrollLeft, A = u.scrollTop;
        T && (u.scrollTop += T), y && (u.scrollLeft += y);
        let q = u.scrollLeft - O, U = u.scrollTop - A;
        e = { left: e.left - q, top: e.top - U, right: e.right - q, bottom: e.bottom - U };
      }
    let N = f ? "fixed" : getComputedStyle(s).position;
    if (/^(fixed|sticky)$/.test(N))
      break;
    s = N == "absolute" ? s.offsetParent : af(s);
  }
}
function Iee(r) {
  let e = r.dom.getBoundingClientRect(), t = Math.max(0, e.top), n, i;
  for (let a = (e.left + e.right) / 2, s = t + 1; s < Math.min(innerHeight, e.bottom); s += 5) {
    let u = r.root.elementFromPoint(a, s);
    if (!u || u == r.dom || !r.dom.contains(u))
      continue;
    let f = u.getBoundingClientRect();
    if (f.top >= t - 20) {
      n = u, i = f.top;
      break;
    }
  }
  return { refDOM: n, refTop: i, stack: xS(r.dom) };
}
function xS(r) {
  let e = [], t = r.ownerDocument;
  for (let n = r; n && (e.push({ dom: n, top: n.scrollTop, left: n.scrollLeft }), r != t); n = af(n))
    ;
  return e;
}
function Pee({ refDOM: r, refTop: e, stack: t }) {
  let n = r ? r.getBoundingClientRect().top : 0;
  ES(t, n == 0 ? 0 : n - e);
}
function ES(r, e) {
  for (let t = 0; t < r.length; t++) {
    let { dom: n, top: i, left: a } = r[t];
    n.scrollTop != i + e && (n.scrollTop = i + e), n.scrollLeft != a && (n.scrollLeft = a);
  }
}
let Vc = null;
function Bee(r) {
  if (r.setActive)
    return r.setActive();
  if (Vc)
    return r.focus(Vc);
  let e = xS(r);
  r.focus(Vc == null ? {
    get preventScroll() {
      return Vc = { preventScroll: !0 }, !0;
    }
  } : void 0), Vc || (Vc = !1, ES(e, 0));
}
function MS(r, e) {
  let t, n = 2e8, i, a = 0, s = e.top, u = e.top, f, p;
  for (let y = r.firstChild, T = 0; y; y = y.nextSibling, T++) {
    let N;
    if (y.nodeType == 1)
      N = y.getClientRects();
    else if (y.nodeType == 3)
      N = ys(y).getClientRects();
    else
      continue;
    for (let O = 0; O < N.length; O++) {
      let A = N[O];
      if (A.top <= s && A.bottom >= u) {
        s = Math.max(A.bottom, s), u = Math.min(A.top, u);
        let q = A.left > e.left ? A.left - e.left : A.right < e.left ? e.left - A.right : 0;
        if (q < n) {
          t = y, n = q, i = q && t.nodeType == 3 ? {
            left: A.right < e.left ? A.right : A.left,
            top: e.top
          } : e, y.nodeType == 1 && q && (a = T + (e.left >= (A.left + A.right) / 2 ? 1 : 0));
          continue;
        }
      } else A.top > e.top && !f && A.left <= e.left && A.right >= e.left && (f = y, p = { left: Math.max(A.left, Math.min(A.right, e.left)), top: A.top });
      !t && (e.left >= A.right && e.top >= A.top || e.left >= A.left && e.top >= A.bottom) && (a = T + 1);
    }
  }
  return !t && f && (t = f, i = p, n = 0), t && t.nodeType == 3 ? Fee(t, i) : !t || n && t.nodeType == 1 ? { node: r, offset: a } : MS(t, i);
}
function Fee(r, e) {
  let t = r.nodeValue.length, n = document.createRange(), i;
  for (let a = 0; a < t; a++) {
    n.setEnd(r, a + 1), n.setStart(r, a);
    let s = al(n, 1);
    if (s.top != s.bottom && K0(e, s)) {
      i = { node: r, offset: a + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
      break;
    }
  }
  return n.detach(), i || { node: r, offset: 0 };
}
function K0(r, e) {
  return r.left >= e.left - 1 && r.left <= e.right + 1 && r.top >= e.top - 1 && r.top <= e.bottom + 1;
}
function _ee(r, e) {
  let t = r.parentNode;
  return t && /^li$/i.test(t.nodeName) && e.left < r.getBoundingClientRect().left ? t : r;
}
function qee(r, e, t) {
  let { node: n, offset: i } = MS(e, t), a = -1;
  if (n.nodeType == 1 && !n.firstChild) {
    let s = n.getBoundingClientRect();
    a = s.left != s.right && t.left > (s.left + s.right) / 2 ? 1 : -1;
  }
  return r.docView.posFromDOM(n, i, a);
}
function zee(r, e, t, n) {
  let i = -1;
  for (let a = e, s = !1; a != r.dom; ) {
    let u = r.docView.nearestDesc(a, !0), f;
    if (!u)
      return null;
    if (u.dom.nodeType == 1 && (u.node.isBlock && u.parent || !u.contentDOM) && // Ignore elements with zero-size bounding rectangles
    ((f = u.dom.getBoundingClientRect()).width || f.height) && (u.node.isBlock && u.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(u.dom.nodeName) && (!s && f.left > n.left || f.top > n.top ? i = u.posBefore : (!s && f.right < n.left || f.bottom < n.top) && (i = u.posAfter), s = !0), !u.contentDOM && i < 0 && !u.node.isText))
      return (u.node.isBlock ? n.top < (f.top + f.bottom) / 2 : n.left < (f.left + f.right) / 2) ? u.posBefore : u.posAfter;
    a = u.dom.parentNode;
  }
  return i > -1 ? i : r.docView.posFromDOM(e, t, -1);
}
function NS(r, e, t) {
  let n = r.childNodes.length;
  if (n && t.top < t.bottom)
    for (let i = Math.max(0, Math.min(n - 1, Math.floor(n * (e.top - t.top) / (t.bottom - t.top)) - 2)), a = i; ; ) {
      let s = r.childNodes[a];
      if (s.nodeType == 1) {
        let u = s.getClientRects();
        for (let f = 0; f < u.length; f++) {
          let p = u[f];
          if (K0(e, p))
            return NS(s, e, p);
        }
      }
      if ((a = (a + 1) % n) == i)
        break;
    }
  return r;
}
function Hee(r, e) {
  let t = r.dom.ownerDocument, n, i = 0, a = Dee(t, e.left, e.top);
  a && ({ node: n, offset: i } = a);
  let s = (r.root.elementFromPoint ? r.root : t).elementFromPoint(e.left, e.top), u;
  if (!s || !r.dom.contains(s.nodeType != 1 ? s.parentNode : s)) {
    let p = r.dom.getBoundingClientRect();
    if (!K0(e, p) || (s = NS(r.dom, e, p), !s))
      return null;
  }
  if (mi)
    for (let p = s; n && p; p = af(p))
      p.draggable && (n = void 0);
  if (s = _ee(s, e), n) {
    if (xa && n.nodeType == 1 && (i = Math.min(i, n.childNodes.length), i < n.childNodes.length)) {
      let y = n.childNodes[i], T;
      y.nodeName == "IMG" && (T = y.getBoundingClientRect()).right <= e.left && T.bottom > e.top && i++;
    }
    let p;
    Sh && i && n.nodeType == 1 && (p = n.childNodes[i - 1]).nodeType == 1 && p.contentEditable == "false" && p.getBoundingClientRect().top >= e.top && i--, n == r.dom && i == n.childNodes.length - 1 && n.lastChild.nodeType == 1 && e.top > n.lastChild.getBoundingClientRect().bottom ? u = r.state.doc.content.size : (i == 0 || n.nodeType != 1 || n.childNodes[i - 1].nodeName != "BR") && (u = zee(r, n, i, e));
  }
  u == null && (u = qee(r, s, e));
  let f = r.docView.nearestDesc(s, !0);
  return { pos: u, inside: f ? f.posAtStart - f.border : -1 };
}
function q1(r) {
  return r.top < r.bottom || r.left < r.right;
}
function al(r, e) {
  let t = r.getClientRects();
  if (t.length) {
    let n = t[e < 0 ? 0 : t.length - 1];
    if (q1(n))
      return n;
  }
  return Array.prototype.find.call(t, q1) || r.getBoundingClientRect();
}
const Vee = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
function OS(r, e, t) {
  let { node: n, offset: i, atom: a } = r.docView.domFromPos(e, t < 0 ? -1 : 1), s = Sh || xa;
  if (n.nodeType == 3)
    if (s && (Vee.test(n.nodeValue) || (t < 0 ? !i : i == n.nodeValue.length))) {
      let f = al(ys(n, i, i), t);
      if (xa && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
        let p = al(ys(n, i - 1, i - 1), -1);
        if (p.top == f.top) {
          let y = al(ys(n, i, i + 1), -1);
          if (y.top != f.top)
            return Jd(y, y.left < p.left);
        }
      }
      return f;
    } else {
      let f = i, p = i, y = t < 0 ? 1 : -1;
      return t < 0 && !i ? (p++, y = -1) : t >= 0 && i == n.nodeValue.length ? (f--, y = 1) : t < 0 ? f-- : p++, Jd(al(ys(n, f, p), y), y < 0);
    }
  if (!r.state.doc.resolve(e - (a || 0)).parent.inlineContent) {
    if (a == null && i && (t < 0 || i == Sa(n))) {
      let f = n.childNodes[i - 1];
      if (f.nodeType == 1)
        return ky(f.getBoundingClientRect(), !1);
    }
    if (a == null && i < Sa(n)) {
      let f = n.childNodes[i];
      if (f.nodeType == 1)
        return ky(f.getBoundingClientRect(), !0);
    }
    return ky(n.getBoundingClientRect(), t >= 0);
  }
  if (a == null && i && (t < 0 || i == Sa(n))) {
    let f = n.childNodes[i - 1], p = f.nodeType == 3 ? ys(f, Sa(f) - (s ? 0 : 1)) : f.nodeType == 1 && (f.nodeName != "BR" || !f.nextSibling) ? f : null;
    if (p)
      return Jd(al(p, 1), !1);
  }
  if (a == null && i < Sa(n)) {
    let f = n.childNodes[i];
    for (; f.pmViewDesc && f.pmViewDesc.ignoreForCoords; )
      f = f.nextSibling;
    let p = f ? f.nodeType == 3 ? ys(f, 0, s ? 0 : 1) : f.nodeType == 1 ? f : null : null;
    if (p)
      return Jd(al(p, -1), !0);
  }
  return Jd(al(n.nodeType == 3 ? ys(n) : n, -t), t >= 0);
}
function Jd(r, e) {
  if (r.width == 0)
    return r;
  let t = e ? r.left : r.right;
  return { top: r.top, bottom: r.bottom, left: t, right: t };
}
function ky(r, e) {
  if (r.height == 0)
    return r;
  let t = e ? r.top : r.bottom;
  return { top: t, bottom: t, left: r.left, right: r.right };
}
function DS(r, e, t) {
  let n = r.state, i = r.root.activeElement;
  n != e && r.updateState(e), i != r.dom && r.focus();
  try {
    return t();
  } finally {
    n != e && r.updateState(n), i != r.dom && i && i.focus();
  }
}
function Uee(r, e, t) {
  let n = e.selection, i = t == "up" ? n.$from : n.$to;
  return DS(r, e, () => {
    let { node: a } = r.docView.domFromPos(i.pos, t == "up" ? -1 : 1);
    for (; ; ) {
      let u = r.docView.nearestDesc(a, !0);
      if (!u)
        break;
      if (u.node.isBlock) {
        a = u.contentDOM || u.dom;
        break;
      }
      a = u.dom.parentNode;
    }
    let s = OS(r, i.pos, 1);
    for (let u = a.firstChild; u; u = u.nextSibling) {
      let f;
      if (u.nodeType == 1)
        f = u.getClientRects();
      else if (u.nodeType == 3)
        f = ys(u, 0, u.nodeValue.length).getClientRects();
      else
        continue;
      for (let p = 0; p < f.length; p++) {
        let y = f[p];
        if (y.bottom > y.top + 1 && (t == "up" ? s.top - y.top > (y.bottom - s.top) * 2 : y.bottom - s.bottom > (s.bottom - y.top) * 2))
          return !1;
      }
    }
    return !0;
  });
}
const $ee = /[\u0590-\u08ac]/;
function Wee(r, e, t) {
  let { $head: n } = e.selection;
  if (!n.parent.isTextblock)
    return !1;
  let i = n.parentOffset, a = !i, s = i == n.parent.content.size, u = r.domSelection();
  return u ? !$ee.test(n.parent.textContent) || !u.modify ? t == "left" || t == "backward" ? a : s : DS(r, e, () => {
    let { focusNode: f, focusOffset: p, anchorNode: y, anchorOffset: T } = r.domSelectionRange(), N = u.caretBidiLevel;
    u.modify("move", t, "character");
    let O = n.depth ? r.docView.domAfterPos(n.before()) : r.dom, { focusNode: A, focusOffset: q } = r.domSelectionRange(), U = A && !O.contains(A.nodeType == 1 ? A : A.parentNode) || f == A && p == q;
    try {
      u.collapse(y, T), f && (f != y || p != T) && u.extend && u.extend(f, p);
    } catch {
    }
    return N != null && (u.caretBidiLevel = N), U;
  }) : n.pos == n.start() || n.pos == n.end();
}
let z1 = null, H1 = null, V1 = !1;
function jee(r, e, t) {
  return z1 == e && H1 == t ? V1 : (z1 = e, H1 = t, V1 = t == "up" || t == "down" ? Uee(r, e, t) : Wee(r, e, t));
}
const Ea = 0, U1 = 1, vu = 2, Fo = 3;
class xh {
  constructor(e, t, n, i) {
    this.parent = e, this.children = t, this.dom = n, this.contentDOM = i, this.dirty = Ea, n.pmViewDesc = this;
  }
  // Used to check whether a given description corresponds to a
  // widget/mark/node.
  matchesWidget(e) {
    return !1;
  }
  matchesMark(e) {
    return !1;
  }
  matchesNode(e, t, n) {
    return !1;
  }
  matchesHack(e) {
    return !1;
  }
  // When parsing in-editor content (in domchange.js), we allow
  // descriptions to determine the parse rules that should be used to
  // parse them.
  parseRule() {
    return null;
  }
  // Used by the editor's event handler to ignore events that come
  // from certain descs.
  stopEvent(e) {
    return !1;
  }
  // The size of the content represented by this desc.
  get size() {
    let e = 0;
    for (let t = 0; t < this.children.length; t++)
      e += this.children[t].size;
    return e;
  }
  // For block nodes, this represents the space taken up by their
  // start/end tokens.
  get border() {
    return 0;
  }
  destroy() {
    this.parent = void 0, this.dom.pmViewDesc == this && (this.dom.pmViewDesc = void 0);
    for (let e = 0; e < this.children.length; e++)
      this.children[e].destroy();
  }
  posBeforeChild(e) {
    for (let t = 0, n = this.posAtStart; ; t++) {
      let i = this.children[t];
      if (i == e)
        return n;
      n += i.size;
    }
  }
  get posBefore() {
    return this.parent.posBeforeChild(this);
  }
  get posAtStart() {
    return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
  }
  get posAfter() {
    return this.posBefore + this.size;
  }
  get posAtEnd() {
    return this.posAtStart + this.size - 2 * this.border;
  }
  localPosFromDOM(e, t, n) {
    if (this.contentDOM && this.contentDOM.contains(e.nodeType == 1 ? e : e.parentNode))
      if (n < 0) {
        let a, s;
        if (e == this.contentDOM)
          a = e.childNodes[t - 1];
        else {
          for (; e.parentNode != this.contentDOM; )
            e = e.parentNode;
          a = e.previousSibling;
        }
        for (; a && !((s = a.pmViewDesc) && s.parent == this); )
          a = a.previousSibling;
        return a ? this.posBeforeChild(s) + s.size : this.posAtStart;
      } else {
        let a, s;
        if (e == this.contentDOM)
          a = e.childNodes[t];
        else {
          for (; e.parentNode != this.contentDOM; )
            e = e.parentNode;
          a = e.nextSibling;
        }
        for (; a && !((s = a.pmViewDesc) && s.parent == this); )
          a = a.nextSibling;
        return a ? this.posBeforeChild(s) : this.posAtEnd;
      }
    let i;
    if (e == this.dom && this.contentDOM)
      i = t > Yn(this.contentDOM);
    else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
      i = e.compareDocumentPosition(this.contentDOM) & 2;
    else if (this.dom.firstChild) {
      if (t == 0)
        for (let a = e; ; a = a.parentNode) {
          if (a == this.dom) {
            i = !1;
            break;
          }
          if (a.previousSibling)
            break;
        }
      if (i == null && t == e.childNodes.length)
        for (let a = e; ; a = a.parentNode) {
          if (a == this.dom) {
            i = !0;
            break;
          }
          if (a.nextSibling)
            break;
        }
    }
    return i ?? n > 0 ? this.posAtEnd : this.posAtStart;
  }
  nearestDesc(e, t = !1) {
    for (let n = !0, i = e; i; i = i.parentNode) {
      let a = this.getDesc(i), s;
      if (a && (!t || a.node))
        if (n && (s = a.nodeDOM) && !(s.nodeType == 1 ? s.contains(e.nodeType == 1 ? e : e.parentNode) : s == e))
          n = !1;
        else
          return a;
    }
  }
  getDesc(e) {
    let t = e.pmViewDesc;
    for (let n = t; n; n = n.parent)
      if (n == this)
        return t;
  }
  posFromDOM(e, t, n) {
    for (let i = e; i; i = i.parentNode) {
      let a = this.getDesc(i);
      if (a)
        return a.localPosFromDOM(e, t, n);
    }
    return -1;
  }
  // Find the desc for the node after the given pos, if any. (When a
  // parent node overrode rendering, there might not be one.)
  descAt(e) {
    for (let t = 0, n = 0; t < this.children.length; t++) {
      let i = this.children[t], a = n + i.size;
      if (n == e && a != n) {
        for (; !i.border && i.children.length; )
          for (let s = 0; s < i.children.length; s++) {
            let u = i.children[s];
            if (u.size) {
              i = u;
              break;
            }
          }
        return i;
      }
      if (e < a)
        return i.descAt(e - n - i.border);
      n = a;
    }
  }
  domFromPos(e, t) {
    if (!this.contentDOM)
      return { node: this.dom, offset: 0, atom: e + 1 };
    let n = 0, i = 0;
    for (let a = 0; n < this.children.length; n++) {
      let s = this.children[n], u = a + s.size;
      if (u > e || s instanceof LS) {
        i = e - a;
        break;
      }
      a = u;
    }
    if (i)
      return this.children[n].domFromPos(i - this.children[n].border, t);
    for (let a; n && !(a = this.children[n - 1]).size && a instanceof AS && a.side >= 0; n--)
      ;
    if (t <= 0) {
      let a, s = !0;
      for (; a = n ? this.children[n - 1] : null, !(!a || a.dom.parentNode == this.contentDOM); n--, s = !1)
        ;
      return a && t && s && !a.border && !a.domAtom ? a.domFromPos(a.size, t) : { node: this.contentDOM, offset: a ? Yn(a.dom) + 1 : 0 };
    } else {
      let a, s = !0;
      for (; a = n < this.children.length ? this.children[n] : null, !(!a || a.dom.parentNode == this.contentDOM); n++, s = !1)
        ;
      return a && s && !a.border && !a.domAtom ? a.domFromPos(0, t) : { node: this.contentDOM, offset: a ? Yn(a.dom) : this.contentDOM.childNodes.length };
    }
  }
  // Used to find a DOM range in a single parent for a given changed
  // range.
  parseRange(e, t, n = 0) {
    if (this.children.length == 0)
      return { node: this.contentDOM, from: e, to: t, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
    let i = -1, a = -1;
    for (let s = n, u = 0; ; u++) {
      let f = this.children[u], p = s + f.size;
      if (i == -1 && e <= p) {
        let y = s + f.border;
        if (e >= y && t <= p - f.border && f.node && f.contentDOM && this.contentDOM.contains(f.contentDOM))
          return f.parseRange(e, t, y);
        e = s;
        for (let T = u; T > 0; T--) {
          let N = this.children[T - 1];
          if (N.size && N.dom.parentNode == this.contentDOM && !N.emptyChildAt(1)) {
            i = Yn(N.dom) + 1;
            break;
          }
          e -= N.size;
        }
        i == -1 && (i = 0);
      }
      if (i > -1 && (p > t || u == this.children.length - 1)) {
        t = p;
        for (let y = u + 1; y < this.children.length; y++) {
          let T = this.children[y];
          if (T.size && T.dom.parentNode == this.contentDOM && !T.emptyChildAt(-1)) {
            a = Yn(T.dom);
            break;
          }
          t += T.size;
        }
        a == -1 && (a = this.contentDOM.childNodes.length);
        break;
      }
      s = p;
    }
    return { node: this.contentDOM, from: e, to: t, fromOffset: i, toOffset: a };
  }
  emptyChildAt(e) {
    if (this.border || !this.contentDOM || !this.children.length)
      return !1;
    let t = this.children[e < 0 ? 0 : this.children.length - 1];
    return t.size == 0 || t.emptyChildAt(e);
  }
  domAfterPos(e) {
    let { node: t, offset: n } = this.domFromPos(e, 0);
    if (t.nodeType != 1 || n == t.childNodes.length)
      throw new RangeError("No node after pos " + e);
    return t.childNodes[n];
  }
  // View descs are responsible for setting any selection that falls
  // entirely inside of them, so that custom implementations can do
  // custom things with the selection. Note that this falls apart when
  // a selection starts in such a node and ends in another, in which
  // case we just use whatever domFromPos produces as a best effort.
  setSelection(e, t, n, i = !1) {
    let a = Math.min(e, t), s = Math.max(e, t);
    for (let O = 0, A = 0; O < this.children.length; O++) {
      let q = this.children[O], U = A + q.size;
      if (a > A && s < U)
        return q.setSelection(e - A - q.border, t - A - q.border, n, i);
      A = U;
    }
    let u = this.domFromPos(e, e ? -1 : 1), f = t == e ? u : this.domFromPos(t, t ? -1 : 1), p = n.root.getSelection(), y = n.domSelectionRange(), T = !1;
    if ((xa || mi) && e == t) {
      let { node: O, offset: A } = u;
      if (O.nodeType == 3) {
        if (T = !!(A && O.nodeValue[A - 1] == `
`), T && A == O.nodeValue.length)
          for (let q = O, U; q; q = q.parentNode) {
            if (U = q.nextSibling) {
              U.nodeName == "BR" && (u = f = { node: U.parentNode, offset: Yn(U) + 1 });
              break;
            }
            let j = q.pmViewDesc;
            if (j && j.node && j.node.isBlock)
              break;
          }
      } else {
        let q = O.childNodes[A - 1];
        T = q && (q.nodeName == "BR" || q.contentEditable == "false");
      }
    }
    if (xa && y.focusNode && y.focusNode != f.node && y.focusNode.nodeType == 1) {
      let O = y.focusNode.childNodes[y.focusOffset];
      O && O.contentEditable == "false" && (i = !0);
    }
    if (!(i || T && mi) && xu(u.node, u.offset, y.anchorNode, y.anchorOffset) && xu(f.node, f.offset, y.focusNode, y.focusOffset))
      return;
    let N = !1;
    if ((p.extend || e == t) && !(T && xa)) {
      p.collapse(u.node, u.offset);
      try {
        e != t && p.extend(f.node, f.offset), N = !0;
      } catch {
      }
    }
    if (!N) {
      if (e > t) {
        let A = u;
        u = f, f = A;
      }
      let O = document.createRange();
      O.setEnd(f.node, f.offset), O.setStart(u.node, u.offset), p.removeAllRanges(), p.addRange(O);
    }
  }
  ignoreMutation(e) {
    return !this.contentDOM && e.type != "selection";
  }
  get contentLost() {
    return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
  }
  // Remove a subtree of the element tree that has been touched
  // by a DOM change, so that the next update will redraw it.
  markDirty(e, t) {
    for (let n = 0, i = 0; i < this.children.length; i++) {
      let a = this.children[i], s = n + a.size;
      if (n == s ? e <= s && t >= n : e < s && t > n) {
        let u = n + a.border, f = s - a.border;
        if (e >= u && t <= f) {
          this.dirty = e == n || t == s ? vu : U1, e == u && t == f && (a.contentLost || a.dom.parentNode != this.contentDOM) ? a.dirty = Fo : a.markDirty(e - u, t - u);
          return;
        } else
          a.dirty = a.dom == a.contentDOM && a.dom.parentNode == this.contentDOM && !a.children.length ? vu : Fo;
      }
      n = s;
    }
    this.dirty = vu;
  }
  markParentsDirty() {
    let e = 1;
    for (let t = this.parent; t; t = t.parent, e++) {
      let n = e == 1 ? vu : U1;
      t.dirty < n && (t.dirty = n);
    }
  }
  get domAtom() {
    return !1;
  }
  get ignoreForCoords() {
    return !1;
  }
  get ignoreForSelection() {
    return !1;
  }
  isText(e) {
    return !1;
  }
}
class AS extends xh {
  constructor(e, t, n, i) {
    let a, s = t.type.toDOM;
    if (typeof s == "function" && (s = s(n, () => {
      if (!a)
        return i;
      if (a.parent)
        return a.parent.posBeforeChild(a);
    })), !t.type.spec.raw) {
      if (s.nodeType != 1) {
        let u = document.createElement("span");
        u.appendChild(s), s = u;
      }
      s.contentEditable = "false", s.classList.add("ProseMirror-widget");
    }
    super(e, [], s, null), this.widget = t, this.widget = t, a = this;
  }
  matchesWidget(e) {
    return this.dirty == Ea && e.type.eq(this.widget.type);
  }
  parseRule() {
    return { ignore: !0 };
  }
  stopEvent(e) {
    let t = this.widget.spec.stopEvent;
    return t ? t(e) : !1;
  }
  ignoreMutation(e) {
    return e.type != "selection" || this.widget.spec.ignoreSelection;
  }
  destroy() {
    this.widget.type.destroy(this.dom), super.destroy();
  }
  get domAtom() {
    return !0;
  }
  get ignoreForSelection() {
    return !!this.widget.type.spec.relaxedSide;
  }
  get side() {
    return this.widget.type.side;
  }
}
class Gee extends xh {
  constructor(e, t, n, i) {
    super(e, [], t, null), this.textDOM = n, this.text = i;
  }
  get size() {
    return this.text.length;
  }
  localPosFromDOM(e, t) {
    return e != this.textDOM ? this.posAtStart + (t ? this.size : 0) : this.posAtStart + t;
  }
  domFromPos(e) {
    return { node: this.textDOM, offset: e };
  }
  ignoreMutation(e) {
    return e.type === "characterData" && e.target.nodeValue == e.oldValue;
  }
}
class Eu extends xh {
  constructor(e, t, n, i, a) {
    super(e, [], n, i), this.mark = t, this.spec = a;
  }
  static create(e, t, n, i) {
    let a = i.nodeViews[t.type.name], s = a && a(t, i, n);
    return (!s || !s.dom) && (s = kf.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new Eu(e, t, s.dom, s.contentDOM || s.dom, s);
  }
  parseRule() {
    return this.dirty & Fo || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
  }
  matchesMark(e) {
    return this.dirty != Fo && this.mark.eq(e);
  }
  markDirty(e, t) {
    if (super.markDirty(e, t), this.dirty != Ea) {
      let n = this.parent;
      for (; !n.node; )
        n = n.parent;
      n.dirty < this.dirty && (n.dirty = this.dirty), this.dirty = Ea;
    }
  }
  slice(e, t, n) {
    let i = Eu.create(this.parent, this.mark, !0, n), a = this.children, s = this.size;
    t < s && (a = f0(a, t, s, n)), e > 0 && (a = f0(a, 0, e, n));
    for (let u = 0; u < a.length; u++)
      a[u].parent = i;
    return i.children = a, i;
  }
  ignoreMutation(e) {
    return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
  }
  destroy() {
    this.spec.destroy && this.spec.destroy(), super.destroy();
  }
}
class vl extends xh {
  constructor(e, t, n, i, a, s, u, f, p) {
    super(e, [], a, s), this.node = t, this.outerDeco = n, this.innerDeco = i, this.nodeDOM = u;
  }
  // By default, a node is rendered using the `toDOM` method from the
  // node type spec. But client code can use the `nodeViews` spec to
  // supply a custom node view, which can influence various aspects of
  // the way the node works.
  //
  // (Using subclassing for this was intentionally decided against,
  // since it'd require exposing a whole slew of finicky
  // implementation details to the user code that they probably will
  // never need.)
  static create(e, t, n, i, a, s) {
    let u = a.nodeViews[t.type.name], f, p = u && u(t, a, () => {
      if (!f)
        return s;
      if (f.parent)
        return f.parent.posBeforeChild(f);
    }, n, i), y = p && p.dom, T = p && p.contentDOM;
    if (t.isText) {
      if (!y)
        y = document.createTextNode(t.text);
      else if (y.nodeType != 3)
        throw new RangeError("Text must be rendered as a DOM text node");
    } else y || ({ dom: y, contentDOM: T } = kf.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
    !T && !t.isText && y.nodeName != "BR" && (y.hasAttribute("contenteditable") || (y.contentEditable = "false"), t.type.spec.draggable && (y.draggable = !0));
    let N = y;
    return y = PS(y, n, t), p ? f = new Kee(e, t, n, i, y, T || null, N, p, a, s + 1) : t.isText ? new Nm(e, t, n, i, y, N, a) : new vl(e, t, n, i, y, T || null, N, a, s + 1);
  }
  parseRule() {
    if (this.node.type.spec.reparseInView)
      return null;
    let e = { node: this.node.type.name, attrs: this.node.attrs };
    if (this.node.type.whitespace == "pre" && (e.preserveWhitespace = "full"), !this.contentDOM)
      e.getContent = () => this.node.content;
    else if (!this.contentLost)
      e.contentElement = this.contentDOM;
    else {
      for (let t = this.children.length - 1; t >= 0; t--) {
        let n = this.children[t];
        if (this.dom.contains(n.dom.parentNode)) {
          e.contentElement = n.dom.parentNode;
          break;
        }
      }
      e.contentElement || (e.getContent = () => Qe.empty);
    }
    return e;
  }
  matchesNode(e, t, n) {
    return this.dirty == Ea && e.eq(this.node) && Zv(t, this.outerDeco) && n.eq(this.innerDeco);
  }
  get size() {
    return this.node.nodeSize;
  }
  get border() {
    return this.node.isLeaf ? 0 : 1;
  }
  // Syncs `this.children` to match `this.node.content` and the local
  // decorations, possibly introducing nesting for marks. Then, in a
  // separate step, syncs the DOM inside `this.contentDOM` to
  // `this.children`.
  updateChildren(e, t) {
    let n = this.node.inlineContent, i = t, a = e.composing ? this.localCompositionInfo(e, t) : null, s = a && a.pos > -1 ? a : null, u = a && a.pos < 0, f = new Qee(this, s && s.node, e);
    Zee(this.node, this.innerDeco, (p, y, T) => {
      p.spec.marks ? f.syncToMarks(p.spec.marks, n, e) : p.type.side >= 0 && !T && f.syncToMarks(y == this.node.childCount ? Tr.none : this.node.child(y).marks, n, e), f.placeWidget(p, e, i);
    }, (p, y, T, N) => {
      f.syncToMarks(p.marks, n, e);
      let O;
      f.findNodeMatch(p, y, T, N) || u && e.state.selection.from > i && e.state.selection.to < i + p.nodeSize && (O = f.findIndexWithChild(a.node)) > -1 && f.updateNodeAt(p, y, T, O, e) || f.updateNextNode(p, y, T, e, N, i) || f.addNode(p, y, T, e, i), i += p.nodeSize;
    }), f.syncToMarks([], n, e), this.node.isTextblock && f.addTextblockHacks(), f.destroyRest(), (f.changed || this.dirty == vu) && (s && this.protectLocalComposition(e, s), RS(this.contentDOM, this.children, e), of && ete(this.dom));
  }
  localCompositionInfo(e, t) {
    let { from: n, to: i } = e.state.selection;
    if (!(e.state.selection instanceof dr) || n < t || i > t + this.node.content.size)
      return null;
    let a = e.input.compositionNode;
    if (!a || !this.dom.contains(a.parentNode))
      return null;
    if (this.node.inlineContent) {
      let s = a.nodeValue, u = tte(this.node.content, s, n - t, i - t);
      return u < 0 ? null : { node: a, pos: u, text: s };
    } else
      return { node: a, pos: -1, text: "" };
  }
  protectLocalComposition(e, { node: t, pos: n, text: i }) {
    if (this.getDesc(t))
      return;
    let a = t;
    for (; a.parentNode != this.contentDOM; a = a.parentNode) {
      for (; a.previousSibling; )
        a.parentNode.removeChild(a.previousSibling);
      for (; a.nextSibling; )
        a.parentNode.removeChild(a.nextSibling);
      a.pmViewDesc && (a.pmViewDesc = void 0);
    }
    let s = new Gee(this, a, t, i);
    e.input.compositionNodes.push(s), this.children = f0(this.children, n, n + i.length, e, s);
  }
  // If this desc must be updated to match the given node decoration,
  // do so and return true.
  update(e, t, n, i) {
    return this.dirty == Fo || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, n, i), !0);
  }
  updateInner(e, t, n, i) {
    this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = Ea;
  }
  updateOuterDeco(e) {
    if (Zv(e, this.outerDeco))
      return;
    let t = this.nodeDOM.nodeType != 1, n = this.dom;
    this.dom = IS(this.dom, this.nodeDOM, c0(this.outerDeco, this.node, t), c0(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
  }
  // Mark this node as being the selected node.
  selectNode() {
    this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.add("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && (this.nodeDOM.draggable = !0));
  }
  // Remove selected node marking from this node.
  deselectNode() {
    this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.remove("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && this.nodeDOM.removeAttribute("draggable"));
  }
  get domAtom() {
    return this.node.isAtom;
  }
}
function $1(r, e, t, n, i) {
  PS(n, e, r);
  let a = new vl(void 0, r, e, t, n, n, n, i, 0);
  return a.contentDOM && a.updateChildren(i, 0), a;
}
class Nm extends vl {
  constructor(e, t, n, i, a, s, u) {
    super(e, t, n, i, a, null, s, u, 0);
  }
  parseRule() {
    let e = this.nodeDOM.parentNode;
    for (; e && e != this.dom && !e.pmIsDeco; )
      e = e.parentNode;
    return { skip: e || !0 };
  }
  update(e, t, n, i) {
    return this.dirty == Fo || this.dirty != Ea && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != Ea || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = Ea, !0);
  }
  inParent() {
    let e = this.parent.contentDOM;
    for (let t = this.nodeDOM; t; t = t.parentNode)
      if (t == e)
        return !0;
    return !1;
  }
  domFromPos(e) {
    return { node: this.nodeDOM, offset: e };
  }
  localPosFromDOM(e, t, n) {
    return e == this.nodeDOM ? this.posAtStart + Math.min(t, this.node.text.length) : super.localPosFromDOM(e, t, n);
  }
  ignoreMutation(e) {
    return e.type != "characterData" && e.type != "selection";
  }
  slice(e, t, n) {
    let i = this.node.cut(e, t), a = document.createTextNode(i.text);
    return new Nm(this.parent, i, this.outerDeco, this.innerDeco, a, a, n);
  }
  markDirty(e, t) {
    super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = Fo);
  }
  get domAtom() {
    return !1;
  }
  isText(e) {
    return this.node.text == e;
  }
}
class LS extends xh {
  parseRule() {
    return { ignore: !0 };
  }
  matchesHack(e) {
    return this.dirty == Ea && this.dom.nodeName == e;
  }
  get domAtom() {
    return !0;
  }
  get ignoreForCoords() {
    return this.dom.nodeName == "IMG";
  }
}
class Kee extends vl {
  constructor(e, t, n, i, a, s, u, f, p, y) {
    super(e, t, n, i, a, s, u, p, y), this.spec = f;
  }
  // A custom `update` method gets to decide whether the update goes
  // through. If it does, and there's a `contentDOM` node, our logic
  // updates the children.
  update(e, t, n, i) {
    if (this.dirty == Fo)
      return !1;
    if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
      let a = this.spec.update(e, t, n);
      return a && this.updateInner(e, t, n, i), a;
    } else return !this.contentDOM && !e.isLeaf ? !1 : super.update(e, t, n, i);
  }
  selectNode() {
    this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
  }
  deselectNode() {
    this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();
  }
  setSelection(e, t, n, i) {
    this.spec.setSelection ? this.spec.setSelection(e, t, n.root) : super.setSelection(e, t, n, i);
  }
  destroy() {
    this.spec.destroy && this.spec.destroy(), super.destroy();
  }
  stopEvent(e) {
    return this.spec.stopEvent ? this.spec.stopEvent(e) : !1;
  }
  ignoreMutation(e) {
    return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
  }
}
function RS(r, e, t) {
  let n = r.firstChild, i = !1;
  for (let a = 0; a < e.length; a++) {
    let s = e[a], u = s.dom;
    if (u.parentNode == r) {
      for (; u != n; )
        n = W1(n), i = !0;
      n = n.nextSibling;
    } else
      i = !0, r.insertBefore(u, n);
    if (s instanceof Eu) {
      let f = n ? n.previousSibling : r.lastChild;
      RS(s.contentDOM, s.children, t), n = f ? f.nextSibling : r.firstChild;
    }
  }
  for (; n; )
    n = W1(n), i = !0;
  i && t.trackWrites == r && (t.trackWrites = null);
}
const lh = function(r) {
  r && (this.nodeName = r);
};
lh.prototype = /* @__PURE__ */ Object.create(null);
const mu = [new lh()];
function c0(r, e, t) {
  if (r.length == 0)
    return mu;
  let n = t ? mu[0] : new lh(), i = [n];
  for (let a = 0; a < r.length; a++) {
    let s = r[a].type.attrs;
    if (s) {
      s.nodeName && i.push(n = new lh(s.nodeName));
      for (let u in s) {
        let f = s[u];
        f != null && (t && i.length == 1 && i.push(n = new lh(e.isInline ? "span" : "div")), u == "class" ? n.class = (n.class ? n.class + " " : "") + f : u == "style" ? n.style = (n.style ? n.style + ";" : "") + f : u != "nodeName" && (n[u] = f));
      }
    }
  }
  return i;
}
function IS(r, e, t, n) {
  if (t == mu && n == mu)
    return e;
  let i = e;
  for (let a = 0; a < n.length; a++) {
    let s = n[a], u = t[a];
    if (a) {
      let f;
      u && u.nodeName == s.nodeName && i != r && (f = i.parentNode) && f.nodeName.toLowerCase() == s.nodeName || (f = document.createElement(s.nodeName), f.pmIsDeco = !0, f.appendChild(i), u = mu[0]), i = f;
    }
    Jee(i, u || mu[0], s);
  }
  return i;
}
function Jee(r, e, t) {
  for (let n in e)
    n != "class" && n != "style" && n != "nodeName" && !(n in t) && r.removeAttribute(n);
  for (let n in t)
    n != "class" && n != "style" && n != "nodeName" && t[n] != e[n] && r.setAttribute(n, t[n]);
  if (e.class != t.class) {
    let n = e.class ? e.class.split(" ").filter(Boolean) : [], i = t.class ? t.class.split(" ").filter(Boolean) : [];
    for (let a = 0; a < n.length; a++)
      i.indexOf(n[a]) == -1 && r.classList.remove(n[a]);
    for (let a = 0; a < i.length; a++)
      n.indexOf(i[a]) == -1 && r.classList.add(i[a]);
    r.classList.length == 0 && r.removeAttribute("class");
  }
  if (e.style != t.style) {
    if (e.style) {
      let n = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, i;
      for (; i = n.exec(e.style); )
        r.style.removeProperty(i[1]);
    }
    t.style && (r.style.cssText += t.style);
  }
}
function PS(r, e, t) {
  return IS(r, r, mu, c0(e, t, r.nodeType != 1));
}
function Zv(r, e) {
  if (r.length != e.length)
    return !1;
  for (let t = 0; t < r.length; t++)
    if (!r[t].type.eq(e[t].type))
      return !1;
  return !0;
}
function W1(r) {
  let e = r.nextSibling;
  return r.parentNode.removeChild(r), e;
}
class Qee {
  constructor(e, t, n) {
    this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = Xee(e.node.content, e);
  }
  // Destroy and remove the children between the given indices in
  // `this.top`.
  destroyBetween(e, t) {
    if (e != t) {
      for (let n = e; n < t; n++)
        this.top.children[n].destroy();
      this.top.children.splice(e, t - e), this.changed = !0;
    }
  }
  // Destroy all remaining children in `this.top`.
  destroyRest() {
    this.destroyBetween(this.index, this.top.children.length);
  }
  // Sync the current stack of mark descs with the given array of
  // marks, reusing existing mark descs when possible.
  syncToMarks(e, t, n) {
    let i = 0, a = this.stack.length >> 1, s = Math.min(a, e.length);
    for (; i < s && (i == a - 1 ? this.top : this.stack[i + 1 << 1]).matchesMark(e[i]) && e[i].type.spec.spanning !== !1; )
      i++;
    for (; i < a; )
      this.destroyRest(), this.top.dirty = Ea, this.index = this.stack.pop(), this.top = this.stack.pop(), a--;
    for (; a < e.length; ) {
      this.stack.push(this.top, this.index + 1);
      let u = -1;
      for (let f = this.index; f < Math.min(this.index + 3, this.top.children.length); f++) {
        let p = this.top.children[f];
        if (p.matchesMark(e[a]) && !this.isLocked(p.dom)) {
          u = f;
          break;
        }
      }
      if (u > -1)
        u > this.index && (this.changed = !0, this.destroyBetween(this.index, u)), this.top = this.top.children[this.index];
      else {
        let f = Eu.create(this.top, e[a], t, n);
        this.top.children.splice(this.index, 0, f), this.top = f, this.changed = !0;
      }
      this.index = 0, a++;
    }
  }
  // Try to find a node desc matching the given data. Skip over it and
  // return true when successful.
  findNodeMatch(e, t, n, i) {
    let a = -1, s;
    if (i >= this.preMatch.index && (s = this.preMatch.matches[i - this.preMatch.index]).parent == this.top && s.matchesNode(e, t, n))
      a = this.top.children.indexOf(s, this.index);
    else
      for (let u = this.index, f = Math.min(this.top.children.length, u + 5); u < f; u++) {
        let p = this.top.children[u];
        if (p.matchesNode(e, t, n) && !this.preMatch.matched.has(p)) {
          a = u;
          break;
        }
      }
    return a < 0 ? !1 : (this.destroyBetween(this.index, a), this.index++, !0);
  }
  updateNodeAt(e, t, n, i, a) {
    let s = this.top.children[i];
    return s.dirty == Fo && s.dom == s.contentDOM && (s.dirty = vu), s.update(e, t, n, a) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
  }
  findIndexWithChild(e) {
    for (; ; ) {
      let t = e.parentNode;
      if (!t)
        return -1;
      if (t == this.top.contentDOM) {
        let n = e.pmViewDesc;
        if (n) {
          for (let i = this.index; i < this.top.children.length; i++)
            if (this.top.children[i] == n)
              return i;
        }
        return -1;
      }
      e = t;
    }
  }
  // Try to update the next node, if any, to the given data. Checks
  // pre-matches to avoid overwriting nodes that could still be used.
  updateNextNode(e, t, n, i, a, s) {
    for (let u = this.index; u < this.top.children.length; u++) {
      let f = this.top.children[u];
      if (f instanceof vl) {
        let p = this.preMatch.matched.get(f);
        if (p != null && p != a)
          return !1;
        let y = f.dom, T, N = this.isLocked(y) && !(e.isText && f.node && f.node.isText && f.nodeDOM.nodeValue == e.text && f.dirty != Fo && Zv(t, f.outerDeco));
        if (!N && f.update(e, t, n, i))
          return this.destroyBetween(this.index, u), f.dom != y && (this.changed = !0), this.index++, !0;
        if (!N && (T = this.recreateWrapper(f, e, t, n, i, s)))
          return this.destroyBetween(this.index, u), this.top.children[this.index] = T, T.contentDOM && (T.dirty = vu, T.updateChildren(i, s + 1), T.dirty = Ea), this.changed = !0, this.index++, !0;
        break;
      }
    }
    return !1;
  }
  // When a node with content is replaced by a different node with
  // identical content, move over its children.
  recreateWrapper(e, t, n, i, a, s) {
    if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !Zv(n, e.outerDeco) || !i.eq(e.innerDeco))
      return null;
    let u = vl.create(this.top, t, n, i, a, s);
    if (u.contentDOM) {
      u.children = e.children, e.children = [];
      for (let f of u.children)
        f.parent = u;
    }
    return e.destroy(), u;
  }
  // Insert the node as a newly created node desc.
  addNode(e, t, n, i, a) {
    let s = vl.create(this.top, e, t, n, i, a);
    s.contentDOM && s.updateChildren(i, a + 1), this.top.children.splice(this.index++, 0, s), this.changed = !0;
  }
  placeWidget(e, t, n) {
    let i = this.index < this.top.children.length ? this.top.children[this.index] : null;
    if (i && i.matchesWidget(e) && (e == i.widget || !i.widget.type.toDOM.parentNode))
      this.index++;
    else {
      let a = new AS(this.top, e, t, n);
      this.top.children.splice(this.index++, 0, a), this.changed = !0;
    }
  }
  // Make sure a textblock looks and behaves correctly in
  // contentEditable.
  addTextblockHacks() {
    let e = this.top.children[this.index - 1], t = this.top;
    for (; e instanceof Eu; )
      t = e, e = t.children[t.children.length - 1];
    (!e || // Empty textblock
    !(e instanceof Nm) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((mi || Fn) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
  }
  addHackNode(e, t) {
    if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
      this.index++;
    else {
      let n = document.createElement(e);
      e == "IMG" && (n.className = "ProseMirror-separator", n.alt = ""), e == "BR" && (n.className = "ProseMirror-trailingBreak");
      let i = new LS(this.top, [], n, null);
      t != this.top ? t.children.push(i) : t.children.splice(this.index++, 0, i), this.changed = !0;
    }
  }
  isLocked(e) {
    return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
  }
}
function Xee(r, e) {
  let t = e, n = t.children.length, i = r.childCount, a = /* @__PURE__ */ new Map(), s = [];
  e: for (; i > 0; ) {
    let u;
    for (; ; )
      if (n) {
        let p = t.children[n - 1];
        if (p instanceof Eu)
          t = p, n = p.children.length;
        else {
          u = p, n--;
          break;
        }
      } else {
        if (t == e)
          break e;
        n = t.parent.children.indexOf(t), t = t.parent;
      }
    let f = u.node;
    if (f) {
      if (f != r.child(i - 1))
        break;
      --i, a.set(u, i), s.push(u);
    }
  }
  return { index: i, matched: a, matches: s.reverse() };
}
function Yee(r, e) {
  return r.type.side - e.type.side;
}
function Zee(r, e, t, n) {
  let i = e.locals(r), a = 0;
  if (i.length == 0) {
    for (let p = 0; p < r.childCount; p++) {
      let y = r.child(p);
      n(y, i, e.forChild(a, y), p), a += y.nodeSize;
    }
    return;
  }
  let s = 0, u = [], f = null;
  for (let p = 0; ; ) {
    let y, T;
    for (; s < i.length && i[s].to == a; ) {
      let U = i[s++];
      U.widget && (y ? (T || (T = [y])).push(U) : y = U);
    }
    if (y)
      if (T) {
        T.sort(Yee);
        for (let U = 0; U < T.length; U++)
          t(T[U], p, !!f);
      } else
        t(y, p, !!f);
    let N, O;
    if (f)
      O = -1, N = f, f = null;
    else if (p < r.childCount)
      O = p, N = r.child(p++);
    else
      break;
    for (let U = 0; U < u.length; U++)
      u[U].to <= a && u.splice(U--, 1);
    for (; s < i.length && i[s].from <= a && i[s].to > a; )
      u.push(i[s++]);
    let A = a + N.nodeSize;
    if (N.isText) {
      let U = A;
      s < i.length && i[s].from < U && (U = i[s].from);
      for (let j = 0; j < u.length; j++)
        u[j].to < U && (U = u[j].to);
      U < A && (f = N.cut(U - a), N = N.cut(0, U - a), A = U, O = -1);
    } else
      for (; s < i.length && i[s].to < A; )
        s++;
    let q = N.isInline && !N.isLeaf ? u.filter((U) => !U.inline) : u.slice();
    n(N, q, e.forChild(a, N), O), a = A;
  }
}
function ete(r) {
  if (r.nodeName == "UL" || r.nodeName == "OL") {
    let e = r.style.cssText;
    r.style.cssText = e + "; list-style: square !important", window.getComputedStyle(r).listStyle, r.style.cssText = e;
  }
}
function tte(r, e, t, n) {
  for (let i = 0, a = 0; i < r.childCount && a <= n; ) {
    let s = r.child(i++), u = a;
    if (a += s.nodeSize, !s.isText)
      continue;
    let f = s.text;
    for (; i < r.childCount; ) {
      let p = r.child(i++);
      if (a += p.nodeSize, !p.isText)
        break;
      f += p.text;
    }
    if (a >= t) {
      if (a >= n && f.slice(n - e.length - u, n - u) == e)
        return n - e.length;
      let p = u < n ? f.lastIndexOf(e, n - u - 1) : -1;
      if (p >= 0 && p + e.length + u >= t)
        return u + p;
      if (t == n && f.length >= n + e.length - u && f.slice(n - u, n - u + e.length) == e)
        return n;
    }
  }
  return -1;
}
function f0(r, e, t, n, i) {
  let a = [];
  for (let s = 0, u = 0; s < r.length; s++) {
    let f = r[s], p = u, y = u += f.size;
    p >= t || y <= e ? a.push(f) : (p < e && a.push(f.slice(0, e - p, n)), i && (a.push(i), i = void 0), y > t && a.push(f.slice(t - p, f.size, n)));
  }
  return a;
}
function J0(r, e = null) {
  let t = r.domSelectionRange(), n = r.state.doc;
  if (!t.focusNode)
    return null;
  let i = r.docView.nearestDesc(t.focusNode), a = i && i.size == 0, s = r.docView.posFromDOM(t.focusNode, t.focusOffset, 1);
  if (s < 0)
    return null;
  let u = n.resolve(s), f, p;
  if (Mm(t)) {
    for (f = s; i && !i.node; )
      i = i.parent;
    let T = i.node;
    if (i && T.isAtom && Kt.isSelectable(T) && i.parent && !(T.isInline && Nee(t.focusNode, t.focusOffset, i.dom))) {
      let N = i.posBefore;
      p = new Kt(s == N ? u : n.resolve(N));
    }
  } else {
    if (t instanceof r.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
      let T = s, N = s;
      for (let O = 0; O < t.rangeCount; O++) {
        let A = t.getRangeAt(O);
        T = Math.min(T, r.docView.posFromDOM(A.startContainer, A.startOffset, 1)), N = Math.max(N, r.docView.posFromDOM(A.endContainer, A.endOffset, -1));
      }
      if (T < 0)
        return null;
      [f, s] = N == r.state.selection.anchor ? [N, T] : [T, N], u = n.resolve(s);
    } else
      f = r.docView.posFromDOM(t.anchorNode, t.anchorOffset, 1);
    if (f < 0)
      return null;
  }
  let y = n.resolve(f);
  if (!p) {
    let T = e == "pointer" || r.state.selection.head < u.pos && !a ? 1 : -1;
    p = Q0(r, y, u, T);
  }
  return p;
}
function BS(r) {
  return r.editable ? r.hasFocus() : _S(r) && document.activeElement && document.activeElement.contains(r.dom);
}
function Ts(r, e = !1) {
  let t = r.state.selection;
  if (FS(r, t), !!BS(r)) {
    if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault && Fn) {
      let n = r.domSelectionRange(), i = r.domObserver.currentSelection;
      if (n.anchorNode && i.anchorNode && xu(n.anchorNode, n.anchorOffset, i.anchorNode, i.anchorOffset)) {
        r.input.mouseDown.delayedSelectionSync = !0, r.domObserver.setCurSelection();
        return;
      }
    }
    if (r.domObserver.disconnectSelection(), r.cursorWrapper)
      nte(r);
    else {
      let { anchor: n, head: i } = t, a, s;
      j1 && !(t instanceof dr) && (t.$from.parent.inlineContent || (a = G1(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (s = G1(r, t.to))), r.docView.setSelection(n, i, r, e), j1 && (a && K1(a), s && K1(s)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && rte(r));
    }
    r.domObserver.setCurSelection(), r.domObserver.connectSelection();
  }
}
const j1 = mi || Fn && TS < 63;
function G1(r, e) {
  let { node: t, offset: n } = r.docView.domFromPos(e, 0), i = n < t.childNodes.length ? t.childNodes[n] : null, a = n ? t.childNodes[n - 1] : null;
  if (mi && i && i.contentEditable == "false")
    return wy(i);
  if ((!i || i.contentEditable == "false") && (!a || a.contentEditable == "false")) {
    if (i)
      return wy(i);
    if (a)
      return wy(a);
  }
}
function wy(r) {
  return r.contentEditable = "true", mi && r.draggable && (r.draggable = !1, r.wasDraggable = !0), r;
}
function K1(r) {
  r.contentEditable = "false", r.wasDraggable && (r.draggable = !0, r.wasDraggable = null);
}
function rte(r) {
  let e = r.dom.ownerDocument;
  e.removeEventListener("selectionchange", r.input.hideSelectionGuard);
  let t = r.domSelectionRange(), n = t.anchorNode, i = t.anchorOffset;
  e.addEventListener("selectionchange", r.input.hideSelectionGuard = () => {
    (t.anchorNode != n || t.anchorOffset != i) && (e.removeEventListener("selectionchange", r.input.hideSelectionGuard), setTimeout(() => {
      (!BS(r) || r.state.selection.visible) && r.dom.classList.remove("ProseMirror-hideselection");
    }, 20));
  });
}
function nte(r) {
  let e = r.domSelection();
  if (!e)
    return;
  let t = r.cursorWrapper.dom, n = t.nodeName == "IMG";
  n ? e.collapse(t.parentNode, Yn(t) + 1) : e.collapse(t, 0), !n && !r.state.selection.visible && Gi && pl <= 11 && (t.disabled = !0, t.disabled = !1);
}
function FS(r, e) {
  if (e instanceof Kt) {
    let t = r.docView.descAt(e.from);
    t != r.lastSelectedViewDesc && (J1(r), t && t.selectNode(), r.lastSelectedViewDesc = t);
  } else
    J1(r);
}
function J1(r) {
  r.lastSelectedViewDesc && (r.lastSelectedViewDesc.parent && r.lastSelectedViewDesc.deselectNode(), r.lastSelectedViewDesc = void 0);
}
function Q0(r, e, t, n) {
  return r.someProp("createSelectionBetween", (i) => i(r, e, t)) || dr.between(e, t, n);
}
function Q1(r) {
  return r.editable && !r.hasFocus() ? !1 : _S(r);
}
function _S(r) {
  let e = r.domSelectionRange();
  if (!e.anchorNode)
    return !1;
  try {
    return r.dom.contains(e.anchorNode.nodeType == 3 ? e.anchorNode.parentNode : e.anchorNode) && (r.editable || r.dom.contains(e.focusNode.nodeType == 3 ? e.focusNode.parentNode : e.focusNode));
  } catch {
    return !1;
  }
}
function ite(r) {
  let e = r.docView.domFromPos(r.state.selection.anchor, 0), t = r.domSelectionRange();
  return xu(e.node, e.offset, t.anchorNode, t.anchorOffset);
}
function d0(r, e) {
  let { $anchor: t, $head: n } = r.selection, i = e > 0 ? t.max(n) : t.min(n), a = i.parent.inlineContent ? i.depth ? r.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
  return a && cr.findFrom(a, e);
}
function ol(r, e) {
  return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()), !0;
}
function X1(r, e, t) {
  let n = r.state.selection;
  if (n instanceof dr)
    if (t.indexOf("s") > -1) {
      let { $head: i } = n, a = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter;
      if (!a || a.isText || !a.isLeaf)
        return !1;
      let s = r.state.doc.resolve(i.pos + a.nodeSize * (e < 0 ? -1 : 1));
      return ol(r, new dr(n.$anchor, s));
    } else if (n.empty) {
      if (r.endOfTextblock(e > 0 ? "forward" : "backward")) {
        let i = d0(r.state, e);
        return i && i instanceof Kt ? ol(r, i) : !1;
      } else if (!(Ta && t.indexOf("m") > -1)) {
        let i = n.$head, a = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, s;
        if (!a || a.isText)
          return !1;
        let u = e < 0 ? i.pos - a.nodeSize : i.pos;
        return a.isAtom || (s = r.docView.descAt(u)) && !s.contentDOM ? Kt.isSelectable(a) ? ol(r, new Kt(e < 0 ? r.state.doc.resolve(i.pos - a.nodeSize) : i)) : Sh ? ol(r, new dr(r.state.doc.resolve(e < 0 ? u : u + a.nodeSize))) : !1 : !1;
      }
    } else return !1;
  else {
    if (n instanceof Kt && n.node.isInline)
      return ol(r, new dr(e > 0 ? n.$to : n.$from));
    {
      let i = d0(r.state, e);
      return i ? ol(r, i) : !1;
    }
  }
}
function em(r) {
  return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
}
function uh(r, e) {
  let t = r.pmViewDesc;
  return t && t.size == 0 && (e < 0 || r.nextSibling || r.nodeName != "BR");
}
function Uc(r, e) {
  return e < 0 ? ate(r) : ote(r);
}
function ate(r) {
  let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
  if (!t)
    return;
  let i, a, s = !1;
  for (xa && t.nodeType == 1 && n < em(t) && uh(t.childNodes[n], -1) && (s = !0); ; )
    if (n > 0) {
      if (t.nodeType != 1)
        break;
      {
        let u = t.childNodes[n - 1];
        if (uh(u, -1))
          i = t, a = --n;
        else if (u.nodeType == 3)
          t = u, n = t.nodeValue.length;
        else
          break;
      }
    } else {
      if (qS(t))
        break;
      {
        let u = t.previousSibling;
        for (; u && uh(u, -1); )
          i = t.parentNode, a = Yn(u), u = u.previousSibling;
        if (u)
          t = u, n = em(t);
        else {
          if (t = t.parentNode, t == r.dom)
            break;
          n = 0;
        }
      }
    }
  s ? h0(r, t, n) : i && h0(r, i, a);
}
function ote(r) {
  let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
  if (!t)
    return;
  let i = em(t), a, s;
  for (; ; )
    if (n < i) {
      if (t.nodeType != 1)
        break;
      let u = t.childNodes[n];
      if (uh(u, 1))
        a = t, s = ++n;
      else
        break;
    } else {
      if (qS(t))
        break;
      {
        let u = t.nextSibling;
        for (; u && uh(u, 1); )
          a = u.parentNode, s = Yn(u) + 1, u = u.nextSibling;
        if (u)
          t = u, n = 0, i = em(t);
        else {
          if (t = t.parentNode, t == r.dom)
            break;
          n = i = 0;
        }
      }
    }
  a && h0(r, a, s);
}
function qS(r) {
  let e = r.pmViewDesc;
  return e && e.node && e.node.isBlock;
}
function ste(r, e) {
  for (; r && e == r.childNodes.length && !Th(r); )
    e = Yn(r) + 1, r = r.parentNode;
  for (; r && e < r.childNodes.length; ) {
    let t = r.childNodes[e];
    if (t.nodeType == 3)
      return t;
    if (t.nodeType == 1 && t.contentEditable == "false")
      break;
    r = t, e = 0;
  }
}
function lte(r, e) {
  for (; r && !e && !Th(r); )
    e = Yn(r), r = r.parentNode;
  for (; r && e; ) {
    let t = r.childNodes[e - 1];
    if (t.nodeType == 3)
      return t;
    if (t.nodeType == 1 && t.contentEditable == "false")
      break;
    r = t, e = r.childNodes.length;
  }
}
function h0(r, e, t) {
  if (e.nodeType != 3) {
    let a, s;
    (s = ste(e, t)) ? (e = s, t = 0) : (a = lte(e, t)) && (e = a, t = a.nodeValue.length);
  }
  let n = r.domSelection();
  if (!n)
    return;
  if (Mm(n)) {
    let a = document.createRange();
    a.setEnd(e, t), a.setStart(e, t), n.removeAllRanges(), n.addRange(a);
  } else n.extend && n.extend(e, t);
  r.domObserver.setCurSelection();
  let { state: i } = r;
  setTimeout(() => {
    r.state == i && Ts(r);
  }, 50);
}
function Y1(r, e) {
  let t = r.state.doc.resolve(e);
  if (!(Fn || SS) && t.parent.inlineContent) {
    let i = r.coordsAtPos(e);
    if (e > t.start()) {
      let a = r.coordsAtPos(e - 1), s = (a.top + a.bottom) / 2;
      if (s > i.top && s < i.bottom && Math.abs(a.left - i.left) > 1)
        return a.left < i.left ? "ltr" : "rtl";
    }
    if (e < t.end()) {
      let a = r.coordsAtPos(e + 1), s = (a.top + a.bottom) / 2;
      if (s > i.top && s < i.bottom && Math.abs(a.left - i.left) > 1)
        return a.left > i.left ? "ltr" : "rtl";
    }
  }
  return getComputedStyle(r.dom).direction == "rtl" ? "rtl" : "ltr";
}
function Z1(r, e, t) {
  let n = r.state.selection;
  if (n instanceof dr && !n.empty || t.indexOf("s") > -1 || Ta && t.indexOf("m") > -1)
    return !1;
  let { $from: i, $to: a } = n;
  if (!i.parent.inlineContent || r.endOfTextblock(e < 0 ? "up" : "down")) {
    let s = d0(r.state, e);
    if (s && s instanceof Kt)
      return ol(r, s);
  }
  if (!i.parent.inlineContent) {
    let s = e < 0 ? i : a, u = n instanceof Di ? cr.near(s, e) : cr.findFrom(s, e);
    return u ? ol(r, u) : !1;
  }
  return !1;
}
function eb(r, e) {
  if (!(r.state.selection instanceof dr))
    return !0;
  let { $head: t, $anchor: n, empty: i } = r.state.selection;
  if (!t.sameParent(n))
    return !0;
  if (!i)
    return !1;
  if (r.endOfTextblock(e > 0 ? "forward" : "backward"))
    return !0;
  let a = !t.textOffset && (e < 0 ? t.nodeBefore : t.nodeAfter);
  if (a && !a.isText) {
    let s = r.state.tr;
    return e < 0 ? s.delete(t.pos - a.nodeSize, t.pos) : s.delete(t.pos, t.pos + a.nodeSize), r.dispatch(s), !0;
  }
  return !1;
}
function tb(r, e, t) {
  r.domObserver.stop(), e.contentEditable = t, r.domObserver.start();
}
function ute(r) {
  if (!mi || r.state.selection.$head.parentOffset > 0)
    return !1;
  let { focusNode: e, focusOffset: t } = r.domSelectionRange();
  if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
    let n = e.firstChild;
    tb(r, n, "true"), setTimeout(() => tb(r, n, "false"), 20);
  }
  return !1;
}
function cte(r) {
  let e = "";
  return r.ctrlKey && (e += "c"), r.metaKey && (e += "m"), r.altKey && (e += "a"), r.shiftKey && (e += "s"), e;
}
function fte(r, e) {
  let t = e.keyCode, n = cte(e);
  if (t == 8 || Ta && t == 72 && n == "c")
    return eb(r, -1) || Uc(r, -1);
  if (t == 46 && !e.shiftKey || Ta && t == 68 && n == "c")
    return eb(r, 1) || Uc(r, 1);
  if (t == 13 || t == 27)
    return !0;
  if (t == 37 || Ta && t == 66 && n == "c") {
    let i = t == 37 ? Y1(r, r.state.selection.from) == "ltr" ? -1 : 1 : -1;
    return X1(r, i, n) || Uc(r, i);
  } else if (t == 39 || Ta && t == 70 && n == "c") {
    let i = t == 39 ? Y1(r, r.state.selection.from) == "ltr" ? 1 : -1 : 1;
    return X1(r, i, n) || Uc(r, i);
  } else {
    if (t == 38 || Ta && t == 80 && n == "c")
      return Z1(r, -1, n) || Uc(r, -1);
    if (t == 40 || Ta && t == 78 && n == "c")
      return ute(r) || Z1(r, 1, n) || Uc(r, 1);
    if (n == (Ta ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
      return !0;
  }
  return !1;
}
function X0(r, e) {
  r.someProp("transformCopied", (O) => {
    e = O(e, r);
  });
  let t = [], { content: n, openStart: i, openEnd: a } = e;
  for (; i > 1 && a > 1 && n.childCount == 1 && n.firstChild.childCount == 1; ) {
    i--, a--;
    let O = n.firstChild;
    t.push(O.type.name, O.attrs != O.type.defaultAttrs ? O.attrs : null), n = O.content;
  }
  let s = r.someProp("clipboardSerializer") || kf.fromSchema(r.state.schema), u = WS(), f = u.createElement("div");
  f.appendChild(s.serializeFragment(n, { document: u }));
  let p = f.firstChild, y, T = 0;
  for (; p && p.nodeType == 1 && (y = $S[p.nodeName.toLowerCase()]); ) {
    for (let O = y.length - 1; O >= 0; O--) {
      let A = u.createElement(y[O]);
      for (; f.firstChild; )
        A.appendChild(f.firstChild);
      f.appendChild(A), T++;
    }
    p = f.firstChild;
  }
  p && p.nodeType == 1 && p.setAttribute("data-pm-slice", `${i} ${a}${T ? ` -${T}` : ""} ${JSON.stringify(t)}`);
  let N = r.someProp("clipboardTextSerializer", (O) => O(e, r)) || e.content.textBetween(0, e.content.size, `

`);
  return { dom: f, text: N, slice: e };
}
function zS(r, e, t, n, i) {
  let a = i.parent.type.spec.code, s, u;
  if (!t && !e)
    return null;
  let f = !!e && (n || a || !t);
  if (f) {
    if (r.someProp("transformPastedText", (N) => {
      e = N(e, a || n, r);
    }), a)
      return u = new ht(Qe.from(r.state.schema.text(e.replace(/\r\n?/g, `
`))), 0, 0), r.someProp("transformPasted", (N) => {
        u = N(u, r, !0);
      }), u;
    let T = r.someProp("clipboardTextParser", (N) => N(e, i, n, r));
    if (T)
      u = T;
    else {
      let N = i.marks(), { schema: O } = r.state, A = kf.fromSchema(O);
      s = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((q) => {
        let U = s.appendChild(document.createElement("p"));
        q && U.appendChild(A.serializeNode(O.text(q, N)));
      });
    }
  } else
    r.someProp("transformPastedHTML", (T) => {
      t = T(t, r);
    }), s = vte(t), Sh && mte(s);
  let p = s && s.querySelector("[data-pm-slice]"), y = p && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice") || "");
  if (y && y[3])
    for (let T = +y[3]; T > 0; T--) {
      let N = s.firstChild;
      for (; N && N.nodeType != 1; )
        N = N.nextSibling;
      if (!N)
        break;
      s = N;
    }
  if (u || (u = (r.someProp("clipboardParser") || r.someProp("domParser") || Tu.fromSchema(r.state.schema)).parseSlice(s, {
    preserveWhitespace: !!(f || y),
    context: i,
    ruleFromNode(N) {
      return N.nodeName == "BR" && !N.nextSibling && N.parentNode && !dte.test(N.parentNode.nodeName) ? { ignore: !0 } : null;
    }
  })), y)
    u = gte(rb(u, +y[1], +y[2]), y[4]);
  else if (u = ht.maxOpen(hte(u.content, i), !0), u.openStart || u.openEnd) {
    let T = 0, N = 0;
    for (let O = u.content.firstChild; T < u.openStart && !O.type.spec.isolating; T++, O = O.firstChild)
      ;
    for (let O = u.content.lastChild; N < u.openEnd && !O.type.spec.isolating; N++, O = O.lastChild)
      ;
    u = rb(u, T, N);
  }
  return r.someProp("transformPasted", (T) => {
    u = T(u, r, f);
  }), u;
}
const dte = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
function hte(r, e) {
  if (r.childCount < 2)
    return r;
  for (let t = e.depth; t >= 0; t--) {
    let i = e.node(t).contentMatchAt(e.index(t)), a, s = [];
    if (r.forEach((u) => {
      if (!s)
        return;
      let f = i.findWrapping(u.type), p;
      if (!f)
        return s = null;
      if (p = s.length && a.length && VS(f, a, u, s[s.length - 1], 0))
        s[s.length - 1] = p;
      else {
        s.length && (s[s.length - 1] = US(s[s.length - 1], a.length));
        let y = HS(u, f);
        s.push(y), i = i.matchType(y.type), a = f;
      }
    }), s)
      return Qe.from(s);
  }
  return r;
}
function HS(r, e, t = 0) {
  for (let n = e.length - 1; n >= t; n--)
    r = e[n].create(null, Qe.from(r));
  return r;
}
function VS(r, e, t, n, i) {
  if (i < r.length && i < e.length && r[i] == e[i]) {
    let a = VS(r, e, t, n.lastChild, i + 1);
    if (a)
      return n.copy(n.content.replaceChild(n.childCount - 1, a));
    if (n.contentMatchAt(n.childCount).matchType(i == r.length - 1 ? t.type : r[i + 1]))
      return n.copy(n.content.append(Qe.from(HS(t, r, i + 1))));
  }
}
function US(r, e) {
  if (e == 0)
    return r;
  let t = r.content.replaceChild(r.childCount - 1, US(r.lastChild, e - 1)), n = r.contentMatchAt(r.childCount).fillBefore(Qe.empty, !0);
  return r.copy(t.append(n));
}
function p0(r, e, t, n, i, a) {
  let s = e < 0 ? r.firstChild : r.lastChild, u = s.content;
  return r.childCount > 1 && (a = 0), i < n - 1 && (u = p0(u, e, t, n, i + 1, a)), i >= t && (u = e < 0 ? s.contentMatchAt(0).fillBefore(u, a <= i).append(u) : u.append(s.contentMatchAt(s.childCount).fillBefore(Qe.empty, !0))), r.replaceChild(e < 0 ? 0 : r.childCount - 1, s.copy(u));
}
function rb(r, e, t) {
  return e < r.openStart && (r = new ht(p0(r.content, -1, e, r.openStart, 0, r.openEnd), e, r.openEnd)), t < r.openEnd && (r = new ht(p0(r.content, 1, t, r.openEnd, 0, 0), r.openStart, t)), r;
}
const $S = {
  thead: ["table"],
  tbody: ["table"],
  tfoot: ["table"],
  caption: ["table"],
  colgroup: ["table"],
  col: ["table", "colgroup"],
  tr: ["table", "tbody"],
  td: ["table", "tbody", "tr"],
  th: ["table", "tbody", "tr"]
};
let nb = null;
function WS() {
  return nb || (nb = document.implementation.createHTMLDocument("title"));
}
let by = null;
function pte(r) {
  let e = window.trustedTypes;
  return e ? (by || (by = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), by.createHTML(r)) : r;
}
function vte(r) {
  let e = /^(\s*<meta [^>]*>)*/.exec(r);
  e && (r = r.slice(e[0].length));
  let t = WS().createElement("div"), n = /<([a-z][^>\s]+)/i.exec(r), i;
  if ((i = n && $S[n[1].toLowerCase()]) && (r = i.map((a) => "<" + a + ">").join("") + r + i.map((a) => "</" + a + ">").reverse().join("")), t.innerHTML = pte(r), i)
    for (let a = 0; a < i.length; a++)
      t = t.querySelector(i[a]) || t;
  return t;
}
function mte(r) {
  let e = r.querySelectorAll(Fn ? "span:not([class]):not([style])" : "span.Apple-converted-space");
  for (let t = 0; t < e.length; t++) {
    let n = e[t];
    n.childNodes.length == 1 && n.textContent == " " && n.parentNode && n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "), n);
  }
}
function gte(r, e) {
  if (!r.size)
    return r;
  let t = r.content.firstChild.type.schema, n;
  try {
    n = JSON.parse(e);
  } catch {
    return r;
  }
  let { content: i, openStart: a, openEnd: s } = r;
  for (let u = n.length - 2; u >= 0; u -= 2) {
    let f = t.nodes[n[u]];
    if (!f || f.hasRequiredAttrs())
      break;
    i = Qe.from(f.create(n[u + 1], i)), a++, s++;
  }
  return new ht(i, a, s);
}
const Ai = {}, Li = {}, yte = { touchstart: !0, touchmove: !0 };
class kte {
  constructor() {
    this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "", button: 0 }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
  }
}
function wte(r) {
  for (let e in Ai) {
    let t = Ai[e];
    r.dom.addEventListener(e, r.input.eventHandlers[e] = (n) => {
      Cte(r, n) && !Y0(r, n) && (r.editable || !(n.type in Li)) && t(r, n);
    }, yte[e] ? { passive: !0 } : void 0);
  }
  mi && r.dom.addEventListener("input", () => null), v0(r);
}
function dl(r, e) {
  r.input.lastSelectionOrigin = e, r.input.lastSelectionTime = Date.now();
}
function bte(r) {
  r.domObserver.stop();
  for (let e in r.input.eventHandlers)
    r.dom.removeEventListener(e, r.input.eventHandlers[e]);
  clearTimeout(r.input.composingTimeout), clearTimeout(r.input.lastIOSEnterFallbackTimeout);
}
function v0(r) {
  r.someProp("handleDOMEvents", (e) => {
    for (let t in e)
      r.input.eventHandlers[t] || r.dom.addEventListener(t, r.input.eventHandlers[t] = (n) => Y0(r, n));
  });
}
function Y0(r, e) {
  return r.someProp("handleDOMEvents", (t) => {
    let n = t[e.type];
    return n ? n(r, e) || e.defaultPrevented : !1;
  });
}
function Cte(r, e) {
  if (!e.bubbles)
    return !0;
  if (e.defaultPrevented)
    return !1;
  for (let t = e.target; t != r.dom; t = t.parentNode)
    if (!t || t.nodeType == 11 || t.pmViewDesc && t.pmViewDesc.stopEvent(e))
      return !1;
  return !0;
}
function Tte(r, e) {
  !Y0(r, e) && Ai[e.type] && (r.editable || !(e.type in Li)) && Ai[e.type](r, e);
}
Li.keydown = (r, e) => {
  let t = e;
  if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !GS(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(bs && Fn && t.keyCode == 13)))
    if (t.keyCode != 229 && r.domObserver.forceFlush(), of && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
      let n = Date.now();
      r.input.lastIOSEnter = n, r.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
        r.input.lastIOSEnter == n && (r.someProp("handleKeyDown", (i) => i(r, hu(13, "Enter"))), r.input.lastIOSEnter = 0);
      }, 200);
    } else r.someProp("handleKeyDown", (n) => n(r, t)) || fte(r, t) ? t.preventDefault() : dl(r, "key");
};
Li.keyup = (r, e) => {
  e.keyCode == 16 && (r.input.shiftKey = !1);
};
Li.keypress = (r, e) => {
  let t = e;
  if (GS(r, t) || !t.charCode || t.ctrlKey && !t.altKey || Ta && t.metaKey)
    return;
  if (r.someProp("handleKeyPress", (i) => i(r, t))) {
    t.preventDefault();
    return;
  }
  let n = r.state.selection;
  if (!(n instanceof dr) || !n.$from.sameParent(n.$to)) {
    let i = String.fromCharCode(t.charCode), a = () => r.state.tr.insertText(i).scrollIntoView();
    !/[\r\n]/.test(i) && !r.someProp("handleTextInput", (s) => s(r, n.$from.pos, n.$to.pos, i, a)) && r.dispatch(a()), t.preventDefault();
  }
};
function Om(r) {
  return { left: r.clientX, top: r.clientY };
}
function Ste(r, e) {
  let t = e.x - r.clientX, n = e.y - r.clientY;
  return t * t + n * n < 100;
}
function Z0(r, e, t, n, i) {
  if (n == -1)
    return !1;
  let a = r.state.doc.resolve(n);
  for (let s = a.depth + 1; s > 0; s--)
    if (r.someProp(e, (u) => s > a.depth ? u(r, t, a.nodeAfter, a.before(s), i, !0) : u(r, t, a.node(s), a.before(s), i, !1)))
      return !0;
  return !1;
}
function rf(r, e, t) {
  if (r.focused || r.focus(), r.state.selection.eq(e))
    return;
  let n = r.state.tr.setSelection(e);
  n.setMeta("pointer", !0), r.dispatch(n);
}
function xte(r, e) {
  if (e == -1)
    return !1;
  let t = r.state.doc.resolve(e), n = t.nodeAfter;
  return n && n.isAtom && Kt.isSelectable(n) ? (rf(r, new Kt(t)), !0) : !1;
}
function Ete(r, e) {
  if (e == -1)
    return !1;
  let t = r.state.selection, n, i;
  t instanceof Kt && (n = t.node);
  let a = r.state.doc.resolve(e);
  for (let s = a.depth + 1; s > 0; s--) {
    let u = s > a.depth ? a.nodeAfter : a.node(s);
    if (Kt.isSelectable(u)) {
      n && t.$from.depth > 0 && s >= t.$from.depth && a.before(t.$from.depth + 1) == t.$from.pos ? i = a.before(t.$from.depth) : i = a.before(s);
      break;
    }
  }
  return i != null ? (rf(r, Kt.create(r.state.doc, i)), !0) : !1;
}
function Mte(r, e, t, n, i) {
  return Z0(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (a) => a(r, e, n)) || (i ? Ete(r, t) : xte(r, t));
}
function Nte(r, e, t, n) {
  return Z0(r, "handleDoubleClickOn", e, t, n) || r.someProp("handleDoubleClick", (i) => i(r, e, n));
}
function Ote(r, e, t, n) {
  return Z0(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) || Dte(r, t, n);
}
function Dte(r, e, t) {
  if (t.button != 0)
    return !1;
  let n = r.state.doc;
  if (e == -1)
    return n.inlineContent ? (rf(r, dr.create(n, 0, n.content.size)), !0) : !1;
  let i = n.resolve(e);
  for (let a = i.depth + 1; a > 0; a--) {
    let s = a > i.depth ? i.nodeAfter : i.node(a), u = i.before(a);
    if (s.inlineContent)
      rf(r, dr.create(n, u + 1, u + 1 + s.content.size));
    else if (Kt.isSelectable(s))
      rf(r, Kt.create(n, u));
    else
      continue;
    return !0;
  }
}
function ek(r) {
  return tm(r);
}
const jS = Ta ? "metaKey" : "ctrlKey";
Ai.mousedown = (r, e) => {
  let t = e;
  r.input.shiftKey = t.shiftKey;
  let n = ek(r), i = Date.now(), a = "singleClick";
  i - r.input.lastClick.time < 500 && Ste(t, r.input.lastClick) && !t[jS] && r.input.lastClick.button == t.button && (r.input.lastClick.type == "singleClick" ? a = "doubleClick" : r.input.lastClick.type == "doubleClick" && (a = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: a, button: t.button };
  let s = r.posAtCoords(Om(t));
  s && (a == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ate(r, s, t, !!n)) : (a == "doubleClick" ? Nte : Ote)(r, s.pos, s.inside, t) ? t.preventDefault() : dl(r, "pointer"));
};
class Ate {
  constructor(e, t, n, i) {
    this.view = e, this.pos = t, this.event = n, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!n[jS], this.allowDefault = n.shiftKey;
    let a, s;
    if (t.inside > -1)
      a = e.state.doc.nodeAt(t.inside), s = t.inside;
    else {
      let y = e.state.doc.resolve(t.pos);
      a = y.parent, s = y.depth ? y.before() : 0;
    }
    const u = i ? null : n.target, f = u ? e.docView.nearestDesc(u, !0) : null;
    this.target = f && f.nodeDOM.nodeType == 1 ? f.nodeDOM : null;
    let { selection: p } = e.state;
    (n.button == 0 && a.type.spec.draggable && a.type.spec.selectable !== !1 || p instanceof Kt && p.from <= s && p.to > s) && (this.mightDrag = {
      node: a,
      pos: s,
      addAttr: !!(this.target && !this.target.draggable),
      setUneditable: !!(this.target && xa && !this.target.hasAttribute("contentEditable"))
    }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
      this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
    }, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), dl(e, "pointer");
  }
  done() {
    this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => Ts(this.view)), this.view.input.mouseDown = null;
  }
  up(e) {
    if (this.done(), !this.view.dom.contains(e.target))
      return;
    let t = this.pos;
    this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Om(e))), this.updateAllowDefault(e), this.allowDefault || !t ? dl(this.view, "pointer") : Mte(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
    mi && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
    // cursor, but still report that the node is selected
    // when asked through getSelection. You'll then get a
    // situation where clicking at the point where that
    // (hidden) cursor is doesn't change the selection, and
    // thus doesn't get a reaction from ProseMirror. This
    // works around that.
    Fn && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (rf(this.view, cr.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : dl(this.view, "pointer");
  }
  move(e) {
    this.updateAllowDefault(e), dl(this.view, "pointer"), e.buttons == 0 && this.done();
  }
  updateAllowDefault(e) {
    !this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
  }
}
Ai.touchstart = (r) => {
  r.input.lastTouch = Date.now(), ek(r), dl(r, "pointer");
};
Ai.touchmove = (r) => {
  r.input.lastTouch = Date.now(), dl(r, "pointer");
};
Ai.contextmenu = (r) => ek(r);
function GS(r, e) {
  return r.composing ? !0 : mi && Math.abs(e.timeStamp - r.input.compositionEndedAt) < 500 ? (r.input.compositionEndedAt = -2e8, !0) : !1;
}
const Lte = bs ? 5e3 : -1;
Li.compositionstart = Li.compositionupdate = (r) => {
  if (!r.composing) {
    r.domObserver.flush();
    let { state: e } = r, t = e.selection.$to;
    if (e.selection instanceof dr && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((n) => n.type.spec.inclusive === !1) || Fn && SS && Rte(r)))
      r.markCursor = r.state.storedMarks || t.marks(), tm(r, !0), r.markCursor = null;
    else if (tm(r, !e.selection.empty), xa && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
      let n = r.domSelectionRange();
      for (let i = n.focusNode, a = n.focusOffset; i && i.nodeType == 1 && a != 0; ) {
        let s = a < 0 ? i.lastChild : i.childNodes[a - 1];
        if (!s)
          break;
        if (s.nodeType == 3) {
          let u = r.domSelection();
          u && u.collapse(s, s.nodeValue.length);
          break;
        } else
          i = s, a = -1;
      }
    }
    r.input.composing = !0;
  }
  KS(r, Lte);
};
function Rte(r) {
  let { focusNode: e, focusOffset: t } = r.domSelectionRange();
  if (!e || e.nodeType != 1 || t >= e.childNodes.length)
    return !1;
  let n = e.childNodes[t];
  return n.nodeType == 1 && n.contentEditable == "false";
}
Li.compositionend = (r, e) => {
  r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, KS(r, 20));
};
function KS(r, e) {
  clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => tm(r), e));
}
function JS(r) {
  for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = Pte()); r.input.compositionNodes.length > 0; )
    r.input.compositionNodes.pop().markParentsDirty();
}
function Ite(r) {
  let e = r.domSelectionRange();
  if (!e.focusNode)
    return null;
  let t = Eee(e.focusNode, e.focusOffset), n = Mee(e.focusNode, e.focusOffset);
  if (t && n && t != n) {
    let i = n.pmViewDesc, a = r.domObserver.lastChangedTextNode;
    if (t == a || n == a)
      return a;
    if (!i || !i.isText(n.nodeValue))
      return n;
    if (r.input.compositionNode == n) {
      let s = t.pmViewDesc;
      if (!(!s || !s.isText(t.nodeValue)))
        return n;
    }
  }
  return t || n;
}
function Pte() {
  let r = document.createEvent("Event");
  return r.initEvent("event", !0, !0), r.timeStamp;
}
function tm(r, e = !1) {
  if (!(bs && r.domObserver.flushingSoon >= 0)) {
    if (r.domObserver.forceFlush(), JS(r), e || r.docView && r.docView.dirty) {
      let t = J0(r), n = r.state.selection;
      return t && !t.eq(n) ? r.dispatch(r.state.tr.setSelection(t)) : (r.markCursor || e) && !n.$from.node(n.$from.sharedDepth(n.to)).inlineContent ? r.dispatch(r.state.tr.deleteSelection()) : r.updateState(r.state), !0;
    }
    return !1;
  }
}
function Bte(r, e) {
  if (!r.dom.parentNode)
    return;
  let t = r.dom.parentNode.appendChild(document.createElement("div"));
  t.appendChild(e), t.style.cssText = "position: fixed; left: -10000px; top: 10px";
  let n = getSelection(), i = document.createRange();
  i.selectNodeContents(e), r.dom.blur(), n.removeAllRanges(), n.addRange(i), setTimeout(() => {
    t.parentNode && t.parentNode.removeChild(t), r.focus();
  }, 50);
}
const mh = Gi && pl < 15 || of && Aee < 604;
Ai.copy = Li.cut = (r, e) => {
  let t = e, n = r.state.selection, i = t.type == "cut";
  if (n.empty)
    return;
  let a = mh ? null : t.clipboardData, s = n.content(), { dom: u, text: f } = X0(r, s);
  a ? (t.preventDefault(), a.clearData(), a.setData("text/html", u.innerHTML), a.setData("text/plain", f)) : Bte(r, u), i && r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
};
function Fte(r) {
  return r.openStart == 0 && r.openEnd == 0 && r.content.childCount == 1 ? r.content.firstChild : null;
}
function _te(r, e) {
  if (!r.dom.parentNode)
    return;
  let t = r.input.shiftKey || r.state.selection.$from.parent.type.spec.code, n = r.dom.parentNode.appendChild(document.createElement(t ? "textarea" : "div"));
  t || (n.contentEditable = "true"), n.style.cssText = "position: fixed; left: -10000px; top: 10px", n.focus();
  let i = r.input.shiftKey && r.input.lastKeyCode != 45;
  setTimeout(() => {
    r.focus(), n.parentNode && n.parentNode.removeChild(n), t ? gh(r, n.value, null, i, e) : gh(r, n.textContent, n.innerHTML, i, e);
  }, 50);
}
function gh(r, e, t, n, i) {
  let a = zS(r, e, t, n, r.state.selection.$from);
  if (r.someProp("handlePaste", (f) => f(r, i, a || ht.empty)))
    return !0;
  if (!a)
    return !1;
  let s = Fte(a), u = s ? r.state.tr.replaceSelectionWith(s, n) : r.state.tr.replaceSelection(a);
  return r.dispatch(u.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
}
function QS(r) {
  let e = r.getData("text/plain") || r.getData("Text");
  if (e)
    return e;
  let t = r.getData("text/uri-list");
  return t ? t.replace(/\r?\n/g, " ") : "";
}
Li.paste = (r, e) => {
  let t = e;
  if (r.composing && !bs)
    return;
  let n = mh ? null : t.clipboardData, i = r.input.shiftKey && r.input.lastKeyCode != 45;
  n && gh(r, QS(n), n.getData("text/html"), i, t) ? t.preventDefault() : _te(r, t);
};
class XS {
  constructor(e, t, n) {
    this.slice = e, this.move = t, this.node = n;
  }
}
const qte = Ta ? "altKey" : "ctrlKey";
function YS(r, e) {
  let t = r.someProp("dragCopies", (n) => !n(e));
  return t ?? !e[qte];
}
Ai.dragstart = (r, e) => {
  let t = e, n = r.input.mouseDown;
  if (n && n.done(), !t.dataTransfer)
    return;
  let i = r.state.selection, a = i.empty ? null : r.posAtCoords(Om(t)), s;
  if (!(a && a.pos >= i.from && a.pos <= (i instanceof Kt ? i.to - 1 : i.to))) {
    if (n && n.mightDrag)
      s = Kt.create(r.state.doc, n.mightDrag.pos);
    else if (t.target && t.target.nodeType == 1) {
      let T = r.docView.nearestDesc(t.target, !0);
      T && T.node.type.spec.draggable && T != r.docView && (s = Kt.create(r.state.doc, T.posBefore));
    }
  }
  let u = (s || r.state.selection).content(), { dom: f, text: p, slice: y } = X0(r, u);
  (!t.dataTransfer.files.length || !Fn || TS > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(mh ? "Text" : "text/html", f.innerHTML), t.dataTransfer.effectAllowed = "copyMove", mh || t.dataTransfer.setData("text/plain", p), r.dragging = new XS(y, YS(r, t), s);
};
Ai.dragend = (r) => {
  let e = r.dragging;
  window.setTimeout(() => {
    r.dragging == e && (r.dragging = null);
  }, 50);
};
Li.dragover = Li.dragenter = (r, e) => e.preventDefault();
Li.drop = (r, e) => {
  try {
    zte(r, e, r.dragging);
  } finally {
    r.dragging = null;
  }
};
function zte(r, e, t) {
  if (!e.dataTransfer)
    return;
  let n = r.posAtCoords(Om(e));
  if (!n)
    return;
  let i = r.state.doc.resolve(n.pos), a = t && t.slice;
  a ? r.someProp("transformPasted", (O) => {
    a = O(a, r, !1);
  }) : a = zS(r, QS(e.dataTransfer), mh ? null : e.dataTransfer.getData("text/html"), !1, i);
  let s = !!(t && YS(r, e));
  if (r.someProp("handleDrop", (O) => O(r, e, a || ht.empty, s))) {
    e.preventDefault();
    return;
  }
  if (!a)
    return;
  e.preventDefault();
  let u = a ? hee(r.state.doc, i.pos, a) : i.pos;
  u == null && (u = i.pos);
  let f = r.state.tr;
  if (s) {
    let { node: O } = t;
    O ? O.replace(f) : f.deleteSelection();
  }
  let p = f.mapping.map(u), y = a.openStart == 0 && a.openEnd == 0 && a.content.childCount == 1, T = f.doc;
  if (y ? f.replaceRangeWith(p, p, a.content.firstChild) : f.replaceRange(p, p, a), f.doc.eq(T))
    return;
  let N = f.doc.resolve(p);
  if (y && Kt.isSelectable(a.content.firstChild) && N.nodeAfter && N.nodeAfter.sameMarkup(a.content.firstChild))
    f.setSelection(new Kt(N));
  else {
    let O = f.mapping.map(u);
    f.mapping.maps[f.mapping.maps.length - 1].forEach((A, q, U, j) => O = j), f.setSelection(Q0(r, N, f.doc.resolve(O)));
  }
  r.focus(), r.dispatch(f.setMeta("uiEvent", "drop"));
}
Ai.focus = (r) => {
  r.input.lastFocus = Date.now(), r.focused || (r.domObserver.stop(), r.dom.classList.add("ProseMirror-focused"), r.domObserver.start(), r.focused = !0, setTimeout(() => {
    r.docView && r.hasFocus() && !r.domObserver.currentSelection.eq(r.domSelectionRange()) && Ts(r);
  }, 20));
};
Ai.blur = (r, e) => {
  let t = e;
  r.focused && (r.domObserver.stop(), r.dom.classList.remove("ProseMirror-focused"), r.domObserver.start(), t.relatedTarget && r.dom.contains(t.relatedTarget) && r.domObserver.currentSelection.clear(), r.focused = !1);
};
Ai.beforeinput = (r, e) => {
  if (Fn && bs && e.inputType == "deleteContentBackward") {
    r.domObserver.flushSoon();
    let { domChangeCount: n } = r.input;
    setTimeout(() => {
      if (r.input.domChangeCount != n || (r.dom.blur(), r.focus(), r.someProp("handleKeyDown", (a) => a(r, hu(8, "Backspace")))))
        return;
      let { $cursor: i } = r.state.selection;
      i && i.pos > 0 && r.dispatch(r.state.tr.delete(i.pos - 1, i.pos).scrollIntoView());
    }, 50);
  }
};
for (let r in Li)
  Ai[r] = Li[r];
function yh(r, e) {
  if (r == e)
    return !0;
  for (let t in r)
    if (r[t] !== e[t])
      return !1;
  for (let t in e)
    if (!(t in r))
      return !1;
  return !0;
}
class rm {
  constructor(e, t) {
    this.toDOM = e, this.spec = t || ku, this.side = this.spec.side || 0;
  }
  map(e, t, n, i) {
    let { pos: a, deleted: s } = e.mapResult(t.from + i, this.side < 0 ? -1 : 1);
    return s ? null : new ji(a - n, a - n, this);
  }
  valid() {
    return !0;
  }
  eq(e) {
    return this == e || e instanceof rm && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && yh(this.spec, e.spec));
  }
  destroy(e) {
    this.spec.destroy && this.spec.destroy(e);
  }
}
class ml {
  constructor(e, t) {
    this.attrs = e, this.spec = t || ku;
  }
  map(e, t, n, i) {
    let a = e.map(t.from + i, this.spec.inclusiveStart ? -1 : 1) - n, s = e.map(t.to + i, this.spec.inclusiveEnd ? 1 : -1) - n;
    return a >= s ? null : new ji(a, s, this);
  }
  valid(e, t) {
    return t.from < t.to;
  }
  eq(e) {
    return this == e || e instanceof ml && yh(this.attrs, e.attrs) && yh(this.spec, e.spec);
  }
  static is(e) {
    return e.type instanceof ml;
  }
  destroy() {
  }
}
class tk {
  constructor(e, t) {
    this.attrs = e, this.spec = t || ku;
  }
  map(e, t, n, i) {
    let a = e.mapResult(t.from + i, 1);
    if (a.deleted)
      return null;
    let s = e.mapResult(t.to + i, -1);
    return s.deleted || s.pos <= a.pos ? null : new ji(a.pos - n, s.pos - n, this);
  }
  valid(e, t) {
    let { index: n, offset: i } = e.content.findIndex(t.from), a;
    return i == t.from && !(a = e.child(n)).isText && i + a.nodeSize == t.to;
  }
  eq(e) {
    return this == e || e instanceof tk && yh(this.attrs, e.attrs) && yh(this.spec, e.spec);
  }
  destroy() {
  }
}
class ji {
  /**
  @internal
  */
  constructor(e, t, n) {
    this.from = e, this.to = t, this.type = n;
  }
  /**
  @internal
  */
  copy(e, t) {
    return new ji(e, t, this.type);
  }
  /**
  @internal
  */
  eq(e, t = 0) {
    return this.type.eq(e.type) && this.from + t == e.from && this.to + t == e.to;
  }
  /**
  @internal
  */
  map(e, t, n) {
    return this.type.map(e, this, t, n);
  }
  /**
  Creates a widget decoration, which is a DOM node that's shown in
  the document at the given position. It is recommended that you
  delay rendering the widget by passing a function that will be
  called when the widget is actually drawn in a view, but you can
  also directly pass a DOM node. `getPos` can be used to find the
  widget's current document position.
  */
  static widget(e, t, n) {
    return new ji(e, e, new rm(t, n));
  }
  /**
  Creates an inline decoration, which adds the given attributes to
  each inline node between `from` and `to`.
  */
  static inline(e, t, n, i) {
    return new ji(e, t, new ml(n, i));
  }
  /**
  Creates a node decoration. `from` and `to` should point precisely
  before and after a node in the document. That node, and only that
  node, will receive the given attributes.
  */
  static node(e, t, n, i) {
    return new ji(e, t, new tk(n, i));
  }
  /**
  The spec provided when creating this decoration. Can be useful
  if you've stored extra information in that object.
  */
  get spec() {
    return this.type.spec;
  }
  /**
  @internal
  */
  get inline() {
    return this.type instanceof ml;
  }
  /**
  @internal
  */
  get widget() {
    return this.type instanceof rm;
  }
}
const Jc = [], ku = {};
class un {
  /**
  @internal
  */
  constructor(e, t) {
    this.local = e.length ? e : Jc, this.children = t.length ? t : Jc;
  }
  /**
  Create a set of decorations, using the structure of the given
  document. This will consume (modify) the `decorations` array, so
  you must make a copy if you want need to preserve that.
  */
  static create(e, t) {
    return t.length ? nm(t, e, 0, ku) : hi;
  }
  /**
  Find all decorations in this set which touch the given range
  (including decorations that start or end directly at the
  boundaries) and match the given predicate on their spec. When
  `start` and `end` are omitted, all decorations in the set are
  considered. When `predicate` isn't given, all decorations are
  assumed to match.
  */
  find(e, t, n) {
    let i = [];
    return this.findInner(e ?? 0, t ?? 1e9, i, 0, n), i;
  }
  findInner(e, t, n, i, a) {
    for (let s = 0; s < this.local.length; s++) {
      let u = this.local[s];
      u.from <= t && u.to >= e && (!a || a(u.spec)) && n.push(u.copy(u.from + i, u.to + i));
    }
    for (let s = 0; s < this.children.length; s += 3)
      if (this.children[s] < t && this.children[s + 1] > e) {
        let u = this.children[s] + 1;
        this.children[s + 2].findInner(e - u, t - u, n, i + u, a);
      }
  }
  /**
  Map the set of decorations in response to a change in the
  document.
  */
  map(e, t, n) {
    return this == hi || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, n || ku);
  }
  /**
  @internal
  */
  mapInner(e, t, n, i, a) {
    let s;
    for (let u = 0; u < this.local.length; u++) {
      let f = this.local[u].map(e, n, i);
      f && f.type.valid(t, f) ? (s || (s = [])).push(f) : a.onRemove && a.onRemove(this.local[u].spec);
    }
    return this.children.length ? Hte(this.children, s || [], e, t, n, i, a) : s ? new un(s.sort(wu), Jc) : hi;
  }
  /**
  Add the given array of decorations to the ones in the set,
  producing a new set. Consumes the `decorations` array. Needs
  access to the current document to create the appropriate tree
  structure.
  */
  add(e, t) {
    return t.length ? this == hi ? un.create(e, t) : this.addInner(e, t, 0) : this;
  }
  addInner(e, t, n) {
    let i, a = 0;
    e.forEach((u, f) => {
      let p = f + n, y;
      if (y = ex(t, u, p)) {
        for (i || (i = this.children.slice()); a < i.length && i[a] < f; )
          a += 3;
        i[a] == f ? i[a + 2] = i[a + 2].addInner(u, y, p + 1) : i.splice(a, 0, f, f + u.nodeSize, nm(y, u, p + 1, ku)), a += 3;
      }
    });
    let s = ZS(a ? tx(t) : t, -n);
    for (let u = 0; u < s.length; u++)
      s[u].type.valid(e, s[u]) || s.splice(u--, 1);
    return new un(s.length ? this.local.concat(s).sort(wu) : this.local, i || this.children);
  }
  /**
  Create a new set that contains the decorations in this set, minus
  the ones in the given array.
  */
  remove(e) {
    return e.length == 0 || this == hi ? this : this.removeInner(e, 0);
  }
  removeInner(e, t) {
    let n = this.children, i = this.local;
    for (let a = 0; a < n.length; a += 3) {
      let s, u = n[a] + t, f = n[a + 1] + t;
      for (let y = 0, T; y < e.length; y++)
        (T = e[y]) && T.from > u && T.to < f && (e[y] = null, (s || (s = [])).push(T));
      if (!s)
        continue;
      n == this.children && (n = this.children.slice());
      let p = n[a + 2].removeInner(s, u + 1);
      p != hi ? n[a + 2] = p : (n.splice(a, 3), a -= 3);
    }
    if (i.length) {
      for (let a = 0, s; a < e.length; a++)
        if (s = e[a])
          for (let u = 0; u < i.length; u++)
            i[u].eq(s, t) && (i == this.local && (i = this.local.slice()), i.splice(u--, 1));
    }
    return n == this.children && i == this.local ? this : i.length || n.length ? new un(i, n) : hi;
  }
  forChild(e, t) {
    if (this == hi)
      return this;
    if (t.isLeaf)
      return un.empty;
    let n, i;
    for (let u = 0; u < this.children.length; u += 3)
      if (this.children[u] >= e) {
        this.children[u] == e && (n = this.children[u + 2]);
        break;
      }
    let a = e + 1, s = a + t.content.size;
    for (let u = 0; u < this.local.length; u++) {
      let f = this.local[u];
      if (f.from < s && f.to > a && f.type instanceof ml) {
        let p = Math.max(a, f.from) - a, y = Math.min(s, f.to) - a;
        p < y && (i || (i = [])).push(f.copy(p, y));
      }
    }
    if (i) {
      let u = new un(i.sort(wu), Jc);
      return n ? new ll([u, n]) : u;
    }
    return n || hi;
  }
  /**
  @internal
  */
  eq(e) {
    if (this == e)
      return !0;
    if (!(e instanceof un) || this.local.length != e.local.length || this.children.length != e.children.length)
      return !1;
    for (let t = 0; t < this.local.length; t++)
      if (!this.local[t].eq(e.local[t]))
        return !1;
    for (let t = 0; t < this.children.length; t += 3)
      if (this.children[t] != e.children[t] || this.children[t + 1] != e.children[t + 1] || !this.children[t + 2].eq(e.children[t + 2]))
        return !1;
    return !0;
  }
  /**
  @internal
  */
  locals(e) {
    return rk(this.localsInner(e));
  }
  /**
  @internal
  */
  localsInner(e) {
    if (this == hi)
      return Jc;
    if (e.inlineContent || !this.local.some(ml.is))
      return this.local;
    let t = [];
    for (let n = 0; n < this.local.length; n++)
      this.local[n].type instanceof ml || t.push(this.local[n]);
    return t;
  }
  forEachSet(e) {
    e(this);
  }
}
un.empty = new un([], []);
un.removeOverlap = rk;
const hi = un.empty;
class ll {
  constructor(e) {
    this.members = e;
  }
  map(e, t) {
    const n = this.members.map((i) => i.map(e, t, ku));
    return ll.from(n);
  }
  forChild(e, t) {
    if (t.isLeaf)
      return un.empty;
    let n = [];
    for (let i = 0; i < this.members.length; i++) {
      let a = this.members[i].forChild(e, t);
      a != hi && (a instanceof ll ? n = n.concat(a.members) : n.push(a));
    }
    return ll.from(n);
  }
  eq(e) {
    if (!(e instanceof ll) || e.members.length != this.members.length)
      return !1;
    for (let t = 0; t < this.members.length; t++)
      if (!this.members[t].eq(e.members[t]))
        return !1;
    return !0;
  }
  locals(e) {
    let t, n = !0;
    for (let i = 0; i < this.members.length; i++) {
      let a = this.members[i].localsInner(e);
      if (a.length)
        if (!t)
          t = a;
        else {
          n && (t = t.slice(), n = !1);
          for (let s = 0; s < a.length; s++)
            t.push(a[s]);
        }
    }
    return t ? rk(n ? t : t.sort(wu)) : Jc;
  }
  // Create a group for the given array of decoration sets, or return
  // a single set when possible.
  static from(e) {
    switch (e.length) {
      case 0:
        return hi;
      case 1:
        return e[0];
      default:
        return new ll(e.every((t) => t instanceof un) ? e : e.reduce((t, n) => t.concat(n instanceof un ? n : n.members), []));
    }
  }
  forEachSet(e) {
    for (let t = 0; t < this.members.length; t++)
      this.members[t].forEachSet(e);
  }
}
function Hte(r, e, t, n, i, a, s) {
  let u = r.slice();
  for (let p = 0, y = a; p < t.maps.length; p++) {
    let T = 0;
    t.maps[p].forEach((N, O, A, q) => {
      let U = q - A - (O - N);
      for (let j = 0; j < u.length; j += 3) {
        let te = u[j + 1];
        if (te < 0 || N > te + y - T)
          continue;
        let se = u[j] + y - T;
        O >= se ? u[j + 1] = N <= se ? -2 : -1 : N >= y && U && (u[j] += U, u[j + 1] += U);
      }
      T += U;
    }), y = t.maps[p].map(y, -1);
  }
  let f = !1;
  for (let p = 0; p < u.length; p += 3)
    if (u[p + 1] < 0) {
      if (u[p + 1] == -2) {
        f = !0, u[p + 1] = -1;
        continue;
      }
      let y = t.map(r[p] + a), T = y - i;
      if (T < 0 || T >= n.content.size) {
        f = !0;
        continue;
      }
      let N = t.map(r[p + 1] + a, -1), O = N - i, { index: A, offset: q } = n.content.findIndex(T), U = n.maybeChild(A);
      if (U && q == T && q + U.nodeSize == O) {
        let j = u[p + 2].mapInner(t, U, y + 1, r[p] + a + 1, s);
        j != hi ? (u[p] = T, u[p + 1] = O, u[p + 2] = j) : (u[p + 1] = -2, f = !0);
      } else
        f = !0;
    }
  if (f) {
    let p = Vte(u, r, e, t, i, a, s), y = nm(p, n, 0, s);
    e = y.local;
    for (let T = 0; T < u.length; T += 3)
      u[T + 1] < 0 && (u.splice(T, 3), T -= 3);
    for (let T = 0, N = 0; T < y.children.length; T += 3) {
      let O = y.children[T];
      for (; N < u.length && u[N] < O; )
        N += 3;
      u.splice(N, 0, y.children[T], y.children[T + 1], y.children[T + 2]);
    }
  }
  return new un(e.sort(wu), u);
}
function ZS(r, e) {
  if (!e || !r.length)
    return r;
  let t = [];
  for (let n = 0; n < r.length; n++) {
    let i = r[n];
    t.push(new ji(i.from + e, i.to + e, i.type));
  }
  return t;
}
function Vte(r, e, t, n, i, a, s) {
  function u(f, p) {
    for (let y = 0; y < f.local.length; y++) {
      let T = f.local[y].map(n, i, p);
      T ? t.push(T) : s.onRemove && s.onRemove(f.local[y].spec);
    }
    for (let y = 0; y < f.children.length; y += 3)
      u(f.children[y + 2], f.children[y] + p + 1);
  }
  for (let f = 0; f < r.length; f += 3)
    r[f + 1] == -1 && u(r[f + 2], e[f] + a + 1);
  return t;
}
function ex(r, e, t) {
  if (e.isLeaf)
    return null;
  let n = t + e.nodeSize, i = null;
  for (let a = 0, s; a < r.length; a++)
    (s = r[a]) && s.from > t && s.to < n && ((i || (i = [])).push(s), r[a] = null);
  return i;
}
function tx(r) {
  let e = [];
  for (let t = 0; t < r.length; t++)
    r[t] != null && e.push(r[t]);
  return e;
}
function nm(r, e, t, n) {
  let i = [], a = !1;
  e.forEach((u, f) => {
    let p = ex(r, u, f + t);
    if (p) {
      a = !0;
      let y = nm(p, u, t + f + 1, n);
      y != hi && i.push(f, f + u.nodeSize, y);
    }
  });
  let s = ZS(a ? tx(r) : r, -t).sort(wu);
  for (let u = 0; u < s.length; u++)
    s[u].type.valid(e, s[u]) || (n.onRemove && n.onRemove(s[u].spec), s.splice(u--, 1));
  return s.length || i.length ? new un(s, i) : hi;
}
function wu(r, e) {
  return r.from - e.from || r.to - e.to;
}
function rk(r) {
  let e = r;
  for (let t = 0; t < e.length - 1; t++) {
    let n = e[t];
    if (n.from != n.to)
      for (let i = t + 1; i < e.length; i++) {
        let a = e[i];
        if (a.from == n.from) {
          a.to != n.to && (e == r && (e = r.slice()), e[i] = a.copy(a.from, n.to), ib(e, i + 1, a.copy(n.to, a.to)));
          continue;
        } else {
          a.from < n.to && (e == r && (e = r.slice()), e[t] = n.copy(n.from, a.from), ib(e, i, n.copy(a.from, n.to)));
          break;
        }
      }
  }
  return e;
}
function ib(r, e, t) {
  for (; e < r.length && wu(t, r[e]) > 0; )
    e++;
  r.splice(e, 0, t);
}
function Cy(r) {
  let e = [];
  return r.someProp("decorations", (t) => {
    let n = t(r.state);
    n && n != hi && e.push(n);
  }), r.cursorWrapper && e.push(un.create(r.state.doc, [r.cursorWrapper.deco])), ll.from(e);
}
const Ute = {
  childList: !0,
  characterData: !0,
  characterDataOldValue: !0,
  attributes: !0,
  attributeOldValue: !0,
  subtree: !0
}, $te = Gi && pl <= 11;
class Wte {
  constructor() {
    this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
  }
  set(e) {
    this.anchorNode = e.anchorNode, this.anchorOffset = e.anchorOffset, this.focusNode = e.focusNode, this.focusOffset = e.focusOffset;
  }
  clear() {
    this.anchorNode = this.focusNode = null;
  }
  eq(e) {
    return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
  }
}
class jte {
  constructor(e, t) {
    this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Wte(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((n) => {
      for (let i = 0; i < n.length; i++)
        this.queue.push(n[i]);
      Gi && pl <= 11 && n.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
    }), $te && (this.onCharData = (n) => {
      this.queue.push({ target: n.target, type: "characterData", oldValue: n.prevValue }), this.flushSoon();
    }), this.onSelectionChange = this.onSelectionChange.bind(this);
  }
  flushSoon() {
    this.flushingSoon < 0 && (this.flushingSoon = window.setTimeout(() => {
      this.flushingSoon = -1, this.flush();
    }, 20));
  }
  forceFlush() {
    this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
  }
  start() {
    this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, Ute)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
  }
  stop() {
    if (this.observer) {
      let e = this.observer.takeRecords();
      if (e.length) {
        for (let t = 0; t < e.length; t++)
          this.queue.push(e[t]);
        window.setTimeout(() => this.flush(), 20);
      }
      this.observer.disconnect();
    }
    this.onCharData && this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData), this.disconnectSelection();
  }
  connectSelection() {
    this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange);
  }
  disconnectSelection() {
    this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange);
  }
  suppressSelectionUpdates() {
    this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
  }
  onSelectionChange() {
    if (Q1(this.view)) {
      if (this.suppressingSelectionUpdates)
        return Ts(this.view);
      if (Gi && pl <= 11 && !this.view.state.selection.empty) {
        let e = this.view.domSelectionRange();
        if (e.focusNode && xu(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
          return this.flushSoon();
      }
      this.flush();
    }
  }
  setCurSelection() {
    this.currentSelection.set(this.view.domSelectionRange());
  }
  ignoreSelectionChange(e) {
    if (!e.focusNode)
      return !0;
    let t = /* @__PURE__ */ new Set(), n;
    for (let a = e.focusNode; a; a = af(a))
      t.add(a);
    for (let a = e.anchorNode; a; a = af(a))
      if (t.has(a)) {
        n = a;
        break;
      }
    let i = n && this.view.docView.nearestDesc(n);
    if (i && i.ignoreMutation({
      type: "selection",
      target: n.nodeType == 3 ? n.parentNode : n
    }))
      return this.setCurSelection(), !0;
  }
  pendingRecords() {
    if (this.observer)
      for (let e of this.observer.takeRecords())
        this.queue.push(e);
    return this.queue;
  }
  flush() {
    let { view: e } = this;
    if (!e.docView || this.flushingSoon > -1)
      return;
    let t = this.pendingRecords();
    t.length && (this.queue = []);
    let n = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(n) && Q1(e) && !this.ignoreSelectionChange(n), a = -1, s = -1, u = !1, f = [];
    if (e.editable)
      for (let y = 0; y < t.length; y++) {
        let T = this.registerMutation(t[y], f);
        T && (a = a < 0 ? T.from : Math.min(T.from, a), s = s < 0 ? T.to : Math.max(T.to, s), T.typeOver && (u = !0));
      }
    if (xa && f.length) {
      let y = f.filter((T) => T.nodeName == "BR");
      if (y.length == 2) {
        let [T, N] = y;
        T.parentNode && T.parentNode.parentNode == N.parentNode ? N.remove() : T.remove();
      } else {
        let { focusNode: T } = this.currentSelection;
        for (let N of y) {
          let O = N.parentNode;
          O && O.nodeName == "LI" && (!T || Jte(e, T) != O) && N.remove();
        }
      }
    } else if ((Fn || mi) && f.some((y) => y.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46)) {
      for (let y of f)
        if (y.nodeName == "BR" && y.parentNode) {
          let T = y.nextSibling;
          T && T.nodeType == 1 && T.contentEditable == "false" && y.parentNode.removeChild(y);
        }
    }
    let p = null;
    a < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Mm(n) && (p = J0(e)) && p.eq(cr.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Ts(e), this.currentSelection.set(n), e.scrollToSelection()) : (a > -1 || i) && (a > -1 && (e.docView.markDirty(a, s), Gte(e)), this.handleDOMChange(a, s, u, f), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || Ts(e), this.currentSelection.set(n));
  }
  registerMutation(e, t) {
    if (t.indexOf(e.target) > -1)
      return null;
    let n = this.view.docView.nearestDesc(e.target);
    if (e.type == "attributes" && (n == this.view.docView || e.attributeName == "contenteditable" || // Firefox sometimes fires spurious events for null/empty styles
    e.attributeName == "style" && !e.oldValue && !e.target.getAttribute("style")) || !n || n.ignoreMutation(e))
      return null;
    if (e.type == "childList") {
      for (let y = 0; y < e.addedNodes.length; y++) {
        let T = e.addedNodes[y];
        t.push(T), T.nodeType == 3 && (this.lastChangedTextNode = T);
      }
      if (n.contentDOM && n.contentDOM != n.dom && !n.contentDOM.contains(e.target))
        return { from: n.posBefore, to: n.posAfter };
      let i = e.previousSibling, a = e.nextSibling;
      if (Gi && pl <= 11 && e.addedNodes.length)
        for (let y = 0; y < e.addedNodes.length; y++) {
          let { previousSibling: T, nextSibling: N } = e.addedNodes[y];
          (!T || Array.prototype.indexOf.call(e.addedNodes, T) < 0) && (i = T), (!N || Array.prototype.indexOf.call(e.addedNodes, N) < 0) && (a = N);
        }
      let s = i && i.parentNode == e.target ? Yn(i) + 1 : 0, u = n.localPosFromDOM(e.target, s, -1), f = a && a.parentNode == e.target ? Yn(a) : e.target.childNodes.length, p = n.localPosFromDOM(e.target, f, 1);
      return { from: u, to: p };
    } else return e.type == "attributes" ? { from: n.posAtStart - n.border, to: n.posAtEnd + n.border } : (this.lastChangedTextNode = e.target, {
      from: n.posAtStart,
      to: n.posAtEnd,
      // An event was generated for a text change that didn't change
      // any text. Mark the dom change to fall back to assuming the
      // selection was typed over with an identical value if it can't
      // find another change.
      typeOver: e.target.nodeValue == e.oldValue
    });
  }
}
let ab = /* @__PURE__ */ new WeakMap(), ob = !1;
function Gte(r) {
  if (!ab.has(r) && (ab.set(r, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace) !== -1)) {
    if (r.requiresGeckoHackNode = xa, ob)
      return;
    console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), ob = !0;
  }
}
function sb(r, e) {
  let t = e.startContainer, n = e.startOffset, i = e.endContainer, a = e.endOffset, s = r.domAtPos(r.state.selection.anchor);
  return xu(s.node, s.offset, i, a) && ([t, n, i, a] = [i, a, t, n]), { anchorNode: t, anchorOffset: n, focusNode: i, focusOffset: a };
}
function Kte(r, e) {
  if (e.getComposedRanges) {
    let i = e.getComposedRanges(r.root)[0];
    if (i)
      return sb(r, i);
  }
  let t;
  function n(i) {
    i.preventDefault(), i.stopImmediatePropagation(), t = i.getTargetRanges()[0];
  }
  return r.dom.addEventListener("beforeinput", n, !0), document.execCommand("indent"), r.dom.removeEventListener("beforeinput", n, !0), t ? sb(r, t) : null;
}
function Jte(r, e) {
  for (let t = e.parentNode; t && t != r.dom; t = t.parentNode) {
    let n = r.docView.nearestDesc(t, !0);
    if (n && n.node.isBlock)
      return t;
  }
  return null;
}
function Qte(r, e, t) {
  let { node: n, fromOffset: i, toOffset: a, from: s, to: u } = r.docView.parseRange(e, t), f = r.domSelectionRange(), p, y = f.anchorNode;
  if (y && r.dom.contains(y.nodeType == 1 ? y : y.parentNode) && (p = [{ node: y, offset: f.anchorOffset }], Mm(f) || p.push({ node: f.focusNode, offset: f.focusOffset })), Fn && r.input.lastKeyCode === 8)
    for (let U = a; U > i; U--) {
      let j = n.childNodes[U - 1], te = j.pmViewDesc;
      if (j.nodeName == "BR" && !te) {
        a = U;
        break;
      }
      if (!te || te.size)
        break;
    }
  let T = r.state.doc, N = r.someProp("domParser") || Tu.fromSchema(r.state.schema), O = T.resolve(s), A = null, q = N.parse(n, {
    topNode: O.parent,
    topMatch: O.parent.contentMatchAt(O.index()),
    topOpen: !0,
    from: i,
    to: a,
    preserveWhitespace: O.parent.type.whitespace == "pre" ? "full" : !0,
    findPositions: p,
    ruleFromNode: Xte,
    context: O
  });
  if (p && p[0].pos != null) {
    let U = p[0].pos, j = p[1] && p[1].pos;
    j == null && (j = U), A = { anchor: U + s, head: j + s };
  }
  return { doc: q, sel: A, from: s, to: u };
}
function Xte(r) {
  let e = r.pmViewDesc;
  if (e)
    return e.parseRule();
  if (r.nodeName == "BR" && r.parentNode) {
    if (mi && /^(ul|ol)$/i.test(r.parentNode.nodeName)) {
      let t = document.createElement("div");
      return t.appendChild(document.createElement("li")), { skip: t };
    } else if (r.parentNode.lastChild == r || mi && /^(tr|table)$/i.test(r.parentNode.nodeName))
      return { ignore: !0 };
  } else if (r.nodeName == "IMG" && r.getAttribute("mark-placeholder"))
    return { ignore: !0 };
  return null;
}
const Yte = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
function Zte(r, e, t, n, i) {
  let a = r.input.compositionPendingChanges || (r.composing ? r.input.compositionID : 0);
  if (r.input.compositionPendingChanges = 0, e < 0) {
    let ke = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, Ne = J0(r, ke);
    if (Ne && !r.state.selection.eq(Ne)) {
      if (Fn && bs && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (Ze) => Ze(r, hu(13, "Enter"))))
        return;
      let ze = r.state.tr.setSelection(Ne);
      ke == "pointer" ? ze.setMeta("pointer", !0) : ke == "key" && ze.scrollIntoView(), a && ze.setMeta("composition", a), r.dispatch(ze);
    }
    return;
  }
  let s = r.state.doc.resolve(e), u = s.sharedDepth(t);
  e = s.before(u + 1), t = r.state.doc.resolve(t).after(u + 1);
  let f = r.state.selection, p = Qte(r, e, t), y = r.state.doc, T = y.slice(p.from, p.to), N, O;
  r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (N = r.state.selection.to, O = "end") : (N = r.state.selection.from, O = "start"), r.input.lastKeyCode = null;
  let A = rre(T.content, p.doc.content, p.from, N, O);
  if (A && r.input.domChangeCount++, (of && r.input.lastIOSEnter > Date.now() - 225 || bs) && i.some((ke) => ke.nodeType == 1 && !Yte.test(ke.nodeName)) && (!A || A.endA >= A.endB) && r.someProp("handleKeyDown", (ke) => ke(r, hu(13, "Enter")))) {
    r.input.lastIOSEnter = 0;
    return;
  }
  if (!A)
    if (n && f instanceof dr && !f.empty && f.$head.sameParent(f.$anchor) && !r.composing && !(p.sel && p.sel.anchor != p.sel.head))
      A = { start: f.from, endA: f.to, endB: f.to };
    else {
      if (p.sel) {
        let ke = lb(r, r.state.doc, p.sel);
        if (ke && !ke.eq(r.state.selection)) {
          let Ne = r.state.tr.setSelection(ke);
          a && Ne.setMeta("composition", a), r.dispatch(Ne);
        }
      }
      return;
    }
  r.state.selection.from < r.state.selection.to && A.start == A.endB && r.state.selection instanceof dr && (A.start > r.state.selection.from && A.start <= r.state.selection.from + 2 && r.state.selection.from >= p.from ? A.start = r.state.selection.from : A.endA < r.state.selection.to && A.endA >= r.state.selection.to - 2 && r.state.selection.to <= p.to && (A.endB += r.state.selection.to - A.endA, A.endA = r.state.selection.to)), Gi && pl <= 11 && A.endB == A.start + 1 && A.endA == A.start && A.start > p.from && p.doc.textBetween(A.start - p.from - 1, A.start - p.from + 1) == "  " && (A.start--, A.endA--, A.endB--);
  let q = p.doc.resolveNoCache(A.start - p.from), U = p.doc.resolveNoCache(A.endB - p.from), j = y.resolve(A.start), te = q.sameParent(U) && q.parent.inlineContent && j.end() >= A.endA;
  if ((of && r.input.lastIOSEnter > Date.now() - 225 && (!te || i.some((ke) => ke.nodeName == "DIV" || ke.nodeName == "P")) || !te && q.pos < p.doc.content.size && (!q.sameParent(U) || !q.parent.inlineContent) && q.pos < U.pos && !/\S/.test(p.doc.textBetween(q.pos, U.pos, "", ""))) && r.someProp("handleKeyDown", (ke) => ke(r, hu(13, "Enter")))) {
    r.input.lastIOSEnter = 0;
    return;
  }
  if (r.state.selection.anchor > A.start && tre(y, A.start, A.endA, q, U) && r.someProp("handleKeyDown", (ke) => ke(r, hu(8, "Backspace")))) {
    bs && Fn && r.domObserver.suppressSelectionUpdates();
    return;
  }
  Fn && A.endB == A.start && (r.input.lastChromeDelete = Date.now()), bs && !te && q.start() != U.start() && U.parentOffset == 0 && q.depth == U.depth && p.sel && p.sel.anchor == p.sel.head && p.sel.head == A.endA && (A.endB -= 2, U = p.doc.resolveNoCache(A.endB - p.from), setTimeout(() => {
    r.someProp("handleKeyDown", function(ke) {
      return ke(r, hu(13, "Enter"));
    });
  }, 20));
  let se = A.start, me = A.endA, Ce = (ke) => {
    let Ne = ke || r.state.tr.replace(se, me, p.doc.slice(A.start - p.from, A.endB - p.from));
    if (p.sel) {
      let ze = lb(r, Ne.doc, p.sel);
      ze && !(Fn && r.composing && ze.empty && (A.start != A.endB || r.input.lastChromeDelete < Date.now() - 100) && (ze.head == se || ze.head == Ne.mapping.map(me) - 1) || Gi && ze.empty && ze.head == se) && Ne.setSelection(ze);
    }
    return a && Ne.setMeta("composition", a), Ne.scrollIntoView();
  }, pe;
  if (te)
    if (q.pos == U.pos) {
      Gi && pl <= 11 && q.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => Ts(r), 20));
      let ke = Ce(r.state.tr.delete(se, me)), Ne = y.resolve(A.start).marksAcross(y.resolve(A.endA));
      Ne && ke.ensureMarks(Ne), r.dispatch(ke);
    } else if (
      // Adding or removing a mark
      A.endA == A.endB && (pe = ere(q.parent.content.cut(q.parentOffset, U.parentOffset), j.parent.content.cut(j.parentOffset, A.endA - j.start())))
    ) {
      let ke = Ce(r.state.tr);
      pe.type == "add" ? ke.addMark(se, me, pe.mark) : ke.removeMark(se, me, pe.mark), r.dispatch(ke);
    } else if (q.parent.child(q.index()).isText && q.index() == U.index() - (U.textOffset ? 0 : 1)) {
      let ke = q.parent.textBetween(q.parentOffset, U.parentOffset), Ne = () => Ce(r.state.tr.insertText(ke, se, me));
      r.someProp("handleTextInput", (ze) => ze(r, se, me, ke, Ne)) || r.dispatch(Ne());
    } else
      r.dispatch(Ce());
  else
    r.dispatch(Ce());
}
function lb(r, e, t) {
  return Math.max(t.anchor, t.head) > e.content.size ? null : Q0(r, e.resolve(t.anchor), e.resolve(t.head));
}
function ere(r, e) {
  let t = r.firstChild.marks, n = e.firstChild.marks, i = t, a = n, s, u, f;
  for (let y = 0; y < n.length; y++)
    i = n[y].removeFromSet(i);
  for (let y = 0; y < t.length; y++)
    a = t[y].removeFromSet(a);
  if (i.length == 1 && a.length == 0)
    u = i[0], s = "add", f = (y) => y.mark(u.addToSet(y.marks));
  else if (i.length == 0 && a.length == 1)
    u = a[0], s = "remove", f = (y) => y.mark(u.removeFromSet(y.marks));
  else
    return null;
  let p = [];
  for (let y = 0; y < e.childCount; y++)
    p.push(f(e.child(y)));
  if (Qe.from(p).eq(r))
    return { mark: u, type: s };
}
function tre(r, e, t, n, i) {
  if (
    // The content must have shrunk
    t - e <= i.pos - n.pos || // newEnd must point directly at or after the end of the block that newStart points into
    Ty(n, !0, !1) < i.pos
  )
    return !1;
  let a = r.resolve(e);
  if (!n.parent.isTextblock) {
    let u = a.nodeAfter;
    return u != null && t == e + u.nodeSize;
  }
  if (a.parentOffset < a.parent.content.size || !a.parent.isTextblock)
    return !1;
  let s = r.resolve(Ty(a, !0, !0));
  return !s.parent.isTextblock || s.pos > t || Ty(s, !0, !1) < t ? !1 : n.parent.content.cut(n.parentOffset).eq(s.parent.content);
}
function Ty(r, e, t) {
  let n = r.depth, i = e ? r.end() : r.pos;
  for (; n > 0 && (e || r.indexAfter(n) == r.node(n).childCount); )
    n--, i++, e = !1;
  if (t) {
    let a = r.node(n).maybeChild(r.indexAfter(n));
    for (; a && !a.isLeaf; )
      a = a.firstChild, i++;
  }
  return i;
}
function rre(r, e, t, n, i) {
  let a = r.findDiffStart(e, t);
  if (a == null)
    return null;
  let { a: s, b: u } = r.findDiffEnd(e, t + r.size, t + e.size);
  if (i == "end") {
    let f = Math.max(0, a - Math.min(s, u));
    n -= s + f - a;
  }
  if (s < a && r.size < e.size) {
    let f = n <= a && n >= s ? a - n : 0;
    a -= f, a && a < e.size && ub(e.textBetween(a - 1, a + 1)) && (a += f ? 1 : -1), u = a + (u - s), s = a;
  } else if (u < a) {
    let f = n <= a && n >= u ? a - n : 0;
    a -= f, a && a < r.size && ub(r.textBetween(a - 1, a + 1)) && (a += f ? 1 : -1), s = a + (s - u), u = a;
  }
  return { start: a, endA: s, endB: u };
}
function ub(r) {
  if (r.length != 2)
    return !1;
  let e = r.charCodeAt(0), t = r.charCodeAt(1);
  return e >= 56320 && e <= 57343 && t >= 55296 && t <= 56319;
}
class Dm {
  /**
  Create a view. `place` may be a DOM node that the editor should
  be appended to, a function that will place it into the document,
  or an object whose `mount` property holds the node to use as the
  document container. If it is `null`, the editor will not be
  added to the document.
  */
  constructor(e, t) {
    this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new kte(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(pb), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = db(this), fb(this), this.nodeViews = hb(this), this.docView = $1(this.state.doc, cb(this), Cy(this), this.dom, this), this.domObserver = new jte(this, (n, i, a, s) => Zte(this, n, i, a, s)), this.domObserver.start(), wte(this), this.updatePluginViews();
  }
  /**
  Holds `true` when a
  [composition](https://w3c.github.io/uievents/#events-compositionevents)
  is active.
  */
  get composing() {
    return this.input.composing;
  }
  /**
  The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).
  */
  get props() {
    if (this._props.state != this.state) {
      let e = this._props;
      this._props = {};
      for (let t in e)
        this._props[t] = e[t];
      this._props.state = this.state;
    }
    return this._props;
  }
  /**
  Update the view's props. Will immediately cause an update to
  the DOM.
  */
  update(e) {
    e.handleDOMEvents != this._props.handleDOMEvents && v0(this);
    let t = this._props;
    this._props = e, e.plugins && (e.plugins.forEach(pb), this.directPlugins = e.plugins), this.updateStateInner(e.state, t);
  }
  /**
  Update the view by updating existing props object with the object
  given as argument. Equivalent to `view.update(Object.assign({},
  view.props, props))`.
  */
  setProps(e) {
    let t = {};
    for (let n in this._props)
      t[n] = this._props[n];
    t.state = this.state;
    for (let n in e)
      t[n] = e[n];
    this.update(t);
  }
  /**
  Update the editor's `state` prop, without touching any of the
  other props.
  */
  updateState(e) {
    this.updateStateInner(e, this._props);
  }
  updateStateInner(e, t) {
    var n;
    let i = this.state, a = !1, s = !1;
    e.storedMarks && this.composing && (JS(this), s = !0), this.state = e;
    let u = i.plugins != e.plugins || this._props.plugins != t.plugins;
    if (u || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
      let O = hb(this);
      ire(O, this.nodeViews) && (this.nodeViews = O, a = !0);
    }
    (u || t.handleDOMEvents != this._props.handleDOMEvents) && v0(this), this.editable = db(this), fb(this);
    let f = Cy(this), p = cb(this), y = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", T = a || !this.docView.matchesNode(e.doc, p, f);
    (T || !e.selection.eq(i.selection)) && (s = !0);
    let N = y == "preserve" && s && this.dom.style.overflowAnchor == null && Iee(this);
    if (s) {
      this.domObserver.stop();
      let O = T && (Gi || Fn) && !this.composing && !i.selection.empty && !e.selection.empty && nre(i.selection, e.selection);
      if (T) {
        let A = Fn ? this.trackWrites = this.domSelectionRange().focusNode : null;
        this.composing && (this.input.compositionNode = Ite(this)), (a || !this.docView.update(e.doc, p, f, this)) && (this.docView.updateOuterDeco(p), this.docView.destroy(), this.docView = $1(e.doc, p, f, this.dom, this)), A && !this.trackWrites && (O = !0);
      }
      O || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && ite(this)) ? Ts(this, O) : (FS(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
    }
    this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), y == "reset" ? this.dom.scrollTop = 0 : y == "to selection" ? this.scrollToSelection() : N && Pee(N);
  }
  /**
  @internal
  */
  scrollToSelection() {
    let e = this.domSelectionRange().focusNode;
    if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode))) {
      if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof Kt) {
        let t = this.docView.domAfterPos(this.state.selection.from);
        t.nodeType == 1 && _1(this, t.getBoundingClientRect(), e);
      } else
        _1(this, this.coordsAtPos(this.state.selection.head, 1), e);
    }
  }
  destroyPluginViews() {
    let e;
    for (; e = this.pluginViews.pop(); )
      e.destroy && e.destroy();
  }
  updatePluginViews(e) {
    if (!e || e.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
      this.prevDirectPlugins = this.directPlugins, this.destroyPluginViews();
      for (let t = 0; t < this.directPlugins.length; t++) {
        let n = this.directPlugins[t];
        n.spec.view && this.pluginViews.push(n.spec.view(this));
      }
      for (let t = 0; t < this.state.plugins.length; t++) {
        let n = this.state.plugins[t];
        n.spec.view && this.pluginViews.push(n.spec.view(this));
      }
    } else
      for (let t = 0; t < this.pluginViews.length; t++) {
        let n = this.pluginViews[t];
        n.update && n.update(this, e);
      }
  }
  updateDraggedNode(e, t) {
    let n = e.node, i = -1;
    if (this.state.doc.nodeAt(n.from) == n.node)
      i = n.from;
    else {
      let a = n.from + (this.state.doc.content.size - t.doc.content.size);
      (a > 0 && this.state.doc.nodeAt(a)) == n.node && (i = a);
    }
    this.dragging = new XS(e.slice, e.move, i < 0 ? void 0 : Kt.create(this.state.doc, i));
  }
  someProp(e, t) {
    let n = this._props && this._props[e], i;
    if (n != null && (i = t ? t(n) : n))
      return i;
    for (let s = 0; s < this.directPlugins.length; s++) {
      let u = this.directPlugins[s].props[e];
      if (u != null && (i = t ? t(u) : u))
        return i;
    }
    let a = this.state.plugins;
    if (a)
      for (let s = 0; s < a.length; s++) {
        let u = a[s].props[e];
        if (u != null && (i = t ? t(u) : u))
          return i;
      }
  }
  /**
  Query whether the view has focus.
  */
  hasFocus() {
    if (Gi) {
      let e = this.root.activeElement;
      if (e == this.dom)
        return !0;
      if (!e || !this.dom.contains(e))
        return !1;
      for (; e && this.dom != e && this.dom.contains(e); ) {
        if (e.contentEditable == "false")
          return !1;
        e = e.parentElement;
      }
      return !0;
    }
    return this.root.activeElement == this.dom;
  }
  /**
  Focus the editor.
  */
  focus() {
    this.domObserver.stop(), this.editable && Bee(this.dom), Ts(this), this.domObserver.start();
  }
  /**
  Get the document root in which the editor exists. This will
  usually be the top-level `document`, but might be a [shadow
  DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
  root if the editor is inside one.
  */
  get root() {
    let e = this._root;
    if (e == null) {
      for (let t = this.dom.parentNode; t; t = t.parentNode)
        if (t.nodeType == 9 || t.nodeType == 11 && t.host)
          return t.getSelection || (Object.getPrototypeOf(t).getSelection = () => t.ownerDocument.getSelection()), this._root = t;
    }
    return e || document;
  }
  /**
  When an existing editor view is moved to a new document or
  shadow tree, call this to make it recompute its root.
  */
  updateRoot() {
    this._root = null;
  }
  /**
  Given a pair of viewport coordinates, return the document
  position that corresponds to them. May return null if the given
  coordinates aren't inside of the editor. When an object is
  returned, its `pos` property is the position nearest to the
  coordinates, and its `inside` property holds the position of the
  inner node that the position falls inside of, or -1 if it is at
  the top level, not in any node.
  */
  posAtCoords(e) {
    return Hee(this, e);
  }
  /**
  Returns the viewport rectangle at a given document position.
  `left` and `right` will be the same number, as this returns a
  flat cursor-ish rectangle. If the position is between two things
  that aren't directly adjacent, `side` determines which element
  is used. When < 0, the element before the position is used,
  otherwise the element after.
  */
  coordsAtPos(e, t = 1) {
    return OS(this, e, t);
  }
  /**
  Find the DOM position that corresponds to the given document
  position. When `side` is negative, find the position as close as
  possible to the content before the position. When positive,
  prefer positions close to the content after the position. When
  zero, prefer as shallow a position as possible.
  
  Note that you should **not** mutate the editor's internal DOM,
  only inspect it (and even that is usually not necessary).
  */
  domAtPos(e, t = 0) {
    return this.docView.domFromPos(e, t);
  }
  /**
  Find the DOM node that represents the document node after the
  given position. May return `null` when the position doesn't point
  in front of a node or if the node is inside an opaque node view.
  
  This is intended to be able to call things like
  `getBoundingClientRect` on that DOM node. Do **not** mutate the
  editor DOM directly, or add styling this way, since that will be
  immediately overriden by the editor as it redraws the node.
  */
  nodeDOM(e) {
    let t = this.docView.descAt(e);
    return t ? t.nodeDOM : null;
  }
  /**
  Find the document position that corresponds to a given DOM
  position. (Whenever possible, it is preferable to inspect the
  document structure directly, rather than poking around in the
  DOM, but sometimes—for example when interpreting an event
  target—you don't have a choice.)
  
  The `bias` parameter can be used to influence which side of a DOM
  node to use when the position is inside a leaf node.
  */
  posAtDOM(e, t, n = -1) {
    let i = this.docView.posFromDOM(e, t, n);
    if (i == null)
      throw new RangeError("DOM position not inside the editor");
    return i;
  }
  /**
  Find out whether the selection is at the end of a textblock when
  moving in a given direction. When, for example, given `"left"`,
  it will return true if moving left from the current cursor
  position would leave that position's parent textblock. Will apply
  to the view's current state by default, but it is possible to
  pass a different state.
  */
  endOfTextblock(e, t) {
    return jee(this, t || this.state, e);
  }
  /**
  Run the editor's paste logic with the given HTML string. The
  `event`, if given, will be passed to the
  [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
  */
  pasteHTML(e, t) {
    return gh(this, "", e, !1, t || new ClipboardEvent("paste"));
  }
  /**
  Run the editor's paste logic with the given plain-text input.
  */
  pasteText(e, t) {
    return gh(this, e, null, !0, t || new ClipboardEvent("paste"));
  }
  /**
  Serialize the given slice as it would be if it was copied from
  this editor. Returns a DOM element that contains a
  representation of the slice as its children, a textual
  representation, and the transformed slice (which can be
  different from the given input due to hooks like
  [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
  */
  serializeForClipboard(e) {
    return X0(this, e);
  }
  /**
  Removes the editor from the DOM and destroys all [node
  views](https://prosemirror.net/docs/ref/#view.NodeView).
  */
  destroy() {
    this.docView && (bte(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], Cy(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, See());
  }
  /**
  This is true when the view has been
  [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be
  used anymore).
  */
  get isDestroyed() {
    return this.docView == null;
  }
  /**
  Used for testing.
  */
  dispatchEvent(e) {
    return Tte(this, e);
  }
  /**
  @internal
  */
  domSelectionRange() {
    let e = this.domSelection();
    return e ? mi && this.root.nodeType === 11 && Oee(this.dom.ownerDocument) == this.dom && Kte(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
  }
  /**
  @internal
  */
  domSelection() {
    return this.root.getSelection();
  }
}
Dm.prototype.dispatch = function(r) {
  let e = this._props.dispatchTransaction;
  e ? e.call(this, r) : this.updateState(this.state.apply(r));
};
function cb(r) {
  let e = /* @__PURE__ */ Object.create(null);
  return e.class = "ProseMirror", e.contenteditable = String(r.editable), r.someProp("attributes", (t) => {
    if (typeof t == "function" && (t = t(r.state)), t)
      for (let n in t)
        n == "class" ? e.class += " " + t[n] : n == "style" ? e.style = (e.style ? e.style + ";" : "") + t[n] : !e[n] && n != "contenteditable" && n != "nodeName" && (e[n] = String(t[n]));
  }), e.translate || (e.translate = "no"), [ji.node(0, r.state.doc.content.size, e)];
}
function fb(r) {
  if (r.markCursor) {
    let e = document.createElement("img");
    e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), r.cursorWrapper = { dom: e, deco: ji.widget(r.state.selection.from, e, { raw: !0, marks: r.markCursor }) };
  } else
    r.cursorWrapper = null;
}
function db(r) {
  return !r.someProp("editable", (e) => e(r.state) === !1);
}
function nre(r, e) {
  let t = Math.min(r.$anchor.sharedDepth(r.head), e.$anchor.sharedDepth(e.head));
  return r.$anchor.start(t) != e.$anchor.start(t);
}
function hb(r) {
  let e = /* @__PURE__ */ Object.create(null);
  function t(n) {
    for (let i in n)
      Object.prototype.hasOwnProperty.call(e, i) || (e[i] = n[i]);
  }
  return r.someProp("nodeViews", t), r.someProp("markViews", t), e;
}
function ire(r, e) {
  let t = 0, n = 0;
  for (let i in r) {
    if (r[i] != e[i])
      return !0;
    t++;
  }
  for (let i in e)
    n++;
  return t != n;
}
function pb(r) {
  if (r.spec.state || r.spec.filterTransaction || r.spec.appendTransaction)
    throw new RangeError("Plugins passed directly to the view must not have a state component");
}
var wl = {
  8: "Backspace",
  9: "Tab",
  10: "Enter",
  12: "NumLock",
  13: "Enter",
  16: "Shift",
  17: "Control",
  18: "Alt",
  20: "CapsLock",
  27: "Escape",
  32: " ",
  33: "PageUp",
  34: "PageDown",
  35: "End",
  36: "Home",
  37: "ArrowLeft",
  38: "ArrowUp",
  39: "ArrowRight",
  40: "ArrowDown",
  44: "PrintScreen",
  45: "Insert",
  46: "Delete",
  59: ";",
  61: "=",
  91: "Meta",
  92: "Meta",
  106: "*",
  107: "+",
  108: ",",
  109: "-",
  110: ".",
  111: "/",
  144: "NumLock",
  145: "ScrollLock",
  160: "Shift",
  161: "Shift",
  162: "Control",
  163: "Control",
  164: "Alt",
  165: "Alt",
  173: "-",
  186: ";",
  187: "=",
  188: ",",
  189: "-",
  190: ".",
  191: "/",
  192: "`",
  219: "[",
  220: "\\",
  221: "]",
  222: "'"
}, im = {
  48: ")",
  49: "!",
  50: "@",
  51: "#",
  52: "$",
  53: "%",
  54: "^",
  55: "&",
  56: "*",
  57: "(",
  59: ":",
  61: "+",
  173: "_",
  186: ":",
  187: "+",
  188: "<",
  189: "_",
  190: ">",
  191: "?",
  192: "~",
  219: "{",
  220: "|",
  221: "}",
  222: '"'
}, are = typeof navigator < "u" && /Mac/.test(navigator.platform), ore = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
for (var Zn = 0; Zn < 10; Zn++) wl[48 + Zn] = wl[96 + Zn] = String(Zn);
for (var Zn = 1; Zn <= 24; Zn++) wl[Zn + 111] = "F" + Zn;
for (var Zn = 65; Zn <= 90; Zn++)
  wl[Zn] = String.fromCharCode(Zn + 32), im[Zn] = String.fromCharCode(Zn);
for (var Sy in wl) im.hasOwnProperty(Sy) || (im[Sy] = wl[Sy]);
function sre(r) {
  var e = are && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || ore && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? im : wl)[r.keyCode] || r.key || "Unidentified";
  return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
}
const lre = typeof navigator < "u" && /Mac|iP(hone|[oa]d)/.test(navigator.platform), ure = typeof navigator < "u" && /Win/.test(navigator.platform);
function cre(r) {
  let e = r.split(/-(?!$)/), t = e[e.length - 1];
  t == "Space" && (t = " ");
  let n, i, a, s;
  for (let u = 0; u < e.length - 1; u++) {
    let f = e[u];
    if (/^(cmd|meta|m)$/i.test(f))
      s = !0;
    else if (/^a(lt)?$/i.test(f))
      n = !0;
    else if (/^(c|ctrl|control)$/i.test(f))
      i = !0;
    else if (/^s(hift)?$/i.test(f))
      a = !0;
    else if (/^mod$/i.test(f))
      lre ? s = !0 : i = !0;
    else
      throw new Error("Unrecognized modifier name: " + f);
  }
  return n && (t = "Alt-" + t), i && (t = "Ctrl-" + t), s && (t = "Meta-" + t), a && (t = "Shift-" + t), t;
}
function fre(r) {
  let e = /* @__PURE__ */ Object.create(null);
  for (let t in r)
    e[cre(t)] = r[t];
  return e;
}
function xy(r, e, t = !0) {
  return e.altKey && (r = "Alt-" + r), e.ctrlKey && (r = "Ctrl-" + r), e.metaKey && (r = "Meta-" + r), t && e.shiftKey && (r = "Shift-" + r), r;
}
function kh(r) {
  return new Ji({ props: { handleKeyDown: dre(r) } });
}
function dre(r) {
  let e = fre(r);
  return function(t, n) {
    let i = sre(n), a, s = e[xy(i, n)];
    if (s && s(t.state, t.dispatch, t))
      return !0;
    if (i.length == 1 && i != " ") {
      if (n.shiftKey) {
        let u = e[xy(i, n, !1)];
        if (u && u(t.state, t.dispatch, t))
          return !0;
      }
      if ((n.altKey || n.metaKey || n.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
      !(ure && n.ctrlKey && n.altKey) && (a = wl[n.keyCode]) && a != i) {
        let u = e[xy(a, n)];
        if (u && u(t.state, t.dispatch, t))
          return !0;
      }
    }
    return !1;
  };
}
const nk = (r, e) => r.selection.empty ? !1 : (e && e(r.tr.deleteSelection().scrollIntoView()), !0);
function hre(r, e) {
  let { $cursor: t } = r.selection;
  return !t || (e ? !e.endOfTextblock("backward", r) : t.parentOffset > 0) ? null : t;
}
const pre = (r, e, t) => {
  let n = hre(r, t);
  if (!n)
    return !1;
  let i = rx(n);
  if (!i) {
    let s = n.blockRange(), u = s && xm(s);
    return u == null ? !1 : (e && e(r.tr.lift(s, u).scrollIntoView()), !0);
  }
  let a = i.nodeBefore;
  if (sx(r, i, e, -1))
    return !0;
  if (n.parent.content.size == 0 && (sf(a, "end") || Kt.isSelectable(a)))
    for (let s = n.depth; ; s--) {
      let u = j0(r.doc, n.before(s), n.after(s), ht.empty);
      if (u && u.slice.size < u.to - u.from) {
        if (e) {
          let f = r.tr.step(u);
          f.setSelection(sf(a, "end") ? cr.findFrom(f.doc.resolve(f.mapping.map(i.pos, -1)), -1) : Kt.create(f.doc, i.pos - a.nodeSize)), e(f.scrollIntoView());
        }
        return !0;
      }
      if (s == 1 || n.node(s - 1).childCount > 1)
        break;
    }
  return a.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos - a.nodeSize, i.pos).scrollIntoView()), !0) : !1;
};
function sf(r, e, t = !1) {
  for (let n = r; n; n = e == "start" ? n.firstChild : n.lastChild) {
    if (n.isTextblock)
      return !0;
    if (t && n.childCount != 1)
      return !1;
  }
  return !1;
}
const vre = (r, e, t) => {
  let { $head: n, empty: i } = r.selection, a = n;
  if (!i)
    return !1;
  if (n.parent.isTextblock) {
    if (t ? !t.endOfTextblock("backward", r) : n.parentOffset > 0)
      return !1;
    a = rx(n);
  }
  let s = a && a.nodeBefore;
  return !s || !Kt.isSelectable(s) ? !1 : (e && e(r.tr.setSelection(Kt.create(r.doc, a.pos - s.nodeSize)).scrollIntoView()), !0);
};
function rx(r) {
  if (!r.parent.type.spec.isolating)
    for (let e = r.depth - 1; e >= 0; e--) {
      if (r.index(e) > 0)
        return r.doc.resolve(r.before(e + 1));
      if (r.node(e).type.spec.isolating)
        break;
    }
  return null;
}
function mre(r, e) {
  let { $cursor: t } = r.selection;
  return !t || (e ? !e.endOfTextblock("forward", r) : t.parentOffset < t.parent.content.size) ? null : t;
}
const nx = (r, e, t) => {
  let n = mre(r, t);
  if (!n)
    return !1;
  let i = ix(n);
  if (!i)
    return !1;
  let a = i.nodeAfter;
  if (sx(r, i, e, 1))
    return !0;
  if (n.parent.content.size == 0 && (sf(a, "start") || Kt.isSelectable(a))) {
    let s = j0(r.doc, n.before(), n.after(), ht.empty);
    if (s && s.slice.size < s.to - s.from) {
      if (e) {
        let u = r.tr.step(s);
        u.setSelection(sf(a, "start") ? cr.findFrom(u.doc.resolve(u.mapping.map(i.pos)), 1) : Kt.create(u.doc, u.mapping.map(i.pos))), e(u.scrollIntoView());
      }
      return !0;
    }
  }
  return a.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos, i.pos + a.nodeSize).scrollIntoView()), !0) : !1;
}, gre = (r, e, t) => {
  let { $head: n, empty: i } = r.selection, a = n;
  if (!i)
    return !1;
  if (n.parent.isTextblock) {
    if (t ? !t.endOfTextblock("forward", r) : n.parentOffset < n.parent.content.size)
      return !1;
    a = ix(n);
  }
  let s = a && a.nodeAfter;
  return !s || !Kt.isSelectable(s) ? !1 : (e && e(r.tr.setSelection(Kt.create(r.doc, a.pos)).scrollIntoView()), !0);
};
function ix(r) {
  if (!r.parent.type.spec.isolating)
    for (let e = r.depth - 1; e >= 0; e--) {
      let t = r.node(e);
      if (r.index(e) + 1 < t.childCount)
        return r.doc.resolve(r.after(e + 1));
      if (t.type.spec.isolating)
        break;
    }
  return null;
}
const ax = (r, e) => {
  let { $head: t, $anchor: n } = r.selection;
  return !t.parent.type.spec.code || !t.sameParent(n) ? !1 : (e && e(r.tr.insertText(`
`).scrollIntoView()), !0);
};
function ik(r) {
  for (let e = 0; e < r.edgeCount; e++) {
    let { type: t } = r.edge(e);
    if (t.isTextblock && !t.hasRequiredAttrs())
      return t;
  }
  return null;
}
const ak = (r, e) => {
  let { $head: t, $anchor: n } = r.selection;
  if (!t.parent.type.spec.code || !t.sameParent(n))
    return !1;
  let i = t.node(-1), a = t.indexAfter(-1), s = ik(i.contentMatchAt(a));
  if (!s || !i.canReplaceWith(a, a, s))
    return !1;
  if (e) {
    let u = t.after(), f = r.tr.replaceWith(u, u, s.createAndFill());
    f.setSelection(cr.near(f.doc.resolve(u), 1)), e(f.scrollIntoView());
  }
  return !0;
}, yre = (r, e) => {
  let t = r.selection, { $from: n, $to: i } = t;
  if (t instanceof Di || n.parent.inlineContent || i.parent.inlineContent)
    return !1;
  let a = ik(i.parent.contentMatchAt(i.indexAfter()));
  if (!a || !a.isTextblock)
    return !1;
  if (e) {
    let s = (!n.parentOffset && i.index() < i.parent.childCount ? n : i).pos, u = r.tr.insert(s, a.createAndFill());
    u.setSelection(dr.create(u.doc, s + 1)), e(u.scrollIntoView());
  }
  return !0;
}, kre = (r, e) => {
  let { $cursor: t } = r.selection;
  if (!t || t.parent.content.size)
    return !1;
  if (t.depth > 1 && t.after() != t.end(-1)) {
    let a = t.before();
    if (ef(r.doc, a))
      return e && e(r.tr.split(a).scrollIntoView()), !0;
  }
  let n = t.blockRange(), i = n && xm(n);
  return i == null ? !1 : (e && e(r.tr.lift(n, i).scrollIntoView()), !0);
};
function wre(r) {
  return (e, t) => {
    let { $from: n, $to: i } = e.selection;
    if (e.selection instanceof Kt && e.selection.node.isBlock)
      return !n.parentOffset || !ef(e.doc, n.pos) ? !1 : (t && t(e.tr.split(n.pos).scrollIntoView()), !0);
    if (!n.depth)
      return !1;
    let a = [], s, u, f = !1, p = !1;
    for (let O = n.depth; ; O--)
      if (n.node(O).isBlock) {
        f = n.end(O) == n.pos + (n.depth - O), p = n.start(O) == n.pos - (n.depth - O), u = ik(n.node(O - 1).contentMatchAt(n.indexAfter(O - 1))), a.unshift(f && u ? { type: u } : null), s = O;
        break;
      } else {
        if (O == 1)
          return !1;
        a.unshift(null);
      }
    let y = e.tr;
    (e.selection instanceof dr || e.selection instanceof Di) && y.deleteSelection();
    let T = y.mapping.map(n.pos), N = ef(y.doc, T, a.length, a);
    if (N || (a[0] = u ? { type: u } : null, N = ef(y.doc, T, a.length, a)), !N)
      return !1;
    if (y.split(T, a.length, a), !f && p && n.node(s).type != u) {
      let O = y.mapping.map(n.before(s)), A = y.doc.resolve(O);
      u && n.node(s - 1).canReplaceWith(A.index(), A.index() + 1, u) && y.setNodeMarkup(y.mapping.map(n.before(s)), u);
    }
    return t && t(y.scrollIntoView()), !0;
  };
}
const bre = wre(), ox = (r, e) => (e && e(r.tr.setSelection(new Di(r.doc))), !0);
function Cre(r, e, t) {
  let n = e.nodeBefore, i = e.nodeAfter, a = e.index();
  return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(a - 1, a) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(a, a + 1) || !(i.isTextblock || pS(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
}
function sx(r, e, t, n) {
  let i = e.nodeBefore, a = e.nodeAfter, s, u, f = i.type.spec.isolating || a.type.spec.isolating;
  if (!f && Cre(r, e, t))
    return !0;
  let p = !f && e.parent.canReplace(e.index(), e.index() + 1);
  if (p && (s = (u = i.contentMatchAt(i.childCount)).findWrapping(a.type)) && u.matchType(s[0] || a.type).validEnd) {
    if (t) {
      let O = e.pos + a.nodeSize, A = Qe.empty;
      for (let j = s.length - 1; j >= 0; j--)
        A = Qe.from(s[j].create(null, A));
      A = Qe.from(i.copy(A));
      let q = r.tr.step(new _n(e.pos - 1, O, e.pos, O, new ht(A, 1, 0), s.length, !0)), U = q.doc.resolve(O + 2 * s.length);
      U.nodeAfter && U.nodeAfter.type == i.type && pS(q.doc, U.pos) && q.join(U.pos), t(q.scrollIntoView());
    }
    return !0;
  }
  let y = a.type.spec.isolating || n > 0 && f ? null : cr.findFrom(e, 1), T = y && y.$from.blockRange(y.$to), N = T && xm(T);
  if (N != null && N >= e.depth)
    return t && t(r.tr.lift(T, N).scrollIntoView()), !0;
  if (p && sf(a, "start", !0) && sf(i, "end")) {
    let O = i, A = [];
    for (; A.push(O), !O.isTextblock; )
      O = O.lastChild;
    let q = a, U = 1;
    for (; !q.isTextblock; q = q.firstChild)
      U++;
    if (O.canReplace(O.childCount, O.childCount, q.content)) {
      if (t) {
        let j = Qe.empty;
        for (let se = A.length - 1; se >= 0; se--)
          j = Qe.from(A[se].copy(j));
        let te = r.tr.step(new _n(e.pos - A.length, e.pos + a.nodeSize, e.pos + U, e.pos + a.nodeSize - U, new ht(j, A.length, 0), 0, !0));
        t(te.scrollIntoView());
      }
      return !0;
    }
  }
  return !1;
}
function lx(r) {
  return function(e, t) {
    let n = e.selection, i = r < 0 ? n.$from : n.$to, a = i.depth;
    for (; i.node(a).isInline; ) {
      if (!a)
        return !1;
      a--;
    }
    return i.node(a).isTextblock ? (t && t(e.tr.setSelection(dr.create(e.doc, r < 0 ? i.start(a) : i.end(a)))), !0) : !1;
  };
}
const Tre = lx(-1), Sre = lx(1);
function xre(r, e = null) {
  return function(t, n) {
    let { $from: i, $to: a } = t.selection, s = i.blockRange(a), u = s && tee(s, r, e);
    return u ? (n && n(t.tr.wrap(s, u).scrollIntoView()), !0) : !1;
  };
}
function ok(r, e = null) {
  return function(t, n) {
    let i = !1;
    for (let a = 0; a < t.selection.ranges.length && !i; a++) {
      let { $from: { pos: s }, $to: { pos: u } } = t.selection.ranges[a];
      t.doc.nodesBetween(s, u, (f, p) => {
        if (i)
          return !1;
        if (!(!f.isTextblock || f.hasMarkup(r, e)))
          if (f.type == r)
            i = !0;
          else {
            let y = t.doc.resolve(p), T = y.index();
            i = y.parent.canReplaceWith(T, T + 1, r);
          }
      });
    }
    if (!i)
      return !1;
    if (n) {
      let a = t.tr;
      for (let s = 0; s < t.selection.ranges.length; s++) {
        let { $from: { pos: u }, $to: { pos: f } } = t.selection.ranges[s];
        a.setBlockType(u, f, r, e);
      }
      n(a.scrollIntoView());
    }
    return !0;
  };
}
function Ere(r, e, t, n) {
  for (let i = 0; i < e.length; i++) {
    let { $from: a, $to: s } = e[i], u = a.depth == 0 ? r.inlineContent && r.type.allowsMarkType(t) : !1;
    if (r.nodesBetween(a.pos, s.pos, (f, p) => {
      if (u)
        return !1;
      u = f.inlineContent && f.type.allowsMarkType(t);
    }), u)
      return !0;
  }
  return !1;
}
function Eh(r, e = null, t) {
  return function(n, i) {
    let { empty: a, $cursor: s, ranges: u } = n.selection;
    if (a && !s || !Ere(n.doc, u, r))
      return !1;
    if (i)
      if (s)
        r.isInSet(n.storedMarks || s.marks()) ? i(n.tr.removeStoredMark(r)) : i(n.tr.addStoredMark(r.create(e)));
      else {
        let f, p = n.tr;
        f = !u.some((y) => n.doc.rangeHasMark(y.$from.pos, y.$to.pos, r));
        for (let y = 0; y < u.length; y++) {
          let { $from: T, $to: N } = u[y];
          if (!f)
            p.removeMark(T.pos, N.pos, r);
          else {
            let O = T.pos, A = N.pos, q = T.nodeAfter, U = N.nodeBefore, j = q && q.isText ? /^\s*/.exec(q.text)[0].length : 0, te = U && U.isText ? /\s*$/.exec(U.text)[0].length : 0;
            O + j < A && (O += j, A -= te), p.addMark(O, A, r.create(e));
          }
        }
        i(p.scrollIntoView());
      }
    return !0;
  };
}
function Am(...r) {
  return function(e, t, n) {
    for (let i = 0; i < r.length; i++)
      if (r[i](e, t, n))
        return !0;
    return !1;
  };
}
let Ey = Am(nk, pre, vre), vb = Am(nk, nx, gre);
const ks = {
  Enter: Am(ax, yre, kre, bre),
  "Mod-Enter": ak,
  Backspace: Ey,
  "Mod-Backspace": Ey,
  "Shift-Backspace": Ey,
  Delete: vb,
  "Mod-Delete": vb,
  "Mod-a": ox
}, ux = {
  "Ctrl-h": ks.Backspace,
  "Alt-Backspace": ks["Mod-Backspace"],
  "Ctrl-d": ks.Delete,
  "Ctrl-Alt-Backspace": ks["Mod-Delete"],
  "Alt-Delete": ks["Mod-Delete"],
  "Alt-d": ks["Mod-Delete"],
  "Ctrl-a": Tre,
  "Ctrl-e": Sre
};
for (let r in ks)
  ux[r] = ks[r];
const Mre = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform ? os.platform() == "darwin" : !1, mb = Mre ? ux : ks;
class Tl {
  /**
  Create an input rule. The rule applies when the user typed
  something and the text directly in front of the cursor matches
  `match`, which should end with `$`.
  
  The `handler` can be a string, in which case the matched text, or
  the first matched group in the regexp, is replaced by that
  string.
  
  Or a it can be a function, which will be called with the match
  array produced by
  [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec),
  as well as the start and end of the matched range, and which can
  return a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) that describes the
  rule's effect, or null to indicate the input was not handled.
  */
  constructor(e, t, n = {}) {
    this.match = e, this.match = e, this.handler = typeof t == "string" ? Nre(t) : t, this.undoable = n.undoable !== !1, this.inCode = n.inCode || !1, this.inCodeMark = n.inCodeMark !== !1;
  }
}
function Nre(r) {
  return function(e, t, n, i) {
    let a = r;
    if (t[1]) {
      let s = t[0].lastIndexOf(t[1]);
      a += t[0].slice(s + t[1].length), n += s;
      let u = n - i;
      u > 0 && (a = t[0].slice(s - u, s) + a, n = i);
    }
    return e.tr.insertText(a, n, i);
  };
}
const Ore = 500;
function cx({ rules: r }) {
  let e = new Ji({
    state: {
      init() {
        return null;
      },
      apply(t, n) {
        let i = t.getMeta(this);
        return i || (t.selectionSet || t.docChanged ? null : n);
      }
    },
    props: {
      handleTextInput(t, n, i, a) {
        return gb(t, n, i, a, r, e);
      },
      handleDOMEvents: {
        compositionend: (t) => {
          setTimeout(() => {
            let { $cursor: n } = t.state.selection;
            n && gb(t, n.pos, n.pos, "", r, e);
          });
        }
      }
    },
    isInputRules: !0
  });
  return e;
}
function gb(r, e, t, n, i, a) {
  if (r.composing)
    return !1;
  let s = r.state, u = s.doc.resolve(e), f = u.parent.textBetween(Math.max(0, u.parentOffset - Ore), u.parentOffset, null, "￼") + n;
  for (let p = 0; p < i.length; p++) {
    let y = i[p];
    if (!y.inCodeMark && u.marks().some((A) => A.type.spec.code))
      continue;
    if (u.parent.type.spec.code) {
      if (!y.inCode)
        continue;
    } else if (y.inCode === "only")
      continue;
    let T = y.match.exec(f);
    if (!T || T[0].length < n.length)
      continue;
    let N = e - (T[0].length - n.length);
    if (!y.inCodeMark) {
      let A = !1;
      if (s.doc.nodesBetween(N, u.pos, (q) => {
        q.isInline && q.marks.some((U) => U.type.spec.code) && (A = !0);
      }), A)
        continue;
    }
    let O = y.handler(s, T, N, t);
    if (O)
      return y.undoable && O.setMeta(a, { transform: O, from: e, to: t, text: n }), r.dispatch(O), !0;
  }
  return !1;
}
const Dre = (r, e) => {
  let t = r.plugins;
  for (let n = 0; n < t.length; n++) {
    let i = t[n], a;
    if (i.spec.isInputRules && (a = i.getState(r))) {
      if (e) {
        let s = r.tr, u = a.transform;
        for (let f = u.steps.length - 1; f >= 0; f--)
          s.step(u.steps[f].invert(u.docs[f]));
        if (a.text) {
          let f = s.doc.resolve(a.from).marks();
          s.replaceWith(a.from, a.to, r.schema.text(a.text, f));
        } else
          s.delete(a.from, a.to);
        e(s);
      }
      return !0;
    }
  }
  return !1;
};
new Tl(/--$/, "—", { inCodeMark: !1 });
new Tl(/\.\.\.$/, "…", { inCodeMark: !1 });
new Tl(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "“", { inCodeMark: !1 });
new Tl(/"$/, "”", { inCodeMark: !1 });
new Tl(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "‘", { inCodeMark: !1 });
new Tl(/'$/, "’", { inCodeMark: !1 });
var am = 200, qn = function() {
};
qn.prototype.append = function(e) {
  return e.length ? (e = qn.from(e), !this.length && e || e.length < am && this.leafAppend(e) || this.length < am && e.leafPrepend(this) || this.appendInner(e)) : this;
};
qn.prototype.prepend = function(e) {
  return e.length ? qn.from(e).append(this) : this;
};
qn.prototype.appendInner = function(e) {
  return new Are(this, e);
};
qn.prototype.slice = function(e, t) {
  return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? qn.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
};
qn.prototype.get = function(e) {
  if (!(e < 0 || e >= this.length))
    return this.getInner(e);
};
qn.prototype.forEach = function(e, t, n) {
  t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
};
qn.prototype.map = function(e, t, n) {
  t === void 0 && (t = 0), n === void 0 && (n = this.length);
  var i = [];
  return this.forEach(function(a, s) {
    return i.push(e(a, s));
  }, t, n), i;
};
qn.from = function(e) {
  return e instanceof qn ? e : e && e.length ? new fx(e) : qn.empty;
};
var fx = /* @__PURE__ */ (function(r) {
  function e(n) {
    r.call(this), this.values = n;
  }
  r && (e.__proto__ = r), e.prototype = Object.create(r && r.prototype), e.prototype.constructor = e;
  var t = { length: { configurable: !0 }, depth: { configurable: !0 } };
  return e.prototype.flatten = function() {
    return this.values;
  }, e.prototype.sliceInner = function(i, a) {
    return i == 0 && a == this.length ? this : new e(this.values.slice(i, a));
  }, e.prototype.getInner = function(i) {
    return this.values[i];
  }, e.prototype.forEachInner = function(i, a, s, u) {
    for (var f = a; f < s; f++)
      if (i(this.values[f], u + f) === !1)
        return !1;
  }, e.prototype.forEachInvertedInner = function(i, a, s, u) {
    for (var f = a - 1; f >= s; f--)
      if (i(this.values[f], u + f) === !1)
        return !1;
  }, e.prototype.leafAppend = function(i) {
    if (this.length + i.length <= am)
      return new e(this.values.concat(i.flatten()));
  }, e.prototype.leafPrepend = function(i) {
    if (this.length + i.length <= am)
      return new e(i.flatten().concat(this.values));
  }, t.length.get = function() {
    return this.values.length;
  }, t.depth.get = function() {
    return 0;
  }, Object.defineProperties(e.prototype, t), e;
})(qn);
qn.empty = new fx([]);
var Are = /* @__PURE__ */ (function(r) {
  function e(t, n) {
    r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
  }
  return r && (e.__proto__ = r), e.prototype = Object.create(r && r.prototype), e.prototype.constructor = e, e.prototype.flatten = function() {
    return this.left.flatten().concat(this.right.flatten());
  }, e.prototype.getInner = function(n) {
    return n < this.left.length ? this.left.get(n) : this.right.get(n - this.left.length);
  }, e.prototype.forEachInner = function(n, i, a, s) {
    var u = this.left.length;
    if (i < u && this.left.forEachInner(n, i, Math.min(a, u), s) === !1 || a > u && this.right.forEachInner(n, Math.max(i - u, 0), Math.min(this.length, a) - u, s + u) === !1)
      return !1;
  }, e.prototype.forEachInvertedInner = function(n, i, a, s) {
    var u = this.left.length;
    if (i > u && this.right.forEachInvertedInner(n, i - u, Math.max(a, u) - u, s + u) === !1 || a < u && this.left.forEachInvertedInner(n, Math.min(i, u), a, s) === !1)
      return !1;
  }, e.prototype.sliceInner = function(n, i) {
    if (n == 0 && i == this.length)
      return this;
    var a = this.left.length;
    return i <= a ? this.left.slice(n, i) : n >= a ? this.right.slice(n - a, i - a) : this.left.slice(n, a).append(this.right.slice(0, i - a));
  }, e.prototype.leafAppend = function(n) {
    var i = this.right.leafAppend(n);
    if (i)
      return new e(this.left, i);
  }, e.prototype.leafPrepend = function(n) {
    var i = this.left.leafPrepend(n);
    if (i)
      return new e(i, this.right);
  }, e.prototype.appendInner = function(n) {
    return this.left.depth >= Math.max(this.right.depth, n.depth) + 1 ? new e(this.left, new e(this.right, n)) : new e(this, n);
  }, e;
})(qn);
const Lre = 500;
class Xa {
  constructor(e, t) {
    this.items = e, this.eventCount = t;
  }
  // Pop the latest event off the branch's history and apply it
  // to a document transform.
  popEvent(e, t) {
    if (this.eventCount == 0)
      return null;
    let n = this.items.length;
    for (; ; n--)
      if (this.items.get(n - 1).selection) {
        --n;
        break;
      }
    let i, a;
    t && (i = this.remapping(n, this.items.length), a = i.maps.length);
    let s = e.tr, u, f, p = [], y = [];
    return this.items.forEach((T, N) => {
      if (!T.step) {
        i || (i = this.remapping(n, N + 1), a = i.maps.length), a--, y.push(T);
        return;
      }
      if (i) {
        y.push(new Lo(T.map));
        let O = T.step.map(i.slice(a)), A;
        O && s.maybeStep(O).doc && (A = s.mapping.maps[s.mapping.maps.length - 1], p.push(new Lo(A, void 0, void 0, p.length + y.length))), a--, A && i.appendMap(A, a);
      } else
        s.maybeStep(T.step);
      if (T.selection)
        return u = i ? T.selection.map(i.slice(a)) : T.selection, f = new Xa(this.items.slice(0, n).append(y.reverse().concat(p)), this.eventCount - 1), !1;
    }, this.items.length, 0), { remaining: f, transform: s, selection: u };
  }
  // Create a new branch with the given transform added.
  addTransform(e, t, n, i) {
    let a = [], s = this.eventCount, u = this.items, f = !i && u.length ? u.get(u.length - 1) : null;
    for (let y = 0; y < e.steps.length; y++) {
      let T = e.steps[y].invert(e.docs[y]), N = new Lo(e.mapping.maps[y], T, t), O;
      (O = f && f.merge(N)) && (N = O, y ? a.pop() : u = u.slice(0, u.length - 1)), a.push(N), t && (s++, t = void 0), i || (f = N);
    }
    let p = s - n.depth;
    return p > Ire && (u = Rre(u, p), s -= p), new Xa(u.append(a), s);
  }
  remapping(e, t) {
    let n = new ph();
    return this.items.forEach((i, a) => {
      let s = i.mirrorOffset != null && a - i.mirrorOffset >= e ? n.maps.length - i.mirrorOffset : void 0;
      n.appendMap(i.map, s);
    }, e, t), n;
  }
  addMaps(e) {
    return this.eventCount == 0 ? this : new Xa(this.items.append(e.map((t) => new Lo(t))), this.eventCount);
  }
  // When the collab module receives remote changes, the history has
  // to know about those, so that it can adjust the steps that were
  // rebased on top of the remote changes, and include the position
  // maps for the remote changes in its array of items.
  rebased(e, t) {
    if (!this.eventCount)
      return this;
    let n = [], i = Math.max(0, this.items.length - t), a = e.mapping, s = e.steps.length, u = this.eventCount;
    this.items.forEach((N) => {
      N.selection && u--;
    }, i);
    let f = t;
    this.items.forEach((N) => {
      let O = a.getMirror(--f);
      if (O == null)
        return;
      s = Math.min(s, O);
      let A = a.maps[O];
      if (N.step) {
        let q = e.steps[O].invert(e.docs[O]), U = N.selection && N.selection.map(a.slice(f + 1, O));
        U && u++, n.push(new Lo(A, q, U));
      } else
        n.push(new Lo(A));
    }, i);
    let p = [];
    for (let N = t; N < s; N++)
      p.push(new Lo(a.maps[N]));
    let y = this.items.slice(0, i).append(p).append(n), T = new Xa(y, u);
    return T.emptyItemCount() > Lre && (T = T.compress(this.items.length - n.length)), T;
  }
  emptyItemCount() {
    let e = 0;
    return this.items.forEach((t) => {
      t.step || e++;
    }), e;
  }
  // Compressing a branch means rewriting it to push the air (map-only
  // items) out. During collaboration, these naturally accumulate
  // because each remote change adds one. The `upto` argument is used
  // to ensure that only the items below a given level are compressed,
  // because `rebased` relies on a clean, untouched set of items in
  // order to associate old items with rebased steps.
  compress(e = this.items.length) {
    let t = this.remapping(0, e), n = t.maps.length, i = [], a = 0;
    return this.items.forEach((s, u) => {
      if (u >= e)
        i.push(s), s.selection && a++;
      else if (s.step) {
        let f = s.step.map(t.slice(n)), p = f && f.getMap();
        if (n--, p && t.appendMap(p, n), f) {
          let y = s.selection && s.selection.map(t.slice(n));
          y && a++;
          let T = new Lo(p.invert(), f, y), N, O = i.length - 1;
          (N = i.length && i[O].merge(T)) ? i[O] = N : i.push(T);
        }
      } else s.map && n--;
    }, this.items.length, 0), new Xa(qn.from(i.reverse()), a);
  }
}
Xa.empty = new Xa(qn.empty, 0);
function Rre(r, e) {
  let t;
  return r.forEach((n, i) => {
    if (n.selection && e-- == 0)
      return t = i, !1;
  }), r.slice(t);
}
class Lo {
  constructor(e, t, n, i) {
    this.map = e, this.step = t, this.selection = n, this.mirrorOffset = i;
  }
  merge(e) {
    if (this.step && e.step && !e.selection) {
      let t = e.step.merge(this.step);
      if (t)
        return new Lo(t.getMap().invert(), t, this.selection);
    }
  }
}
class sl {
  constructor(e, t, n, i, a) {
    this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = i, this.prevComposition = a;
  }
}
const Ire = 20;
function Pre(r, e, t, n) {
  let i = t.getMeta(gl), a;
  if (i)
    return i.historyState;
  t.getMeta(_re) && (r = new sl(r.done, r.undone, null, 0, -1));
  let s = t.getMeta("appendedTransaction");
  if (t.steps.length == 0)
    return r;
  if (s && s.getMeta(gl))
    return s.getMeta(gl).redo ? new sl(r.done.addTransform(t, void 0, n, qv(e)), r.undone, yb(t.mapping.maps), r.prevTime, r.prevComposition) : new sl(r.done, r.undone.addTransform(t, void 0, n, qv(e)), null, r.prevTime, r.prevComposition);
  if (t.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
    let u = t.getMeta("composition"), f = r.prevTime == 0 || !s && r.prevComposition != u && (r.prevTime < (t.time || 0) - n.newGroupDelay || !Bre(t, r.prevRanges)), p = s ? My(r.prevRanges, t.mapping) : yb(t.mapping.maps);
    return new sl(r.done.addTransform(t, f ? e.selection.getBookmark() : void 0, n, qv(e)), Xa.empty, p, t.time, u ?? r.prevComposition);
  } else return (a = t.getMeta("rebased")) ? new sl(r.done.rebased(t, a), r.undone.rebased(t, a), My(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new sl(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), My(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
}
function Bre(r, e) {
  if (!e)
    return !1;
  if (!r.docChanged)
    return !0;
  let t = !1;
  return r.mapping.maps[0].forEach((n, i) => {
    for (let a = 0; a < e.length; a += 2)
      n <= e[a + 1] && i >= e[a] && (t = !0);
  }), t;
}
function yb(r) {
  let e = [];
  for (let t = r.length - 1; t >= 0 && e.length == 0; t--)
    r[t].forEach((n, i, a, s) => e.push(a, s));
  return e;
}
function My(r, e) {
  if (!r)
    return null;
  let t = [];
  for (let n = 0; n < r.length; n += 2) {
    let i = e.map(r[n], 1), a = e.map(r[n + 1], -1);
    i <= a && t.push(i, a);
  }
  return t;
}
function Fre(r, e, t) {
  let n = qv(e), i = gl.get(e).spec.config, a = (t ? r.undone : r.done).popEvent(e, n);
  if (!a)
    return null;
  let s = a.selection.resolve(a.transform.doc), u = (t ? r.done : r.undone).addTransform(a.transform, e.selection.getBookmark(), i, n), f = new sl(t ? u : a.remaining, t ? a.remaining : u, null, 0, -1);
  return a.transform.setSelection(s).setMeta(gl, { redo: t, historyState: f });
}
let Ny = !1, kb = null;
function qv(r) {
  let e = r.plugins;
  if (kb != e) {
    Ny = !1, kb = e;
    for (let t = 0; t < e.length; t++)
      if (e[t].spec.historyPreserveItems) {
        Ny = !0;
        break;
      }
  }
  return Ny;
}
const gl = new Ch("history"), _re = new Ch("closeHistory");
function dx(r = {}) {
  return r = {
    depth: r.depth || 100,
    newGroupDelay: r.newGroupDelay || 500
  }, new Ji({
    key: gl,
    state: {
      init() {
        return new sl(Xa.empty, Xa.empty, null, 0, -1);
      },
      apply(e, t, n) {
        return Pre(t, n, e, r);
      }
    },
    config: r,
    props: {
      handleDOMEvents: {
        beforeinput(e, t) {
          let n = t.inputType, i = n == "historyUndo" ? ch : n == "historyRedo" ? sk : null;
          return !i || !e.editable ? !1 : (t.preventDefault(), i(e.state, e.dispatch));
        }
      }
    }
  });
}
function hx(r, e) {
  return (t, n) => {
    let i = gl.getState(t);
    if (!i || (r ? i.undone : i.done).eventCount == 0)
      return !1;
    if (n) {
      let a = Fre(i, t, r);
      a && n(e ? a.scrollIntoView() : a);
    }
    return !0;
  };
}
const ch = hx(!1, !0), sk = hx(!0, !0);
function qre(r) {
  let e = gl.getState(r);
  return e ? e.done.eventCount : 0;
}
var m0 = function(r, e) {
  return m0 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
    t.__proto__ = n;
  } || function(t, n) {
    for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
  }, m0(r, e);
};
function bt(r, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  m0(r, e);
  function t() {
    this.constructor = r;
  }
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
var _e = function() {
  return _e = Object.assign || function(e) {
    for (var t, n = 1, i = arguments.length; n < i; n++) {
      t = arguments[n];
      for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
    }
    return e;
  }, _e.apply(this, arguments);
};
function Ki(r, e, t) {
  if (arguments.length === 2) for (var n = 0, i = e.length, a; n < i; n++)
    (a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
  return r.concat(a || Array.prototype.slice.call(e));
}
function pr(r, e) {
  return Object.defineProperty ? Object.defineProperty(r, "raw", { value: e }) : r.raw = e, r;
}
function zre(r, e, t) {
  var n;
  t = t || null;
  for (n in r)
    if (r.hasOwnProperty(n) && e.call(t, r[n], n, r) === !1)
      break;
}
var lf = zre;
function Hre(r, e) {
  var t = Object.prototype.hasOwnProperty, n, i, a, s;
  for (a = 1, s = arguments.length; a < s; a += 1) {
    n = arguments[a];
    for (i in n)
      t.call(n, i) && (r[i] = n[i]);
  }
  return r;
}
var lk = Hre;
function Vre(r) {
  return typeof r == "string" || r instanceof String;
}
var Ms = Vre;
function Ure(r) {
  return r instanceof Array;
}
var wf = Ure;
function $re(r, e, t) {
  var n = 0, i = r.length;
  for (t = t || null; n < i && e.call(t, r[n], n, r) !== !1; n += 1)
    ;
}
var uf = $re, Wre = wf, jre = uf, Gre = lf;
function Kre(r, e, t) {
  Wre(r) ? jre(r, e, t) : Gre(r, e, t);
}
var Lm = Kre, Jre = Ms, Qre = Lm;
function Xre(r, e, t) {
  var n = r.style;
  if (Jre(e)) {
    n[e] = t;
    return;
  }
  Qre(e, function(i, a) {
    n[a] = i;
  });
}
var _o = Xre, Yre = wf;
function Zre(r, e, t) {
  var n, i;
  if (t = t || 0, !Yre(e))
    return -1;
  if (Array.prototype.indexOf)
    return Array.prototype.indexOf.call(e, r, t);
  for (i = e.length, n = t; t >= 0 && n < i; n += 1)
    if (e[n] === r)
      return n;
  return -1;
}
var Mu = Zre;
function ene(r) {
  return r === void 0;
}
var to = ene, tne = to;
function rne(r) {
  return !r || !r.className ? "" : tne(r.className.baseVal) ? r.className : r.className.baseVal;
}
var uk = rne, nne = wf, ine = to;
function ane(r, e) {
  if (e = nne(e) ? e.join(" ") : e, e = e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), ine(r.className.baseVal)) {
    r.className = e;
    return;
  }
  r.className.baseVal = e;
}
var px = ane, wb = Lm, one = Mu, sne = uk, lne = px;
function une(r) {
  var e = Array.prototype.slice.call(arguments, 1), t = r.classList, n = [], i;
  if (t) {
    wb(e, function(a) {
      r.classList.add(a);
    });
    return;
  }
  i = sne(r), i && (e = [].concat(i.split(/\s+/), e)), wb(e, function(a) {
    one(a, n) < 0 && n.push(a);
  }), lne(r, n);
}
var Io = une, bb = uf, cne = Mu, fne = uk, dne = px;
function hne(r) {
  var e = Array.prototype.slice.call(arguments, 1), t = r.classList, n, i;
  if (t) {
    bb(e, function(a) {
      t.remove(a);
    });
    return;
  }
  n = fne(r).split(/\s+/), i = [], bb(n, function(a) {
    cne(a, e) < 0 && i.push(a);
  }), dne(r, i);
}
var Ya = hne;
function pne(r) {
  return typeof r == "number" || r instanceof Number;
}
var ws = pne;
function vne(r) {
  return r === null;
}
var om = vne, mne = lf;
function gne(r, e) {
  var t = document.createElement("img"), n = "";
  return mne(e, function(i, a) {
    n += "&" + a + "=" + i;
  }), n = n.substring(1), t.src = r + "?" + n, t.style.display = "none", document.body.appendChild(t), document.body.removeChild(t), t;
}
var yne = gne, kne = to, wne = yne, bne = 10080 * 60 * 1e3;
function Cne(r) {
  var e = (/* @__PURE__ */ new Date()).getTime();
  return e - r > bne;
}
function Tne(r, e) {
  var t = "https://www.google-analytics.com/collect", n = location.hostname, i = "event", a = "use", s = "TOAST UI " + r + " for " + n + ": Statistics", u = window.localStorage.getItem(s);
  !kne(window.tui) && window.tui.usageStatistics === !1 || u && !Cne(u) || (window.localStorage.setItem(s, (/* @__PURE__ */ new Date()).getTime()), setTimeout(function() {
    (document.readyState === "interactive" || document.readyState === "complete") && wne(t, {
      v: 1,
      t: i,
      tid: e,
      cid: n,
      dp: n,
      dh: r,
      el: r,
      ec: a
    });
  }, 1e3));
}
var Sne = Tne, xne = /[\u0020]+/g, Ene = /[>(){}[\]+-.!#|]/g, Cb = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g, Tb = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g, Mne = /[*_~`]/g, Sb = /!\[.*\]\(.*\)/g, Nne = /[[\]]/g, xb = /(?:^|[^\\])\\(?!\\)/g, One = '[&<>"]', Eb = new RegExp(One, "g");
function Dne(r) {
  switch (r) {
    case "&":
      return "&amp;";
    case "<":
      return "&lt;";
    case ">":
      return "&gt;";
    case '"':
      return "&quot;";
    default:
      return r;
  }
}
function Xc(r) {
  return Eb.test(r) ? r.replace(Eb, Dne) : r;
}
function Ane() {
  Sne("editor", "UA-129966929-1");
}
function ti(r, e) {
  return r.indexOf(e) !== -1;
}
var Lne = ["rel", "target", "hreflang", "type"], Rne = {
  codeblock: /(^ {4}[^\n]+\n*)+/,
  thematicBreak: /^ *((\* *){3,}|(- *){3,} *|(_ *){3,}) */,
  atxHeading: /^(#{1,6}) +[\s\S]+/,
  seTextheading: /^([^\n]+)\n *(=|-){2,} */,
  blockquote: /^( *>[^\n]+.*)+/,
  list: /^ *(\*+|-+|\d+\.) [\s\S]+/,
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? */,
  link: /!?\[.*\]\(.*\)/,
  reflink: /!?\[.*\]\s*\[([^\]]*)\]/,
  verticalBar: /\u007C/,
  fencedCodeblock: /^((`|~){3,})/
};
function vx(r) {
  if (!r)
    return null;
  var e = {};
  return Lne.forEach(function(t) {
    to(r[t]) || (e[t] = r[t]);
  }), e;
}
function sm(r, e) {
  for (var t = "", n = 0; n < e; n += 1)
    t += r;
  return t;
}
function Ine(r) {
  var e = !1;
  return lf(Rne, function(t) {
    return t.test(r) && (e = !0), !e;
  }), e;
}
function lm(r) {
  for (var e = [], t = Sb.exec(r); t; )
    e.push([t.index, t.index + t[0].length]), t = Sb.exec(r);
  return r.replace(Nne, function(n, i) {
    var a = e.some(function(s) {
      return i > s[0] && i < s[1];
    });
    return a ? n : "\\" + n;
  });
}
function Pne(r) {
  var e = function(i) {
    return "\\" + i;
  }, t = function(i) {
    return i + "\\";
  }, n = r.replace(xne, " ");
  return Tb.test(n) && (n = n.replace(Tb, e)), xb.test(n) && (n = n.replace(xb, t)), n = n.replace(Mne, e), Cb.test(n) && (n = n.replace(Cb, e)), Ine(n) && (n = n.replace(Ene, e)), n;
}
function Bne(r) {
  var e;
  return r.indexOf('"') === -1 ? e = '""' : e = r.indexOf("'") === -1 ? "''" : "()", e[0] + r + e[1];
}
function g0(r) {
  return om(r) || to(r);
}
function ck(r, e) {
  if (r === null && r === e)
    return !0;
  if (typeof r != "object" || typeof e != "object" || g0(r) || g0(e))
    return r === e;
  for (var t in r)
    if (r[t] !== e[t])
      return !1;
  for (var t in e)
    if (!(t in r))
      return !1;
  return !0;
}
function vi(r) {
  return r[r.length - 1];
}
function Fne(r, e, t) {
  return r >= e && r <= t;
}
function fk(r) {
  return typeof r == "object" && r !== null;
}
function um(r, e) {
  var t = _e({}, r);
  return r && e && Object.keys(e).forEach(function(n) {
    fk(t[n]) ? Array.isArray(e[n]) ? t[n] = dk(e[n]) : t.hasOwnProperty(n) ? t[n] = um(t[n], e[n]) : t[n] = hk(e[n]) : t[n] = e[n];
  }), t;
}
function dk(r) {
  return r.map(function(e) {
    return fk(e) ? Array.isArray(e) ? dk(e) : hk(e) : e;
  });
}
function hk(r) {
  var e = Object.keys(r);
  return e.length ? e.reduce(function(t, n) {
    return fk(r[n]) ? t[n] = Array.isArray(r[n]) ? dk(r[n]) : hk(r[n]) : t[n] = r[n], t;
  }, {}) : r;
}
function pk(r, e) {
  return e === void 0 && (e = {}), Object.keys(e).forEach(function(t) {
    r.hasOwnProperty(t) && typeof r[t] == "object" ? Array.isArray(e[t]) ? r[t] = e[t] : pk(r[t], e[t]) : r[t] = e[t];
  }), r;
}
function Mb(r, e) {
  return r > e ? [e, r] : [r, e];
}
var _ne = uf;
function qne(r) {
  var e;
  try {
    e = Array.prototype.slice.call(r);
  } catch {
    e = [], _ne(r, function(n) {
      e.push(n);
    });
  }
  return e;
}
var qo = qne;
function cm(r, e) {
  var t = r.nodes.paragraph;
  return e ? t.create(null, Ms(e) ? r.text(e) : e) : t.createAndFill();
}
function ei(r, e, t) {
  return r.text(e, t);
}
function Jr(r, e, t) {
  t === void 0 && (t = e);
  var n = r.doc.content.size, i = n > 0 ? n - 1 : 1;
  return dr.create(r.doc, Math.min(e, i), Math.min(t, i));
}
function vk(r, e, t) {
  var n = e.pos;
  return r.replaceWith(n, n, cm(t)), r.setSelection(Jr(r, n + 1));
}
function fm(r) {
  for (var e = r.state, t = r.from, n = r.startIndex, i = r.endIndex, a = r.createText, s = e.tr, u = e.doc, f = e.schema, p = n; p <= i; p += 1) {
    var y = u.child(p), T = y.nodeSize, N = y.textContent, O = y.content, A = a(N), q = A ? ei(f, A) : Qe.empty, U = s.mapping.map(t), j = U + O.size;
    s.replaceWith(U, j, q), t += T;
  }
  return s;
}
function mk(r, e, t, n) {
  var i = t.length;
  r.split(e).delete(e - i, e).insert(r.mapping.map(e), n).setSelection(Jr(r, r.mapping.map(e) - i));
}
function Mh(r) {
  return r.sourcepos[0][0];
}
function Rm(r) {
  return r.sourcepos[1][0];
}
function Im(r) {
  return r.sourcepos[0][1];
}
function yl(r) {
  return r.sourcepos[1][1];
}
function zne(r) {
  var e = r.type;
  return e === "htmlBlock" || e === "htmlInline";
}
function Hne(r) {
  var e = r.type;
  return e === "strike" || e === "strong" || e === "emph" || e === "code" || e === "link" || e === "image";
}
function Vne(r) {
  return r && r.type === "codeBlock";
}
function Nu(r) {
  return r && (r.type === "item" || r.type === "list");
}
function mx(r) {
  return Nu(r) && r.listData.type === "ordered";
}
function Une(r) {
  return Nu(r) && r.listData.type !== "ordered";
}
function Nb(r) {
  return r && (r.type === "tableCell" || r.type === "tableDelimCell");
}
function $ne(r) {
  switch (r.type) {
    case "code":
    case "text":
    case "emph":
    case "strong":
    case "strike":
    case "link":
    case "image":
    case "htmlInline":
    case "linebreak":
    case "softbreak":
    case "customInline":
      return !0;
    default:
      return !1;
  }
}
function cf(r, e, t) {
  for (t === void 0 && (t = !0), r = t ? r : r.parent; r && r.type !== "document"; ) {
    if (e(r))
      return r;
    r = r.parent;
  }
  return null;
}
function Wne(r, e, t) {
  for (t === void 0 && (t = !0), r = t ? r : r.parent; r && r.type !== "document"; )
    e(r), r = r.parent;
}
function Bn(r, e) {
  return [r[0], r[1] + e];
}
function kl(r, e) {
  return [r[0], e];
}
function jne(r) {
  var e = r.firstChild.literal;
  switch (r.type) {
    case "emph":
      return "*" + e + "*";
    case "strong":
      return "**" + e + "**";
    case "strike":
      return "~~" + e + "~~";
    case "code":
      return "`" + e + "`";
    case "link":
    case "image":
      var t = r, n = t.destination, i = t.title, a = r.type === "link" ? "" : "!";
      return a + "[" + e + "](" + n + (i ? ' "' + i + '"' : "") + ")";
    default:
      return null;
  }
}
function Gne(r) {
  switch (r.type) {
    case "document":
    case "blockQuote":
    case "list":
    case "item":
    case "paragraph":
    case "heading":
    case "emph":
    case "strong":
    case "strike":
    case "link":
    case "image":
    case "table":
    case "tableHead":
    case "tableBody":
    case "tableRow":
    case "tableCell":
    case "tableDelimRow":
    case "customInline":
      return !0;
    default:
      return !1;
  }
}
function Kne(r) {
  for (var e = [], t = r.walker(), n = null; n = t.next(); ) {
    var i = n.node;
    i.type === "text" && e.push(i.literal);
  }
  return e.join("");
}
var wh = [], gx = {}, Ob = /\$\$widget\d+\s/;
function Pm(r) {
  var e = r.search(Ob);
  if (e !== -1) {
    var t = r.substring(e), n = t.replace(Ob, "").replace("$$", "");
    r = r.substring(0, e), r += Pm(n);
  }
  return r;
}
function yx(r, e) {
  return "$$" + r + " " + e + "$$";
}
function kx(r, e) {
  var t = gx[r], n = t.rule, i = t.toDOM, a = Pm(e).match(n);
  return a && (e = a[0]), i(e);
}
function Jne() {
  return wh;
}
function Qne(r) {
  wh = r, wh.forEach(function(e, t) {
    gx["widget" + t] = e;
  });
}
function Oy(r, e, t, n) {
  return r.concat(bu(e, t, n));
}
function bu(r, e, t) {
  t === void 0 && (t = 0);
  var n = [], i = (wh[t] || {}).rule, a = t + 1;
  if (r = Pm(r), i && i.test(r)) {
    for (var s = void 0; (s = r.search(i)) !== -1; ) {
      var u = r.substring(0, s);
      u && (n = Oy(n, u, e, a)), r = r.substring(s);
      var f = r.match(i)[0], p = "widget" + t;
      n.push(e.nodes.widget.create({ info: p }, e.text(yx(p, f)))), r = r.substring(f.length);
    }
    r && (n = Oy(n, r, e, a));
  } else r && (n = t < wh.length - 1 ? Oy(n, r, e, a) : [e.text(r)]);
  return n;
}
function wx(r) {
  for (var e, t = "", n = r.walker(); e = n.next(); ) {
    var i = e.node, a = e.entering;
    a && (i !== r && i.type !== "text" ? (t += jne(i), n.resumeAt(r, !1), n.next()) : i.type === "text" && (t += i.literal));
  }
  return t;
}
function bx() {
  return {
    deleteSelection: function() {
      return nk;
    },
    selectAll: function() {
      return ox;
    },
    undo: function() {
      return ch;
    },
    redo: function() {
      return sk;
    }
  };
}
function Xne(r) {
  return new Ji({
    props: {
      decorations: function(e) {
        var t = e.doc;
        if (r.text && t.childCount === 1 && t.firstChild.isTextblock && t.firstChild.content.size === 0) {
          var n = document.createElement("span");
          return Io(n, "placeholder"), r.className && Io(n, r.className), n.textContent = r.text, un.create(t, [ji.widget(1, n)]);
        }
        return null;
      }
    }
  });
}
var Yne = Mu, Zne = uk;
function eie(r, e) {
  var t;
  return r.classList ? r.classList.contains(e) : (t = Zne(r).split(/\s+/), Yne(e, t) > -1);
}
var Cx = eie, tie = Mu, rie = qo, Sv = Element.prototype, nie = Sv.matches || Sv.webkitMatchesSelector || Sv.mozMatchesSelector || Sv.msMatchesSelector || function(r) {
  var e = this.document || this.ownerDocument;
  return tie(this, rie(e.querySelectorAll(r))) > -1;
};
function iie(r, e) {
  return nie.call(r, e);
}
var aie = iie, Tx = "[A-Za-z][A-Za-z0-9-]*", oie = "[a-zA-Z_:][a-zA-Z0-9:._-]*", sie = "[^\"'=<>`\\x00-\\x20]+", lie = "'[^']*'", uie = '"[^"]*"', cie = "(?:" + sie + "|" + lie + "|" + uie + ")", fie = "(?:\\s*=\\s*" + cie + ")", Sx = "(?:\\s+" + oie + fie + "?)", xx = "<(" + Tx + ")(" + Sx + ")*\\s*/?>", die = "</(" + Tx + ")\\s*[>]", Ex = "(?:" + xx + "|" + die + ")", ff = new RegExp("^" + Ex, "i"), y0 = /<br\s*\/*>/i, hie = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/, Mx = "</p><p>";
function gk(r, e, t) {
  var n = parseInt(r.left, 10), i = parseInt(r.top, 10), a = parseInt(r.width, 10) + parseInt(r.paddingLeft, 10) + parseInt(r.paddingRight, 10), s = parseInt(r.height, 10) + parseInt(r.paddingTop, 10) + parseInt(r.paddingBottom, 10);
  return e >= n && e <= n + a && t >= i && t <= i + s;
}
var Nx = "toastui-editor-";
function Mt() {
  for (var r = [], e = 0; e < arguments.length; e++)
    r[e] = arguments[e];
  for (var t = [], n = 0, i = r; n < i.length; n++) {
    var a = i[n], s = void 0;
    Array.isArray(a) ? s = a[0] ? a[1] : null : s = a, s && t.push("" + Nx + s);
  }
  return t.join(" ");
}
function xn() {
  for (var r = [], e = 0; e < arguments.length; e++)
    r[e] = arguments[e];
  return r.map(function(t) {
    return Nx + "md-" + t;
  }).join(" ");
}
function pie(r) {
  return r?.nodeType === Node.TEXT_NODE;
}
function Bm(r) {
  return r && r.nodeType === Node.ELEMENT_NODE;
}
function vie(r, e) {
  var t = qo(r.querySelectorAll(e));
  return t.length ? t : [];
}
function mie(r, e) {
  e = wf(e) ? qo(e) : [e], e.forEach(function(t) {
    r.appendChild(t);
  });
}
function gie(r, e) {
  e.parentNode && e.parentNode.insertBefore(r, e);
}
function Ou(r) {
  r.parentNode && r.parentNode.removeChild(r);
}
function yie(r) {
  for (var e = []; r.firstChild; )
    e.push(r.firstChild), r.parentNode && r.parentNode.insertBefore(r.firstChild, r);
  return Ou(r), e;
}
function yk(r, e, t) {
  to(t) && (t = !Cx(r, e));
  var n = t ? Io : Ya;
  n(r, e);
}
function Ox(r, e) {
  var t = document.createElement("div");
  Ms(r) ? t.innerHTML = r : t.appendChild(r);
  var n = t.firstChild;
  return e && e.appendChild(n), n;
}
function kk(r) {
  var e = window.getComputedStyle(r);
  return ["margin-left", "margin-right"].reduce(function(t, n) {
    return t + parseInt(e.getPropertyValue(n), 10);
  }, 0) + r.offsetWidth;
}
function Po(r, e) {
  var t;
  for (Ms(e) ? t = function(n) {
    return aie(n, e);
  } : t = function(n) {
    return n === e;
  }; r && r !== document; ) {
    if (Bm(r) && t(r))
      return r;
    r = r.parentNode;
  }
  return null;
}
function Dx(r, e) {
  for (var t = 0, n = 0; r && r !== e; ) {
    var i = r.offsetTop, a = r.offsetLeft, s = r.offsetParent;
    if (t += i, n += a, s === e.offsetParent)
      break;
    r = r.offsetParent;
  }
  return { offsetTop: t, offsetLeft: n };
}
function wk(r, e) {
  Object.keys(r).forEach(function(t) {
    g0(r[t]) ? e.removeAttribute(t) : e.setAttribute(t, r[t]);
  });
}
function kie(r) {
  var e = r.replace(/<p><br\s*\/*><\/p>/gi, "<p></p>"), t = new RegExp(Ex, "ig"), n = e.match(t);
  return n?.forEach(function(i, a) {
    if (y0.test(i)) {
      var s = Mx;
      if (a) {
        var u = n[a - 1], f = u.match(xx);
        if (f && !/br/i.test(f[1])) {
          var p = f[1];
          s = "</" + p + "><" + p + ">";
        }
      }
      e = e.replace(y0, s);
    }
  }), e;
}
function bk(r) {
  var e = /<img class="ProseMirror-separator" alt="">/g, t = / class="ProseMirror-trailingBreak"/g, n = r;
  return n = n.replace(e, ""), n = n.replace(t, ""), n;
}
var Ax = new Ch("widget"), Db = 5, wie = (
  /** @class */
  (function() {
    function r(e, t) {
      var n = this;
      this.popup = null, this.removeWidget = function() {
        n.popup && (n.rootEl.removeChild(n.popup), n.popup = null);
      }, this.rootEl = e.dom.parentElement, this.eventEmitter = t, this.eventEmitter.listen("blur", this.removeWidget), this.eventEmitter.listen("loadUI", function() {
        n.rootEl = Po(e.dom.parentElement, "." + Mt("defaultUI"));
      }), this.eventEmitter.listen("removePopupWidget", this.removeWidget);
    }
    return r.prototype.update = function(e) {
      var t = Ax.getState(e.state);
      if (this.removeWidget(), t) {
        var n = t.node, i = t.style, a = e.coordsAtPos(t.pos), s = a.top, u = a.left, f = a.bottom, p = f - s, y = this.rootEl.getBoundingClientRect(), T = s - y.top;
        _o(n, { opacity: "0" }), this.rootEl.appendChild(n), _o(n, {
          position: "absolute",
          left: u - y.left + Db + "px",
          top: (i === "bottom" ? T + p - Db : T - p) + "px",
          opacity: "1"
        }), this.popup = n, e.focus();
      }
    }, r.prototype.destroy = function() {
      this.eventEmitter.removeEventHandler("blur", this.removeWidget);
    }, r;
  })()
);
function bie(r) {
  return new Ji({
    key: Ax,
    state: {
      init: function() {
        return null;
      },
      apply: function(e) {
        return e.getMeta("widget");
      }
    },
    view: function(e) {
      return new wie(e, r);
    }
  });
}
function Cie(r) {
  r.listen("addImageBlobHook", function(e, t) {
    var n = new FileReader();
    n.onload = function(i) {
      var a = i.target;
      return t(a.result);
    }, n.readAsDataURL(e);
  });
}
function Ck(r, e, t) {
  var n = function(i, a) {
    r.emit("command", "addImage", {
      imageUrl: i,
      altText: a || e.name || "image"
    });
  };
  r.emit("addImageBlobHook", e, n, t);
}
function Lx(r) {
  var e = qo(r).filter(function(n) {
    var i = n.type;
    return i.indexOf("image") !== -1;
  });
  if (e.length === 1) {
    var t = e[0];
    if (t)
      return t.getAsFile();
  }
  return null;
}
function Tie(r) {
  var e = r.eventEmitter;
  return new Ji({
    props: {
      handleDOMEvents: {
        drop: function(t, n) {
          var i, a = (i = n.dataTransfer) === null || i === void 0 ? void 0 : i.files;
          return a && uf(a, function(s) {
            return s.type.indexOf("image") !== -1 ? (n.preventDefault(), n.stopPropagation(), Ck(e, s, n.type), !1) : !0;
          }), !0;
        }
      }
    }
  });
}
var $r = (
  /** @class */
  (function() {
    function r() {
    }
    return Object.defineProperty(r.prototype, "type", {
      get: function() {
        return "node";
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.setContext = function(e) {
      this.context = e;
    }, r;
  })()
);
function Rx(r) {
  var e = document.createElement("span"), t = kx(r.attrs.info, r.textContent);
  return e.className = "tui-widget", e.appendChild(t), { dom: e };
}
function k0(r) {
  return r.type.name === "widget";
}
var Ix = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "widget";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: {
            info: { default: null }
          },
          group: "inline",
          inline: !0,
          content: "text*",
          selectable: !1,
          atom: !0,
          toDOM: function() {
            return ["span", { class: "tui-widget" }, 0];
          },
          parseDOM: [
            {
              tag: "span.tui-widget",
              getAttrs: function(t) {
                var n = t.textContent, i = n.match(/\$\$(widget\d+)/), a = i[1];
                return { info: a };
              }
            }
          ]
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), Px = (
  /** @class */
  (function() {
    function r(e) {
      this.timer = null, this.el = document.createElement("div"), this.el.className = "toastui-editor", this.eventEmitter = e, this.placeholder = { text: "" };
    }
    return r.prototype.createState = function() {
      return pu.create({
        schema: this.schema,
        plugins: this.createPlugins()
      });
    }, r.prototype.initEvent = function() {
      var e = this, t = e.eventEmitter, n = e.view, i = e.editorType;
      n.dom.addEventListener("focus", function() {
        return t.emit("focus", i);
      }), n.dom.addEventListener("blur", function() {
        return t.emit("blur", i);
      });
    }, r.prototype.emitChangeEvent = function(e) {
      this.eventEmitter.emit("caretChange", this.editorType), e.docChanged && this.eventEmitter.emit("change", this.editorType);
    }, Object.defineProperty(r.prototype, "defaultPlugins", {
      get: function() {
        var e = this.createInputRules(), t = Ki(Ki([], this.keymaps), [
          kh(_e({ "Shift-Enter": mb.Enter }, mb)),
          dx(),
          Xne(this.placeholder),
          bie(this.eventEmitter),
          Tie(this.context)
        ]);
        return e ? t.concat(e) : t;
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.createInputRules = function() {
      var e = Jne(), t = e.map(function(n) {
        var i = n.rule;
        return new Tl(i, function(a, s, u, f) {
          var p = a.schema, y = a.tr, T = a.doc, N = s.input.match(new RegExp(i, "g")), O = T.resolve(u), A = O.parent, q = 0;
          if (k0(A) && (A = O.node(O.depth - 1)), A.forEach(function(te) {
            return k0(te) && (q += 1);
          }), N.length > q) {
            var U = vi(N), j = bu(U, p);
            return y.replaceWith(f - U.length + 1, f, j);
          }
          return null;
        });
      });
      return t.length ? cx({ rules: t }) : null;
    }, r.prototype.clearTimer = function() {
      this.timer && (clearTimeout(this.timer), this.timer = null);
    }, r.prototype.createSchema = function() {
      return new iS({
        nodes: this.specs.nodes,
        marks: this.specs.marks
      });
    }, r.prototype.createKeymaps = function(e) {
      var t = bx(), n = t.undo, i = t.redo, a = this.specs.keymaps(e), s = {
        "Mod-z": n(),
        "Shift-Mod-z": i()
      };
      return e ? a.concat(kh(s)) : a;
    }, r.prototype.createCommands = function() {
      return this.specs.commands(this.view);
    }, r.prototype.createPluginProps = function() {
      var e = this;
      return this.extraPlugins.map(function(t) {
        return t(e.eventEmitter);
      });
    }, r.prototype.focus = function() {
      var e = this;
      this.clearTimer(), this.timer = setTimeout(function() {
        e.view.focus(), e.view.dispatch(e.view.state.tr.scrollIntoView());
      });
    }, r.prototype.blur = function() {
      this.view.dom.blur();
    }, r.prototype.destroy = function() {
      var e = this;
      this.clearTimer(), this.view.destroy(), Object.keys(this).forEach(function(t) {
        delete e[t];
      });
    }, r.prototype.moveCursorToStart = function(e) {
      var t = this.view.state.tr;
      this.view.dispatch(t.setSelection(Jr(t, 1)).scrollIntoView()), e && this.focus();
    }, r.prototype.moveCursorToEnd = function(e) {
      var t = this.view.state.tr;
      this.view.dispatch(t.setSelection(Jr(t, t.doc.content.size - 1)).scrollIntoView()), e && this.focus();
    }, r.prototype.setScrollTop = function(e) {
      this.view.dom.scrollTop = e;
    }, r.prototype.getScrollTop = function() {
      return this.view.dom.scrollTop;
    }, r.prototype.setPlaceholder = function(e) {
      this.placeholder.text = e, this.view.dispatch(this.view.state.tr.scrollIntoView());
    }, r.prototype.setHeight = function(e) {
      _o(this.el, { height: e + "px" });
    }, r.prototype.setMinHeight = function(e) {
      _o(this.el, { minHeight: e + "px" });
    }, r.prototype.getElement = function() {
      return this.el;
    }, r;
  })()
);
function Sie(r) {
  return r instanceof Function;
}
var Ma = Sie, xie = [
  "Enter",
  "Shift-Enter",
  "Mod-Enter",
  "Tab",
  "Shift-Tab",
  "Delete",
  "Backspace",
  "Mod-Delete",
  "Mod-Backspace",
  "ArrowUp",
  "ArrowDown",
  "ArrowLeft",
  "ArrowRight",
  "Mod-d",
  "Mod-D",
  "Alt-ArrowUp",
  "Alt-ArrowDown"
];
function xv(r, e, t) {
  return r.focus(), e(t)(r.state, r.dispatch, r);
}
var Bx = (
  /** @class */
  (function() {
    function r(e) {
      this.specs = e;
    }
    return Object.defineProperty(r.prototype, "nodes", {
      get: function() {
        return this.specs.filter(function(e) {
          return e.type === "node";
        }).reduce(function(e, t) {
          var n, i = t.name, a = t.schema;
          return _e(_e({}, e), (n = {}, n[i] = a, n));
        }, {});
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(r.prototype, "marks", {
      get: function() {
        return this.specs.filter(function(e) {
          return e.type === "mark";
        }).reduce(function(e, t) {
          var n, i = t.name, a = t.schema;
          return _e(_e({}, e), (n = {}, n[i] = a, n));
        }, {});
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.commands = function(e, t) {
      var n = this.specs.filter(function(a) {
        var s = a.commands;
        return s;
      }).reduce(function(a, s) {
        var u = {}, f = s.commands();
        return Ma(f) ? u[s.name] = function(p) {
          return xv(e, f, p);
        } : Object.keys(f).forEach(function(p) {
          u[p] = function(y) {
            return xv(e, f[p], y);
          };
        }), _e(_e({}, a), u);
      }, {}), i = bx();
      return Object.keys(i).forEach(function(a) {
        n[a] = function(s) {
          return xv(e, i[a], s);
        };
      }), t && Object.keys(t).forEach(function(a) {
        n[a] = function(s) {
          return xv(e, t[a], s);
        };
      }), n;
    }, r.prototype.keymaps = function(e) {
      var t = this.specs.filter(function(n) {
        return n.keymaps;
      }).map(function(n) {
        return n.keymaps();
      });
      return t.map(function(n) {
        return e || Object.keys(n).forEach(function(i) {
          ti(xie, i) || delete n[i];
        }), kh(n);
      });
    }, r.prototype.setContext = function(e) {
      this.specs.forEach(function(t) {
        t.setContext(e);
      });
    }, r;
  })()
);
function Fx(r) {
  var e = r.from, t = r.to;
  return r instanceof Di ? [e + 1, t - 1] : [e, t];
}
function Ab(r) {
  return r.index(0) + 1;
}
function df(r, e, t) {
  t === void 0 && (t = 1);
  var n = 0;
  return r.forEach(function(i, a) {
    k0(i) && a + 2 < e && (n += 2 * t);
  }), n;
}
function zv(r, e, t) {
  t === void 0 && (t = e);
  var n = e === t, i = r.resolve(e), a = Ab(i), s = a, u = i.start(1), f = u;
  if (!n) {
    var p = r.resolve(t === r.content.size ? t - 1 : t);
    f = p.start(1), s = Ab(p), p.pos === r.content.size && (t = r.content.size - 2);
  }
  var y = Math.max(e - u + 1, 1), T = Math.max(t - f + 1, 1);
  return [
    [a, y + df(r.child(a - 1), y, -1)],
    [s, T + df(r.child(s - 1), T, -1)]
  ];
}
function _x(r, e) {
  for (var t = [], n = 0, i = 0; n < e; n += 1) {
    var a = r.child(n);
    t[n] = i, i += a.nodeSize;
  }
  return t;
}
function fu(r, e, t) {
  var n = _x(r, t[0]), i = e[0] - 1, a = t[0] - 1, s = r.child(i), u = r.child(a), f = n[i], p = n[a];
  return f += e[1] + df(s, e[1] - 1), p += t[1] + df(u, t[1] - 1), [f, Math.min(p, r.content.size)];
}
function Sn(r) {
  var e = r.$from, t = r.$to, n = r.from, i = r.to, a = e.doc;
  return r instanceof Di && (e = a.resolve(n + 1), t = a.resolve(i - 1)), e.depth === 0 && (e = a.resolve(n - 1), t = e), {
    startFromOffset: e.start(1),
    endFromOffset: t.start(1),
    startToOffset: e.end(1),
    endToOffset: t.end(1),
    startIndex: e.index(0),
    endIndex: t.index(0),
    from: e.pos,
    to: t.pos
  };
}
function dm(r, e) {
  for (var t = 1, n = 1, i = 0, a = 0; i < r.childCount; i += 1) {
    var s = r.child(i).nodeSize;
    if (t = a + 1, n = a + s - 1, i === e)
      break;
    a += s;
  }
  return { startOffset: t, endOffset: n };
}
var Lb = "heading", Eie = "blockQuote", Mie = "listItem", Nie = "table", Oie = "tableCell", Die = "codeBlock", Aie = "thematicBreak", Hv = "link", Ev = "code", Fm = "meta", Du = "delimiter", Lie = "taskDelimiter", Tk = "markedText", Rie = "html", Iie = "customBlock", Rb = {
  strong: 2,
  emph: 1,
  strike: 2
};
function Sr(r, e, t, n) {
  return { start: r, end: e, spec: { type: t, attrs: n } };
}
function Pie(r, e, t) {
  var n = r.level, i = r.headingType, a = [Sr(e, t, Lb, { level: n })];
  return i === "atx" ? a.push(Sr(e, Bn(e, n), Du)) : a.push(Sr(kl(t, 0), t, Lb, { seText: !0 })), a;
}
function Dy(r, e, t) {
  var n = r.type, i = Bn(e, Rb[n]), a = Bn(t, -Rb[n]);
  return [
    Sr(i, a, n),
    Sr(e, i, Du),
    Sr(a, t, Du)
  ];
}
function qx(r, e, t, n) {
  return [
    Sr(r, e, Hv),
    Sr(kl(r, t[1] + 1), kl(e, n), Hv, {
      desc: !0
    }),
    Sr(kl(e, n + 2), Bn(e, -1), Hv, { url: !0 })
  ];
}
function Bie(r, e, t) {
  var n = r.lastChild, i = n ? yl(n) + 1 : 3, a = Bn(e, 1);
  return Ki([Sr(e, a, Fm)], qx(e, t, a, i));
}
function Fie(r, e, t) {
  var n = r.lastChild, i = r.extendedAutolink, a = n ? yl(n) + 1 : 2;
  return i ? [Sr(e, t, Hv, { desc: !0 })] : qx(e, t, e, a);
}
function _ie(r, e, t) {
  var n = r.tickCount, i = Bn(e, n), a = Bn(t, -n);
  return [
    Sr(e, t, Ev),
    Sr(e, i, Ev, { start: !0 }),
    Sr(i, a, Ev, { marked: !0 }),
    Sr(a, t, Ev, { end: !0 })
  ];
}
function zx(r, e, t, n) {
  var i = {
    start: e,
    end: t,
    spec: {
      attrs: { className: n + "-line-background", codeStart: e[0], codeEnd: t[0] }
    },
    lineBackground: !0
  };
  return r.type !== "item" && r.type !== "blockQuote" ? [
    _e(_e({}, i), { end: e, spec: { attrs: { className: n + "-line-background start" } } }),
    _e(_e({}, i), { start: [Math.min(e[0] + 1, t[0]), e[1]] })
  ] : null;
}
function qie(r, e, t, n) {
  var i = r.fenceOffset, a = r.fenceLength, s = r.fenceChar, u = r.info, f = r.infoPadding, p = r.parent, y = i + a, T = [Sr(kl(e, 1), t, Die)];
  s && T.push(Sr(e, Bn(e, y), Du)), u && T.push(Sr(Bn(e, a), Bn(e, a + f + u.length), Fm));
  var N = "^(\\s{0,4})(" + s + "{" + a + ",})", O = new RegExp(N);
  O.test(n) && T.push(Sr(kl(t, 1), t, Du));
  var A = zx(p, e, t, "code-block");
  return A ? T.concat(A) : T;
}
function zie(r, e, t) {
  var n = r, i = n.offset, a = n.syntaxLength, s = n.info, u = n.parent, f = i + a, p = [Sr(kl(e, 1), t, Iie)];
  p.push(Sr(e, Bn(e, f), Du)), s && p.push(Sr(Bn(e, f), Bn(e, a + s.length), Fm)), p.push(Sr(kl(t, 1), t, Du));
  var y = zx(u, e, t, "custom-block");
  return y ? p.concat(y) : p;
}
function Hx(r, e) {
  for (var t = []; r; ) {
    var n = r.type;
    (n === "paragraph" || n === "codeBlock") && t.push(Sr([Mh(r), Im(r) - 1], [Rm(r), yl(r) + 1], e)), r = r.next;
  }
  return t;
}
function Hie(r) {
  for (var e = []; r; )
    e.push(Sr([Mh(r), Im(r)], [Rm(r), yl(r) + 1], Tk)), r = r.next;
  return e;
}
function Vie(r, e, t) {
  var n = r.parent && r.parent.type !== "blockQuote" ? [Sr(e, t, Eie)] : [];
  if (r.firstChild) {
    var i = [];
    r.firstChild.type === "paragraph" ? i = Hie(r.firstChild.firstChild) : r.firstChild.type === "list" && (i = Hx(r.firstChild, Tk)), n = Ki(Ki([], n), i);
  }
  return n;
}
function Uie(r) {
  for (var e = 0; r.parent.parent && r.parent.parent.type === "item"; )
    r = r.parent.parent, e += 1;
  var t = [{ odd: !0 }, { even: !0 }][e % 2];
  return [Mie, _e(_e({}, t), { listStyle: !0 })];
}
function $ie(r, e) {
  var t = r.listData, n = t.padding, i = t.task, a = Uie(r), s = [Sr.apply(void 0, Ki([e, Bn(e, n)], a))];
  return i && (s.push(Sr(Bn(e, n), Bn(e, n + 3), Lie)), s.push(Sr(Bn(e, n + 1), Bn(e, n + 2), Fm))), s.concat(Hx(r.firstChild, Tk));
}
var Ib = {
  heading: Pie,
  strong: Dy,
  emph: Dy,
  strike: Dy,
  link: Fie,
  image: Bie,
  code: _ie,
  codeBlock: qie,
  blockQuote: Vie,
  item: $ie,
  customBlock: zie
}, Pb = {
  thematicBreak: Aie,
  table: Nie,
  tableCell: Oie,
  htmlInline: Rie
};
function Wie(r, e, t, n) {
  var i = r.type;
  return Ma(Ib[i]) ? Ib[i](r, e, t, n) : Pb[i] ? [Sr(e, t, Pb[i])] : null;
}
var bh = {};
function jie(r) {
  var e = r.schema, t = r.toastMark;
  return new Ji({
    appendTransaction: function(n, i, a) {
      var s = n[0], u = a.tr;
      if (s.docChanged) {
        var f = [], p = s.getMeta("editResult");
        p.forEach(function(y) {
          var T = y.nodes, N = y.removedNodeRange;
          if (T.length) {
            f = f.concat(Yie(u, T));
            for (var O = 0, A = T; O < A.length; O++)
              for (var q = A[O], U = q.walker(), j = U.next(); j; ) {
                var te = j.node, se = j.entering;
                se && (f = f.concat(Zie(te, t))), j = U.next();
              }
          } else if (N)
            for (var me = u.doc.childCount - 1, Ce = N.line, pe = Ce[0], ke = Ce[1], Ne = Math.min(pe, me), ze = Math.min(ke, me), Ze = Ne; Ze <= ze; Ze += 1)
              bh[Ze] = !0;
        }), Jie(u, e, f);
      }
      return u.setMeta("widget", s.getMeta("widget"));
    }
  });
}
function Gie(r, e, t) {
  return Object.keys(t).some(function(n) {
    return t[n] !== r.child(e).attrs[n];
  });
}
function Kie(r, e, t, n, i) {
  i === void 0 && (i = {});
  for (var a = n.startIndex, s = n.endIndex, u = n.from, f = n.to, p = !1, y = a; y <= s; y += 1)
    delete bh[y], p = Gie(e, y, i);
  p && r.setBlockType(u, f, t, i);
}
function Jie(r, e, t) {
  var n = r.doc, i = e.nodes.paragraph, a = _x(n, n.childCount);
  t.forEach(function(s) {
    var u = s.start, f = s.end, p = s.spec, y = s.lineBackground, T = Math.min(u[0], n.childCount) - 1, N = Math.min(f[0], n.childCount) - 1, O = n.child(T), A = n.child(N), q = a[T], U = a[N];
    if (q += u[1] + df(O, u[1] - 1), U += f[1] + df(A, f[1] - 1), p)
      if (y) {
        var j = { from: q, to: U, startIndex: T, endIndex: N };
        Kie(r, n, i, j, p.attrs);
      } else
        r.addMark(q, U, e.mark(p.type, p.attrs));
    else
      r.removeMark(q, U);
  }), Qie(r, a, i);
}
function Qie(r, e, t) {
  Object.keys(bh).forEach(function(n) {
    var i = Number(n), a = Math.min(Number(n) + 1, r.doc.childCount - 1), s = e[i], u = e[a] - 1;
    i === a && (u += 2), r.setBlockType(s, u, t);
  });
}
function Xie(r, e, t) {
  var n = [];
  bh = {};
  for (var i = e[0] - 1; i < t[0]; i += 1) {
    var a = r.child(i), s = a.attrs.codeEnd, u = a.attrs.codeStart;
    if (u && s && !ti(n, u)) {
      n.push(u), s = Math.min(s, r.childCount);
      for (var f = u - 1, p = t[0], y = f; y < p; y += 1)
        bh[y] = !0;
    }
  }
}
function Yie(r, e) {
  var t = r.doc, n = e[0].sourcepos[0], i = vi(e).sourcepos, a = i[1], s = [n[0], n[1]], u = [a[0], a[1] + 1], f = [];
  return Xie(t, n, a), f.push({ start: s, end: u }), f;
}
function Zie(r, e) {
  var t = e.getLineTexts(), n = [Mh(r), Im(r)], i = [Rm(r), yl(r) + 1], a = Wie(r, n, i, t[i[0] - 1]);
  return a ?? [];
}
var eae = [
  "taskList",
  "orderedList",
  "bulletList",
  "table",
  "strong",
  "emph",
  "strike",
  "heading",
  "thematicBreak",
  "blockQuote",
  "code",
  "codeBlock",
  "indent",
  "outdent"
];
function tae(r) {
  var e = r.type;
  return Nu(r) ? r.listData.task ? "taskList" : r.listData.type === "ordered" ? "orderedList" : "bulletList" : e.indexOf("table") !== -1 ? "table" : ti(eae, e) ? e : null;
}
function rae(r) {
  var e = {
    indent: { active: !1, disabled: !0 },
    outdent: { active: !1, disabled: !0 }
  }, t = !0;
  return Wne(r, function(n) {
    var i = tae(n);
    i && (i === "bulletList" || i === "orderedList" ? t && (e[i] = { active: !0 }, e.indent.disabled = !1, e.outdent.disabled = !1, t = !1) : e[i] = { active: !0 });
  }), e;
}
function nae(r) {
  var e = r.toastMark, t = r.eventEmitter;
  return new Ji({
    view: function() {
      return {
        update: function(n, i) {
          var a = n.state, s = a.doc, u = a.selection;
          if (!(i && i.doc.eq(s) && i.selection.eq(u))) {
            var f = u.from, p = a.doc.resolve(f).start(), y = a.doc.content.findIndex(f).index + 1, T = f - p;
            f === p && (T += 1);
            var N = [y, T], O = e.findNodeAtPosition(N), A = rae(O);
            t.emit("changeToolbarState", {
              cursorPos: N,
              mdNode: O,
              toolbarState: A
            }), t.emit("setFocusedNode", O);
          }
        }
      };
    }
  });
}
var iae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "doc";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "block+"
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), Qr = (
  /** @class */
  (function() {
    function r() {
    }
    return Object.defineProperty(r.prototype, "type", {
      get: function() {
        return "mark";
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.setContext = function(e) {
      this.context = e;
    }, r;
  })()
);
function ca(r, e) {
  return bl(r, e - 1);
}
function bl(r, e) {
  return r.child(e).textContent;
}
var ih = /^\s*> ?/, aae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "blockQuote";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("block-quote") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.createBlockQuoteText = function(t, n) {
      return n ? t.replace(ih, "").trim() : "> " + t.trim();
    }, e.prototype.extendBlockQuote = function() {
      var t = this;
      return function(n, i) {
        var a = n.selection, s = n.doc, u = n.tr, f = n.schema, p = Sn(a), y = p.endFromOffset, T = p.endToOffset, N = p.endIndex, O = p.to, A = bl(s, N), q = ih.test(A);
        if (q && O > y && a.empty) {
          var U = !A.replace(ih, "").trim();
          if (U)
            u.deleteRange(y, T).split(u.mapping.map(T));
          else {
            var j = A.slice(O - y).trim(), te = ei(f, t.createBlockQuoteText(j));
            mk(u, T, j, te);
          }
          return i(u), !0;
        }
        return !1;
      };
    }, e.prototype.commands = function() {
      var t = this;
      return function() {
        return function(n, i) {
          var a = n.selection, s = n.doc, u = Sn(a), f = u.startFromOffset, p = u.endToOffset, y = u.startIndex, T = u.endIndex, N = ih.test(bl(s, y)), O = fm({
            state: n,
            startIndex: y,
            endIndex: T,
            from: f,
            createText: function(A) {
              return t.createBlockQuoteText(A, N);
            }
          });
          return i(O.setSelection(Jr(O, O.mapping.map(p)))), !0;
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "alt-q": t,
        "alt-Q": t,
        Enter: this.extendBlockQuote()
      };
    }, e;
  })(Qr)
), Au = /(^\s*)([-*+] |[\d]+\. )/, Sk = /(^\s*)([\d])+\.( \[[ xX]])? /, Ss = /^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/, hm = /(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /, oae = /^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/, sae = /(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/, lae = /(^\s*)([-*+])( \[[ xX]]) /;
function xk(r) {
  return Sk.test(r) ? "ordered" : "bullet";
}
function Ek(r) {
  for (var e = 0; r && r.type !== "document"; )
    r.type === "list" && (e += 1), r = r.parent;
  return e;
}
function w0(r, e, t, n) {
  for (var i = r.getLineTexts(), a = i.length, s = [], u = e; n ? u < a : u > 1; ) {
    u = n ? u + 1 : u - 1;
    var f = r.findFirstNodeAtLine(u), p = Ek(f);
    if (p === t)
      s.push({ line: u, depth: t, mdNode: f });
    else if (p < t)
      break;
  }
  return s;
}
function uae(r) {
  var e = r.toastMark, t = r.mdNode, n = r.line, i = Ek(t), a = w0(e, n, i, !1).reverse(), s = w0(e, n, i, !0);
  return a.concat([{ line: n, depth: i, mdNode: t }]).concat(s);
}
function cae(r) {
  if (!Au.test(r))
    return "* " + r;
  var e = xk(r);
  return e === "bullet" && hm.test(r) ? r = r.replace(lae, "$1$2 ") : e === "ordered" && (r = r.replace(Sk, "$1* ")), r;
}
function fae(r, e) {
  if (!Au.test(r))
    return e + ". " + r;
  var t = xk(r);
  if (t === "bullet" || t === "ordered" && hm.test(r))
    r = r.replace(hm, "$1" + e + ". ");
  else if (t === "ordered") {
    var n = Ss.exec(r)[3];
    Number(n) !== e && (r = r.replace(Sk, "$1" + e + ". "));
  }
  return r;
}
function Vx(r, e, t, n) {
  n === void 0 && (n = 0);
  var i = Number.MAX_VALUE, a = 0, s = e.map(function(u, f) {
    var p = u.line;
    i = Math.min(p - 1, i), a = Math.max(p - 1, a);
    var y = ca(r, p);
    return y = t === "bullet" ? cae(y) : fae(y, f + 1 + n), { text: y, line: p };
  });
  return { changedResults: s, firstIndex: i, lastIndex: a };
}
function Bb(r, e) {
  var t = uae(e);
  return Vx(e.doc, t, r);
}
var dae = {
  bullet: function(r) {
    return Bb("bullet", r);
  },
  ordered: function(r) {
    return Bb("ordered", r);
  },
  task: function(r) {
    var e = r.mdNode, t = r.doc, n = r.line, i = ca(t, n);
    return e.listData.task ? i = i.replace(sae, "$1$2") : Nu(e) && (i = i.replace(Au, "$1$2[ ] ")), { changedResults: [{ text: i, line: n }] };
  }
}, hae = {
  bullet: function(r) {
    var e = r.doc, t = r.line, n = ca(e, t), i = [{ text: "* " + n, line: t }];
    return { changedResults: i };
  },
  ordered: function(r) {
    for (var e = r.toastMark, t = r.doc, n = r.line, i = r.startLine, a = ca(t, n), s = 1, u = i, f = 0, p = i - 1; p > 0; p -= 1) {
      var y = e.findFirstNodeAtLine(p), T = ca(t, p), N = T && !!cf(y, function(se) {
        return Nu(se);
      }), O = Ss.exec(ca(t, p));
      if (!O && !N)
        break;
      if (!O && N) {
        f += 1;
        continue;
      }
      var A = O, q = A[1], U = A[3];
      if (!q) {
        s = Number(U), u = p;
        break;
      }
    }
    var j = s + n - u - f, te = [{ text: j + ". " + a, line: n }];
    return { changedResults: te };
  },
  task: function(r) {
    var e = r.doc, t = r.line, n = ca(e, t), i = [{ text: "* [ ] " + n, line: t }];
    return { changedResults: i };
  }
}, pae = {
  bullet: function(r) {
    var e = r.line, t = r.doc, n = ca(t, e), i = oae.exec(n), a = i[1], s = i[2];
    return { listSyntax: "" + a + s };
  },
  ordered: function(r) {
    var e = r.toastMark, t = r.line, n = r.mdNode, i = r.doc, a = Ek(n), s = ca(i, t), u = Ss.exec(s), f = u[1], p = u[3], y = u[4], T = Number(p) + 1, N = "" + f + T + y, O = w0(e, t, a, !0), A = O.filter(function(q) {
      var U = Ss.exec(ca(i, q.line));
      return U && U[1].length === f.length && !!cf(q.mdNode, function(j) {
        return mx(j);
      });
    });
    return _e({ listSyntax: N }, Vx(i, A, "ordered", T));
  }
};
function Ux(r, e, t, n, i) {
  for (var a = [], s = ca(r, t), u = Ss.exec(s); u; ) {
    var f = u[1], p = u[4], y = u[5], T = f.length;
    if (T === i)
      a.push(ei(e, "" + f + n + p + y)), n += 1, t += 1;
    else if (T > i) {
      var N = Ux(r, e, t, 1, T);
      t = N.line, a = a.concat(N.nodes);
    }
    if (T < i || t > r.childCount)
      break;
    s = ca(r, t), u = Ss.exec(s);
  }
  return { nodes: a, line: t };
}
var Fb = /(^\s{1,4})(.*)/;
function _b(r, e, t) {
  return r < e || Au.test(t) || ih.test(t);
}
function qb(r, e, t) {
  var n = t.$from;
  n.depth === 0 && (n = r.resolve(n.pos - 1));
  var i = n.node(1), a = n.start(1), s = i.content.size;
  return i.rangeHasMark(0, s, e.marks.table) && n.pos - a !== s && n.pos !== a;
}
function zb(r, e) {
  var t = e.from, n = e.to;
  if (e.type === "indent") {
    var i = 4;
    t += i, n += (e.lineLen + 1) * i;
  } else {
    var a = e.spaceLenList;
    t -= a[0];
    for (var s = 0; s < a.length; s += 1)
      n -= a[s];
  }
  return Jr(r, t, n);
}
var vae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "paragraph";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "inline*",
          attrs: {
            className: { default: null },
            codeStart: { default: null },
            codeEnd: { default: null }
          },
          selectable: !1,
          group: "block",
          parseDOM: [{ tag: "div" }],
          toDOM: function(t) {
            var n = t.attrs;
            return n.className ? ["div", { class: xn(n.className) }, 0] : ["div", 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.reorderList = function(t, n) {
      for (var i = this.context, a = i.view, s = i.toastMark, u = i.schema, f = a.state, p = f.tr, y = f.selection, T = f.doc, N = s.findFirstNodeAtLine(t), O = N; N && !Une(N) && N.parent.type !== "document"; )
        if (N = N.parent, mx(N)) {
          O = N;
          break;
        }
      O && (t = O.sourcepos[0][0]);
      var A = Ss.exec(ca(T, t)), q = A[1], U = A[3], j = q.length, te = Ux(T, u, t, Number(U), j), se = te.line, me = te.nodes;
      n = Math.max(n, se - 1);
      for (var Ce = dm(T, t - 1).startOffset, pe = t - 1; pe <= n - 1; pe += 1) {
        var ke = T.child(pe), Ne = ke.nodeSize, ze = ke.content, Ze = p.mapping.map(Ce), At = Ze + ze.size;
        p.replaceWith(Ze, At, me[pe - t + 1]), Ce += Ne;
      }
      var et = Jr(p, y.from, y.to);
      a.dispatch(p.setSelection(et));
    }, e.prototype.indent = function(t) {
      var n = this;
      return t === void 0 && (t = !1), function() {
        return function(i, a) {
          var s = i.schema, u = i.selection, f = i.doc, p = Sn(u), y = p.from, T = p.to, N = p.startFromOffset, O = p.startIndex, A = p.endIndex;
          if (t && qb(f, s, u))
            return !1;
          var q = bl(f, O);
          if (t && _b(y, T, q) || !t && Au.test(q)) {
            var U = fm({
              state: i,
              from: N,
              startIndex: O,
              endIndex: A,
              createText: function(te) {
                return "    " + te;
              }
            }), j = {
              type: "indent",
              from: y,
              to: T,
              lineLen: A - O
            };
            a(U.setSelection(zb(U, j))), Ss.test(q) && n.reorderList(O + 1, A + 1);
          } else t && a(i.tr.insert(T, ei(s, "    ")));
          return !0;
        };
      };
    }, e.prototype.outdent = function(t) {
      var n = this;
      return t === void 0 && (t = !1), function() {
        return function(i, a) {
          var s = i.selection, u = i.doc, f = i.schema, p = Sn(s), y = p.from, T = p.to, N = p.startFromOffset, O = p.startIndex, A = p.endIndex;
          if (t && qb(u, f, s))
            return !1;
          var q = bl(u, O);
          if (t && _b(y, T, q) || !t && Au.test(q)) {
            var U = [], j = fm({
              state: i,
              from: N,
              startIndex: O,
              endIndex: A,
              createText: function(pe) {
                var ke = Fb.exec(pe);
                return U.push(ke ? ke[1].length : 0), pe.replace(Fb, "$2");
              }
            }), te = { type: "outdent", from: y, to: T, spaceLenList: U };
            a(j.setSelection(zb(j, te))), Ss.test(q) && n.reorderList(O + 1, A + 1);
          } else if (t) {
            var se = q.slice(0, T - N), me = se.replace(/\s{1,4}$/, ""), Ce = T - (se.length - me.length);
            a(i.tr.delete(Ce, T));
          }
          return !0;
        };
      };
    }, e.prototype.deleteLines = function() {
      var t = this;
      return function(n, i) {
        var a = t.context.view, s = Sn(n.selection), u = s.startFromOffset, f = s.endToOffset, p = function() {
          return i(n.tr.deleteRange(u, f)), !0;
        };
        return Am(p, nx)(n, i, a);
      };
    }, e.prototype.moveDown = function() {
      return function(t, n) {
        var i = t.doc, a = t.tr, s = t.selection, u = t.schema, f = Sn(s), p = f.startFromOffset, y = f.endToOffset, T = f.endIndex;
        if (T < i.content.childCount - 1) {
          var N = i.child(T + 1), O = N.nodeSize, A = N.textContent;
          return a.delete(y, y + O).split(p).insert(a.mapping.map(p) - 2, ei(u, A)), n(a), !0;
        }
        return !1;
      };
    }, e.prototype.moveUp = function() {
      return function(t, n) {
        var i = t.tr, a = t.doc, s = t.selection, u = t.schema, f = Sn(s), p = f.startFromOffset, y = f.endToOffset, T = f.startIndex;
        if (T > 0) {
          var N = a.child(T - 1), O = N.nodeSize, A = N.textContent;
          return i.delete(p - O, p).split(i.mapping.map(y)).insert(i.mapping.map(y), ei(u, A)), n(i), !0;
        }
        return !1;
      };
    }, e.prototype.commands = function() {
      return {
        indent: this.indent(),
        outdent: this.outdent()
      };
    }, e.prototype.keymaps = function() {
      return {
        Tab: this.indent(!0)(),
        "Shift-Tab": this.outdent(!0)(),
        "Mod-d": this.deleteLines(),
        "Mod-D": this.deleteLines(),
        "Alt-ArrowUp": this.moveUp(),
        "Alt-ArrowDown": this.moveDown()
      };
    }, e;
  })($r)
), mae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "text";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          group: "inline"
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), gae = /^#{1,6}\s/, yae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "heading";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: {
            level: { default: 1 },
            seText: { default: !1 }
          },
          toDOM: function(t) {
            var n = t.attrs, i = n.level, a = n.seText, s = "heading|heading" + i;
            return a && (s += "|delimiter|setext"), ["span", { class: xn.apply(void 0, s.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.createHeadingText = function(t, n, i) {
      for (var a = n.replace(i, "").trim(), s = ""; t > 0; )
        s += "#", t -= 1;
      return s + " " + a;
    }, e.prototype.commands = function() {
      var t = this;
      return function(n) {
        return function(i, a) {
          var s = n.level, u = Sn(i.selection), f = u.startFromOffset, p = u.endToOffset, y = u.startIndex, T = u.endIndex, N = fm({
            state: i,
            from: f,
            startIndex: y,
            endIndex: T,
            createText: function(O) {
              var A = O.match(gae), q = A ? A[0] : "";
              return t.createHeadingText(s, O, q);
            }
          });
          return a(N.setSelection(Jr(N, N.mapping.map(p)))), !0;
        };
      };
    }, e;
  })(Qr)
), Ay = "```", kae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "codeBlock";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("code-block") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, a = t.schema, s = t.tr, u = Sn(i), f = u.startFromOffset, p = u.endToOffset, y = ei(a, Ay);
          return s.insert(f, y).split(f + Ay.length), s.split(s.mapping.map(p)).insert(s.mapping.map(p), y), n(s.setSelection(
            // subtract fenced syntax length and open, close tag(2)
            Jr(s, s.mapping.map(p) - (Ay.length + 2))
          )), !0;
        };
      };
    }, e.prototype.keepIndentation = function() {
      var t = this;
      return function(n, i) {
        var a = n.selection, s = n.tr, u = n.doc, f = n.schema, p = t.context.toastMark, y = Sn(a), T = y.startFromOffset, N = y.endToOffset, O = y.endIndex, A = y.from, q = y.to, U = bl(u, O);
        if (A === q && U.trim()) {
          var j = U.match(/^\s+/), te = p.findFirstNodeAtLine(O + 1);
          if (Vne(te) && j) {
            var se = j[0], me = U.slice(q - T), Ce = ei(f, se + me);
            return mk(s, N, me, Ce), i(s), !0;
          }
        }
        return !1;
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Shift-Mod-p": t,
        "Shift-Mod-P": t,
        Enter: this.keepIndentation()
      };
    }, e;
  })(Qr)
), wae = /\||\s/g;
function bae(r) {
  return [pm(r), pm(r, !0)];
}
function Cae(r, e) {
  for (var t = [], n = 0; n < e; n += 1)
    t.push(pm(r));
  return t;
}
function pm(r, e) {
  for (var t = "|", n = 0; n < r; n += 1)
    t += e ? " --- |" : "  |";
  return t;
}
function Tae(r) {
  return r ? { type: "next", parentType: "tableHead", childType: "firstChild" } : { type: "prev", parentType: "tableBody", childType: "lastChild" };
}
var Sae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "table";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("table") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.extendTable = function() {
      var t = this;
      return function(n, i) {
        var a = n.selection, s = n.doc, u = n.tr, f = n.schema;
        if (!a.empty)
          return !1;
        var p = Sn(a), y = p.endFromOffset, T = p.endToOffset, N = p.endIndex, O = p.to, A = bl(s, N), q = [N + 1, O - y + 1], U = t.context.toastMark.findNodeAtPosition(q), j = cf(U, function(pe) {
          return Nb(pe) && (pe.parent.type === "tableDelimRow" || pe.parent.parent.type === "tableBody");
        });
        if (j) {
          var te = !A.replace(wae, "").trim(), se = j.parent, me = se.parent.parent.columns.length, Ce = pm(me);
          return te ? u.deleteRange(y, T).split(u.mapping.map(T)) : u.split(T).insert(u.mapping.map(T), ei(f, Ce)).setSelection(Jr(u, u.mapping.map(T) - 2)), i(u), !0;
        }
        return !1;
      };
    }, e.prototype.moveTableCell = function(t) {
      var n = this;
      return function(i, a) {
        var s = i.selection, u = i.tr, f = Sn(s), p = f.endFromOffset, y = f.endIndex, T = f.to, N = [y + 1, T - p], O = n.context.toastMark.findNodeAtPosition(N), A = cf(O, function(ke) {
          return Nb(ke);
        });
        if (A) {
          var q = A.parent, U = Tae(t), j = U.type, te = U.parentType, se = U.childType, me = yl(A);
          if (A[j])
            me = yl(A[j]) - 1;
          else {
            var Ce = !q[j] && q.parent.type === te ? q.parent[j][se] : q[j];
            if (j === "next") {
              var pe = Ce ? yl(Ce[se]) : 0;
              me += pe + 2;
            } else j === "prev" && (me = Ce ? -4 : 0);
          }
          return a(u.setSelection(Jr(u, p + me))), !0;
        }
        return !1;
      };
    }, e.prototype.addTable = function() {
      return function(t) {
        return function(n, i) {
          var a = n.selection, s = n.tr, u = n.schema, f = t, p = f.columnCount, y = f.rowCount, T = Sn(a).endToOffset, N = bae(p), O = Cae(p, y - 1), A = Ki(Ki([], N), O);
          return A.forEach(function(q) {
            s.split(s.mapping.map(T)).insert(s.mapping.map(T), ei(u, q));
          }), i(s.setSelection(Jr(s, T + 4))), !0;
        };
      };
    }, e.prototype.commands = function() {
      return { addTable: this.addTable() };
    }, e.prototype.keymaps = function() {
      return {
        Enter: this.extendTable(),
        Tab: this.moveTableCell(!0),
        "Shift-Tab": this.moveTableCell(!1)
      };
    }, e;
  })(Qr)
), xae = "***", Eae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "thematicBreak";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("thematic-break") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.hr = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, a = t.schema, s = t.tr, u = Sn(i), f = u.from, p = u.to, y = u.endToOffset, T = ei(a, xae);
          return s.split(f).replaceWith(s.mapping.map(f), s.mapping.map(p), T).split(s.mapping.map(p)).setSelection(Jr(s, s.mapping.map(y))), n(s), !0;
        };
      };
    }, e.prototype.commands = function() {
      return { hr: this.hr() };
    }, e.prototype.keymaps = function() {
      var t = this.hr()();
      return { "Mod-l": t, "Mod-L": t };
    }, e;
  })(Qr)
);
function Mae(r, e) {
  var t = r.type, n = r.sourcepos, i = n[0][0];
  return e <= i && (t === "codeBlock" || t === "heading" || t.match("table"));
}
var Nae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "listItem";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: {
            odd: { default: !1 },
            even: { default: !1 },
            listStyle: { default: !1 }
          },
          toDOM: function(t) {
            var n = t.attrs, i = n.odd, a = n.even, s = n.listStyle, u = "list-item";
            return s && (u += "|list-item-style"), i && (u += "|list-item-odd"), a && (u += "|list-item-even"), ["span", { class: xn.apply(void 0, u.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.extendList = function() {
      var t = this;
      return function(n, i) {
        var a = n.selection, s = n.doc, u = n.schema, f = n.tr, p = t.context.toastMark, y = Sn(a), T = y.to, N = y.startFromOffset, O = y.endFromOffset, A = y.endIndex, q = y.endToOffset, U = bl(s, A), j = Au.test(U);
        if (!j || a.from === N || !a.empty)
          return !1;
        var te = !U.replace(hm, "").trim();
        if (te)
          f.deleteRange(O, q).split(f.mapping.map(q));
        else {
          var se = xk(U), me = p.findFirstNodeAtLine(A + 1), Ce = U.slice(T - O), pe = { toastMark: p, mdNode: me, doc: s, line: A + 1 }, ke = pae[se](pe), Ne = ke.listSyntax, ze = ke.changedResults;
          if (ze?.length) {
            f.split(T), ze.unshift({ text: Ne + Ce, line: A + 1 }), t.changeToListPerLine(f, ze, {
              from: T,
              // don't subtract 1 because the line has increased through 'split' command.
              startLine: ze[0].line,
              endLine: vi(ze).line
            });
            var Ze = f.mapping.map(q) - Ce.length;
            f.setSelection(Jr(f, Ze));
          } else {
            var At = ei(u, Ne + Ce);
            mk(f, q, Ce, At);
          }
        }
        return i(f), !0;
      };
    }, e.prototype.toList = function(t) {
      var n = this;
      return function() {
        return function(i, a) {
          for (var s = i.doc, u = i.tr, f = i.selection, p = n.context.toastMark, y = Sn(f), T = y.startIndex + 1, N = y.endIndex + 1, O = y.endToOffset, A = [], q = T; q <= N; q += 1) {
            var U = p.findFirstNodeAtLine(q);
            if (U && Mae(U, q))
              break;
            if (A.indexOf(q) === -1) {
              var j = { toastMark: p, mdNode: U, doc: s, line: q, startLine: T }, te = (Nu(U) ? dae[t](j) : hae[t](j)).changedResults, se = n.changeToListPerLine(u, te, {
                from: dm(s, te[0].line - 1).startOffset,
                startLine: te[0].line,
                endLine: vi(te).line,
                indexDiff: 1
              });
              O = Math.max(se, O), te && (A = A.concat(te.map(function(me) {
                return me.line;
              })));
            }
          }
          return a(u.setSelection(Jr(u, u.mapping.map(O)))), !0;
        };
      };
    }, e.prototype.changeToListPerLine = function(t, n, i) {
      for (var a = i.from, s = i.startLine, u = i.endLine, f = i.indexDiff, p = f === void 0 ? 0 : f, y = 0, T = function(A) {
        var q = t.doc.child(A), U = q.nodeSize, j = q.content, te = t.mapping.map(a), se = te + j.size, me = n.filter(function(Ce) {
          return Ce.line - p === A;
        })[0];
        me && (t.replaceWith(te, se, ei(N.context.schema, me.text)), y = Math.max(y, a + j.size)), a += U;
      }, N = this, O = s - p; O <= u - p; O += 1)
        T(O);
      return y;
    }, e.prototype.toggleTask = function() {
      var t = this;
      return function(n, i) {
        for (var a = n.selection, s = n.tr, u = n.doc, f = n.schema, p = t.context.toastMark, y = Sn(a), T = y.startIndex, N = y.endIndex, O = null, A = T; A <= N; A += 1) {
          var q = p.findFirstNodeAtLine(A + 1);
          if (Nu(q) && q.listData.task) {
            var U = q.listData, j = U.checked, te = U.padding, se = j ? " " : "x", me = q.sourcepos[0], Ce = dm(u, me[0] - 1).startOffset;
            Ce += me[1] + te, O = s.replaceWith(Ce, Ce + 1, f.text(se));
          }
        }
        return O ? (i(O), !0) : !1;
      };
    }, e.prototype.commands = function() {
      return {
        bulletList: this.toList("bullet"),
        orderedList: this.toList("ordered"),
        taskList: this.toList("task")
      };
    }, e.prototype.keymaps = function() {
      var t = this.toList("bullet")(), n = this.toList("ordered")(), i = this.toList("task")(), a = this.toggleTask();
      return {
        "Mod-u": t,
        "Mod-U": t,
        "Mod-o": n,
        "Mod-O": n,
        "alt-t": i,
        "alt-T": i,
        "Shift-Ctrl-x": a,
        "Shift-Ctrl-X": a,
        Enter: this.extendList()
      };
    }, e;
  })(Qr)
);
function _m(r, e) {
  return function() {
    return function(t, n) {
      var i = t.tr, a = t.selection, s = Ma(r) ? r : function(se) {
        return r.test(se);
      }, u = e.length, f = i.doc, p = Fx(a), y = p[0], T = p[1], N = Math.max(y - u, 1), O = Math.min(T + u, f.content.size - 1), A = a.content(), q = A.content.textBetween(0, A.content.size, `
`), U = f.textBetween(N, y, `
`), j = f.textBetween(T, O, `
`);
      if (q = "" + U + q + j, U && j && s(q))
        i.delete(O - u, O).delete(N, N + u);
      else {
        i.insertText(e, T).insertText(e, y);
        var te = a.empty ? Jr(i, y + u) : Jr(i, y + u, T + u);
        i.setSelection(te);
      }
      return n(i), !0;
    };
  };
}
var Oae = /^(\*{2}|_{2}).*([\s\S]*)\1$/m, Dae = "**", Aae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "strong";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("strong") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.bold = function() {
      return _m(Oae, Dae);
    }, e.prototype.commands = function() {
      return { bold: this.bold() };
    }, e.prototype.keymaps = function() {
      var t = this.bold()();
      return { "Mod-b": t, "Mod-B": t };
    }, e;
  })(Qr)
), Lae = /^(~{2}).*([\s\S]*)\1$/m, Rae = "~~", Iae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "strike";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("strike") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return _m(Lae, Rae);
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return { "Mod-s": t, "Mod-S": t };
    }, e;
  })(Qr)
), Pae = /^(\*|_).*([\s\S]*)\1$/m, Bae = "*", Fae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "emph";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("emph") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.italic = function() {
      return _m(Pae, Bae);
    }, e.prototype.commands = function() {
      return { italic: this.italic() };
    }, e.prototype.keymaps = function() {
      var t = this.italic()();
      return { "Mod-i": t, "Mod-I": t };
    }, e;
  })(Qr)
), _ae = /^(`).*([\s\S]*)\1$/m, qae = "`", zae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "code";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: {
            start: { default: !1 },
            end: { default: !1 },
            marked: { default: !1 }
          },
          toDOM: function(t) {
            var n = t.attrs, i = n.start, a = n.end, s = n.marked, u = "code";
            return i && (u += "|delimiter|start"), a && (u += "|delimiter|end"), s && (u += "|marked-text"), ["span", { class: xn.apply(void 0, u.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return _m(_ae, qae);
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return { "Shift-Mod-c": t, "Shift-Mod-C": t };
    }, e;
  })(Qr)
), Hae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "link";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: {
            url: { default: !1 },
            desc: { default: !1 }
          },
          toDOM: function(t) {
            var n = t.attrs, i = n.url, a = n.desc, s = "link";
            return i && (s += "|link-url|marked-text"), a && (s += "|link-desc|marked-text"), ["span", { class: xn.apply(void 0, s.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addLinkOrImage = function(t) {
      return function(n) {
        return function(i, a) {
          var s = i.selection, u = i.tr, f = i.schema, p = Fx(s), y = p[0], T = p[1], N = n, O = N.linkText, A = N.altText, q = N.linkUrl, U = N.imageUrl, j = O, te = q, se = "";
          return t === "image" && (j = A, te = U, se = "!"), j = lm(j), se += "[" + j + "](" + te + ")", a(u.replaceWith(y, T, ei(f, se))), !0;
        };
      };
    }, e.prototype.commands = function() {
      return {
        addImage: this.addLinkOrImage("image"),
        addLink: this.addLinkOrImage("link")
      };
    }, e;
  })(Qr)
), Vae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "taskDelimiter";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("delimiter", "list-item") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Qr)
), Uae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "delimiter";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("delimiter") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Qr)
), $ae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "meta";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("meta") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Qr)
), Wae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "markedText";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("marked-text") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Qr)
), jae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "tableCell";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("table-cell") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Qr)
), Gae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "html";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("html") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Qr)
), Ly = "$$", Kae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "customBlock";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          toDOM: function() {
            return ["span", { class: xn("custom-block") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function(t) {
        return function(n, i) {
          var a = n.selection, s = n.schema, u = n.tr, f = Sn(a), p = f.startFromOffset, y = f.endToOffset;
          if (!t?.info)
            return !1;
          var T = "" + Ly + t.info, N = ei(s, T), O = ei(s, Ly);
          return u.insert(p, N).split(p + T.length), u.split(u.mapping.map(y)).insert(u.mapping.map(y), O), i(u.setSelection(Jr(u, u.mapping.map(y) - (Ly.length + 2)))), !0;
        };
      };
    }, e;
  })(Qr)
), Jae = /x|backspace/i, Qae = /^\[(\s*)(x?)(\s*)\](?:\s+)/i;
function Xae(r) {
  var e = r.schema, t = r.toastMark;
  return new Ji({
    props: {
      handleDOMEvents: {
        keyup: function(n, i) {
          var a, s = n.state, u = s.doc, f = s.tr, p = s.selection;
          if (p.empty && Jae.test(i.key)) {
            var y = Sn(p), T = y.startIndex, N = y.startFromOffset, O = y.from, A = [T + 1, O - N + 1], q = t.findNodeAtPosition(A), U = cf(q, function(At) {
              var et;
              return At.type === "paragraph" && ((et = At.parent) === null || et === void 0 ? void 0 : et.type) === "item";
            });
            if (!((a = U?.firstChild) === null || a === void 0) && a.literal) {
              var j = U.firstChild, te = j.literal.match(Qae);
              if (te) {
                var se = j.sourcepos[0], me = te[1], Ce = te[2], pe = te[3], ke = me.length + pe.length, Ne = dm(u, se[0] - 1).startOffset, ze = se[1] + Ne;
                if (Ce) {
                  var Ze = ke ? ke + 1 : 0;
                  f.replaceWith(ze, Ze + ze, e.text(Ce)), n.dispatch(f);
                } else ke || (f.insertText(" ", ze), n.dispatch(f));
              }
            }
          }
          return !1;
        }
      }
    }
  });
}
var Ry = "cut", Hb = /\r\n|\n|\r/, Yae = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t, n) {
      var i = r.call(this, t) || this, a = n.toastMark, s = n.useCommandShortcut, u = s === void 0 ? !0 : s, f = n.mdPlugins, p = f === void 0 ? [] : f;
      return i.editorType = "markdown", i.el.classList.add("md-mode"), i.toastMark = a, i.extraPlugins = p, i.specs = i.createSpecs(), i.schema = i.createSchema(), i.context = i.createContext(), i.keymaps = i.createKeymaps(u), i.view = i.createView(), i.commands = i.createCommands(), i.specs.setContext(_e(_e({}, i.context), { view: i.view })), i.createClipboard(), i.eventEmitter.listen("changePreviewTabWrite", function(y) {
        return i.toggleActive(!0, y);
      }), i.eventEmitter.listen("changePreviewTabPreview", function() {
        return i.toggleActive(!1);
      }), i.initEvent(), i;
    }
    return e.prototype.toggleActive = function(t, n) {
      yk(this.el, "active", t), t ? n || this.focus() : this.blur();
    }, e.prototype.createClipboard = function() {
      var t = this;
      this.clipboard = document.createElement("textarea"), this.clipboard.className = Mt("pseudo-clipboard"), this.clipboard.addEventListener("paste", function(n) {
        var i = n.clipboardData || window.clipboardData, a = i && i.items;
        if (a) {
          var s = qo(a).some(function(f) {
            return f.kind === "string" && f.type === "text/rtf";
          });
          if (!s) {
            var u = Lx(a);
            u && (n.preventDefault(), Ck(t.eventEmitter, u, n.type));
          }
        }
      }), this.clipboard.addEventListener("input", function(n) {
        var i = n.target.value;
        t.replaceSelection(i), n.preventDefault(), n.target.value = "";
      }), this.el.insertBefore(this.clipboard, this.view.dom);
    }, e.prototype.createContext = function() {
      return {
        toastMark: this.toastMark,
        schema: this.schema,
        eventEmitter: this.eventEmitter
      };
    }, e.prototype.createSpecs = function() {
      return new Bx([
        new iae(),
        new vae(),
        new Ix(),
        new mae(),
        new yae(),
        new aae(),
        new kae(),
        new Kae(),
        new Sae(),
        new jae(),
        new Eae(),
        new Nae(),
        new Aae(),
        new Iae(),
        new Fae(),
        new zae(),
        new Hae(),
        new Uae(),
        new Vae(),
        new Wae(),
        new $ae(),
        new Gae()
      ]);
    }, e.prototype.createPlugins = function() {
      return Ki([
        jie(this.context),
        nae(this.context),
        Xae(this.context)
      ], this.createPluginProps()).concat(this.defaultPlugins);
    }, e.prototype.createView = function() {
      var t = this;
      return new Dm(this.el, {
        state: this.createState(),
        dispatchTransaction: function(n) {
          t.updateMarkdown(n);
          var i = t.view.state.applyTransaction(n).state;
          t.view.updateState(i), t.emitChangeEvent(n);
        },
        handleKeyDown: function(n, i) {
          return (i.metaKey || i.ctrlKey) && i.key.toUpperCase() === "V" && t.clipboard.focus(), t.eventEmitter.emit("keydown", t.editorType, i), !1;
        },
        handleDOMEvents: {
          copy: function(n, i) {
            return t.captureCopy(i);
          },
          cut: function(n, i) {
            return t.captureCopy(i, Ry);
          },
          scroll: function() {
            return t.eventEmitter.emit("scroll", "editor"), !0;
          },
          keyup: function(n, i) {
            return t.eventEmitter.emit("keyup", t.editorType, i), !1;
          }
        },
        nodeViews: {
          widget: Rx
        }
      });
    }, e.prototype.createCommands = function() {
      return this.specs.commands(this.view);
    }, e.prototype.captureCopy = function(t, n) {
      t.preventDefault();
      var i = this.view.state, a = i.selection, s = i.tr;
      if (a.empty)
        return !0;
      var u = this.getChanged(a.content());
      return t.clipboardData ? t.clipboardData.setData("text/plain", u) : window.clipboardData.setData("Text", u), n === Ry && this.view.dispatch(s.deleteSelection().scrollIntoView().setMeta("uiEvent", Ry)), !0;
    }, e.prototype.updateMarkdown = function(t) {
      var n = this;
      t.docChanged && t.steps.forEach(function(i, a) {
        if (i.slice && !(i instanceof _n)) {
          var s = t.docs[a], u = [i.from, i.to], f = u[0], p = u[1], y = zv(s, f, p), T = y[0], N = y[1], O = n.getChanged(i.slice);
          T[0] === N[0] && T[1] === N[1] && O === "" && (O = `
`);
          var A = n.toastMark.editMarkdown(T, N, O);
          n.eventEmitter.emit("updatePreview", A), t.setMeta("editResult", A).scrollIntoView();
        }
      });
    }, e.prototype.getChanged = function(t) {
      var n = "", i = 0, a = t.content.size;
      return t.content.nodesBetween(i, a, function(s, u) {
        s.isText ? n += s.text.slice(Math.max(i, u) - u, a - u) : s.isBlock && u > 0 && (n += `
`);
      }), n;
    }, e.prototype.setSelection = function(t, n) {
      n === void 0 && (n = t);
      var i = this.view.state.tr, a = fu(i.doc, t, n), s = a[0], u = a[1];
      this.view.dispatch(i.setSelection(Jr(i, s, u)).scrollIntoView());
    }, e.prototype.replaceSelection = function(t, n, i) {
      var a, s = this.view.state, u = s.tr, f = s.schema, p = s.doc, y = t.split(Hb), T = y.map(function(U) {
        return cm(f, bu(U, f));
      }), N = new ht(Qe.from(T), 1, 1);
      if (this.focus(), n && i) {
        var O = fu(p, n, i), A = O[0], q = O[1];
        a = u.replaceRange(A, q, N);
      } else
        a = u.replaceSelection(N);
      this.view.dispatch(a.scrollIntoView());
    }, e.prototype.deleteSelection = function(t, n) {
      var i, a = this.view.state, s = a.tr, u = a.doc;
      if (t && n) {
        var f = fu(u, t, n), p = f[0], y = f[1];
        i = s.deleteRange(p, y);
      } else
        i = s.deleteSelection();
      this.view.dispatch(i.scrollIntoView());
    }, e.prototype.getSelectedText = function(t, n) {
      var i = this.view.state, a = i.doc, s = i.selection, u = s.from, f = s.to;
      if (t && n) {
        var p = fu(a, t, n);
        u = p[0], f = p[1];
      }
      return a.textBetween(u, f, `
`);
    }, e.prototype.getSelection = function() {
      var t = this.view.state.selection, n = t.from, i = t.to;
      return zv(this.view.state.tr.doc, n, i);
    }, e.prototype.setMarkdown = function(t, n) {
      n === void 0 && (n = !0);
      var i = t.split(Hb), a = this.view.state, s = a.tr, u = a.doc, f = a.schema, p = i.map(function(y) {
        return cm(f, bu(y, f));
      });
      this.view.dispatch(s.replaceWith(0, u.content.size, p)), n && this.moveCursorToEnd(!0);
    }, e.prototype.addWidget = function(t, n, i) {
      var a = this.view.state, s = a.tr, u = a.doc, f = a.selection, p = i ? fu(u, i, i)[0] : f.to;
      this.view.dispatch(s.setMeta("widget", { pos: p, node: t, style: n }));
    }, e.prototype.replaceWithWidget = function(t, n, i) {
      var a = this.view.state, s = a.tr, u = a.schema, f = a.doc, p = fu(f, t, n), y = bu(i, u);
      this.view.dispatch(s.replaceWith(p[0], p[1], y));
    }, e.prototype.getRangeInfoOfNode = function(t) {
      var n = this.view.state, i = n.doc, a = n.selection, s = t || zv(i, a.from)[0], u = this.toastMark.findNodeAtPosition(s);
      return u.type === "text" && u.parent.type !== "paragraph" && (u = u.parent), u.sourcepos[1][1] += 1, { range: u.sourcepos, type: u.type };
    }, e.prototype.getMarkdown = function() {
      return this.toastMark.getLineTexts().map(function(t) {
        return Pm(t);
      }).join(`
`);
    }, e.prototype.getToastMark = function() {
      return this.toastMark;
    }, e;
  })(Px)
), Vb = "_feEventKey";
function Zae(r, e) {
  var t = r[Vb], n;
  return t || (t = r[Vb] = {}), n = t[e], n || (n = t[e] = []), n;
}
var $x = Zae, eoe = Ms, vm = Lm, toe = $x;
function roe(r, e, t) {
  if (eoe(e)) {
    vm(e.split(/\s+/g), function(n) {
      Ub(r, n, t);
    });
    return;
  }
  vm(e, function(n, i) {
    Ub(r, i, n);
  });
}
function Ub(r, e, t) {
  var n = toe(r, e), i;
  t ? (vm(n, function(a, s) {
    return t === a.handler ? ($b(r, e, a.wrappedHandler), i = s, !1) : !0;
  }), n.splice(i, 1)) : (vm(n, function(a) {
    $b(r, e, a.wrappedHandler);
  }), n.splice(0, n.length));
}
function $b(r, e, t) {
  "removeEventListener" in r ? r.removeEventListener(e, t) : "detachEvent" in r && r.detachEvent("on" + e, t);
}
var Wx = roe, noe = Ms, b0 = Lm, ioe = $x;
function aoe(r, e, t, n) {
  if (noe(e)) {
    b0(e.split(/\s+/g), function(i) {
      Wb(r, i, t, n);
    });
    return;
  }
  b0(e, function(i, a) {
    Wb(r, a, i, t);
  });
}
function Wb(r, e, t, n) {
  function i(a) {
    t.call(n || r, a || window.event);
  }
  "addEventListener" in r ? r.addEventListener(e, i) : "attachEvent" in r && r.attachEvent("on" + e, i), ooe(r, e, t, i);
}
function ooe(r, e, t, n) {
  var i = ioe(r, e), a = !1;
  b0(i, function(s) {
    return s.handler === t ? (a = !0, !1) : !0;
  }), a || i.push({
    handler: t,
    wrappedHandler: n
  });
}
var jx = aoe;
var C0 = function(r, e) {
  return C0 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
    t.__proto__ = n;
  } || function(t, n) {
    for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
  }, C0(r, e);
};
function Na(r, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  C0(r, e);
  function t() {
    this.constructor = r;
  }
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
var Xn = function() {
  return Xn = Object.assign || function(e) {
    for (var t, n = 1, i = arguments.length; n < i; n++) {
      t = arguments[n];
      for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
    }
    return e;
  }, Xn.apply(this, arguments);
};
function T0(r, e, t) {
  if (arguments.length === 2) for (var n = 0, i = e.length, a; n < i; n++)
    (a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]);
  return r.concat(a || Array.prototype.slice.call(e));
}
var hf = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, jb = {};
function soe(r) {
  var e, t, n = jb[r];
  if (n)
    return n;
  for (n = jb[r] = [], e = 0; e < 128; e++)
    t = String.fromCharCode(e), /^[0-9a-z]$/i.test(t) ? n.push(t) : n.push("%" + ("0" + e.toString(16).toUpperCase()).slice(-2));
  for (e = 0; e < r.length; e++)
    n[r.charCodeAt(e)] = r[e];
  return n;
}
function qm(r, e, t) {
  var n, i, a, s, u, f = "";
  for (typeof e != "string" && (t = e, e = qm.defaultChars), typeof t > "u" && (t = !0), u = soe(e), n = 0, i = r.length; n < i; n++) {
    if (a = r.charCodeAt(n), t && a === 37 && n + 2 < i && /^[0-9a-f]{2}$/i.test(r.slice(n + 1, n + 3))) {
      f += r.slice(n, n + 3), n += 2;
      continue;
    }
    if (a < 128) {
      f += u[a];
      continue;
    }
    if (a >= 55296 && a <= 57343) {
      if (a >= 55296 && a <= 56319 && n + 1 < i && (s = r.charCodeAt(n + 1), s >= 56320 && s <= 57343)) {
        f += encodeURIComponent(r[n] + r[n + 1]), n++;
        continue;
      }
      f += "%EF%BF%BD";
      continue;
    }
    f += encodeURIComponent(r[n]);
  }
  return f;
}
qm.defaultChars = ";/?:@&=+$,-_.!~*'()#";
qm.componentChars = "-_.!~*'()";
var loe = qm, Mk = {}, xs = {}, uoe = "Á", coe = "á", foe = "Ă", doe = "ă", hoe = "∾", poe = "∿", voe = "∾̳", moe = "Â", goe = "â", yoe = "´", koe = "А", woe = "а", boe = "Æ", Coe = "æ", Toe = "⁡", Soe = "𝔄", xoe = "𝔞", Eoe = "À", Moe = "à", Noe = "ℵ", Ooe = "ℵ", Doe = "Α", Aoe = "α", Loe = "Ā", Roe = "ā", Ioe = "⨿", Poe = "&", Boe = "&", Foe = "⩕", _oe = "⩓", qoe = "∧", zoe = "⩜", Hoe = "⩘", Voe = "⩚", Uoe = "∠", $oe = "⦤", Woe = "∠", joe = "⦨", Goe = "⦩", Koe = "⦪", Joe = "⦫", Qoe = "⦬", Xoe = "⦭", Yoe = "⦮", Zoe = "⦯", ese = "∡", tse = "∟", rse = "⊾", nse = "⦝", ise = "∢", ase = "Å", ose = "⍼", sse = "Ą", lse = "ą", use = "𝔸", cse = "𝕒", fse = "⩯", dse = "≈", hse = "⩰", pse = "≊", vse = "≋", mse = "'", gse = "⁡", yse = "≈", kse = "≊", wse = "Å", bse = "å", Cse = "𝒜", Tse = "𝒶", Sse = "≔", xse = "*", Ese = "≈", Mse = "≍", Nse = "Ã", Ose = "ã", Dse = "Ä", Ase = "ä", Lse = "∳", Rse = "⨑", Ise = "≌", Pse = "϶", Bse = "‵", Fse = "∽", _se = "⋍", qse = "∖", zse = "⫧", Hse = "⊽", Vse = "⌅", Use = "⌆", $se = "⌅", Wse = "⎵", jse = "⎶", Gse = "≌", Kse = "Б", Jse = "б", Qse = "„", Xse = "∵", Yse = "∵", Zse = "∵", ele = "⦰", tle = "϶", rle = "ℬ", nle = "ℬ", ile = "Β", ale = "β", ole = "ℶ", sle = "≬", lle = "𝔅", ule = "𝔟", cle = "⋂", fle = "◯", dle = "⋃", hle = "⨀", ple = "⨁", vle = "⨂", mle = "⨆", gle = "★", yle = "▽", kle = "△", wle = "⨄", ble = "⋁", Cle = "⋀", Tle = "⤍", Sle = "⧫", xle = "▪", Ele = "▴", Mle = "▾", Nle = "◂", Ole = "▸", Dle = "␣", Ale = "▒", Lle = "░", Rle = "▓", Ile = "█", Ple = "=⃥", Ble = "≡⃥", Fle = "⫭", _le = "⌐", qle = "𝔹", zle = "𝕓", Hle = "⊥", Vle = "⊥", Ule = "⋈", $le = "⧉", Wle = "┐", jle = "╕", Gle = "╖", Kle = "╗", Jle = "┌", Qle = "╒", Xle = "╓", Yle = "╔", Zle = "─", eue = "═", tue = "┬", rue = "╤", nue = "╥", iue = "╦", aue = "┴", oue = "╧", sue = "╨", lue = "╩", uue = "⊟", cue = "⊞", fue = "⊠", due = "┘", hue = "╛", pue = "╜", vue = "╝", mue = "└", gue = "╘", yue = "╙", kue = "╚", wue = "│", bue = "║", Cue = "┼", Tue = "╪", Sue = "╫", xue = "╬", Eue = "┤", Mue = "╡", Nue = "╢", Oue = "╣", Due = "├", Aue = "╞", Lue = "╟", Rue = "╠", Iue = "‵", Pue = "˘", Bue = "˘", Fue = "¦", _ue = "𝒷", que = "ℬ", zue = "⁏", Hue = "∽", Vue = "⋍", Uue = "⧅", $ue = "\\", Wue = "⟈", jue = "•", Gue = "•", Kue = "≎", Jue = "⪮", Que = "≏", Xue = "≎", Yue = "≏", Zue = "Ć", ece = "ć", tce = "⩄", rce = "⩉", nce = "⩋", ice = "∩", ace = "⋒", oce = "⩇", sce = "⩀", lce = "ⅅ", uce = "∩︀", cce = "⁁", fce = "ˇ", dce = "ℭ", hce = "⩍", pce = "Č", vce = "č", mce = "Ç", gce = "ç", yce = "Ĉ", kce = "ĉ", wce = "∰", bce = "⩌", Cce = "⩐", Tce = "Ċ", Sce = "ċ", xce = "¸", Ece = "¸", Mce = "⦲", Nce = "¢", Oce = "·", Dce = "·", Ace = "𝔠", Lce = "ℭ", Rce = "Ч", Ice = "ч", Pce = "✓", Bce = "✓", Fce = "Χ", _ce = "χ", qce = "ˆ", zce = "≗", Hce = "↺", Vce = "↻", Uce = "⊛", $ce = "⊚", Wce = "⊝", jce = "⊙", Gce = "®", Kce = "Ⓢ", Jce = "⊖", Qce = "⊕", Xce = "⊗", Yce = "○", Zce = "⧃", efe = "≗", tfe = "⨐", rfe = "⫯", nfe = "⧂", ife = "∲", afe = "”", ofe = "’", sfe = "♣", lfe = "♣", ufe = ":", cfe = "∷", ffe = "⩴", dfe = "≔", hfe = "≔", pfe = ",", vfe = "@", mfe = "∁", gfe = "∘", yfe = "∁", kfe = "ℂ", wfe = "≅", bfe = "⩭", Cfe = "≡", Tfe = "∮", Sfe = "∯", xfe = "∮", Efe = "𝕔", Mfe = "ℂ", Nfe = "∐", Ofe = "∐", Dfe = "©", Afe = "©", Lfe = "℗", Rfe = "∳", Ife = "↵", Pfe = "✗", Bfe = "⨯", Ffe = "𝒞", _fe = "𝒸", qfe = "⫏", zfe = "⫑", Hfe = "⫐", Vfe = "⫒", Ufe = "⋯", $fe = "⤸", Wfe = "⤵", jfe = "⋞", Gfe = "⋟", Kfe = "↶", Jfe = "⤽", Qfe = "⩈", Xfe = "⩆", Yfe = "≍", Zfe = "∪", ede = "⋓", tde = "⩊", rde = "⊍", nde = "⩅", ide = "∪︀", ade = "↷", ode = "⤼", sde = "⋞", lde = "⋟", ude = "⋎", cde = "⋏", fde = "¤", dde = "↶", hde = "↷", pde = "⋎", vde = "⋏", mde = "∲", gde = "∱", yde = "⌭", kde = "†", wde = "‡", bde = "ℸ", Cde = "↓", Tde = "↡", Sde = "⇓", xde = "‐", Ede = "⫤", Mde = "⊣", Nde = "⤏", Ode = "˝", Dde = "Ď", Ade = "ď", Lde = "Д", Rde = "д", Ide = "‡", Pde = "⇊", Bde = "ⅅ", Fde = "ⅆ", _de = "⤑", qde = "⩷", zde = "°", Hde = "∇", Vde = "Δ", Ude = "δ", $de = "⦱", Wde = "⥿", jde = "𝔇", Gde = "𝔡", Kde = "⥥", Jde = "⇃", Qde = "⇂", Xde = "´", Yde = "˙", Zde = "˝", ehe = "`", the = "˜", rhe = "⋄", nhe = "⋄", ihe = "⋄", ahe = "♦", ohe = "♦", she = "¨", lhe = "ⅆ", uhe = "ϝ", che = "⋲", fhe = "÷", dhe = "÷", hhe = "⋇", phe = "⋇", vhe = "Ђ", mhe = "ђ", ghe = "⌞", yhe = "⌍", khe = "$", whe = "𝔻", bhe = "𝕕", Che = "¨", The = "˙", She = "⃜", xhe = "≐", Ehe = "≑", Mhe = "≐", Nhe = "∸", Ohe = "∔", Dhe = "⊡", Ahe = "⌆", Lhe = "∯", Rhe = "¨", Ihe = "⇓", Phe = "⇐", Bhe = "⇔", Fhe = "⫤", _he = "⟸", qhe = "⟺", zhe = "⟹", Hhe = "⇒", Vhe = "⊨", Uhe = "⇑", $he = "⇕", Whe = "∥", jhe = "⤓", Ghe = "↓", Khe = "↓", Jhe = "⇓", Qhe = "⇵", Xhe = "̑", Yhe = "⇊", Zhe = "⇃", epe = "⇂", tpe = "⥐", rpe = "⥞", npe = "⥖", ipe = "↽", ape = "⥟", ope = "⥗", spe = "⇁", lpe = "↧", upe = "⊤", cpe = "⤐", fpe = "⌟", dpe = "⌌", hpe = "𝒟", ppe = "𝒹", vpe = "Ѕ", mpe = "ѕ", gpe = "⧶", ype = "Đ", kpe = "đ", wpe = "⋱", bpe = "▿", Cpe = "▾", Tpe = "⇵", Spe = "⥯", xpe = "⦦", Epe = "Џ", Mpe = "џ", Npe = "⟿", Ope = "É", Dpe = "é", Ape = "⩮", Lpe = "Ě", Rpe = "ě", Ipe = "Ê", Ppe = "ê", Bpe = "≖", Fpe = "≕", _pe = "Э", qpe = "э", zpe = "⩷", Hpe = "Ė", Vpe = "ė", Upe = "≑", $pe = "ⅇ", Wpe = "≒", jpe = "𝔈", Gpe = "𝔢", Kpe = "⪚", Jpe = "È", Qpe = "è", Xpe = "⪖", Ype = "⪘", Zpe = "⪙", eve = "∈", tve = "⏧", rve = "ℓ", nve = "⪕", ive = "⪗", ave = "Ē", ove = "ē", sve = "∅", lve = "∅", uve = "◻", cve = "∅", fve = "▫", dve = " ", hve = " ", pve = " ", vve = "Ŋ", mve = "ŋ", gve = " ", yve = "Ę", kve = "ę", wve = "𝔼", bve = "𝕖", Cve = "⋕", Tve = "⧣", Sve = "⩱", xve = "ε", Eve = "Ε", Mve = "ε", Nve = "ϵ", Ove = "≖", Dve = "≕", Ave = "≂", Lve = "⪖", Rve = "⪕", Ive = "⩵", Pve = "=", Bve = "≂", Fve = "≟", _ve = "⇌", qve = "≡", zve = "⩸", Hve = "⧥", Vve = "⥱", Uve = "≓", $ve = "ℯ", Wve = "ℰ", jve = "≐", Gve = "⩳", Kve = "≂", Jve = "Η", Qve = "η", Xve = "Ð", Yve = "ð", Zve = "Ë", eme = "ë", tme = "€", rme = "!", nme = "∃", ime = "∃", ame = "ℰ", ome = "ⅇ", sme = "ⅇ", lme = "≒", ume = "Ф", cme = "ф", fme = "♀", dme = "ﬃ", hme = "ﬀ", pme = "ﬄ", vme = "𝔉", mme = "𝔣", gme = "ﬁ", yme = "◼", kme = "▪", wme = "fj", bme = "♭", Cme = "ﬂ", Tme = "▱", Sme = "ƒ", xme = "𝔽", Eme = "𝕗", Mme = "∀", Nme = "∀", Ome = "⋔", Dme = "⫙", Ame = "ℱ", Lme = "⨍", Rme = "½", Ime = "⅓", Pme = "¼", Bme = "⅕", Fme = "⅙", _me = "⅛", qme = "⅔", zme = "⅖", Hme = "¾", Vme = "⅗", Ume = "⅜", $me = "⅘", Wme = "⅚", jme = "⅝", Gme = "⅞", Kme = "⁄", Jme = "⌢", Qme = "𝒻", Xme = "ℱ", Yme = "ǵ", Zme = "Γ", ege = "γ", tge = "Ϝ", rge = "ϝ", nge = "⪆", ige = "Ğ", age = "ğ", oge = "Ģ", sge = "Ĝ", lge = "ĝ", uge = "Г", cge = "г", fge = "Ġ", dge = "ġ", hge = "≥", pge = "≧", vge = "⪌", mge = "⋛", gge = "≥", yge = "≧", kge = "⩾", wge = "⪩", bge = "⩾", Cge = "⪀", Tge = "⪂", Sge = "⪄", xge = "⋛︀", Ege = "⪔", Mge = "𝔊", Nge = "𝔤", Oge = "≫", Dge = "⋙", Age = "⋙", Lge = "ℷ", Rge = "Ѓ", Ige = "ѓ", Pge = "⪥", Bge = "≷", Fge = "⪒", _ge = "⪤", qge = "⪊", zge = "⪊", Hge = "⪈", Vge = "≩", Uge = "⪈", $ge = "≩", Wge = "⋧", jge = "𝔾", Gge = "𝕘", Kge = "`", Jge = "≥", Qge = "⋛", Xge = "≧", Yge = "⪢", Zge = "≷", eye = "⩾", tye = "≳", rye = "𝒢", nye = "ℊ", iye = "≳", aye = "⪎", oye = "⪐", sye = "⪧", lye = "⩺", uye = ">", cye = ">", fye = "≫", dye = "⋗", hye = "⦕", pye = "⩼", vye = "⪆", mye = "⥸", gye = "⋗", yye = "⋛", kye = "⪌", wye = "≷", bye = "≳", Cye = "≩︀", Tye = "≩︀", Sye = "ˇ", xye = " ", Eye = "½", Mye = "ℋ", Nye = "Ъ", Oye = "ъ", Dye = "⥈", Aye = "↔", Lye = "⇔", Rye = "↭", Iye = "^", Pye = "ℏ", Bye = "Ĥ", Fye = "ĥ", _ye = "♥", qye = "♥", zye = "…", Hye = "⊹", Vye = "𝔥", Uye = "ℌ", $ye = "ℋ", Wye = "⤥", jye = "⤦", Gye = "⇿", Kye = "∻", Jye = "↩", Qye = "↪", Xye = "𝕙", Yye = "ℍ", Zye = "―", e0e = "─", t0e = "𝒽", r0e = "ℋ", n0e = "ℏ", i0e = "Ħ", a0e = "ħ", o0e = "≎", s0e = "≏", l0e = "⁃", u0e = "‐", c0e = "Í", f0e = "í", d0e = "⁣", h0e = "Î", p0e = "î", v0e = "И", m0e = "и", g0e = "İ", y0e = "Е", k0e = "е", w0e = "¡", b0e = "⇔", C0e = "𝔦", T0e = "ℑ", S0e = "Ì", x0e = "ì", E0e = "ⅈ", M0e = "⨌", N0e = "∭", O0e = "⧜", D0e = "℩", A0e = "Ĳ", L0e = "ĳ", R0e = "Ī", I0e = "ī", P0e = "ℑ", B0e = "ⅈ", F0e = "ℐ", _0e = "ℑ", q0e = "ı", z0e = "ℑ", H0e = "⊷", V0e = "Ƶ", U0e = "⇒", $0e = "℅", W0e = "∞", j0e = "⧝", G0e = "ı", K0e = "⊺", J0e = "∫", Q0e = "∬", X0e = "ℤ", Y0e = "∫", Z0e = "⊺", eke = "⋂", tke = "⨗", rke = "⨼", nke = "⁣", ike = "⁢", ake = "Ё", oke = "ё", ske = "Į", lke = "į", uke = "𝕀", cke = "𝕚", fke = "Ι", dke = "ι", hke = "⨼", pke = "¿", vke = "𝒾", mke = "ℐ", gke = "∈", yke = "⋵", kke = "⋹", wke = "⋴", bke = "⋳", Cke = "∈", Tke = "⁢", Ske = "Ĩ", xke = "ĩ", Eke = "І", Mke = "і", Nke = "Ï", Oke = "ï", Dke = "Ĵ", Ake = "ĵ", Lke = "Й", Rke = "й", Ike = "𝔍", Pke = "𝔧", Bke = "ȷ", Fke = "𝕁", _ke = "𝕛", qke = "𝒥", zke = "𝒿", Hke = "Ј", Vke = "ј", Uke = "Є", $ke = "є", Wke = "Κ", jke = "κ", Gke = "ϰ", Kke = "Ķ", Jke = "ķ", Qke = "К", Xke = "к", Yke = "𝔎", Zke = "𝔨", ewe = "ĸ", twe = "Х", rwe = "х", nwe = "Ќ", iwe = "ќ", awe = "𝕂", owe = "𝕜", swe = "𝒦", lwe = "𝓀", uwe = "⇚", cwe = "Ĺ", fwe = "ĺ", dwe = "⦴", hwe = "ℒ", pwe = "Λ", vwe = "λ", mwe = "⟨", gwe = "⟪", ywe = "⦑", kwe = "⟨", wwe = "⪅", bwe = "ℒ", Cwe = "«", Twe = "⇤", Swe = "⤟", xwe = "←", Ewe = "↞", Mwe = "⇐", Nwe = "⤝", Owe = "↩", Dwe = "↫", Awe = "⤹", Lwe = "⥳", Rwe = "↢", Iwe = "⤙", Pwe = "⤛", Bwe = "⪫", Fwe = "⪭", _we = "⪭︀", qwe = "⤌", zwe = "⤎", Hwe = "❲", Vwe = "{", Uwe = "[", $we = "⦋", Wwe = "⦏", jwe = "⦍", Gwe = "Ľ", Kwe = "ľ", Jwe = "Ļ", Qwe = "ļ", Xwe = "⌈", Ywe = "{", Zwe = "Л", e1e = "л", t1e = "⤶", r1e = "“", n1e = "„", i1e = "⥧", a1e = "⥋", o1e = "↲", s1e = "≤", l1e = "≦", u1e = "⟨", c1e = "⇤", f1e = "←", d1e = "←", h1e = "⇐", p1e = "⇆", v1e = "↢", m1e = "⌈", g1e = "⟦", y1e = "⥡", k1e = "⥙", w1e = "⇃", b1e = "⌊", C1e = "↽", T1e = "↼", S1e = "⇇", x1e = "↔", E1e = "↔", M1e = "⇔", N1e = "⇆", O1e = "⇋", D1e = "↭", A1e = "⥎", L1e = "↤", R1e = "⊣", I1e = "⥚", P1e = "⋋", B1e = "⧏", F1e = "⊲", _1e = "⊴", q1e = "⥑", z1e = "⥠", H1e = "⥘", V1e = "↿", U1e = "⥒", $1e = "↼", W1e = "⪋", j1e = "⋚", G1e = "≤", K1e = "≦", J1e = "⩽", Q1e = "⪨", X1e = "⩽", Y1e = "⩿", Z1e = "⪁", ebe = "⪃", tbe = "⋚︀", rbe = "⪓", nbe = "⪅", ibe = "⋖", abe = "⋚", obe = "⪋", sbe = "⋚", lbe = "≦", ube = "≶", cbe = "≶", fbe = "⪡", dbe = "≲", hbe = "⩽", pbe = "≲", vbe = "⥼", mbe = "⌊", gbe = "𝔏", ybe = "𝔩", kbe = "≶", wbe = "⪑", bbe = "⥢", Cbe = "↽", Tbe = "↼", Sbe = "⥪", xbe = "▄", Ebe = "Љ", Mbe = "љ", Nbe = "⇇", Obe = "≪", Dbe = "⋘", Abe = "⌞", Lbe = "⇚", Rbe = "⥫", Ibe = "◺", Pbe = "Ŀ", Bbe = "ŀ", Fbe = "⎰", _be = "⎰", qbe = "⪉", zbe = "⪉", Hbe = "⪇", Vbe = "≨", Ube = "⪇", $be = "≨", Wbe = "⋦", jbe = "⟬", Gbe = "⇽", Kbe = "⟦", Jbe = "⟵", Qbe = "⟵", Xbe = "⟸", Ybe = "⟷", Zbe = "⟷", eCe = "⟺", tCe = "⟼", rCe = "⟶", nCe = "⟶", iCe = "⟹", aCe = "↫", oCe = "↬", sCe = "⦅", lCe = "𝕃", uCe = "𝕝", cCe = "⨭", fCe = "⨴", dCe = "∗", hCe = "_", pCe = "↙", vCe = "↘", mCe = "◊", gCe = "◊", yCe = "⧫", kCe = "(", wCe = "⦓", bCe = "⇆", CCe = "⌟", TCe = "⇋", SCe = "⥭", xCe = "‎", ECe = "⊿", MCe = "‹", NCe = "𝓁", OCe = "ℒ", DCe = "↰", ACe = "↰", LCe = "≲", RCe = "⪍", ICe = "⪏", PCe = "[", BCe = "‘", FCe = "‚", _Ce = "Ł", qCe = "ł", zCe = "⪦", HCe = "⩹", VCe = "<", UCe = "<", $Ce = "≪", WCe = "⋖", jCe = "⋋", GCe = "⋉", KCe = "⥶", JCe = "⩻", QCe = "◃", XCe = "⊴", YCe = "◂", ZCe = "⦖", eTe = "⥊", tTe = "⥦", rTe = "≨︀", nTe = "≨︀", iTe = "¯", aTe = "♂", oTe = "✠", sTe = "✠", lTe = "↦", uTe = "↦", cTe = "↧", fTe = "↤", dTe = "↥", hTe = "▮", pTe = "⨩", vTe = "М", mTe = "м", gTe = "—", yTe = "∺", kTe = "∡", wTe = " ", bTe = "ℳ", CTe = "𝔐", TTe = "𝔪", STe = "℧", xTe = "µ", ETe = "*", MTe = "⫰", NTe = "∣", OTe = "·", DTe = "⊟", ATe = "−", LTe = "∸", RTe = "⨪", ITe = "∓", PTe = "⫛", BTe = "…", FTe = "∓", _Te = "⊧", qTe = "𝕄", zTe = "𝕞", HTe = "∓", VTe = "𝓂", UTe = "ℳ", $Te = "∾", WTe = "Μ", jTe = "μ", GTe = "⊸", KTe = "⊸", JTe = "∇", QTe = "Ń", XTe = "ń", YTe = "∠⃒", ZTe = "≉", eSe = "⩰̸", tSe = "≋̸", rSe = "ŉ", nSe = "≉", iSe = "♮", aSe = "ℕ", oSe = "♮", sSe = " ", lSe = "≎̸", uSe = "≏̸", cSe = "⩃", fSe = "Ň", dSe = "ň", hSe = "Ņ", pSe = "ņ", vSe = "≇", mSe = "⩭̸", gSe = "⩂", ySe = "Н", kSe = "н", wSe = "–", bSe = "⤤", CSe = "↗", TSe = "⇗", SSe = "↗", xSe = "≠", ESe = "≐̸", MSe = "​", NSe = "​", OSe = "​", DSe = "​", ASe = "≢", LSe = "⤨", RSe = "≂̸", ISe = "≫", PSe = "≪", BSe = `
`, FSe = "∄", _Se = "∄", qSe = "𝔑", zSe = "𝔫", HSe = "≧̸", VSe = "≱", USe = "≱", $Se = "≧̸", WSe = "⩾̸", jSe = "⩾̸", GSe = "⋙̸", KSe = "≵", JSe = "≫⃒", QSe = "≯", XSe = "≯", YSe = "≫̸", ZSe = "↮", exe = "⇎", txe = "⫲", rxe = "∋", nxe = "⋼", ixe = "⋺", axe = "∋", oxe = "Њ", sxe = "њ", lxe = "↚", uxe = "⇍", cxe = "‥", fxe = "≦̸", dxe = "≰", hxe = "↚", pxe = "⇍", vxe = "↮", mxe = "⇎", gxe = "≰", yxe = "≦̸", kxe = "⩽̸", wxe = "⩽̸", bxe = "≮", Cxe = "⋘̸", Txe = "≴", Sxe = "≪⃒", xxe = "≮", Exe = "⋪", Mxe = "⋬", Nxe = "≪̸", Oxe = "∤", Dxe = "⁠", Axe = " ", Lxe = "𝕟", Rxe = "ℕ", Ixe = "⫬", Pxe = "¬", Bxe = "≢", Fxe = "≭", _xe = "∦", qxe = "∉", zxe = "≠", Hxe = "≂̸", Vxe = "∄", Uxe = "≯", $xe = "≱", Wxe = "≧̸", jxe = "≫̸", Gxe = "≹", Kxe = "⩾̸", Jxe = "≵", Qxe = "≎̸", Xxe = "≏̸", Yxe = "∉", Zxe = "⋵̸", eEe = "⋹̸", tEe = "∉", rEe = "⋷", nEe = "⋶", iEe = "⧏̸", aEe = "⋪", oEe = "⋬", sEe = "≮", lEe = "≰", uEe = "≸", cEe = "≪̸", fEe = "⩽̸", dEe = "≴", hEe = "⪢̸", pEe = "⪡̸", vEe = "∌", mEe = "∌", gEe = "⋾", yEe = "⋽", kEe = "⊀", wEe = "⪯̸", bEe = "⋠", CEe = "∌", TEe = "⧐̸", SEe = "⋫", xEe = "⋭", EEe = "⊏̸", MEe = "⋢", NEe = "⊐̸", OEe = "⋣", DEe = "⊂⃒", AEe = "⊈", LEe = "⊁", REe = "⪰̸", IEe = "⋡", PEe = "≿̸", BEe = "⊃⃒", FEe = "⊉", _Ee = "≁", qEe = "≄", zEe = "≇", HEe = "≉", VEe = "∤", UEe = "∦", $Ee = "∦", WEe = "⫽⃥", jEe = "∂̸", GEe = "⨔", KEe = "⊀", JEe = "⋠", QEe = "⊀", XEe = "⪯̸", YEe = "⪯̸", ZEe = "⤳̸", eMe = "↛", tMe = "⇏", rMe = "↝̸", nMe = "↛", iMe = "⇏", aMe = "⋫", oMe = "⋭", sMe = "⊁", lMe = "⋡", uMe = "⪰̸", cMe = "𝒩", fMe = "𝓃", dMe = "∤", hMe = "∦", pMe = "≁", vMe = "≄", mMe = "≄", gMe = "∤", yMe = "∦", kMe = "⋢", wMe = "⋣", bMe = "⊄", CMe = "⫅̸", TMe = "⊈", SMe = "⊂⃒", xMe = "⊈", EMe = "⫅̸", MMe = "⊁", NMe = "⪰̸", OMe = "⊅", DMe = "⫆̸", AMe = "⊉", LMe = "⊃⃒", RMe = "⊉", IMe = "⫆̸", PMe = "≹", BMe = "Ñ", FMe = "ñ", _Me = "≸", qMe = "⋪", zMe = "⋬", HMe = "⋫", VMe = "⋭", UMe = "Ν", $Me = "ν", WMe = "#", jMe = "№", GMe = " ", KMe = "≍⃒", JMe = "⊬", QMe = "⊭", XMe = "⊮", YMe = "⊯", ZMe = "≥⃒", eNe = ">⃒", tNe = "⤄", rNe = "⧞", nNe = "⤂", iNe = "≤⃒", aNe = "<⃒", oNe = "⊴⃒", sNe = "⤃", lNe = "⊵⃒", uNe = "∼⃒", cNe = "⤣", fNe = "↖", dNe = "⇖", hNe = "↖", pNe = "⤧", vNe = "Ó", mNe = "ó", gNe = "⊛", yNe = "Ô", kNe = "ô", wNe = "⊚", bNe = "О", CNe = "о", TNe = "⊝", SNe = "Ő", xNe = "ő", ENe = "⨸", MNe = "⊙", NNe = "⦼", ONe = "Œ", DNe = "œ", ANe = "⦿", LNe = "𝔒", RNe = "𝔬", INe = "˛", PNe = "Ò", BNe = "ò", FNe = "⧁", _Ne = "⦵", qNe = "Ω", zNe = "∮", HNe = "↺", VNe = "⦾", UNe = "⦻", $Ne = "‾", WNe = "⧀", jNe = "Ō", GNe = "ō", KNe = "Ω", JNe = "ω", QNe = "Ο", XNe = "ο", YNe = "⦶", ZNe = "⊖", eOe = "𝕆", tOe = "𝕠", rOe = "⦷", nOe = "“", iOe = "‘", aOe = "⦹", oOe = "⊕", sOe = "↻", lOe = "⩔", uOe = "∨", cOe = "⩝", fOe = "ℴ", dOe = "ℴ", hOe = "ª", pOe = "º", vOe = "⊶", mOe = "⩖", gOe = "⩗", yOe = "⩛", kOe = "Ⓢ", wOe = "𝒪", bOe = "ℴ", COe = "Ø", TOe = "ø", SOe = "⊘", xOe = "Õ", EOe = "õ", MOe = "⨶", NOe = "⨷", OOe = "⊗", DOe = "Ö", AOe = "ö", LOe = "⌽", ROe = "‾", IOe = "⏞", POe = "⎴", BOe = "⏜", FOe = "¶", _Oe = "∥", qOe = "∥", zOe = "⫳", HOe = "⫽", VOe = "∂", UOe = "∂", $Oe = "П", WOe = "п", jOe = "%", GOe = ".", KOe = "‰", JOe = "⊥", QOe = "‱", XOe = "𝔓", YOe = "𝔭", ZOe = "Φ", eDe = "φ", tDe = "ϕ", rDe = "ℳ", nDe = "☎", iDe = "Π", aDe = "π", oDe = "⋔", sDe = "ϖ", lDe = "ℏ", uDe = "ℎ", cDe = "ℏ", fDe = "⨣", dDe = "⊞", hDe = "⨢", pDe = "+", vDe = "∔", mDe = "⨥", gDe = "⩲", yDe = "±", kDe = "±", wDe = "⨦", bDe = "⨧", CDe = "±", TDe = "ℌ", SDe = "⨕", xDe = "𝕡", EDe = "ℙ", MDe = "£", NDe = "⪷", ODe = "⪻", DDe = "≺", ADe = "≼", LDe = "⪷", RDe = "≺", IDe = "≼", PDe = "≺", BDe = "⪯", FDe = "≼", _De = "≾", qDe = "⪯", zDe = "⪹", HDe = "⪵", VDe = "⋨", UDe = "⪯", $De = "⪳", WDe = "≾", jDe = "′", GDe = "″", KDe = "ℙ", JDe = "⪹", QDe = "⪵", XDe = "⋨", YDe = "∏", ZDe = "∏", eAe = "⌮", tAe = "⌒", rAe = "⌓", nAe = "∝", iAe = "∝", aAe = "∷", oAe = "∝", sAe = "≾", lAe = "⊰", uAe = "𝒫", cAe = "𝓅", fAe = "Ψ", dAe = "ψ", hAe = " ", pAe = "𝔔", vAe = "𝔮", mAe = "⨌", gAe = "𝕢", yAe = "ℚ", kAe = "⁗", wAe = "𝒬", bAe = "𝓆", CAe = "ℍ", TAe = "⨖", SAe = "?", xAe = "≟", EAe = '"', MAe = '"', NAe = "⇛", OAe = "∽̱", DAe = "Ŕ", AAe = "ŕ", LAe = "√", RAe = "⦳", IAe = "⟩", PAe = "⟫", BAe = "⦒", FAe = "⦥", _Ae = "⟩", qAe = "»", zAe = "⥵", HAe = "⇥", VAe = "⤠", UAe = "⤳", $Ae = "→", WAe = "↠", jAe = "⇒", GAe = "⤞", KAe = "↪", JAe = "↬", QAe = "⥅", XAe = "⥴", YAe = "⤖", ZAe = "↣", eLe = "↝", tLe = "⤚", rLe = "⤜", nLe = "∶", iLe = "ℚ", aLe = "⤍", oLe = "⤏", sLe = "⤐", lLe = "❳", uLe = "}", cLe = "]", fLe = "⦌", dLe = "⦎", hLe = "⦐", pLe = "Ř", vLe = "ř", mLe = "Ŗ", gLe = "ŗ", yLe = "⌉", kLe = "}", wLe = "Р", bLe = "р", CLe = "⤷", TLe = "⥩", SLe = "”", xLe = "”", ELe = "↳", MLe = "ℜ", NLe = "ℛ", OLe = "ℜ", DLe = "ℝ", ALe = "ℜ", LLe = "▭", RLe = "®", ILe = "®", PLe = "∋", BLe = "⇋", FLe = "⥯", _Le = "⥽", qLe = "⌋", zLe = "𝔯", HLe = "ℜ", VLe = "⥤", ULe = "⇁", $Le = "⇀", WLe = "⥬", jLe = "Ρ", GLe = "ρ", KLe = "ϱ", JLe = "⟩", QLe = "⇥", XLe = "→", YLe = "→", ZLe = "⇒", eRe = "⇄", tRe = "↣", rRe = "⌉", nRe = "⟧", iRe = "⥝", aRe = "⥕", oRe = "⇂", sRe = "⌋", lRe = "⇁", uRe = "⇀", cRe = "⇄", fRe = "⇌", dRe = "⇉", hRe = "↝", pRe = "↦", vRe = "⊢", mRe = "⥛", gRe = "⋌", yRe = "⧐", kRe = "⊳", wRe = "⊵", bRe = "⥏", CRe = "⥜", TRe = "⥔", SRe = "↾", xRe = "⥓", ERe = "⇀", MRe = "˚", NRe = "≓", ORe = "⇄", DRe = "⇌", ARe = "‏", LRe = "⎱", RRe = "⎱", IRe = "⫮", PRe = "⟭", BRe = "⇾", FRe = "⟧", _Re = "⦆", qRe = "𝕣", zRe = "ℝ", HRe = "⨮", VRe = "⨵", URe = "⥰", $Re = ")", WRe = "⦔", jRe = "⨒", GRe = "⇉", KRe = "⇛", JRe = "›", QRe = "𝓇", XRe = "ℛ", YRe = "↱", ZRe = "↱", eIe = "]", tIe = "’", rIe = "’", nIe = "⋌", iIe = "⋊", aIe = "▹", oIe = "⊵", sIe = "▸", lIe = "⧎", uIe = "⧴", cIe = "⥨", fIe = "℞", dIe = "Ś", hIe = "ś", pIe = "‚", vIe = "⪸", mIe = "Š", gIe = "š", yIe = "⪼", kIe = "≻", wIe = "≽", bIe = "⪰", CIe = "⪴", TIe = "Ş", SIe = "ş", xIe = "Ŝ", EIe = "ŝ", MIe = "⪺", NIe = "⪶", OIe = "⋩", DIe = "⨓", AIe = "≿", LIe = "С", RIe = "с", IIe = "⊡", PIe = "⋅", BIe = "⩦", FIe = "⤥", _Ie = "↘", qIe = "⇘", zIe = "↘", HIe = "§", VIe = ";", UIe = "⤩", $Ie = "∖", WIe = "∖", jIe = "✶", GIe = "𝔖", KIe = "𝔰", JIe = "⌢", QIe = "♯", XIe = "Щ", YIe = "щ", ZIe = "Ш", ePe = "ш", tPe = "↓", rPe = "←", nPe = "∣", iPe = "∥", aPe = "→", oPe = "↑", sPe = "­", lPe = "Σ", uPe = "σ", cPe = "ς", fPe = "ς", dPe = "∼", hPe = "⩪", pPe = "≃", vPe = "≃", mPe = "⪞", gPe = "⪠", yPe = "⪝", kPe = "⪟", wPe = "≆", bPe = "⨤", CPe = "⥲", TPe = "←", SPe = "∘", xPe = "∖", EPe = "⨳", MPe = "⧤", NPe = "∣", OPe = "⌣", DPe = "⪪", APe = "⪬", LPe = "⪬︀", RPe = "Ь", IPe = "ь", PPe = "⌿", BPe = "⧄", FPe = "/", _Pe = "𝕊", qPe = "𝕤", zPe = "♠", HPe = "♠", VPe = "∥", UPe = "⊓", $Pe = "⊓︀", WPe = "⊔", jPe = "⊔︀", GPe = "√", KPe = "⊏", JPe = "⊑", QPe = "⊏", XPe = "⊑", YPe = "⊐", ZPe = "⊒", eBe = "⊐", tBe = "⊒", rBe = "□", nBe = "□", iBe = "⊓", aBe = "⊏", oBe = "⊑", sBe = "⊐", lBe = "⊒", uBe = "⊔", cBe = "▪", fBe = "□", dBe = "▪", hBe = "→", pBe = "𝒮", vBe = "𝓈", mBe = "∖", gBe = "⌣", yBe = "⋆", kBe = "⋆", wBe = "☆", bBe = "★", CBe = "ϵ", TBe = "ϕ", SBe = "¯", xBe = "⊂", EBe = "⋐", MBe = "⪽", NBe = "⫅", OBe = "⊆", DBe = "⫃", ABe = "⫁", LBe = "⫋", RBe = "⊊", IBe = "⪿", PBe = "⥹", BBe = "⊂", FBe = "⋐", _Be = "⊆", qBe = "⫅", zBe = "⊆", HBe = "⊊", VBe = "⫋", UBe = "⫇", $Be = "⫕", WBe = "⫓", jBe = "⪸", GBe = "≻", KBe = "≽", JBe = "≻", QBe = "⪰", XBe = "≽", YBe = "≿", ZBe = "⪰", eFe = "⪺", tFe = "⪶", rFe = "⋩", nFe = "≿", iFe = "∋", aFe = "∑", oFe = "∑", sFe = "♪", lFe = "¹", uFe = "²", cFe = "³", fFe = "⊃", dFe = "⋑", hFe = "⪾", pFe = "⫘", vFe = "⫆", mFe = "⊇", gFe = "⫄", yFe = "⊃", kFe = "⊇", wFe = "⟉", bFe = "⫗", CFe = "⥻", TFe = "⫂", SFe = "⫌", xFe = "⊋", EFe = "⫀", MFe = "⊃", NFe = "⋑", OFe = "⊇", DFe = "⫆", AFe = "⊋", LFe = "⫌", RFe = "⫈", IFe = "⫔", PFe = "⫖", BFe = "⤦", FFe = "↙", _Fe = "⇙", qFe = "↙", zFe = "⤪", HFe = "ß", VFe = "	", UFe = "⌖", $Fe = "Τ", WFe = "τ", jFe = "⎴", GFe = "Ť", KFe = "ť", JFe = "Ţ", QFe = "ţ", XFe = "Т", YFe = "т", ZFe = "⃛", e_e = "⌕", t_e = "𝔗", r_e = "𝔱", n_e = "∴", i_e = "∴", a_e = "∴", o_e = "Θ", s_e = "θ", l_e = "ϑ", u_e = "ϑ", c_e = "≈", f_e = "∼", d_e = "  ", h_e = " ", p_e = " ", v_e = "≈", m_e = "∼", g_e = "Þ", y_e = "þ", k_e = "˜", w_e = "∼", b_e = "≃", C_e = "≅", T_e = "≈", S_e = "⨱", x_e = "⊠", E_e = "×", M_e = "⨰", N_e = "∭", O_e = "⤨", D_e = "⌶", A_e = "⫱", L_e = "⊤", R_e = "𝕋", I_e = "𝕥", P_e = "⫚", B_e = "⤩", F_e = "‴", __e = "™", q_e = "™", z_e = "▵", H_e = "▿", V_e = "◃", U_e = "⊴", $_e = "≜", W_e = "▹", j_e = "⊵", G_e = "◬", K_e = "≜", J_e = "⨺", Q_e = "⃛", X_e = "⨹", Y_e = "⧍", Z_e = "⨻", e2e = "⏢", t2e = "𝒯", r2e = "𝓉", n2e = "Ц", i2e = "ц", a2e = "Ћ", o2e = "ћ", s2e = "Ŧ", l2e = "ŧ", u2e = "≬", c2e = "↞", f2e = "↠", d2e = "Ú", h2e = "ú", p2e = "↑", v2e = "↟", m2e = "⇑", g2e = "⥉", y2e = "Ў", k2e = "ў", w2e = "Ŭ", b2e = "ŭ", C2e = "Û", T2e = "û", S2e = "У", x2e = "у", E2e = "⇅", M2e = "Ű", N2e = "ű", O2e = "⥮", D2e = "⥾", A2e = "𝔘", L2e = "𝔲", R2e = "Ù", I2e = "ù", P2e = "⥣", B2e = "↿", F2e = "↾", _2e = "▀", q2e = "⌜", z2e = "⌜", H2e = "⌏", V2e = "◸", U2e = "Ū", $2e = "ū", W2e = "¨", j2e = "_", G2e = "⏟", K2e = "⎵", J2e = "⏝", Q2e = "⋃", X2e = "⊎", Y2e = "Ų", Z2e = "ų", eqe = "𝕌", tqe = "𝕦", rqe = "⤒", nqe = "↑", iqe = "↑", aqe = "⇑", oqe = "⇅", sqe = "↕", lqe = "↕", uqe = "⇕", cqe = "⥮", fqe = "↿", dqe = "↾", hqe = "⊎", pqe = "↖", vqe = "↗", mqe = "υ", gqe = "ϒ", yqe = "ϒ", kqe = "Υ", wqe = "υ", bqe = "↥", Cqe = "⊥", Tqe = "⇈", Sqe = "⌝", xqe = "⌝", Eqe = "⌎", Mqe = "Ů", Nqe = "ů", Oqe = "◹", Dqe = "𝒰", Aqe = "𝓊", Lqe = "⋰", Rqe = "Ũ", Iqe = "ũ", Pqe = "▵", Bqe = "▴", Fqe = "⇈", _qe = "Ü", qqe = "ü", zqe = "⦧", Hqe = "⦜", Vqe = "ϵ", Uqe = "ϰ", $qe = "∅", Wqe = "ϕ", jqe = "ϖ", Gqe = "∝", Kqe = "↕", Jqe = "⇕", Qqe = "ϱ", Xqe = "ς", Yqe = "⊊︀", Zqe = "⫋︀", eze = "⊋︀", tze = "⫌︀", rze = "ϑ", nze = "⊲", ize = "⊳", aze = "⫨", oze = "⫫", sze = "⫩", lze = "В", uze = "в", cze = "⊢", fze = "⊨", dze = "⊩", hze = "⊫", pze = "⫦", vze = "⊻", mze = "∨", gze = "⋁", yze = "≚", kze = "⋮", wze = "|", bze = "‖", Cze = "|", Tze = "‖", Sze = "∣", xze = "|", Eze = "❘", Mze = "≀", Nze = " ", Oze = "𝔙", Dze = "𝔳", Aze = "⊲", Lze = "⊂⃒", Rze = "⊃⃒", Ize = "𝕍", Pze = "𝕧", Bze = "∝", Fze = "⊳", _ze = "𝒱", qze = "𝓋", zze = "⫋︀", Hze = "⊊︀", Vze = "⫌︀", Uze = "⊋︀", $ze = "⊪", Wze = "⦚", jze = "Ŵ", Gze = "ŵ", Kze = "⩟", Jze = "∧", Qze = "⋀", Xze = "≙", Yze = "℘", Zze = "𝔚", eHe = "𝔴", tHe = "𝕎", rHe = "𝕨", nHe = "℘", iHe = "≀", aHe = "≀", oHe = "𝒲", sHe = "𝓌", lHe = "⋂", uHe = "◯", cHe = "⋃", fHe = "▽", dHe = "𝔛", hHe = "𝔵", pHe = "⟷", vHe = "⟺", mHe = "Ξ", gHe = "ξ", yHe = "⟵", kHe = "⟸", wHe = "⟼", bHe = "⋻", CHe = "⨀", THe = "𝕏", SHe = "𝕩", xHe = "⨁", EHe = "⨂", MHe = "⟶", NHe = "⟹", OHe = "𝒳", DHe = "𝓍", AHe = "⨆", LHe = "⨄", RHe = "△", IHe = "⋁", PHe = "⋀", BHe = "Ý", FHe = "ý", _He = "Я", qHe = "я", zHe = "Ŷ", HHe = "ŷ", VHe = "Ы", UHe = "ы", $He = "¥", WHe = "𝔜", jHe = "𝔶", GHe = "Ї", KHe = "ї", JHe = "𝕐", QHe = "𝕪", XHe = "𝒴", YHe = "𝓎", ZHe = "Ю", e3e = "ю", t3e = "ÿ", r3e = "Ÿ", n3e = "Ź", i3e = "ź", a3e = "Ž", o3e = "ž", s3e = "З", l3e = "з", u3e = "Ż", c3e = "ż", f3e = "ℨ", d3e = "​", h3e = "Ζ", p3e = "ζ", v3e = "𝔷", m3e = "ℨ", g3e = "Ж", y3e = "ж", k3e = "⇝", w3e = "𝕫", b3e = "ℤ", C3e = "𝒵", T3e = "𝓏", S3e = "‍", x3e = "‌", Gx = {
  Aacute: uoe,
  aacute: coe,
  Abreve: foe,
  abreve: doe,
  ac: hoe,
  acd: poe,
  acE: voe,
  Acirc: moe,
  acirc: goe,
  acute: yoe,
  Acy: koe,
  acy: woe,
  AElig: boe,
  aelig: Coe,
  af: Toe,
  Afr: Soe,
  afr: xoe,
  Agrave: Eoe,
  agrave: Moe,
  alefsym: Noe,
  aleph: Ooe,
  Alpha: Doe,
  alpha: Aoe,
  Amacr: Loe,
  amacr: Roe,
  amalg: Ioe,
  amp: Poe,
  AMP: Boe,
  andand: Foe,
  And: _oe,
  and: qoe,
  andd: zoe,
  andslope: Hoe,
  andv: Voe,
  ang: Uoe,
  ange: $oe,
  angle: Woe,
  angmsdaa: joe,
  angmsdab: Goe,
  angmsdac: Koe,
  angmsdad: Joe,
  angmsdae: Qoe,
  angmsdaf: Xoe,
  angmsdag: Yoe,
  angmsdah: Zoe,
  angmsd: ese,
  angrt: tse,
  angrtvb: rse,
  angrtvbd: nse,
  angsph: ise,
  angst: ase,
  angzarr: ose,
  Aogon: sse,
  aogon: lse,
  Aopf: use,
  aopf: cse,
  apacir: fse,
  ap: dse,
  apE: hse,
  ape: pse,
  apid: vse,
  apos: mse,
  ApplyFunction: gse,
  approx: yse,
  approxeq: kse,
  Aring: wse,
  aring: bse,
  Ascr: Cse,
  ascr: Tse,
  Assign: Sse,
  ast: xse,
  asymp: Ese,
  asympeq: Mse,
  Atilde: Nse,
  atilde: Ose,
  Auml: Dse,
  auml: Ase,
  awconint: Lse,
  awint: Rse,
  backcong: Ise,
  backepsilon: Pse,
  backprime: Bse,
  backsim: Fse,
  backsimeq: _se,
  Backslash: qse,
  Barv: zse,
  barvee: Hse,
  barwed: Vse,
  Barwed: Use,
  barwedge: $se,
  bbrk: Wse,
  bbrktbrk: jse,
  bcong: Gse,
  Bcy: Kse,
  bcy: Jse,
  bdquo: Qse,
  becaus: Xse,
  because: Yse,
  Because: Zse,
  bemptyv: ele,
  bepsi: tle,
  bernou: rle,
  Bernoullis: nle,
  Beta: ile,
  beta: ale,
  beth: ole,
  between: sle,
  Bfr: lle,
  bfr: ule,
  bigcap: cle,
  bigcirc: fle,
  bigcup: dle,
  bigodot: hle,
  bigoplus: ple,
  bigotimes: vle,
  bigsqcup: mle,
  bigstar: gle,
  bigtriangledown: yle,
  bigtriangleup: kle,
  biguplus: wle,
  bigvee: ble,
  bigwedge: Cle,
  bkarow: Tle,
  blacklozenge: Sle,
  blacksquare: xle,
  blacktriangle: Ele,
  blacktriangledown: Mle,
  blacktriangleleft: Nle,
  blacktriangleright: Ole,
  blank: Dle,
  blk12: Ale,
  blk14: Lle,
  blk34: Rle,
  block: Ile,
  bne: Ple,
  bnequiv: Ble,
  bNot: Fle,
  bnot: _le,
  Bopf: qle,
  bopf: zle,
  bot: Hle,
  bottom: Vle,
  bowtie: Ule,
  boxbox: $le,
  boxdl: Wle,
  boxdL: jle,
  boxDl: Gle,
  boxDL: Kle,
  boxdr: Jle,
  boxdR: Qle,
  boxDr: Xle,
  boxDR: Yle,
  boxh: Zle,
  boxH: eue,
  boxhd: tue,
  boxHd: rue,
  boxhD: nue,
  boxHD: iue,
  boxhu: aue,
  boxHu: oue,
  boxhU: sue,
  boxHU: lue,
  boxminus: uue,
  boxplus: cue,
  boxtimes: fue,
  boxul: due,
  boxuL: hue,
  boxUl: pue,
  boxUL: vue,
  boxur: mue,
  boxuR: gue,
  boxUr: yue,
  boxUR: kue,
  boxv: wue,
  boxV: bue,
  boxvh: Cue,
  boxvH: Tue,
  boxVh: Sue,
  boxVH: xue,
  boxvl: Eue,
  boxvL: Mue,
  boxVl: Nue,
  boxVL: Oue,
  boxvr: Due,
  boxvR: Aue,
  boxVr: Lue,
  boxVR: Rue,
  bprime: Iue,
  breve: Pue,
  Breve: Bue,
  brvbar: Fue,
  bscr: _ue,
  Bscr: que,
  bsemi: zue,
  bsim: Hue,
  bsime: Vue,
  bsolb: Uue,
  bsol: $ue,
  bsolhsub: Wue,
  bull: jue,
  bullet: Gue,
  bump: Kue,
  bumpE: Jue,
  bumpe: Que,
  Bumpeq: Xue,
  bumpeq: Yue,
  Cacute: Zue,
  cacute: ece,
  capand: tce,
  capbrcup: rce,
  capcap: nce,
  cap: ice,
  Cap: ace,
  capcup: oce,
  capdot: sce,
  CapitalDifferentialD: lce,
  caps: uce,
  caret: cce,
  caron: fce,
  Cayleys: dce,
  ccaps: hce,
  Ccaron: pce,
  ccaron: vce,
  Ccedil: mce,
  ccedil: gce,
  Ccirc: yce,
  ccirc: kce,
  Cconint: wce,
  ccups: bce,
  ccupssm: Cce,
  Cdot: Tce,
  cdot: Sce,
  cedil: xce,
  Cedilla: Ece,
  cemptyv: Mce,
  cent: Nce,
  centerdot: Oce,
  CenterDot: Dce,
  cfr: Ace,
  Cfr: Lce,
  CHcy: Rce,
  chcy: Ice,
  check: Pce,
  checkmark: Bce,
  Chi: Fce,
  chi: _ce,
  circ: qce,
  circeq: zce,
  circlearrowleft: Hce,
  circlearrowright: Vce,
  circledast: Uce,
  circledcirc: $ce,
  circleddash: Wce,
  CircleDot: jce,
  circledR: Gce,
  circledS: Kce,
  CircleMinus: Jce,
  CirclePlus: Qce,
  CircleTimes: Xce,
  cir: Yce,
  cirE: Zce,
  cire: efe,
  cirfnint: tfe,
  cirmid: rfe,
  cirscir: nfe,
  ClockwiseContourIntegral: ife,
  CloseCurlyDoubleQuote: afe,
  CloseCurlyQuote: ofe,
  clubs: sfe,
  clubsuit: lfe,
  colon: ufe,
  Colon: cfe,
  Colone: ffe,
  colone: dfe,
  coloneq: hfe,
  comma: pfe,
  commat: vfe,
  comp: mfe,
  compfn: gfe,
  complement: yfe,
  complexes: kfe,
  cong: wfe,
  congdot: bfe,
  Congruent: Cfe,
  conint: Tfe,
  Conint: Sfe,
  ContourIntegral: xfe,
  copf: Efe,
  Copf: Mfe,
  coprod: Nfe,
  Coproduct: Ofe,
  copy: Dfe,
  COPY: Afe,
  copysr: Lfe,
  CounterClockwiseContourIntegral: Rfe,
  crarr: Ife,
  cross: Pfe,
  Cross: Bfe,
  Cscr: Ffe,
  cscr: _fe,
  csub: qfe,
  csube: zfe,
  csup: Hfe,
  csupe: Vfe,
  ctdot: Ufe,
  cudarrl: $fe,
  cudarrr: Wfe,
  cuepr: jfe,
  cuesc: Gfe,
  cularr: Kfe,
  cularrp: Jfe,
  cupbrcap: Qfe,
  cupcap: Xfe,
  CupCap: Yfe,
  cup: Zfe,
  Cup: ede,
  cupcup: tde,
  cupdot: rde,
  cupor: nde,
  cups: ide,
  curarr: ade,
  curarrm: ode,
  curlyeqprec: sde,
  curlyeqsucc: lde,
  curlyvee: ude,
  curlywedge: cde,
  curren: fde,
  curvearrowleft: dde,
  curvearrowright: hde,
  cuvee: pde,
  cuwed: vde,
  cwconint: mde,
  cwint: gde,
  cylcty: yde,
  dagger: kde,
  Dagger: wde,
  daleth: bde,
  darr: Cde,
  Darr: Tde,
  dArr: Sde,
  dash: xde,
  Dashv: Ede,
  dashv: Mde,
  dbkarow: Nde,
  dblac: Ode,
  Dcaron: Dde,
  dcaron: Ade,
  Dcy: Lde,
  dcy: Rde,
  ddagger: Ide,
  ddarr: Pde,
  DD: Bde,
  dd: Fde,
  DDotrahd: _de,
  ddotseq: qde,
  deg: zde,
  Del: Hde,
  Delta: Vde,
  delta: Ude,
  demptyv: $de,
  dfisht: Wde,
  Dfr: jde,
  dfr: Gde,
  dHar: Kde,
  dharl: Jde,
  dharr: Qde,
  DiacriticalAcute: Xde,
  DiacriticalDot: Yde,
  DiacriticalDoubleAcute: Zde,
  DiacriticalGrave: ehe,
  DiacriticalTilde: the,
  diam: rhe,
  diamond: nhe,
  Diamond: ihe,
  diamondsuit: ahe,
  diams: ohe,
  die: she,
  DifferentialD: lhe,
  digamma: uhe,
  disin: che,
  div: fhe,
  divide: dhe,
  divideontimes: hhe,
  divonx: phe,
  DJcy: vhe,
  djcy: mhe,
  dlcorn: ghe,
  dlcrop: yhe,
  dollar: khe,
  Dopf: whe,
  dopf: bhe,
  Dot: Che,
  dot: The,
  DotDot: She,
  doteq: xhe,
  doteqdot: Ehe,
  DotEqual: Mhe,
  dotminus: Nhe,
  dotplus: Ohe,
  dotsquare: Dhe,
  doublebarwedge: Ahe,
  DoubleContourIntegral: Lhe,
  DoubleDot: Rhe,
  DoubleDownArrow: Ihe,
  DoubleLeftArrow: Phe,
  DoubleLeftRightArrow: Bhe,
  DoubleLeftTee: Fhe,
  DoubleLongLeftArrow: _he,
  DoubleLongLeftRightArrow: qhe,
  DoubleLongRightArrow: zhe,
  DoubleRightArrow: Hhe,
  DoubleRightTee: Vhe,
  DoubleUpArrow: Uhe,
  DoubleUpDownArrow: $he,
  DoubleVerticalBar: Whe,
  DownArrowBar: jhe,
  downarrow: Ghe,
  DownArrow: Khe,
  Downarrow: Jhe,
  DownArrowUpArrow: Qhe,
  DownBreve: Xhe,
  downdownarrows: Yhe,
  downharpoonleft: Zhe,
  downharpoonright: epe,
  DownLeftRightVector: tpe,
  DownLeftTeeVector: rpe,
  DownLeftVectorBar: npe,
  DownLeftVector: ipe,
  DownRightTeeVector: ape,
  DownRightVectorBar: ope,
  DownRightVector: spe,
  DownTeeArrow: lpe,
  DownTee: upe,
  drbkarow: cpe,
  drcorn: fpe,
  drcrop: dpe,
  Dscr: hpe,
  dscr: ppe,
  DScy: vpe,
  dscy: mpe,
  dsol: gpe,
  Dstrok: ype,
  dstrok: kpe,
  dtdot: wpe,
  dtri: bpe,
  dtrif: Cpe,
  duarr: Tpe,
  duhar: Spe,
  dwangle: xpe,
  DZcy: Epe,
  dzcy: Mpe,
  dzigrarr: Npe,
  Eacute: Ope,
  eacute: Dpe,
  easter: Ape,
  Ecaron: Lpe,
  ecaron: Rpe,
  Ecirc: Ipe,
  ecirc: Ppe,
  ecir: Bpe,
  ecolon: Fpe,
  Ecy: _pe,
  ecy: qpe,
  eDDot: zpe,
  Edot: Hpe,
  edot: Vpe,
  eDot: Upe,
  ee: $pe,
  efDot: Wpe,
  Efr: jpe,
  efr: Gpe,
  eg: Kpe,
  Egrave: Jpe,
  egrave: Qpe,
  egs: Xpe,
  egsdot: Ype,
  el: Zpe,
  Element: eve,
  elinters: tve,
  ell: rve,
  els: nve,
  elsdot: ive,
  Emacr: ave,
  emacr: ove,
  empty: sve,
  emptyset: lve,
  EmptySmallSquare: uve,
  emptyv: cve,
  EmptyVerySmallSquare: fve,
  emsp13: dve,
  emsp14: hve,
  emsp: pve,
  ENG: vve,
  eng: mve,
  ensp: gve,
  Eogon: yve,
  eogon: kve,
  Eopf: wve,
  eopf: bve,
  epar: Cve,
  eparsl: Tve,
  eplus: Sve,
  epsi: xve,
  Epsilon: Eve,
  epsilon: Mve,
  epsiv: Nve,
  eqcirc: Ove,
  eqcolon: Dve,
  eqsim: Ave,
  eqslantgtr: Lve,
  eqslantless: Rve,
  Equal: Ive,
  equals: Pve,
  EqualTilde: Bve,
  equest: Fve,
  Equilibrium: _ve,
  equiv: qve,
  equivDD: zve,
  eqvparsl: Hve,
  erarr: Vve,
  erDot: Uve,
  escr: $ve,
  Escr: Wve,
  esdot: jve,
  Esim: Gve,
  esim: Kve,
  Eta: Jve,
  eta: Qve,
  ETH: Xve,
  eth: Yve,
  Euml: Zve,
  euml: eme,
  euro: tme,
  excl: rme,
  exist: nme,
  Exists: ime,
  expectation: ame,
  exponentiale: ome,
  ExponentialE: sme,
  fallingdotseq: lme,
  Fcy: ume,
  fcy: cme,
  female: fme,
  ffilig: dme,
  fflig: hme,
  ffllig: pme,
  Ffr: vme,
  ffr: mme,
  filig: gme,
  FilledSmallSquare: yme,
  FilledVerySmallSquare: kme,
  fjlig: wme,
  flat: bme,
  fllig: Cme,
  fltns: Tme,
  fnof: Sme,
  Fopf: xme,
  fopf: Eme,
  forall: Mme,
  ForAll: Nme,
  fork: Ome,
  forkv: Dme,
  Fouriertrf: Ame,
  fpartint: Lme,
  frac12: Rme,
  frac13: Ime,
  frac14: Pme,
  frac15: Bme,
  frac16: Fme,
  frac18: _me,
  frac23: qme,
  frac25: zme,
  frac34: Hme,
  frac35: Vme,
  frac38: Ume,
  frac45: $me,
  frac56: Wme,
  frac58: jme,
  frac78: Gme,
  frasl: Kme,
  frown: Jme,
  fscr: Qme,
  Fscr: Xme,
  gacute: Yme,
  Gamma: Zme,
  gamma: ege,
  Gammad: tge,
  gammad: rge,
  gap: nge,
  Gbreve: ige,
  gbreve: age,
  Gcedil: oge,
  Gcirc: sge,
  gcirc: lge,
  Gcy: uge,
  gcy: cge,
  Gdot: fge,
  gdot: dge,
  ge: hge,
  gE: pge,
  gEl: vge,
  gel: mge,
  geq: gge,
  geqq: yge,
  geqslant: kge,
  gescc: wge,
  ges: bge,
  gesdot: Cge,
  gesdoto: Tge,
  gesdotol: Sge,
  gesl: xge,
  gesles: Ege,
  Gfr: Mge,
  gfr: Nge,
  gg: Oge,
  Gg: Dge,
  ggg: Age,
  gimel: Lge,
  GJcy: Rge,
  gjcy: Ige,
  gla: Pge,
  gl: Bge,
  glE: Fge,
  glj: _ge,
  gnap: qge,
  gnapprox: zge,
  gne: Hge,
  gnE: Vge,
  gneq: Uge,
  gneqq: $ge,
  gnsim: Wge,
  Gopf: jge,
  gopf: Gge,
  grave: Kge,
  GreaterEqual: Jge,
  GreaterEqualLess: Qge,
  GreaterFullEqual: Xge,
  GreaterGreater: Yge,
  GreaterLess: Zge,
  GreaterSlantEqual: eye,
  GreaterTilde: tye,
  Gscr: rye,
  gscr: nye,
  gsim: iye,
  gsime: aye,
  gsiml: oye,
  gtcc: sye,
  gtcir: lye,
  gt: uye,
  GT: cye,
  Gt: fye,
  gtdot: dye,
  gtlPar: hye,
  gtquest: pye,
  gtrapprox: vye,
  gtrarr: mye,
  gtrdot: gye,
  gtreqless: yye,
  gtreqqless: kye,
  gtrless: wye,
  gtrsim: bye,
  gvertneqq: Cye,
  gvnE: Tye,
  Hacek: Sye,
  hairsp: xye,
  half: Eye,
  hamilt: Mye,
  HARDcy: Nye,
  hardcy: Oye,
  harrcir: Dye,
  harr: Aye,
  hArr: Lye,
  harrw: Rye,
  Hat: Iye,
  hbar: Pye,
  Hcirc: Bye,
  hcirc: Fye,
  hearts: _ye,
  heartsuit: qye,
  hellip: zye,
  hercon: Hye,
  hfr: Vye,
  Hfr: Uye,
  HilbertSpace: $ye,
  hksearow: Wye,
  hkswarow: jye,
  hoarr: Gye,
  homtht: Kye,
  hookleftarrow: Jye,
  hookrightarrow: Qye,
  hopf: Xye,
  Hopf: Yye,
  horbar: Zye,
  HorizontalLine: e0e,
  hscr: t0e,
  Hscr: r0e,
  hslash: n0e,
  Hstrok: i0e,
  hstrok: a0e,
  HumpDownHump: o0e,
  HumpEqual: s0e,
  hybull: l0e,
  hyphen: u0e,
  Iacute: c0e,
  iacute: f0e,
  ic: d0e,
  Icirc: h0e,
  icirc: p0e,
  Icy: v0e,
  icy: m0e,
  Idot: g0e,
  IEcy: y0e,
  iecy: k0e,
  iexcl: w0e,
  iff: b0e,
  ifr: C0e,
  Ifr: T0e,
  Igrave: S0e,
  igrave: x0e,
  ii: E0e,
  iiiint: M0e,
  iiint: N0e,
  iinfin: O0e,
  iiota: D0e,
  IJlig: A0e,
  ijlig: L0e,
  Imacr: R0e,
  imacr: I0e,
  image: P0e,
  ImaginaryI: B0e,
  imagline: F0e,
  imagpart: _0e,
  imath: q0e,
  Im: z0e,
  imof: H0e,
  imped: V0e,
  Implies: U0e,
  incare: $0e,
  in: "∈",
  infin: W0e,
  infintie: j0e,
  inodot: G0e,
  intcal: K0e,
  int: J0e,
  Int: Q0e,
  integers: X0e,
  Integral: Y0e,
  intercal: Z0e,
  Intersection: eke,
  intlarhk: tke,
  intprod: rke,
  InvisibleComma: nke,
  InvisibleTimes: ike,
  IOcy: ake,
  iocy: oke,
  Iogon: ske,
  iogon: lke,
  Iopf: uke,
  iopf: cke,
  Iota: fke,
  iota: dke,
  iprod: hke,
  iquest: pke,
  iscr: vke,
  Iscr: mke,
  isin: gke,
  isindot: yke,
  isinE: kke,
  isins: wke,
  isinsv: bke,
  isinv: Cke,
  it: Tke,
  Itilde: Ske,
  itilde: xke,
  Iukcy: Eke,
  iukcy: Mke,
  Iuml: Nke,
  iuml: Oke,
  Jcirc: Dke,
  jcirc: Ake,
  Jcy: Lke,
  jcy: Rke,
  Jfr: Ike,
  jfr: Pke,
  jmath: Bke,
  Jopf: Fke,
  jopf: _ke,
  Jscr: qke,
  jscr: zke,
  Jsercy: Hke,
  jsercy: Vke,
  Jukcy: Uke,
  jukcy: $ke,
  Kappa: Wke,
  kappa: jke,
  kappav: Gke,
  Kcedil: Kke,
  kcedil: Jke,
  Kcy: Qke,
  kcy: Xke,
  Kfr: Yke,
  kfr: Zke,
  kgreen: ewe,
  KHcy: twe,
  khcy: rwe,
  KJcy: nwe,
  kjcy: iwe,
  Kopf: awe,
  kopf: owe,
  Kscr: swe,
  kscr: lwe,
  lAarr: uwe,
  Lacute: cwe,
  lacute: fwe,
  laemptyv: dwe,
  lagran: hwe,
  Lambda: pwe,
  lambda: vwe,
  lang: mwe,
  Lang: gwe,
  langd: ywe,
  langle: kwe,
  lap: wwe,
  Laplacetrf: bwe,
  laquo: Cwe,
  larrb: Twe,
  larrbfs: Swe,
  larr: xwe,
  Larr: Ewe,
  lArr: Mwe,
  larrfs: Nwe,
  larrhk: Owe,
  larrlp: Dwe,
  larrpl: Awe,
  larrsim: Lwe,
  larrtl: Rwe,
  latail: Iwe,
  lAtail: Pwe,
  lat: Bwe,
  late: Fwe,
  lates: _we,
  lbarr: qwe,
  lBarr: zwe,
  lbbrk: Hwe,
  lbrace: Vwe,
  lbrack: Uwe,
  lbrke: $we,
  lbrksld: Wwe,
  lbrkslu: jwe,
  Lcaron: Gwe,
  lcaron: Kwe,
  Lcedil: Jwe,
  lcedil: Qwe,
  lceil: Xwe,
  lcub: Ywe,
  Lcy: Zwe,
  lcy: e1e,
  ldca: t1e,
  ldquo: r1e,
  ldquor: n1e,
  ldrdhar: i1e,
  ldrushar: a1e,
  ldsh: o1e,
  le: s1e,
  lE: l1e,
  LeftAngleBracket: u1e,
  LeftArrowBar: c1e,
  leftarrow: f1e,
  LeftArrow: d1e,
  Leftarrow: h1e,
  LeftArrowRightArrow: p1e,
  leftarrowtail: v1e,
  LeftCeiling: m1e,
  LeftDoubleBracket: g1e,
  LeftDownTeeVector: y1e,
  LeftDownVectorBar: k1e,
  LeftDownVector: w1e,
  LeftFloor: b1e,
  leftharpoondown: C1e,
  leftharpoonup: T1e,
  leftleftarrows: S1e,
  leftrightarrow: x1e,
  LeftRightArrow: E1e,
  Leftrightarrow: M1e,
  leftrightarrows: N1e,
  leftrightharpoons: O1e,
  leftrightsquigarrow: D1e,
  LeftRightVector: A1e,
  LeftTeeArrow: L1e,
  LeftTee: R1e,
  LeftTeeVector: I1e,
  leftthreetimes: P1e,
  LeftTriangleBar: B1e,
  LeftTriangle: F1e,
  LeftTriangleEqual: _1e,
  LeftUpDownVector: q1e,
  LeftUpTeeVector: z1e,
  LeftUpVectorBar: H1e,
  LeftUpVector: V1e,
  LeftVectorBar: U1e,
  LeftVector: $1e,
  lEg: W1e,
  leg: j1e,
  leq: G1e,
  leqq: K1e,
  leqslant: J1e,
  lescc: Q1e,
  les: X1e,
  lesdot: Y1e,
  lesdoto: Z1e,
  lesdotor: ebe,
  lesg: tbe,
  lesges: rbe,
  lessapprox: nbe,
  lessdot: ibe,
  lesseqgtr: abe,
  lesseqqgtr: obe,
  LessEqualGreater: sbe,
  LessFullEqual: lbe,
  LessGreater: ube,
  lessgtr: cbe,
  LessLess: fbe,
  lesssim: dbe,
  LessSlantEqual: hbe,
  LessTilde: pbe,
  lfisht: vbe,
  lfloor: mbe,
  Lfr: gbe,
  lfr: ybe,
  lg: kbe,
  lgE: wbe,
  lHar: bbe,
  lhard: Cbe,
  lharu: Tbe,
  lharul: Sbe,
  lhblk: xbe,
  LJcy: Ebe,
  ljcy: Mbe,
  llarr: Nbe,
  ll: Obe,
  Ll: Dbe,
  llcorner: Abe,
  Lleftarrow: Lbe,
  llhard: Rbe,
  lltri: Ibe,
  Lmidot: Pbe,
  lmidot: Bbe,
  lmoustache: Fbe,
  lmoust: _be,
  lnap: qbe,
  lnapprox: zbe,
  lne: Hbe,
  lnE: Vbe,
  lneq: Ube,
  lneqq: $be,
  lnsim: Wbe,
  loang: jbe,
  loarr: Gbe,
  lobrk: Kbe,
  longleftarrow: Jbe,
  LongLeftArrow: Qbe,
  Longleftarrow: Xbe,
  longleftrightarrow: Ybe,
  LongLeftRightArrow: Zbe,
  Longleftrightarrow: eCe,
  longmapsto: tCe,
  longrightarrow: rCe,
  LongRightArrow: nCe,
  Longrightarrow: iCe,
  looparrowleft: aCe,
  looparrowright: oCe,
  lopar: sCe,
  Lopf: lCe,
  lopf: uCe,
  loplus: cCe,
  lotimes: fCe,
  lowast: dCe,
  lowbar: hCe,
  LowerLeftArrow: pCe,
  LowerRightArrow: vCe,
  loz: mCe,
  lozenge: gCe,
  lozf: yCe,
  lpar: kCe,
  lparlt: wCe,
  lrarr: bCe,
  lrcorner: CCe,
  lrhar: TCe,
  lrhard: SCe,
  lrm: xCe,
  lrtri: ECe,
  lsaquo: MCe,
  lscr: NCe,
  Lscr: OCe,
  lsh: DCe,
  Lsh: ACe,
  lsim: LCe,
  lsime: RCe,
  lsimg: ICe,
  lsqb: PCe,
  lsquo: BCe,
  lsquor: FCe,
  Lstrok: _Ce,
  lstrok: qCe,
  ltcc: zCe,
  ltcir: HCe,
  lt: VCe,
  LT: UCe,
  Lt: $Ce,
  ltdot: WCe,
  lthree: jCe,
  ltimes: GCe,
  ltlarr: KCe,
  ltquest: JCe,
  ltri: QCe,
  ltrie: XCe,
  ltrif: YCe,
  ltrPar: ZCe,
  lurdshar: eTe,
  luruhar: tTe,
  lvertneqq: rTe,
  lvnE: nTe,
  macr: iTe,
  male: aTe,
  malt: oTe,
  maltese: sTe,
  Map: "⤅",
  map: lTe,
  mapsto: uTe,
  mapstodown: cTe,
  mapstoleft: fTe,
  mapstoup: dTe,
  marker: hTe,
  mcomma: pTe,
  Mcy: vTe,
  mcy: mTe,
  mdash: gTe,
  mDDot: yTe,
  measuredangle: kTe,
  MediumSpace: wTe,
  Mellintrf: bTe,
  Mfr: CTe,
  mfr: TTe,
  mho: STe,
  micro: xTe,
  midast: ETe,
  midcir: MTe,
  mid: NTe,
  middot: OTe,
  minusb: DTe,
  minus: ATe,
  minusd: LTe,
  minusdu: RTe,
  MinusPlus: ITe,
  mlcp: PTe,
  mldr: BTe,
  mnplus: FTe,
  models: _Te,
  Mopf: qTe,
  mopf: zTe,
  mp: HTe,
  mscr: VTe,
  Mscr: UTe,
  mstpos: $Te,
  Mu: WTe,
  mu: jTe,
  multimap: GTe,
  mumap: KTe,
  nabla: JTe,
  Nacute: QTe,
  nacute: XTe,
  nang: YTe,
  nap: ZTe,
  napE: eSe,
  napid: tSe,
  napos: rSe,
  napprox: nSe,
  natural: iSe,
  naturals: aSe,
  natur: oSe,
  nbsp: sSe,
  nbump: lSe,
  nbumpe: uSe,
  ncap: cSe,
  Ncaron: fSe,
  ncaron: dSe,
  Ncedil: hSe,
  ncedil: pSe,
  ncong: vSe,
  ncongdot: mSe,
  ncup: gSe,
  Ncy: ySe,
  ncy: kSe,
  ndash: wSe,
  nearhk: bSe,
  nearr: CSe,
  neArr: TSe,
  nearrow: SSe,
  ne: xSe,
  nedot: ESe,
  NegativeMediumSpace: MSe,
  NegativeThickSpace: NSe,
  NegativeThinSpace: OSe,
  NegativeVeryThinSpace: DSe,
  nequiv: ASe,
  nesear: LSe,
  nesim: RSe,
  NestedGreaterGreater: ISe,
  NestedLessLess: PSe,
  NewLine: BSe,
  nexist: FSe,
  nexists: _Se,
  Nfr: qSe,
  nfr: zSe,
  ngE: HSe,
  nge: VSe,
  ngeq: USe,
  ngeqq: $Se,
  ngeqslant: WSe,
  nges: jSe,
  nGg: GSe,
  ngsim: KSe,
  nGt: JSe,
  ngt: QSe,
  ngtr: XSe,
  nGtv: YSe,
  nharr: ZSe,
  nhArr: exe,
  nhpar: txe,
  ni: rxe,
  nis: nxe,
  nisd: ixe,
  niv: axe,
  NJcy: oxe,
  njcy: sxe,
  nlarr: lxe,
  nlArr: uxe,
  nldr: cxe,
  nlE: fxe,
  nle: dxe,
  nleftarrow: hxe,
  nLeftarrow: pxe,
  nleftrightarrow: vxe,
  nLeftrightarrow: mxe,
  nleq: gxe,
  nleqq: yxe,
  nleqslant: kxe,
  nles: wxe,
  nless: bxe,
  nLl: Cxe,
  nlsim: Txe,
  nLt: Sxe,
  nlt: xxe,
  nltri: Exe,
  nltrie: Mxe,
  nLtv: Nxe,
  nmid: Oxe,
  NoBreak: Dxe,
  NonBreakingSpace: Axe,
  nopf: Lxe,
  Nopf: Rxe,
  Not: Ixe,
  not: Pxe,
  NotCongruent: Bxe,
  NotCupCap: Fxe,
  NotDoubleVerticalBar: _xe,
  NotElement: qxe,
  NotEqual: zxe,
  NotEqualTilde: Hxe,
  NotExists: Vxe,
  NotGreater: Uxe,
  NotGreaterEqual: $xe,
  NotGreaterFullEqual: Wxe,
  NotGreaterGreater: jxe,
  NotGreaterLess: Gxe,
  NotGreaterSlantEqual: Kxe,
  NotGreaterTilde: Jxe,
  NotHumpDownHump: Qxe,
  NotHumpEqual: Xxe,
  notin: Yxe,
  notindot: Zxe,
  notinE: eEe,
  notinva: tEe,
  notinvb: rEe,
  notinvc: nEe,
  NotLeftTriangleBar: iEe,
  NotLeftTriangle: aEe,
  NotLeftTriangleEqual: oEe,
  NotLess: sEe,
  NotLessEqual: lEe,
  NotLessGreater: uEe,
  NotLessLess: cEe,
  NotLessSlantEqual: fEe,
  NotLessTilde: dEe,
  NotNestedGreaterGreater: hEe,
  NotNestedLessLess: pEe,
  notni: vEe,
  notniva: mEe,
  notnivb: gEe,
  notnivc: yEe,
  NotPrecedes: kEe,
  NotPrecedesEqual: wEe,
  NotPrecedesSlantEqual: bEe,
  NotReverseElement: CEe,
  NotRightTriangleBar: TEe,
  NotRightTriangle: SEe,
  NotRightTriangleEqual: xEe,
  NotSquareSubset: EEe,
  NotSquareSubsetEqual: MEe,
  NotSquareSuperset: NEe,
  NotSquareSupersetEqual: OEe,
  NotSubset: DEe,
  NotSubsetEqual: AEe,
  NotSucceeds: LEe,
  NotSucceedsEqual: REe,
  NotSucceedsSlantEqual: IEe,
  NotSucceedsTilde: PEe,
  NotSuperset: BEe,
  NotSupersetEqual: FEe,
  NotTilde: _Ee,
  NotTildeEqual: qEe,
  NotTildeFullEqual: zEe,
  NotTildeTilde: HEe,
  NotVerticalBar: VEe,
  nparallel: UEe,
  npar: $Ee,
  nparsl: WEe,
  npart: jEe,
  npolint: GEe,
  npr: KEe,
  nprcue: JEe,
  nprec: QEe,
  npreceq: XEe,
  npre: YEe,
  nrarrc: ZEe,
  nrarr: eMe,
  nrArr: tMe,
  nrarrw: rMe,
  nrightarrow: nMe,
  nRightarrow: iMe,
  nrtri: aMe,
  nrtrie: oMe,
  nsc: sMe,
  nsccue: lMe,
  nsce: uMe,
  Nscr: cMe,
  nscr: fMe,
  nshortmid: dMe,
  nshortparallel: hMe,
  nsim: pMe,
  nsime: vMe,
  nsimeq: mMe,
  nsmid: gMe,
  nspar: yMe,
  nsqsube: kMe,
  nsqsupe: wMe,
  nsub: bMe,
  nsubE: CMe,
  nsube: TMe,
  nsubset: SMe,
  nsubseteq: xMe,
  nsubseteqq: EMe,
  nsucc: MMe,
  nsucceq: NMe,
  nsup: OMe,
  nsupE: DMe,
  nsupe: AMe,
  nsupset: LMe,
  nsupseteq: RMe,
  nsupseteqq: IMe,
  ntgl: PMe,
  Ntilde: BMe,
  ntilde: FMe,
  ntlg: _Me,
  ntriangleleft: qMe,
  ntrianglelefteq: zMe,
  ntriangleright: HMe,
  ntrianglerighteq: VMe,
  Nu: UMe,
  nu: $Me,
  num: WMe,
  numero: jMe,
  numsp: GMe,
  nvap: KMe,
  nvdash: JMe,
  nvDash: QMe,
  nVdash: XMe,
  nVDash: YMe,
  nvge: ZMe,
  nvgt: eNe,
  nvHarr: tNe,
  nvinfin: rNe,
  nvlArr: nNe,
  nvle: iNe,
  nvlt: aNe,
  nvltrie: oNe,
  nvrArr: sNe,
  nvrtrie: lNe,
  nvsim: uNe,
  nwarhk: cNe,
  nwarr: fNe,
  nwArr: dNe,
  nwarrow: hNe,
  nwnear: pNe,
  Oacute: vNe,
  oacute: mNe,
  oast: gNe,
  Ocirc: yNe,
  ocirc: kNe,
  ocir: wNe,
  Ocy: bNe,
  ocy: CNe,
  odash: TNe,
  Odblac: SNe,
  odblac: xNe,
  odiv: ENe,
  odot: MNe,
  odsold: NNe,
  OElig: ONe,
  oelig: DNe,
  ofcir: ANe,
  Ofr: LNe,
  ofr: RNe,
  ogon: INe,
  Ograve: PNe,
  ograve: BNe,
  ogt: FNe,
  ohbar: _Ne,
  ohm: qNe,
  oint: zNe,
  olarr: HNe,
  olcir: VNe,
  olcross: UNe,
  oline: $Ne,
  olt: WNe,
  Omacr: jNe,
  omacr: GNe,
  Omega: KNe,
  omega: JNe,
  Omicron: QNe,
  omicron: XNe,
  omid: YNe,
  ominus: ZNe,
  Oopf: eOe,
  oopf: tOe,
  opar: rOe,
  OpenCurlyDoubleQuote: nOe,
  OpenCurlyQuote: iOe,
  operp: aOe,
  oplus: oOe,
  orarr: sOe,
  Or: lOe,
  or: uOe,
  ord: cOe,
  order: fOe,
  orderof: dOe,
  ordf: hOe,
  ordm: pOe,
  origof: vOe,
  oror: mOe,
  orslope: gOe,
  orv: yOe,
  oS: kOe,
  Oscr: wOe,
  oscr: bOe,
  Oslash: COe,
  oslash: TOe,
  osol: SOe,
  Otilde: xOe,
  otilde: EOe,
  otimesas: MOe,
  Otimes: NOe,
  otimes: OOe,
  Ouml: DOe,
  ouml: AOe,
  ovbar: LOe,
  OverBar: ROe,
  OverBrace: IOe,
  OverBracket: POe,
  OverParenthesis: BOe,
  para: FOe,
  parallel: _Oe,
  par: qOe,
  parsim: zOe,
  parsl: HOe,
  part: VOe,
  PartialD: UOe,
  Pcy: $Oe,
  pcy: WOe,
  percnt: jOe,
  period: GOe,
  permil: KOe,
  perp: JOe,
  pertenk: QOe,
  Pfr: XOe,
  pfr: YOe,
  Phi: ZOe,
  phi: eDe,
  phiv: tDe,
  phmmat: rDe,
  phone: nDe,
  Pi: iDe,
  pi: aDe,
  pitchfork: oDe,
  piv: sDe,
  planck: lDe,
  planckh: uDe,
  plankv: cDe,
  plusacir: fDe,
  plusb: dDe,
  pluscir: hDe,
  plus: pDe,
  plusdo: vDe,
  plusdu: mDe,
  pluse: gDe,
  PlusMinus: yDe,
  plusmn: kDe,
  plussim: wDe,
  plustwo: bDe,
  pm: CDe,
  Poincareplane: TDe,
  pointint: SDe,
  popf: xDe,
  Popf: EDe,
  pound: MDe,
  prap: NDe,
  Pr: ODe,
  pr: DDe,
  prcue: ADe,
  precapprox: LDe,
  prec: RDe,
  preccurlyeq: IDe,
  Precedes: PDe,
  PrecedesEqual: BDe,
  PrecedesSlantEqual: FDe,
  PrecedesTilde: _De,
  preceq: qDe,
  precnapprox: zDe,
  precneqq: HDe,
  precnsim: VDe,
  pre: UDe,
  prE: $De,
  precsim: WDe,
  prime: jDe,
  Prime: GDe,
  primes: KDe,
  prnap: JDe,
  prnE: QDe,
  prnsim: XDe,
  prod: YDe,
  Product: ZDe,
  profalar: eAe,
  profline: tAe,
  profsurf: rAe,
  prop: nAe,
  Proportional: iAe,
  Proportion: aAe,
  propto: oAe,
  prsim: sAe,
  prurel: lAe,
  Pscr: uAe,
  pscr: cAe,
  Psi: fAe,
  psi: dAe,
  puncsp: hAe,
  Qfr: pAe,
  qfr: vAe,
  qint: mAe,
  qopf: gAe,
  Qopf: yAe,
  qprime: kAe,
  Qscr: wAe,
  qscr: bAe,
  quaternions: CAe,
  quatint: TAe,
  quest: SAe,
  questeq: xAe,
  quot: EAe,
  QUOT: MAe,
  rAarr: NAe,
  race: OAe,
  Racute: DAe,
  racute: AAe,
  radic: LAe,
  raemptyv: RAe,
  rang: IAe,
  Rang: PAe,
  rangd: BAe,
  range: FAe,
  rangle: _Ae,
  raquo: qAe,
  rarrap: zAe,
  rarrb: HAe,
  rarrbfs: VAe,
  rarrc: UAe,
  rarr: $Ae,
  Rarr: WAe,
  rArr: jAe,
  rarrfs: GAe,
  rarrhk: KAe,
  rarrlp: JAe,
  rarrpl: QAe,
  rarrsim: XAe,
  Rarrtl: YAe,
  rarrtl: ZAe,
  rarrw: eLe,
  ratail: tLe,
  rAtail: rLe,
  ratio: nLe,
  rationals: iLe,
  rbarr: aLe,
  rBarr: oLe,
  RBarr: sLe,
  rbbrk: lLe,
  rbrace: uLe,
  rbrack: cLe,
  rbrke: fLe,
  rbrksld: dLe,
  rbrkslu: hLe,
  Rcaron: pLe,
  rcaron: vLe,
  Rcedil: mLe,
  rcedil: gLe,
  rceil: yLe,
  rcub: kLe,
  Rcy: wLe,
  rcy: bLe,
  rdca: CLe,
  rdldhar: TLe,
  rdquo: SLe,
  rdquor: xLe,
  rdsh: ELe,
  real: MLe,
  realine: NLe,
  realpart: OLe,
  reals: DLe,
  Re: ALe,
  rect: LLe,
  reg: RLe,
  REG: ILe,
  ReverseElement: PLe,
  ReverseEquilibrium: BLe,
  ReverseUpEquilibrium: FLe,
  rfisht: _Le,
  rfloor: qLe,
  rfr: zLe,
  Rfr: HLe,
  rHar: VLe,
  rhard: ULe,
  rharu: $Le,
  rharul: WLe,
  Rho: jLe,
  rho: GLe,
  rhov: KLe,
  RightAngleBracket: JLe,
  RightArrowBar: QLe,
  rightarrow: XLe,
  RightArrow: YLe,
  Rightarrow: ZLe,
  RightArrowLeftArrow: eRe,
  rightarrowtail: tRe,
  RightCeiling: rRe,
  RightDoubleBracket: nRe,
  RightDownTeeVector: iRe,
  RightDownVectorBar: aRe,
  RightDownVector: oRe,
  RightFloor: sRe,
  rightharpoondown: lRe,
  rightharpoonup: uRe,
  rightleftarrows: cRe,
  rightleftharpoons: fRe,
  rightrightarrows: dRe,
  rightsquigarrow: hRe,
  RightTeeArrow: pRe,
  RightTee: vRe,
  RightTeeVector: mRe,
  rightthreetimes: gRe,
  RightTriangleBar: yRe,
  RightTriangle: kRe,
  RightTriangleEqual: wRe,
  RightUpDownVector: bRe,
  RightUpTeeVector: CRe,
  RightUpVectorBar: TRe,
  RightUpVector: SRe,
  RightVectorBar: xRe,
  RightVector: ERe,
  ring: MRe,
  risingdotseq: NRe,
  rlarr: ORe,
  rlhar: DRe,
  rlm: ARe,
  rmoustache: LRe,
  rmoust: RRe,
  rnmid: IRe,
  roang: PRe,
  roarr: BRe,
  robrk: FRe,
  ropar: _Re,
  ropf: qRe,
  Ropf: zRe,
  roplus: HRe,
  rotimes: VRe,
  RoundImplies: URe,
  rpar: $Re,
  rpargt: WRe,
  rppolint: jRe,
  rrarr: GRe,
  Rrightarrow: KRe,
  rsaquo: JRe,
  rscr: QRe,
  Rscr: XRe,
  rsh: YRe,
  Rsh: ZRe,
  rsqb: eIe,
  rsquo: tIe,
  rsquor: rIe,
  rthree: nIe,
  rtimes: iIe,
  rtri: aIe,
  rtrie: oIe,
  rtrif: sIe,
  rtriltri: lIe,
  RuleDelayed: uIe,
  ruluhar: cIe,
  rx: fIe,
  Sacute: dIe,
  sacute: hIe,
  sbquo: pIe,
  scap: vIe,
  Scaron: mIe,
  scaron: gIe,
  Sc: yIe,
  sc: kIe,
  sccue: wIe,
  sce: bIe,
  scE: CIe,
  Scedil: TIe,
  scedil: SIe,
  Scirc: xIe,
  scirc: EIe,
  scnap: MIe,
  scnE: NIe,
  scnsim: OIe,
  scpolint: DIe,
  scsim: AIe,
  Scy: LIe,
  scy: RIe,
  sdotb: IIe,
  sdot: PIe,
  sdote: BIe,
  searhk: FIe,
  searr: _Ie,
  seArr: qIe,
  searrow: zIe,
  sect: HIe,
  semi: VIe,
  seswar: UIe,
  setminus: $Ie,
  setmn: WIe,
  sext: jIe,
  Sfr: GIe,
  sfr: KIe,
  sfrown: JIe,
  sharp: QIe,
  SHCHcy: XIe,
  shchcy: YIe,
  SHcy: ZIe,
  shcy: ePe,
  ShortDownArrow: tPe,
  ShortLeftArrow: rPe,
  shortmid: nPe,
  shortparallel: iPe,
  ShortRightArrow: aPe,
  ShortUpArrow: oPe,
  shy: sPe,
  Sigma: lPe,
  sigma: uPe,
  sigmaf: cPe,
  sigmav: fPe,
  sim: dPe,
  simdot: hPe,
  sime: pPe,
  simeq: vPe,
  simg: mPe,
  simgE: gPe,
  siml: yPe,
  simlE: kPe,
  simne: wPe,
  simplus: bPe,
  simrarr: CPe,
  slarr: TPe,
  SmallCircle: SPe,
  smallsetminus: xPe,
  smashp: EPe,
  smeparsl: MPe,
  smid: NPe,
  smile: OPe,
  smt: DPe,
  smte: APe,
  smtes: LPe,
  SOFTcy: RPe,
  softcy: IPe,
  solbar: PPe,
  solb: BPe,
  sol: FPe,
  Sopf: _Pe,
  sopf: qPe,
  spades: zPe,
  spadesuit: HPe,
  spar: VPe,
  sqcap: UPe,
  sqcaps: $Pe,
  sqcup: WPe,
  sqcups: jPe,
  Sqrt: GPe,
  sqsub: KPe,
  sqsube: JPe,
  sqsubset: QPe,
  sqsubseteq: XPe,
  sqsup: YPe,
  sqsupe: ZPe,
  sqsupset: eBe,
  sqsupseteq: tBe,
  square: rBe,
  Square: nBe,
  SquareIntersection: iBe,
  SquareSubset: aBe,
  SquareSubsetEqual: oBe,
  SquareSuperset: sBe,
  SquareSupersetEqual: lBe,
  SquareUnion: uBe,
  squarf: cBe,
  squ: fBe,
  squf: dBe,
  srarr: hBe,
  Sscr: pBe,
  sscr: vBe,
  ssetmn: mBe,
  ssmile: gBe,
  sstarf: yBe,
  Star: kBe,
  star: wBe,
  starf: bBe,
  straightepsilon: CBe,
  straightphi: TBe,
  strns: SBe,
  sub: xBe,
  Sub: EBe,
  subdot: MBe,
  subE: NBe,
  sube: OBe,
  subedot: DBe,
  submult: ABe,
  subnE: LBe,
  subne: RBe,
  subplus: IBe,
  subrarr: PBe,
  subset: BBe,
  Subset: FBe,
  subseteq: _Be,
  subseteqq: qBe,
  SubsetEqual: zBe,
  subsetneq: HBe,
  subsetneqq: VBe,
  subsim: UBe,
  subsub: $Be,
  subsup: WBe,
  succapprox: jBe,
  succ: GBe,
  succcurlyeq: KBe,
  Succeeds: JBe,
  SucceedsEqual: QBe,
  SucceedsSlantEqual: XBe,
  SucceedsTilde: YBe,
  succeq: ZBe,
  succnapprox: eFe,
  succneqq: tFe,
  succnsim: rFe,
  succsim: nFe,
  SuchThat: iFe,
  sum: aFe,
  Sum: oFe,
  sung: sFe,
  sup1: lFe,
  sup2: uFe,
  sup3: cFe,
  sup: fFe,
  Sup: dFe,
  supdot: hFe,
  supdsub: pFe,
  supE: vFe,
  supe: mFe,
  supedot: gFe,
  Superset: yFe,
  SupersetEqual: kFe,
  suphsol: wFe,
  suphsub: bFe,
  suplarr: CFe,
  supmult: TFe,
  supnE: SFe,
  supne: xFe,
  supplus: EFe,
  supset: MFe,
  Supset: NFe,
  supseteq: OFe,
  supseteqq: DFe,
  supsetneq: AFe,
  supsetneqq: LFe,
  supsim: RFe,
  supsub: IFe,
  supsup: PFe,
  swarhk: BFe,
  swarr: FFe,
  swArr: _Fe,
  swarrow: qFe,
  swnwar: zFe,
  szlig: HFe,
  Tab: VFe,
  target: UFe,
  Tau: $Fe,
  tau: WFe,
  tbrk: jFe,
  Tcaron: GFe,
  tcaron: KFe,
  Tcedil: JFe,
  tcedil: QFe,
  Tcy: XFe,
  tcy: YFe,
  tdot: ZFe,
  telrec: e_e,
  Tfr: t_e,
  tfr: r_e,
  there4: n_e,
  therefore: i_e,
  Therefore: a_e,
  Theta: o_e,
  theta: s_e,
  thetasym: l_e,
  thetav: u_e,
  thickapprox: c_e,
  thicksim: f_e,
  ThickSpace: d_e,
  ThinSpace: h_e,
  thinsp: p_e,
  thkap: v_e,
  thksim: m_e,
  THORN: g_e,
  thorn: y_e,
  tilde: k_e,
  Tilde: w_e,
  TildeEqual: b_e,
  TildeFullEqual: C_e,
  TildeTilde: T_e,
  timesbar: S_e,
  timesb: x_e,
  times: E_e,
  timesd: M_e,
  tint: N_e,
  toea: O_e,
  topbot: D_e,
  topcir: A_e,
  top: L_e,
  Topf: R_e,
  topf: I_e,
  topfork: P_e,
  tosa: B_e,
  tprime: F_e,
  trade: __e,
  TRADE: q_e,
  triangle: z_e,
  triangledown: H_e,
  triangleleft: V_e,
  trianglelefteq: U_e,
  triangleq: $_e,
  triangleright: W_e,
  trianglerighteq: j_e,
  tridot: G_e,
  trie: K_e,
  triminus: J_e,
  TripleDot: Q_e,
  triplus: X_e,
  trisb: Y_e,
  tritime: Z_e,
  trpezium: e2e,
  Tscr: t2e,
  tscr: r2e,
  TScy: n2e,
  tscy: i2e,
  TSHcy: a2e,
  tshcy: o2e,
  Tstrok: s2e,
  tstrok: l2e,
  twixt: u2e,
  twoheadleftarrow: c2e,
  twoheadrightarrow: f2e,
  Uacute: d2e,
  uacute: h2e,
  uarr: p2e,
  Uarr: v2e,
  uArr: m2e,
  Uarrocir: g2e,
  Ubrcy: y2e,
  ubrcy: k2e,
  Ubreve: w2e,
  ubreve: b2e,
  Ucirc: C2e,
  ucirc: T2e,
  Ucy: S2e,
  ucy: x2e,
  udarr: E2e,
  Udblac: M2e,
  udblac: N2e,
  udhar: O2e,
  ufisht: D2e,
  Ufr: A2e,
  ufr: L2e,
  Ugrave: R2e,
  ugrave: I2e,
  uHar: P2e,
  uharl: B2e,
  uharr: F2e,
  uhblk: _2e,
  ulcorn: q2e,
  ulcorner: z2e,
  ulcrop: H2e,
  ultri: V2e,
  Umacr: U2e,
  umacr: $2e,
  uml: W2e,
  UnderBar: j2e,
  UnderBrace: G2e,
  UnderBracket: K2e,
  UnderParenthesis: J2e,
  Union: Q2e,
  UnionPlus: X2e,
  Uogon: Y2e,
  uogon: Z2e,
  Uopf: eqe,
  uopf: tqe,
  UpArrowBar: rqe,
  uparrow: nqe,
  UpArrow: iqe,
  Uparrow: aqe,
  UpArrowDownArrow: oqe,
  updownarrow: sqe,
  UpDownArrow: lqe,
  Updownarrow: uqe,
  UpEquilibrium: cqe,
  upharpoonleft: fqe,
  upharpoonright: dqe,
  uplus: hqe,
  UpperLeftArrow: pqe,
  UpperRightArrow: vqe,
  upsi: mqe,
  Upsi: gqe,
  upsih: yqe,
  Upsilon: kqe,
  upsilon: wqe,
  UpTeeArrow: bqe,
  UpTee: Cqe,
  upuparrows: Tqe,
  urcorn: Sqe,
  urcorner: xqe,
  urcrop: Eqe,
  Uring: Mqe,
  uring: Nqe,
  urtri: Oqe,
  Uscr: Dqe,
  uscr: Aqe,
  utdot: Lqe,
  Utilde: Rqe,
  utilde: Iqe,
  utri: Pqe,
  utrif: Bqe,
  uuarr: Fqe,
  Uuml: _qe,
  uuml: qqe,
  uwangle: zqe,
  vangrt: Hqe,
  varepsilon: Vqe,
  varkappa: Uqe,
  varnothing: $qe,
  varphi: Wqe,
  varpi: jqe,
  varpropto: Gqe,
  varr: Kqe,
  vArr: Jqe,
  varrho: Qqe,
  varsigma: Xqe,
  varsubsetneq: Yqe,
  varsubsetneqq: Zqe,
  varsupsetneq: eze,
  varsupsetneqq: tze,
  vartheta: rze,
  vartriangleleft: nze,
  vartriangleright: ize,
  vBar: aze,
  Vbar: oze,
  vBarv: sze,
  Vcy: lze,
  vcy: uze,
  vdash: cze,
  vDash: fze,
  Vdash: dze,
  VDash: hze,
  Vdashl: pze,
  veebar: vze,
  vee: mze,
  Vee: gze,
  veeeq: yze,
  vellip: kze,
  verbar: wze,
  Verbar: bze,
  vert: Cze,
  Vert: Tze,
  VerticalBar: Sze,
  VerticalLine: xze,
  VerticalSeparator: Eze,
  VerticalTilde: Mze,
  VeryThinSpace: Nze,
  Vfr: Oze,
  vfr: Dze,
  vltri: Aze,
  vnsub: Lze,
  vnsup: Rze,
  Vopf: Ize,
  vopf: Pze,
  vprop: Bze,
  vrtri: Fze,
  Vscr: _ze,
  vscr: qze,
  vsubnE: zze,
  vsubne: Hze,
  vsupnE: Vze,
  vsupne: Uze,
  Vvdash: $ze,
  vzigzag: Wze,
  Wcirc: jze,
  wcirc: Gze,
  wedbar: Kze,
  wedge: Jze,
  Wedge: Qze,
  wedgeq: Xze,
  weierp: Yze,
  Wfr: Zze,
  wfr: eHe,
  Wopf: tHe,
  wopf: rHe,
  wp: nHe,
  wr: iHe,
  wreath: aHe,
  Wscr: oHe,
  wscr: sHe,
  xcap: lHe,
  xcirc: uHe,
  xcup: cHe,
  xdtri: fHe,
  Xfr: dHe,
  xfr: hHe,
  xharr: pHe,
  xhArr: vHe,
  Xi: mHe,
  xi: gHe,
  xlarr: yHe,
  xlArr: kHe,
  xmap: wHe,
  xnis: bHe,
  xodot: CHe,
  Xopf: THe,
  xopf: SHe,
  xoplus: xHe,
  xotime: EHe,
  xrarr: MHe,
  xrArr: NHe,
  Xscr: OHe,
  xscr: DHe,
  xsqcup: AHe,
  xuplus: LHe,
  xutri: RHe,
  xvee: IHe,
  xwedge: PHe,
  Yacute: BHe,
  yacute: FHe,
  YAcy: _He,
  yacy: qHe,
  Ycirc: zHe,
  ycirc: HHe,
  Ycy: VHe,
  ycy: UHe,
  yen: $He,
  Yfr: WHe,
  yfr: jHe,
  YIcy: GHe,
  yicy: KHe,
  Yopf: JHe,
  yopf: QHe,
  Yscr: XHe,
  yscr: YHe,
  YUcy: ZHe,
  yucy: e3e,
  yuml: t3e,
  Yuml: r3e,
  Zacute: n3e,
  zacute: i3e,
  Zcaron: a3e,
  zcaron: o3e,
  Zcy: s3e,
  zcy: l3e,
  Zdot: u3e,
  zdot: c3e,
  zeetrf: f3e,
  ZeroWidthSpace: d3e,
  Zeta: h3e,
  zeta: p3e,
  zfr: v3e,
  Zfr: m3e,
  ZHcy: g3e,
  zhcy: y3e,
  zigrarr: k3e,
  zopf: w3e,
  Zopf: b3e,
  Zscr: C3e,
  zscr: T3e,
  zwj: S3e,
  zwnj: x3e
}, E3e = "Á", M3e = "á", N3e = "Â", O3e = "â", D3e = "´", A3e = "Æ", L3e = "æ", R3e = "À", I3e = "à", P3e = "&", B3e = "&", F3e = "Å", _3e = "å", q3e = "Ã", z3e = "ã", H3e = "Ä", V3e = "ä", U3e = "¦", $3e = "Ç", W3e = "ç", j3e = "¸", G3e = "¢", K3e = "©", J3e = "©", Q3e = "¤", X3e = "°", Y3e = "÷", Z3e = "É", eVe = "é", tVe = "Ê", rVe = "ê", nVe = "È", iVe = "è", aVe = "Ð", oVe = "ð", sVe = "Ë", lVe = "ë", uVe = "½", cVe = "¼", fVe = "¾", dVe = ">", hVe = ">", pVe = "Í", vVe = "í", mVe = "Î", gVe = "î", yVe = "¡", kVe = "Ì", wVe = "ì", bVe = "¿", CVe = "Ï", TVe = "ï", SVe = "«", xVe = "<", EVe = "<", MVe = "¯", NVe = "µ", OVe = "·", DVe = " ", AVe = "¬", LVe = "Ñ", RVe = "ñ", IVe = "Ó", PVe = "ó", BVe = "Ô", FVe = "ô", _Ve = "Ò", qVe = "ò", zVe = "ª", HVe = "º", VVe = "Ø", UVe = "ø", $Ve = "Õ", WVe = "õ", jVe = "Ö", GVe = "ö", KVe = "¶", JVe = "±", QVe = "£", XVe = '"', YVe = '"', ZVe = "»", eUe = "®", tUe = "®", rUe = "§", nUe = "­", iUe = "¹", aUe = "²", oUe = "³", sUe = "ß", lUe = "Þ", uUe = "þ", cUe = "×", fUe = "Ú", dUe = "ú", hUe = "Û", pUe = "û", vUe = "Ù", mUe = "ù", gUe = "¨", yUe = "Ü", kUe = "ü", wUe = "Ý", bUe = "ý", CUe = "¥", TUe = "ÿ", SUe = {
  Aacute: E3e,
  aacute: M3e,
  Acirc: N3e,
  acirc: O3e,
  acute: D3e,
  AElig: A3e,
  aelig: L3e,
  Agrave: R3e,
  agrave: I3e,
  amp: P3e,
  AMP: B3e,
  Aring: F3e,
  aring: _3e,
  Atilde: q3e,
  atilde: z3e,
  Auml: H3e,
  auml: V3e,
  brvbar: U3e,
  Ccedil: $3e,
  ccedil: W3e,
  cedil: j3e,
  cent: G3e,
  copy: K3e,
  COPY: J3e,
  curren: Q3e,
  deg: X3e,
  divide: Y3e,
  Eacute: Z3e,
  eacute: eVe,
  Ecirc: tVe,
  ecirc: rVe,
  Egrave: nVe,
  egrave: iVe,
  ETH: aVe,
  eth: oVe,
  Euml: sVe,
  euml: lVe,
  frac12: uVe,
  frac14: cVe,
  frac34: fVe,
  gt: dVe,
  GT: hVe,
  Iacute: pVe,
  iacute: vVe,
  Icirc: mVe,
  icirc: gVe,
  iexcl: yVe,
  Igrave: kVe,
  igrave: wVe,
  iquest: bVe,
  Iuml: CVe,
  iuml: TVe,
  laquo: SVe,
  lt: xVe,
  LT: EVe,
  macr: MVe,
  micro: NVe,
  middot: OVe,
  nbsp: DVe,
  not: AVe,
  Ntilde: LVe,
  ntilde: RVe,
  Oacute: IVe,
  oacute: PVe,
  Ocirc: BVe,
  ocirc: FVe,
  Ograve: _Ve,
  ograve: qVe,
  ordf: zVe,
  ordm: HVe,
  Oslash: VVe,
  oslash: UVe,
  Otilde: $Ve,
  otilde: WVe,
  Ouml: jVe,
  ouml: GVe,
  para: KVe,
  plusmn: JVe,
  pound: QVe,
  quot: XVe,
  QUOT: YVe,
  raquo: ZVe,
  reg: eUe,
  REG: tUe,
  sect: rUe,
  shy: nUe,
  sup1: iUe,
  sup2: aUe,
  sup3: oUe,
  szlig: sUe,
  THORN: lUe,
  thorn: uUe,
  times: cUe,
  Uacute: fUe,
  uacute: dUe,
  Ucirc: hUe,
  ucirc: pUe,
  Ugrave: vUe,
  ugrave: mUe,
  uml: gUe,
  Uuml: yUe,
  uuml: kUe,
  Yacute: wUe,
  yacute: bUe,
  yen: CUe,
  yuml: TUe
}, xUe = "&", EUe = "'", MUe = ">", NUe = "<", OUe = '"', Kx = {
  amp: xUe,
  apos: EUe,
  gt: MUe,
  lt: NUe,
  quot: OUe
}, Nk = {}, DUe = {
  0: 65533,
  128: 8364,
  130: 8218,
  131: 402,
  132: 8222,
  133: 8230,
  134: 8224,
  135: 8225,
  136: 710,
  137: 8240,
  138: 352,
  139: 8249,
  140: 338,
  142: 381,
  145: 8216,
  146: 8217,
  147: 8220,
  148: 8221,
  149: 8226,
  150: 8211,
  151: 8212,
  152: 732,
  153: 8482,
  154: 353,
  155: 8250,
  156: 339,
  158: 382,
  159: 376
}, AUe = hf && hf.__importDefault || function(r) {
  return r && r.__esModule ? r : { default: r };
};
Object.defineProperty(Nk, "__esModule", { value: !0 });
var Gb = AUe(DUe), LUe = (
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  String.fromCodePoint || function(r) {
    var e = "";
    return r > 65535 && (r -= 65536, e += String.fromCharCode(r >>> 10 & 1023 | 55296), r = 56320 | r & 1023), e += String.fromCharCode(r), e;
  }
);
function RUe(r) {
  return r >= 55296 && r <= 57343 || r > 1114111 ? "�" : (r in Gb.default && (r = Gb.default[r]), LUe(r));
}
Nk.default = RUe;
var zm = hf && hf.__importDefault || function(r) {
  return r && r.__esModule ? r : { default: r };
};
Object.defineProperty(xs, "__esModule", { value: !0 });
xs.decodeHTML = xs.decodeHTMLStrict = xs.decodeXML = void 0;
var S0 = zm(Gx), IUe = zm(SUe), PUe = zm(Kx), Kb = zm(Nk), BUe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
xs.decodeXML = Jx(PUe.default);
xs.decodeHTMLStrict = Jx(S0.default);
function Jx(r) {
  var e = Qx(r);
  return function(t) {
    return String(t).replace(BUe, e);
  };
}
var Jb = function(r, e) {
  return r < e ? 1 : -1;
};
xs.decodeHTML = (function() {
  for (var r = Object.keys(IUe.default).sort(Jb), e = Object.keys(S0.default).sort(Jb), t = 0, n = 0; t < e.length; t++)
    r[n] === e[t] ? (e[t] += ";?", n++) : e[t] += ";";
  var i = new RegExp("&(?:" + e.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"), a = Qx(S0.default);
  function s(u) {
    return u.substr(-1) !== ";" && (u += ";"), a(u);
  }
  return function(u) {
    return String(u).replace(i, s);
  };
})();
function Qx(r) {
  return function(t) {
    if (t.charAt(1) === "#") {
      var n = t.charAt(2);
      return n === "X" || n === "x" ? Kb.default(parseInt(t.substr(3), 16)) : Kb.default(parseInt(t.substr(2), 10));
    }
    return r[t.slice(1, -1)] || t;
  };
}
var fa = {}, Xx = hf && hf.__importDefault || function(r) {
  return r && r.__esModule ? r : { default: r };
};
Object.defineProperty(fa, "__esModule", { value: !0 });
fa.escapeUTF8 = fa.escape = fa.encodeNonAsciiHTML = fa.encodeHTML = fa.encodeXML = void 0;
var FUe = Xx(Kx), Yx = eE(FUe.default), Zx = tE(Yx);
fa.encodeXML = iE(Yx);
var _Ue = Xx(Gx), Ok = eE(_Ue.default), qUe = tE(Ok);
fa.encodeHTML = HUe(Ok, qUe);
fa.encodeNonAsciiHTML = iE(Ok);
function eE(r) {
  return Object.keys(r).sort().reduce(function(e, t) {
    return e[r[t]] = "&" + t + ";", e;
  }, {});
}
function tE(r) {
  for (var e = [], t = [], n = 0, i = Object.keys(r); n < i.length; n++) {
    var a = i[n];
    a.length === 1 ? e.push("\\" + a) : t.push(a);
  }
  e.sort();
  for (var s = 0; s < e.length - 1; s++) {
    for (var u = s; u < e.length - 1 && e[u].charCodeAt(1) + 1 === e[u + 1].charCodeAt(1); )
      u += 1;
    var f = 1 + u - s;
    f < 3 || e.splice(s, f, e[s] + "-" + e[u]);
  }
  return t.unshift("[" + e.join("") + "]"), new RegExp(t.join("|"), "g");
}
var rE = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, zUe = (
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  String.prototype.codePointAt != null ? (
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
    function(r) {
      return r.codePointAt(0);
    }
  ) : (
    // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
    function(r) {
      return (r.charCodeAt(0) - 55296) * 1024 + r.charCodeAt(1) - 56320 + 65536;
    }
  )
);
function Hm(r) {
  return "&#x" + (r.length > 1 ? zUe(r) : r.charCodeAt(0)).toString(16).toUpperCase() + ";";
}
function HUe(r, e) {
  return function(t) {
    return t.replace(e, function(n) {
      return r[n];
    }).replace(rE, Hm);
  };
}
var nE = new RegExp(Zx.source + "|" + rE.source, "g");
function VUe(r) {
  return r.replace(nE, Hm);
}
fa.escape = VUe;
function UUe(r) {
  return r.replace(Zx, Hm);
}
fa.escapeUTF8 = UUe;
function iE(r) {
  return function(e) {
    return e.replace(nE, function(t) {
      return r[t] || Hm(t);
    });
  };
}
(function(r) {
  Object.defineProperty(r, "__esModule", { value: !0 }), r.decodeXMLStrict = r.decodeHTML5Strict = r.decodeHTML4Strict = r.decodeHTML5 = r.decodeHTML4 = r.decodeHTMLStrict = r.decodeHTML = r.decodeXML = r.encodeHTML5 = r.encodeHTML4 = r.escapeUTF8 = r.escape = r.encodeNonAsciiHTML = r.encodeHTML = r.encodeXML = r.encode = r.decodeStrict = r.decode = void 0;
  var e = xs, t = fa;
  function n(f, p) {
    return (!p || p <= 0 ? e.decodeXML : e.decodeHTML)(f);
  }
  r.decode = n;
  function i(f, p) {
    return (!p || p <= 0 ? e.decodeXML : e.decodeHTMLStrict)(f);
  }
  r.decodeStrict = i;
  function a(f, p) {
    return (!p || p <= 0 ? t.encodeXML : t.encodeHTML)(f);
  }
  r.encode = a;
  var s = fa;
  Object.defineProperty(r, "encodeXML", { enumerable: !0, get: function() {
    return s.encodeXML;
  } }), Object.defineProperty(r, "encodeHTML", { enumerable: !0, get: function() {
    return s.encodeHTML;
  } }), Object.defineProperty(r, "encodeNonAsciiHTML", { enumerable: !0, get: function() {
    return s.encodeNonAsciiHTML;
  } }), Object.defineProperty(r, "escape", { enumerable: !0, get: function() {
    return s.escape;
  } }), Object.defineProperty(r, "escapeUTF8", { enumerable: !0, get: function() {
    return s.escapeUTF8;
  } }), Object.defineProperty(r, "encodeHTML4", { enumerable: !0, get: function() {
    return s.encodeHTML;
  } }), Object.defineProperty(r, "encodeHTML5", { enumerable: !0, get: function() {
    return s.encodeHTML;
  } });
  var u = xs;
  Object.defineProperty(r, "decodeXML", { enumerable: !0, get: function() {
    return u.decodeXML;
  } }), Object.defineProperty(r, "decodeHTML", { enumerable: !0, get: function() {
    return u.decodeHTML;
  } }), Object.defineProperty(r, "decodeHTMLStrict", { enumerable: !0, get: function() {
    return u.decodeHTMLStrict;
  } }), Object.defineProperty(r, "decodeHTML4", { enumerable: !0, get: function() {
    return u.decodeHTML;
  } }), Object.defineProperty(r, "decodeHTML5", { enumerable: !0, get: function() {
    return u.decodeHTML;
  } }), Object.defineProperty(r, "decodeHTML4Strict", { enumerable: !0, get: function() {
    return u.decodeHTMLStrict;
  } }), Object.defineProperty(r, "decodeHTML5Strict", { enumerable: !0, get: function() {
    return u.decodeHTMLStrict;
  } }), Object.defineProperty(r, "decodeXMLStrict", { enumerable: !0, get: function() {
    return u.decodeXML;
  } });
})(Mk);
var aE = "&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});", $Ue = 92, WUe = /[\\&]/, Dk = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]", jUe = new RegExp("\\\\" + Dk + "|" + aE, "gi"), GUe = '[&<>"]', Qb = new RegExp(GUe, "g"), KUe = function(r) {
  return r.charCodeAt(0) === $Ue ? r.charAt(1) : Mk.decodeHTML(r);
};
function fh(r) {
  return WUe.test(r) ? r.replace(jUe, KUe) : r;
}
function Mv(r) {
  try {
    return loe(r);
  } catch {
    return r;
  }
}
function JUe(r) {
  switch (r) {
    case "&":
      return "&amp;";
    case "<":
      return "&lt;";
    case ">":
      return "&gt;";
    case '"':
      return "&quot;";
    default:
      return r;
  }
}
function Qc(r) {
  return Qb.test(r) ? r.replace(Qb, JUe) : r;
}
function x0(r, e) {
  for (var t = [], n = 0; n < e; n++)
    t.push(r);
  return t.join("");
}
function Xb(r) {
  return r ? !/[^ \t]+/.test(r) : !0;
}
var QUe = (
  /** @class */
  (function() {
    function r(e) {
      this.current = e, this.root = e, this.entering = !0;
    }
    return r.prototype.next = function() {
      var e = this.current, t = this.entering;
      if (e === null)
        return null;
      var n = Ak(e);
      return t && n ? e.firstChild ? (this.current = e.firstChild, this.entering = !0) : this.entering = !1 : e === this.root ? this.current = null : e.next === null ? (this.current = e.parent, this.entering = !1) : (this.current = e.next, this.entering = !0), { entering: t, node: e };
    }, r.prototype.resumeAt = function(e, t) {
      this.current = e, this.entering = t === !0;
    }, r;
  })()
);
function Ak(r) {
  switch (r.type) {
    case "document":
    case "blockQuote":
    case "list":
    case "item":
    case "paragraph":
    case "heading":
    case "emph":
    case "strong":
    case "strike":
    case "link":
    case "image":
    case "table":
    case "tableHead":
    case "tableBody":
    case "tableRow":
    case "tableCell":
    case "tableDelimRow":
    case "customInline":
      return !0;
    default:
      return !1;
  }
}
var XUe = 1, Vm = {};
function YUe(r) {
  return Vm[r];
}
function E0(r) {
  delete Vm[r];
}
function ZUe() {
  Vm = {};
}
var Nh = (
  /** @class */
  (function() {
    function r(e, t) {
      this.parent = null, this.prev = null, this.next = null, this.firstChild = null, this.lastChild = null, this.literal = null, e === "document" ? this.id = -1 : this.id = XUe++, this.type = e, this.sourcepos = t, Vm[this.id] = this;
    }
    return r.prototype.isContainer = function() {
      return Ak(this);
    }, r.prototype.unlink = function() {
      this.prev ? this.prev.next = this.next : this.parent && (this.parent.firstChild = this.next), this.next ? this.next.prev = this.prev : this.parent && (this.parent.lastChild = this.prev), this.parent = null, this.next = null, this.prev = null;
    }, r.prototype.replaceWith = function(e) {
      this.insertBefore(e), this.unlink();
    }, r.prototype.insertAfter = function(e) {
      e.unlink(), e.next = this.next, e.next && (e.next.prev = e), e.prev = this, this.next = e, this.parent && (e.parent = this.parent, e.next || (e.parent.lastChild = e));
    }, r.prototype.insertBefore = function(e) {
      e.unlink(), e.prev = this.prev, e.prev && (e.prev.next = e), e.next = this, this.prev = e, e.parent = this.parent, e.prev || (e.parent.firstChild = e);
    }, r.prototype.appendChild = function(e) {
      e.unlink(), e.parent = this, this.lastChild ? (this.lastChild.next = e, e.prev = this.lastChild, this.lastChild = e) : (this.firstChild = e, this.lastChild = e);
    }, r.prototype.prependChild = function(e) {
      e.unlink(), e.parent = this, this.firstChild ? (this.firstChild.prev = e, e.next = this.firstChild, this.firstChild = e) : (this.firstChild = e, this.lastChild = e);
    }, r.prototype.walker = function() {
      return new QUe(this);
    }, r;
  })()
), Ns = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e(t, n) {
      var i = r.call(this, t, n) || this;
      return i.open = !0, i.lineOffsets = null, i.stringContent = null, i.lastLineBlank = !1, i.lastLineChecked = !1, i.type = t, i;
    }
    return e;
  })(Nh)
), e$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.listData = null, t;
    }
    return e;
  })(Ns)
), t$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.level = 0, t.headingType = "atx", t;
    }
    return e;
  })(Ns)
), r$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.isFenced = !1, t.fenceChar = null, t.fenceLength = 0, t.fenceOffset = -1, t.info = null, t.infoPadding = 0, t;
    }
    return e;
  })(Ns)
), n$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.columns = [], t;
    }
    return e;
  })(Ns)
), i$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.startIdx = 0, t.endIdx = 0, t.paddingLeft = 0, t.paddingRight = 0, t.ignored = !1, t;
    }
    return e;
  })(Ns)
), a$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.title = "", t.dest = "", t.label = "", t;
    }
    return e;
  })(Ns)
), o$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.syntaxLength = 0, t.offset = -1, t.info = "", t;
    }
    return e;
  })(Ns)
), s$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.htmlBlockType = -1, t;
    }
    return e;
  })(Ns)
), l$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.destination = null, t.title = null, t.extendedAutolink = !1, t;
    }
    return e;
  })(Nh)
), u$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.tickCount = 0, t;
    }
    return e;
  })(Nh)
), c$e = (
  /** @class */
  (function(r) {
    Na(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.info = "", t;
    }
    return e;
  })(Nh)
);
function ln(r, e) {
  switch (r) {
    case "heading":
      return new t$e(r, e);
    case "list":
    case "item":
      return new e$e(r, e);
    case "link":
    case "image":
      return new l$e(r, e);
    case "codeBlock":
      return new r$e(r, e);
    case "htmlBlock":
      return new s$e(r, e);
    case "table":
      return new n$e(r, e);
    case "tableCell":
      return new i$e(r, e);
    case "document":
    case "paragraph":
    case "blockQuote":
    case "thematicBreak":
    case "tableRow":
    case "tableBody":
    case "tableHead":
    case "frontMatter":
      return new Ns(r, e);
    case "code":
      return new u$e(r, e);
    case "refDef":
      return new a$e(r, e);
    case "customBlock":
      return new o$e(r, e);
    case "customInline":
      return new c$e(r, e);
    default:
      return new Nh(r, e);
  }
}
function oE(r) {
  return r.type === "codeBlock";
}
function f$e(r) {
  return r.type === "htmlBlock";
}
function d$e(r) {
  return r.type === "heading";
}
function Yb(r) {
  return r.type === "list";
}
function h$e(r) {
  return r.type === "table";
}
function $c(r) {
  return r.type === "refDef";
}
function sE(r) {
  return r.type === "customBlock";
}
function p$e(r) {
  return r.type === "customInline";
}
function Tn(r, e) {
  var t = ln("text", e);
  return t.literal = r, t;
}
var lE = "[A-Za-z][A-Za-z0-9-]*", v$e = "[a-zA-Z_:][a-zA-Z0-9:._-]*", m$e = "[^\"'=<>`\\x00-\\x20]+", g$e = "'[^']*'", y$e = '"[^"]*"', k$e = "(?:" + m$e + "|" + g$e + "|" + y$e + ")", w$e = "(?:\\s*=\\s*" + k$e + ")", b$e = "(?:\\s+" + v$e + w$e + "?)", uE = "<" + lE + b$e + "*\\s*/?>", cE = "</" + lE + "\\s*[>]", C$e = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->", T$e = "[<][?].*?[?][>]", S$e = "<![A-Z]+\\s+[^>]*>", x$e = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>", E$e = "(?:" + uE + "|" + cE + "|" + C$e + "|" + T$e + "|" + S$e + "|" + x$e + ")", M$e = new RegExp("^" + E$e, "i");
var M0;
if (String.fromCodePoint)
  M0 = function(r) {
    try {
      return String.fromCodePoint(r);
    } catch (e) {
      if (e instanceof RangeError)
        return "�";
      throw e;
    }
  };
else {
  var N$e = String.fromCharCode, O$e = Math.floor;
  M0 = function() {
    for (var r = [], e = 0; e < arguments.length; e++)
      r[e] = arguments[e];
    var t = 16384, n = [], i, a, s = -1, u = r.length;
    if (!u)
      return "";
    for (var f = ""; ++s < u; ) {
      var p = Number(r[s]);
      if (!isFinite(p) || // `NaN`, `+Infinity`, or `-Infinity`
      p < 0 || // not a valid Unicode code point
      p > 1114111 || // not a valid Unicode code point
      O$e(p) !== p)
        return "�";
      p <= 65535 ? n.push(p) : (p -= 65536, i = (p >> 10) + 55296, a = p % 1024 + 56320, n.push(i, a)), (s + 1 === u || n.length > t) && (f += N$e.apply(void 0, n), n.length = 0);
    }
    return f;
  };
}
var Iy = M0, D$e = "(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+", A$e = "[^<\\s]*[^<?!.,:*_?~\\s]", L$e = "[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+";
function R$e(r) {
  var e = /\)+$/.exec(r);
  if (e) {
    for (var t = 0, n = 0, i = r; n < i.length; n++) {
      var a = i[n];
      a === "(" ? t < 0 ? t = 1 : t += 1 : a === ")" && (t -= 1);
    }
    if (t < 0) {
      var s = Math.min(-t, e[0].length);
      return r.substring(0, r.length - s);
    }
  }
  return r;
}
function I$e(r) {
  return r.replace(/&[A-Za-z0-9]+;$/, "");
}
function P$e(r) {
  for (var e = new RegExp(L$e, "g"), t = [], n; n = e.exec(r); ) {
    var i = n[0];
    /[_-]+$/.test(i) || t.push({
      text: i,
      range: [n.index, n.index + i.length - 1],
      url: "mailto:" + i
    });
  }
  return t;
}
function B$e(r) {
  for (var e = new RegExp("(www|https?://)." + D$e + A$e, "g"), t = [], n; n = e.exec(r); ) {
    var i = I$e(R$e(n[0])), a = n[1] === "www" ? "http://" : "";
    t.push({
      text: i,
      range: [n.index, n.index + i.length - 1],
      url: "" + a + i
    });
  }
  return t;
}
function F$e(r) {
  return T0(T0([], B$e(r)), P$e(r)).sort(function(e, t) {
    return e.range[0] - t.range[0];
  });
}
function _$e(r, e) {
  typeof e == "boolean" && (e = F$e);
  for (var t, n = function() {
    var i = t.entering, a = t.node;
    if (i && a.type === "text" && a.parent.type !== "link") {
      var s = a.literal, u = e(s);
      if (!u || !u.length)
        return "continue";
      for (var f = 0, p = a.sourcepos[0], y = p[0], T = p[1], N = function(Ne, ze) {
        return [
          [y, T + Ne],
          [y, T + ze]
        ];
      }, O = [], A = 0, q = u; A < q.length; A++) {
        var U = q[A], j = U.range, te = U.url, se = U.text;
        j[0] > f && O.push(Tn(s.substring(f, j[0]), N(f, j[0] - 1)));
        var me = ln("link", N.apply(void 0, j));
        me.appendChild(Tn(se, N.apply(void 0, j))), me.destination = te, me.extendedAutolink = !0, O.push(me), f = j[1] + 1;
      }
      f < s.length && O.push(Tn(s.substring(f), N(f, s.length - 1)));
      for (var Ce = 0, pe = O; Ce < pe.length; Ce++) {
        var ke = pe[Ce];
        a.insertBefore(ke);
      }
      a.unlink();
    }
  }; t = r.next(); )
    n();
}
function mm(r) {
  return r[r.length - 1];
}
function Zb(r) {
  return r.slice(1, r.length - 1).trim().replace(/[ \t\r\n]+/, " ").toLowerCase().toUpperCase();
}
function Nv(r, e) {
  Object.keys(r).forEach(function(t) {
    e(t, r[t]);
  });
}
function q$e(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  var n = Xn({}, r);
  return e.forEach(function(i) {
    delete n[i];
  }), n;
}
function Wc(r) {
  return !Object.keys(r).length;
}
function z$e(r) {
  Object.keys(r).forEach(function(e) {
    delete r[e];
  });
}
var N0 = 10, Py = 42, Ov = 95, H$e = 96, eC = 91, V$e = 93, Dv = 126, tC = 60, U$e = 33, rC = 92, $$e = 38, nC = 40, By = 41, W$e = 58, ou = 39, su = 34, lu = 36, Fy = "\\\\" + Dk, iC = new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/), j$e = new RegExp('^(?:"(' + Fy + '|[^"\\x00])*"|' + ("'(" + Fy + "|[^'\\x00])*'") + "|" + ("\\((" + Fy + "|[^()\\x00])*\\))")), G$e = /^(?:<(?:[^<>\n\\\x00]|\\.)*>)/, aC = new RegExp("^" + Dk), K$e = new RegExp("^" + aE, "i"), J$e = /`+/, Q$e = /^`+/, X$e = /\.\.\./g, Y$e = /--+/g, Z$e = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/, e4e = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i, t4e = /^ *(?:\n *)?/, _y = /^[ \t\n\x0b\x0c\x0d]/, oC = /^\s/, r4e = / *$/, n4e = /^ */, sC = /^ *(?:\n|$)/, i4e = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/, a4e = /^[^\n`\[\]\\!<&*_'"~$]+/m, o4e = (
  /** @class */
  (function() {
    function r(e) {
      this.subject = "", this.delimiters = null, this.brackets = null, this.pos = 0, this.lineStartNum = 0, this.lineIdx = 0, this.lineOffsets = [0], this.linePosOffset = 0, this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.options = e;
    }
    return r.prototype.sourcepos = function(e, t) {
      var n = this.linePosOffset + this.lineOffsets[this.lineIdx], i = this.lineStartNum + this.lineIdx, a = [i, e + n];
      return typeof t == "number" ? [a, [i, t + n]] : a;
    }, r.prototype.nextLine = function() {
      this.lineIdx += 1, this.linePosOffset = -this.pos;
    }, r.prototype.match = function(e) {
      var t = e.exec(this.subject.slice(this.pos));
      return t === null ? null : (this.pos += t.index + t[0].length, t[0]);
    }, r.prototype.peek = function() {
      return this.pos < this.subject.length ? this.subject.charCodeAt(this.pos) : -1;
    }, r.prototype.spnl = function() {
      return this.match(t4e), !0;
    }, r.prototype.parseBackticks = function(e) {
      var t = this.pos + 1, n = this.match(Q$e);
      if (n === null)
        return !1;
      for (var i = this.pos, a; (a = this.match(J$e)) !== null; )
        if (a === n) {
          var s = this.subject.slice(i, this.pos - n.length), u = this.sourcepos(t, this.pos), f = s.split(`
`);
          if (f.length > 1) {
            var p = mm(f);
            this.lineIdx += f.length - 1, this.linePosOffset = -(this.pos - p.length - n.length), u[1] = this.sourcepos(this.pos), s = f.join(" ");
          }
          var y = ln("code", u);
          return s.length > 0 && s.match(/[^ ]/) !== null && s[0] == " " && s[s.length - 1] == " " ? y.literal = s.slice(1, s.length - 1) : y.literal = s, y.tickCount = n.length, e.appendChild(y), !0;
        }
      return this.pos = i, e.appendChild(Tn(n, this.sourcepos(t, this.pos - 1))), !0;
    }, r.prototype.parseBackslash = function(e) {
      var t = this.subject, n;
      this.pos += 1;
      var i = this.pos;
      return this.peek() === N0 ? (this.pos += 1, n = ln("linebreak", this.sourcepos(this.pos - 1, this.pos)), e.appendChild(n), this.nextLine()) : aC.test(t.charAt(this.pos)) ? (e.appendChild(Tn(t.charAt(this.pos), this.sourcepos(i, this.pos))), this.pos += 1) : e.appendChild(Tn("\\", this.sourcepos(i, i))), !0;
    }, r.prototype.parseAutolink = function(e) {
      var t, n, i, a = this.pos + 1;
      return (t = this.match(Z$e)) ? (n = t.slice(1, t.length - 1), i = ln("link", this.sourcepos(a, this.pos)), i.destination = Mv("mailto:" + n), i.title = "", i.appendChild(Tn(n, this.sourcepos(a + 1, this.pos - 1))), e.appendChild(i), !0) : (t = this.match(e4e)) ? (n = t.slice(1, t.length - 1), i = ln("link", this.sourcepos(a, this.pos)), i.destination = Mv(n), i.title = "", i.appendChild(Tn(n, this.sourcepos(a + 1, this.pos - 1))), e.appendChild(i), !0) : !1;
    }, r.prototype.parseHtmlTag = function(e) {
      var t = this.pos + 1, n = this.match(M$e);
      if (n === null)
        return !1;
      var i = ln("htmlInline", this.sourcepos(t, this.pos));
      return i.literal = n, e.appendChild(i), !0;
    }, r.prototype.scanDelims = function(e) {
      var t = 0, n = this.pos;
      if (e === ou || e === su)
        t++, this.pos++;
      else
        for (; this.peek() === e; )
          t++, this.pos++;
      if (t === 0 || t < 2 && (e === Dv || e === lu))
        return this.pos = n, null;
      var i = n === 0 ? `
` : this.subject.charAt(n - 1), a = this.peek(), s;
      a === -1 ? s = `
` : s = Iy(a);
      var u = oC.test(s), f = iC.test(s), p = oC.test(i), y = iC.test(i), T = !u && (!f || p || y), N = !p && (!y || u || f), O, A;
      return e === Ov ? (O = T && (!N || y), A = N && (!T || f)) : e === ou || e === su ? (O = T && !N, A = N) : e === lu ? (O = !u, A = !p) : (O = T, A = N), this.pos = n, { numdelims: t, canOpen: O, canClose: A };
    }, r.prototype.handleDelim = function(e, t) {
      var n = this.scanDelims(e);
      if (!n)
        return !1;
      var i = n.numdelims, a = this.pos + 1, s;
      this.pos += i, e === ou ? s = "’" : e === su ? s = "“" : s = this.subject.slice(a - 1, this.pos);
      var u = Tn(s, this.sourcepos(a, this.pos));
      return t.appendChild(u), (n.canOpen || n.canClose) && (this.options.smart || e !== ou && e !== su) && (this.delimiters = {
        cc: e,
        numdelims: i,
        origdelims: i,
        node: u,
        previous: this.delimiters,
        next: null,
        canOpen: n.canOpen,
        canClose: n.canClose
      }, this.delimiters.previous && (this.delimiters.previous.next = this.delimiters)), !0;
    }, r.prototype.removeDelimiter = function(e) {
      e.previous !== null && (e.previous.next = e.next), e.next === null ? this.delimiters = e.previous : e.next.previous = e.previous;
    }, r.prototype.removeDelimitersBetween = function(e, t) {
      e.next !== t && (e.next = t, t.previous = e);
    }, r.prototype.processEmphasis = function(e) {
      var t, n, i, a, s, u, f, p = !1, y = (t = {}, t[Ov] = [e, e, e], t[Py] = [e, e, e], t[ou] = [e], t[su] = [e], t[Dv] = [e], t[lu] = [e], t);
      for (i = this.delimiters; i !== null && i.previous !== e; )
        i = i.previous;
      for (; i !== null; ) {
        var T = i.cc, N = T === Ov || T === Py;
        if (!i.canClose)
          i = i.next;
        else {
          for (n = i.previous, f = !1; n !== null && n !== e && n !== y[T][N ? i.origdelims % 3 : 0]; ) {
            if (p = N && (i.canOpen || n.canClose) && i.origdelims % 3 !== 0 && (n.origdelims + i.origdelims) % 3 === 0, n.cc === i.cc && n.canOpen && !p) {
              f = !0;
              break;
            }
            n = n.previous;
          }
          if (a = i, N || T === Dv || T === lu) {
            if (!f)
              i = i.next;
            else if (n) {
              var O = i.numdelims >= 2 && n.numdelims >= 2 ? 2 : 1, A = N ? 0 : 1;
              s = n.node, u = i.node;
              var q = N ? O === 1 ? "emph" : "strong" : "strike";
              T === lu && (q = "customInline");
              var U = ln(q), j = s.sourcepos[1], te = u.sourcepos[0];
              U.sourcepos = [
                [j[0], j[1] - O + 1],
                [te[0], te[1] + O - 1]
              ], s.sourcepos[1][1] -= O, u.sourcepos[0][1] += O, s.literal = s.literal.slice(O), u.literal = u.literal.slice(O), n.numdelims -= O, i.numdelims -= O;
              for (var se = s.next, me = void 0; se && se !== u; )
                me = se.next, se.unlink(), U.appendChild(se), se = me;
              if (T === lu) {
                var Ce = U.firstChild, pe = Ce.literal || "", ke = pe.split(/\s/)[0];
                U.info = ke, pe.length <= ke.length ? Ce.unlink() : (Ce.sourcepos[0][1] += ke.length, Ce.literal = pe.replace(ke + " ", ""));
              }
              if (s.insertAfter(U), this.removeDelimitersBetween(n, i), n.numdelims <= A && (n.numdelims === 0 && s.unlink(), this.removeDelimiter(n)), i.numdelims <= A) {
                i.numdelims === 0 && u.unlink();
                var Ne = i.next;
                this.removeDelimiter(i), i = Ne;
              }
            }
          } else T === ou ? (i.node.literal = "’", f && (n.node.literal = "‘"), i = i.next) : T === su && (i.node.literal = "”", f && (n.node.literal = "“"), i = i.next);
          f || (y[T][N ? a.origdelims % 3 : 0] = a.previous, a.canOpen || this.removeDelimiter(a));
        }
      }
      for (; this.delimiters !== null && this.delimiters !== e; )
        this.removeDelimiter(this.delimiters);
    }, r.prototype.parseLinkTitle = function() {
      var e = this.match(j$e);
      return e === null ? null : fh(e.substr(1, e.length - 2));
    }, r.prototype.parseLinkDestination = function() {
      var e = this.match(G$e);
      if (e === null) {
        if (this.peek() === tC)
          return null;
        for (var t = this.pos, n = 0, i = void 0; (i = this.peek()) !== -1; )
          if (i === rC && aC.test(this.subject.charAt(this.pos + 1)))
            this.pos += 1, this.peek() !== -1 && (this.pos += 1);
          else if (i === nC)
            this.pos += 1, n += 1;
          else if (i === By) {
            if (n < 1)
              break;
            this.pos += 1, n -= 1;
          } else {
            if (_y.exec(Iy(i)) !== null)
              break;
            this.pos += 1;
          }
        return this.pos === t && i !== By || n !== 0 ? null : (e = this.subject.substr(t, this.pos - t), Mv(fh(e)));
      }
      return Mv(fh(e.substr(1, e.length - 2)));
    }, r.prototype.parseLinkLabel = function() {
      var e = this.match(i4e);
      return e === null || e.length > 1001 ? 0 : e.length;
    }, r.prototype.parseOpenBracket = function(e) {
      var t = this.pos;
      this.pos += 1;
      var n = Tn("[", this.sourcepos(this.pos, this.pos));
      return e.appendChild(n), this.addBracket(n, t, !1), !0;
    }, r.prototype.parseBang = function(e) {
      var t = this.pos;
      if (this.pos += 1, this.peek() === eC) {
        this.pos += 1;
        var n = Tn("![", this.sourcepos(this.pos - 1, this.pos));
        e.appendChild(n), this.addBracket(n, t + 1, !0);
      } else {
        var n = Tn("!", this.sourcepos(this.pos, this.pos));
        e.appendChild(n);
      }
      return !0;
    }, r.prototype.parseCloseBracket = function(e) {
      var t = null, n = null, i = !1;
      this.pos += 1;
      var a = this.pos, s = this.brackets;
      if (s === null)
        return e.appendChild(Tn("]", this.sourcepos(a, a))), !0;
      if (!s.active)
        return e.appendChild(Tn("]", this.sourcepos(a, a))), this.removeBracket(), !0;
      var u = s.image, f = this.pos;
      this.peek() === nC && (this.pos++, this.spnl() && (t = this.parseLinkDestination()) !== null && this.spnl() && // make sure there's a space before the title:
      (_y.test(this.subject.charAt(this.pos - 1)) && (n = this.parseLinkTitle()) || !0) && this.spnl() && this.peek() === By ? (this.pos += 1, i = !0) : this.pos = f);
      var p = "";
      if (!i) {
        var y = this.pos, T = this.parseLinkLabel();
        if (T > 2 ? p = this.subject.slice(y, y + T) : s.bracketAfter || (p = this.subject.slice(s.index, a)), T === 0 && (this.pos = f), p) {
          p = Zb(p);
          var N = this.refMap[p];
          N && (t = N.destination, n = N.title, i = !0);
        }
      }
      if (i) {
        var O = ln(u ? "image" : "link");
        O.destination = t, O.title = n || "", O.sourcepos = [s.startpos, this.sourcepos(this.pos)];
        for (var A = s.node.next, q = void 0; A; )
          q = A.next, A.unlink(), O.appendChild(A), A = q;
        if (e.appendChild(O), this.processEmphasis(s.previousDelimiter), this.removeBracket(), s.node.unlink(), !u)
          for (s = this.brackets; s !== null; )
            s.image || (s.active = !1), s = s.previous;
        return this.options.referenceDefinition && (this.refLinkCandidateMap[e.id] = { node: e, refLabel: p }), !0;
      }
      return this.removeBracket(), this.pos = a, e.appendChild(Tn("]", this.sourcepos(a, a))), this.options.referenceDefinition && (this.refLinkCandidateMap[e.id] = { node: e, refLabel: p }), !0;
    }, r.prototype.addBracket = function(e, t, n) {
      this.brackets !== null && (this.brackets.bracketAfter = !0), this.brackets = {
        node: e,
        startpos: this.sourcepos(t + (n ? 0 : 1)),
        previous: this.brackets,
        previousDelimiter: this.delimiters,
        index: t,
        image: n,
        active: !0
      };
    }, r.prototype.removeBracket = function() {
      this.brackets && (this.brackets = this.brackets.previous);
    }, r.prototype.parseEntity = function(e) {
      var t, n = this.pos + 1;
      return (t = this.match(K$e)) ? (e.appendChild(Tn(Mk.decodeHTML(t), this.sourcepos(n, this.pos))), !0) : !1;
    }, r.prototype.parseString = function(e) {
      var t, n = this.pos + 1;
      if (t = this.match(a4e)) {
        if (this.options.smart) {
          var i = t.replace(X$e, "…").replace(Y$e, function(s) {
            var u = 0, f = 0;
            return s.length % 3 === 0 ? f = s.length / 3 : s.length % 2 === 0 ? u = s.length / 2 : s.length % 3 === 2 ? (u = 1, f = (s.length - 2) / 3) : (u = 2, f = (s.length - 4) / 3), x0("—", f) + x0("–", u);
          });
          e.appendChild(Tn(i, this.sourcepos(n, this.pos)));
        } else {
          var a = Tn(t, this.sourcepos(n, this.pos));
          e.appendChild(a);
        }
        return !0;
      }
      return !1;
    }, r.prototype.parseNewline = function(e) {
      this.pos += 1;
      var t = e.lastChild;
      if (t && t.type === "text" && t.literal[t.literal.length - 1] === " ") {
        var n = t.literal[t.literal.length - 2] === " ", i = t.literal.length;
        t.literal = t.literal.replace(r4e, "");
        var a = i - t.literal.length;
        t.sourcepos[1][1] -= a, e.appendChild(ln(n ? "linebreak" : "softbreak", this.sourcepos(this.pos - a, this.pos)));
      } else
        e.appendChild(ln("softbreak", this.sourcepos(this.pos, this.pos)));
      return this.nextLine(), this.match(n4e), !0;
    }, r.prototype.parseReference = function(e, t) {
      if (!this.options.referenceDefinition)
        return 0;
      this.subject = e.stringContent, this.pos = 0;
      var n = null, i = this.pos, a = this.parseLinkLabel();
      if (a === 0)
        return 0;
      var s = this.subject.substr(0, a);
      if (this.peek() === W$e)
        this.pos++;
      else
        return this.pos = i, 0;
      this.spnl();
      var u = this.parseLinkDestination();
      if (u === null)
        return this.pos = i, 0;
      var f = this.pos;
      this.spnl(), this.pos !== f && (n = this.parseLinkTitle()), n === null && (n = "", this.pos = f);
      var p = !0;
      if (this.match(sC) === null && (n === "" ? p = !1 : (n = "", this.pos = f, p = this.match(sC) !== null)), !p)
        return this.pos = i, 0;
      var y = Zb(s);
      if (y === "")
        return this.pos = i, 0;
      var T = this.getReferenceDefSourcepos(e);
      e.sourcepos[0][0] = T[1][0] + 1;
      var N = ln("refDef", T);
      return N.title = n, N.dest = u, N.label = y, e.insertBefore(N), t[y] ? this.refDefCandidateMap[N.id] = N : t[y] = A0(N), this.pos - i;
    }, r.prototype.mergeTextNodes = function(e) {
      for (var t, n = []; t = e.next(); ) {
        var i = t.entering, a = t.node;
        if (i && a.type === "text")
          n.push(a);
        else if (n.length === 1)
          n = [];
        else if (n.length > 1) {
          var s = n[0], u = n[n.length - 1];
          s.sourcepos && u.sourcepos && (s.sourcepos[1] = u.sourcepos[1]), s.next = u.next, s.next && (s.next.prev = s);
          for (var f = 1; f < n.length; f += 1)
            s.literal += n[f].literal, n[f].unlink();
          n = [];
        }
      }
    }, r.prototype.getReferenceDefSourcepos = function(e) {
      for (var t = e.stringContent.split(/\n|\r\n/), n = !1, i = 0, a = { line: 0, ch: 0 }, s = 0; s < t.length; s += 1) {
        var u = t[s];
        if (_y.test(u))
          break;
        if (/\:/.test(u) && i === 0) {
          if (n)
            break;
          var f = u.indexOf(":") === u.length - 1 ? s + 1 : s;
          a = { line: f, ch: t[f].length }, n = !0;
        }
        var p = u.match(/'|"/g);
        if (p && (i += p.length), i === 2) {
          a = { line: s, ch: u.length };
          break;
        }
      }
      return [
        [e.sourcepos[0][0], e.sourcepos[0][1]],
        [e.sourcepos[0][0] + a.line, a.ch]
      ];
    }, r.prototype.parseInline = function(e) {
      var t, n = !1, i = this.peek();
      if (i === -1)
        return !1;
      switch (i) {
        case N0:
          n = this.parseNewline(e);
          break;
        case rC:
          n = this.parseBackslash(e);
          break;
        case H$e:
          n = this.parseBackticks(e);
          break;
        case Py:
        case Ov:
        case Dv:
        case lu:
          n = this.handleDelim(i, e);
          break;
        case ou:
        case su:
          n = !!(!((t = this.options) === null || t === void 0) && t.smart) && this.handleDelim(i, e);
          break;
        case eC:
          n = this.parseOpenBracket(e);
          break;
        case U$e:
          n = this.parseBang(e);
          break;
        case V$e:
          n = this.parseCloseBracket(e);
          break;
        case tC:
          n = this.parseAutolink(e) || this.parseHtmlTag(e);
          break;
        case $$e:
          e.disabledEntityParse || (n = this.parseEntity(e));
          break;
        default:
          n = this.parseString(e);
          break;
      }
      return n || (this.pos += 1, e.appendChild(Tn(Iy(i), this.sourcepos(this.pos, this.pos + 1)))), !0;
    }, r.prototype.parse = function(e) {
      for (this.subject = e.stringContent.trim(), this.pos = 0, this.delimiters = null, this.brackets = null, this.lineOffsets = e.lineOffsets || [0], this.lineIdx = 0, this.linePosOffset = 0, this.lineStartNum = e.sourcepos[0][0], d$e(e) && (this.lineOffsets[0] += e.level + 1); this.parseInline(e); )
        ;
      e.stringContent = null, this.processEmphasis(null), this.mergeTextNodes(e.walker());
      var t = this.options, n = t.extendedAutolinks, i = t.customParser;
      if (n && _$e(e.walker(), n), i && e.firstChild)
        for (var a, s = e.firstChild.walker(); a = s.next(); ) {
          var u = a.node, f = a.entering;
          i[u.type] && i[u.type](u, { entering: f, options: this.options });
        }
    }, r;
  })()
), s4e = /^\[([ \txX])\][ \t]+/;
function l4e(r, e) {
  if (e.firstChild && e.firstChild.type === "paragraph") {
    var t = e.firstChild, n = t.stringContent.match(s4e);
    if (n) {
      var i = n[0].length;
      t.stringContent = t.stringContent.substring(i - 1), t.sourcepos[0][1] += i, t.lineOffsets[0] += i, e.listData.task = !0, e.listData.checked = /[xX]/.test(n[1]);
    }
  }
}
var u4e = {
  continue: function() {
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableHead" || r === "tableBody";
  },
  acceptsLines: !1
}, c4e = {
  continue: function() {
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableRow";
  },
  acceptsLines: !1
}, f4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableRow" || r === "tableDelimRow";
  },
  acceptsLines: !1
}, d4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableDelimCell";
  },
  acceptsLines: !1
}, h4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, p4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableCell";
  },
  acceptsLines: !1
}, v4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, gm = 4, fE = 9, dE = 62, m4e = 60, hE = 32, pE = 91, vE = /[^ \t\f\v\r\n]/, g4e = /^(?:`{3,}|~{3,})(?= *$)/;
function lC(r) {
  for (var e = r; e; ) {
    if (e.lastLineBlank)
      return !0;
    var t = e.type;
    if (!e.lastLineChecked && (t === "list" || t === "item"))
      e.lastLineChecked = !0, e = e.lastChild;
    else {
      e.lastLineChecked = !0;
      break;
    }
  }
  return !1;
}
function da(r, e) {
  return e < r.length ? r.charCodeAt(e) : -1;
}
function mE(r) {
  return !vE.test(r);
}
function pf(r) {
  return r === hE || r === fE;
}
var y4e = /^\$\$$/, k4e = {
  continue: function(r, e) {
    var t = r.currentLine, n = t.match(y4e);
    if (n)
      return r.lastLineLength = n[0].length, r.finalize(e, r.lineNumber), 2;
    for (var i = e.offset; i > 0 && pf(da(t, r.offset)); )
      r.advanceOffset(1, !0), i--;
    return 0;
  },
  finalize: function(r, e) {
    if (e.stringContent !== null) {
      var t = e.stringContent, n = t.indexOf(`
`), i = t.slice(0, n), a = t.slice(n + 1), s = i.match(/^(\s*)(.*)/);
      e.info = fh(s[2].trim()), e.literal = a, e.stringContent = null;
    }
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, gE = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, w4e = {
  continue: function() {
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r !== "item";
  },
  acceptsLines: !1
}, b4e = {
  continue: function() {
    return 0;
  },
  finalize: function(r, e) {
    for (var t = e.firstChild; t; ) {
      if (lC(t) && t.next) {
        e.listData.tight = !1;
        break;
      }
      for (var n = t.firstChild; n; ) {
        if (lC(n) && (t.next || n.next)) {
          e.listData.tight = !1;
          break;
        }
        n = n.next;
      }
      t = t.next;
    }
  },
  canContain: function(r) {
    return r === "item";
  },
  acceptsLines: !1
}, C4e = {
  continue: function(r) {
    var e = r.currentLine;
    if (!r.indented && da(e, r.nextNonspace) === dE)
      r.advanceNextNonspace(), r.advanceOffset(1, !1), pf(da(e, r.offset)) && r.advanceOffset(1, !0);
    else
      return 1;
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r !== "item";
  },
  acceptsLines: !1
}, T4e = {
  continue: function(r, e) {
    if (r.blank) {
      if (e.firstChild === null)
        return 1;
      r.advanceNextNonspace();
    } else if (r.indent >= e.listData.markerOffset + e.listData.padding)
      r.advanceOffset(e.listData.markerOffset + e.listData.padding, !0);
    else
      return 1;
    return 0;
  },
  finalize: l4e,
  canContain: function(r) {
    return r !== "item";
  },
  acceptsLines: !1
}, S4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, x4e = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, E4e = {
  continue: function(r, e) {
    var t = r.currentLine, n = r.indent;
    if (e.isFenced) {
      var i = n <= 3 && t.charAt(r.nextNonspace) === e.fenceChar && t.slice(r.nextNonspace).match(g4e);
      if (i && i[0].length >= e.fenceLength)
        return r.lastLineLength = r.offset + n + i[0].length, r.finalize(e, r.lineNumber), 2;
      for (var a = e.fenceOffset; a > 0 && pf(da(t, r.offset)); )
        r.advanceOffset(1, !0), a--;
    } else if (n >= gm)
      r.advanceOffset(gm, !0);
    else if (r.blank)
      r.advanceNextNonspace();
    else
      return 1;
    return 0;
  },
  finalize: function(r, e) {
    var t;
    if (e.stringContent !== null) {
      if (e.isFenced) {
        var n = e.stringContent, i = n.indexOf(`
`), a = n.slice(0, i), s = n.slice(i + 1), u = a.match(/^(\s*)(.*)/);
        e.infoPadding = u[1].length, e.info = fh(u[2].trim()), e.literal = s;
      } else
        e.literal = (t = e.stringContent) === null || t === void 0 ? void 0 : t.replace(/(\n *)+$/, `
`);
      e.stringContent = null;
    }
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, M4e = {
  continue: function(r, e) {
    return r.blank && (e.htmlBlockType === 6 || e.htmlBlockType === 7) ? 1 : 0;
  },
  finalize: function(r, e) {
    var t;
    e.literal = ((t = e.stringContent) === null || t === void 0 ? void 0 : t.replace(/(\n *)+$/, "")) || null, e.stringContent = null;
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, N4e = {
  continue: function(r) {
    return r.blank ? 1 : 0;
  },
  finalize: function(r, e) {
    if (e.stringContent !== null) {
      for (var t, n = !1; da(e.stringContent, 0) === pE && (t = r.inlineParser.parseReference(e, r.refMap)); )
        e.stringContent = e.stringContent.slice(t), n = !0;
      n && mE(e.stringContent) && e.unlink();
    }
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, O4e = gE, D4e = gE, jc = {
  document: w4e,
  list: b4e,
  blockQuote: C4e,
  item: T4e,
  heading: S4e,
  thematicBreak: x4e,
  codeBlock: E4e,
  htmlBlock: M4e,
  paragraph: N4e,
  table: u4e,
  tableBody: c4e,
  tableHead: f4e,
  tableRow: p4e,
  tableCell: v4e,
  tableDelimRow: d4e,
  tableDelimCell: h4e,
  refDef: O4e,
  customBlock: k4e,
  frontMatter: D4e
};
function O0(r) {
  for (var e = 0, t = 0, n = [], i = 0; i < r.length; i += 1)
    if (r[i] === "|" && r[i - 1] !== "\\") {
      var a = r.substring(e, i);
      e === 0 && Xb(a) ? t = i + 1 : n.push(a), e = i + 1;
    }
  if (e < r.length) {
    var a = r.substring(e, r.length);
    Xb(a) || n.push(a);
  }
  return [t, n];
}
function D0(r, e, t, n) {
  for (var i = [], a = 0, s = e; a < s.length; a++) {
    var u = s[a], f = u.match(/^[ \t]+/), p = f ? f[0].length : 0, y = void 0, T = void 0;
    if (p === u.length)
      p = 0, y = 0, T = "";
    else {
      var N = u.match(/[ \t]+$/);
      y = N ? N[0].length : 0, T = u.slice(p, u.length - y);
    }
    var O = n + p, A = ln(r, [
      [t, n],
      [t, n + u.length - 1]
    ]);
    A.stringContent = T.replace(/\\\|/g, "|"), A.startIdx = i.length, A.endIdx = i.length, A.lineOffsets = [O - 1], A.paddingLeft = p, A.paddingRight = y, i.push(A), n += u.length + 1;
  }
  return i;
}
function A4e(r) {
  var e = null, t = r.stringContent, n = t[0], i = t[t.length - 1];
  return i === ":" ? e = n === ":" ? "center" : "right" : n === ":" && (e = "left"), { align: e };
}
var L4e = function(r, e) {
  var t = e.stringContent;
  if (e.type === "paragraph" && !r.indented && !r.blank) {
    var n = t.length - 1, i = t.lastIndexOf(`
`, n - 1) + 1, a = t.slice(i, n), s = r.currentLine.slice(r.nextNonspace), u = O0(a), f = u[0], p = u[1], y = O0(s), T = y[0], N = y[1], O = /^[ \t]*:?-+:?[ \t]*$/;
    if (
      // not checking if the number of header cells and delimiter cells are the same
      // to consider the case of merged-column (via plugin)
      !p.length || !N.length || N.some(function(Ne) {
        return !O.test(Ne);
      }) || // to prevent to regard setTextHeading as tabel delim cell with 'disallowDeepHeading' option
      N.length === 1 && s.indexOf("|") !== 0
    )
      return 0;
    var A = e.lineOffsets, q = r.lineNumber - 1, U = mm(A) + 1, j = ln("table", [
      [q, U],
      [r.lineNumber, r.offset]
    ]);
    if (j.columns = N.map(function() {
      return { align: null };
    }), e.insertAfter(j), A.length === 1)
      e.unlink();
    else {
      e.stringContent = t.slice(0, i);
      var te = t.lastIndexOf(`
`, i - 2) + 1, se = i - te - 1;
      r.lastLineLength = A[A.length - 2] + se, r.finalize(e, q - 1);
    }
    r.advanceOffset(r.currentLine.length - r.offset, !1);
    var me = ln("tableHead", [
      [q, U],
      [r.lineNumber, r.offset]
    ]);
    j.appendChild(me);
    var Ce = ln("tableRow", [
      [q, U],
      [q, U + a.length - 1]
    ]), pe = ln("tableDelimRow", [
      [r.lineNumber, r.nextNonspace + 1],
      [r.lineNumber, r.offset]
    ]);
    me.appendChild(Ce), me.appendChild(pe), D0("tableCell", p, q, U + f).forEach(function(Ne) {
      Ce.appendChild(Ne);
    });
    var ke = D0("tableDelimCell", N, r.lineNumber, r.nextNonspace + 1 + T);
    return ke.forEach(function(Ne) {
      pe.appendChild(Ne);
    }), j.columns = ke.map(A4e), r.tip = j, 2;
  }
  return 0;
}, R4e = function(r, e) {
  if (e.type !== "table" && e.type !== "tableBody" || !r.blank && r.currentLine.indexOf("|") === -1)
    return 0;
  if (r.advanceOffset(r.currentLine.length - r.offset, !1), r.blank) {
    var t = e;
    return e.type === "tableBody" && (t = e.parent, r.finalize(e, r.lineNumber - 1)), r.finalize(t, r.lineNumber - 1), 0;
  }
  var n = e;
  e.type === "table" && (n = r.addChild("tableBody", r.nextNonspace), n.stringContent = null);
  var i = ln("tableRow", [
    [r.lineNumber, r.nextNonspace + 1],
    [r.lineNumber, r.currentLine.length]
  ]);
  n.appendChild(i);
  var a = n.parent, s = r.currentLine.slice(r.nextNonspace), u = O0(s), f = u[0], p = u[1];
  return D0("tableCell", p, r.lineNumber, r.nextNonspace + 1 + f).forEach(function(y, T) {
    T >= a.columns.length && (y.ignored = !0), i.appendChild(y);
  }), 2;
}, I4e = /^(\$\$)(\s*[a-zA-Z])+/, P4e = /^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/, B4e = function(r) {
  var e;
  if (!r.indented && !P4e.test(r.currentLine) && (e = r.currentLine.match(I4e))) {
    var t = e[1].length;
    r.closeUnmatchedBlocks();
    var n = r.addChild("customBlock", r.nextNonspace);
    return n.syntaxLength = t, n.offset = r.indent, r.advanceNextNonspace(), r.advanceOffset(t, !1), 2;
  }
  return 0;
}, F4e = /^`{3,}(?!.*`)|^~{3,}/, _4e = [
  /./,
  /^<(?:script|pre|style)(?:\s|>|$)/i,
  /^<!--/,
  /^<[?]/,
  /^<![A-Z]/,
  /^<!\[CDATA\[/,
  /^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,
  new RegExp("^(?:" + uE + "|" + cE + ")\\s*$", "i")
], q4e = /^(?:=+|-+)[ \t]*$/, z4e = /^#{1,6}(?:[ \t]+|$)/, H4e = /^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/, yE = /^[*+-]/, kE = /^(\d{1,9})([.)])/;
function V4e(r, e) {
  var t = r.currentLine.slice(r.nextNonspace), n, i, a = {
    type: "bullet",
    tight: !0,
    bulletChar: "",
    start: 0,
    delimiter: "",
    padding: 0,
    markerOffset: r.indent,
    // GFM: Task List Item
    task: !1,
    checked: !1
  };
  if (r.indent >= 4)
    return null;
  if (n = t.match(yE))
    a.type = "bullet", a.bulletChar = n[0][0];
  else if ((n = t.match(kE)) && (e.type !== "paragraph" || n[1] === "1"))
    a.type = "ordered", a.start = parseInt(n[1], 10), a.delimiter = n[2];
  else
    return null;
  if (i = da(r.currentLine, r.nextNonspace + n[0].length), !(i === -1 || i === fE || i === hE) || e.type === "paragraph" && !r.currentLine.slice(r.nextNonspace + n[0].length).match(vE))
    return null;
  r.advanceNextNonspace(), r.advanceOffset(n[0].length, !0);
  var s = r.column, u = r.offset;
  do
    r.advanceOffset(1, !0), i = da(r.currentLine, r.offset);
  while (r.column - s < 5 && pf(i));
  var f = da(r.currentLine, r.offset) === -1, p = r.column - s;
  return p >= 5 || p < 1 || f ? (a.padding = n[0].length + 1, r.column = s, r.offset = u, pf(da(r.currentLine, r.offset)) && r.advanceOffset(1, !0)) : a.padding = n[0].length + p, a;
}
function U4e(r, e) {
  return r.type === e.type && r.delimiter === e.delimiter && r.bulletChar === e.bulletChar;
}
function wE(r, e) {
  return r.options.disallowDeepHeading && (e.type === "blockQuote" || e.type === "item");
}
var $4e = function(r) {
  return !r.indented && da(r.currentLine, r.nextNonspace) === dE ? (r.advanceNextNonspace(), r.advanceOffset(1, !1), pf(da(r.currentLine, r.offset)) && r.advanceOffset(1, !0), r.closeUnmatchedBlocks(), r.addChild("blockQuote", r.nextNonspace), 1) : 0;
}, W4e = function(r, e) {
  var t;
  if (!r.indented && // The nested Heading is disallowed in list and blockquote with 'disallowDeepHeading' option
  !wE(r, e) && (t = r.currentLine.slice(r.nextNonspace).match(z4e))) {
    r.advanceNextNonspace(), r.advanceOffset(t[0].length, !1), r.closeUnmatchedBlocks();
    var n = r.addChild("heading", r.nextNonspace);
    return n.level = t[0].trim().length, n.headingType = "atx", n.stringContent = r.currentLine.slice(r.offset).replace(/^[ \t]*#+[ \t]*$/, "").replace(/[ \t]+#+[ \t]*$/, ""), r.advanceOffset(r.currentLine.length - r.offset), 2;
  }
  return 0;
}, j4e = function(r) {
  var e;
  if (!r.indented && (e = r.currentLine.slice(r.nextNonspace).match(F4e))) {
    var t = e[0].length;
    r.closeUnmatchedBlocks();
    var n = r.addChild("codeBlock", r.nextNonspace);
    return n.isFenced = !0, n.fenceLength = t, n.fenceChar = e[0][0], n.fenceOffset = r.indent, r.advanceNextNonspace(), r.advanceOffset(t, !1), 2;
  }
  return 0;
}, G4e = function(r, e) {
  if (!r.indented && da(r.currentLine, r.nextNonspace) === m4e) {
    var t = r.currentLine.slice(r.nextNonspace), n = r.options.disallowedHtmlBlockTags, i = void 0;
    for (i = 1; i <= 7; i++) {
      var a = t.match(_4e[i]);
      if (a) {
        if (i === 7) {
          if (e.type === "paragraph")
            return 0;
          if (n.length > 0) {
            var s = new RegExp("</?(?:" + n.join("|") + ")", "i");
            if (s.test(a[0]))
              return 0;
          }
        }
        r.closeUnmatchedBlocks();
        var u = r.addChild("htmlBlock", r.offset);
        return u.htmlBlockType = i, 2;
      }
    }
  }
  return 0;
}, K4e = function(r, e) {
  var t;
  if (e.stringContent !== null && !r.indented && e.type === "paragraph" && // The nested Heading is disallowed in list and blockquote with 'disallowDeepHeading' option
  !wE(r, e.parent) && (t = r.currentLine.slice(r.nextNonspace).match(q4e))) {
    r.closeUnmatchedBlocks();
    for (var n = void 0; da(e.stringContent, 0) === pE && (n = r.inlineParser.parseReference(e, r.refMap)); )
      e.stringContent = e.stringContent.slice(n);
    if (e.stringContent.length > 0) {
      var i = ln("heading", e.sourcepos);
      return i.level = t[0][0] === "=" ? 1 : 2, i.headingType = "setext", i.stringContent = e.stringContent, e.insertAfter(i), e.unlink(), r.tip = i, r.advanceOffset(r.currentLine.length - r.offset, !1), 2;
    }
    return 0;
  }
  return 0;
}, J4e = function(r) {
  return !r.indented && H4e.test(r.currentLine.slice(r.nextNonspace)) ? (r.closeUnmatchedBlocks(), r.addChild("thematicBreak", r.nextNonspace), r.advanceOffset(r.currentLine.length - r.offset, !1), 2) : 0;
}, Q4e = function(r, e) {
  var t, n = e;
  return (!r.indented || e.type === "list") && (t = V4e(r, n)) ? (r.closeUnmatchedBlocks(), (r.tip.type !== "list" || !U4e(n.listData, t)) && (n = r.addChild("list", r.nextNonspace), n.listData = t), n = r.addChild("item", r.nextNonspace), n.listData = t, 1) : 0;
}, X4e = function(r) {
  return r.indented && r.tip.type !== "paragraph" && !r.blank ? (r.advanceOffset(gm, !0), r.closeUnmatchedBlocks(), r.addChild("codeBlock", r.offset), 2) : 0;
}, qy = [
  $4e,
  W4e,
  j4e,
  G4e,
  K4e,
  J4e,
  Q4e,
  X4e,
  L4e,
  R4e,
  B4e
], bE = /^(-{3}|\+{3}|;{3})$/, Y4e = function(r, e) {
  var t = r.currentLine, n = r.lineNumber, i = r.indented;
  if (n === 1 && !i && e.type === "document" && bE.test(t)) {
    r.closeUnmatchedBlocks();
    var a = r.addChild("frontMatter", r.nextNonspace);
    return a.stringContent = t, r.advanceNextNonspace(), r.advanceOffset(t.length, !1), 2;
  }
  return 0;
}, Z4e = {
  continue: function(r, e) {
    var t = r.currentLine, n = t.match(bE);
    return e.type === "frontMatter" && n ? (e.stringContent += t, r.lastLineLength = n[0].length, r.finalize(e, r.lineNumber), 2) : 0;
  },
  finalize: function(r, e) {
    e.stringContent !== null && (e.literal = e.stringContent, e.stringContent = null);
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, eWe = [
  /./,
  /<\/(?:script|pre|style)>/i,
  /-->/,
  /\?>/,
  />/,
  /\]\]>/
], tWe = /^[#`~*+_=<>0-9-;$]/, rWe = /\r\n|\n|\r/;
function zy() {
  return ln("document", [
    [1, 1],
    [0, 0]
  ]);
}
var nWe = {
  smart: !1,
  tagFilter: !1,
  extendedAutolinks: !1,
  disallowedHtmlBlockTags: [],
  referenceDefinition: !1,
  disallowDeepHeading: !1,
  customParser: null,
  frontMatter: !1
}, iWe = (
  /** @class */
  (function() {
    function r(e) {
      this.options = Xn(Xn({}, nWe), e), this.doc = zy(), this.tip = this.doc, this.oldtip = this.doc, this.lineNumber = 0, this.offset = 0, this.column = 0, this.nextNonspace = 0, this.nextNonspaceColumn = 0, this.indent = 0, this.currentLine = "", this.indented = !1, this.blank = !1, this.partiallyConsumedTab = !1, this.allClosed = !0, this.lastMatchedContainer = this.doc, this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.lastLineLength = 0, this.lines = [], this.options.frontMatter && (jc.frontMatter = Z4e, qy.unshift(Y4e)), this.inlineParser = new o4e(this.options);
    }
    return r.prototype.advanceOffset = function(e, t) {
      t === void 0 && (t = !1);
      for (var n = this.currentLine, i, a, s; e > 0 && (s = n[this.offset]); )
        s === "	" ? (i = 4 - this.column % 4, t ? (this.partiallyConsumedTab = i > e, a = i > e ? e : i, this.column += a, this.offset += this.partiallyConsumedTab ? 0 : 1, e -= a) : (this.partiallyConsumedTab = !1, this.column += i, this.offset += 1, e -= 1)) : (this.partiallyConsumedTab = !1, this.offset += 1, this.column += 1, e -= 1);
    }, r.prototype.advanceNextNonspace = function() {
      this.offset = this.nextNonspace, this.column = this.nextNonspaceColumn, this.partiallyConsumedTab = !1;
    }, r.prototype.findNextNonspace = function() {
      for (var e = this.currentLine, t = this.offset, n = this.column, i; (i = e.charAt(t)) !== ""; )
        if (i === " ")
          t++, n++;
        else if (i === "	")
          t++, n += 4 - n % 4;
        else
          break;
      this.blank = i === `
` || i === "\r" || i === "", this.nextNonspace = t, this.nextNonspaceColumn = n, this.indent = this.nextNonspaceColumn - this.column, this.indented = this.indent >= gm;
    }, r.prototype.addLine = function() {
      if (this.partiallyConsumedTab) {
        this.offset += 1;
        var e = 4 - this.column % 4;
        this.tip.stringContent += x0(" ", e);
      }
      this.tip.lineOffsets ? this.tip.lineOffsets.push(this.offset) : this.tip.lineOffsets = [this.offset], this.tip.stringContent += this.currentLine.slice(this.offset) + `
`;
    }, r.prototype.addChild = function(e, t) {
      for (; !jc[this.tip.type].canContain(e); )
        this.finalize(this.tip, this.lineNumber - 1);
      var n = t + 1, i = ln(e, [
        [this.lineNumber, n],
        [0, 0]
      ]);
      return i.stringContent = "", this.tip.appendChild(i), this.tip = i, i;
    }, r.prototype.closeUnmatchedBlocks = function() {
      if (!this.allClosed) {
        for (; this.oldtip !== this.lastMatchedContainer; ) {
          var e = this.oldtip.parent;
          this.finalize(this.oldtip, this.lineNumber - 1), this.oldtip = e;
        }
        this.allClosed = !0;
      }
    }, r.prototype.finalize = function(e, t) {
      var n = e.parent;
      e.open = !1, e.sourcepos[1] = [t, this.lastLineLength], jc[e.type].finalize(this, e), this.tip = n;
    }, r.prototype.processInlines = function(e) {
      var t, n = this.options.customParser, i = e.walker();
      for (this.inlineParser.refMap = this.refMap, this.inlineParser.refLinkCandidateMap = this.refLinkCandidateMap, this.inlineParser.refDefCandidateMap = this.refDefCandidateMap, this.inlineParser.options = this.options; t = i.next(); ) {
        var a = t.node, s = t.entering, u = a.type;
        n && n[u] && n[u](a, { entering: s, options: this.options }), !s && (u === "paragraph" || u === "heading" || u === "tableCell" && !a.ignored) && this.inlineParser.parse(a);
      }
    }, r.prototype.incorporateLine = function(e) {
      var t = this.doc;
      this.oldtip = this.tip, this.offset = 0, this.column = 0, this.blank = !1, this.partiallyConsumedTab = !1, this.lineNumber += 1, e.indexOf("\0") !== -1 && (e = e.replace(/\0/g, "�")), this.currentLine = e;
      for (var n = !0, i; (i = t.lastChild) && i.open; ) {
        switch (t = i, this.findNextNonspace(), jc[t.type].continue(this, t)) {
          case 0:
            break;
          case 1:
            n = !1;
            break;
          case 2:
            this.lastLineLength = e.length;
            return;
          default:
            throw new Error("continue returned illegal value, must be 0, 1, or 2");
        }
        if (!n) {
          t = t.parent;
          break;
        }
      }
      this.allClosed = t === this.oldtip, this.lastMatchedContainer = t;
      for (var a = t.type !== "paragraph" && jc[t.type].acceptsLines, s = qy.length; !a; ) {
        if (this.findNextNonspace(), t.type !== "table" && t.type !== "tableBody" && t.type !== "paragraph" && !this.indented && !tWe.test(e.slice(this.nextNonspace))) {
          this.advanceNextNonspace();
          break;
        }
        for (var u = 0; u < s; ) {
          var f = qy[u](this, t);
          if (f === 1) {
            t = this.tip;
            break;
          } else if (f === 2) {
            t = this.tip, a = !0;
            break;
          } else
            u++;
        }
        if (u === s) {
          this.advanceNextNonspace();
          break;
        }
      }
      if (!this.allClosed && !this.blank && this.tip.type === "paragraph")
        this.addLine();
      else {
        this.closeUnmatchedBlocks(), this.blank && t.lastChild && (t.lastChild.lastLineBlank = !0);
        for (var p = t.type, y = this.blank && !(p === "blockQuote" || oE(t) && t.isFenced || p === "item" && !t.firstChild && t.sourcepos[0][0] === this.lineNumber), T = t; T; )
          T.lastLineBlank = y, T = T.parent;
        jc[p].acceptsLines ? (this.addLine(), f$e(t) && t.htmlBlockType >= 1 && t.htmlBlockType <= 5 && eWe[t.htmlBlockType].test(this.currentLine.slice(this.offset)) && (this.lastLineLength = e.length, this.finalize(t, this.lineNumber))) : this.offset < e.length && !this.blank && (t = this.addChild("paragraph", this.offset), this.advanceNextNonspace(), this.addLine());
      }
      this.lastLineLength = e.length;
    }, r.prototype.parse = function(e, t) {
      this.doc = zy(), this.tip = this.doc, this.lineNumber = 0, this.lastLineLength = 0, this.offset = 0, this.column = 0, this.lastMatchedContainer = this.doc, this.currentLine = "";
      var n = e.split(rWe), i = n.length;
      this.lines = t || n, this.options.referenceDefinition && this.clearRefMaps(), e.charCodeAt(e.length - 1) === N0 && (i -= 1);
      for (var a = 0; a < i; a++)
        this.incorporateLine(n[a]);
      for (; this.tip; )
        this.finalize(this.tip, i);
      return this.processInlines(this.doc), this.doc;
    }, r.prototype.partialParseStart = function(e, t) {
      this.doc = zy(), this.tip = this.doc, this.lineNumber = e - 1, this.lastLineLength = 0, this.offset = 0, this.column = 0, this.lastMatchedContainer = this.doc, this.currentLine = "";
      for (var n = t.length, i = 0; i < n; i++)
        this.incorporateLine(t[i]);
      return this.doc;
    }, r.prototype.partialParseExtends = function(e) {
      for (var t = 0; t < e.length; t++)
        this.incorporateLine(e[t]);
    }, r.prototype.partialParseFinish = function() {
      for (; this.tip; )
        this.finalize(this.tip, this.lineNumber);
      this.processInlines(this.doc);
    }, r.prototype.setRefMaps = function(e, t, n) {
      this.refMap = e, this.refLinkCandidateMap = t, this.refDefCandidateMap = n;
    }, r.prototype.clearRefMaps = function() {
      [this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function(e) {
        z$e(e);
      });
    }, r;
  })()
);
function uC(r, e) {
  return r[0] < e[0] ? 1 : r[0] > e[0] ? -1 : r[1] < e[1] ? 1 : r[1] > e[1] ? -1 : 0;
}
function aWe(r, e) {
  var t = r[0], n = r[1];
  return uC(n, e) === 1 ? 1 : uC(t, e) === -1 ? -1 : 0;
}
function oWe(r, e) {
  if (!(r.parent !== e.parent || r === e)) {
    for (var t = r.next; t && t !== e; ) {
      for (var n = t.next, i = 0, a = ["parent", "prev", "next"]; i < a.length; i++) {
        var s = a[i];
        t[s] && (E0(t[s].id), t[s] = null);
      }
      t = n;
    }
    r.next = e.next, e.next ? e.next.prev = r : r.parent.lastChild = r;
  }
}
function sWe(r) {
  for (var e = [], t = r.firstChild; t; )
    e.push(t), t = t.next;
  return e;
}
function cC(r, e) {
  for (var t = 0, n = e; t < n.length; t++) {
    var i = n[t];
    r.insertBefore(i);
  }
}
function lWe(r, e) {
  for (var t = e.length - 1; t >= 0; t -= 1)
    r.prependChild(e[t]);
}
function uWe(r, e) {
  if (!(!r || !r.parent || e === 0)) {
    var t = r.parent.walker();
    t.resumeAt(r, !0);
    for (var n; n = t.next(); ) {
      var i = n.node, a = n.entering;
      a && (i.sourcepos[0][0] += e, i.sourcepos[1][0] += e);
    }
  }
}
function CE(r, e) {
  var t = r[0], n = r[1];
  return n[0] < e ? 1 : t[0] > e ? -1 : 0;
}
function Av(r, e) {
  for (var t = r.firstChild; t; ) {
    var n = CE(t.sourcepos, e);
    if (n === 0)
      return t;
    if (n === -1)
      return t.prev || t;
    t = t.next;
  }
  return r.lastChild;
}
function cWe(r) {
  for (; r.lastChild; )
    r = r.lastChild;
  return r;
}
function fWe(r) {
  for (; r.parent && r.parent.type !== "document" && r.parent.sourcepos[0][0] === r.sourcepos[0][0]; )
    r = r.parent;
  return r;
}
function dWe(r, e) {
  for (var t = r.firstChild, n = null; t; ) {
    var i = CE(t.sourcepos, e);
    if (i === 0) {
      if (t.sourcepos[0][0] === e || !t.firstChild)
        return t;
      n = t, t = t.firstChild;
    } else {
      if (i === -1)
        break;
      n = t, t = t.next;
    }
  }
  return n ? fWe(cWe(n)) : null;
}
function hWe(r, e) {
  for (var t = r, n = null; t; ) {
    var i = aWe(t.sourcepos, e);
    if (i === 0)
      if (t.firstChild)
        n = t, t = t.firstChild;
      else
        return t;
    else {
      if (i === -1)
        return n;
      if (t.next)
        t = t.next;
      else
        return n;
    }
  }
  return t;
}
function TE(r) {
  return YUe(r) || null;
}
function Hy(r, e, t) {
  if (t === void 0 && (t = null), e)
    for (var n = e.walker(); e && e !== t; ) {
      r(e);
      var i = n.next();
      if (i)
        e = i.node;
      else
        break;
    }
}
function pWe(r) {
  var e = TE(r);
  if (!e)
    return !0;
  for (; e && e.type !== "document"; ) {
    if (!e.parent && !e.prev && !e.next)
      return !0;
    e = e.parent;
  }
  return !1;
}
var fC = /\r\n|\n|\r/;
function vWe(r) {
  var e = r.match(/^[ \t]+/);
  if (e && (e[0].length >= 2 || /\t/.test(e[0])))
    return !0;
  var t = e ? r.slice(e.length) : r;
  return yE.test(t) || kE.test(t);
}
function mWe(r) {
  return !mE(r) && r.indexOf("|") !== -1;
}
function A0(r) {
  var e = r.id, t = r.title, n = r.sourcepos, i = r.dest;
  return {
    id: e,
    title: t,
    sourcepos: n,
    unlinked: !1,
    destination: i
  };
}
var SE = (
  /** @class */
  (function() {
    function r(e, t) {
      this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.referenceDefinition = !!t?.referenceDefinition, this.parser = new iWe(t), this.parser.setRefMaps(this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap), this.eventHandlerMap = { change: [] }, e = e || "", this.lineTexts = e.split(fC), this.root = this.parser.parse(e, this.lineTexts);
    }
    return r.prototype.updateLineTexts = function(e, t, n) {
      var i, a = e[0], s = e[1], u = t[0], f = t[1], p = n.split(fC), y = p.length, T = this.lineTexts[a - 1], N = this.lineTexts[u - 1];
      p[0] = T.slice(0, s - 1) + p[0], p[y - 1] = p[y - 1] + N.slice(f - 1);
      var O = u - a + 1;
      return (i = this.lineTexts).splice.apply(i, T0([a - 1, O], p)), y - O;
    }, r.prototype.updateRootNodeState = function() {
      if (this.lineTexts.length === 1 && this.lineTexts[0] === "") {
        this.root.lastLineBlank = !0, this.root.sourcepos = [
          [1, 1],
          [1, 0]
        ];
        return;
      }
      this.root.lastChild && (this.root.lastLineBlank = this.root.lastChild.lastLineBlank);
      for (var e = this.lineTexts, t = e.length - 1; e[t] === ""; )
        t -= 1;
      e.length - 2 > t && (t += 1), this.root.sourcepos[1] = [t + 1, e[t].length];
    }, r.prototype.replaceRangeNodes = function(e, t, n) {
      e ? (cC(e, n), oWe(e, t), [e.id, t.id].forEach(function(i) {
        return E0(i);
      }), e.unlink()) : t ? (cC(t, n), E0(t.id), t.unlink()) : lWe(this.root, n);
    }, r.prototype.getNodeRange = function(e, t) {
      var n = Av(this.root, e[0]), i = Av(this.root, t[0]);
      return i && i.next && t[0] + 1 === i.next.sourcepos[0][0] && (i = i.next), [n, i];
    }, r.prototype.trigger = function(e, t) {
      this.eventHandlerMap[e].forEach(function(n) {
        n(t);
      });
    }, r.prototype.extendEndLine = function(e) {
      for (; this.lineTexts[e] === ""; )
        e += 1;
      return e;
    }, r.prototype.parseRange = function(e, t, n, i) {
      e && e.prev && (Yb(e.prev) && vWe(this.lineTexts[n - 1]) || h$e(e.prev) && mWe(this.lineTexts[n - 1])) && (e = e.prev, n = e.sourcepos[0][0]);
      for (var a = this.lineTexts.slice(n - 1, i), s = this.parser.partialParseStart(n, a), u = t ? t.next : this.root.firstChild, f = s.lastChild, p = f && oE(f) && f.open, y = f && sE(f) && f.open, T = f && Yb(f); (p || y) && u || T && u && (u.type === "list" || u.sourcepos[0][1] >= 2); ) {
        var N = this.extendEndLine(u.sourcepos[1][0]);
        this.parser.partialParseExtends(this.lineTexts.slice(i, N)), e || (e = t), t = u, i = N, u = u.next;
      }
      this.parser.partialParseFinish();
      var O = sWe(s);
      return { newNodes: O, extStartNode: e, extEndNode: t };
    }, r.prototype.getRemovedNodeRange = function(e, t) {
      return !e || e && $c(e) || t && $c(t) ? null : {
        id: [e.id, t.id],
        line: [e.sourcepos[0][0] - 1, t.sourcepos[1][0] - 1]
      };
    }, r.prototype.markDeletedRefMap = function(e, t) {
      var n = this;
      if (!Wc(this.refMap)) {
        var i = function(a) {
          if ($c(a)) {
            var s = n.refMap[a.label];
            s && a.id === s.id && (s.unlinked = !0);
          }
        };
        e && Hy(i, e.parent, t), t && Hy(i, t);
      }
    }, r.prototype.replaceWithNewRefDefState = function(e) {
      var t = this;
      if (!Wc(this.refMap)) {
        var n = function(i) {
          if ($c(i)) {
            var a = i.label, s = t.refMap[a];
            (!s || s.unlinked) && (t.refMap[a] = A0(i));
          }
        };
        e.forEach(function(i) {
          Hy(n, i);
        });
      }
    }, r.prototype.replaceWithRefDefCandidate = function() {
      var e = this;
      Wc(this.refDefCandidateMap) || Nv(this.refDefCandidateMap, function(t, n) {
        var i = n.label, a = n.sourcepos, s = e.refMap[i];
        (!s || s.unlinked || s.sourcepos[0][0] > a[0][0]) && (e.refMap[i] = A0(n));
      });
    }, r.prototype.getRangeWithRefDef = function(e, t, n, i, a) {
      if (this.referenceDefinition && !Wc(this.refMap)) {
        var s = Av(this.root, e - 1), u = Av(this.root, t + 1);
        s && $c(s) && s !== n && s !== i && (n = s, e = n.sourcepos[0][0]), u && $c(u) && u !== n && u !== i && (i = u, t = this.extendEndLine(i.sourcepos[1][0] + a));
      }
      return [n, i, e, t];
    }, r.prototype.parse = function(e, t, n) {
      n === void 0 && (n = 0);
      var i = this.getNodeRange(e, t), a = i[0], s = i[1], u = a ? Math.min(a.sourcepos[0][0], e[0]) : e[0], f = this.extendEndLine((s ? Math.max(s.sourcepos[1][0], t[0]) : t[0]) + n), p = this.parseRange.apply(this, this.getRangeWithRefDef(u, f, a, s, n)), y = p.newNodes, T = p.extStartNode, N = p.extEndNode, O = this.getRemovedNodeRange(T, N), A = N ? N.next : this.root.firstChild;
      return this.referenceDefinition ? (this.markDeletedRefMap(T, N), this.replaceRangeNodes(T, N, y), this.replaceWithNewRefDefState(y)) : this.replaceRangeNodes(T, N, y), { nodes: y, removedNodeRange: O, nextNode: A };
    }, r.prototype.parseRefLink = function() {
      var e = this, t = [];
      return Wc(this.refMap) || Nv(this.refMap, function(n, i) {
        i.unlinked && delete e.refMap[n], Nv(e.refLinkCandidateMap, function(a, s) {
          var u = s.node, f = s.refLabel;
          f === n && t.push(e.parse(u.sourcepos[0], u.sourcepos[1]));
        });
      }), t;
    }, r.prototype.removeUnlinkedCandidate = function() {
      Wc(this.refDefCandidateMap) || [this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function(e) {
        Nv(e, function(t) {
          pWe(t) && delete e[t];
        });
      });
    }, r.prototype.editMarkdown = function(e, t, n) {
      var i = this.updateLineTexts(e, t, n), a = this.parse(e, t, i), s = q$e(a, "nextNode");
      uWe(a.nextNode, i), this.updateRootNodeState();
      var u = [s];
      return this.referenceDefinition && (this.removeUnlinkedCandidate(), this.replaceWithRefDefCandidate(), u = u.concat(this.parseRefLink())), this.trigger("change", u), u;
    }, r.prototype.getLineTexts = function() {
      return this.lineTexts;
    }, r.prototype.getRootNode = function() {
      return this.root;
    }, r.prototype.findNodeAtPosition = function(e) {
      var t = hWe(this.root, e);
      return !t || t === this.root ? null : t;
    }, r.prototype.findFirstNodeAtLine = function(e) {
      return dWe(this.root, e);
    }, r.prototype.on = function(e, t) {
      this.eventHandlerMap[e].push(t);
    }, r.prototype.off = function(e, t) {
      var n = this.eventHandlerMap[e], i = n.indexOf(t);
      n.splice(i, 1);
    }, r.prototype.findNodeById = function(e) {
      return TE(e);
    }, r.prototype.removeAllNode = function() {
      ZUe();
    }, r;
  })()
), gWe = [
  "title",
  "textarea",
  "style",
  "xmp",
  "iframe",
  "noembed",
  "noframes",
  "script",
  "plaintext"
], dC = new RegExp("<(/?(?:" + gWe.join("|") + ")[^>]*>)", "ig");
function hC(r) {
  return dC.test(r) ? r.replace(dC, function(e, t) {
    return "&lt;" + t;
  }) : r;
}
var pC = {
  heading: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "h" + r.level,
      outerNewLine: !0
    };
  },
  text: function(r) {
    return {
      type: "text",
      content: r.literal
    };
  },
  softbreak: function(r, e) {
    var t = e.options;
    return {
      type: "html",
      content: t.softbreak
    };
  },
  linebreak: function() {
    return {
      type: "html",
      content: `<br />
`
    };
  },
  emph: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "em"
    };
  },
  strong: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "strong"
    };
  },
  paragraph: function(r, e) {
    var t, n = e.entering, i = (t = r.parent) === null || t === void 0 ? void 0 : t.parent;
    return i && i.type === "list" && i.listData.tight ? null : {
      type: n ? "openTag" : "closeTag",
      tagName: "p",
      outerNewLine: !0
    };
  },
  thematicBreak: function() {
    return {
      type: "openTag",
      tagName: "hr",
      outerNewLine: !0,
      selfClose: !0
    };
  },
  blockQuote: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "blockquote",
      outerNewLine: !0,
      innerNewLine: !0
    };
  },
  list: function(r, e) {
    var t = e.entering, n = r.listData, i = n.type, a = n.start, s = i === "bullet" ? "ul" : "ol", u = {};
    return s === "ol" && a !== null && a !== 1 && (u.start = a.toString()), {
      type: t ? "openTag" : "closeTag",
      tagName: s,
      attributes: u,
      outerNewLine: !0
    };
  },
  item: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "li",
      outerNewLine: !0
    };
  },
  htmlInline: function(r, e) {
    var t = e.options, n = t.tagFilter ? hC(r.literal) : r.literal;
    return { type: "html", content: n };
  },
  htmlBlock: function(r, e) {
    var t = e.options, n = t.tagFilter ? hC(r.literal) : r.literal;
    return t.nodeId ? [
      { type: "openTag", tagName: "div", outerNewLine: !0 },
      { type: "html", content: n },
      { type: "closeTag", tagName: "div", outerNewLine: !0 }
    ] : { type: "html", content: n, outerNewLine: !0 };
  },
  code: function(r) {
    return [
      { type: "openTag", tagName: "code" },
      { type: "text", content: r.literal },
      { type: "closeTag", tagName: "code" }
    ];
  },
  codeBlock: function(r) {
    var e = r.info, t = e ? e.split(/\s+/) : [], n = [];
    return t.length > 0 && t[0].length > 0 && n.push("language-" + Qc(t[0])), [
      { type: "openTag", tagName: "pre", outerNewLine: !0 },
      { type: "openTag", tagName: "code", classNames: n },
      { type: "text", content: r.literal },
      { type: "closeTag", tagName: "code" },
      { type: "closeTag", tagName: "pre", outerNewLine: !0 }
    ];
  },
  link: function(r, e) {
    var t = e.entering;
    if (t) {
      var n = r, i = n.title, a = n.destination;
      return {
        type: "openTag",
        tagName: "a",
        attributes: Xn({ href: Qc(a) }, i && { title: Qc(i) })
      };
    }
    return { type: "closeTag", tagName: "a" };
  },
  image: function(r, e) {
    var t = e.getChildrenText, n = e.skipChildren, i = r, a = i.title, s = i.destination;
    return n(), {
      type: "openTag",
      tagName: "img",
      selfClose: !0,
      attributes: Xn({ src: Qc(s), alt: t(r) }, a && { title: Qc(a) })
    };
  },
  customBlock: function(r, e, t) {
    var n = r.info.trim().toLowerCase(), i = t[n];
    if (i)
      try {
        return i(r, e);
      } catch (a) {
        console.warn("[@toast-ui/editor] - The error occurred when " + n + " block node was parsed in markdown renderer: " + a);
      }
    return [
      { type: "openTag", tagName: "div", outerNewLine: !0 },
      { type: "text", content: r.literal },
      { type: "closeTag", tagName: "div", outerNewLine: !0 }
    ];
  },
  frontMatter: function(r) {
    return [
      {
        type: "openTag",
        tagName: "div",
        outerNewLine: !0,
        // Because front matter is metadata, it should not be render.
        attributes: { style: "white-space: pre; display: none;" }
      },
      { type: "text", content: r.literal },
      { type: "closeTag", tagName: "div", outerNewLine: !0 }
    ];
  },
  customInline: function(r, e, t) {
    var n = r, i = n.info, a = n.firstChild, s = i.trim().toLowerCase(), u = t[s], f = e.entering;
    if (u)
      try {
        return u(r, e);
      } catch (p) {
        console.warn("[@toast-ui/editor] - The error occurred when " + s + " inline node was parsed in markdown renderer: " + p);
      }
    return f ? [
      { type: "openTag", tagName: "span" },
      { type: "text", content: "$$" + i + (a ? " " : "") }
    ] : [
      { type: "text", content: "$$" },
      { type: "closeTag", tagName: "span" }
    ];
  }
}, vC = {
  strike: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "del"
    };
  },
  item: function(r, e) {
    var t = e.entering, n = r.listData, i = n.checked, a = n.task;
    if (t) {
      var s = {
        type: "openTag",
        tagName: "li",
        outerNewLine: !0
      };
      return a ? [
        s,
        {
          type: "openTag",
          tagName: "input",
          selfClose: !0,
          attributes: Xn(Xn({}, i && { checked: "" }), { disabled: "", type: "checkbox" })
        },
        {
          type: "text",
          content: " "
        }
      ] : s;
    }
    return {
      type: "closeTag",
      tagName: "li",
      outerNewLine: !0
    };
  },
  table: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "table",
      outerNewLine: !0
    };
  },
  tableHead: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "thead",
      outerNewLine: !0
    };
  },
  tableBody: function(r, e) {
    var t = e.entering;
    return {
      type: t ? "openTag" : "closeTag",
      tagName: "tbody",
      outerNewLine: !0
    };
  },
  tableRow: function(r, e) {
    var t = e.entering;
    if (t)
      return {
        type: "openTag",
        tagName: "tr",
        outerNewLine: !0
      };
    var n = [];
    if (r.lastChild)
      for (var i = r.parent.parent.columns.length, a = r.lastChild.endIdx, s = a + 1; s < i; s += 1)
        n.push({
          type: "openTag",
          tagName: "td",
          outerNewLine: !0
        }, {
          type: "closeTag",
          tagName: "td",
          outerNewLine: !0
        });
    return n.push({
      type: "closeTag",
      tagName: "tr",
      outerNewLine: !0
    }), n;
  },
  tableCell: function(r, e) {
    var t = e.entering;
    if (r.ignored)
      return {
        type: "text",
        content: ""
      };
    var n = r.parent.parent, i = n.type === "tableHead" ? "th" : "td", a = n.parent, s = a.columns[r.startIdx], u = s?.align ? { align: s.align } : null;
    return t ? Xn({ type: "openTag", tagName: i, outerNewLine: !0 }, u && { attributes: u }) : {
      type: "closeTag",
      tagName: i,
      outerNewLine: !0
    };
  }
}, yWe = {
  softbreak: `
`,
  gfm: !1,
  tagFilter: !1,
  nodeId: !1
};
function kWe(r) {
  for (var e = [], t = r.walker(), n = null; n = t.next(); ) {
    var i = n.node;
    i.type === "text" && e.push(i.literal);
  }
  return e.join("");
}
var Lk = (
  /** @class */
  (function() {
    function r(e) {
      this.buffer = [], this.options = Xn(Xn({}, yWe), e), this.convertors = this.createConvertors(), delete this.options.convertors;
    }
    return r.prototype.createConvertors = function() {
      var e = Xn({}, pC);
      if (this.options.gfm && (e = Xn(Xn({}, e), vC)), this.options.convertors) {
        var t = this.options.convertors, n = Object.keys(t), i = Xn(Xn({}, pC), vC);
        n.forEach(function(a) {
          var s = e[a], u = t[a], f = Object.keys(i).indexOf(a) === -1 ? a.toLowerCase() : a;
          s ? e[f] = function(p, y, T) {
            return y.origin = function() {
              return s(p, y, T);
            }, u(p, y);
          } : e[f] = u;
        });
      }
      return e;
    }, r.prototype.getConvertors = function() {
      return this.convertors;
    }, r.prototype.getOptions = function() {
      return this.options;
    }, r.prototype.render = function(e) {
      var t = this;
      this.buffer = [];
      for (var n = e.walker(), i = null, a = function() {
        var u = i.node, f = i.entering, p = s.convertors[u.type];
        if (!p)
          return "continue";
        var y = !1, T = {
          entering: f,
          leaf: !Ak(u),
          options: s.options,
          getChildrenText: kWe,
          skipChildren: function() {
            y = !0;
          }
        }, N = sE(u) || p$e(u) ? p(u, T, s.convertors) : p(u, T);
        if (N) {
          var O = Array.isArray(N) ? N : [N];
          O.forEach(function(A, q) {
            A.type === "openTag" && t.options.nodeId && q === 0 && (A.attributes || (A.attributes = {}), A.attributes["data-nodeid"] = String(u.id)), t.renderHTMLNode(A);
          }), y && (n.resumeAt(u, !1), n.next());
        }
      }, s = this; i = n.next(); )
        a();
      return this.addNewLine(), this.buffer.join("");
    }, r.prototype.renderHTMLNode = function(e) {
      switch (e.type) {
        case "openTag":
        case "closeTag":
          this.renderElementNode(e);
          break;
        case "text":
          this.renderTextNode(e);
          break;
        case "html":
          this.renderRawHtmlNode(e);
          break;
      }
    }, r.prototype.generateOpenTagString = function(e) {
      var t = this, n = e.tagName, i = e.classNames, a = e.attributes;
      this.buffer.push("<" + n), i && i.length > 0 && this.buffer.push(' class="' + i.join(" ") + '"'), a && Object.keys(a).forEach(function(s) {
        var u = a[s];
        t.buffer.push(" " + s + '="' + u + '"');
      }), e.selfClose && this.buffer.push(" /"), this.buffer.push(">");
    }, r.prototype.generateCloseTagString = function(e) {
      var t = e.tagName;
      this.buffer.push("</" + t + ">");
    }, r.prototype.addNewLine = function() {
      this.buffer.length && mm(mm(this.buffer)) !== `
` && this.buffer.push(`
`);
    }, r.prototype.addOuterNewLine = function(e) {
      e.outerNewLine && this.addNewLine();
    }, r.prototype.addInnerNewLine = function(e) {
      e.innerNewLine && this.addNewLine();
    }, r.prototype.renderTextNode = function(e) {
      this.buffer.push(Qc(e.content));
    }, r.prototype.renderRawHtmlNode = function(e) {
      this.addOuterNewLine(e), this.buffer.push(e.content), this.addOuterNewLine(e);
    }, r.prototype.renderElementNode = function(e) {
      e.type === "openTag" ? (this.addOuterNewLine(e), this.generateOpenTagString(e), e.selfClose ? this.addOuterNewLine(e) : this.addInnerNewLine(e)) : (this.addInnerNewLine(e), this.generateCloseTagString(e), this.addOuterNewLine(e));
    }, r;
  })()
);
function wWe(r) {
  if (Array.isArray(r)) {
    for (var e = 0, t = Array(r.length); e < r.length; e++)
      t[e] = r[e];
    return t;
  } else
    return Array.from(r);
}
var bWe = Object.hasOwnProperty, mC = Object.setPrototypeOf, CWe = Object.isFrozen, TWe = Object.getPrototypeOf, SWe = Object.getOwnPropertyDescriptor, Ri = Object.freeze, Es = Object.seal, xWe = Object.create, xE = typeof Reflect < "u" && Reflect, ym = xE.apply, L0 = xE.construct;
ym || (ym = function(e, t, n) {
  return e.apply(t, n);
});
Ri || (Ri = function(e) {
  return e;
});
Es || (Es = function(e) {
  return e;
});
L0 || (L0 = function(e, t) {
  return new (Function.prototype.bind.apply(e, [null].concat(wWe(t))))();
});
var EWe = ro(Array.prototype.forEach), gC = ro(Array.prototype.pop), Qd = ro(Array.prototype.push), Vv = ro(String.prototype.toLowerCase), yC = ro(String.prototype.match), il = ro(String.prototype.replace), MWe = ro(String.prototype.indexOf), NWe = ro(String.prototype.trim), gs = ro(RegExp.prototype.test), kC = OWe(TypeError);
function ro(r) {
  return function(e) {
    for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
      n[i - 1] = arguments[i];
    return ym(r, e, n);
  };
}
function OWe(r) {
  return function() {
    for (var e = arguments.length, t = Array(e), n = 0; n < e; n++)
      t[n] = arguments[n];
    return L0(r, t);
  };
}
function ir(r, e) {
  mC && mC(r, null);
  for (var t = e.length; t--; ) {
    var n = e[t];
    if (typeof n == "string") {
      var i = Vv(n);
      i !== n && (CWe(e) || (e[t] = i), n = i);
    }
    r[n] = !0;
  }
  return r;
}
function uu(r) {
  var e = xWe(null), t = void 0;
  for (t in r)
    ym(bWe, r, [t]) && (e[t] = r[t]);
  return e;
}
function Lv(r, e) {
  for (; r !== null; ) {
    var t = SWe(r, e);
    if (t) {
      if (t.get)
        return ro(t.get);
      if (typeof t.value == "function")
        return ro(t.value);
    }
    r = TWe(r);
  }
  function n(i) {
    return console.warn("fallback value for", i), null;
  }
  return n;
}
var wC = Ri(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Vy = Ri(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Uy = Ri(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), DWe = Ri(["animate", "color-profile", "cursor", "discard", "fedropshadow", "feimage", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), $y = Ri(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), AWe = Ri(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), bC = Ri(["#text"]), CC = Ri(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), Wy = Ri(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), TC = Ri(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Rv = Ri(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), LWe = Es(/\{\{[\s\S]*|[\s\S]*\}\}/gm), RWe = Es(/<%[\s\S]*|[\s\S]*%>/gm), IWe = Es(/^data-[\-\w.\u00B7-\uFFFF]/), PWe = Es(/^aria-[\-\w]+$/), BWe = Es(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), FWe = Es(/^(?:\w+script|data):/i), _We = Es(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), ah = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
  return typeof r;
} : function(r) {
  return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
};
function Do(r) {
  if (Array.isArray(r)) {
    for (var e = 0, t = Array(r.length); e < r.length; e++)
      t[e] = r[e];
    return t;
  } else
    return Array.from(r);
}
var qWe = function() {
  return typeof window > "u" ? null : window;
}, zWe = function(e, t) {
  if ((typeof e > "u" ? "undefined" : ah(e)) !== "object" || typeof e.createPolicy != "function")
    return null;
  var n = null, i = "data-tt-policy-suffix";
  t.currentScript && t.currentScript.hasAttribute(i) && (n = t.currentScript.getAttribute(i));
  var a = "dompurify" + (n ? "#" + n : "");
  try {
    return e.createPolicy(a, {
      createHTML: function(u) {
        return u;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + a + " could not be created."), null;
  }
};
function EE() {
  var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : qWe(), e = function(ne) {
    return EE(ne);
  };
  if (e.version = "2.3.3", e.removed = [], !r || !r.document || r.document.nodeType !== 9)
    return e.isSupported = !1, e;
  var t = r.document, n = r.document, i = r.DocumentFragment, a = r.HTMLTemplateElement, s = r.Node, u = r.Element, f = r.NodeFilter, p = r.NamedNodeMap, y = p === void 0 ? r.NamedNodeMap || r.MozNamedAttrMap : p, T = r.Text, N = r.Comment, O = r.DOMParser, A = r.trustedTypes, q = u.prototype, U = Lv(q, "cloneNode"), j = Lv(q, "nextSibling"), te = Lv(q, "childNodes"), se = Lv(q, "parentNode");
  if (typeof a == "function") {
    var me = n.createElement("template");
    me.content && me.content.ownerDocument && (n = me.content.ownerDocument);
  }
  var Ce = zWe(A, t), pe = Ce && jt ? Ce.createHTML("") : "", ke = n, Ne = ke.implementation, ze = ke.createNodeIterator, Ze = ke.createDocumentFragment, At = ke.getElementsByTagName, et = t.importNode, Ht = {};
  try {
    Ht = uu(n).documentMode ? n.documentMode : {};
  } catch {
  }
  var Rt = {};
  e.isSupported = typeof se == "function" && Ne && typeof Ne.createHTMLDocument < "u" && Ht !== 9;
  var Ut = LWe, yt = RWe, It = IWe, Ke = PWe, ct = FWe, He = _We, fe = BWe, Le = null, dt = ir({}, [].concat(Do(wC), Do(Vy), Do(Uy), Do($y), Do(bC))), vt = null, Ft = ir({}, [].concat(Do(CC), Do(Wy), Do(TC), Do(Rv))), Lt = null, $t = null, Te = !0, be = !0, ue = !1, ge = !1, oe = !1, Pe = !1, Ve = !1, lt = !1, Tt = !1, Yt = !0, jt = !1, mr = !0, tr = !0, yr = !1, ar = {}, Wr = null, ki = ir({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), Hn = null, _r = ir({}, ["audio", "video", "img", "source", "image", "track"]), st = null, ut = ir({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), _t = "http://www.w3.org/1998/Math/MathML", Vt = "http://www.w3.org/2000/svg", Zt = "http://www.w3.org/1999/xhtml", tn = Zt, kr = !1, xr = void 0, En = ["application/xhtml+xml", "text/html"], Vn = "text/html", Rr = void 0, cn = null, ri = n.createElement("form"), Un = function(ne) {
    cn && cn === ne || ((!ne || (typeof ne > "u" ? "undefined" : ah(ne)) !== "object") && (ne = {}), ne = uu(ne), Le = "ALLOWED_TAGS" in ne ? ir({}, ne.ALLOWED_TAGS) : dt, vt = "ALLOWED_ATTR" in ne ? ir({}, ne.ALLOWED_ATTR) : Ft, st = "ADD_URI_SAFE_ATTR" in ne ? ir(uu(ut), ne.ADD_URI_SAFE_ATTR) : ut, Hn = "ADD_DATA_URI_TAGS" in ne ? ir(uu(_r), ne.ADD_DATA_URI_TAGS) : _r, Wr = "FORBID_CONTENTS" in ne ? ir({}, ne.FORBID_CONTENTS) : ki, Lt = "FORBID_TAGS" in ne ? ir({}, ne.FORBID_TAGS) : {}, $t = "FORBID_ATTR" in ne ? ir({}, ne.FORBID_ATTR) : {}, ar = "USE_PROFILES" in ne ? ne.USE_PROFILES : !1, Te = ne.ALLOW_ARIA_ATTR !== !1, be = ne.ALLOW_DATA_ATTR !== !1, ue = ne.ALLOW_UNKNOWN_PROTOCOLS || !1, ge = ne.SAFE_FOR_TEMPLATES || !1, oe = ne.WHOLE_DOCUMENT || !1, lt = ne.RETURN_DOM || !1, Tt = ne.RETURN_DOM_FRAGMENT || !1, Yt = ne.RETURN_DOM_IMPORT !== !1, jt = ne.RETURN_TRUSTED_TYPE || !1, Ve = ne.FORCE_BODY || !1, mr = ne.SANITIZE_DOM !== !1, tr = ne.KEEP_CONTENT !== !1, yr = ne.IN_PLACE || !1, fe = ne.ALLOWED_URI_REGEXP || fe, tn = ne.NAMESPACE || Zt, xr = // eslint-disable-next-line unicorn/prefer-includes
    En.indexOf(ne.PARSER_MEDIA_TYPE) === -1 ? xr = Vn : xr = ne.PARSER_MEDIA_TYPE, Rr = xr === "application/xhtml+xml" ? function(Ae) {
      return Ae;
    } : Vv, ge && (be = !1), Tt && (lt = !0), ar && (Le = ir({}, [].concat(Do(bC))), vt = [], ar.html === !0 && (ir(Le, wC), ir(vt, CC)), ar.svg === !0 && (ir(Le, Vy), ir(vt, Wy), ir(vt, Rv)), ar.svgFilters === !0 && (ir(Le, Uy), ir(vt, Wy), ir(vt, Rv)), ar.mathMl === !0 && (ir(Le, $y), ir(vt, TC), ir(vt, Rv))), ne.ADD_TAGS && (Le === dt && (Le = uu(Le)), ir(Le, ne.ADD_TAGS)), ne.ADD_ATTR && (vt === Ft && (vt = uu(vt)), ir(vt, ne.ADD_ATTR)), ne.ADD_URI_SAFE_ATTR && ir(st, ne.ADD_URI_SAFE_ATTR), ne.FORBID_CONTENTS && (Wr === ki && (Wr = uu(Wr)), ir(Wr, ne.FORBID_CONTENTS)), tr && (Le["#text"] = !0), oe && ir(Le, ["html", "head", "body"]), Le.table && (ir(Le, ["tbody"]), delete Lt.tbody), Ri && Ri(ne), cn = ne);
  }, rn = ir({}, ["mi", "mo", "mn", "ms", "mtext"]), Xr = ir({}, ["foreignobject", "desc", "title", "annotation-xml"]), gn = ir({}, Vy);
  ir(gn, Uy), ir(gn, DWe);
  var qr = ir({}, $y);
  ir(qr, AWe);
  var $n = function(ne) {
    var Ae = se(ne);
    (!Ae || !Ae.tagName) && (Ae = {
      namespaceURI: Zt,
      tagName: "template"
    });
    var Fe = Vv(ne.tagName), it = Vv(Ae.tagName);
    if (ne.namespaceURI === Vt)
      return Ae.namespaceURI === Zt ? Fe === "svg" : Ae.namespaceURI === _t ? Fe === "svg" && (it === "annotation-xml" || rn[it]) : !!gn[Fe];
    if (ne.namespaceURI === _t)
      return Ae.namespaceURI === Zt ? Fe === "math" : Ae.namespaceURI === Vt ? Fe === "math" && Xr[it] : !!qr[Fe];
    if (ne.namespaceURI === Zt) {
      if (Ae.namespaceURI === Vt && !Xr[it] || Ae.namespaceURI === _t && !rn[it])
        return !1;
      var Nt = ir({}, ["title", "style", "font", "a", "script"]);
      return !qr[Fe] && (Nt[Fe] || !gn[Fe]);
    }
    return !1;
  }, wr = function(ne) {
    Qd(e.removed, { element: ne });
    try {
      ne.parentNode.removeChild(ne);
    } catch {
      try {
        ne.outerHTML = pe;
      } catch {
        ne.remove();
      }
    }
  }, jr = function(ne, Ae) {
    try {
      Qd(e.removed, {
        attribute: Ae.getAttributeNode(ne),
        from: Ae
      });
    } catch {
      Qd(e.removed, {
        attribute: null,
        from: Ae
      });
    }
    if (Ae.removeAttribute(ne), ne === "is" && !vt[ne])
      if (lt || Tt)
        try {
          wr(Ae);
        } catch {
        }
      else
        try {
          Ae.setAttribute(ne, "");
        } catch {
        }
  }, Q = function(ne) {
    var Ae = void 0, Fe = void 0;
    if (Ve)
      ne = "<remove></remove>" + ne;
    else {
      var it = yC(ne, /^[\r\n\t ]+/);
      Fe = it && it[0];
    }
    xr === "application/xhtml+xml" && (ne = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + ne + "</body></html>");
    var Nt = Ce ? Ce.createHTML(ne) : ne;
    if (tn === Zt)
      try {
        Ae = new O().parseFromString(Nt, xr);
      } catch {
      }
    if (!Ae || !Ae.documentElement) {
      Ae = Ne.createDocument(tn, "template", null);
      try {
        Ae.documentElement.innerHTML = kr ? "" : Nt;
      } catch {
      }
    }
    var H = Ae.body || Ae.documentElement;
    return ne && Fe && H.insertBefore(n.createTextNode(Fe), H.childNodes[0] || null), tn === Zt ? At.call(Ae, oe ? "html" : "body")[0] : oe ? Ae.documentElement : H;
  }, X = function(ne) {
    return ze.call(ne.ownerDocument || ne, ne, f.SHOW_ELEMENT | f.SHOW_COMMENT | f.SHOW_TEXT, null, !1);
  }, z = function(ne) {
    return ne instanceof T || ne instanceof N ? !1 : typeof ne.nodeName != "string" || typeof ne.textContent != "string" || typeof ne.removeChild != "function" || !(ne.attributes instanceof y) || typeof ne.removeAttribute != "function" || typeof ne.setAttribute != "function" || typeof ne.namespaceURI != "string" || typeof ne.insertBefore != "function";
  }, F = function(ne) {
    return (typeof s > "u" ? "undefined" : ah(s)) === "object" ? ne instanceof s : ne && (typeof ne > "u" ? "undefined" : ah(ne)) === "object" && typeof ne.nodeType == "number" && typeof ne.nodeName == "string";
  }, V = function(ne, Ae, Fe) {
    Rt[ne] && EWe(Rt[ne], function(it) {
      it.call(e, Ae, Fe, cn);
    });
  }, G = function(ne) {
    var Ae = void 0;
    if (V("beforeSanitizeElements", ne, null), z(ne) || yC(ne.nodeName, /[\u0080-\uFFFF]/))
      return wr(ne), !0;
    var Fe = Rr(ne.nodeName);
    if (V("uponSanitizeElement", ne, {
      tagName: Fe,
      allowedTags: Le
    }), !F(ne.firstElementChild) && (!F(ne.content) || !F(ne.content.firstElementChild)) && gs(/<[/\w]/g, ne.innerHTML) && gs(/<[/\w]/g, ne.textContent) || Fe === "select" && gs(/<template/i, ne.innerHTML))
      return wr(ne), !0;
    if (!Le[Fe] || Lt[Fe]) {
      if (tr && !Wr[Fe]) {
        var it = se(ne) || ne.parentNode, Nt = te(ne) || ne.childNodes;
        if (Nt && it)
          for (var H = Nt.length, R = H - 1; R >= 0; --R)
            it.insertBefore(U(Nt[R], !0), j(ne));
      }
      return wr(ne), !0;
    }
    return ne instanceof u && !$n(ne) || (Fe === "noscript" || Fe === "noembed") && gs(/<\/no(script|embed)/i, ne.innerHTML) ? (wr(ne), !0) : (ge && ne.nodeType === 3 && (Ae = ne.textContent, Ae = il(Ae, Ut, " "), Ae = il(Ae, yt, " "), ne.textContent !== Ae && (Qd(e.removed, { element: ne.cloneNode() }), ne.textContent = Ae)), V("afterSanitizeElements", ne, null), !1);
  }, re = function(ne, Ae, Fe) {
    if (mr && (Ae === "id" || Ae === "name") && (Fe in n || Fe in ri))
      return !1;
    if (!(be && !$t[Ae] && gs(It, Ae))) {
      if (!(Te && gs(Ke, Ae))) {
        if (!vt[Ae] || $t[Ae])
          return !1;
        if (!st[Ae]) {
          if (!gs(fe, il(Fe, He, ""))) {
            if (!((Ae === "src" || Ae === "xlink:href" || Ae === "href") && ne !== "script" && MWe(Fe, "data:") === 0 && Hn[ne])) {
              if (!(ue && !gs(ct, il(Fe, He, "")))) {
                if (Fe) return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, Ee = function(ne) {
    var Ae = void 0, Fe = void 0, it = void 0, Nt = void 0;
    V("beforeSanitizeAttributes", ne, null);
    var H = ne.attributes;
    if (H) {
      var R = {
        attrName: "",
        attrValue: "",
        keepAttr: !0,
        allowedAttributes: vt
      };
      for (Nt = H.length; Nt--; ) {
        Ae = H[Nt];
        var b = Ae, E = b.name, B = b.namespaceURI;
        if (Fe = NWe(Ae.value), it = Rr(E), R.attrName = it, R.attrValue = Fe, R.keepAttr = !0, R.forceKeepAttr = void 0, V("uponSanitizeAttribute", ne, R), Fe = R.attrValue, !R.forceKeepAttr && (jr(E, ne), !!R.keepAttr)) {
          if (gs(/\/>/i, Fe)) {
            jr(E, ne);
            continue;
          }
          ge && (Fe = il(Fe, Ut, " "), Fe = il(Fe, yt, " "));
          var K = Rr(ne.nodeName);
          if (re(K, it, Fe))
            try {
              B ? ne.setAttributeNS(B, E, Fe) : ne.setAttribute(E, Fe), gC(e.removed);
            } catch {
            }
        }
      }
      V("afterSanitizeAttributes", ne, null);
    }
  }, Be = function he(ne) {
    var Ae = void 0, Fe = X(ne);
    for (V("beforeSanitizeShadowDOM", ne, null); Ae = Fe.nextNode(); )
      V("uponSanitizeShadowNode", Ae, null), !G(Ae) && (Ae.content instanceof i && he(Ae.content), Ee(Ae));
    V("afterSanitizeShadowDOM", ne, null);
  };
  return e.sanitize = function(he, ne) {
    var Ae = void 0, Fe = void 0, it = void 0, Nt = void 0, H = void 0;
    if (kr = !he, kr && (he = "<!-->"), typeof he != "string" && !F(he)) {
      if (typeof he.toString != "function")
        throw kC("toString is not a function");
      if (he = he.toString(), typeof he != "string")
        throw kC("dirty is not a string, aborting");
    }
    if (!e.isSupported) {
      if (ah(r.toStaticHTML) === "object" || typeof r.toStaticHTML == "function") {
        if (typeof he == "string")
          return r.toStaticHTML(he);
        if (F(he))
          return r.toStaticHTML(he.outerHTML);
      }
      return he;
    }
    if (Pe || Un(ne), e.removed = [], typeof he == "string" && (yr = !1), !yr) if (he instanceof s)
      Ae = Q("<!---->"), Fe = Ae.ownerDocument.importNode(he, !0), Fe.nodeType === 1 && Fe.nodeName === "BODY" || Fe.nodeName === "HTML" ? Ae = Fe : Ae.appendChild(Fe);
    else {
      if (!lt && !ge && !oe && // eslint-disable-next-line unicorn/prefer-includes
      he.indexOf("<") === -1)
        return Ce && jt ? Ce.createHTML(he) : he;
      if (Ae = Q(he), !Ae)
        return lt ? null : pe;
    }
    Ae && Ve && wr(Ae.firstChild);
    for (var R = X(yr ? he : Ae); it = R.nextNode(); )
      it.nodeType === 3 && it === Nt || G(it) || (it.content instanceof i && Be(it.content), Ee(it), Nt = it);
    if (Nt = null, yr)
      return he;
    if (lt) {
      if (Tt)
        for (H = Ze.call(Ae.ownerDocument); Ae.firstChild; )
          H.appendChild(Ae.firstChild);
      else
        H = Ae;
      return Yt && (H = et.call(t, H, !0)), H;
    }
    var b = oe ? Ae.outerHTML : Ae.innerHTML;
    return ge && (b = il(b, Ut, " "), b = il(b, yt, " ")), Ce && jt ? Ce.createHTML(b) : b;
  }, e.setConfig = function(he) {
    Un(he), Pe = !0;
  }, e.clearConfig = function() {
    cn = null, Pe = !1;
  }, e.isValidAttribute = function(he, ne, Ae) {
    cn || Un({});
    var Fe = Rr(he), it = Rr(ne);
    return re(Fe, it, Ae);
  }, e.addHook = function(he, ne) {
    typeof ne == "function" && (Rt[he] = Rt[he] || [], Qd(Rt[he], ne));
  }, e.removeHook = function(he) {
    Rt[he] && gC(Rt[he]);
  }, e.removeHooks = function(he) {
    Rt[he] && (Rt[he] = []);
  }, e.removeAllHooks = function() {
    Rt = {};
  }, e;
}
var HWe = EE(), VWe = ["iframe", "embed"], ME = [];
function NE(r) {
  ti(VWe, r) && ME.push(r.toLowerCase());
}
function Lu(r, e) {
  return HWe.sanitize(r, _e({ ADD_TAGS: ME, ADD_ATTR: ["rel", "target", "hreflang", "type"], FORBID_TAGS: [
    "input",
    "script",
    "textarea",
    "form",
    "button",
    "select",
    "meta",
    "style",
    "link",
    "title",
    "object",
    "base"
  ] }, e));
}
function OE(r, e) {
  return r.literal.replace(new RegExp("(<\\s*" + e + "[^>]*>)|(</" + e + "\\s*[>])", "ig"), "").trim();
}
function R0(r) {
  r = r.match(ff)[0];
  var e = r.match(new RegExp(Sx, "g"));
  return e ? e.reduce(function(t, n) {
    var i = n.trim().split("="), a = i[0], s = i.slice(1);
    return s.length && (t[a] = s.join("=").replace(/'|"/g, "").trim()), t;
  }, {}) : {};
}
function I0(r) {
  return qo(r.attributes).reduce(function(e, t) {
    return e[t.nodeName] = t.nodeValue, e;
  }, {});
}
function SC(r, e, t, n) {
  var i = n.getToDOMNode(e)(r), a = t(i.outerHTML), s = document.createElement("div");
  s.innerHTML = a, i = s.firstChild;
  var u = I0(i);
  return { dom: i, htmlAttrs: u };
}
var UWe = {
  htmlBlock: function(r, e, t) {
    return {
      atom: !0,
      content: "block+",
      group: "block",
      attrs: {
        htmlAttrs: { default: {} },
        childrenHTML: { default: "" },
        htmlBlock: { default: !0 }
      },
      parseDOM: [
        {
          tag: r,
          getAttrs: function(n) {
            return {
              htmlAttrs: I0(n),
              childrenHTML: n.innerHTML
            };
          }
        }
      ],
      toDOM: function(n) {
        var i = SC(n, r, e, t), a = i.dom, s = i.htmlAttrs;
        return s.class = s.class ? s.class + " html-block" : "html-block", Ki([r, s], qo(a.childNodes));
      }
    };
  },
  htmlInline: function(r, e, t) {
    return {
      attrs: {
        htmlAttrs: { default: {} },
        htmlInline: { default: !0 }
      },
      parseDOM: [
        {
          tag: r,
          getAttrs: function(n) {
            return {
              htmlAttrs: I0(n)
            };
          }
        }
      ],
      toDOM: function(n) {
        var i = SC(n, r, e, t).htmlAttrs;
        return [r, i, 0];
      }
    };
  }
};
function $We(r, e, t) {
  var n = { nodes: {}, marks: {} };
  return ["htmlBlock", "htmlInline"].forEach(function(i) {
    r[i] && Object.keys(r[i]).forEach(function(a) {
      var s = i === "htmlBlock" ? "nodes" : "marks";
      NE(a), n[s][a] = UWe[i](a, e, t);
    });
  }), n;
}
var WWe = /^\s*<\s*\//, jWe = {
  paragraph: function(r, e) {
    var t = e.entering, n = e.origin, i = e.options;
    return i.nodeId ? {
      type: t ? "openTag" : "closeTag",
      outerNewLine: !0,
      tagName: "p"
    } : n();
  },
  softbreak: function(r) {
    var e = r.prev && r.prev.type === "htmlInline", t = e && /<br ?\/?>/.test(r.prev.literal), n = t ? `
` : `<br>
`;
    return { type: "html", content: n };
  },
  item: function(r, e) {
    var t = e.entering;
    if (t) {
      var n = {}, i = [];
      return r.listData.task && (n["data-task"] = "", i.push("task-list-item"), r.listData.checked && (i.push("checked"), n["data-task-checked"] = "")), {
        type: "openTag",
        tagName: "li",
        classNames: i,
        attributes: n,
        outerNewLine: !0
      };
    }
    return {
      type: "closeTag",
      tagName: "li",
      outerNewLine: !0
    };
  },
  code: function(r) {
    var e = { "data-backticks": String(r.tickCount) };
    return [
      { type: "openTag", tagName: "code", attributes: e },
      { type: "text", content: r.literal },
      { type: "closeTag", tagName: "code" }
    ];
  },
  codeBlock: function(r) {
    var e = r, t = e.fenceLength, n = e.info, i = n ? n.split(/\s+/) : [], a = [], s = {};
    if (t > 3 && (s["data-backticks"] = t), i.length > 0 && i[0].length > 0) {
      var u = i[0];
      a.push("lang-" + u), s["data-language"] = u;
    }
    return [
      { type: "openTag", tagName: "pre", classNames: a },
      { type: "openTag", tagName: "code", attributes: s },
      { type: "text", content: r.literal },
      { type: "closeTag", tagName: "code" },
      { type: "closeTag", tagName: "pre" }
    ];
  },
  customInline: function(r, e) {
    var t = e.origin, n = e.entering, i = e.skipChildren, a = r.info;
    if (a.indexOf("widget") !== -1 && n) {
      i();
      var s = wx(r), u = kx(a, s).outerHTML;
      return [
        { type: "openTag", tagName: "span", classNames: ["tui-widget"] },
        { type: "html", content: u },
        { type: "closeTag", tagName: "span" }
      ];
    }
    return t();
  }
};
function Rk(r, e) {
  var t = _e({}, jWe);
  return r && (t.link = function(n, i) {
    var a = i.entering, s = i.origin, u = s();
    return a && (u.attributes = _e(_e({}, u.attributes), r)), u;
  }), e && Object.keys(e).forEach(function(n) {
    var i = t[n], a = e[n];
    i && Ma(a) ? t[n] = function(s, u) {
      var f = _e({}, u);
      return f.origin = function() {
        return i(s, u);
      }, a(s, f);
    } : ti(["htmlBlock", "htmlInline"], n) && !Ma(a) ? t[n] = function(s, u) {
      var f = s.literal.match(ff);
      if (f) {
        var p = f[0], y = f[1], T = f[3], N = (y || T).toLowerCase(), O = a[N], A = OE(s, N);
        if (O) {
          var q = _e({}, s);
          return q.attrs = R0(p), q.childrenHTML = A, q.type = N, u.entering = !WWe.test(s.literal), O(q, u);
        }
      }
      return u.origin();
    } : t[n] = a;
  }), t;
}
var GWe = ["list", "item", "blockQuote"], KWe = ["UL", "OL", "BLOCKQUOTE"];
function JWe(r, e) {
  var t, n = r.child(e);
  return !n.childCount || n.childCount === 1 && !(!((t = n.firstChild.text) === null || t === void 0) && t.trim());
}
function xC(r, e, t) {
  var n = Mh(e) - 1, i = Rm(e) - 1, a = t[n].getBoundingClientRect(), s = t[i].offsetTop - t[n].offsetTop + t[i].clientHeight;
  return {
    height: s <= 0 ? t[n].clientHeight : s + QWe(r, t, Math.min(i + 1, r.childCount - 1)),
    rect: a
  };
}
function QWe(r, e, t) {
  for (var n = r.childCount - 1, i = 0; t <= n && JWe(r, t); )
    i += e[t].clientHeight, t += 1;
  return i;
}
function XWe(r, e) {
  for (; !r.getAttribute("data-nodeid") && r.parentElement !== e; )
    r = r.parentElement;
  return r;
}
function km(r, e) {
  for (var t = 0; r && r !== e && (ti(KWe, r.tagName) || (t += r.offsetTop), r.offsetParent !== e.offsetParent); )
    r = r.parentElement;
  return t;
}
function YWe(r, e) {
  for (var t = e, n = null; t; ) {
    var i = t.firstElementChild;
    if (!i)
      break;
    var a = DE(i, r, km(t, e));
    n = t, t = a;
  }
  var s = t || n;
  return s === e ? null : s;
}
function DE(r, e, t) {
  return r && e > t + r.offsetTop ? DE(r.nextElementSibling, e, t) || r : null;
}
function ZWe(r, e, t, n) {
  var i = Math.min((r - e) / t, 1);
  return i * n;
}
function jy(r, e) {
  for (var t = r.querySelector('[data-nodeid="' + e.id + '"]'); !t || Hne(e); )
    e = e.parent, t = r.querySelector('[data-nodeid="' + e.id + '"]');
  return eje({ mdNode: e, el: t });
}
function eje(r) {
  for (var e = r.mdNode, t = r.el; (ti(GWe, e.type) || e.type === "table") && e.firstChild; )
    e = e.firstChild, t = t.firstElementChild;
  return { mdNode: e, el: t };
}
var Za = {};
function tje(r, e) {
  Za[r] = Za[r] || {}, Za[r].height = e;
}
function rje(r, e) {
  Za[r] = Za[r] || {}, Za[r].offsetTop = e;
}
function nje(r) {
  return Za[r] && Za[r].height;
}
function ije(r) {
  return Za[r] && Za[r].offsetTop;
}
function P0(r) {
  r && (delete Za[Number(r.getAttribute("data-nodeid"))], qo(r.children).forEach(function(e) {
    P0(e);
  }));
}
function aje(r, e, t) {
  var n = nje(t), i = ije(t), a = n || r.clientHeight, s = i || km(r, e) || r.offsetTop;
  return n || tje(t, a), i || rje(t, s), { nodeHeight: a, offsetTop: s };
}
var Gy = Mt("md-preview-highlight");
function oje(r, e) {
  for (var t = r.firstChild; t && t.next && !(Im(t.next) > e + 1); )
    t = t.next;
  return t;
}
var AE = (
  /** @class */
  (function() {
    function r(e, t) {
      var n = document.createElement("div");
      this.el = n, this.eventEmitter = e, this.isViewer = !!t.isViewer, this.el.className = Mt("md-preview");
      var i = t.linkAttributes, a = t.customHTMLRenderer, s = t.sanitizer, u = t.highlight, f = u === void 0 ? !1 : u;
      this.renderer = new Lk({
        gfm: !0,
        nodeId: !0,
        convertors: Rk(i, a)
      }), this.cursorNodeId = null, this.sanitizer = s, this.initEvent(f), this.initContentSection(), this.isViewer && (this.previewContent.style.overflowWrap = "break-word");
    }
    return r.prototype.initContentSection = function() {
      this.previewContent = Ox('<div class="' + Mt("contents") + '"></div>'), this.isViewer || this.el.appendChild(this.previewContent);
    }, r.prototype.toggleActive = function(e) {
      yk(this.el, "active", e);
    }, r.prototype.initEvent = function(e) {
      var t = this;
      this.eventEmitter.listen("updatePreview", this.update.bind(this)), !this.isViewer && (e && (this.eventEmitter.listen("changeToolbarState", function(n) {
        var i = n.mdNode, a = n.cursorPos;
        t.updateCursorNode(i, a);
      }), this.eventEmitter.listen("blur", function() {
        t.removeHighlight();
      })), jx(this.el, "scroll", function(n) {
        t.eventEmitter.emit("scroll", "preview", YWe(n.target.scrollTop, t.previewContent));
      }), this.eventEmitter.listen("changePreviewTabPreview", function() {
        return t.toggleActive(!0);
      }), this.eventEmitter.listen("changePreviewTabWrite", function() {
        return t.toggleActive(!1);
      }));
    }, r.prototype.removeHighlight = function() {
      if (this.cursorNodeId) {
        var e = this.getElementByNodeId(this.cursorNodeId);
        e && Ya(e, Gy);
      }
    }, r.prototype.updateCursorNode = function(e, t) {
      e && (e = cf(e, function(s) {
        return !$ne(s);
      }), e.type === "tableRow" ? e = oje(e, t[1]) : e.type === "tableBody" && (e = null));
      var n = e ? e.id : null;
      if (this.cursorNodeId !== n) {
        var i = this.getElementByNodeId(this.cursorNodeId), a = this.getElementByNodeId(n);
        i && Ya(i, Gy), a && Io(a, Gy), this.cursorNodeId = n;
      }
    }, r.prototype.getElementByNodeId = function(e) {
      return e ? this.previewContent.querySelector('[data-nodeid="' + e + '"]') : null;
    }, r.prototype.update = function(e) {
      var t = this;
      e.forEach(function(n) {
        return t.replaceRangeNodes(n);
      }), this.eventEmitter.emit("afterPreviewRender", this);
    }, r.prototype.replaceRangeNodes = function(e) {
      var t = this, n = e.nodes, i = e.removedNodeRange, a = this.previewContent, s = this.eventEmitter.emitReduce("beforePreviewRender", this.sanitizer(n.map(function(A) {
        return t.renderer.render(A);
      }).join("")));
      if (!i)
        a.insertAdjacentHTML("afterbegin", s);
      else {
        var u = i.id, f = u[0], p = u[1], y = this.getElementByNodeId(f), T = this.getElementByNodeId(p);
        if (y) {
          y.insertAdjacentHTML("beforebegin", s);
          for (var N = y; N && N !== T; ) {
            var O = N.nextElementSibling;
            Ou(N), P0(N), N = O;
          }
          N?.parentNode && (Ou(N), P0(N));
        }
      }
    }, r.prototype.getRenderer = function() {
      return this.renderer;
    }, r.prototype.destroy = function() {
      Wx(this.el, "scroll"), this.el = null;
    }, r.prototype.getElement = function() {
      return this.el;
    }, r.prototype.getHTML = function() {
      return bk(this.previewContent.innerHTML);
    }, r.prototype.setHTML = function(e) {
      this.previewContent.innerHTML = e;
    }, r.prototype.setHeight = function(e) {
      _o(this.el, { height: e + "px" });
    }, r.prototype.setMinHeight = function(e) {
      _o(this.el, { minHeight: e + "px" });
    }, r;
  })()
);
function Cs(r, e) {
  for (var t = r.depth; t; ) {
    var n = r.node(t);
    if (e(n, t))
      return {
        node: n,
        depth: t,
        offset: t > 0 ? r.before(t) : 0
      };
    t -= 1;
  }
  return null;
}
function vf(r) {
  return !!Cs(r, function(e) {
    var t = e.type;
    return t.name === "listItem" || t.name === "bulletList" || t.name === "orderedList";
  });
}
function wm(r) {
  return !!Cs(r, function(e) {
    var t = e.type;
    return t.name === "tableHeadCell" || t.name === "tableBodyCell";
  });
}
function mf(r) {
  return Cs(r, function(e) {
    var t = e.type;
    return t.name === "listItem";
  });
}
function Um(r) {
  return {
    tag: r,
    getAttrs: function(e) {
      var t = e.getAttribute("data-raw-html");
      return _e({}, t && { rawHTML: t });
    }
  };
}
function LE(r) {
  return Object.keys(r).reduce(function(e, t) {
    return t !== "rawHTML" && r[t] && (t = t === "className" ? "class" : t, e[t] = r[t]), e;
  }, {});
}
function RE(r) {
  return {
    tag: r,
    getAttrs: function(e) {
      return ["rawHTML", "colspan", "rowspan", "extended"].reduce(function(t, n) {
        var i = n === "rawHTML" ? "data-raw-html" : n, a = e.getAttribute(i);
        return a && (t[n] = ti(["rawHTML", "extended"], n) ? a : Number(a)), t;
      }, {});
    }
  };
}
function zn() {
  return {
    htmlAttrs: { default: null },
    classNames: { default: null }
  };
}
function mn(r) {
  var e = r.htmlAttrs, t = r.classNames;
  return _e(_e({}, e), { class: t ? t.join(" ") : null });
}
function sje(r, e) {
  var t = r.parent, n = r.startIndex, i = r.endIndex, a = t.contentMatchAt(n).findWrapping(e);
  if (a) {
    var s = a.length ? a[0] : e;
    return t.canReplaceWith(n, i, s) ? a : null;
  }
  return null;
}
function lje(r, e) {
  var t = r.parent, n = r.startIndex, i = r.endIndex, a = t.child(n), s = e.contentMatch.findWrapping(a.type);
  if (s) {
    for (var u = s.length ? s[s.length - 1] : e, f = u.contentMatch, p = n; f && p < i; p += 1)
      f = f.matchType(t.child(p).type);
    if (f && f.validEnd)
      return s;
  }
  return null;
}
function uje(r, e, t, n) {
  var i = sje(r, t), a = lje(e, t);
  if (i && a) {
    var s = i.map(function(f) {
      return { type: f };
    }), u = a.map(function(f) {
      return { type: f, attrs: n };
    });
    return s.concat({ type: t }).concat(u);
  }
  return null;
}
function cje(r, e, t, n, i) {
  for (var a = e.start, s = e.end, u = e.startIndex, f = e.endIndex, p = e.parent, y = Qe.empty, T = t.length - 1; T >= 0; T -= 1)
    y = Qe.from(t[T].type.create(t[T].attrs, y));
  r.step(new _n(a - (n ? 2 : 0), s, a, s, new ht(y, 0, 0), t.length, !0));
  for (var N = 0, T = 0; T < t.length; T += 1)
    if (t[T].type === i) {
      N = T + 1;
      break;
    }
  for (var O = t.length - N, A = a + t.length - (n ? 2 : 0), T = u, q = f; T < q; T += 1) {
    var U = T === u;
    !U && ef(r.doc, A, O) && (r.split(A, O), A += O * 2), A += p.child(T).nodeSize;
  }
  return r;
}
function IE(r, e, t, n) {
  var i = e.$from, a = e.$to, s = e.depth, u = e, f = !1;
  if (s >= 2 && i.node(s - 1).type.compatibleContent(t) && e.startIndex === 0 && i.index(s - 1)) {
    var p = r.doc.resolve(e.start - 2);
    u = new Xv(p, p, s), e.endIndex < e.parent.childCount && (e = new Xv(i, r.doc.resolve(a.end(s)), s)), f = !0;
  }
  var y = uje(u, e, t, n);
  return y ? cje(r, e, y, f, t) : r;
}
function PE(r, e) {
  for (var t = r.resolve(e); t.node().type.name !== "paragraph"; )
    e -= 2, t = r.resolve(e);
  return mf(t);
}
function fje(r, e) {
  var t = e.$from, n = e.$to, i = mf(t), a = mf(n);
  if (i && a)
    for (; a; ) {
      var s = a.offset, u = a.node, f = { task: !u.attrs.task, checked: !1 };
      if (r.setNodeMarkup(s, null, f), s === i.offset)
        break;
      a = PE(r.doc, s);
    }
  return r;
}
function dje(r, e, t) {
  var n = e.$from, i = e.$to, a = mf(n), s = mf(i);
  if (a && s)
    for (; s; ) {
      var u = s.offset, f = s.node, p = s.depth;
      f.attrs.task && r.setNodeMarkup(u, null, { task: !1, checked: !1 });
      var y = r.doc.resolve(u);
      if (y.parent.type !== t) {
        var T = y.before(p - 1);
        r.setNodeMarkup(T, t);
      }
      if (u === a.offset)
        break;
      s = PE(r.doc, u);
    }
  return r;
}
function BE(r) {
  return function(e, t) {
    var n = e.selection, i = e.tr, a = n.$from, s = n.$to, u = a.blockRange(s);
    if (u) {
      var f = vf(a) ? dje(i, u, r) : IE(i, u, r);
      return t(f), !0;
    }
    return !1;
  };
}
function hje() {
  return function(r, e) {
    var t = r.selection, n = r.tr, i = r.schema, a = t.$from, s = t.$to, u = a.blockRange(s);
    if (u) {
      var f = vf(a) ? fje(n, u) : IE(n, u, i.nodes.bulletList, { task: !0 });
      return e(f), !0;
    }
    return !1;
  };
}
function pje(r) {
  return function(e, t) {
    var n = e.tr, i = e.selection, a = i.$from, s = i.$to, u = a.blockRange(s, function(q) {
      var U = q.childCount, j = q.firstChild;
      return !!U && j.type === r;
    });
    if (u && u.startIndex > 0) {
      var f = u.parent, p = f.child(u.startIndex - 1);
      if (p.type !== r)
        return !1;
      var y = p.lastChild && p.lastChild.type === f.type, T = y ? Qe.from(r.create()) : null, N = new ht(Qe.from(r.create(null, Qe.from(f.type.create(null, T)))), y ? 3 : 1, 0), O = u.start, A = u.end;
      return n.step(new _n(O - (y ? 3 : 1), A, O, A, N, 1, !0)), t(n), !0;
    }
    return !1;
  };
}
function vje(r, e, t) {
  var n = e.$from, i = e.$to, a = e.end, s = e.depth, u = e.parent, f = i.end(s);
  return a < f && (r.step(new _n(a - 1, f, a, f, new ht(Qe.from(t.create(null, u.copy())), 1, 0), 1, !0)), e = new Xv(r.doc.resolve(n.pos), r.doc.resolve(f), s)), r.lift(e, xm(e)), r;
}
function mje(r, e) {
  for (var t = e.parent, n = e.end, i = e.endIndex - 1, a = e.startIndex; i > a; i -= 1)
    n -= t.child(i).nodeSize, r.delete(n - 1, n + 1);
  var s = r.doc.resolve(e.start), u = s.nodeAfter, f = e.startIndex === 0, p = e.endIndex === t.childCount, y = s.node(-1), T = s.index(-1), N = y.canReplace(T + (f ? 0 : 1), T + 1, u?.content.append(p ? Qe.empty : Qe.from(t)));
  if (u && N) {
    var O = s.pos, A = O + u.nodeSize;
    r.step(new _n(O - (f ? 1 : 0), A + (p ? 1 : 0), O + 1, A - 1, new ht((f ? Qe.empty : Qe.from(t.copy(Qe.empty))).append(p ? Qe.empty : Qe.from(t.copy(Qe.empty))), f ? 0 : 1, p ? 0 : 1), f ? 0 : 1));
  }
  return r;
}
function gje(r) {
  return function(e, t) {
    var n = e.tr, i = e.selection, a = i.$from, s = i.$to, u = a.blockRange(s, function(y) {
      var T = y.childCount, N = y.firstChild;
      return !!T && N.type === r;
    });
    if (u) {
      var f = a.node(u.depth - 1).type === r, p = f ? vje(n, u, r) : mje(n, u);
      return t(p), !0;
    }
    return !1;
  };
}
function yje(r) {
  return function(e, t) {
    var n = e.tr, i = e.selection, a = i.$from, s = i.$to;
    if (a.depth < 2 || !a.sameParent(s))
      return !1;
    var u = a.node(-1);
    if (u.type !== r)
      return !1;
    if (a.parent.content.size === 0 && a.node(-1).childCount === a.indexAfter(-1)) {
      if (a.depth === 2 || a.node(-3).type !== r || a.index(-2) !== a.node(-2).childCount - 1)
        return !1;
      for (var f = a.index(-1) > 0, p = Qe.empty, y = a.depth - (f ? 1 : 2); y >= a.depth - 3; y -= 1)
        p = Qe.from(a.node(y).copy(p));
      return p = p.append(Qe.from(r.createAndFill())), n.replace(f ? a.before() : a.before(-1), a.after(-3), new ht(p, f ? 3 : 2, 2)), n.setSelection(cr.near(n.doc.resolve(a.pos + (f ? 3 : 2)))), t(n), !0;
    }
    var T = s.pos === a.end() ? u.contentMatchAt(0).defaultType : null, N = T && [null, { type: T }];
    return n.delete(a.pos, s.pos), ef(n.doc, a.pos, 2, N) ? (n.split(a.pos, 2, N), t(n), !0) : !1;
  };
}
function kje() {
  return function() {
    return function(r, e) {
      var t = r.selection, n = r.schema, i = t.$from, a = t.$to, s = i.blockRange(a);
      return s && vf(i) ? pje(n.nodes.listItem)(r, e) : !1;
    };
  };
}
function wje() {
  return function() {
    return function(r, e) {
      var t = r.selection, n = r.schema, i = t.$from, a = t.$to, s = i.blockRange(a);
      return s && vf(i) ? gje(n.nodes.listItem)(r, e) : !1;
    };
  };
}
function Ik() {
  return {
    indent: kje(),
    outdent: wje()
  };
}
var EC = /* @__PURE__ */ new Map(), Qn = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      this.table = e, this.tableRows = t, this.tableStartPos = n, this.rowInfo = i;
    }
    return r.create = function(e) {
      var t = Cs(e, function(A) {
        var q = A.type;
        return q.name === "table";
      });
      if (t) {
        var n = t.node, i = t.depth, a = t.offset, s = EC.get(n);
        if (s?.tableStartPos === a + 1)
          return s;
        var u = [], f = e.start(i), p = n.child(0), y = n.child(1), T = B0(p, f), N = B0(y, f + p.nodeSize);
        p.forEach(function(A) {
          return u.push(A);
        }), y.forEach(function(A) {
          return u.push(A);
        });
        var O = new r(n, u, f, T.concat(N));
        return EC.set(n, O), O;
      }
      return null;
    }, Object.defineProperty(r.prototype, "totalRowCount", {
      get: function() {
        return this.rowInfo.length;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(r.prototype, "totalColumnCount", {
      get: function() {
        return this.rowInfo[0].length;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(r.prototype, "tableStartOffset", {
      get: function() {
        return this.tableStartPos;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(r.prototype, "tableEndOffset", {
      get: function() {
        return this.tableStartPos + this.table.nodeSize - 1;
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.getCellInfo = function(e, t) {
      return this.rowInfo[e][t];
    }, r.prototype.posAt = function(e, t) {
      for (var n = 0, i = this.tableStartPos; ; n += 1) {
        var a = i + this.tableRows[n].nodeSize;
        if (n === e) {
          for (var s = t; s < this.totalColumnCount && this.rowInfo[n][s].offset < i; )
            s += 1;
          return s === this.totalColumnCount ? a : this.rowInfo[n][s].offset;
        }
        i = a;
      }
    }, r.prototype.getNodeAndPos = function(e, t) {
      var n = this.rowInfo[e][t];
      return {
        node: this.table.nodeAt(n.offset - this.tableStartOffset),
        pos: n.offset
      };
    }, r.prototype.extendedRowspan = function(e, t) {
      return !1;
    }, r.prototype.extendedColspan = function(e, t) {
      return !1;
    }, r.prototype.getRowspanCount = function(e, t) {
      return 0;
    }, r.prototype.getColspanCount = function(e, t) {
      return 0;
    }, r.prototype.decreaseColspanCount = function(e, t) {
      return 0;
    }, r.prototype.decreaseRowspanCount = function(e, t) {
      return 0;
    }, r.prototype.getColspanStartInfo = function(e, t) {
      return null;
    }, r.prototype.getRowspanStartInfo = function(e, t) {
      return null;
    }, r.prototype.getCellStartOffset = function(e, t) {
      var n = this.rowInfo[e][t].offset;
      return this.extendedRowspan(e, t) ? this.posAt(e, t) : n;
    }, r.prototype.getCellEndOffset = function(e, t) {
      var n = this.rowInfo[e][t], i = n.offset, a = n.nodeSize;
      return this.extendedRowspan(e, t) ? this.posAt(e, t) : i + a;
    }, r.prototype.getCellIndex = function(e) {
      for (var t = 0; t < this.totalRowCount; t += 1)
        for (var n = this.rowInfo[t], i = 0; i < this.totalColumnCount; i += 1)
          if (n[i].offset + 1 > e.pos)
            return [t, i];
      return [0, 0];
    }, r.prototype.getRectOffsets = function(e, t) {
      var n, i, a;
      t === void 0 && (t = e), e.pos > t.pos && (n = [t, e], e = n[0], t = n[1]);
      var s = this.getCellIndex(e), u = s[0], f = s[1], p = this.getCellIndex(t), y = p[0], T = p[1];
      return i = Mb(u, y), u = i[0], y = i[1], a = Mb(f, T), f = a[0], T = a[1], this.getSpannedOffsets({ startRowIdx: u, startColIdx: f, endRowIdx: y, endColIdx: T });
    }, r.prototype.getSpannedOffsets = function(e) {
      return e;
    }, r;
  })()
), B0 = function(r, e) {
  var t = [];
  return r.forEach(function(n, i) {
    var a = { rowspanMap: {}, colspanMap: {}, length: 0 };
    n.forEach(function(s, u) {
      for (var f = s.nodeSize, p = 0; a[p]; )
        p += 1;
      a[p] = {
        // 2 is the sum of the front and back positions of the tag
        offset: e + i + u + 2,
        nodeSize: f
      }, a.length += 1;
    }), t.push(a);
  }), t;
};
function bje(r, e) {
  return pk(Qn.prototype, r), B0 = e, Qn;
}
function Cje(r, e, t) {
  for (var n = t.startRowIdx, i = t.startColIdx, a = t.endRowIdx, s = t.endColIdx, u = [], f = n; f <= a; f += 1)
    for (var p = i; p <= s; p += 1) {
      var y = e.getCellInfo(f, p), T = y.offset, N = y.nodeSize;
      u.push(new kS(r.resolve(T + 1), r.resolve(T + N - 1)));
    }
  return u;
}
function Tje(r, e) {
  var t = [];
  return r.childCount && t.push(r), e.childCount && t.push(e), Qe.from(t);
}
var Pk = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t, n) {
      n === void 0 && (n = t);
      var i = this, a = t.node(0), s = Qn.create(t), u = s.getRectOffsets(t, n), f = Cje(a, s, u);
      return i = r.call(this, f[0].$from, f[0].$to, f) || this, i.startCell = t, i.endCell = n, i.offsetMap = s, i.isCellSelection = !0, i.visible = !1, i;
    }
    return e.prototype.map = function(t, n) {
      var i = this.startCell.pos, a = this.endCell.pos, s = t.resolve(n.map(i)), u = t.resolve(n.map(a)), f = Qn.create(s);
      if (this.offsetMap.totalColumnCount > f.totalColumnCount || this.offsetMap.totalRowCount > f.totalRowCount) {
        var p = { tableBody: 1, tableRow: 2, tableCell: 3, paragraph: 4 }, y = p[u.parent.type.name], T = u.end(u.depth - y), N = Math.min(T - 4, u.pos);
        return dr.create(t, N);
      }
      return new e(s, u);
    }, e.prototype.eq = function(t) {
      return t instanceof e && t.startCell.pos === this.startCell.pos && t.endCell.pos === this.endCell.pos;
    }, e.prototype.content = function() {
      for (var t = this.startCell.node(-2), n = this.startCell.start(-2), i = t.child(1).firstChild, a = t.child(0).type.create(), s = t.child(1).type.create(), u = Qn.create(this.startCell), f = u.getRectOffsets(this.startCell, this.endCell), p = f.startRowIdx, y = f.startColIdx, T = f.endRowIdx, N = f.endColIdx, O = !1, A = p; A <= T; A += 1) {
        for (var q = [], U = y; U <= N; U += 1) {
          var j = u.getCellInfo(A, U).offset, te = t.nodeAt(j - n);
          te && (O = te.type.name === "tableHeadCell", u.extendedRowspan(A, U) || u.extendedColspan(A, U) ? q.push(te.type.create({ extended: !0 })) : q.push(te.copy(te.content)));
        }
        var se = i.copy(Qe.from(q)), me = O ? a : s;
        me.content = me.content.append(Qe.from(se));
      }
      return new ht(Tje(a, s), 1, 1);
    }, e.prototype.toJSON = function() {
      return JSON.stringify(this);
    }, e;
  })(cr)
);
function Sje(r, e, t) {
  for (var n = e.nodes, i = n.tableRow, a = n.tableHeadCell, s = n.paragraph, u = [], f = 0; f < r; f += 1) {
    var p = t && t[f], y = s.create(null, p ? e.text(p) : []);
    u.push(a.create(null, y));
  }
  return [i.create(null, u)];
}
function FE(r, e, t, n) {
  for (var i = t.nodes, a = i.tableRow, s = i.tableBodyCell, u = i.paragraph, f = [], p = 0; p < r; p += 1) {
    for (var y = [], T = 0; T < e; T += 1) {
      var N = n && n[p * e + T], O = u.create(null, N ? t.text(N) : []);
      y.push(s.create(null, O));
    }
    f.push(a.create(null, y));
  }
  return f;
}
function Uv(r, e, t, n) {
  n === void 0 && (n = null);
  for (var i = t.nodes, a = i.tableHeadCell, s = i.tableBodyCell, u = i.paragraph, f = e === 0 ? a : s, p = [], y = 0; y < r; y += 1)
    p.push(f.create(n, u.create()));
  return p;
}
function _E(r, e) {
  for (; r && r !== e; ) {
    if (r.nodeName === "TD" || r.nodeName === "TH")
      return r;
    r = r.parentNode;
  }
  return null;
}
function qE(r) {
  return Cs(r, function(e) {
    var t = e.type;
    return t.name === "tableHeadCell" || t.name === "tableBodyCell";
  });
}
function Ao(r) {
  if (r instanceof dr) {
    var e = r.$anchor, t = qE(e);
    if (t) {
      var n = e.node(0).resolve(e.before(t.depth));
      return { anchor: n, head: n };
    }
  }
  var i = r, a = i.startCell, s = i.endCell;
  return { anchor: a, head: s };
}
function zE(r) {
  var e;
  if (r.size) {
    var t = r.content, n = r.openStart, i = r.openEnd;
    if (t.childCount !== 1)
      return null;
    for (; t.childCount === 1 && (n > 0 && i > 0 || ((e = t.firstChild) === null || e === void 0 ? void 0 : e.type.name) === "table"); )
      n -= 1, i -= 1, t = t.firstChild.content;
    if (t.firstChild.type.name === "tableHead" || t.firstChild.type.name === "tableBody")
      return t;
  }
  return null;
}
function Yc(r) {
  var e = r.startRowIdx, t = r.startColIdx, n = r.endRowIdx, i = r.endColIdx, a = n - e + 1, s = i - t + 1;
  return { rowCount: a, columnCount: s };
}
function xje(r, e) {
  return _e(_e({}, r.attrs), e);
}
var ul = new Ch("cellSelection"), Eje = 2, Mje = (
  /** @class */
  (function() {
    function r(e) {
      this.view = e, this.handlers = {
        mousedown: this.handleMousedown.bind(this),
        mousemove: this.handleMousemove.bind(this),
        mouseup: this.handleMouseup.bind(this)
      }, this.startCellPos = null, this.init();
    }
    return r.prototype.init = function() {
      this.view.dom.addEventListener("mousedown", this.handlers.mousedown);
    }, r.prototype.handleMousedown = function(e) {
      var t = _E(e.target, this.view.dom);
      if (e.button === Eje) {
        e.preventDefault();
        return;
      }
      if (t) {
        var n = this.getCellPos(e);
        n && (this.startCellPos = n), this.bindEvent();
      }
    }, r.prototype.handleMousemove = function(e) {
      var t = ul.getState(this.view.state), n = this.getCellPos(e), i = this.startCellPos, a;
      t ? a = this.view.state.doc.resolve(t) : i !== n && (a = i), a && i && n && this.setCellSelection(i, n);
    }, r.prototype.handleMouseup = function() {
      this.startCellPos = null, this.unbindEvent(), ul.getState(this.view.state) !== null && this.view.dispatch(this.view.state.tr.setMeta(ul, -1));
    }, r.prototype.bindEvent = function() {
      var e = this.view.dom;
      e.addEventListener("mousemove", this.handlers.mousemove), e.addEventListener("mouseup", this.handlers.mouseup);
    }, r.prototype.unbindEvent = function() {
      var e = this.view.dom;
      e.removeEventListener("mousemove", this.handlers.mousemove), e.removeEventListener("mouseup", this.handlers.mouseup);
    }, r.prototype.getCellPos = function(e) {
      var t = e.clientX, n = e.clientY, i = this.view.posAtCoords({ left: t, top: n });
      if (i) {
        var a = this.view.state.doc, s = a.resolve(i.pos), u = qE(s);
        if (u) {
          var f = s.before(u.depth);
          return a.resolve(f);
        }
      }
      return null;
    }, r.prototype.setCellSelection = function(e, t) {
      var n = this.view.state, i = n.selection, a = n.tr, s = ul.getState(this.view.state) === null, u = new Pk(e, t);
      if (s || !i.eq(u)) {
        var f = a.setSelection(u);
        s && f.setMeta(ul, t.pos), this.view.dispatch(f);
      }
    }, r.prototype.destroy = function() {
      this.view.dom.removeEventListener("mousedown", this.handlers.mousedown);
    }, r;
  })()
), Nje = Mt("cell-selected");
function Oje(r) {
  var e = r.selection, t = r.doc;
  if (e instanceof Pk) {
    var n = [], i = e.ranges;
    return i.forEach(function(a) {
      var s = a.$from, u = a.$to;
      n.push(ji.node(s.pos - 1, u.pos + 1, { class: Nje }));
    }), un.create(t, n);
  }
  return null;
}
function Dje() {
  return new Ji({
    key: ul,
    state: {
      init: function() {
        return null;
      },
      apply: function(r, e) {
        var t = r.getMeta(ul);
        if (t)
          return t === -1 ? null : t;
        if (om(e) || !r.docChanged)
          return e;
        var n = r.mapping.mapResult(e), i = n.deleted, a = n.pos;
        return i ? null : a;
      }
    },
    props: {
      decorations: Oje,
      createSelectionBetween: function(r) {
        var e = r.state;
        return om(ul.getState(e)) ? null : e.selection;
      }
    },
    view: function(r) {
      return new Mje(r);
    }
  });
}
var HE = (
  /** @class */
  (function() {
    function r() {
      this.keys = [], this.values = [];
    }
    return r.prototype.getKeyIndex = function(e) {
      return Mu(e, this.keys);
    }, r.prototype.get = function(e) {
      return this.values[this.getKeyIndex(e)];
    }, r.prototype.set = function(e, t) {
      var n = this.getKeyIndex(e);
      return n > -1 ? this.values[n] = t : (this.keys.push(e), this.values.push(t)), this;
    }, r.prototype.has = function(e) {
      return this.getKeyIndex(e) > -1;
    }, r.prototype.delete = function(e) {
      var t = this.getKeyIndex(e);
      return t > -1 ? (this.keys.splice(t, 1), this.values.splice(t, 1), !0) : !1;
    }, r.prototype.forEach = function(e, t) {
      var n = this;
      t === void 0 && (t = this), this.values.forEach(function(i, a) {
        i && n.keys[a] && e.call(t, i, n.keys[a], n);
      });
    }, r.prototype.clear = function() {
      this.keys = [], this.values = [];
    }, r;
  })()
), Ky = "en-US", Aje = (
  /** @class */
  (function() {
    function r() {
      this.code = Ky, this.langs = new HE();
    }
    return r.prototype.setCode = function(e) {
      this.code = e || Ky;
    }, r.prototype.setLanguage = function(e, t) {
      var n = this;
      e = [].concat(e), e.forEach(function(i) {
        if (!n.langs.has(i))
          n.langs.set(i, t);
        else {
          var a = n.langs.get(i);
          n.langs.set(i, lk(a, t));
        }
      });
    }, r.prototype.get = function(e, t) {
      t || (t = this.code);
      var n = this.langs.get(t);
      n || (n = this.langs.get(Ky));
      var i = n[e];
      if (!i)
        throw new Error('There is no text key "' + e + '" in ' + t);
      return i;
    }, r;
  })()
), Xt = new Aje(), Lje = [
  [
    {
      action: "Add row to up",
      command: "addRowToUp",
      disableInThead: !0,
      className: "add-row-up"
    },
    {
      action: "Add row to down",
      command: "addRowToDown",
      disableInThead: !0,
      className: "add-row-down"
    },
    { action: "Remove row", command: "removeRow", disableInThead: !0, className: "remove-row" }
  ],
  [
    { action: "Add column to left", command: "addColumnToLeft", className: "add-column-left" },
    { action: "Add column to right", command: "addColumnToRight", className: "add-column-right" },
    { action: "Remove column", command: "removeColumn", className: "remove-column" }
  ],
  [
    {
      action: "Align column to left",
      command: "alignColumn",
      payload: { align: "left" },
      className: "align-column-left"
    },
    {
      action: "Align column to center",
      command: "alignColumn",
      payload: { align: "center" },
      className: "align-column-center"
    },
    {
      action: "Align column to right",
      command: "alignColumn",
      payload: { align: "right" },
      className: "align-column-right"
    }
  ],
  [{ action: "Remove table", command: "removeTable", className: "remove-table" }]
];
function Rje(r, e) {
  return Lje.map(function(t) {
    return t.map(function(n) {
      var i = n.action, a = n.command, s = n.payload, u = n.disableInThead, f = n.className;
      return {
        label: Xt.get(i),
        onClick: function() {
          r.emit("command", a, s);
        },
        disabled: e && !!u,
        className: f
      };
    });
  }).concat();
}
function Ije(r) {
  return new Ji({
    props: {
      handleDOMEvents: {
        contextmenu: function(e, t) {
          var n = _E(t.target, e.dom);
          if (n) {
            t.preventDefault();
            var i = t, a = i.clientX, s = i.clientY, u = e.dom.parentNode.getBoundingClientRect(), f = u.left, p = u.top, y = n.nodeName === "TH";
            return r.emit("contextmenu", {
              pos: { left: a - f + 10 + "px", top: s - p + 30 + "px" },
              menuGroups: Rje(r, y),
              tableCell: n
            }), !0;
          }
          return !1;
        }
      }
    }
  });
}
function Pje() {
  return new Ji({
    props: {
      handleDOMEvents: {
        mousedown: function(r, e) {
          var t = e, n = t.clientX, i = t.clientY, a = r.posAtCoords({ left: n, top: i });
          if (a) {
            var s = r.state, u = s.doc, f = s.tr, p = u.resolve(a.pos), y = mf(p), T = e.target, N = getComputedStyle(T, ":before"), O = e, A = O.offsetX, q = O.offsetY;
            if (!y || !gk(N, A, q))
              return !1;
            e.preventDefault();
            var U = p.before(y.depth), j = y.node.attrs;
            return f.setNodeMarkup(U, null, _e(_e({}, j), { checked: !j.checked })), r.dispatch(f), !0;
          }
          return !1;
        }
      }
    }
  });
}
var Bje = ["image", "link", "customBlock", "frontMatter"], Fje = ["strong", "strike", "emph", "code"], VE = ["bulletList", "orderedList", "taskList"];
function _je(r, e) {
  var t = r.type.name;
  return t === "listItem" ? r.attrs.task ? "taskList" : e.type.name : t.indexOf("table") !== -1 ? "table" : t;
}
function qje(r, e) {
  e[r] = { active: !0 }, VE.filter(function(t) {
    return t !== r;
  }).forEach(function(t) {
    e[t] && delete e[t];
  });
}
function zje(r, e, t, n) {
  Fje.forEach(function(i) {
    var a = t.marks[i], s = r.marksAcross(e) || [], u = !!a.isInSet(s);
    u && (n[i] = { active: !0 });
  });
}
function Hje(r, e, t) {
  var n = r.$from, i = r.$to, a = r.from, s = r.to, u = {
    indent: { active: !1, disabled: !0 },
    outdent: { active: !1, disabled: !0 }
  };
  return e.nodesBetween(a, s, function(f, p, y) {
    var T = _je(f, y);
    ti(Bje, T) || (ti(VE, T) ? (qje(T, u), u.indent.disabled = !1, u.outdent.disabled = !1) : T === "paragraph" || T === "text" ? zje(n, i, t, u) : u[T] = { active: !0 });
  }), u;
}
function Vje(r) {
  return new Ji({
    view: function() {
      return {
        update: function(e) {
          var t = e.state, n = t.selection, i = t.doc, a = t.schema;
          r.emit("changeToolbarState", {
            toolbarState: Hje(n, i, a)
          });
        }
      };
    }
  });
}
var Uje = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var a = this;
      this.openEditor = function() {
        if (a.innerEditorView)
          throw new Error("The editor is already opened.");
        a.dom.draggable = !1, a.wrapper.style.display = "none", a.innerViewContainer.style.display = "block", a.innerEditorView = new Dm(a.innerViewContainer, {
          state: pu.create({
            doc: a.node,
            plugins: [
              kh({
                "Mod-z": function() {
                  return ch(a.innerEditorView.state, a.innerEditorView.dispatch);
                },
                "Shift-Mod-z": function() {
                  return sk(a.innerEditorView.state, a.innerEditorView.dispatch);
                },
                Tab: function(s, u) {
                  return u(s.tr.insertText("	")), !0;
                },
                Enter: ax,
                Escape: function() {
                  return a.cancelEditing(), !0;
                },
                "Ctrl-Enter": function() {
                  return a.saveAndFinishEditing(), !0;
                }
              }),
              dx()
            ]
          }),
          dispatchTransaction: function(s) {
            return a.dispatchInner(s);
          },
          handleDOMEvents: {
            mousedown: function() {
              return a.editorView.hasFocus() && a.innerEditorView.focus(), !0;
            },
            blur: function() {
              return a.saveAndFinishEditing(), !0;
            }
          }
        }), a.innerEditorView.focus();
      }, this.node = e, this.editorView = t, this.getPos = n, this.toDOMAdaptor = i, this.innerEditorView = null, this.canceled = !1, this.dom = document.createElement("div"), this.dom.className = Mt("custom-block"), this.wrapper = document.createElement("div"), this.wrapper.className = Mt("custom-block-view"), this.createInnerViewContainer(), this.renderCustomBlock(), this.dom.appendChild(this.innerViewContainer), this.dom.appendChild(this.wrapper);
    }
    return r.prototype.renderToolArea = function() {
      var e = this, t = document.createElement("div"), n = document.createElement("span"), i = document.createElement("button");
      t.className = "tool", n.textContent = this.node.attrs.info, n.className = "info", i.type = "button", i.addEventListener("click", function() {
        return e.openEditor();
      }), t.appendChild(n), t.appendChild(i), this.wrapper.appendChild(t);
    }, r.prototype.renderCustomBlock = function() {
      var e = this.toDOMAdaptor.getToDOMNode(this.node.attrs.info);
      if (e) {
        for (var t = e(this.node); this.wrapper.hasChildNodes(); )
          this.wrapper.removeChild(this.wrapper.lastChild);
        t && this.wrapper.appendChild(t), this.renderToolArea();
      }
    }, r.prototype.createInnerViewContainer = function() {
      this.innerViewContainer = document.createElement("div"), this.innerViewContainer.className = Mt("custom-block-editor"), this.innerViewContainer.style.display = "none";
    }, r.prototype.closeEditor = function() {
      this.innerEditorView && (this.innerEditorView.destroy(), this.innerEditorView = null, this.innerViewContainer.style.display = "none"), this.wrapper.style.display = "block";
    }, r.prototype.saveAndFinishEditing = function() {
      var e = this.editorView.state.selection.to, t = this.editorView.state;
      this.editorView.dispatch(t.tr.setSelection(Jr(t.tr, e))), this.editorView.focus(), this.renderCustomBlock(), this.closeEditor();
    }, r.prototype.cancelEditing = function() {
      var e = qre(this.innerEditorView.state);
      for (this.canceled = !0; e--; )
        ch(this.innerEditorView.state, this.innerEditorView.dispatch), ch(this.editorView.state, this.editorView.dispatch);
      this.canceled = !1;
      var t = this.editorView.state.selection.to, n = this.editorView.state;
      this.editorView.dispatch(n.tr.setSelection(dr.create(n.doc, t))), this.editorView.focus(), this.closeEditor();
    }, r.prototype.dispatchInner = function(e) {
      var t = this.innerEditorView.state.applyTransaction(e), n = t.state, i = t.transactions;
      if (this.innerEditorView.updateState(n), !this.canceled && Ma(this.getPos)) {
        for (var a = this.editorView.state.tr, s = Wi.offset(this.getPos() + 1), u = 0; u < i.length; u += 1)
          for (var f = i[u].steps, p = 0; p < f.length; p += 1)
            a.step(f[p].map(s));
        a.docChanged && this.editorView.dispatch(a);
      }
    }, r.prototype.update = function(e) {
      return e.sameMarkup(this.node) ? (this.node = e, this.innerEditorView || this.renderCustomBlock(), !0) : !1;
    }, r.prototype.stopEvent = function(e) {
      return !!this.innerEditorView && !!e.target && this.innerEditorView.dom.contains(e.target);
    }, r.prototype.ignoreMutation = function() {
      return !0;
    }, r.prototype.destroy = function() {
      this.dom.removeEventListener("dblclick", this.openEditor), this.closeEditor();
    }, r;
  })()
), MC = "image-link", $je = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var a = this, s;
      this.handleMousedown = function(u) {
        u.preventDefault();
        var f = u.target, p = u.offsetX, y = u.offsetY;
        if (a.imageLink && Ma(a.getPos) && Cx(f, MC)) {
          var T = getComputedStyle(f, ":before");
          if (u.stopPropagation(), gk(T, p, y)) {
            var N = a.view.state.tr, O = a.getPos();
            N.setSelection(Jr(N, O, O + 1)), a.view.dispatch(N), a.eventEmitter.emit("openPopup", "link", a.imageLink.attrs);
          }
        }
      }, this.node = e, this.view = t, this.getPos = n, this.eventEmitter = i, this.imageLink = (s = e.marks.filter(function(u) {
        var f = u.type;
        return f.name === "link";
      })[0]) !== null && s !== void 0 ? s : null, this.dom = this.createElement(), this.bindEvent();
    }
    return r.prototype.createElement = function() {
      var e = this.createImageElement(this.node);
      if (this.imageLink) {
        var t = document.createElement("span");
        return t.className = MC, t.appendChild(e), t;
      }
      return e;
    }, r.prototype.createImageElement = function(e) {
      var t = document.createElement("img"), n = e.attrs, i = n.imageUrl, a = n.altText, s = mn(e.attrs);
      return t.src = i, a && (t.alt = a), wk(s, t), t;
    }, r.prototype.bindEvent = function() {
      this.imageLink && this.dom.addEventListener("mousedown", this.handleMousedown);
    }, r.prototype.stopEvent = function() {
      return !0;
    }, r.prototype.destroy = function() {
      this.imageLink && this.dom.removeEventListener("mousedown", this.handleMousedown);
    }, r;
  })()
), Wje = "toastui-editor-ww-code-block", jje = "toastui-editor-ww-code-block-language", Gje = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var a = this;
      this.contentDOM = null, this.input = null, this.timer = null, this.handleMousedown = function(s) {
        var u = s.target, f = getComputedStyle(u, ":after");
        if (f.backgroundImage !== "none" && Ma(a.getPos)) {
          var p = a.view.coordsAtPos(a.getPos()), y = p.top, T = p.right;
          a.createLanguageEditor({ top: y, right: T });
        }
      }, this.handleKeydown = function(s) {
        s.key === "Enter" && a.input && (s.preventDefault(), a.changeLanguage());
      }, this.node = e, this.view = t, this.getPos = n, this.eventEmitter = i, this.createElement(), this.bindDOMEvent(), this.bindEvent();
    }
    return r.prototype.createElement = function() {
      var e = this.node.attrs.language, t = document.createElement("div");
      t.setAttribute("data-language", e || "text"), t.className = Wje;
      var n = this.createCodeBlockElement(), i = n.firstChild;
      t.appendChild(n), this.dom = t, this.contentDOM = i;
    }, r.prototype.createCodeBlockElement = function() {
      var e = document.createElement("pre"), t = document.createElement("code"), n = this.node.attrs.language, i = mn(this.node.attrs);
      return n && t.setAttribute("data-language", n), wk(i, e), e.appendChild(t), e;
    }, r.prototype.createLanguageEditor = function(e) {
      var t = this, n = e.top, i = e.right, a = document.createElement("span");
      a.className = jje;
      var s = document.createElement("input");
      s.type = "text", s.value = this.node.attrs.language, a.appendChild(s), this.view.dom.parentElement.appendChild(a);
      var u = a.clientWidth;
      _o(a, {
        top: n + 10 + "px",
        left: i - u - 10 + "px",
        width: u + "px"
      }), this.input = s, this.input.addEventListener("blur", function() {
        return t.changeLanguage();
      }), this.input.addEventListener("keydown", this.handleKeydown), this.clearTimer(), this.timer = setTimeout(function() {
        t.input.focus();
      });
    }, r.prototype.bindDOMEvent = function() {
      this.dom && this.dom.addEventListener("click", this.handleMousedown);
    }, r.prototype.bindEvent = function() {
      var e = this;
      this.eventEmitter.listen("scroll", function() {
        e.input && e.reset();
      });
    }, r.prototype.changeLanguage = function() {
      if (this.input && Ma(this.getPos)) {
        var e = this.input.value;
        this.reset();
        var t = this.getPos(), n = this.view.state.tr;
        n.setNodeMarkup(t, null, { language: e }), this.view.dispatch(n);
      }
    }, r.prototype.reset = function() {
      var e;
      if (!((e = this.input) === null || e === void 0) && e.parentElement) {
        var t = this.input.parentElement;
        this.input = null, Ou(t);
      }
    }, r.prototype.clearTimer = function() {
      this.timer && (clearTimeout(this.timer), this.timer = null);
    }, r.prototype.stopEvent = function() {
      return !0;
    }, r.prototype.update = function(e) {
      return e.sameMarkup(this.node) ? (this.node = e, !0) : !1;
    }, r.prototype.destroy = function() {
      this.reset(), this.clearTimer(), this.dom && this.dom.removeEventListener("click", this.handleMousedown);
    }, r;
  })()
), Kje = /MsoListParagraph/, UE = /style=(.|\n)*mso-/, $E = /mso-list:(.*)/, Jje = /O:P/, Qje = /^(n|u|l)/, Xje = "p.MsoListParagraph";
function Yje(r) {
  return UE.test(r);
}
function Zje(r) {
  for (var e = [], t = document.createTreeWalker(r, 1, null, !1); t.nextNode(); ) {
    var n = t.currentNode;
    if (Bm(n)) {
      var i = n, a = i.outerHTML, s = i.textContent, u = UE.test(a), f = $E.test(a);
      u && !f && s ? e.push([n, !0]) : (Jje.test(n.nodeName) || u && !s || f) && e.push([n, !1]);
    }
  }
  return e.forEach(function(p) {
    var y = p[0], T = p[1];
    T ? yie(y) : Ou(y);
  }), r.innerHTML.trim();
}
function e8e(r, e) {
  var t = r.getAttribute("style");
  if (t) {
    var n = t.match($E), i = n[1], a = i.trim().split(" "), s = a[1], u = parseInt(s.replace("level", ""), 10), f = Qje.test(r.textContent || "");
    return {
      id: e,
      level: u,
      prev: null,
      parent: null,
      children: [],
      unordered: f,
      contents: Zje(r)
    };
  }
  return null;
}
function t8e(r, e) {
  if (e.level < r.level)
    e.children.push(r), r.parent = e;
  else {
    for (; e && e.level !== r.level; )
      e = e.parent;
    e && (r.prev = e, r.parent = e.parent, r.parent && r.parent.children.push(r));
  }
}
function r8e(r) {
  var e = [];
  return r.forEach(function(t, n) {
    var i = e[n - 1], a = e8e(t, n);
    a && (i && t8e(a, i), e.push(a));
  }), e;
}
function WE(r) {
  var e = r[0].unordered ? "ul" : "ol", t = document.createElement(e);
  return r.forEach(function(n) {
    var i = n.children, a = n.contents, s = document.createElement("li");
    s.innerHTML = a, t.appendChild(s), i.length && t.appendChild(WE(i));
  }), t;
}
function n8e(r) {
  var e = r8e(r), t = e.filter(function(n) {
    var i = n.parent;
    return !i;
  });
  return WE(t);
}
function i8e(r) {
  for (; r && !Bm(r); )
    r = r.nextSibling;
  return r ? !Kje.test(r.className) : !0;
}
function a8e(r) {
  var e = document.createElement("div");
  e.innerHTML = r;
  var t = [], n = vie(e, Xje);
  n.forEach(function(a) {
    var s = i8e(a.nextSibling);
    if (t.push(a), s) {
      var u = n8e(t), f = a.nextSibling;
      f ? gie(u, f) : mie(e, u), t = [];
    }
    Ou(a);
  });
  var i = n.length ? "<p></p>" : "";
  return "" + i + e.innerHTML;
}
var NC = "<!--StartFragment-->", o8e = "<!--EndFragment-->";
function s8e(r) {
  var e = r.indexOf(NC), t = r.lastIndexOf(o8e);
  return e > -1 && t > -1 && (r = r.slice(e + NC.length, t)), r.replace(/<br[^>]*>/g, Mx);
}
function l8e(r) {
  return /<\/td>((?!<\/tr>)[\s\S])*$/i.test(r) && (r = "<tr>" + r + "</tr>"), /<\/tr>((?!<\/table>)[\s\S])*$/i.test(r) && (r = "<table>" + r + "</table>"), r;
}
function u8e(r) {
  return r = s8e(r), r = l8e(r), Yje(r) && (r = a8e(r)), r;
}
function c8e(r) {
  var e = r.reduce(function(t, n) {
    return t.childCount > n.childCount ? t : n;
  });
  return e.childCount;
}
function jE(r, e, t) {
  for (var n = [], i = r.childCount, a = 0; a < i; a += 1)
    if (!r.child(a).attrs.extended) {
      var s = a < i ? t.create(r.child(a).attrs, r.child(a).content) : t.createAndFill();
      n.push(s);
    }
  return n;
}
function GE(r, e, t) {
  var n = t.nodes, i = n.tableRow, a = n.tableHeadCell, s = jE(r, e, a);
  return i.create(null, s);
}
function KE(r, e, t) {
  var n = t.nodes, i = n.tableRow, a = n.tableBodyCell, s = jE(r, e, a);
  return i.create(null, s);
}
function f8e(r, e) {
  for (var t = e.nodes, n = t.tableRow, i = t.tableBodyCell, a = [], s = 0; s < r; s += 1) {
    var u = i.createAndFill();
    a.push(u);
  }
  return n.create({ dummyRowForPasting: !0 }, a);
}
function JE(r) {
  var e = [], t = [];
  if (r.firstChild.type.name === "tableHead") {
    var n = r.firstChild;
    n.forEach(function(a) {
      return e.push(a);
    });
  }
  if (r.lastChild.type.name === "tableBody") {
    var i = r.lastChild;
    i.forEach(function(a) {
      return t.push(a);
    });
  }
  return Ki(Ki([], e), t);
}
function d8e(r, e, t) {
  var n = GE(r, e, t);
  return t.nodes.tableHead.create(null, n);
}
function OC(r, e, t) {
  var n = r.map(function(a) {
    return KE(a, e, t);
  });
  if (!r.length) {
    var i = f8e(e, t);
    n.push(i);
  }
  return t.nodes.tableBody.create(null, n);
}
function h8e(r, e, t, n) {
  var i = c8e(r);
  if (t && n)
    return e.nodes.table.create(null, [OC(r, i, e)]);
  var a = r[0], s = r.slice(1), u = [d8e(a, i, e)];
  return s.length && u.push(OC(s, i, e)), e.nodes.table.create(null, u);
}
function p8e(r, e, t) {
  var n = [], i = r.content, a = r.openStart, s = r.openEnd;
  return i.forEach(function(u) {
    if (u.type.name === "table") {
      var f = zE(new ht(Qe.from(u), 0, 0));
      if (f) {
        var p = JE(f), y = f.firstChild.type.name === "tableBody", T = h8e(p, e, y, t);
        n.push(T);
      }
    } else
      n.push(u);
  }), new ht(Qe.from(n), a, s);
}
var v8e = 4, m8e = 2;
function $v(r) {
  return r * v8e;
}
function g8e(r, e, t) {
  var n = [], i = JE(r), a = i[0].childCount, s = i.length, u = e.startRowIdx === 0, f = i.slice(0, s);
  if (u) {
    var p = f.shift();
    if (p) {
      var y = GE(p, a, t).content;
      n.push(y);
    }
  }
  return f.forEach(function(T) {
    if (!T.attrs.dummyRowForPasting) {
      var N = KE(T, a, t).content;
      n.push(N);
    }
  }), n;
}
function y8e(r, e, t) {
  for (var n = e.startRowIdx, i = e.startColIdx, a = t.length, s = 0, u = function(O) {
    var A = t[O].childCount;
    t[O].forEach(function(q) {
      var U = q.attrs, j = U.colspan;
      j > 1 && (A += j - 1);
    }), s = Math.max(s, A);
  }, f = 0; f < a; f += 1)
    u(f);
  var p = n + a - 1, y = i + s - 1, T = Math.max(p + 1 - r.totalRowCount, 0), N = Math.max(y + 1 - r.totalColumnCount, 0);
  return {
    startRowIdx: n,
    startColIdx: i,
    endRowIdx: p,
    endColIdx: y,
    addedRowCount: T,
    addedColumnCount: N
  };
}
function k8e(r, e) {
  for (var t = r.startRowIdx, n = r.startColIdx, i = r.endRowIdx, a = r.endColIdx, s = r.addedRowCount, u = r.addedColumnCount, f = t; f <= i - s; f += 1)
    e.push({
      rowIdx: f,
      startColIdx: n,
      endColIdx: a - u
    });
}
function w8e(r, e, t, n, i) {
  for (var a = n.startRowIdx, s = n.startColIdx, u = n.endRowIdx, f = n.endColIdx, p = n.addedRowCount, y = n.addedColumnCount, T = t.totalRowCount, N = 0, O = 0; O < T; O += 1) {
    var A = t.getCellInfo(O, f - y), q = A.offset, U = A.nodeSize, j = r.mapping.map(q + U), te = Uv(y, O, e);
    if (r.insert(j, te), O >= a && O <= u - p) {
      var se = t.getCellInfo(O, f - y), me = r.mapping.map(se.offset), Ce = j + $v(y);
      i[N] = {
        rowIdx: O,
        startColIdx: s,
        endColIdx: f,
        dummyOffsets: [me, Ce]
      }, N += 1;
    }
  }
}
function b8e(r, e, t, n, i) {
  var a = n.addedRowCount, s = n.addedColumnCount, u = n.startColIdx, f = n.endColIdx, p = r.mapping.maps.length, y = t.tableEndOffset - 2, T = FE(a, t.totalColumnCount + s, e), N = y;
  r.insert(r.mapping.slice(p).map(N), T);
  for (var O = 0; O < a; O += 1) {
    var A = N + $v(u) + 1, q = N + $v(f + 1) + 1, U = N + $v(t.totalColumnCount + s) + m8e;
    i.push({
      rowIdx: O + t.totalRowCount,
      startColIdx: u,
      endColIdx: f,
      dummyOffsets: [A, q]
    }), N = U;
  }
}
function C8e(r, e, t, n) {
  var i = r.mapping.maps.length;
  t.forEach(function(a, s) {
    var u = a.rowIdx, f = a.startColIdx, p = a.endColIdx, y = a.dummyOffsets, T = r.mapping.slice(i), N = new ht(e[s], 0, 0), O = y ? y[0] : n.getCellStartOffset(u, f), A = y ? y[1] : n.getCellEndOffset(u, p);
    r.replace(T.map(O), T.map(A), N);
  });
}
function T8e(r, e) {
  var t = r.state, n = t.selection, i = t.schema, a = t.tr, s = Ao(n), u = s.anchor, f = s.head;
  if (u && f) {
    var p = zE(e);
    if (!p)
      return !1;
    var y = Qn.create(u), T = y.getRectOffsets(u, f), N = g8e(p, T, i), O = y8e(y, T, N), A = [];
    return x8e(y, O) && (k8e(O, A), O.addedColumnCount && w8e(a, i, y, O, A), O.addedRowCount && b8e(a, i, y, O, A), C8e(a, N, A, y), r.dispatch(a), S8e(r, A, y.getCellInfo(0, 0).offset)), !0;
  }
  return !1;
}
function S8e(r, e, t) {
  var n = r.state, i = n.tr, a = n.doc, s = Qn.create(a.resolve(t)), u = e[0], f = u.rowIdx, p = u.startColIdx, y = vi(e), T = y.rowIdx, N = y.endColIdx, O = s.getCellInfo(f, p).offset, A = s.getCellInfo(T, N).offset;
  r.dispatch(i.setSelection(new Pk(a.resolve(O), a.resolve(A))));
}
function x8e(r, e) {
  var t = r.getSpannedOffsets(e), n = Yc(t), i = n.rowCount, a = n.columnCount, s = Yc(e), u = s.rowCount, f = s.columnCount;
  return i === u && a === f;
}
var E8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "doc";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "block+"
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), M8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "paragraph";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "inline*",
          group: "block",
          attrs: _e({}, zn()),
          parseDOM: [{ tag: "p" }],
          toDOM: function(t) {
            var n = t.attrs;
            return ["p", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), N8e = /\s{1,4}$/, O8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "text";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          group: "inline"
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addSpaces = function() {
      return function(t, n) {
        var i = t.selection, a = t.tr, s = i.$from, u = i.$to, f = s.blockRange(u);
        return f && !vf(s) && !wm(s) ? (n(a.insertText("    ", s.pos, u.pos)), !0) : !1;
      };
    }, e.prototype.removeSpaces = function() {
      return function(t, n) {
        var i = t.selection, a = t.tr, s = i.$from, u = i.$to, f = i.from, p = s.blockRange(u);
        if (p && !vf(s) && !wm(s)) {
          var y = s.nodeBefore;
          if (y && y.isText) {
            var T = y.text, N = T.replace(N8e, ""), O = T.length - N.length;
            return n(a.delete(f - O, f)), !0;
          }
        }
        return !1;
      };
    }, e.prototype.keymaps = function() {
      return {
        Tab: this.addSpaces(),
        "Shift-Tab": this.removeSpaces()
      };
    }, e;
  })($r)
), D8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "heading";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "levels", {
      get: function() {
        return [1, 2, 3, 4, 5, 6];
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        var t = this.levels.map(function(n) {
          return {
            tag: "h" + n,
            getAttrs: function(i) {
              var a = i.getAttribute("data-raw-html");
              return _e({ level: n }, a && { rawHTML: a });
            }
          };
        });
        return {
          attrs: _e({ level: { default: 1 }, headingType: { default: "atx" }, rawHTML: { default: null } }, zn()),
          content: "inline*",
          group: "block",
          defining: !0,
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return ["h" + i.level, mn(i), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function(t) {
        return function(n, i) {
          var a = n.schema.nodes[t.level ? "heading" : "paragraph"];
          return ok(a, t)(n, i);
        };
      };
    }, e;
  })($r)
), A8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "codeBlock";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "text*",
          group: "block",
          attrs: _e({ language: { default: null }, rawHTML: { default: null } }, zn()),
          code: !0,
          defining: !0,
          marks: "",
          parseDOM: [
            {
              tag: "pre",
              preserveWhitespace: "full",
              getAttrs: function(t) {
                var n = t.getAttribute("data-raw-html"), i = t.firstElementChild;
                return _e({ language: i?.getAttribute("data-language") || null }, n && { rawHTML: n });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [
              n.rawHTML || "pre",
              ["code", _e({ "data-language": n.language }, mn(n)), 0]
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return ok(t.schema.nodes.codeBlock)(t, n);
        };
      };
    }, e.prototype.moveCursor = function(t) {
      var n = this;
      return function(i, a) {
        var s = i.tr, u = i.doc, f = i.schema, p = i.selection.$from, y = n.context.view;
        if (y.endOfTextblock(t) && p.node().type.name === "codeBlock") {
          var T = p.parent.textContent.split(`
`), N = t === "up" ? p.start() : p.end(), O = t === "up" ? [N, T[0].length + N] : [N - vi(T).length, N], A = u.resolve(t === "up" ? p.before() : p.after()), q = t === "up" ? A.nodeBefore : A.nodeAfter;
          if (Fne(p.pos, O[0], O[1]) && !q) {
            var U = vk(s, A, f);
            if (U)
              return a(U), !0;
          }
        }
        return !1;
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Shift-Mod-p": t,
        "Shift-Mod-P": t,
        ArrowUp: this.moveCursor("up"),
        ArrowDown: this.moveCursor("down")
      };
    }, e;
  })($r)
), L8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "bulletList";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "listItem+",
          group: "block",
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: [Um("ul")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["ul", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.changeList = function() {
      return function(t, n) {
        return BE(t.schema.nodes.bulletList)(t, n);
      };
    }, e.prototype.commands = function() {
      return {
        bulletList: this.changeList,
        taskList: hje
      };
    }, e.prototype.keymaps = function() {
      var t = this.changeList(), n = Ik(), i = n.indent, a = n.outdent;
      return {
        "Mod-u": t,
        "Mod-U": t,
        Tab: i(),
        "Shift-Tab": a()
      };
    }, e;
  })($r)
), R8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "orderedList";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "listItem+",
          group: "block",
          attrs: _e({ order: { default: 1 }, rawHTML: { default: null } }, zn()),
          parseDOM: [
            {
              tag: "ol",
              getAttrs: function(t) {
                var n = t.getAttribute("start"), i = t.getAttribute("data-raw-html");
                return _e({ order: t.hasAttribute("start") ? Number(n) : 1 }, i && { rawHTML: i });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [
              n.rawHTML || "ol",
              _e({ start: n.order === 1 ? null : n.order }, mn(n)),
              0
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return BE(t.schema.nodes.orderedList)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()(), n = Ik(), i = n.indent, a = n.outdent;
      return {
        "Mod-o": t,
        "Mod-O": t,
        Tab: i(),
        "Shift-Tab": a()
      };
    }, e;
  })($r)
), I8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "listItem";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "paragraph block*",
          selectable: !1,
          attrs: {
            task: { default: !1 },
            checked: { default: !1 },
            rawHTML: { default: null }
          },
          defining: !0,
          parseDOM: [
            {
              tag: "li",
              getAttrs: function(t) {
                var n = t.getAttribute("data-raw-html");
                return _e({ task: t.hasAttribute("data-task"), checked: t.hasAttribute("data-task-checked") }, n && { rawHTML: n });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs, i = n.task, a = n.checked;
            if (!i)
              return [n.rawHTML || "li", 0];
            var s = ["task-list-item"];
            return a && s.push("checked"), [
              n.rawHTML || "li",
              _e({ class: s.join(" "), "data-task": i }, a && { "data-task-checked": a }),
              0
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.liftToPrevListItem = function() {
      return function(t, n) {
        var i = t.selection, a = t.tr, s = t.schema, u = i.$from, f = i.empty, p = s.nodes.listItem, y = u.parent, T = u.node(-1);
        if (f && !y.childCount && T.type === p) {
          if (u.index(-2) >= 1)
            return a.delete(u.start(-1) - 1, u.end(-1)), n(a), !0;
          var N = u.node(-3);
          if (N.type === p)
            return a.delete(u.start(-2) - 1, u.end(-1)), n(a), !0;
        }
        return !1;
      };
    }, e.prototype.keymaps = function() {
      var t = function(n, i) {
        return yje(n.schema.nodes.listItem)(n, i);
      };
      return {
        Backspace: this.liftToPrevListItem(),
        Enter: t
      };
    }, e;
  })($r)
), P8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "blockQuote";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: _e({ rawHTML: { default: null } }, zn()),
          content: "block+",
          group: "block",
          parseDOM: [Um("blockquote")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["blockquote", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return xre(t.schema.nodes.blockQuote)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Alt-q": t,
        "Alt-Q": t
      };
    }, e;
  })($r)
), B8e = {
  left: $8e,
  right: U8e,
  up: W8e,
  down: j8e
};
function F8e(r, e, t) {
  var n = t[0], i = t[1], a = e.resolve(r.before(n - 1));
  return i === n && !a.nodeBefore;
}
function _8e(r) {
  for (var e, t = r.depth, n; t && (n = r.node(t), n.type.name !== "tableBodyCell"); ) {
    if (n.type.name === "listItem") {
      var i = r.node(t - 1), a = i.lastChild === n, s = ((e = n.lastChild) === null || e === void 0 ? void 0 : e.type.name) !== "paragraph";
      return a ? !s : !1;
    }
    t -= 1;
  }
  return !1;
}
function q8e(r, e, t, n, i) {
  var a = e[0], s = e[1], u = e[2];
  if (r === "left" || r === "up") {
    if (i && !F8e(t, n, [a, s]))
      return !1;
    var f = t.before(u), p = n.resolve(f).nodeBefore;
    if (p)
      return !1;
  }
  return !0;
}
function z8e(r, e, t, n, i) {
  if (r === "right" || r === "down") {
    if (i && !_8e(t))
      return !1;
    var a = t.after(e), s = n.resolve(a).nodeAfter;
    if (s)
      return !1;
  }
  return !0;
}
function H8e(r, e, t, n) {
  var i = e[0], a = e[1], s = i + 3, u = a >= s, f = u ? i + 1 : a, p = q8e(r, [a, s, f], t, n, u), y = z8e(r, f, t, n, u);
  return p && y;
}
function DC(r, e, t) {
  var n = t[0], i = t[1], a = e.getRowspanStartInfo(n, i), s = r === "up" && n === 0, u = r === "down" && (a?.count > 1 ? n + a.count - 1 : n) === e.totalRowCount - 1;
  return s || u;
}
function V8e(r, e, t) {
  var n = r.doc.resolve(e.tableStartOffset - 1);
  return n.nodeBefore ? r.setSelection(cr.near(n, -1)) : vk(r, n, t);
}
function Jy(r, e, t, n) {
  n === void 0 && (n = !1);
  var i = r.doc.resolve(e.tableEndOffset);
  return n || !i.nodeAfter ? vk(r, i, t) : r.setSelection(cr.near(i, 1));
}
function U8e(r, e) {
  var t = r[0], n = r[1], i = e.totalRowCount, a = e.totalColumnCount, s = n === a - 1, u = t === i - 1 && s;
  if (!u) {
    var f = n + 1, p = e.getColspanStartInfo(t, n);
    p?.count > 1 && (f += p.count - 1), (s || f === a) && (t += 1, f = 0);
    var y = e.getCellInfo(t, f).offset;
    return y + 2;
  }
  return null;
}
function $8e(r, e) {
  var t = r[0], n = r[1], i = e.totalColumnCount, a = n === 0, s = t === 0 && a;
  if (!s) {
    n -= 1, a && (t -= 1, n = i - 1);
    var u = e.getCellInfo(t, n), f = u.offset, p = u.nodeSize;
    return f + p - 2;
  }
  return null;
}
function W8e(r, e) {
  var t = r[0], n = r[1];
  if (t > 0) {
    var i = e.getCellInfo(t - 1, n), a = i.offset, s = i.nodeSize;
    return a + s - 2;
  }
  return null;
}
function j8e(r, e) {
  var t = r[0], n = r[1], i = e.totalRowCount;
  if (t < i - 1) {
    var a = t + 1, s = e.getRowspanStartInfo(t, n);
    s?.count > 1 && (a += s.count - 1);
    var u = e.getCellInfo(a, n).offset;
    return u + 2;
  }
  return null;
}
function AC(r, e, t, n) {
  var i = B8e[r], a = i(t, n);
  if (a) {
    var s = r === "right" || r === "down" ? 1 : -1;
    return e.setSelection(cr.near(e.doc.resolve(a), s));
  }
  return null;
}
function G8e(r, e, t) {
  var n = t[0], i = t[1];
  if (r === "up" || r === "down")
    return !1;
  var a = e.tableStartOffset, s = e.tableEndOffset, u = e.getCellInfo(n, i), f = u.offset, p = u.nodeSize, y = r === "left" ? a : s, T = r === "left" ? f - 2 : f + p + 3;
  return y === T;
}
function K8e(r, e, t) {
  var n = r.doc.resolve(e.before(t - 3));
  return r.setSelection(new Kt(n));
}
function J8e(r, e, t) {
  var n, i, a;
  return r === "up" ? (n = t.startRowIdx, i = 0, a = -1) : (n = t.endRowIdx, i = e.totalColumnCount - 1, a = e.getCellInfo(n, i).nodeSize + 1), { targetRowIdx: n, insertColIdx: i, nodeSize: a };
}
function Q8e(r, e, t) {
  var n = r.getCellInfo(e, 0).offset, i = r.getCellInfo(e, t - 1), a = i.offset, s = i.nodeSize;
  return { from: n, to: a + s };
}
var X8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "table";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "tableHead{1} tableBody{1}",
          group: "block",
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: [Um("table")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["table", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addTable = function() {
      return function(t) {
        return t === void 0 && (t = { rowCount: 2, columnCount: 1, data: [] }), function(n, i) {
          var a = t.rowCount, s = t.columnCount, u = t.data, f = n.schema, p = n.selection, y = n.tr, T = p.from, N = p.to, O = p.$from, A = T === N;
          if (A && !wm(O)) {
            var q = f.nodes, U = q.tableHead, j = q.tableBody, te = u?.slice(0, s), se = u?.slice(s, u.length), me = Sje(s, f, te), Ce = FE(a - 1, s, f, se), pe = f.nodes.table.create(null, [
              U.create(null, me),
              j.create(null, Ce)
            ]);
            return i(y.replaceSelectionWith(pe)), !0;
          }
          return !1;
        };
      };
    }, e.prototype.removeTable = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, a = t.tr, s = Qn.create(i.$anchor);
          if (s) {
            var u = s.tableStartOffset, f = s.tableEndOffset, p = u - 1, y = Jr(a.delete(p, f), p);
            return n(a.setSelection(y)), !0;
          }
          return !1;
        };
      };
    }, e.prototype.addColumn = function(t) {
      return function() {
        return function(n, i) {
          var a = n.selection, s = n.tr, u = n.schema, f = Ao(a), p = f.anchor, y = f.head;
          if (p && y) {
            for (var T = Qn.create(p), N = T.getRectOffsets(p, y), O = t === "left" ? N.startColIdx : N.endColIdx + 1, A = Yc(N).columnCount, q = T.totalRowCount, U = 0; U < q; U += 1) {
              var j = Uv(A, U, u);
              s.insert(s.mapping.map(T.posAt(U, O)), j);
            }
            return i(s), !0;
          }
          return !1;
        };
      };
    }, e.prototype.removeColumn = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, a = t.tr, s = Ao(i), u = s.anchor, f = s.head;
          if (u && f) {
            var p = Qn.create(u), y = p.getRectOffsets(u, f), T = p.totalColumnCount, N = p.totalRowCount, O = Yc(y).columnCount, A = O === T;
            if (A)
              return !1;
            for (var q = y.startColIdx, U = y.endColIdx, j = a.mapping.maps.length, te = 0; te < N; te += 1)
              for (var se = U; se >= q; se -= 1) {
                var me = p.getCellInfo(te, se), Ce = me.offset, pe = me.nodeSize, ke = a.mapping.slice(j).map(Ce), Ne = ke + pe;
                a.delete(ke, Ne);
              }
            return n(a), !0;
          }
          return !1;
        };
      };
    }, e.prototype.addRow = function(t) {
      return function() {
        return function(n, i) {
          var a = n.selection, s = n.schema, u = n.tr, f = Ao(a), p = f.anchor, y = f.head;
          if (p && y) {
            var T = Qn.create(p), N = T.totalColumnCount, O = T.getRectOffsets(p, y), A = Yc(O).rowCount, q = J8e(t, T, O), U = q.targetRowIdx, j = q.insertColIdx, te = q.nodeSize, se = U === 0;
            if (!se) {
              for (var me = [], Ce = u.mapping.map(T.posAt(U, j)) + te, pe = [], ke = 0; ke < N; ke += 1)
                pe = pe.concat(Uv(1, U, s));
              for (var Ne = 0; Ne < A; Ne += 1)
                me.push(s.nodes.tableRow.create(null, pe));
              return i(u.insert(Ce, me)), !0;
            }
          }
          return !1;
        };
      };
    }, e.prototype.removeRow = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, a = t.tr, s = Ao(i), u = s.anchor, f = s.head;
          if (u && f) {
            var p = Qn.create(u), y = p.totalRowCount, T = p.totalColumnCount, N = p.getRectOffsets(u, f), O = Yc(N).rowCount, A = N.startRowIdx, q = N.endRowIdx, U = A === 0, j = O === y - 1;
            if (j || U)
              return !1;
            for (var te = q; te >= A; te -= 1) {
              var se = Q8e(p, te, T), me = se.from, Ce = se.to;
              a.delete(me - 1, Ce + 1);
            }
            return n(a), !0;
          }
          return !1;
        };
      };
    }, e.prototype.alignColumn = function() {
      return function(t) {
        return t === void 0 && (t = { align: "center" }), function(n, i) {
          var a = t.align, s = n.selection, u = n.tr, f = Ao(s), p = f.anchor, y = f.head;
          if (p && y) {
            for (var T = Qn.create(p), N = T.totalRowCount, O = T.getRectOffsets(p, y), A = O.startColIdx, q = O.endColIdx, U = 0; U < N; U += 1)
              for (var j = A; j <= q; j += 1)
                if (!T.extendedRowspan(U, j) && !T.extendedColspan(U, j)) {
                  var te = T.getNodeAndPos(U, j), se = te.node, me = te.pos, Ce = xje(se, { align: a });
                  u.setNodeMarkup(me, null, Ce);
                }
            return i(u), !0;
          }
          return !1;
        };
      };
    }, e.prototype.moveToCell = function(t) {
      return function(n, i) {
        var a = n.selection, s = n.tr, u = n.schema, f = Ao(a), p = f.anchor, y = f.head;
        if (p && y) {
          var T = Qn.create(p), N = T.getCellIndex(p), O = void 0;
          if (DC(t, T, N) ? O = Jy(s, T, u) : O = AC(t, s, N, T), O)
            return i(O), !0;
        }
        return !1;
      };
    }, e.prototype.moveInCell = function(t) {
      var n = this;
      return function(i, a) {
        var s = i.selection, u = i.tr, f = i.doc, p = i.schema, y = s.$from, T = n.context.view;
        if (!T.endOfTextblock(t))
          return !1;
        var N = Cs(y, function(se) {
          var me = se.type;
          return me.name === "tableHeadCell" || me.name === "tableBodyCell";
        });
        if (N) {
          var O = Cs(y, function(se) {
            var me = se.type;
            return me.name === "paragraph";
          }), A = N.depth;
          if (O && H8e(t, [A, O.depth], y, f)) {
            var q = Ao(s).anchor, U = Qn.create(q), j = U.getCellIndex(q), te = void 0;
            if (G8e(t, U, j) ? te = K8e(u, y, A) : DC(t, U, j) ? t === "up" ? te = V8e(u, U, p) : t === "down" && (te = Jy(u, U, p)) : te = AC(t, u, j, U), te)
              return a(te), !0;
          }
        }
        return !1;
      };
    }, e.prototype.deleteCells = function() {
      return function(t, n) {
        var i = t.schema, a = t.selection, s = t.tr, u = Ao(a), f = u.anchor, p = u.head, y = a instanceof dr;
        if (f && p && !y) {
          for (var T = Qn.create(f), N = T.getRectOffsets(f, p), O = N.startRowIdx, A = N.startColIdx, q = N.endRowIdx, U = N.endColIdx, j = O; j <= q; j += 1)
            for (var te = A; te <= U; te += 1)
              if (!T.extendedRowspan(j, te) && !T.extendedColspan(j, te)) {
                var se = T.getNodeAndPos(j, te), me = se.node, Ce = se.pos, pe = Uv(1, j, i, me.attrs);
                s.replaceWith(s.mapping.map(Ce), s.mapping.map(Ce + me.nodeSize), pe);
              }
          return n(s), !0;
        }
        return !1;
      };
    }, e.prototype.exitTable = function() {
      return function(t, n) {
        var i = t.selection, a = t.tr, s = t.schema, u = i.$from, f = Cs(u, function(N) {
          var O = N.type;
          return O.name === "tableHeadCell" || O.name === "tableBodyCell";
        });
        if (f) {
          var p = Cs(u, function(N) {
            var O = N.type;
            return O.name === "paragraph";
          });
          if (p) {
            var y = Ao(i).anchor, T = Qn.create(y);
            return n(Jy(a, T, s, !0)), !0;
          }
        }
        return !1;
      };
    }, e.prototype.commands = function() {
      return {
        addTable: this.addTable(),
        removeTable: this.removeTable(),
        addColumnToLeft: this.addColumn(
          "left"
          /* LEFT */
        ),
        addColumnToRight: this.addColumn(
          "right"
          /* RIGHT */
        ),
        removeColumn: this.removeColumn(),
        addRowToUp: this.addRow(
          "up"
          /* UP */
        ),
        addRowToDown: this.addRow(
          "down"
          /* DOWN */
        ),
        removeRow: this.removeRow(),
        alignColumn: this.alignColumn()
      };
    }, e.prototype.keymaps = function() {
      var t = this.deleteCells();
      return {
        Tab: this.moveToCell(
          "right"
          /* RIGHT */
        ),
        "Shift-Tab": this.moveToCell(
          "left"
          /* LEFT */
        ),
        ArrowUp: this.moveInCell(
          "up"
          /* UP */
        ),
        ArrowDown: this.moveInCell(
          "down"
          /* DOWN */
        ),
        ArrowLeft: this.moveInCell(
          "left"
          /* LEFT */
        ),
        ArrowRight: this.moveInCell(
          "right"
          /* RIGHT */
        ),
        Backspace: t,
        "Mod-Backspace": t,
        Delete: t,
        "Mod-Delete": t,
        "Mod-Enter": this.exitTable()
      };
    }, e;
  })($r)
), Y8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "tableHead";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "tableRow{1}",
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: [Um("thead")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["thead", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), Z8e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "tableBody";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "tableRow+",
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: [
            {
              tag: "tbody",
              getAttrs: function(t) {
                var n = t.querySelectorAll("tr"), i = n[0].children.length, a = t.getAttribute("data-raw-html");
                return i ? _e({}, a && { rawHTML: a }) : !1;
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return ["tbody", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), e5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "tableRow";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "(tableHeadCell | tableBodyCell)*",
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: [
            {
              tag: "tr",
              getAttrs: function(t) {
                var n = t.children.length, i = t.getAttribute("data-raw-html");
                return n ? _e({}, i && { rawHTML: i }) : !1;
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return ["tr", mn(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), t5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "tableHeadCell";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "paragraph+",
          attrs: _e({ align: { default: null }, className: { default: null }, rawHTML: { default: null }, colspan: { default: null }, extended: { default: null } }, zn()),
          isolating: !0,
          parseDOM: [RE("th")],
          toDOM: function(t) {
            var n = t.attrs, i = LE(n);
            return ["th", _e(_e({}, i), mn(n)), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), r5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "tableBodyCell";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "(paragraph | bulletList | orderedList)+",
          attrs: {
            align: { default: null },
            className: { default: null },
            rawHTML: { default: null },
            colspan: { default: null },
            rowspan: { default: null },
            extended: { default: null }
          },
          isolating: !0,
          parseDOM: [RE("td")],
          toDOM: function(t) {
            var n = t.attrs, i = LE(n);
            return ["td", i, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })($r)
), n5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "image";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          inline: !0,
          attrs: _e({ imageUrl: { default: "" }, altText: { default: null }, rawHTML: { default: null } }, zn()),
          group: "inline",
          selectable: !1,
          parseDOM: [
            {
              tag: "img[src]",
              getAttrs: function(t) {
                var n = Lu(t, { RETURN_DOM_FRAGMENT: !0 }).firstChild, i = n.getAttribute("src") || "", a = n.getAttribute("data-raw-html"), s = n.getAttribute("alt");
                return _e({
                  imageUrl: i,
                  altText: s
                }, a && { rawHTML: a });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [
              n.rawHTML || "img",
              _e(_e({ src: Xc(n.imageUrl) }, n.altText && { alt: n.altText }), mn(n))
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addImage = function() {
      return function(t) {
        return function(n, i) {
          var a = n.schema, s = n.tr, u = t, f = u.imageUrl, p = u.altText;
          if (!f)
            return !1;
          var y = a.nodes.image.createAndFill(_e({ imageUrl: f }, p && { altText: p }));
          return i(s.replaceSelectionWith(y).scrollIntoView()), !0;
        };
      };
    }, e.prototype.commands = function() {
      return {
        addImage: this.addImage()
      };
    }, e;
  })($r)
), LC = 1, i5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "thematicBreak";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: _e({ rawHTML: { default: null } }, zn()),
          group: "block",
          parseDOM: [{ tag: "hr" }],
          selectable: !1,
          toDOM: function(t) {
            var n = t.attrs;
            return ["div", mn(n), [n.rawHTML || "hr"]];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.hr = function() {
      var t = this;
      return function() {
        return function(n, i) {
          var a, s = n.selection, u = s.$from, f = s.$to;
          if (u === f) {
            var p = n.doc, y = n.schema.nodes, T = y.thematicBreak, N = y.paragraph, O = [T.create()], A = u.node(LC), q = p.child(p.childCount - 1) === A, U = p.resolve(u.after(LC)), j = ((a = u.nodeAfter) === null || a === void 0 ? void 0 : a.type.name) === t.name;
            return (q || j) && O.push(N.create()), i(n.tr.insert(U.pos, O).scrollIntoView()), !0;
          }
          return !1;
        };
      };
    }, e.prototype.commands = function() {
      return { hr: this.hr() };
    }, e.prototype.keymaps = function() {
      var t = this.hr()();
      return {
        "Mod-l": t,
        "Mod-L": t
      };
    }, e;
  })($r)
), a5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "strong";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        var t = ["b", "strong"].map(function(n) {
          return {
            tag: n,
            getAttrs: function(i) {
              var a = i.getAttribute("data-raw-html");
              return _e({}, a && { rawHTML: a });
            }
          };
        });
        return {
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return [i.rawHTML || "strong", mn(i)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.bold = function() {
      return function() {
        return function(t, n) {
          return Eh(t.schema.marks.strong)(t, n);
        };
      };
    }, e.prototype.commands = function() {
      return { bold: this.bold() };
    }, e.prototype.keymaps = function() {
      var t = this.bold()();
      return {
        "Mod-b": t,
        "Mod-B": t
      };
    }, e;
  })(Qr)
), o5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "emph";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        var t = ["i", "em"].map(function(n) {
          return {
            tag: n,
            getAttrs: function(i) {
              var a = i.getAttribute("data-raw-html");
              return _e({}, a && { rawHTML: a });
            }
          };
        });
        return {
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return [i.rawHTML || "em", mn(i)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.italic = function() {
      return function() {
        return function(t, n) {
          return Eh(t.schema.marks.emph)(t, n);
        };
      };
    }, e.prototype.commands = function() {
      return { italic: this.italic() };
    }, e.prototype.keymaps = function() {
      var t = this.italic()();
      return {
        "Mod-i": t,
        "Mod-I": t
      };
    }, e;
  })(Qr)
), s5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "strike";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        var t = ["s", "del"].map(function(n) {
          return {
            tag: n,
            getAttrs: function(i) {
              var a = i.getAttribute("data-raw-html");
              return _e({}, a && { rawHTML: a });
            }
          };
        });
        return {
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return [i.rawHTML || "del", mn(i)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return Eh(t.schema.marks.strike)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Mod-s": t,
        "Mod-S": t
      };
    }, e;
  })(Qr)
), l5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this) || this;
      return n.linkAttributes = t, n;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "link";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        var t = this;
        return {
          attrs: _e({ linkUrl: { default: "" }, title: { default: null }, rawHTML: { default: null } }, zn()),
          inclusive: !1,
          parseDOM: [
            {
              tag: "a[href]",
              getAttrs: function(n) {
                var i = Lu(n, { RETURN_DOM_FRAGMENT: !0 }).firstChild, a = i.getAttribute("href") || "", s = i.getAttribute("title") || "", u = i.getAttribute("data-raw-html");
                return _e({ linkUrl: a, title: s }, u && { rawHTML: u });
              }
            }
          ],
          toDOM: function(n) {
            var i = n.attrs;
            return [
              i.rawHTML || "a",
              _e(_e({ href: Xc(i.linkUrl) }, t.linkAttributes), mn(i))
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addLink = function() {
      return function(t) {
        return function(n, i) {
          var a = t, s = a.linkUrl, u = a.linkText, f = u === void 0 ? "" : u, p = n.schema, y = n.tr, T = n.selection, N = T.empty, O = T.from, A = T.to;
          if (O && A && s) {
            var q = { linkUrl: s }, U = p.mark("link", q);
            if (N && f) {
              var j = ei(p, f, U);
              y.replaceRangeWith(O, A, j);
            } else
              y.addMark(O, A, U);
            return i(y.scrollIntoView()), !0;
          }
          return !1;
        };
      };
    }, e.prototype.toggleLink = function() {
      return function(t) {
        return function(n, i) {
          return Eh(n.schema.marks.link, t)(n, i);
        };
      };
    }, e.prototype.commands = function() {
      return {
        addLink: this.addLink(),
        toggleLink: this.toggleLink()
      };
    }, e;
  })(Qr)
), u5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "code";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          attrs: _e({ rawHTML: { default: null } }, zn()),
          parseDOM: [
            {
              tag: "code",
              getAttrs: function(t) {
                var n = t.getAttribute("data-raw-html");
                return _e({}, n && { rawHTML: n });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [n.rawHTML || "code", mn(n)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return Eh(t.schema.marks.code)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Shift-Mod-c": t,
        "Shift-Mod-C": t
      };
    }, e;
  })(Qr)
), c5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "customBlock";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "text*",
          group: "block",
          attrs: {
            info: { default: null }
          },
          atom: !0,
          code: !0,
          defining: !0,
          parseDOM: [
            {
              tag: "div[data-custom-info]",
              getAttrs: function(t) {
                var n = t.getAttribute("data-custom-info");
                return { info: n };
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return ["div", { "data-custom-info": n.info || null }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function(t) {
        return function(n, i) {
          return t?.info ? ok(n.schema.nodes.customBlock, t)(n, i) : !1;
        };
      };
    }, e;
  })($r)
), f5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "frontMatter";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "text*",
          group: "block",
          code: !0,
          defining: !0,
          parseDOM: [
            {
              preserveWhitespace: "full",
              tag: "div[data-front-matter]"
            }
          ],
          toDOM: function() {
            return ["div", { "data-front-matter": "true" }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n, i) {
          var a = t.selection.$from;
          return i.endOfTextblock("down") && a.node().type.name === "frontMatter" ? ak(t, n) : !1;
        };
      };
    }, e.prototype.keymaps = function() {
      return {
        Enter: this.commands()()
      };
    }, e;
  })($r)
), d5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return Object.defineProperty(e.prototype, "name", {
      get: function() {
        return "htmlComment";
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e.prototype, "schema", {
      get: function() {
        return {
          content: "text*",
          group: "block",
          code: !0,
          defining: !0,
          parseDOM: [{ preserveWhitespace: "full", tag: "div[data-html-comment]" }],
          toDOM: function() {
            return ["div", { "data-html-comment": "true" }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n, i) {
          var a = t.selection.$from;
          return i.endOfTextblock("down") && a.node().type.name === "htmlComment" ? ak(t, n) : !1;
        };
      };
    }, e.prototype.keymaps = function() {
      return {
        Enter: this.commands()()
      };
    }, e;
  })($r)
);
function h5e(r) {
  return new Bx([
    new E8e(),
    new M8e(),
    new O8e(),
    new D8e(),
    new A8e(),
    new L8e(),
    new R8e(),
    new I8e(),
    new P8e(),
    new X8e(),
    new Y8e(),
    new Z8e(),
    new e5e(),
    new t5e(),
    new r5e(),
    new n5e(),
    new i5e(),
    new a5e(),
    new o5e(),
    new s5e(),
    new l5e(r),
    new u5e(),
    new c5e(),
    new f5e(),
    new Ix(),
    new d5e()
  ]);
}
var p5e = Mt("contents"), v5e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t, n) {
      var i = r.call(this, t) || this, a = n.toDOMAdaptor, s = n.htmlSchemaMap, u = s === void 0 ? {} : s, f = n.linkAttributes, p = f === void 0 ? {} : f, y = n.useCommandShortcut, T = y === void 0 ? !0 : y, N = n.wwPlugins, O = N === void 0 ? [] : N, A = n.wwNodeViews, q = A === void 0 ? {} : A;
      return i.editorType = "wysiwyg", i.el.classList.add("ww-mode"), i.toDOMAdaptor = a, i.linkAttributes = p, i.extraPlugins = O, i.pluginNodeViews = q, i.specs = i.createSpecs(), i.schema = i.createSchema(u), i.context = i.createContext(), i.keymaps = i.createKeymaps(T), i.view = i.createView(), i.commands = i.createCommands(), i.specs.setContext(_e(_e({}, i.context), { view: i.view })), i.initEvent(), i;
    }
    return e.prototype.createSpecs = function() {
      return h5e(this.linkAttributes);
    }, e.prototype.createContext = function() {
      return {
        schema: this.schema,
        eventEmitter: this.eventEmitter
      };
    }, e.prototype.createSchema = function(t) {
      return new iS({
        nodes: _e(_e({}, this.specs.nodes), t.nodes),
        marks: _e(_e({}, this.specs.marks), t.marks)
      });
    }, e.prototype.createPlugins = function() {
      return Ki([
        Dje(),
        Ije(this.eventEmitter),
        Pje(),
        Vje(this.eventEmitter)
      ], this.createPluginProps()).concat(this.defaultPlugins);
    }, e.prototype.createPluginNodeViews = function() {
      var t = this, n = t.eventEmitter, i = t.pluginNodeViews, a = {};
      return i && Object.keys(i).forEach(function(s) {
        a[s] = function(u, f, p) {
          return i[s](u, f, p, n);
        };
      }), a;
    }, e.prototype.createView = function() {
      var t = this, n = this, i = n.toDOMAdaptor, a = n.eventEmitter;
      return new Dm(this.el, {
        state: this.createState(),
        attributes: {
          class: p5e
        },
        nodeViews: _e({
          customBlock: function(s, u, f) {
            return new Uje(s, u, f, i);
          },
          image: function(s, u, f) {
            return new $je(s, u, f, a);
          },
          codeBlock: function(s, u, f) {
            return new Gje(s, u, f, a);
          },
          widget: Rx
        }, this.createPluginNodeViews()),
        dispatchTransaction: function(s) {
          var u = t.view.state.applyTransaction(s).state;
          t.view.updateState(u), t.emitChangeEvent(s.scrollIntoView()), t.eventEmitter.emit("setFocusedNode", u.selection.$from.node(1));
        },
        transformPastedHTML: u8e,
        transformPasted: function(s) {
          return p8e(s, t.schema, wm(t.view.state.selection.$from));
        },
        handlePaste: function(s, u, f) {
          return T8e(s, f);
        },
        handleKeyDown: function(s, u) {
          return t.eventEmitter.emit("keydown", t.editorType, u), !1;
        },
        handleDOMEvents: {
          paste: function(s, u) {
            var f = u.clipboardData || window.clipboardData, p = f?.items;
            if (p) {
              var y = qo(p).some(function(N) {
                return N.kind === "string" && N.type === "text/rtf";
              });
              if (!y) {
                var T = Lx(p);
                T && (u.preventDefault(), Ck(t.eventEmitter, T, u.type));
              }
            }
            return !1;
          },
          keyup: function(s, u) {
            return t.eventEmitter.emit("keyup", t.editorType, u), !1;
          },
          scroll: function() {
            return t.eventEmitter.emit("scroll", "editor"), !0;
          }
        }
      });
    }, e.prototype.createCommands = function() {
      return this.specs.commands(this.view, Ik());
    }, e.prototype.getHTML = function() {
      return bk(this.view.dom.innerHTML);
    }, e.prototype.getModel = function() {
      return this.view.state.doc;
    }, e.prototype.getSelection = function() {
      var t = this.view.state.selection, n = t.from, i = t.to;
      return [n, i];
    }, e.prototype.getSchema = function() {
      return this.view.state.schema;
    }, e.prototype.replaceSelection = function(t, n, i) {
      var a = this.view.state, s = a.schema, u = a.tr, f = t.split(`
`), p = f.map(function(N) {
        return cm(s, bu(N, s));
      }), y = new ht(Qe.from(p), 1, 1), T = ws(n) && ws(i) ? u.replaceRange(n, i, y) : u.replaceSelection(y);
      this.view.dispatch(T), this.focus();
    }, e.prototype.deleteSelection = function(t, n) {
      var i = this.view.state.tr, a = ws(t) && ws(n) ? i.deleteRange(t, n) : i.deleteSelection();
      this.view.dispatch(a.scrollIntoView());
    }, e.prototype.getSelectedText = function(t, n) {
      var i = this.view.state, a = i.doc, s = i.selection, u = s.from, f = s.to;
      return ws(t) && ws(n) && (u = t, f = n), a.textBetween(u, f, `
`);
    }, e.prototype.setModel = function(t, n) {
      n === void 0 && (n = !1);
      var i = this.view.state, a = i.tr, s = i.doc;
      this.view.dispatch(a.replaceWith(0, s.content.size, t)), n && this.moveCursorToEnd(!0);
    }, e.prototype.setSelection = function(t, n) {
      n === void 0 && (n = t);
      var i = this.view.state.tr, a = Jr(i, t, n);
      this.view.dispatch(i.setSelection(a).scrollIntoView());
    }, e.prototype.addWidget = function(t, n, i) {
      var a = this.view, s = a.dispatch, u = a.state;
      s(u.tr.setMeta("widget", { pos: i ?? u.selection.to, node: t, style: n }));
    }, e.prototype.replaceWithWidget = function(t, n, i) {
      var a = this.view.state, s = a.tr, u = a.schema, f = bu(i, u);
      this.view.dispatch(s.replaceWith(t, n, f));
    }, e.prototype.getRangeInfoOfNode = function(t) {
      var n = this.view.state, i = n.doc, a = n.selection, s = t ? i.resolve(t) : a.$from, u = s.marks(), f = s.node(), p = s.start(), y = s.end(), T = f.type.name;
      if (u.length || T === "paragraph") {
        var N = u[u.length - 1], O = function(A) {
          return A.length ? ti(A, N) : !0;
        };
        T = N ? N.type.name : "text", f.forEach(function(A, q) {
          var U = A.isText, j = A.nodeSize, te = A.marks, se = s.pos - p;
          U && q <= se && q + j >= se && O(te) && (p = p + q, y = p + j);
        });
      }
      return { range: [p, y], type: T };
    }, e;
  })(Px)
), m5e = to, g5e = om;
function y5e(r) {
  return !m5e(r) && !g5e(r);
}
var k5e = y5e, w5e = k5e;
function b5e(r) {
  return w5e(r) && r !== !1;
}
var C5e = b5e, T5e = C5e;
function S5e(r) {
  return !T5e(r);
}
var x5e = S5e, RC = [
  "afterPreviewRender",
  "updatePreview",
  "changeMode",
  "needChangeMode",
  "command",
  "changePreviewStyle",
  "changePreviewTabPreview",
  "changePreviewTabWrite",
  "scroll",
  "contextmenu",
  "show",
  "hide",
  "changeLanguage",
  "changeToolbarState",
  "toggleScrollSync",
  "mixinTableOffsetMapPrototype",
  "setFocusedNode",
  "removePopupWidget",
  "query",
  // provide event for user
  "openPopup",
  "closePopup",
  "addImageBlobHook",
  "beforePreviewRender",
  "beforeConvertWysiwygToMarkdown",
  "load",
  "loadUI",
  "change",
  "caretChange",
  "destroy",
  "focus",
  "blur",
  "keydown",
  "keyup"
], QE = (
  /** @class */
  (function() {
    function r() {
      var e = this;
      this.events = new HE(), this.eventTypes = RC.reduce(function(t, n) {
        return _e(_e({}, t), { type: n });
      }, {}), this.hold = !1, RC.forEach(function(t) {
        e.addEventType(t);
      });
    }
    return r.prototype.listen = function(e, t) {
      var n = this.getTypeInfo(e), i = this.events.get(n.type) || [];
      if (!this.hasEventType(n.type))
        throw new Error("There is no event type " + n.type);
      n.namespace && (t.namespace = n.namespace), i.push(t), this.events.set(n.type, i);
    }, r.prototype.emit = function(e) {
      for (var t = [], n = 1; n < arguments.length; n++)
        t[n - 1] = arguments[n];
      var i = this.getTypeInfo(e), a = this.events.get(i.type), s = [];
      return !this.hold && a && a.forEach(function(u) {
        var f = u.apply(void 0, t);
        to(f) || s.push(f);
      }), s;
    }, r.prototype.emitReduce = function(e, t) {
      for (var n = [], i = 2; i < arguments.length; i++)
        n[i - 2] = arguments[i];
      var a = this.events.get(e);
      return !this.hold && a && a.forEach(function(s) {
        var u = s.apply(void 0, Ki([t], n));
        x5e(u) || (t = u);
      }), t;
    }, r.prototype.getTypeInfo = function(e) {
      var t = e.split(".");
      return {
        type: t[0],
        namespace: t[1]
      };
    }, r.prototype.hasEventType = function(e) {
      return !to(this.eventTypes[this.getTypeInfo(e).type]);
    }, r.prototype.addEventType = function(e) {
      if (this.hasEventType(e))
        throw new Error("There is already have event type " + e);
      this.eventTypes[e] = e;
    }, r.prototype.removeEventHandler = function(e, t) {
      var n = this, i = this.getTypeInfo(e), a = i.type, s = i.namespace;
      a && t ? this.removeEventHandlerWithHandler(a, t) : a && !s ? this.events.delete(a) : !a && s ? this.events.forEach(function(u, f) {
        n.removeEventHandlerWithTypeInfo(f, s);
      }) : a && s && this.removeEventHandlerWithTypeInfo(a, s);
    }, r.prototype.removeEventHandlerWithHandler = function(e, t) {
      var n = this.events.get(e);
      if (n) {
        var i = n.indexOf(t);
        n.indexOf(t) >= 0 && n.splice(i, 1);
      }
    }, r.prototype.removeEventHandlerWithTypeInfo = function(e, t) {
      var n = [], i = this.events.get(e);
      i && (i.map(function(a) {
        return a.namespace !== t && n.push(a), null;
      }), this.events.set(e, n));
    }, r.prototype.getEvents = function() {
      return this.events;
    }, r.prototype.holdEventInvoke = function(e) {
      this.hold = !0, e(), this.hold = !1;
    }, r;
  })()
), E5e = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      this.eventEmitter = e, this.mdCommands = t, this.wwCommands = n, this.getEditorType = i, this.initEvent();
    }
    return r.prototype.initEvent = function() {
      var e = this;
      this.eventEmitter.listen("command", function(t, n) {
        e.exec(t, n);
      });
    }, r.prototype.addCommand = function(e, t, n) {
      e === "markdown" ? this.mdCommands[t] = n : this.wwCommands[t] = n;
    }, r.prototype.deleteCommand = function(e, t) {
      e === "markdown" ? delete this.mdCommands[t] : delete this.wwCommands[t];
    }, r.prototype.exec = function(e, t) {
      var n = this.getEditorType();
      n === "markdown" ? this.mdCommands[e](t) : this.wwCommands[e](t);
    }, r;
  })()
);
function Wv(r) {
  return r[r.length - 1] === `
` ? r.slice(0, r.length - 1) : r;
}
function F0(r, e) {
  var t = r.schema, n = e.literal, i = n.match(ff);
  if (i) {
    var a = i[1], s = i[3], u = (a || s).toLowerCase();
    return e.type === "htmlInline" && !!(t.marks[u] || t.nodes[u]);
  }
  return !1;
}
function _0(r) {
  var e = r.type;
  return ti(["text", "strong", "emph", "strike", "image", "link", "code"], e);
}
function IC(r) {
  return r?.type === "softbreak";
}
function Xd(r) {
  var e = r.type, t = r.literal, n = e === "htmlInline" && t.match(ff);
  if (n) {
    var i = n[1], a = n[3], s = i || a;
    if (s)
      return ti(["ul", "ol", "li"], s.toLowerCase());
  }
  return !1;
}
function M5e(r) {
  var e = r.literal, t = /data-task/.test(e), n = /data-task-checked/.test(e);
  return { task: t, checked: n };
}
function PC(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  var n = document.createElement("div");
  n.innerHTML = Lu(r);
  var i = n.firstChild;
  return e.map(function(a) {
    return i.getAttribute(a) || "";
  });
}
function N5e(r) {
  var e = {};
  return Object.keys(r).forEach(function(t) {
    var n = t.split(", ");
    n.forEach(function(i) {
      var a = i.toLowerCase();
      e[a] = r[t];
    });
  }), e;
}
var O5e = {
  "b, strong": function(r, e, t) {
    var n = r.schema.marks.strong;
    t ? r.openMark(n.create({ rawHTML: t })) : r.closeMark(n);
  },
  "i, em": function(r, e, t) {
    var n = r.schema.marks.emph;
    t ? r.openMark(n.create({ rawHTML: t })) : r.closeMark(n);
  },
  "s, del": function(r, e, t) {
    var n = r.schema.marks.strike;
    t ? r.openMark(n.create({ rawHTML: t })) : r.closeMark(n);
  },
  code: function(r, e, t) {
    var n = r.schema.marks.code;
    t ? r.openMark(n.create({ rawHTML: t })) : r.closeMark(n);
  },
  a: function(r, e, t) {
    var n = e.literal, i = r.schema.marks.link;
    if (t) {
      var a = PC(n, "href")[0];
      r.openMark(i.create({
        linkUrl: a,
        rawHTML: t
      }));
    } else
      r.closeMark(i);
  },
  img: function(r, e, t) {
    var n = e.literal;
    if (t) {
      var i = PC(n, "src", "alt"), a = i[0], s = i[1], u = r.schema.nodes.image;
      r.addNode(u, _e({ rawHTML: t, imageUrl: a }, s && { altText: s }));
    }
  },
  hr: function(r, e, t) {
    r.addNode(r.schema.nodes.thematicBreak, { rawHTML: t });
  },
  br: function(r, e) {
    var t = r.schema.nodes.paragraph, n = e.parent, i = e.prev, a = e.next;
    n?.type === "paragraph" ? (IC(i) && r.openNode(t), IC(a) ? r.closeNode() : a && (r.closeNode(), r.openNode(t))) : n?.type === "tableCell" && (i && (_0(i) || F0(r, i)) && r.closeNode(), a && (_0(a) || F0(r, a)) && r.openNode(t));
  },
  pre: function(r, e, t) {
    var n, i, a = document.createElement("div");
    a.innerHTML = e.literal;
    var s = (i = (n = a.firstChild) === null || n === void 0 ? void 0 : n.firstChild) === null || i === void 0 ? void 0 : i.textContent;
    r.openNode(r.schema.nodes.codeBlock, { rawHTML: t }), r.addText(Wv(s)), r.closeNode();
  },
  "ul, ol": function(r, e, t) {
    if (e.parent.type === "tableCell") {
      var n = r.schema.nodes, i = n.bulletList, a = n.orderedList, s = n.paragraph, u = t === "ul" ? i : a;
      t ? (e.prev && !Xd(e.prev) && r.closeNode(), r.openNode(u, { rawHTML: t })) : (r.closeNode(), e.next && !Xd(e.next) && r.openNode(s));
    }
  },
  li: function(r, e, t) {
    var n;
    if (((n = e.parent) === null || n === void 0 ? void 0 : n.type) === "tableCell") {
      var i = r.schema.nodes, a = i.listItem, s = i.paragraph;
      if (t) {
        var u = M5e(e);
        e.prev && !Xd(e.prev) && r.closeNode(), r.openNode(a, _e({ rawHTML: t }, u)), e.next && !Xd(e.next) && r.openNode(s);
      } else
        e.prev && !Xd(e.prev) && r.closeNode(), r.closeNode();
    }
  }
}, D5e = N5e(O5e);
function BC(r) {
  return r.type === "htmlInline" && y0.test(r.literal);
}
function XE(r) {
  qo(r.childNodes).forEach(function(e) {
    if (Bm(e)) {
      var t = e.nodeName.toLowerCase();
      e.setAttribute("data-raw-html", t), e.childNodes && XE(e);
    }
  });
}
var FC = {
  text: function(r, e) {
    r.addText(e.literal || "");
  },
  paragraph: function(r, e, t, n) {
    var i, a = t.entering;
    if (a) {
      var s = r.schema.nodes.paragraph;
      ((i = e.prev) === null || i === void 0 ? void 0 : i.type) === "paragraph" && (r.openNode(s, n), r.closeNode()), r.openNode(s, n);
    } else
      r.closeNode();
  },
  heading: function(r, e, t, n) {
    var i = t.entering;
    if (i) {
      var a = e, s = a.level, u = a.headingType;
      r.openNode(r.schema.nodes.heading, _e({ level: s, headingType: u }, n));
    } else
      r.closeNode();
  },
  codeBlock: function(r, e, t) {
    var n = r.schema.nodes.codeBlock, i = e, a = i.info, s = i.literal;
    r.openNode(n, _e({ language: a }, t)), r.addText(Wv(s || "")), r.closeNode();
  },
  list: function(r, e, t, n) {
    var i = t.entering;
    if (i) {
      var a = r.schema.nodes, s = a.bulletList, u = a.orderedList, f = e.listData, p = f.type, y = f.start;
      p === "bullet" ? r.openNode(s, n) : r.openNode(u, _e({ order: y }, n));
    } else
      r.closeNode();
  },
  item: function(r, e, t, n) {
    var i = t.entering, a = r.schema.nodes.listItem, s = e.listData, u = s.task, f = s.checked;
    if (i) {
      var p = _e(_e(_e({}, u && { task: u }), f && { checked: f }), n);
      r.openNode(a, p);
    } else
      r.closeNode();
  },
  blockQuote: function(r, e, t, n) {
    var i = t.entering;
    i ? r.openNode(r.schema.nodes.blockQuote, n) : r.closeNode();
  },
  image: function(r, e, t, n) {
    var i = t.entering, a = t.skipChildren, s = r.schema.nodes.image, u = e, f = u.destination, p = u.firstChild;
    i && a && a(), r.addNode(s, _e(_e({ imageUrl: f }, p && { altText: p.literal }), n));
  },
  thematicBreak: function(r, e, t, n) {
    r.addNode(r.schema.nodes.thematicBreak, n);
  },
  strong: function(r, e, t, n) {
    var i = t.entering, a = r.schema.marks.strong;
    i ? r.openMark(a.create(n)) : r.closeMark(a);
  },
  emph: function(r, e, t, n) {
    var i = t.entering, a = r.schema.marks.emph;
    i ? r.openMark(a.create(n)) : r.closeMark(a);
  },
  link: function(r, e, t, n) {
    var i = t.entering, a = r.schema.marks.link, s = e, u = s.destination, f = s.title;
    if (i) {
      var p = _e({ linkUrl: u, title: f }, n);
      r.openMark(a.create(p));
    } else
      r.closeMark(a);
  },
  softbreak: function(r, e) {
    if (e.parent.type === "paragraph") {
      var t = e.prev, n = e.next;
      t && !BC(t) && r.closeNode(), n && !BC(n) && r.openNode(r.schema.nodes.paragraph);
    }
  },
  // GFM specifications node
  table: function(r, e, t, n) {
    var i = t.entering;
    i ? r.openNode(r.schema.nodes.table, n) : r.closeNode();
  },
  tableHead: function(r, e, t, n) {
    var i = t.entering;
    i ? r.openNode(r.schema.nodes.tableHead, n) : r.closeNode();
  },
  tableBody: function(r, e, t, n) {
    var i = t.entering;
    i ? r.openNode(r.schema.nodes.tableBody, n) : r.closeNode();
  },
  tableRow: function(r, e, t, n) {
    var i = t.entering;
    i ? r.openNode(r.schema.nodes.tableRow, n) : r.closeNode();
  },
  tableCell: function(r, e, t) {
    var n = t.entering;
    if (!e.ignored) {
      var i = function(A) {
        return A && (_0(A) || F0(r, A));
      };
      if (n) {
        var a = r.schema.nodes, s = a.tableHeadCell, u = a.tableBodyCell, f = a.paragraph, p = e.parent.parent, y = p.type === "tableHead" ? s : u, T = p.parent, N = (T.columns[e.startIdx] || {}).align, O = _e({}, e.attrs);
        N && (O.align = N), r.openNode(y, O), i(e.firstChild) && r.openNode(f);
      } else
        i(e.lastChild) && r.closeNode(), r.closeNode();
    }
  },
  strike: function(r, e, t, n) {
    var i = t.entering, a = r.schema.marks.strike;
    i ? r.openMark(a.create(n)) : r.closeMark(a);
  },
  code: function(r, e, t, n) {
    var i = r.schema.marks.code;
    r.openMark(i.create(n)), r.addText(Wv(e.literal || "")), r.closeMark(i);
  },
  customBlock: function(r, e) {
    var t = r.schema.nodes, n = t.customBlock, i = t.paragraph, a = e, s = a.info, u = a.literal;
    r.openNode(n, { info: s }), r.addText(Wv(u || "")), r.closeNode(), e.next || (r.openNode(i), r.closeNode());
  },
  frontMatter: function(r, e) {
    r.openNode(r.schema.nodes.frontMatter), r.addText(e.literal), r.closeNode();
  },
  htmlInline: function(r, e) {
    var t = e.literal, n = t.match(ff), i = n[1], a = n[3], s = (i || a).toLowerCase(), u = r.schema.marks[s], f = Lu(t);
    if (u?.spec.attrs.htmlInline)
      if (i) {
        var p = R0(f);
        r.openMark(u.create({ htmlAttrs: p }));
      } else
        r.closeMark(u);
    else {
      var y = D5e[s];
      y && y(r, e, i);
    }
  },
  htmlBlock: function(r, e) {
    var t = e.literal, n = document.createElement("div"), i = hie.test(t);
    if (i)
      r.openNode(r.schema.nodes.htmlComment), r.addText(e.literal), r.closeNode();
    else {
      var a = t.match(ff), s = a[1], u = a[3], f = (s || u).toLowerCase(), p = r.schema.nodes[f], y = Lu(t);
      if (p?.spec.attrs.htmlBlock) {
        var T = R0(y), N = OE(e, f);
        r.addNode(p, { htmlAttrs: T, childrenHTML: N });
      } else
        n.innerHTML = y, XE(n), r.convertByDOMParser(n);
    }
  },
  customInline: function(r, e, t) {
    var n = t.entering, i = t.skipChildren, a = e, s = a.info, u = a.firstChild, f = r.schema;
    if (s.indexOf("widget") !== -1 && n) {
      var p = wx(e);
      i(), r.addNode(f.nodes.widget, { info: s }, [
        f.text(yx(s, p))
      ]);
    } else {
      var y = "$$";
      n && (y += u ? s + " " : s), r.addText(y);
    }
  }
};
function A5e(r) {
  var e = Object.keys(r), t = _e({}, FC), n = new Lk({
    gfm: !0,
    nodeId: !0,
    convertors: r
  }), i = n.getConvertors();
  return e.forEach(function(a) {
    var s = FC[a];
    s && !ti(["htmlBlock", "htmlInline"], a) && (t[a] = function(u, f, p) {
      p.origin = function() {
        return i[a](f, p, i);
      };
      var y = r[a](f, p), T;
      if (y) {
        var N = Array.isArray(y) ? y[0] : y, O = N.attributes, A = N.classNames;
        T = { htmlAttrs: O, classNames: A };
      }
      s(u, f, p, T);
    });
  }), t;
}
function L5e(r, e) {
  return r.isText && e.isText && Tr.sameSet(r.marks, e.marks) ? r.withText(r.text + e.text) : !1;
}
var R5e = (
  /** @class */
  (function() {
    function r(e, t) {
      this.schema = e, this.convertors = t, this.stack = [{ type: this.schema.topNodeType, attrs: null, content: [] }], this.marks = Tr.none;
    }
    return r.prototype.top = function() {
      return vi(this.stack);
    }, r.prototype.push = function(e) {
      this.stack.length && this.top().content.push(e);
    }, r.prototype.addText = function(e) {
      if (e) {
        var t = this.top().content, n = vi(t), i = this.schema.text(e, this.marks), a = n && L5e(n, i);
        a ? t[t.length - 1] = a : t.push(i);
      }
    }, r.prototype.openMark = function(e) {
      this.marks = e.addToSet(this.marks);
    }, r.prototype.closeMark = function(e) {
      this.marks = e.removeFromSet(this.marks);
    }, r.prototype.addNode = function(e, t, n) {
      var i = e.createAndFill(t, n, this.marks);
      return i ? (this.push(i), i) : null;
    }, r.prototype.openNode = function(e, t) {
      this.stack.push({ type: e, attrs: t, content: [] });
    }, r.prototype.closeNode = function() {
      this.marks.length && (this.marks = Tr.none);
      var e = this.stack.pop(), t = e.type, n = e.attrs, i = e.content;
      return this.addNode(t, n, i);
    }, r.prototype.convertByDOMParser = function(e) {
      var t = this, n = Tu.fromSchema(this.schema).parse(e);
      n.content.forEach(function(i) {
        return t.push(i);
      });
    }, r.prototype.closeUnmatchedHTMLInline = function(e, t) {
      var n;
      if (!t && e.type !== "htmlInline")
        for (var i = this.stack.length - 1, a = i; a >= 0; a -= 1) {
          var s = this.stack[a];
          if (!((n = s.attrs) === null || n === void 0) && n.rawHTML)
            s.content.length ? this.closeNode() : this.stack.pop();
          else
            break;
        }
    }, r.prototype.convert = function(e, t) {
      for (var n = e.walker(), i = n.next(), a = function() {
        var u = i.node, f = i.entering, p = s.convertors[u.type], y = !1;
        if (p) {
          var T = {
            entering: f,
            leaf: !Gne(u),
            getChildrenText: Kne,
            options: { gfm: !0, nodeId: !1, tagFilter: !1, softbreak: `
` },
            skipChildren: function() {
              y = !0;
            }
          };
          if (s.closeUnmatchedHTMLInline(u, f), p(s, u, T), t?.node === u) {
            var N = s.stack.reduce(function(O, A) {
              return O + A.content.reduce(function(q, U) {
                return q + U.nodeSize;
              }, 0);
            }, 0) + 1;
            t.setMappedPos(N);
          }
        }
        y && (n.resumeAt(u, !1), n.next()), i = n.next();
      }, s = this; i; )
        a();
    }, r.prototype.convertNode = function(e, t) {
      return this.convert(e, t), this.stack.length ? this.closeNode() : null;
    }, r;
  })()
);
function I5e(r, e, t) {
  var n = t[0], i = t[1];
  r.write(n), r.convertInline(e), r.write(i);
}
function P5e(r, e, t) {
  var n = e.node, i = e.parent, a = t[0], s = t[1];
  r.stopNewline = !0, r.write(a), r.convertNode(n), r.write(s), i?.type.name === "doc" && (r.closeBlock(n), r.stopNewline = !1);
}
function B5e(r, e) {
  var t = r.length, n = "", i = "";
  return e === "left" ? (n = ":", t -= 1) : e === "right" ? (i = ":", t -= 1) : e === "center" && (n = ":", i = ":", t -= 2), "" + n + sm("-", Math.max(t, 3)) + i;
}
var q0 = {
  text: function(r, e) {
    var t, n = e.node, i = (t = n.text) !== null && t !== void 0 ? t : "";
    (n.marks || []).some(function(a) {
      return a.type.name === "link";
    }) ? r.text(lm(i), !1) : r.text(i);
  },
  paragraph: function(r, e) {
    var t = e.node, n = e.parent, i = e.index, a = i === void 0 ? 0 : i;
    if (r.stopNewline)
      r.convertInline(t);
    else {
      var s = a === 0, u = !s && n.child(a - 1), f = u && u.childCount === 0, p = a < n.childCount - 1 && n.child(a + 1), y = p && p.type.name === "paragraph", T = t.childCount === 0;
      if (T && f)
        r.write(`<br>
`);
      else if (T && !f && !s) {
        if (n?.type.name === "listItem") {
          var N = r.getDelim();
          r.setDelim(""), r.write("<br>"), r.setDelim(N);
        }
        r.write(`
`);
      } else
        r.convertInline(t), y ? r.write(`
`) : r.closeBlock(t);
    }
  },
  heading: function(r, e, t) {
    var n = e.node, i = t.delim, a = n.attrs.headingType;
    a === "atx" ? (r.write(i + " "), r.convertInline(n), r.closeBlock(n)) : (r.convertInline(n), r.ensureNewLine(), r.write(i), r.closeBlock(n));
  },
  codeBlock: function(r, e, t) {
    var n = e.node, i = t.delim, a = t.text, s = i, u = s[0], f = s[1];
    r.write(u), r.ensureNewLine(), r.text(a, !1), r.ensureNewLine(), r.write(f), r.closeBlock(n);
  },
  blockQuote: function(r, e, t) {
    var n = e.node, i = e.parent, a = t.delim;
    i?.type.name === n.type.name && r.flushClose(1), r.wrapBlock(a, null, n, function() {
      return r.convertNode(n);
    });
  },
  bulletList: function(r, e, t) {
    var n = e.node, i = t.delim;
    r.convertList(n, sm(" ", 4), function() {
      return i + " ";
    });
  },
  orderedList: function(r, e) {
    var t = e.node, n = t.attrs.order || 1;
    r.convertList(t, sm(" ", 4), function(i) {
      var a = String(n + i);
      return a + ". ";
    });
  },
  listItem: function(r, e) {
    var t = e.node, n = t.attrs, i = n.task, a = n.checked;
    i && r.write("[" + (a ? "x" : " ") + "] "), r.convertNode(t);
  },
  image: function(r, e, t) {
    var n = t.attrs;
    r.write("![" + n?.altText + "](" + n?.imageUrl + ")");
  },
  thematicBreak: function(r, e, t) {
    var n = e.node, i = t.delim;
    r.write(i), r.closeBlock(n);
  },
  table: function(r, e) {
    var t = e.node;
    r.convertNode(t), r.closeBlock(t);
  },
  tableHead: function(r, e, t) {
    var n = e.node, i = t.delim, a = n.firstChild;
    r.convertNode(n);
    var s = i ?? "";
    !i && a && a.forEach(function(u) {
      var f = u.textContent, p = u.attrs, y = B5e(f, p.align);
      s += "| " + y + " ";
    }), r.write(s + "|"), r.ensureNewLine();
  },
  tableBody: function(r, e) {
    var t = e.node;
    r.convertNode(t);
  },
  tableRow: function(r, e) {
    var t = e.node;
    r.convertNode(t), r.write("|"), r.ensureNewLine();
  },
  tableHeadCell: function(r, e, t) {
    var n = e.node, i = t.delim, a = i === void 0 ? "| " : i;
    r.write(a), r.convertTableCell(n), r.write(" ");
  },
  tableBodyCell: function(r, e, t) {
    var n = e.node, i = t.delim, a = i === void 0 ? "| " : i;
    r.write(a), r.convertTableCell(n), r.write(" ");
  },
  customBlock: function(r, e, t) {
    var n = e.node, i = t.delim, a = t.text, s = i, u = s[0], f = s[1];
    r.write(u), r.ensureNewLine(), r.text(a, !1), r.ensureNewLine(), r.write(f), r.closeBlock(n);
  },
  frontMatter: function(r, e, t) {
    var n = e.node, i = t.text;
    r.text(i, !1), r.closeBlock(n);
  },
  widget: function(r, e, t) {
    var n = t.text;
    r.write(n);
  },
  html: function(r, e, t) {
    var n = e.node, i = t.text;
    r.write(i), n.attrs.htmlBlock && r.closeBlock(n);
  },
  htmlComment: function(r, e, t) {
    var n = e.node, i = t.text;
    r.write(i), r.closeBlock(n);
  }
};
function F5e(r, e) {
  var t = e.state, n = e.nodeInfo, i = e.params, a = i.rawHTML;
  a ? Mu(r, ["heading", "codeBlock"]) > -1 ? I5e(t, n.node, a) : Mu(r, ["image", "thematicBreak"]) > -1 ? t.write(a) : P5e(t, n, a) : q0[r](t, n, i);
}
function _C(r, e) {
  var t = r.text, n = /`+/g, i = 0;
  if (r.isText && t)
    for (var a = n.exec(t); a; )
      i = Math.max(i, a[0].length), a = n.exec(t);
  for (var s = i > 0 && e > 0 ? " `" : "`", u = 0; u < i; u += 1)
    s += "`";
  return i > 0 && e < 0 && (s += " "), s;
}
function Ja(r) {
  return r ? ["<" + r + ">", "</" + r + ">"] : null;
}
function Yd(r) {
  return r ? "<" + r + ">" : null;
}
function Zd(r) {
  return r ? "</" + r + ">" : null;
}
var eh = {
  heading: function(r) {
    var e = r.node, t = e.attrs, n = t.level, i = sm("#", n);
    return t.headingType === "setext" && (i = n === 1 ? "===" : "---"), {
      delim: i,
      rawHTML: Ja(t.rawHTML)
    };
  },
  codeBlock: function(r) {
    var e = r.node, t = e, n = t.attrs, i = t.textContent;
    return {
      delim: ["```" + (n.language || ""), "```"],
      rawHTML: Ja(n.rawHTML),
      text: i
    };
  },
  blockQuote: function(r) {
    var e = r.node;
    return {
      delim: "> ",
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  bulletList: function(r, e) {
    var t = r.node, n = e.inTable, i = t.attrs.rawHTML;
    return n && (i = i || "ul"), {
      delim: "*",
      rawHTML: Ja(i)
    };
  },
  orderedList: function(r, e) {
    var t = r.node, n = e.inTable, i = t.attrs.rawHTML;
    return n && (i = i || "ol"), {
      rawHTML: Ja(i)
    };
  },
  listItem: function(r, e) {
    var t = r.node, n = e.inTable, i = t.attrs, a = i.task, s = i.checked, u = t.attrs.rawHTML;
    n && (u = u || "li");
    var f = a ? ' class="task-list-item' + (s ? " checked" : "") + '"' : "", p = a ? " data-task" + (s ? " data-task-checked" : "") : "";
    return {
      rawHTML: u ? ["<" + u + f + p + ">", "</" + u + ">"] : null
    };
  },
  table: function(r) {
    var e = r.node;
    return {
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  tableHead: function(r) {
    var e = r.node;
    return {
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  tableBody: function(r) {
    var e = r.node;
    return {
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  tableRow: function(r) {
    var e = r.node;
    return {
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  tableHeadCell: function(r) {
    var e = r.node;
    return {
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  tableBodyCell: function(r) {
    var e = r.node;
    return {
      rawHTML: Ja(e.attrs.rawHTML)
    };
  },
  image: function(r) {
    var e = r.node, t = e.attrs, n = t.rawHTML, i = t.altText, a = t.imageUrl.replace(/&amp;/g, "&"), s = i ? ' alt="' + Xc(i) + '"' : "";
    return {
      rawHTML: n ? "<" + n + ' src="' + Xc(a) + '"' + s + ">" : null,
      attrs: {
        altText: lm(i || ""),
        imageUrl: a
      }
    };
  },
  thematicBreak: function(r) {
    var e = r.node;
    return {
      delim: "***",
      rawHTML: Yd(e.attrs.rawHTML)
    };
  },
  customBlock: function(r) {
    var e = r.node, t = e, n = t.attrs, i = t.textContent;
    return {
      delim: ["$$" + n.info, "$$"],
      text: i
    };
  },
  frontMatter: function(r) {
    var e = r.node;
    return {
      text: e.textContent
    };
  },
  widget: function(r) {
    var e = r.node;
    return {
      text: e.textContent
    };
  },
  strong: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs.rawHTML;
    return {
      delim: "**",
      rawHTML: n ? Yd(i) : Zd(i)
    };
  },
  emph: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs.rawHTML;
    return {
      delim: "*",
      rawHTML: n ? Yd(i) : Zd(i)
    };
  },
  strike: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs.rawHTML;
    return {
      delim: "~~",
      rawHTML: n ? Yd(i) : Zd(i)
    };
  },
  link: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs, a = i.title, s = i.rawHTML, u = i.linkUrl.replace(/&amp;/g, "&"), f = a ? ' title="' + Xc(a) + '"' : "";
    return n ? {
      delim: "[",
      rawHTML: s ? "<" + s + ' href="' + Xc(u) + '"' + f + ">" : null
    } : {
      delim: "](" + u + (a ? " " + Bne(lm(a)) : "") + ")",
      rawHTML: Zd(s)
    };
  },
  code: function(r, e) {
    var t = r.node, n = r.parent, i = r.index, a = i === void 0 ? 0 : i, s = e.entering, u = s ? _C(n.child(a), -1) : _C(n.child(a - 1), 1), f = s ? Yd(t.attrs.rawHTML) : Zd(t.attrs.rawHTML);
    return {
      delim: u,
      rawHTML: f
    };
  },
  htmlComment: function(r) {
    var e = r.node;
    return {
      text: e.textContent
    };
  },
  // html inline node, html block node
  html: function(r, e) {
    var t = r.node, n = e.entering, i = t.type.name, a = t.attrs.htmlAttrs, s = "<" + i, u = "</" + i + ">";
    return Object.keys(a).forEach(function(f) {
      s += " " + f + '="' + a[f].replace(/"/g, "'") + '"';
    }), s += ">", t.attrs.htmlInline ? {
      rawHTML: n ? s : u
    } : {
      text: "" + s + t.attrs.childrenHTML + u
    };
  }
}, qC = {
  strong: {
    mixable: !0,
    removedEnclosingWhitespace: !0
  },
  emph: {
    mixable: !0,
    removedEnclosingWhitespace: !0
  },
  strike: {
    mixable: !0,
    removedEnclosingWhitespace: !0
  },
  code: {
    escape: !1
  },
  link: null,
  html: null
};
function _5e(r) {
  var e = {}, t = Object.keys(q0);
  return t.forEach(function(n) {
    e[n] = function(i, a) {
      var s = q0[n];
      if (s) {
        var u = r[n], f = u ? u(a, {
          inTable: i.inTable
        }) : {};
        F5e(n, { state: i, nodeInfo: a, params: f });
      }
    };
  }), e;
}
function q5e(r) {
  var e = {}, t = Object.keys(qC);
  return t.forEach(function(n) {
    e[n] = function(i, a) {
      var s = qC[n], u = r[n], f = u && i && !to(a), p = f ? u(i, { entering: a }) : {};
      return _e(_e({}, p), s);
    };
  }), e;
}
function z5e(r) {
  var e = Object.keys(r);
  e.forEach(function(i) {
    var a = eh[i], s = r[i];
    a ? eh[i] = function(u, f) {
      return f.origin = function() {
        return a(u, f);
      }, s(u, f);
    } : eh[i] = s, delete r[i];
  });
  var t = _5e(eh), n = q5e(eh);
  return {
    nodeTypeConvertors: t,
    markTypeConvertors: n
  };
}
var H5e = (
  /** @class */
  (function() {
    function r(e) {
      var t = e.nodeTypeConvertors, n = e.markTypeConvertors;
      this.nodeTypeConvertors = t, this.markTypeConvertors = n, this.delim = "", this.result = "", this.closed = !1, this.tightList = !1, this.stopNewline = !1, this.inTable = !1;
    }
    return r.prototype.getMarkConvertor = function(e) {
      var t = e.attrs.htmlInline ? "html" : e.type.name;
      return this.markTypeConvertors[t];
    }, r.prototype.isInBlank = function() {
      return /(^|\n)$/.test(this.result);
    }, r.prototype.markText = function(e, t, n, i) {
      var a = this.getMarkConvertor(e);
      if (a) {
        var s = a({ node: e, parent: n, index: i }, t), u = s.delim, f = s.rawHTML;
        return f || u;
      }
      return "";
    }, r.prototype.setDelim = function(e) {
      this.delim = e;
    }, r.prototype.getDelim = function() {
      return this.delim;
    }, r.prototype.flushClose = function(e) {
      if (!this.stopNewline && this.closed) {
        if (this.isInBlank() || (this.result += `
`), e || (e = 2), e > 1) {
          var t = this.delim, n = /\s+$/.exec(t);
          n && (t = t.slice(0, t.length - n[0].length));
          for (var i = 1; i < e; i += 1)
            this.result += t + `
`;
        }
        this.closed = !1;
      }
    }, r.prototype.wrapBlock = function(e, t, n, i) {
      var a = this.getDelim();
      this.write(t || e), this.setDelim(this.getDelim() + e), i(), this.setDelim(a), this.closeBlock(n);
    }, r.prototype.ensureNewLine = function() {
      this.isInBlank() || (this.result += `
`);
    }, r.prototype.write = function(e) {
      e === void 0 && (e = ""), this.flushClose(), this.delim && this.isInBlank() && (this.result += this.delim), e && (this.result += e);
    }, r.prototype.closeBlock = function(e) {
      this.closed = e;
    }, r.prototype.text = function(e, t) {
      t === void 0 && (t = !0);
      for (var n = e.split(`
`), i = 0; i < n.length; i += 1)
        this.write(), this.result += t ? Pne(n[i]) : n[i], i !== n.length - 1 && (this.result += `
`);
    }, r.prototype.convertBlock = function(e, t, n) {
      var i = e.type.name, a = this.nodeTypeConvertors[i], s = { node: e, parent: t, index: n };
      e.attrs.htmlBlock ? this.nodeTypeConvertors.html(this, s) : a && a(this, s);
    }, r.prototype.convertInline = function(e) {
      var t = this, n = [], i = "", a = function(s, u, f) {
        var p = s ? s.marks : [], y = i;
        i = "";
        var T = s && s.isText && p.some(function(Ze) {
          var At = t.getMarkConvertor(Ze), et = At && At();
          return et && et.removedEnclosingWhitespace;
        });
        if (T && s && s.text) {
          var N = /^(\s*)(.*?)(\s*)$/m.exec(s.text), O = N[1], A = N[2], q = N[3];
          y += O, i = q, (O || q) && (s = A ? s.withText(A) : null, s || (p = n));
        }
        for (var U = p.length && vi(p), j = U && t.getMarkConvertor(U), te = j && j(), se = te && te.escape === !1, me = p.length - (se ? 1 : 0), Ce = 0; Ce < me; Ce += 1) {
          var A = p[Ce];
          if (te && !te.mixable)
            break;
          for (var pe = 0; pe < n.length; pe += 1) {
            var ke = n[pe];
            if (te && !te.mixable)
              break;
            if (A.eq(ke)) {
              Ce > pe ? p = p.slice(0, pe).concat(A).concat(p.slice(pe, Ce)).concat(p.slice(Ce + 1, me)) : pe > Ce && (p = p.slice(0, Ce).concat(p.slice(Ce + 1, pe)).concat(A).concat(p.slice(pe, me)));
              break;
            }
          }
        }
        for (var Ne = 0; Ne < Math.min(n.length, me) && p[Ne].eq(n[Ne]); )
          Ne += 1;
        for (; Ne < n.length; ) {
          var ze = n.pop();
          ze && t.text(t.markText(ze, !1, e, f), !1);
        }
        if (y && t.text(y), s) {
          for (; n.length < me; ) {
            var A = p[n.length];
            n.push(A), t.text(t.markText(A, !0, e, f), !1);
          }
          se && s.isText ? t.text(t.markText(U, !0, e, f) + s.text + t.markText(U, !1, e, f + 1), !1) : t.convertBlock(s, e, f);
        }
      };
      e.forEach(a), a(null, null, e.childCount);
    }, r.prototype.convertList = function(e, t, n) {
      var i = this, a;
      this.closed && this.closed.type === e.type ? this.flushClose(3) : this.tightList && this.flushClose(1);
      var s = (a = e.attrs.tight) !== null && a !== void 0 ? a : !0, u = this.tightList;
      this.tightList = s, e.forEach(function(f, p, y) {
        y && s && i.flushClose(1), i.wrapBlock(t, n(y), e, function() {
          return i.convertBlock(f, e, y);
        });
      }), this.tightList = u;
    }, r.prototype.convertTableCell = function(e) {
      var t = this;
      this.stopNewline = !0, this.inTable = !0, e.forEach(function(n, i, a) {
        if (ti(["bulletList", "orderedList"], n.type.name))
          t.convertBlock(n, e, a), t.closed = !1;
        else if (t.convertInline(n), a < e.childCount - 1) {
          var s = e.child(a + 1);
          s.type.name === "paragraph" && t.write("<br>");
        }
      }), this.stopNewline = !1, this.inTable = !1;
    }, r.prototype.convertNode = function(e, t) {
      var n = this;
      return e.forEach(function(i, a, s) {
        if (n.convertBlock(i, e, s), t?.node === i) {
          var u = n.result.split(`
`);
          t.setMappedPos([u.length, vi(u).length + 1]);
        }
      }), this.result;
    }, r;
  })()
), V5e = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var a = this;
      this.setMappedPos = function(s) {
        a.mappedPosWhenConverting = s;
      }, this.schema = e, this.eventEmitter = i, this.focusedNode = null, this.mappedPosWhenConverting = null, this.toWwConvertors = A5e(n), this.toMdConvertors = z5e(t || {}), this.eventEmitter.listen("setFocusedNode", function(s) {
        return a.focusedNode = s;
      });
    }
    return r.prototype.getMappedPos = function() {
      return this.mappedPosWhenConverting;
    }, r.prototype.getInfoForPosSync = function() {
      return { node: this.focusedNode, setMappedPos: this.setMappedPos };
    }, r.prototype.toWysiwygModel = function(e) {
      var t = new R5e(this.schema, this.toWwConvertors);
      return t.convertNode(e, this.getInfoForPosSync());
    }, r.prototype.toMarkdownText = function(e) {
      var t = new H5e(this.toMdConvertors), n = t.convertNode(e, this.getInfoForPosSync());
      return n = this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown", n), n;
    }, r;
  })()
);
function U5e(r) {
  var e = r.plugin, t = r.eventEmitter, n = r.usageStatistics, i = r.instance, a = { Plugin: Ji, PluginKey: Ch, Selection: cr, TextSelection: dr }, s = { Decoration: ji, DecorationSet: un }, u = { Fragment: Qe }, f = { InputRule: Tl, inputRules: cx, undoInputRule: Dre }, p = { keymap: kh }, y = {
    eventEmitter: t,
    usageStatistics: n,
    instance: i,
    pmState: a,
    pmView: s,
    pmModel: u,
    pmRules: f,
    pmKeymap: p,
    i18n: Xt
  };
  if (wf(e)) {
    var T = e[0], N = e[1], O = N === void 0 ? {} : N;
    return T(y, O);
  }
  return e(y);
}
function YE(r) {
  var e = r.plugins, t = r.eventEmitter, n = r.usageStatistics, i = r.instance;
  return t.listen("mixinTableOffsetMapPrototype", bje), (e ?? []).reduce(function(a, s) {
    var u = U5e({
      plugin: s,
      eventEmitter: t,
      usageStatistics: n,
      instance: i
    });
    if (!u)
      throw new Error("The return value of the executed plugin is empty.");
    var f = u.markdownParsers, p = u.toHTMLRenderers, y = u.toMarkdownRenderers, T = u.markdownPlugins, N = u.wysiwygPlugins, O = u.wysiwygNodeViews, A = u.markdownCommands, q = u.wysiwygCommands, U = u.toolbarItems;
    return p && (a.toHTMLRenderers = um(a.toHTMLRenderers, p)), y && (a.toMarkdownRenderers = um(a.toMarkdownRenderers, y)), T && (a.mdPlugins = a.mdPlugins.concat(T)), N && (a.wwPlugins = a.wwPlugins.concat(N)), O && (a.wwNodeViews = _e(_e({}, a.wwNodeViews), O)), A && (a.mdCommands = _e(_e({}, a.mdCommands), A)), q && (a.wwCommands = _e(_e({}, a.wwCommands), q)), U && (a.toolbarItems = a.toolbarItems.concat(U)), f && (a.markdownParsers = _e(_e({}, a.markdownParsers), f)), a;
  }, {
    toHTMLRenderers: {},
    toMarkdownRenderers: {},
    mdPlugins: [],
    wwPlugins: [],
    wwNodeViews: {},
    mdCommands: {},
    wwCommands: {},
    toolbarItems: [],
    markdownParsers: {}
  });
}
var $5e = "data-task", W5e = "data-task-disabled", j5e = "checked";
function G5e(r) {
  ["htmlBlock", "htmlInline"].forEach(function(e) {
    r[e] && Object.keys(r[e]).forEach(function(t) {
      return NE(t);
    });
  });
}
var ZE = (
  /** @class */
  (function() {
    function r(e) {
      var t = this;
      this.options = lk({
        linkAttributes: null,
        extendedAutolinks: !1,
        customHTMLRenderer: null,
        referenceDefinition: !1,
        customHTMLSanitizer: null,
        frontMatter: !1,
        usageStatistics: !0,
        theme: "light"
      }, e), this.eventEmitter = new QE();
      var n = vx(this.options.linkAttributes), i = YE({
        plugins: this.options.plugins,
        eventEmitter: this.eventEmitter,
        usageStatistics: this.options.usageStatistics,
        instance: this
      }) || {}, a = i.toHTMLRenderers, s = i.markdownParsers, u = this.options, f = u.customHTMLRenderer, p = u.extendedAutolinks, y = u.referenceDefinition, T = u.frontMatter, N = u.customHTMLSanitizer, O = {
        linkAttributes: n,
        customHTMLRenderer: _e(_e({}, a), f),
        extendedAutolinks: p,
        referenceDefinition: y,
        frontMatter: T,
        sanitizer: N || Lu
      };
      G5e(O.customHTMLRenderer), this.options.events && lf(this.options.events, function(se, me) {
        t.on(me, se);
      });
      var A = this.options, q = A.el, U = A.initialValue, j = A.theme, te = q.innerHTML;
      j !== "light" && q.classList.add(Mt(j)), q.innerHTML = "", this.toastMark = new SE("", {
        disallowedHtmlBlockTags: ["br", "img"],
        extendedAutolinks: p,
        referenceDefinition: y,
        disallowDeepHeading: !0,
        frontMatter: T,
        customParser: s
      }), this.preview = new AE(this.eventEmitter, _e(_e({}, O), { isViewer: !0 })), jx(this.preview.previewContent, "mousedown", this.toggleTask.bind(this)), U ? this.setMarkdown(U) : te && this.preview.setHTML(te), q.appendChild(this.preview.previewContent), this.eventEmitter.emit("load", this);
    }
    return r.prototype.toggleTask = function(e) {
      var t = e.target, n = getComputedStyle(t, ":before");
      !t.hasAttribute(W5e) && t.hasAttribute($5e) && gk(n, e.offsetX, e.offsetY) && (yk(t, j5e), this.eventEmitter.emit("change", {
        source: "viewer",
        date: e
      }));
    }, r.prototype.setMarkdown = function(e) {
      var t = this.toastMark.getLineTexts(), n = t.length, i = vi(t), a = [n, i.length + 1], s = this.toastMark.editMarkdown([1, 1], a, e || "");
      this.eventEmitter.emit("updatePreview", s);
    }, r.prototype.on = function(e, t) {
      this.eventEmitter.listen(e, t);
    }, r.prototype.off = function(e) {
      this.eventEmitter.removeEventHandler(e);
    }, r.prototype.addHook = function(e, t) {
      this.eventEmitter.removeEventHandler(e), this.eventEmitter.listen(e, t);
    }, r.prototype.destroy = function() {
      Wx(this.preview.el, "mousedown", this.toggleTask.bind(this)), this.preview.destroy(), this.eventEmitter.emit("destroy");
    }, r.prototype.isViewer = function() {
      return !0;
    }, r.prototype.isMarkdownMode = function() {
      return !1;
    }, r.prototype.isWysiwygMode = function() {
      return !1;
    }, r;
  })()
);
function jv(r) {
  return r instanceof hl;
}
function eM(r) {
  var e = [
    "document",
    "blockQuote",
    "bulletList",
    "orderedList",
    "listItem",
    "paragraph",
    "heading",
    "emph",
    "strong",
    "strike",
    "link",
    "image",
    "table",
    "tableHead",
    "tableBody",
    "tableRow",
    "tableHeadCell",
    "tableBodyCell"
  ];
  return ti(e, r);
}
function K5e(r) {
  var e = r.attrs, t = r.type, n = t.name, i = {
    type: n,
    wysiwygNode: !0,
    literal: !eM(n) && jv(r) ? r.textContent : null
  }, a = {
    heading: { level: e.level },
    link: { destination: e.linkUrl, title: e.title },
    image: { destination: e.imageUrl },
    codeBlock: { info: e.language },
    bulletList: { type: "list", listData: { type: "bullet" } },
    orderedList: { type: "list", listData: { type: "ordered", start: e.order } },
    listItem: { type: "item", listData: { task: e.task, checked: e.checked } },
    tableHeadCell: { type: "tableCell", cellType: "head", align: e.align },
    tableBodyCell: { type: "tableCell", cellType: "body", align: e.align },
    customBlock: { info: e.info }
  }, s = a[n], u = _e(_e({}, i), s), f = r.attrs, p = f.htmlAttrs, y = f.childrenHTML;
  return p ? _e(_e({}, u), { attrs: p, childrenHTML: y }) : u;
}
var J5e = {
  openTag: function(r, e) {
    var t = r, n = t.tagName, i = t.classNames, a = t.attributes, s = document.createElement(n), u = {};
    i && (s.className = i.join(" ")), a && (u = _e(_e({}, u), a)), wk(u, s), e.push(s);
  },
  closeTag: function(r, e) {
    if (e.length > 1) {
      var t = e.pop();
      vi(e).appendChild(t);
    }
  },
  html: function(r, e) {
    vi(e).insertAdjacentHTML("beforeend", r.content);
  },
  text: function(r, e) {
    var t = document.createTextNode(r.content);
    vi(e).appendChild(t);
  }
}, Q5e = (
  /** @class */
  (function() {
    function r(e, t) {
      var n = Rk(e, t), i = _e(_e({}, t.htmlBlock), t.htmlInline);
      this.customConvertorKeys = Object.keys(t).concat(Object.keys(i)), this.renderer = new Lk({
        gfm: !0,
        convertors: _e(_e({}, n), i)
      }), this.convertors = this.renderer.getConvertors();
    }
    return r.prototype.generateTokens = function(e) {
      var t = K5e(e), n = {
        entering: !0,
        leaf: jv(e) ? e.isLeaf : !1,
        options: this.renderer.getOptions(),
        getChildrenText: function() {
          return jv(e) ? e.textContent : "";
        },
        skipChildren: function() {
          return !1;
        }
      }, i = this.convertors[e.type.name], a = i(t, n, this.convertors), s = wf(a) ? a : [a];
      return (eM(e.type.name) || e.attrs.htmlInline) && (n.entering = !1, s.push({ type: "text", content: jv(e) ? e.textContent : "" }), s = s.concat(i(t, n, this.convertors))), s;
    }, r.prototype.toDOMNode = function(e) {
      var t = this.generateTokens(e), n = [];
      return t.forEach(function(i) {
        return J5e[i.type](i, n);
      }), n[0];
    }, r.prototype.getToDOMNode = function(e) {
      return ti(this.customConvertorKeys, e) ? this.toDOMNode.bind(this) : null;
    }, r;
  })()
), X5e = 100, Y5e = 15, Iv = null, Qy = null;
function zC(r, e) {
  var t = e.syncScrollTop, n = e.releaseEventBlock;
  Qy && clearTimeout(Qy), t(r), Qy = setTimeout(function() {
    n();
  }, Y5e);
}
function Z5e(r, e, t) {
  var n = e - r, i = Date.now(), a = function() {
    var s = Date.now(), u = (s - i) / X5e, f;
    Iv && clearTimeout(Iv), u < 1 ? (f = r + n * Math.cos((1 - u) * Math.PI / 2), zC(Math.ceil(f), t), Iv = setTimeout(a, 1)) : (zC(e, t), Iv = null);
  };
  a();
}
var e6e = 18, t6e = (
  /** @class */
  (function() {
    function r(e, t, n) {
      this.latestEditorScrollTop = null, this.latestPreviewScrollTop = null, this.blockedScroll = null, this.active = !0, this.timer = null;
      var i = t.previewContent, a = t.el;
      this.previewRoot = i, this.previewEl = a, this.mdEditor = e, this.editorView = e.view, this.toastMark = e.getToastMark(), this.eventEmitter = n, this.addScrollSyncEvent();
    }
    return r.prototype.addScrollSyncEvent = function() {
      var e = this;
      this.eventEmitter.listen("afterPreviewRender", function() {
        e.clearTimer(), e.timer = setTimeout(function() {
          e.syncPreviewScrollTop(!0);
        }, 200);
      }), this.eventEmitter.listen("scroll", function(t, n) {
        e.active && (t === "editor" && e.blockedScroll !== "editor" ? e.syncPreviewScrollTop() : t === "preview" && e.blockedScroll !== "preview" && e.syncEditorScrollTop(n));
      }), this.eventEmitter.listen("toggleScrollSync", function(t) {
        e.active = t;
      });
    }, r.prototype.getMdNodeAtPos = function(e, t) {
      var n = e.content.findIndex(t.pos), i = n.index;
      return this.toastMark.findFirstNodeAtLine(i + 1);
    }, r.prototype.getScrollTopByCaretPos = function() {
      var e = this.mdEditor.getSelection(), t = this.toastMark.findFirstNodeAtLine(e[0][0]), n = this.previewEl.clientHeight, i = jy(this.previewRoot, t).el, a = km(i, this.previewRoot) || i.offsetTop, s = i.clientHeight, u = a + s - n * 0.5;
      this.latestEditorScrollTop = null;
      var f = i.getBoundingClientRect().top - this.previewEl.getBoundingClientRect().top;
      return f < n ? null : u;
    }, r.prototype.syncPreviewScrollTop = function(e) {
      e === void 0 && (e = !1);
      var t = this, n = t.editorView, i = t.previewEl, a = t.previewRoot, s = n.dom.getBoundingClientRect(), u = s.left, f = s.top, p = n.posAtCoords({ left: u, top: f }), y = n.state.doc, T = this.getMdNodeAtPos(y, p);
      if (!(!T || zne(T))) {
        var N = i.scrollTop, O = n.dom, A = O.scrollTop, q = O.scrollHeight, U = O.clientHeight, j = O.children, te = q - A <= U + e6e, se = te ? i.scrollHeight : 0;
        if (A && !te) {
          if (e) {
            var me = this.getScrollTopByCaretPos();
            if (!me)
              return;
            se = me;
          } else {
            var Ce = jy(this.previewRoot, T), pe = Ce.el, ke = Ce.mdNode, Ne = xC(y, ke, j), ze = Ne.height, Ze = Ne.rect, At = km(pe, a) || pe.offsetTop, et = pe.clientHeight, Ht = f > Ze.top ? Math.min((f - Ze.top) / ze, 1) : 0;
            se = At + et * Ht;
          }
          se = this.getResolvedScrollTop("editor", A, se, N), this.latestEditorScrollTop = A;
        }
        se !== N && this.run("editor", se, N);
      }
    }, r.prototype.syncEditorScrollTop = function(e) {
      var t = this, n = t.toastMark, i = t.editorView, a = t.previewRoot, s = t.previewEl, u = i.dom, f = i.state, p = s.scrollTop, y = s.clientHeight, T = s.scrollHeight, N = T - p <= y, O = u.scrollTop, A = N ? u.scrollHeight : 0;
      if (p && e && !N) {
        if (e = XWe(e, a), !e.getAttribute("data-nodeid"))
          return;
        var q = u.children, U = Number(e.getAttribute("data-nodeid")), j = jy(this.previewRoot, n.findNodeById(U)), te = j.mdNode, se = j.el, me = Mh(te);
        A = q[me - 1].offsetTop;
        var Ce = xC(f.doc, te, q).height, pe = aje(se, a, U), ke = pe.nodeHeight, Ne = pe.offsetTop;
        A += ZWe(p, Ne, ke, Ce), A = this.getResolvedScrollTop("preview", p, A, O), this.latestPreviewScrollTop = p;
      }
      A !== O && this.run("preview", A, O);
    }, r.prototype.getResolvedScrollTop = function(e, t, n, i) {
      var a = e === "editor" ? this.latestEditorScrollTop : this.latestPreviewScrollTop;
      return a === null ? n : a < t ? Math.max(n, i) : Math.min(n, i);
    }, r.prototype.run = function(e, t, n) {
      var i = this, a;
      e === "editor" ? (a = this.previewEl, this.blockedScroll = "preview") : (a = this.editorView.dom, this.blockedScroll = "editor");
      var s = {
        syncScrollTop: function(u) {
          return a.scrollTop = u;
        },
        releaseEventBlock: function() {
          return i.blockedScroll = null;
        }
      };
      Z5e(n, t, s);
    }, r.prototype.clearTimer = function() {
      this.timer && (clearTimeout(this.timer), this.timer = null);
    }, r.prototype.destroy = function() {
      this.clearTimer(), this.eventEmitter.removeEventHandler("scroll"), this.eventEmitter.removeEventHandler("afterPreviewRender");
    }, r;
  })()
), r6e = {
  getPopupInitialValues: function(r, e) {
    var t = e.popupName;
    return t === "link" ? { linkText: r.getSelectedText() } : {};
  }
};
function n6e(r) {
  r.eventEmitter.listen("query", function(e, t) {
    return r6e[e](r, t);
  });
}
var tM = (
  /** @class */
  (function() {
    function r(e) {
      var t = this;
      this.initialHTML = e.el.innerHTML, e.el.innerHTML = "", this.options = lk({
        previewStyle: "tab",
        previewHighlight: !0,
        initialEditType: "markdown",
        height: "300px",
        minHeight: "200px",
        language: "en-US",
        useCommandShortcut: !0,
        usageStatistics: !0,
        toolbarItems: [
          ["heading", "bold", "italic", "strike"],
          ["hr", "quote"],
          ["ul", "ol", "task", "indent", "outdent"],
          ["table", "image", "link"],
          ["code", "codeblock"],
          ["scrollSync"]
        ],
        hideModeSwitch: !1,
        linkAttributes: null,
        extendedAutolinks: !1,
        customHTMLRenderer: null,
        customMarkdownRenderer: null,
        referenceDefinition: !1,
        customHTMLSanitizer: null,
        frontMatter: !1,
        widgetRules: [],
        theme: "light",
        autofocus: !0
      }, e);
      var n = this.options, i = n.customHTMLRenderer, a = n.extendedAutolinks, s = n.referenceDefinition, u = n.frontMatter, f = n.customMarkdownRenderer, p = n.useCommandShortcut, y = n.initialEditType, T = n.widgetRules, N = n.customHTMLSanitizer;
      this.mode = y || "markdown", this.mdPreviewStyle = this.options.previewStyle, this.i18n = Xt, this.i18n.setCode(this.options.language), this.eventEmitter = new QE(), Qne(T);
      var O = vx(this.options.linkAttributes);
      this.pluginInfo = YE({
        plugins: this.options.plugins,
        eventEmitter: this.eventEmitter,
        usageStatistics: this.options.usageStatistics,
        instance: this
      });
      var A = this.pluginInfo, q = A.toHTMLRenderers, U = A.toMarkdownRenderers, j = A.mdPlugins, te = A.wwPlugins, se = A.wwNodeViews, me = A.mdCommands, Ce = A.wwCommands, pe = A.markdownParsers, ke = {
        linkAttributes: O,
        customHTMLRenderer: um(q, i),
        extendedAutolinks: a,
        referenceDefinition: s,
        frontMatter: u,
        sanitizer: N || Lu
      }, Ne = new Q5e(O, ke.customHTMLRenderer), ze = $We(ke.customHTMLRenderer, ke.sanitizer, Ne);
      this.toastMark = new SE("", {
        disallowedHtmlBlockTags: ["br", "img"],
        extendedAutolinks: a,
        referenceDefinition: s,
        disallowDeepHeading: !0,
        frontMatter: u,
        customParser: pe
      }), this.mdEditor = new Yae(this.eventEmitter, {
        toastMark: this.toastMark,
        useCommandShortcut: p,
        mdPlugins: j
      }), this.preview = new AE(this.eventEmitter, _e(_e({}, ke), { isViewer: !1, highlight: this.options.previewHighlight })), this.wwEditor = new v5e(this.eventEmitter, {
        toDOMAdaptor: Ne,
        useCommandShortcut: p,
        htmlSchemaMap: ze,
        linkAttributes: O,
        wwPlugins: te,
        wwNodeViews: se
      }), this.convertor = new V5e(this.wwEditor.getSchema(), _e(_e({}, U), f), Rk(O, ke.customHTMLRenderer), this.eventEmitter), this.setMinHeight(this.options.minHeight), this.setHeight(this.options.height), this.setMarkdown(this.options.initialValue, !1), this.options.placeholder && this.setPlaceholder(this.options.placeholder), this.options.initialValue || this.setHTML(this.initialHTML, !1), this.commandManager = new E5e(this.eventEmitter, this.mdEditor.commands, this.wwEditor.commands, function() {
        return t.mode;
      }), this.options.usageStatistics && Ane(), this.scrollSync = new t6e(this.mdEditor, this.preview, this.eventEmitter), this.addInitEvent(), this.addInitCommand(me, Ce), n6e(this), this.options.hooks && lf(this.options.hooks, function(Ze, At) {
        return t.addHook(At, Ze);
      }), this.options.events && lf(this.options.events, function(Ze, At) {
        return t.on(At, Ze);
      }), this.eventEmitter.emit("load", this), this.moveCursorToStart(this.options.autofocus);
    }
    return r.prototype.addInitEvent = function() {
      var e = this;
      this.on("needChangeMode", this.changeMode.bind(this)), this.on("loadUI", function() {
        if (e.height !== "auto") {
          var t = Math.min(parseInt(e.minHeight, 10), parseInt(e.height, 10) - 75) + "px";
          e.setMinHeight(t);
        }
      }), Cie(this.eventEmitter);
    }, r.prototype.addInitCommand = function(e, t) {
      var n = this, i = function(a, s) {
        Object.keys(s).forEach(function(u) {
          n.addCommand(a, u, s[u]);
        });
      };
      this.addCommand("markdown", "toggleScrollSync", function(a) {
        return n.eventEmitter.emit("toggleScrollSync", a.active), !0;
      }), i("markdown", e), i("wysiwyg", t);
    }, r.prototype.getCurrentModeEditor = function() {
      return this.isMarkdownMode() ? this.mdEditor : this.wwEditor;
    }, r.factory = function(e) {
      return e.viewer ? new ZE(e) : new r(e);
    }, r.setLanguage = function(e, t) {
      Xt.setLanguage(e, t);
    }, r.prototype.changePreviewStyle = function(e) {
      this.mdPreviewStyle !== e && (this.mdPreviewStyle = e, this.eventEmitter.emit("changePreviewStyle", e));
    }, r.prototype.exec = function(e, t) {
      this.commandManager.exec(e, t);
    }, r.prototype.addCommand = function(e, t, n) {
      var i = this, a = function(s) {
        s === void 0 && (s = {});
        var u = (e === "markdown" ? i.mdEditor : i.wwEditor).view;
        n(s, u.state, u.dispatch, u);
      };
      this.commandManager.addCommand(e, t, a);
    }, r.prototype.on = function(e, t) {
      this.eventEmitter.listen(e, t);
    }, r.prototype.off = function(e) {
      this.eventEmitter.removeEventHandler(e);
    }, r.prototype.addHook = function(e, t) {
      this.eventEmitter.removeEventHandler(e), this.eventEmitter.listen(e, t);
    }, r.prototype.removeHook = function(e) {
      this.eventEmitter.removeEventHandler(e);
    }, r.prototype.focus = function() {
      this.getCurrentModeEditor().focus();
    }, r.prototype.blur = function() {
      this.getCurrentModeEditor().blur();
    }, r.prototype.moveCursorToEnd = function(e) {
      e === void 0 && (e = !0), this.getCurrentModeEditor().moveCursorToEnd(e);
    }, r.prototype.moveCursorToStart = function(e) {
      e === void 0 && (e = !0), this.getCurrentModeEditor().moveCursorToStart(e);
    }, r.prototype.setMarkdown = function(e, t) {
      if (e === void 0 && (e = ""), t === void 0 && (t = !0), this.mdEditor.setMarkdown(e, t), this.isWysiwygMode()) {
        var n = this.toastMark.getRootNode(), i = this.convertor.toWysiwygModel(n);
        this.wwEditor.setModel(i, t);
      }
    }, r.prototype.setHTML = function(e, t) {
      e === void 0 && (e = ""), t === void 0 && (t = !0);
      var n = document.createElement("div");
      n.innerHTML = kie(e);
      var i = Tu.fromSchema(this.wwEditor.schema).parse(n);
      this.isMarkdownMode() ? this.mdEditor.setMarkdown(this.convertor.toMarkdownText(i), t) : this.wwEditor.setModel(i, t);
    }, r.prototype.getMarkdown = function() {
      return this.isMarkdownMode() ? this.mdEditor.getMarkdown() : this.convertor.toMarkdownText(this.wwEditor.getModel());
    }, r.prototype.getHTML = function() {
      var e = this;
      this.eventEmitter.holdEventInvoke(function() {
        if (e.isMarkdownMode()) {
          var i = e.toastMark.getRootNode(), a = e.convertor.toWysiwygModel(i);
          e.wwEditor.setModel(a);
        }
      });
      var t = bk(this.wwEditor.view.dom.innerHTML);
      if (this.placeholder) {
        var n = new RegExp('<span class="placeholder[^>]+>' + this.placeholder + "</span>", "i");
        return t.replace(n, "");
      }
      return t;
    }, r.prototype.insertText = function(e) {
      this.getCurrentModeEditor().replaceSelection(e);
    }, r.prototype.setSelection = function(e, t) {
      this.getCurrentModeEditor().setSelection(e, t);
    }, r.prototype.replaceSelection = function(e, t, n) {
      this.getCurrentModeEditor().replaceSelection(e, t, n);
    }, r.prototype.deleteSelection = function(e, t) {
      this.getCurrentModeEditor().deleteSelection(e, t);
    }, r.prototype.getSelectedText = function(e, t) {
      return this.getCurrentModeEditor().getSelectedText(e, t);
    }, r.prototype.getRangeInfoOfNode = function(e) {
      return this.getCurrentModeEditor().getRangeInfoOfNode(e);
    }, r.prototype.addWidget = function(e, t, n) {
      this.getCurrentModeEditor().addWidget(e, t, n);
    }, r.prototype.replaceWithWidget = function(e, t, n) {
      this.getCurrentModeEditor().replaceWithWidget(e, t, n);
    }, r.prototype.setHeight = function(e) {
      var t = this.options.el;
      Ms(e) && (e === "auto" ? Io(t, "auto-height") : Ya(t, "auto-height"), this.setMinHeight(this.getMinHeight())), _o(t, { height: e }), this.height = e;
    }, r.prototype.getHeight = function() {
      return this.height;
    }, r.prototype.setMinHeight = function(e) {
      if (e !== this.minHeight) {
        var t = this.height || this.options.height;
        t !== "auto" && this.options.el.querySelector("." + Mt("main")) && (e = Math.min(parseInt(e, 10), parseInt(t, 10) - 75) + "px");
        var n = parseInt(e, 10);
        this.minHeight = e, this.wwEditor.setMinHeight(n), this.mdEditor.setMinHeight(n), this.preview.setMinHeight(n);
      }
    }, r.prototype.getMinHeight = function() {
      return this.minHeight;
    }, r.prototype.isMarkdownMode = function() {
      return this.mode === "markdown";
    }, r.prototype.isWysiwygMode = function() {
      return this.mode === "wysiwyg";
    }, r.prototype.isViewer = function() {
      return !1;
    }, r.prototype.getCurrentPreviewStyle = function() {
      return this.mdPreviewStyle;
    }, r.prototype.changeMode = function(e, t) {
      if (this.mode !== e) {
        if (this.mode = e, this.isWysiwygMode()) {
          var n = this.toastMark.getRootNode(), i = this.convertor.toWysiwygModel(n);
          this.wwEditor.setModel(i);
        } else {
          var i = this.wwEditor.getModel();
          this.mdEditor.setMarkdown(this.convertor.toMarkdownText(i), !t);
        }
        if (this.eventEmitter.emit("removePopupWidget"), this.eventEmitter.emit("changeMode", e), !t) {
          var a = this.convertor.getMappedPos();
          this.focus(), this.isWysiwygMode() && ws(a) ? this.wwEditor.setSelection(a) : Array.isArray(a) && this.mdEditor.setSelection(a);
        }
      }
    }, r.prototype.destroy = function() {
      var e = this;
      this.wwEditor.destroy(), this.mdEditor.destroy(), this.preview.destroy(), this.scrollSync.destroy(), this.eventEmitter.emit("destroy"), this.eventEmitter.getEvents().forEach(function(t, n) {
        return e.off(n);
      });
    }, r.prototype.hide = function() {
      this.eventEmitter.emit("hide");
    }, r.prototype.show = function() {
      this.eventEmitter.emit("show");
    }, r.prototype.setScrollTop = function(e) {
      this.getCurrentModeEditor().setScrollTop(e);
    }, r.prototype.getScrollTop = function() {
      return this.getCurrentModeEditor().getScrollTop();
    }, r.prototype.reset = function() {
      this.wwEditor.setModel([]), this.mdEditor.setMarkdown("");
    }, r.prototype.getSelection = function() {
      return this.getCurrentModeEditor().getSelection();
    }, r.prototype.setPlaceholder = function(e) {
      this.placeholder = e, this.mdEditor.setPlaceholder(e), this.wwEditor.setPlaceholder(e);
    }, r.prototype.getEditorElements = function() {
      return {
        mdEditor: this.mdEditor.getElement(),
        mdPreview: this.preview.getElement(),
        wwEditor: this.wwEditor.getElement()
      };
    }, r.prototype.convertPosToMatchEditorMode = function(e, t, n) {
      var i, a;
      t === void 0 && (t = e), n === void 0 && (n = this.mode);
      var s = this.mdEditor.view.state.doc, u = Array.isArray(e), f = Array.isArray(t), p = e, y = t;
      if (u !== f)
        throw new Error("Types of arguments must be same");
      return n === "markdown" && !u && !f ? (i = zv(s, e, t), p = i[0], y = i[1]) : n === "wysiwyg" && u && f && (a = fu(s, e, t), p = a[0], y = a[1]), [p, y];
    }, r;
  })()
);
function i6e(r) {
  for (var e, t, n = arguments, i = 1, a = "", s = "", u = [0], f = function(y) {
    i === 1 && (y || (a = a.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? u.push(y ? n[y] : a) : i === 3 && (y || a) ? (u[1] = y ? n[y] : a, i = 2) : i === 2 && a === "..." && y ? u[2] = pk(u[2] || {}, n[y]) : i === 2 && a && !y ? (u[2] = u[2] || {})[a] = !0 : i >= 5 && (i === 5 ? ((u[2] = u[2] || {})[t] = y ? a ? a + n[y] : n[y] : a, i = 6) : (y || a) && (u[2][t] += y ? a + n[y] : a)), a = "";
  }, p = 0; p < r.length; p++) {
    p && (i === 1 && f(), f(p));
    for (let y = 0; y < r[p].length; y++)
      e = r[p][y], i === 1 ? e === "<" ? (f(), u = [u, "", null], i = 3) : a += e : i === 4 ? a === "--" && e === ">" ? (i = 1, a = "") : a = e + a[0] : s ? e === s ? s = "" : a += e : e === '"' || e === "'" ? s = e : e === ">" ? (f(), i = 1) : i && (e === "=" ? (i = 5, t = a, a = "") : e === "/" && (i < 5 || r[p][y + 1] === ">") ? (f(), i === 3 && (u = u[0]), i = u, (u = u[0]).push(this.apply(null, i.slice(1))), i = 0) : e === " " || e === "	" || e === `
` || e === "\r" ? (f(), i = 2) : a += e), i === 3 && a === "!--" && (i = 4, u = u[0]);
  }
  return f(), u.length > 2 ? u.slice(1) : u[1];
}
function a6e(r) {
  return typeof r == "boolean" || r instanceof Boolean;
}
var o6e = a6e, s6e = (
  /** @class */
  (function() {
    function r(e) {
      this.current = e, this.root = e, this.entering = !0;
    }
    return r.prototype.walk = function() {
      var e = this, t = e.entering, n = e.current;
      return n ? (t ? n.firstChild ? (this.current = n.firstChild, this.entering = !0) : this.entering = !1 : n === this.root ? this.current = null : n.next ? (this.current = n.next, this.entering = !0) : (this.current = n.parent, this.entering = !1), { vnode: n, entering: t }) : null;
    }, r;
  })()
), eo = (
  /** @class */
  (function() {
    function r(e, t, n) {
      this.parent = null, this.old = null, this.firstChild = null, this.next = null, this.skip = !1, this.type = e, this.props = t, this.children = n, this.props.children = n, t.ref && (this.ref = t.ref, delete t.ref), t.key && (this.key = t.key, delete t.key);
    }
    return r.prototype.walker = function() {
      return new s6e(this);
    }, r.removalNodes = [], r;
  })()
);
function l6e(r) {
  return new eo("TEXT_NODE", { nodeValue: r }, []);
}
function HC(r, e) {
  var t = r;
  o6e(r) || r == null ? t = null : (Ms(r) || ws(r)) && (t = l6e(String(r))), t && e.push(t);
}
function u6e(r, e) {
  for (var t = [], n = 2; n < arguments.length; n++)
    t[n - 2] = arguments[n];
  var i = [];
  return t.forEach(function(a) {
    Array.isArray(a) ? a.forEach(function(s) {
      HC(s, i);
    }) : HC(a, i);
  }), new eo(r, e || {}, i);
}
var vr = i6e.bind(u6e);
function c6e(r) {
  return r === Object(r);
}
var f6e = c6e;
function d6e(r) {
  var e;
  return r.type === "TEXT_NODE" ? e = document.createTextNode(r.props.nodeValue) : (e = document.createElement(r.type), nM(e, {}, r.props)), e;
}
function rM(r, e) {
  r.node ? e.removeChild(r.node) : rM(r.firstChild, e);
}
function h6e(r, e, t) {
  Object.keys(e).forEach(function(n) {
    if (/^on/.test(n)) {
      if (!t[n] || e[n] !== t[n]) {
        var i = n.slice(2).toLowerCase();
        r.removeEventListener(i, e[n]);
      }
    } else n !== "children" && !t[n] && !pie(r) && r.removeAttribute(n);
  }), nM(r, e, t, function(n) {
    return !ck(e[n], t[n]);
  });
}
var p6e = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
function nM(r, e, t, n) {
  Object.keys(t).forEach(function(i) {
    if (!n || n(i))
      if (/^on/.test(i)) {
        var a = i.slice(2).toLowerCase();
        r.addEventListener(a, t[i]);
      } else i === "nodeValue" ? r[i] = t[i] : i === "style" && f6e(t[i]) ? v6e(r, e[i], t[i]) : i !== "children" && (t[i] === !1 ? r.removeAttribute(i) : r.setAttribute(i, t[i]));
  });
}
function v6e(r, e, t) {
  e && Object.keys(e).forEach(function(n) {
    r.style[n] = "";
  }), Object.keys(t).forEach(function(n) {
    var i = t[n];
    r.style[n] = ws(i) && !p6e.test(n) ? i + "px" : i;
  });
}
function Bk(r) {
  if (eo.removalNodes.forEach(function(a) {
    return UC(a);
  }), r) {
    for (var e = void 0, t = r.walker(); e = t.walk(); )
      if (r = e.vnode, e.entering)
        UC(r);
      else if (Ma(r.type)) {
        var n = r.component;
        if (!r.old && n.mounted && n.mounted(), r.old && n.updated) {
          var i = n.prevProps || {};
          n.updated(i);
        }
      }
  }
}
function VC(r) {
  for (var e = r.parent; !e.node; )
    e = e.parent;
  return e.node;
}
function UC(r) {
  if (!(!r || !r.parent)) {
    if (r.node) {
      var e = VC(r);
      r.effect === "A" ? e.appendChild(r.node) : r.effect === "U" && h6e(r.node, r.old.props, r.props);
    }
    if (r.effect === "D") {
      for (var t = void 0, n = r.walker(); t = n.walk(); )
        if (r = t.vnode, !t.entering)
          if (Ma(r.type)) {
            var i = r.component;
            i.beforeDestroy && i.beforeDestroy();
          } else {
            var e = VC(r);
            rM(r, e);
          }
    }
    r.ref && (r.component ? r.ref(r.component) : r.node && r.ref(r.node));
  }
}
function m6e(r, e) {
  var t = e.props, n = e.component;
  return n ? (n.prevProps = n.props, n.props = e.props, n) : new r(t);
}
function iM(r) {
  for (var e = r; r && !r.skip; ) {
    if (Ma(r.type)) {
      var t = m6e(r.type, r);
      t.vnode = r, r.component = t, r.props.children = r.children = [t.render()], $C(r);
    } else
      r.node || (r.node = d6e(r)), $C(r);
    if (r.firstChild)
      r = r.firstChild;
    else {
      for (; r && r.parent && !r.next && (r = r.parent, r !== e); )
        ;
      r = r.next;
    }
  }
}
function g6e(r, e) {
  return r && e && e.type === r.type && (!e.key || e.key === r.key);
}
function $C(r) {
  var e = r.children, t = r.old ? r.old.firstChild : null, n = null;
  e.forEach(function(a, s) {
    var u = g6e(t, a);
    u && (a.old = t, a.parent = r, a.node = t.node, a.component = t.component, a.effect = "U"), a && !u && (a.old = null, a.parent = r, a.node = null, a.effect = "A"), t && !u && (eo.removalNodes.push(t), t.effect = "D"), t && (t = t.next), s === 0 ? r.firstChild = a : a && (n.next = a), n = a;
  });
  var i = vi(e);
  if (!e.length)
    for (; t; )
      eo.removalNodes.push(t), t.effect = "D", t = t.next;
  for (; t && i; )
    t && i.old !== t && (eo.removalNodes.push(t), t.effect = "D", t = t.next);
}
function y6e(r) {
  r.effect = "D", eo.removalNodes = [r], Bk(), eo.removalNodes = [];
}
function k6e(r) {
  var e = r.vnode;
  e.effect = "U", e.old = e, e.next && (e.next.skip = !0), eo.removalNodes = [], iM(e), Bk(e), e.next && (e.next.skip = !1);
}
function w6e(r, e) {
  var t = new eo(r.tagName.toLowerCase(), {}, [e]);
  return t.node = r, eo.removalNodes = [], iM(t), Bk(t), function() {
    return y6e(t.firstChild);
  };
}
var yi = (
  /** @class */
  (function() {
    function r(e) {
      this.props = e, this.state = {}, this.refs = {};
    }
    return r.prototype.setState = function(e) {
      var t = _e(_e({}, this.state), e);
      ck(this.state, t) || (this.state = t, k6e(this));
    }, r;
  })()
), b6e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.state = {
        hide: !1
      }, n;
    }
    return e.prototype.show = function() {
      this.setState({ hide: !1 });
    }, e.prototype.hide = function() {
      this.setState({ hide: !0 });
    }, e.prototype.render = function() {
      var t = this.props, n = t.editorType, i = t.eventEmitter;
      return vr(WC || (WC = pr([`
      <div class="`, '" style="display: ', `">
        <div
          class="tab-item`, `"
          onClick=`, `
        >
          `, `
        </div>
        <div
          class="tab-item`, `"
          onClick=`, `
        >
          `, `
        </div>
      </div>
    `], [
        `
      <div class="`,
        '" style="display: ',
        `">
        <div
          class="tab-item`,
        `"
          onClick=`,
        `
        >
          `,
        `
        </div>
        <div
          class="tab-item`,
        `"
          onClick=`,
        `
        >
          `,
        `
        </div>
      </div>
    `
      ])), Mt("mode-switch"), this.state.hide ? "none" : "block", n === "markdown" ? " active" : "", function() {
        i.emit("needChangeMode", "markdown");
      }, Xt.get("Markdown"), n === "wysiwyg" ? " active" : "", function() {
        i.emit("needChangeMode", "wysiwyg");
      }, Xt.get("WYSIWYG"));
    }, e;
  })(yi)
), WC;
function C6e(r, e) {
  var t, n;
  e = e || 0;
  function i() {
    n = Array.prototype.slice.call(arguments), window.clearTimeout(t), t = window.setTimeout(function() {
      r.apply(null, n);
    }, e);
  }
  return i;
}
var T6e = C6e, S6e = T6e;
function x6e(r, e) {
  var t, n = !0, i = function(y) {
    r.apply(null, y), t = null;
  }, a, s, u;
  e = e || 0, a = S6e(i, e);
  function f() {
    if (u = Array.prototype.slice.call(arguments), n) {
      i(u), n = !1;
      return;
    }
    s = Number(/* @__PURE__ */ new Date()), t = t || s, a(u), s - t >= e && i(u);
  }
  function p() {
    n = !0, t = null;
  }
  return f.reset = p, f;
}
var E6e = x6e, aM = (function() {
  if (typeof Map < "u")
    return Map;
  function r(e, t) {
    var n = -1;
    return e.some(function(i, a) {
      return i[0] === t ? (n = a, !0) : !1;
    }), n;
  }
  return (
    /** @class */
    (function() {
      function e() {
        this.__entries__ = [];
      }
      return Object.defineProperty(e.prototype, "size", {
        /**
         * @returns {boolean}
         */
        get: function() {
          return this.__entries__.length;
        },
        enumerable: !0,
        configurable: !0
      }), e.prototype.get = function(t) {
        var n = r(this.__entries__, t), i = this.__entries__[n];
        return i && i[1];
      }, e.prototype.set = function(t, n) {
        var i = r(this.__entries__, t);
        ~i ? this.__entries__[i][1] = n : this.__entries__.push([t, n]);
      }, e.prototype.delete = function(t) {
        var n = this.__entries__, i = r(n, t);
        ~i && n.splice(i, 1);
      }, e.prototype.has = function(t) {
        return !!~r(this.__entries__, t);
      }, e.prototype.clear = function() {
        this.__entries__.splice(0);
      }, e.prototype.forEach = function(t, n) {
        n === void 0 && (n = null);
        for (var i = 0, a = this.__entries__; i < a.length; i++) {
          var s = a[i];
          t.call(n, s[1], s[0]);
        }
      }, e;
    })()
  );
})(), z0 = typeof window < "u" && typeof document < "u" && window.document === document, bm = (function() {
  return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
})(), M6e = (function() {
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(bm) : function(r) {
    return setTimeout(function() {
      return r(Date.now());
    }, 1e3 / 60);
  };
})(), N6e = 2;
function O6e(r, e) {
  var t = !1, n = !1, i = 0;
  function a() {
    t && (t = !1, r()), n && u();
  }
  function s() {
    M6e(a);
  }
  function u() {
    var f = Date.now();
    if (t) {
      if (f - i < N6e)
        return;
      n = !0;
    } else
      t = !0, n = !1, setTimeout(s, e);
    i = f;
  }
  return u;
}
var D6e = 20, A6e = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], L6e = typeof MutationObserver < "u", R6e = (
  /** @class */
  (function() {
    function r() {
      this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = O6e(this.refresh.bind(this), D6e);
    }
    return r.prototype.addObserver = function(e) {
      ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_();
    }, r.prototype.removeObserver = function(e) {
      var t = this.observers_, n = t.indexOf(e);
      ~n && t.splice(n, 1), !t.length && this.connected_ && this.disconnect_();
    }, r.prototype.refresh = function() {
      var e = this.updateObservers_();
      e && this.refresh();
    }, r.prototype.updateObservers_ = function() {
      var e = this.observers_.filter(function(t) {
        return t.gatherActive(), t.hasActive();
      });
      return e.forEach(function(t) {
        return t.broadcastActive();
      }), e.length > 0;
    }, r.prototype.connect_ = function() {
      !z0 || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), L6e ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
        attributes: !0,
        childList: !0,
        characterData: !0,
        subtree: !0
      })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
    }, r.prototype.disconnect_ = function() {
      !z0 || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
    }, r.prototype.onTransitionEnd_ = function(e) {
      var t = e.propertyName, n = t === void 0 ? "" : t, i = A6e.some(function(a) {
        return !!~n.indexOf(a);
      });
      i && this.refresh();
    }, r.getInstance = function() {
      return this.instance_ || (this.instance_ = new r()), this.instance_;
    }, r.instance_ = null, r;
  })()
), oM = (function(r, e) {
  for (var t = 0, n = Object.keys(e); t < n.length; t++) {
    var i = n[t];
    Object.defineProperty(r, i, {
      value: e[i],
      enumerable: !1,
      writable: !1,
      configurable: !0
    });
  }
  return r;
}), gf = (function(r) {
  var e = r && r.ownerDocument && r.ownerDocument.defaultView;
  return e || bm;
}), sM = $m(0, 0, 0, 0);
function Cm(r) {
  return parseFloat(r) || 0;
}
function jC(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  return e.reduce(function(n, i) {
    var a = r["border-" + i + "-width"];
    return n + Cm(a);
  }, 0);
}
function I6e(r) {
  for (var e = ["top", "right", "bottom", "left"], t = {}, n = 0, i = e; n < i.length; n++) {
    var a = i[n], s = r["padding-" + a];
    t[a] = Cm(s);
  }
  return t;
}
function P6e(r) {
  var e = r.getBBox();
  return $m(0, 0, e.width, e.height);
}
function B6e(r) {
  var e = r.clientWidth, t = r.clientHeight;
  if (!e && !t)
    return sM;
  var n = gf(r).getComputedStyle(r), i = I6e(n), a = i.left + i.right, s = i.top + i.bottom, u = Cm(n.width), f = Cm(n.height);
  if (n.boxSizing === "border-box" && (Math.round(u + a) !== e && (u -= jC(n, "left", "right") + a), Math.round(f + s) !== t && (f -= jC(n, "top", "bottom") + s)), !_6e(r)) {
    var p = Math.round(u + a) - e, y = Math.round(f + s) - t;
    Math.abs(p) !== 1 && (u -= p), Math.abs(y) !== 1 && (f -= y);
  }
  return $m(i.left, i.top, u, f);
}
var F6e = /* @__PURE__ */ (function() {
  return typeof SVGGraphicsElement < "u" ? function(r) {
    return r instanceof gf(r).SVGGraphicsElement;
  } : function(r) {
    return r instanceof gf(r).SVGElement && typeof r.getBBox == "function";
  };
})();
function _6e(r) {
  return r === gf(r).document.documentElement;
}
function q6e(r) {
  return z0 ? F6e(r) ? P6e(r) : B6e(r) : sM;
}
function z6e(r) {
  var e = r.x, t = r.y, n = r.width, i = r.height, a = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, s = Object.create(a.prototype);
  return oM(s, {
    x: e,
    y: t,
    width: n,
    height: i,
    top: t,
    right: e + n,
    bottom: i + t,
    left: e
  }), s;
}
function $m(r, e, t, n) {
  return { x: r, y: e, width: t, height: n };
}
var H6e = (
  /** @class */
  (function() {
    function r(e) {
      this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = $m(0, 0, 0, 0), this.target = e;
    }
    return r.prototype.isActive = function() {
      var e = q6e(this.target);
      return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
    }, r.prototype.broadcastRect = function() {
      var e = this.contentRect_;
      return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e;
    }, r;
  })()
), V6e = (
  /** @class */
  /* @__PURE__ */ (function() {
    function r(e, t) {
      var n = z6e(t);
      oM(this, { target: e, contentRect: n });
    }
    return r;
  })()
), U6e = (
  /** @class */
  (function() {
    function r(e, t, n) {
      if (this.activeObservations_ = [], this.observations_ = new aM(), typeof e != "function")
        throw new TypeError("The callback provided as parameter 1 is not a function.");
      this.callback_ = e, this.controller_ = t, this.callbackCtx_ = n;
    }
    return r.prototype.observe = function(e) {
      if (!arguments.length)
        throw new TypeError("1 argument required, but only 0 present.");
      if (!(typeof Element > "u" || !(Element instanceof Object))) {
        if (!(e instanceof gf(e).Element))
          throw new TypeError('parameter 1 is not of type "Element".');
        var t = this.observations_;
        t.has(e) || (t.set(e, new H6e(e)), this.controller_.addObserver(this), this.controller_.refresh());
      }
    }, r.prototype.unobserve = function(e) {
      if (!arguments.length)
        throw new TypeError("1 argument required, but only 0 present.");
      if (!(typeof Element > "u" || !(Element instanceof Object))) {
        if (!(e instanceof gf(e).Element))
          throw new TypeError('parameter 1 is not of type "Element".');
        var t = this.observations_;
        t.has(e) && (t.delete(e), t.size || this.controller_.removeObserver(this));
      }
    }, r.prototype.disconnect = function() {
      this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
    }, r.prototype.gatherActive = function() {
      var e = this;
      this.clearActive(), this.observations_.forEach(function(t) {
        t.isActive() && e.activeObservations_.push(t);
      });
    }, r.prototype.broadcastActive = function() {
      if (this.hasActive()) {
        var e = this.callbackCtx_, t = this.activeObservations_.map(function(n) {
          return new V6e(n.target, n.broadcastRect());
        });
        this.callback_.call(e, t, e), this.clearActive();
      }
    }, r.prototype.clearActive = function() {
      this.activeObservations_.splice(0);
    }, r.prototype.hasActive = function() {
      return this.activeObservations_.length > 0;
    }, r;
  })()
), lM = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new aM(), uM = (
  /** @class */
  /* @__PURE__ */ (function() {
    function r(e) {
      if (!(this instanceof r))
        throw new TypeError("Cannot call a class as a function.");
      if (!arguments.length)
        throw new TypeError("1 argument required, but only 0 present.");
      var t = R6e.getInstance(), n = new U6e(e, t, this);
      lM.set(this, n);
    }
    return r;
  })()
);
[
  "observe",
  "unobserve",
  "disconnect"
].forEach(function(r) {
  uM.prototype[r] = function() {
    var e;
    return (e = lM.get(this))[r].apply(e, arguments);
  };
});
var $6e = (function() {
  return typeof bm.ResizeObserver < "u" ? bm.ResizeObserver : uM;
})(), W6e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return e.prototype.execCommand = function(t) {
      var n = Po(t.target, "li");
      this.props.execCommand("heading", {
        level: Number(n.getAttribute("data-level"))
      });
    }, e.prototype.render = function() {
      var t = this;
      return vr(KC || (KC = pr([`
      <ul
        onClick=`, `
        aria-role="menu"
        aria-label="`, `"
      >
        `, `
        <li data-type="Paragraph" aria-role="menuitem">
          <div>`, `</div>
        </li>
      </ul>
    `], [
        `
      <ul
        onClick=`,
        `
        aria-role="menu"
        aria-label="`,
        `"
      >
        `,
        `
        <li data-type="Paragraph" aria-role="menuitem">
          <div>`,
        `</div>
        </li>
      </ul>
    `
      ])), function(n) {
        return t.execCommand(n);
      }, Xt.get("Headings"), [1, 2, 3, 4, 5, 6].map(function(n) {
        return vr(GC || (GC = pr([`
              <li data-level="`, `" data-type="Heading" aria-role="menuitem">
                <`, ">", " ", `</$>
              </li>
            `], [`
              <li data-level="`, `" data-type="Heading" aria-role="menuitem">
                <`, ">", " ", `</$>
              </li>
            `])), n, "h" + n, Xt.get("Heading"), n);
      }), Xt.get("Paragraph"));
    }, e;
  })(yi)
), GC, KC, cM = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return e.prototype.toggleTab = function(t, n) {
      this.props.onClick(t, n);
    }, e.prototype.render = function() {
      var t = this;
      return vr(QC || (QC = pr([`
      <div class="`, `" aria-role="tabpanel">
        `, `
      </div>
    `], [
        `
      <div class="`,
        `" aria-role="tabpanel">
        `,
        `
      </div>
    `
      ])), Mt("tabs"), this.props.tabs.map(function(n) {
        var i = n.name, a = n.text, s = t.props.activeTab === i;
        return vr(JC || (JC = pr([`
            <div
              class="tab-item`, `"
              onClick=`, `
              aria-role="tab"
              aria-label="`, `"
              aria-selected="`, `"
              tabindex="`, `"
            >
              `, `
            </div>
          `], [`
            <div
              class="tab-item`, `"
              onClick=`, `
              aria-role="tab"
              aria-label="`, `"
              aria-selected="`, `"
              tabindex="`, `"
            >
              `, `
            </div>
          `])), s ? " active" : "", function(u) {
          return t.toggleTab(u, i);
        }, Xt.get(a), s ? "true" : "false", s ? "0" : "-1", Xt.get(a));
      }));
    }, e;
  })(yi)
), JC, QC, j6e = "ui", G6e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.initialize = function(i) {
        i === void 0 && (i = "file");
        var a = n.refs.url;
        a.value = "", n.refs.altText.value = "", n.refs.file.value = "", Ya(a, "wrong"), n.setState({ activeTab: i, file: null, fileNameElClassName: "" });
      }, n.execCommand = function() {
        n.state.activeTab === "file" ? n.emitAddImageBlob() : n.emitAddImage();
      }, n.toggleTab = function(i, a) {
        a !== n.state.activeTab && n.initialize(a);
      }, n.showFileSelectBox = function() {
        n.refs.file.click();
      }, n.changeFile = function(i) {
        var a = i.target.files;
        a?.length && n.setState({ file: a[0] });
      }, n.state = { activeTab: "file", file: null, fileNameElClassName: "" }, n.tabs = [
        { name: "file", text: "File" },
        { name: "url", text: "URL" }
      ], n;
    }
    return e.prototype.emitAddImageBlob = function() {
      var t = this, n = this.refs.file.files, i = this.refs.altText, a = " wrong";
      if (n?.length) {
        a = "";
        var s = n.item(0), u = function(f, p) {
          return t.props.execCommand("addImage", { imageUrl: f, altText: p || i.value });
        };
        this.props.eventEmitter.emit("addImageBlobHook", s, u, j6e);
      }
      this.setState({ fileNameElClassName: a });
    }, e.prototype.emitAddImage = function() {
      var t = this.refs.url, n = this.refs.altText, i = t.value, a = n.value || "image";
      if (Ya(t, "wrong"), !i.length) {
        Io(t, "wrong");
        return;
      }
      i && this.props.execCommand("addImage", { imageUrl: i, altText: a });
    }, e.prototype.preventSelectStart = function(t) {
      t.preventDefault();
    }, e.prototype.updated = function() {
      this.props.show || this.initialize();
    }, e.prototype.render = function() {
      var t = this, n = this.state, i = n.activeTab, a = n.file, s = n.fileNameElClassName;
      return vr(XC || (XC = pr([`
      <div aria-label="`, `">
        <`, " tabs=", " activeTab=", " onClick=", ` />
        <div style="display:`, `">
          <label for="toastuiImageUrlInput">`, `</label>
          <input
            id="toastuiImageUrlInput"
            type="text"
            ref=`, `
          />
        </div>
        <div style="display:`, `;position: relative;">
          <label for="toastuiImageFileInput">`, `</label>
          <span
            class="`, "", `"
            onClick=`, `
            onSelectstart=`, `
          >
            `, `
          </span>
          <button
            type="button"
            class="`, `"
            onClick=`, `
          >
            `, `
          </button>
          <input
            id="toastuiImageFileInput"
            type="file"
            accept="image/*"
            onChange=`, `
            ref=`, `
          />
        </div>
        <label for="toastuiAltTextInput">`, `</label>
        <input
          id="toastuiAltTextInput"
          type="text"
          ref=`, `
        />
        <div class="`, `">
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
        </div>
      </div>
    `], [`
      <div aria-label="`, `">
        <`, " tabs=", " activeTab=", " onClick=", ` />
        <div style="display:`, `">
          <label for="toastuiImageUrlInput">`, `</label>
          <input
            id="toastuiImageUrlInput"
            type="text"
            ref=`, `
          />
        </div>
        <div style="display:`, `;position: relative;">
          <label for="toastuiImageFileInput">`, `</label>
          <span
            class="`, "", `"
            onClick=`, `
            onSelectstart=`, `
          >
            `, `
          </span>
          <button
            type="button"
            class="`, `"
            onClick=`, `
          >
            `, `
          </button>
          <input
            id="toastuiImageFileInput"
            type="file"
            accept="image/*"
            onChange=`, `
            ref=`, `
          />
        </div>
        <label for="toastuiAltTextInput">`, `</label>
        <input
          id="toastuiAltTextInput"
          type="text"
          ref=`, `
        />
        <div class="`, `">
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
        </div>
      </div>
    `])), Xt.get("Insert image"), cM, this.tabs, i, this.toggleTab, i === "url" ? "block" : "none", Xt.get("Image URL"), function(u) {
        return t.refs.url = u;
      }, i === "file" ? "block" : "none", Xt.get("Select image file"), Mt("file-name"), a ? " has-file" : s, this.showFileSelectBox, this.preventSelectStart, a ? a.name : Xt.get("No file"), Mt("file-select-button"), this.showFileSelectBox, Xt.get("Choose a file"), this.changeFile, function(u) {
        return t.refs.file = u;
      }, Xt.get("Description"), function(u) {
        return t.refs.altText = u;
      }, Mt("button-container"), Mt("close-button"), this.props.hidePopup, Xt.get("Cancel"), Mt("ok-button"), this.execCommand, Xt.get("OK"));
    }, e;
  })(yi)
), XC, K6e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.execCommand = function() {
        var n = t.refs.url, i = t.refs.text;
        if (Ya(n, "wrong"), Ya(i, "wrong"), n.value.length < 1) {
          Io(n, "wrong");
          return;
        }
        var a = to(t.props.initialValues.linkUrl);
        if (a && i.value.length < 1) {
          Io(i, "wrong");
          return;
        }
        t.props.execCommand("addLink", {
          linkUrl: n.value,
          linkText: i.value
        });
      }, t;
    }
    return e.prototype.initialize = function() {
      var t = this.props.initialValues, n = t.linkUrl, i = t.linkText, a = this.refs.url, s = this.refs.text;
      Ya(a, "wrong"), Ya(s, "wrong", "disabled"), s.removeAttribute("disabled"), n && (Io(s, "disabled"), s.setAttribute("disabled", "disabled")), a.value = n || "", s.value = i || "";
    }, e.prototype.mounted = function() {
      this.initialize();
    }, e.prototype.updated = function(t) {
      !t.show && this.props.show && this.initialize();
    }, e.prototype.render = function() {
      var t = this;
      return vr(YC || (YC = pr([`
      <div aria-label="`, `">
        <label for="toastuiLinkUrlInput">`, `</label>
        <input
          id="toastuiLinkUrlInput"
          type="text"
          ref=`, `
        />
        <label for="toastuiLinkTextInput">`, `</label>
        <input
          id="toastuiLinkTextInput"
          type="text"
          ref=`, `
        />
        <div class="`, `">
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
        </div>
      </div>
    `], [`
      <div aria-label="`, `">
        <label for="toastuiLinkUrlInput">`, `</label>
        <input
          id="toastuiLinkUrlInput"
          type="text"
          ref=`, `
        />
        <label for="toastuiLinkTextInput">`, `</label>
        <input
          id="toastuiLinkTextInput"
          type="text"
          ref=`, `
        />
        <div class="`, `">
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
          <button type="button" class="`, '" onClick=', `>
            `, `
          </button>
        </div>
      </div>
    `])), Xt.get("Insert link"), Xt.get("URL"), function(n) {
        return t.refs.url = n;
      }, Xt.get("Link text"), function(n) {
        return t.refs.text = n;
      }, Mt("button-container"), Mt("close-button"), this.props.hidePopup, Xt.get("Cancel"), Mt("ok-button"), this.execCommand, Xt.get("OK"));
    }, e;
  })(yi)
), YC, ZC = 20, eT = 20, tT = 5, rT = 14, nT = 5, iT = 9, J6e = 1, Q6e = 1, aT = 1, X6e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.extendSelectionRange = function(i) {
        var a = i.pageX, s = i.pageY, u = a - n.offsetRect.left, f = s - n.offsetRect.top, p = n.getSelectionRangeByOffset(u, f);
        n.setState(_e({}, p));
      }, n.execCommand = function() {
        n.props.execCommand("addTable", {
          rowCount: n.state.rowIdx + 1,
          columnCount: n.state.colIdx + 1
        });
      }, n.state = {
        rowIdx: -1,
        colIdx: -1
      }, n;
    }
    return e.prototype.getDescription = function() {
      return this.state.colIdx === -1 ? "" : this.state.colIdx + 1 + " x " + (this.state.rowIdx + 1);
    }, e.prototype.getBoundByRange = function(t, n) {
      return {
        width: (t + 1) * ZC,
        height: (n + 1) * eT
      };
    }, e.prototype.getRangeByOffset = function(t, n) {
      return {
        colIdx: Math.floor(t / ZC),
        rowIdx: Math.floor(n / eT)
      };
    }, e.prototype.getTableRange = function() {
      var t = this.state, n = t.colIdx, i = t.rowIdx, a = Math.max(n, nT), s = Math.max(i, tT);
      return n >= nT && a < iT && (a += 1), i >= tT && s < rT && (s += 1), { colIdx: a + 1, rowIdx: s + 1 };
    }, e.prototype.getSelectionAreaBound = function() {
      var t = this.getBoundByRange(this.state.colIdx, this.state.rowIdx), n = t.width, i = t.height;
      return !n && !i ? { display: "none" } : { width: n - aT, height: i - aT, display: "block" };
    }, e.prototype.getSelectionRangeByOffset = function(t, n) {
      var i = this.getRangeByOffset(t, n);
      return i.rowIdx = Math.min(Math.max(i.rowIdx, J6e), rT), i.colIdx = Math.min(Math.max(i.colIdx, Q6e), iT), i;
    }, e.prototype.updated = function() {
      if (!this.props.show)
        this.setState({ colIdx: -1, rowIdx: -1 });
      else if (this.state.colIdx === -1 && this.state.rowIdx === -1) {
        var t = this.refs.tableEl.getBoundingClientRect(), n = t.left, i = t.top;
        this.offsetRect = {
          left: window.pageXOffset + n,
          top: window.pageYOffset + i
        };
      }
    }, e.prototype.createTableArea = function(t) {
      for (var n = t.colIdx, i = t.rowIdx, a = [], s = 0; s < i; s += 1) {
        for (var u = [], f = 0; f < n; f += 1) {
          var p = "" + Mt("table-cell") + (s > 0 ? "" : " header");
          u.push(vr(oT || (oT = pr(['<div class="', '"></div>'], ['<div class="', '"></div>'])), p));
        }
        a.push(vr(sT || (sT = pr(['<div class="', '">', "</div>"], ['<div class="', '">', "</div>"])), Mt("table-row"), u));
      }
      return vr(lT || (lT = pr(['<div class="', '">', "</div>"], ['<div class="', '">', "</div>"])), Mt("table"), a);
    }, e.prototype.render = function() {
      var t = this, n = this.getTableRange(), i = this.getSelectionAreaBound();
      return vr(uT || (uT = pr([`
      <div aria-label="`, `">
        <div
          class="`, `"
          ref=`, `
          onMousemove=`, `
          onClick=`, `
        >
          `, `
          <div class="`, '" style=', `></div>
        </div>
        <p class="`, '">', `</p>
      </div>
    `], [`
      <div aria-label="`, `">
        <div
          class="`, `"
          ref=`, `
          onMousemove=`, `
          onClick=`, `
        >
          `, `
          <div class="`, '" style=', `></div>
        </div>
        <p class="`, '">', `</p>
      </div>
    `])), Xt.get("Insert table"), Mt("table-selection"), function(a) {
        return t.refs.tableEl = a;
      }, this.extendSelectionRange, this.execCommand, this.createTableArea(n), Mt("table-selection-layer"), i, Mt("table-description"), this.getDescription());
    }, e;
  })(yi)
), oT, sT, lT, uT, Y6e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return e.prototype.mounted = function() {
      this.refs.el.appendChild(this.props.body);
    }, e.prototype.updated = function(t) {
      this.refs.el.replaceChild(this.props.body, t.body);
    }, e.prototype.render = function() {
      var t = this;
      return vr(cT || (cT = pr(["<div ref=", "></div>"], ["<div ref=", "></div>"])), function(n) {
        return t.refs.el = n;
      });
    }, e;
  })(yi)
), cT;
function H0(r) {
  return Ms(r) ? e9e(r) : r;
}
function Z6e() {
  var r = document.createElement("label"), e = document.createElement("input"), t = document.createElement("span");
  r.className = "scroll-sync active", e.type = "checkbox", e.checked = !0, t.className = "switch";
  var n = function(i) {
    return e.addEventListener("change", function(a) {
      var s = a.target.checked;
      s ? Io(r, "active") : Ya(r, "active"), i("toggleScrollSync", { active: s });
    });
  };
  return r.appendChild(e), r.appendChild(t), {
    name: "scrollSync",
    el: r,
    onMounted: n
  };
}
function e9e(r) {
  var e;
  switch (r) {
    case "heading":
      e = {
        name: "heading",
        className: "heading",
        tooltip: Xt.get("Headings"),
        state: "heading"
      };
      break;
    case "bold":
      e = {
        name: "bold",
        className: "bold",
        command: "bold",
        tooltip: Xt.get("Bold"),
        state: "strong"
      };
      break;
    case "italic":
      e = {
        name: "italic",
        className: "italic",
        command: "italic",
        tooltip: Xt.get("Italic"),
        state: "emph"
      };
      break;
    case "strike":
      e = {
        name: "strike",
        className: "strike",
        command: "strike",
        tooltip: Xt.get("Strike"),
        state: "strike"
      };
      break;
    case "hr":
      e = {
        name: "hr",
        className: "hrline",
        command: "hr",
        tooltip: Xt.get("Line"),
        state: "thematicBreak"
      };
      break;
    case "quote":
      e = {
        name: "quote",
        className: "quote",
        command: "blockQuote",
        tooltip: Xt.get("Blockquote"),
        state: "blockQuote"
      };
      break;
    case "ul":
      e = {
        name: "ul",
        className: "bullet-list",
        command: "bulletList",
        tooltip: Xt.get("Unordered list"),
        state: "bulletList"
      };
      break;
    case "ol":
      e = {
        name: "ol",
        className: "ordered-list",
        command: "orderedList",
        tooltip: Xt.get("Ordered list"),
        state: "orderedList"
      };
      break;
    case "task":
      e = {
        name: "task",
        className: "task-list",
        command: "taskList",
        tooltip: Xt.get("Task"),
        state: "taskList"
      };
      break;
    case "table":
      e = {
        name: "table",
        className: "table",
        tooltip: Xt.get("Insert table"),
        state: "table"
      };
      break;
    case "image":
      e = {
        name: "image",
        className: "image",
        tooltip: Xt.get("Insert image")
      };
      break;
    case "link":
      e = {
        name: "link",
        className: "link",
        tooltip: Xt.get("Insert link")
      };
      break;
    case "code":
      e = {
        name: "code",
        className: "code",
        command: "code",
        tooltip: Xt.get("Code"),
        state: "code"
      };
      break;
    case "codeblock":
      e = {
        name: "codeblock",
        className: "codeblock",
        command: "codeBlock",
        tooltip: Xt.get("Insert CodeBlock"),
        state: "codeBlock"
      };
      break;
    case "indent":
      e = {
        name: "indent",
        className: "indent",
        command: "indent",
        tooltip: Xt.get("Indent"),
        state: "indent"
      };
      break;
    case "outdent":
      e = {
        name: "outdent",
        className: "outdent",
        command: "outdent",
        tooltip: Xt.get("Outdent"),
        state: "outdent"
      };
      break;
    case "scrollSync":
      e = Z6e();
      break;
    case "more":
      e = {
        name: "more",
        className: "more",
        tooltip: Xt.get("More")
      };
      break;
  }
  return e.name !== "scrollSync" && (e.className += " " + Mt("toolbar-icons")), e;
}
function Fk(r, e) {
  var t = e.el, n = e.pos, i = e.popup, a = e.initialValues;
  switch (r) {
    case "heading":
      return {
        render: function(s) {
          return vr(fT || (fT = pr(["<", " ...", " />"], ["<", " ...", " />"])), W6e, s);
        },
        className: Mt("popup-add-heading"),
        fromEl: t,
        pos: n
      };
    case "link":
      return {
        render: function(s) {
          return vr(dT || (dT = pr(["<", " ...", " />"], ["<", " ...", " />"])), K6e, s);
        },
        className: Mt("popup-add-link"),
        fromEl: t,
        pos: n,
        initialValues: a
      };
    case "image":
      return {
        render: function(s) {
          return vr(hT || (hT = pr(["<", " ...", " />"], ["<", " ...", " />"])), G6e, s);
        },
        className: Mt("popup-add-image"),
        fromEl: t,
        pos: n
      };
    case "table":
      return {
        render: function(s) {
          return vr(pT || (pT = pr(["<", " ...", " />"], ["<", " ...", " />"])), X6e, s);
        },
        className: Mt("popup-add-table"),
        fromEl: t,
        pos: n
      };
    case "customPopupBody":
      return i ? _e({ render: function(s) {
        return vr(vT || (vT = pr(["<", " ...", " body=", " />"], ["<", " ...", " body=", " />"])), Y6e, s, i.body);
      }, fromEl: t, pos: n }, i) : null;
    default:
      return null;
  }
}
function Tm(r) {
  r.hidden = r.length === r.filter(function(e) {
    return e.hidden;
  }).length;
}
function t9e(r, e) {
  var t = function(n) {
    return n.hidden = n.name === "scrollSync" && e, n;
  };
  return r.reduce(function(n, i) {
    n.push(i.map(function(s) {
      return t(H0(s));
    }));
    var a = n[(n.length || 1) - 1];
    return a && Tm(a), n;
  }, []);
}
function r9e(r, e) {
  r.forEach(function(t) {
    t.forEach(function(n) {
      return n.hidden = n.name === "scrollSync" && e;
    }), Tm(t);
  });
}
var fT, dT, hT, pT, vT, n9e = 20, i9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.handleMousedown = function(n) {
        !Po(n.target, "." + Mt("popup")) && !Po(n.target, t.props.info.fromEl) && t.props.hidePopup();
      }, t;
    }
    return e.prototype.mounted = function() {
      document.addEventListener("mousedown", this.handleMousedown), this.props.eventEmitter.listen("closePopup", this.props.hidePopup);
    }, e.prototype.beforeDestroy = function() {
      document.removeEventListener("mousedown", this.handleMousedown);
    }, e.prototype.updated = function(t) {
      var n = this.props, i = n.show, a = n.info;
      if (i && a.pos && t.show !== i) {
        var s = _e({}, a.pos), u = this.refs.el.offsetWidth, f = Po(this.refs.el, "." + Mt("toolbar")), p = f.offsetWidth;
        s.left + u >= p && (s.left = p - u - n9e), ck(this.state.popupPos, s) || this.setState({ popupPos: s });
      }
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.info, a = n.show, s = n.hidePopup, u = n.eventEmitter, f = n.execCommand, p = i || {}, y = p.className, T = y === void 0 ? "" : y, N = p.style, O = p.render, A = p.initialValues, q = A === void 0 ? {} : A, U = _e(_e({ display: a ? "block" : "none" }, N), this.state.popupPos);
      return vr(mT || (mT = pr([`
      <div
        class="`, " ", `"
        style=`, `
        ref=`, `
        aria-role="dialog"
      >
        <div class="`, `">
          `, `
        </div>
      </div>
    `], [`
      <div
        class="`, " ", `"
        style=`, `
        ref=`, `
        aria-role="dialog"
      >
        <div class="`, `">
          `, `
        </div>
      </div>
    `])), Mt("popup"), T, U, function(j) {
        return t.refs.el = j;
      }, Mt("popup-body"), O && O({ eventEmitter: u, show: a, hidePopup: s, execCommand: f, initialValues: q }));
    }, e;
  })(yi)
), mT, gT = 6;
function _k(r) {
  return (
    /** @class */
    (function(e) {
      bt(t, e);
      function t(n) {
        var i = e.call(this, n) || this;
        return i.showTooltip = function(a) {
          var s = i.props.item.tooltip;
          if (!i.props.disabled && s) {
            var u = i.getBound(a), f = u.left + gT + "px", p = u.top + gT + "px";
            _o(i.props.tooltipRef.current, { display: "block", left: f, top: p }), i.props.tooltipRef.current.querySelector(".text").textContent = s;
          }
        }, i.hideTooltip = function() {
          _o(i.props.tooltipRef.current, "display", "none");
        }, i.state = { active: !1, disabled: n.disabled }, i.addEvent(), i;
      }
      return t.prototype.addEvent = function() {
        var n = this, i = this.props, a = i.item, s = i.eventEmitter;
        a.state && s.listen("changeToolbarState", function(u) {
          var f, p = u.toolbarState, y = (f = p[a.state]) !== null && f !== void 0 ? f : {}, T = y.active, N = y.disabled;
          n.setState({ active: !!T, disabled: N ?? n.props.disabled });
        });
      }, t.prototype.getBound = function(n) {
        var i = Dx(n, Po(n, "." + Mt("toolbar"))), a = i.offsetLeft, s = i.offsetTop;
        return { left: a, top: n.offsetHeight + s };
      }, t.prototype.render = function() {
        return vr(yT || (yT = pr([`
        <`, `
          ...`, `
          active=`, `
          showTooltip=`, `
          hideTooltip=`, `
          getBound=`, `
          disabled=`, `
        />
      `], [`
        <`, `
          ...`, `
          active=`, `
          showTooltip=`, `
          hideTooltip=`, `
          getBound=`, `
          disabled=`, `
        />
      `])), r, this.props, this.state.active, this.showTooltip, this.hideTooltip, this.getBound, this.state.disabled || this.props.disabled);
      }, t;
    })(yi)
  );
}
var yT, a9e = 80, o9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.showTooltip = function() {
        t.props.showTooltip(t.refs.el);
      }, t.execCommand = function() {
        var n = t.props, i = n.item, a = n.execCommand, s = n.setPopupInfo, u = n.getBound, f = n.eventEmitter, p = i.command, y = i.name, T = i.popup;
        if (p)
          a(p);
        else {
          var N = T ? "customPopupBody" : y, O = f.emit("query", "getPopupInitialValues", { popupName: N })[0], A = Fk(N, {
            el: t.refs.el,
            pos: u(t.refs.el),
            popup: T,
            initialValues: O
          });
          A && s(A);
        }
      }, t;
    }
    return e.prototype.mounted = function() {
      this.setItemWidth();
    }, e.prototype.updated = function(t) {
      t.item.name !== this.props.item.name && this.setItemWidth();
    }, e.prototype.setItemWidth = function() {
      var t = this.props, n = t.setItemWidth, i = t.item;
      n && n(i.name, kk(this.refs.el) + (i.hidden ? a9e : 0));
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.hideTooltip, a = n.disabled, s = n.item, u = n.active, f = _e({ display: s.hidden ? "none" : null }, s.style), p = "" + (s.className || "") + (u ? " active" : "");
      return vr(kT || (kT = pr([`
      <button
        ref=`, `
        type="button"
        style=`, `
        class=`, `
        onClick=`, `
        onMouseover=`, `
        onMouseout=`, `
        disabled=`, `
        aria-label=`, `
      >
        `, `
      </button>
    `], [`
      <button
        ref=`, `
        type="button"
        style=`, `
        class=`, `
        onClick=`, `
        onMouseover=`, `
        onMouseout=`, `
        disabled=`, `
        aria-label=`, `
      >
        `, `
      </button>
    `])), function(y) {
        return t.refs.el = y;
      }, f, p, this.execCommand, this.showTooltip, i, !!a, s.text || s.tooltip || "", s.text || "");
    }, e;
  })(yi)
), s9e = _k(o9e), kT, l9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.showTooltip = function() {
        t.props.showTooltip(t.refs.el);
      }, t.showPopup = function() {
        var n = Fk("customPopupBody", {
          el: t.refs.el,
          pos: t.props.getBound(t.refs.el),
          popup: t.props.item.popup
        });
        n && t.props.setPopupInfo(n);
      }, t;
    }
    return e.prototype.mounted = function() {
      var t = this.props, n = t.setItemWidth, i = t.item;
      this.refs.el.appendChild(i.el), n && n(i.name, kk(this.refs.el)), i.onMounted && i.onMounted(this.props.execCommand);
    }, e.prototype.updated = function(t) {
      var n, i = this.props, a = i.item, s = i.active, u = i.disabled;
      (t.active !== s || t.disabled !== u) && ((n = a.onUpdated) === null || n === void 0 || n.call(a, { active: s, disabled: u }));
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.disabled, a = n.item, s = { display: a.hidden ? "none" : "inline-block" }, u = function(f) {
        return i ? null : f;
      };
      return vr(wT || (wT = pr([`
      <div
        ref=`, `
        style=`, `
        class=`, `
        onClick=`, `
        onMouseover=`, `
        onMouseout=`, `
      ></div>
    `], [`
      <div
        ref=`, `
        style=`, `
        class=`, `
        onClick=`, `
        onMouseover=`, `
        onMouseout=`, `
      ></div>
    `])), function(f) {
        return t.refs.el = f;
      }, s, Mt("toolbar-item-wrapper"), u(this.showPopup), u(this.showTooltip), u(this.props.hideTooltip));
    }, e;
  })(yi)
), u9e = _k(l9e), wT, fM = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return e.prototype.render = function() {
      var t = this, n = this.props, i = n.group, a = n.hiddenDivider, s = i.hidden ? { display: "none" } : null, u = a ? { display: "none" } : null;
      return vr(CT || (CT = pr([`
      <div class="`, '" style=', `>
        `, `
        <div class="`, '" style=', `></div>
      </div>
    `], [
        `
      <div class="`,
        '" style=',
        `>
        `,
        `
        <div class="`,
        '" style=',
        `></div>
      </div>
    `
      ])), Mt("toolbar-group"), s, i.map(function(f) {
        var p = f.el ? u9e : s9e;
        return vr(bT || (bT = pr(["<", " key=", " ...", " item=", " />"], ["<", " key=", " ...", " item=", " />"])), p, f.name, t.props, f);
      }), Mt("toolbar-divider"), u);
    }, e;
  })(yi)
), bT, CT, c9e = 4, f9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.handleClickDocument = function(i) {
        var a = i.target;
        !Po(a, "." + Mt("dropdown-toolbar")) && !Po(a, ".more") && n.setState({ showDropdown: !1, dropdownPos: null });
      }, n.showTooltip = function() {
        n.props.showTooltip(n.refs.el);
      }, n.state = { showDropdown: !1, dropdownPos: null }, n;
    }
    return e.prototype.getBound = function() {
      var t = this.props.getBound(this.refs.el);
      return t.top += c9e, _e(_e({}, t), { left: null, right: 10 });
    }, e.prototype.mounted = function() {
      document.addEventListener("click", this.handleClickDocument);
    }, e.prototype.updated = function() {
      this.state.showDropdown && !this.state.dropdownPos && this.setState({ dropdownPos: this.getBound() });
    }, e.prototype.beforeDestroy = function() {
      document.removeEventListener("click", this.handleClickDocument);
    }, e.prototype.render = function() {
      var t = this, n = this.state, i = n.showDropdown, a = n.dropdownPos, s = this.props, u = s.disabled, f = s.item, p = s.items, y = s.hideTooltip, T = p.filter(function(A) {
        return !A.hidden;
      }), N = T.length ? null : { display: "none" }, O = i ? null : { display: "none" };
      return vr(ST || (ST = pr([`
      <div class="`, '" style=', `>
        <button
          ref=`, `
          type="button"
          class=`, `
          onClick=`, `
          onMouseover=`, `
          onMouseout=`, `
          disabled=`, `
        ></button>
        <div
          class="`, `"
          style=`, `
          ref=`, `
        >
          `, `
        </div>
      </div>
    `], [
        `
      <div class="`,
        '" style=',
        `>
        <button
          ref=`,
        `
          type="button"
          class=`,
        `
          onClick=`,
        `
          onMouseover=`,
        `
          onMouseout=`,
        `
          disabled=`,
        `
        ></button>
        <div
          class="`,
        `"
          style=`,
        `
          ref=`,
        `
        >
          `,
        `
        </div>
      </div>
    `
      ])), Mt("toolbar-group"), N, function(A) {
        return t.refs.el = A;
      }, f.className, function() {
        return t.setState({ showDropdown: !0 });
      }, this.showTooltip, y, u, Mt("dropdown-toolbar"), _e(_e({}, O), a), function(A) {
        return t.refs.dropdownEl = A;
      }, T.length ? T.map(function(A, q) {
        var U;
        return vr(TT || (TT = pr([`
                  <`, `
                    group=`, `
                    hiddenDivider=`, `
                    ...`, `
                  />
                `], [
          `
                  <`,
          `
                    group=`,
          `
                    hiddenDivider=`,
          `
                    ...`,
          `
                  />
                `
        ])), fM, A, q === T.length - 1 || ((U = T[q + 1]) === null || U === void 0 ? void 0 : U.hidden), t.props);
      }) : null);
    }, e;
  })(yi)
), d9e = _k(f9e), TT, ST, h9e = 50, p9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.toggleTab = function(i, a) {
        var s = n.props.eventEmitter;
        if (n.state.activeTab !== a) {
          var u = a === "write" ? "changePreviewTabWrite" : "changePreviewTabPreview";
          s.emit(u), n.setState({ activeTab: a });
        }
      }, n.setItemWidth = function(i, a) {
        n.itemWidthMap[i] = a;
      }, n.setPopupInfo = function(i) {
        n.setState({ showPopup: !0, popupInfo: i });
      }, n.openPopup = function(i, a) {
        a === void 0 && (a = {});
        var s = n.refs.el.querySelector("." + Mt("toolbar-group") + " ." + i);
        if (s) {
          var u = Dx(s, Po(s, "." + Mt("toolbar"))), f = u.offsetLeft, p = u.offsetTop, y = Fk(i, {
            el: s,
            pos: { left: f, top: s.offsetHeight + p },
            initialValues: a
          });
          y && n.setPopupInfo(y);
        }
      }, n.hidePopup = function() {
        n.state.showPopup && n.setState({ showPopup: !1 });
      }, n.execCommand = function(i, a) {
        var s = n.props.eventEmitter;
        s.emit("command", i, a), n.hidePopup();
      }, n.tabs = [
        { name: "write", text: "Write" },
        { name: "preview", text: "Preview" }
      ], n.itemWidthMap = {}, n.initialItems = t9e(t.toolbarItems || [], n.hiddenScrollSync()), n.state = {
        items: n.initialItems,
        dropdownItems: [],
        showPopup: !1,
        popupInfo: {},
        activeTab: "write"
      }, n.tooltipRef = { current: null }, n.resizeObserver = new $6e(function() {
        return n.handleResize();
      }), n.addEvent(), n;
    }
    return e.prototype.insertToolbarItem = function(t, n) {
      var i = t.groupIndex, a = t.itemIndex, s = this.initialItems[i];
      n = H0(n), s ? s.splice(a, 0, n) : this.initialItems.push([n]), this.setState(this.classifyToolbarItems());
    }, e.prototype.removeToolbarItem = function(t) {
      var n = this;
      uf(this.initialItems, function(i) {
        var a = !1;
        return uf(i, function(s, u) {
          return s.name === t ? (a = !0, i.splice(u, 1), n.setState(n.classifyToolbarItems()), !1) : !0;
        }), !a;
      });
    }, e.prototype.addEvent = function() {
      var t = this, n = this.props.eventEmitter;
      this.handleResize = E6e(function() {
        t.setState({ items: t.initialItems, dropdownItems: [] }), t.setState(t.classifyToolbarItems());
      }, 200), n.listen("openPopup", this.openPopup);
    }, e.prototype.appendTooltipToRoot = function() {
      var t = '<div class="' + Mt("tooltip") + `" style="display:none">
        <div class="arrow"></div>
        <span class="text"></span>
      </div>`;
      this.tooltipRef.current = Ox(t, this.refs.el);
    }, e.prototype.hiddenScrollSync = function() {
      return this.props.editorType === "wysiwyg" || this.props.previewStyle === "tab";
    }, e.prototype.movePrevItemToDropdownToolbar = function(t, n, i, a) {
      var s = function(f) {
        var p = f.pop();
        p && a.push(p);
      };
      if (t > 1)
        s(i);
      else {
        var u = vi(n);
        u && s(u);
      }
    }, e.prototype.classifyToolbarItems = function() {
      var t = this, n = 0, i = this.refs.el.clientWidth, a = this.refs.el.querySelector("." + Mt("toolbar-divider")), s = a ? kk(a) : 0, u = [], f = [], p = !1;
      return this.initialItems.forEach(function(y, T) {
        var N = [], O = [];
        y.forEach(function(A, q) {
          A.hidden || (n += t.itemWidthMap[A.name], n > i - h9e ? (p || (t.movePrevItemToDropdownToolbar(q, u, N, O), p = !0), O.push(A)) : N.push(A));
        }), N.length && (Tm(N), u.push(N)), O.length && (Tm(O), f.push(O)), T < t.state.items.length - 1 && (n += s);
      }), { items: u, dropdownItems: f };
    }, e.prototype.mounted = function() {
      this.props.previewStyle === "tab" && this.props.eventEmitter.emit("changePreviewTabWrite", !0), this.setState(this.classifyToolbarItems()), this.appendTooltipToRoot(), this.resizeObserver.observe(this.refs.el);
    }, e.prototype.updated = function(t) {
      var n = this.props, i = n.editorType, a = n.previewStyle, s = n.eventEmitter, u = a !== t.previewStyle, f = i !== t.editorType;
      if (u || f) {
        r9e(this.initialItems, this.hiddenScrollSync());
        var p = this.classifyToolbarItems();
        (u || a === "tab" && i === "markdown") && (s.emit("changePreviewTabWrite"), p.activeTab = "write"), this.setState(p);
      }
    }, e.prototype.beforeDestroy = function() {
      window.removeEventListener("resize", this.handleResize), this.resizeObserver.disconnect(), Ou(this.tooltipRef.current);
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.previewStyle, a = n.eventEmitter, s = n.editorType, u = this.state, f = u.popupInfo, p = u.showPopup, y = u.activeTab, T = u.items, N = u.dropdownItems, O = {
        eventEmitter: a,
        tooltipRef: this.tooltipRef,
        disabled: s === "markdown" && i === "tab" && y === "preview",
        execCommand: this.execCommand,
        setPopupInfo: this.setPopupInfo
      }, A = i === "tab" ? { borderTopLeftRadius: 0 } : null;
      return vr(ET || (ET = pr([`
      <div class="`, `">
        <div
          class="`, `"
          style="display: `, `"
        >
          <`, " tabs=", " activeTab=", " onClick=", ` />
        </div>
        <div
          class="`, `"
          ref=`, `
          style=`, `
        >
          `, `
          <`, `
            item=`, `
            items=`, `
            ...`, `
          />
        </div>
        <`, `
          info=`, `
          show=`, `
          eventEmitter=`, `
          hidePopup=`, `
          execCommand=`, `
        />
      </div>
    `], [
        `
      <div class="`,
        `">
        <div
          class="`,
        `"
          style="display: `,
        `"
        >
          <`,
        " tabs=",
        " activeTab=",
        " onClick=",
        ` />
        </div>
        <div
          class="`,
        `"
          ref=`,
        `
          style=`,
        `
        >
          `,
        `
          <`,
        `
            item=`,
        `
            items=`,
        `
            ...`,
        `
          />
        </div>
        <`,
        `
          info=`,
        `
          show=`,
        `
          eventEmitter=`,
        `
          hidePopup=`,
        `
          execCommand=`,
        `
        />
      </div>
    `
      ])), Mt("toolbar"), Mt("md-tab-container"), s === "wysiwyg" || i === "vertical" ? "none" : "block", cM, this.tabs, y, this.toggleTab, Mt("defaultUI-toolbar"), function(q) {
        return t.refs.el = q;
      }, A, T.map(function(q, U) {
        var j;
        return vr(xT || (xT = pr([`
              <`, `
                group=`, `
                hiddenDivider=`, `
                setItemWidth=`, `
                ...`, `
              />
            `], [`
              <`, `
                group=`, `
                hiddenDivider=`, `
                setItemWidth=`, `
                ...`, `
              />
            `])), fM, q, U === T.length - 1 || ((j = T[U + 1]) === null || j === void 0 ? void 0 : j.hidden), t.setItemWidth, O);
      }), d9e, H0("more"), N, O, i9e, f, p, a, this.hidePopup, this.execCommand);
    }, e;
  })(yi)
), xT, ET, v9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.handleClickDocument = function(i) {
        Po(i.target, "." + Mt("context-menu")) || n.setState({ pos: null });
      }, n.state = {
        pos: null,
        menuGroups: []
      }, n.addEvent(), n;
    }
    return e.prototype.addEvent = function() {
      var t = this;
      this.props.eventEmitter.listen("contextmenu", function(n) {
        var i = n.pos, a = n.menuGroups;
        t.setState({ pos: i, menuGroups: a });
      });
    }, e.prototype.mounted = function() {
      document.addEventListener("click", this.handleClickDocument);
    }, e.prototype.beforeDestroy = function() {
      document.removeEventListener("click", this.handleClickDocument);
    }, e.prototype.getMenuGroupElements = function() {
      var t = this, n = this.state, i = n.pos, a = n.menuGroups;
      return i ? a.reduce(function(s, u) {
        var f = [];
        return u.forEach(function(p) {
          var y = p.label, T = p.className, N = T === void 0 ? !1 : T, O = p.disabled, A = p.onClick, q = function() {
            O || (A(), t.setState({ pos: null }));
          };
          f.push(vr(MT || (MT = pr([`
                <li
                  onClick=`, `
                  class="menu-item`, `"
                  aria-role="menuitem"
                >
                  <span class="`, '">', `</span>
                </li>
              `], [`
                <li
                  onClick=`, `
                  class="menu-item`, `"
                  aria-role="menuitem"
                >
                  <span class="`, '">', `</span>
                </li>
              `])), q, O ? " disabled" : "", N, y));
        }), s.push(vr(NT || (NT = pr([`<ul class="menu-group">
              `, `
            </ul>`], [`<ul class="menu-group">
              `, `
            </ul>`])), f)), s;
      }, []) : [];
    }, e.prototype.render = function() {
      var t = _e({ display: this.state.pos ? "block" : "none" }, this.state.pos);
      return vr(OT || (OT = pr(['<div class="', '" style=', ` aria-role="menu">
      `, `
    </div>`], ['<div class="', '" style=', ` aria-role="menu">
      `, `
    </div>`])), Mt("context-menu"), t, this.getMenuGroupElements());
    }, e;
  })(yi)
), MT, NT, OT, m9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      n.changeMode = function(s) {
        s !== n.state.editorType && n.setState({ editorType: s });
      }, n.changePreviewStyle = function(s) {
        s !== n.state.previewStyle && n.setState({ previewStyle: s });
      }, n.hide = function() {
        n.setState({ hide: !0 });
      }, n.show = function() {
        n.setState({ hide: !1 });
      };
      var i = t.editorType, a = t.previewStyle;
      return n.state = {
        editorType: i,
        previewStyle: a,
        hide: !1
      }, n.addEvent(), n;
    }
    return e.prototype.mounted = function() {
      var t = this.props.slots, n = t.wwEditor, i = t.mdEditor, a = t.mdPreview;
      this.refs.wwContainer.appendChild(n), this.refs.mdContainer.insertAdjacentElement("afterbegin", i), this.refs.mdContainer.appendChild(a);
    }, e.prototype.insertToolbarItem = function(t, n) {
      this.toolbar.insertToolbarItem(t, n);
    }, e.prototype.removeToolbarItem = function(t) {
      this.toolbar.removeToolbarItem(t);
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.eventEmitter, a = n.hideModeSwitch, s = n.toolbarItems, u = n.theme, f = this.state, p = f.hide, y = f.previewStyle, T = f.editorType, N = p ? " hidden" : "", O = Mt(T === "markdown" ? "md-mode" : "ww-mode"), A = Mt("md") + "-" + y + "-style", q = Mt([u !== "light", u + " "]);
      return vr(AT || (AT = pr([`
      <div
        class="`, "", "", `"
        ref=`, `
      >
        <`, `
          ref=`, `
          eventEmitter=`, `
          previewStyle=`, `
          toolbarItems=`, `
          editorType=`, `
        />
        <div
          class="`, " ", `"
          ref=`, `
        >
          <div class="`, `">
            <div
              class="`, " ", `"
              ref=`, `
            >
              <div class="`, `"></div>
            </div>
            <div
              class="`, `"
              ref=`, `
            />
          </div>
        </div>
        `, `
        <`, " eventEmitter=", ` />
      </div>
    `], [
        `
      <div
        class="`,
        "",
        "",
        `"
        ref=`,
        `
      >
        <`,
        `
          ref=`,
        `
          eventEmitter=`,
        `
          previewStyle=`,
        `
          toolbarItems=`,
        `
          editorType=`,
        `
        />
        <div
          class="`,
        " ",
        `"
          ref=`,
        `
        >
          <div class="`,
        `">
            <div
              class="`,
        " ",
        `"
              ref=`,
        `
            >
              <div class="`,
        `"></div>
            </div>
            <div
              class="`,
        `"
              ref=`,
        `
            />
          </div>
        </div>
        `,
        `
        <`,
        " eventEmitter=",
        ` />
      </div>
    `
      ])), q, Mt("defaultUI"), N, function(U) {
        return t.refs.el = U;
      }, p9e, function(U) {
        return t.toolbar = U;
      }, i, y, s, T, Mt("main"), O, function(U) {
        return t.refs.editorSection = U;
      }, Mt("main-container"), Mt("md-container"), A, function(U) {
        return t.refs.mdContainer = U;
      }, Mt("md-splitter"), Mt("ww-container"), function(U) {
        return t.refs.wwContainer = U;
      }, !a && vr(DT || (DT = pr(["<", " eventEmitter=", " editorType=", " />"], ["<", " eventEmitter=", " editorType=", " />"])), b6e, i, T), v9e, i);
    }, e.prototype.addEvent = function() {
      var t = this.props.eventEmitter;
      t.listen("hide", this.hide), t.listen("show", this.show), t.listen("changeMode", this.changeMode), t.listen("changePreviewStyle", this.changePreviewStyle);
    }, e;
  })(yi)
), DT, AT, g9e = (
  /** @class */
  (function(r) {
    bt(e, r);
    function e(t) {
      var n, i = r.call(this, t) || this, a, s = w6e(i.options.el, vr(LT || (LT = pr([`
        <`, `
          ref=`, `
          eventEmitter=`, `
          slots=`, `
          hideModeSwitch=`, `
          toolbarItems=`, `
          previewStyle=`, `
          editorType=`, `
          theme=`, `
        />
      `], [`
        <`, `
          ref=`, `
          eventEmitter=`, `
          slots=`, `
          hideModeSwitch=`, `
          toolbarItems=`, `
          previewStyle=`, `
          editorType=`, `
          theme=`, `
        />
      `])), m9e, function(u) {
        return a = u;
      }, i.eventEmitter, i.getEditorElements(), i.options.hideModeSwitch, i.options.toolbarItems, i.options.previewStyle, i.options.initialEditType, i.options.theme));
      return i.setMinHeight(i.options.minHeight), i.setHeight(i.options.height), i.defaultUI = {
        insertToolbarItem: a.insertToolbarItem.bind(a),
        removeToolbarItem: a.removeToolbarItem.bind(a),
        destroy: s
      }, (n = i.pluginInfo.toolbarItems) === null || n === void 0 || n.forEach(function(u) {
        var f = u.groupIndex, p = u.itemIndex, y = u.item;
        i.defaultUI.insertToolbarItem({ groupIndex: f, itemIndex: p }, y);
      }), i.eventEmitter.emit("loadUI", i), i;
    }
    return e.factory = function(t) {
      return t.viewer ? new ZE(t) : new e(t);
    }, e.prototype.insertToolbarItem = function(t, n) {
      this.defaultUI.insertToolbarItem(t, n);
    }, e.prototype.removeToolbarItem = function(t) {
      this.defaultUI.removeToolbarItem(t);
    }, e.prototype.destroy = function() {
      r.prototype.destroy.call(this), this.defaultUI.destroy();
    }, e;
  })(tM)
), LT;
tM.setLanguage(["en", "en-US"], {
  Markdown: "Markdown",
  WYSIWYG: "WYSIWYG",
  Write: "Write",
  Preview: "Preview",
  Headings: "Headings",
  Paragraph: "Paragraph",
  Bold: "Bold",
  Italic: "Italic",
  Strike: "Strike",
  Code: "Inline code",
  Line: "Line",
  Blockquote: "Blockquote",
  "Unordered list": "Unordered list",
  "Ordered list": "Ordered list",
  Task: "Task",
  Indent: "Indent",
  Outdent: "Outdent",
  "Insert link": "Insert link",
  "Insert CodeBlock": "Insert codeBlock",
  "Insert table": "Insert table",
  "Insert image": "Insert image",
  Heading: "Heading",
  "Image URL": "Image URL",
  "Select image file": "Select image file",
  "Choose a file": "Choose a file",
  "No file": "No file",
  Description: "Description",
  OK: "OK",
  More: "More",
  Cancel: "Cancel",
  File: "File",
  URL: "URL",
  "Link text": "Link text",
  "Add row to up": "Add row to up",
  "Add row to down": "Add row to down",
  "Add column to left": "Add column to left",
  "Add column to right": "Add column to right",
  "Remove row": "Remove row",
  "Remove column": "Remove column",
  "Align column to left": "Align column to left",
  "Align column to center": "Align column to center",
  "Align column to right": "Align column to right",
  "Remove table": "Remove table",
  "Would you like to paste as table?": "Would you like to paste as table?",
  "Text color": "Text color",
  "Auto scroll enabled": "Auto scroll enabled",
  "Auto scroll disabled": "Auto scroll disabled",
  "Choose language": "Choose language"
});
var Xy = { exports: {} }, $i = {}, Qa = {}, Oi = {}, Yy, RT;
function y9e() {
  if (RT) return Yy;
  RT = 1;
  function r(e) {
    this.content = e;
  }
  return r.prototype = {
    constructor: r,
    find: function(e) {
      for (var t = 0; t < this.content.length; t += 2)
        if (this.content[t] === e) return t;
      return -1;
    },
    // :: (string) → ?any
    // Retrieve the value stored under `key`, or return undefined when
    // no such key exists.
    get: function(e) {
      var t = this.find(e);
      return t == -1 ? void 0 : this.content[t + 1];
    },
    // :: (string, any, ?string) → OrderedMap
    // Create a new map by replacing the value of `key` with a new
    // value, or adding a binding to the end of the map. If `newKey` is
    // given, the key of the binding will be replaced with that key.
    update: function(e, t, n) {
      var i = n && n != e ? this.remove(n) : this, a = i.find(e), s = i.content.slice();
      return a == -1 ? s.push(n || e, t) : (s[a + 1] = t, n && (s[a] = n)), new r(s);
    },
    // :: (string) → OrderedMap
    // Return a map with the given key removed, if it existed.
    remove: function(e) {
      var t = this.find(e);
      if (t == -1) return this;
      var n = this.content.slice();
      return n.splice(t, 2), new r(n);
    },
    // :: (string, any) → OrderedMap
    // Add a new key to the start of the map.
    addToStart: function(e, t) {
      return new r([e, t].concat(this.remove(e).content));
    },
    // :: (string, any) → OrderedMap
    // Add a new key to the end of the map.
    addToEnd: function(e, t) {
      var n = this.remove(e).content.slice();
      return n.push(e, t), new r(n);
    },
    // :: (string, string, any) → OrderedMap
    // Add a key after the given key. If `place` is not found, the new
    // key is added to the end.
    addBefore: function(e, t, n) {
      var i = this.remove(t), a = i.content.slice(), s = i.find(e);
      return a.splice(s == -1 ? a.length : s, 0, t, n), new r(a);
    },
    // :: ((key: string, value: any))
    // Call the given function for each key/value pair in the map, in
    // order.
    forEach: function(e) {
      for (var t = 0; t < this.content.length; t += 2)
        e(this.content[t], this.content[t + 1]);
    },
    // :: (union<Object, OrderedMap>) → OrderedMap
    // Create a new map by prepending the keys in this map that don't
    // appear in `map` before the keys in `map`.
    prepend: function(e) {
      return e = r.from(e), e.size ? new r(e.content.concat(this.subtract(e).content)) : this;
    },
    // :: (union<Object, OrderedMap>) → OrderedMap
    // Create a new map by appending the keys in this map that don't
    // appear in `map` after the keys in `map`.
    append: function(e) {
      return e = r.from(e), e.size ? new r(this.subtract(e).content.concat(e.content)) : this;
    },
    // :: (union<Object, OrderedMap>) → OrderedMap
    // Create a map containing all the keys in this map that don't
    // appear in `map`.
    subtract: function(e) {
      var t = this;
      e = r.from(e);
      for (var n = 0; n < e.content.length; n += 2)
        t = t.remove(e.content[n]);
      return t;
    },
    // :: () → Object
    // Turn ordered map into a plain object.
    toObject: function() {
      var e = {};
      return this.forEach(function(t, n) {
        e[t] = n;
      }), e;
    },
    // :: number
    // The amount of keys in this map.
    get size() {
      return this.content.length >> 1;
    }
  }, r.from = function(e) {
    if (e instanceof r) return e;
    var t = [];
    if (e) for (var n in e) t.push(n, e[n]);
    return new r(t);
  }, Yy = r, Yy;
}
var IT;
function Wm() {
  if (IT) return Oi;
  IT = 1;
  function r(H, R) {
    var b = typeof Symbol < "u" && H[Symbol.iterator] || H["@@iterator"];
    if (!b) {
      if (Array.isArray(H) || (b = e(H)) || R) {
        b && (H = b);
        var E = 0, B = function() {
        };
        return { s: B, n: function() {
          return E >= H.length ? { done: !0 } : { done: !1, value: H[E++] };
        }, e: function(Oe) {
          throw Oe;
        }, f: B };
      }
      throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
    }
    var K = !0, Z = !1, ae;
    return { s: function() {
      b = b.call(H);
    }, n: function() {
      var Oe = b.next();
      return K = Oe.done, Oe;
    }, e: function(Oe) {
      Z = !0, ae = Oe;
    }, f: function() {
      try {
        !K && b.return != null && b.return();
      } finally {
        if (Z) throw ae;
      }
    } };
  }
  function e(H, R) {
    if (H) {
      if (typeof H == "string") return t(H, R);
      var b = Object.prototype.toString.call(H).slice(8, -1);
      if (b === "Object" && H.constructor && (b = H.constructor.name), b === "Map" || b === "Set") return Array.from(H);
      if (b === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)) return t(H, R);
    }
  }
  function t(H, R) {
    (R == null || R > H.length) && (R = H.length);
    for (var b = 0, E = new Array(R); b < R; b++) E[b] = H[b];
    return E;
  }
  function n() {
    return typeof Reflect < "u" && Reflect.get ? n = Reflect.get.bind() : n = function(R, b, E) {
      var B = i(R, b);
      if (B) {
        var K = Object.getOwnPropertyDescriptor(B, b);
        return K.get ? K.get.call(arguments.length < 3 ? R : E) : K.value;
      }
    }, n.apply(this, arguments);
  }
  function i(H, R) {
    for (; !Object.prototype.hasOwnProperty.call(H, R) && (H = A(H), H !== null); )
      ;
    return H;
  }
  function a(H, R) {
    if (typeof R != "function" && R !== null)
      throw new TypeError("Super expression must either be null or a function");
    H.prototype = Object.create(R && R.prototype, { constructor: { value: H, writable: !0, configurable: !0 } }), Object.defineProperty(H, "prototype", { writable: !1 }), R && O(H, R);
  }
  function s(H) {
    var R = T();
    return function() {
      var E = A(H), B;
      if (R) {
        var K = A(this).constructor;
        B = Reflect.construct(E, arguments, K);
      } else
        B = E.apply(this, arguments);
      return u(this, B);
    };
  }
  function u(H, R) {
    if (R && (q(R) === "object" || typeof R == "function"))
      return R;
    if (R !== void 0)
      throw new TypeError("Derived constructors may only return object or undefined");
    return f(H);
  }
  function f(H) {
    if (H === void 0)
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return H;
  }
  function p(H) {
    var R = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
    return p = function(E) {
      if (E === null || !N(E)) return E;
      if (typeof E != "function")
        throw new TypeError("Super expression must either be null or a function");
      if (typeof R < "u") {
        if (R.has(E)) return R.get(E);
        R.set(E, B);
      }
      function B() {
        return y(E, arguments, A(this).constructor);
      }
      return B.prototype = Object.create(E.prototype, { constructor: { value: B, enumerable: !1, writable: !0, configurable: !0 } }), O(B, E);
    }, p(H);
  }
  function y(H, R, b) {
    return T() ? y = Reflect.construct.bind() : y = function(B, K, Z) {
      var ae = [null];
      ae.push.apply(ae, K);
      var ye = Function.bind.apply(B, ae), Oe = new ye();
      return Z && O(Oe, Z.prototype), Oe;
    }, y.apply(null, arguments);
  }
  function T() {
    if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
    if (typeof Proxy == "function") return !0;
    try {
      return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
      })), !0;
    } catch {
      return !1;
    }
  }
  function N(H) {
    try {
      return Function.toString.call(H).indexOf("[native code]") !== -1;
    } catch {
      return typeof H == "function";
    }
  }
  function O(H, R) {
    return O = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(E, B) {
      return E.__proto__ = B, E;
    }, O(H, R);
  }
  function A(H) {
    return A = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(b) {
      return b.__proto__ || Object.getPrototypeOf(b);
    }, A(H);
  }
  function q(H) {
    "@babel/helpers - typeof";
    return q = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(R) {
      return typeof R;
    } : function(R) {
      return R && typeof Symbol == "function" && R.constructor === Symbol && R !== Symbol.prototype ? "symbol" : typeof R;
    }, q(H);
  }
  function U(H, R) {
    if (!(H instanceof R))
      throw new TypeError("Cannot call a class as a function");
  }
  function j(H, R) {
    for (var b = 0; b < R.length; b++) {
      var E = R[b];
      E.enumerable = E.enumerable || !1, E.configurable = !0, "value" in E && (E.writable = !0), Object.defineProperty(H, se(E.key), E);
    }
  }
  function te(H, R, b) {
    return R && j(H.prototype, R), b && j(H, b), Object.defineProperty(H, "prototype", { writable: !1 }), H;
  }
  function se(H) {
    var R = me(H, "string");
    return q(R) === "symbol" ? R : String(R);
  }
  function me(H, R) {
    if (q(H) !== "object" || H === null) return H;
    var b = H[Symbol.toPrimitive];
    if (b !== void 0) {
      var E = b.call(H, R);
      if (q(E) !== "object") return E;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return String(H);
  }
  var Ce = /* @__PURE__ */ y9e();
  function pe(H, R, b) {
    for (var E = 0; ; E++) {
      if (E == H.childCount || E == R.childCount) return H.childCount == R.childCount ? null : b;
      var B = H.child(E), K = R.child(E);
      if (B == K) {
        b += B.nodeSize;
        continue;
      }
      if (!B.sameMarkup(K)) return b;
      if (B.isText && B.text != K.text) {
        for (var Z = 0; B.text[Z] == K.text[Z]; Z++) b++;
        return b;
      }
      if (B.content.size || K.content.size) {
        var ae = pe(B.content, K.content, b + 1);
        if (ae != null) return ae;
      }
      b += B.nodeSize;
    }
  }
  function ke(H, R, b, E) {
    for (var B = H.childCount, K = R.childCount; ; ) {
      if (B == 0 || K == 0) return B == K ? null : {
        a: b,
        b: E
      };
      var Z = H.child(--B), ae = R.child(--K), ye = Z.nodeSize;
      if (Z == ae) {
        b -= ye, E -= ye;
        continue;
      }
      if (!Z.sameMarkup(ae)) return {
        a: b,
        b: E
      };
      if (Z.isText && Z.text != ae.text) {
        for (var Oe = 0, je = Math.min(Z.text.length, ae.text.length); Oe < je && Z.text[Z.text.length - Oe - 1] == ae.text[ae.text.length - Oe - 1]; )
          Oe++, b--, E--;
        return {
          a: b,
          b: E
        };
      }
      if (Z.content.size || ae.content.size) {
        var $e = ke(Z.content, ae.content, b - 1, E - 1);
        if ($e) return $e;
      }
      b -= ye, E -= ye;
    }
  }
  var Ne = (function() {
    function H(R, b) {
      if (U(this, H), this.content = R, this.size = b || 0, b == null) for (var E = 0; E < R.length; E++) this.size += R[E].nodeSize;
    }
    return te(H, [{
      key: "nodesBetween",
      value: function(b, E, B) {
        for (var K = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, Z = arguments.length > 4 ? arguments[4] : void 0, ae = 0, ye = 0; ye < E; ae++) {
          var Oe = this.content[ae], je = ye + Oe.nodeSize;
          if (je > b && B(Oe, K + ye, Z || null, ae) !== !1 && Oe.content.size) {
            var $e = ye + 1;
            Oe.nodesBetween(Math.max(0, b - $e), Math.min(Oe.content.size, E - $e), B, K + $e);
          }
          ye = je;
        }
      }
    }, {
      key: "descendants",
      value: function(b) {
        this.nodesBetween(0, this.size, b);
      }
    }, {
      key: "textBetween",
      value: function(b, E, B, K) {
        var Z = "", ae = !0;
        return this.nodesBetween(b, E, function(ye, Oe) {
          var je = ye.isText ? ye.text.slice(Math.max(b, Oe) - Oe, E - Oe) : ye.isLeaf ? K ? typeof K == "function" ? K(ye) : K : ye.type.spec.leafText ? ye.type.spec.leafText(ye) : "" : "";
          ye.isBlock && (ye.isLeaf && je || ye.isTextblock) && B && (ae ? ae = !1 : Z += B), Z += je;
        }, 0), Z;
      }
    }, {
      key: "append",
      value: function(b) {
        if (!b.size) return this;
        if (!this.size) return b;
        var E = this.lastChild, B = b.firstChild, K = this.content.slice(), Z = 0;
        for (E.isText && E.sameMarkup(B) && (K[K.length - 1] = E.withText(E.text + B.text), Z = 1); Z < b.content.length; Z++) K.push(b.content[Z]);
        return new H(K, this.size + b.size);
      }
    }, {
      key: "cut",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.size;
        if (b == 0 && E == this.size) return this;
        var B = [], K = 0;
        if (E > b) for (var Z = 0, ae = 0; ae < E; Z++) {
          var ye = this.content[Z], Oe = ae + ye.nodeSize;
          Oe > b && ((ae < b || Oe > E) && (ye.isText ? ye = ye.cut(Math.max(0, b - ae), Math.min(ye.text.length, E - ae)) : ye = ye.cut(Math.max(0, b - ae - 1), Math.min(ye.content.size, E - ae - 1))), B.push(ye), K += ye.nodeSize), ae = Oe;
        }
        return new H(B, K);
      }
    }, {
      key: "cutByIndex",
      value: function(b, E) {
        return b == E ? H.empty : b == 0 && E == this.content.length ? this : new H(this.content.slice(b, E));
      }
    }, {
      key: "replaceChild",
      value: function(b, E) {
        var B = this.content[b];
        if (B == E) return this;
        var K = this.content.slice(), Z = this.size + E.nodeSize - B.nodeSize;
        return K[b] = E, new H(K, Z);
      }
    }, {
      key: "addToStart",
      value: function(b) {
        return new H([b].concat(this.content), this.size + b.nodeSize);
      }
    }, {
      key: "addToEnd",
      value: function(b) {
        return new H(this.content.concat(b), this.size + b.nodeSize);
      }
    }, {
      key: "eq",
      value: function(b) {
        if (this.content.length != b.content.length) return !1;
        for (var E = 0; E < this.content.length; E++) if (!this.content[E].eq(b.content[E])) return !1;
        return !0;
      }
    }, {
      key: "firstChild",
      get: function() {
        return this.content.length ? this.content[0] : null;
      }
    }, {
      key: "lastChild",
      get: function() {
        return this.content.length ? this.content[this.content.length - 1] : null;
      }
    }, {
      key: "childCount",
      get: function() {
        return this.content.length;
      }
    }, {
      key: "child",
      value: function(b) {
        var E = this.content[b];
        if (!E) throw new RangeError("Index " + b + " out of range for " + this);
        return E;
      }
    }, {
      key: "maybeChild",
      value: function(b) {
        return this.content[b] || null;
      }
    }, {
      key: "forEach",
      value: function(b) {
        for (var E = 0, B = 0; E < this.content.length; E++) {
          var K = this.content[E];
          b(K, B, E), B += K.nodeSize;
        }
      }
    }, {
      key: "findDiffStart",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        return pe(this, b, E);
      }
    }, {
      key: "findDiffEnd",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.size, B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : b.size;
        return ke(this, b, E, B);
      }
    }, {
      key: "findIndex",
      value: function(b) {
        if (b == 0) return Ze(0, b);
        if (b == this.size) return Ze(this.content.length, b);
        if (b > this.size || b < 0) throw new RangeError("Position ".concat(b, " outside of fragment (").concat(this, ")"));
        for (var E = 0, B = 0; ; E++) {
          var K = this.child(E), Z = B + K.nodeSize;
          if (Z >= b)
            return Z == b ? Ze(E + 1, Z) : Ze(E, B);
          B = Z;
        }
      }
    }, {
      key: "toString",
      value: function() {
        return "<" + this.toStringInner() + ">";
      }
    }, {
      key: "toStringInner",
      value: function() {
        return this.content.join(", ");
      }
    }, {
      key: "toJSON",
      value: function() {
        return this.content.length ? this.content.map(function(b) {
          return b.toJSON();
        }) : null;
      }
    }], [{
      key: "fromJSON",
      value: function(b, E) {
        if (!E) return H.empty;
        if (!Array.isArray(E)) throw new RangeError("Invalid input for Fragment.fromJSON");
        return new H(E.map(b.nodeFromJSON));
      }
    }, {
      key: "fromArray",
      value: function(b) {
        if (!b.length) return H.empty;
        for (var E, B = 0, K = 0; K < b.length; K++) {
          var Z = b[K];
          B += Z.nodeSize, K && Z.isText && b[K - 1].sameMarkup(Z) ? (E || (E = b.slice(0, K)), E[E.length - 1] = Z.withText(E[E.length - 1].text + Z.text)) : E && E.push(Z);
        }
        return new H(E || b, B);
      }
    }, {
      key: "from",
      value: function(b) {
        if (!b) return H.empty;
        if (b instanceof H) return b;
        if (Array.isArray(b)) return this.fromArray(b);
        if (b.attrs) return new H([b], b.nodeSize);
        throw new RangeError("Can not convert " + b + " to a Fragment" + (b.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
      }
    }]), H;
  })();
  Ne.empty = new Ne([], 0);
  var ze = {
    index: 0,
    offset: 0
  };
  function Ze(H, R) {
    return ze.index = H, ze.offset = R, ze;
  }
  function At(H, R) {
    if (H === R) return !0;
    if (!(H && q(H) == "object") || !(R && q(R) == "object")) return !1;
    var b = Array.isArray(H);
    if (Array.isArray(R) != b) return !1;
    if (b) {
      if (H.length != R.length) return !1;
      for (var E = 0; E < H.length; E++) if (!At(H[E], R[E])) return !1;
    } else {
      for (var B in H) if (!(B in R) || !At(H[B], R[B])) return !1;
      for (var K in R) if (!(K in H)) return !1;
    }
    return !0;
  }
  var et = (function() {
    function H(R, b) {
      U(this, H), this.type = R, this.attrs = b;
    }
    return te(H, [{
      key: "addToSet",
      value: function(b) {
        for (var E, B = !1, K = 0; K < b.length; K++) {
          var Z = b[K];
          if (this.eq(Z)) return b;
          if (this.type.excludes(Z.type))
            E || (E = b.slice(0, K));
          else {
            if (Z.type.excludes(this.type))
              return b;
            !B && Z.type.rank > this.type.rank && (E || (E = b.slice(0, K)), E.push(this), B = !0), E && E.push(Z);
          }
        }
        return E || (E = b.slice()), B || E.push(this), E;
      }
    }, {
      key: "removeFromSet",
      value: function(b) {
        for (var E = 0; E < b.length; E++) if (this.eq(b[E])) return b.slice(0, E).concat(b.slice(E + 1));
        return b;
      }
    }, {
      key: "isInSet",
      value: function(b) {
        for (var E = 0; E < b.length; E++) if (this.eq(b[E])) return !0;
        return !1;
      }
    }, {
      key: "eq",
      value: function(b) {
        return this == b || this.type == b.type && At(this.attrs, b.attrs);
      }
    }, {
      key: "toJSON",
      value: function() {
        var b = {
          type: this.type.name
        };
        for (var E in this.attrs) {
          b.attrs = this.attrs;
          break;
        }
        return b;
      }
    }], [{
      key: "fromJSON",
      value: function(b, E) {
        if (!E) throw new RangeError("Invalid input for Mark.fromJSON");
        var B = b.marks[E.type];
        if (!B) throw new RangeError("There is no mark type ".concat(E.type, " in this schema"));
        var K = B.create(E.attrs);
        return B.checkAttrs(K.attrs), K;
      }
    }, {
      key: "sameSet",
      value: function(b, E) {
        if (b == E) return !0;
        if (b.length != E.length) return !1;
        for (var B = 0; B < b.length; B++) if (!b[B].eq(E[B])) return !1;
        return !0;
      }
    }, {
      key: "setFrom",
      value: function(b) {
        if (!b || Array.isArray(b) && b.length == 0) return H.none;
        if (b instanceof H) return [b];
        var E = b.slice();
        return E.sort(function(B, K) {
          return B.type.rank - K.type.rank;
        }), E;
      }
    }]), H;
  })();
  et.none = [];
  var Ht = (function(H) {
    a(b, H);
    var R = s(b);
    function b() {
      return U(this, b), R.apply(this, arguments);
    }
    return te(b);
  })(p(Error)), Rt = (function() {
    function H(R, b, E) {
      U(this, H), this.content = R, this.openStart = b, this.openEnd = E;
    }
    return te(H, [{
      key: "size",
      get: function() {
        return this.content.size - this.openStart - this.openEnd;
      }
    }, {
      key: "insertAt",
      value: function(b, E) {
        var B = yt(this.content, b + this.openStart, E);
        return B && new H(B, this.openStart, this.openEnd);
      }
    }, {
      key: "removeBetween",
      value: function(b, E) {
        return new H(Ut(this.content, b + this.openStart, E + this.openStart), this.openStart, this.openEnd);
      }
    }, {
      key: "eq",
      value: function(b) {
        return this.content.eq(b.content) && this.openStart == b.openStart && this.openEnd == b.openEnd;
      }
    }, {
      key: "toString",
      value: function() {
        return this.content + "(" + this.openStart + "," + this.openEnd + ")";
      }
    }, {
      key: "toJSON",
      value: function() {
        if (!this.content.size) return null;
        var b = {
          content: this.content.toJSON()
        };
        return this.openStart > 0 && (b.openStart = this.openStart), this.openEnd > 0 && (b.openEnd = this.openEnd), b;
      }
    }], [{
      key: "fromJSON",
      value: function(b, E) {
        if (!E) return H.empty;
        var B = E.openStart || 0, K = E.openEnd || 0;
        if (typeof B != "number" || typeof K != "number") throw new RangeError("Invalid input for Slice.fromJSON");
        return new H(Ne.fromJSON(b, E.content), B, K);
      }
    }, {
      key: "maxOpen",
      value: function(b) {
        for (var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, B = 0, K = 0, Z = b.firstChild; Z && !Z.isLeaf && (E || !Z.type.spec.isolating); Z = Z.firstChild) B++;
        for (var ae = b.lastChild; ae && !ae.isLeaf && (E || !ae.type.spec.isolating); ae = ae.lastChild) K++;
        return new H(b, B, K);
      }
    }]), H;
  })();
  Rt.empty = new Rt(Ne.empty, 0, 0);
  function Ut(H, R, b) {
    var E = H.findIndex(R), B = E.index, K = E.offset, Z = H.maybeChild(B), ae = H.findIndex(b), ye = ae.index, Oe = ae.offset;
    if (K == R || Z.isText) {
      if (Oe != b && !H.child(ye).isText) throw new RangeError("Removing non-flat range");
      return H.cut(0, R).append(H.cut(b));
    }
    if (B != ye) throw new RangeError("Removing non-flat range");
    return H.replaceChild(B, Z.copy(Ut(Z.content, R - K - 1, b - K - 1)));
  }
  function yt(H, R, b, E) {
    var B = H.findIndex(R), K = B.index, Z = B.offset, ae = H.maybeChild(K);
    if (Z == R || ae.isText)
      return E && !E.canReplace(K, K, b) ? null : H.cut(0, R).append(b).append(H.cut(R));
    var ye = yt(ae.content, R - Z - 1, b, ae);
    return ye && H.replaceChild(K, ae.copy(ye));
  }
  function It(H, R, b) {
    if (b.openStart > H.depth) throw new Ht("Inserted content deeper than insertion position");
    if (H.depth - b.openStart != R.depth - b.openEnd) throw new Ht("Inconsistent open depths");
    return Ke(H, R, b, 0);
  }
  function Ke(H, R, b, E) {
    var B = H.index(E), K = H.node(E);
    if (B == R.index(E) && E < H.depth - b.openStart) {
      var Z = Ke(H, R, b, E + 1);
      return K.copy(K.content.replaceChild(B, Z));
    } else if (b.content.size)
      if (!b.openStart && !b.openEnd && H.depth == E && R.depth == E) {
        var ae = H.parent, ye = ae.content;
        return dt(ae, ye.cut(0, H.parentOffset).append(b.content).append(ye.cut(R.parentOffset)));
      } else {
        var Oe = Lt(b, H), je = Oe.start, $e = Oe.end;
        return dt(K, vt(H, je, $e, R, E));
      }
    else return dt(K, Ft(H, R, E));
  }
  function ct(H, R) {
    if (!R.type.compatibleContent(H.type)) throw new Ht("Cannot join " + R.type.name + " onto " + H.type.name);
  }
  function He(H, R, b) {
    var E = H.node(b);
    return ct(E, R.node(b)), E;
  }
  function fe(H, R) {
    var b = R.length - 1;
    b >= 0 && H.isText && H.sameMarkup(R[b]) ? R[b] = H.withText(R[b].text + H.text) : R.push(H);
  }
  function Le(H, R, b, E) {
    var B = (R || H).node(b), K = 0, Z = R ? R.index(b) : B.childCount;
    H && (K = H.index(b), H.depth > b ? K++ : H.textOffset && (fe(H.nodeAfter, E), K++));
    for (var ae = K; ae < Z; ae++) fe(B.child(ae), E);
    R && R.depth == b && R.textOffset && fe(R.nodeBefore, E);
  }
  function dt(H, R) {
    return H.type.checkContent(R), H.copy(R);
  }
  function vt(H, R, b, E, B) {
    var K = H.depth > B && He(H, R, B + 1), Z = E.depth > B && He(b, E, B + 1), ae = [];
    return Le(null, H, B, ae), K && Z && R.index(B) == b.index(B) ? (ct(K, Z), fe(dt(K, vt(H, R, b, E, B + 1)), ae)) : (K && fe(dt(K, Ft(H, R, B + 1)), ae), Le(R, b, B, ae), Z && fe(dt(Z, Ft(b, E, B + 1)), ae)), Le(E, null, B, ae), new Ne(ae);
  }
  function Ft(H, R, b) {
    var E = [];
    if (Le(null, H, b, E), H.depth > b) {
      var B = He(H, R, b + 1);
      fe(dt(B, Ft(H, R, b + 1)), E);
    }
    return Le(R, null, b, E), new Ne(E);
  }
  function Lt(H, R) {
    for (var b = R.depth - H.openStart, E = R.node(b), B = E.copy(H.content), K = b - 1; K >= 0; K--) B = R.node(K).copy(Ne.from(B));
    return {
      start: B.resolveNoCache(H.openStart + b),
      end: B.resolveNoCache(B.content.size - H.openEnd - b)
    };
  }
  var $t = (function() {
    function H(R, b, E) {
      U(this, H), this.pos = R, this.path = b, this.parentOffset = E, this.depth = b.length / 3 - 1;
    }
    return te(H, [{
      key: "resolveDepth",
      value: function(b) {
        return b == null ? this.depth : b < 0 ? this.depth + b : b;
      }
    }, {
      key: "parent",
      get: function() {
        return this.node(this.depth);
      }
    }, {
      key: "doc",
      get: function() {
        return this.node(0);
      }
    }, {
      key: "node",
      value: function(b) {
        return this.path[this.resolveDepth(b) * 3];
      }
    }, {
      key: "index",
      value: function(b) {
        return this.path[this.resolveDepth(b) * 3 + 1];
      }
    }, {
      key: "indexAfter",
      value: function(b) {
        return b = this.resolveDepth(b), this.index(b) + (b == this.depth && !this.textOffset ? 0 : 1);
      }
    }, {
      key: "start",
      value: function(b) {
        return b = this.resolveDepth(b), b == 0 ? 0 : this.path[b * 3 - 1] + 1;
      }
    }, {
      key: "end",
      value: function(b) {
        return b = this.resolveDepth(b), this.start(b) + this.node(b).content.size;
      }
    }, {
      key: "before",
      value: function(b) {
        if (b = this.resolveDepth(b), !b) throw new RangeError("There is no position before the top-level node");
        return b == this.depth + 1 ? this.pos : this.path[b * 3 - 1];
      }
    }, {
      key: "after",
      value: function(b) {
        if (b = this.resolveDepth(b), !b) throw new RangeError("There is no position after the top-level node");
        return b == this.depth + 1 ? this.pos : this.path[b * 3 - 1] + this.path[b * 3].nodeSize;
      }
    }, {
      key: "textOffset",
      get: function() {
        return this.pos - this.path[this.path.length - 1];
      }
    }, {
      key: "nodeAfter",
      get: function() {
        var b = this.parent, E = this.index(this.depth);
        if (E == b.childCount) return null;
        var B = this.pos - this.path[this.path.length - 1], K = b.child(E);
        return B ? b.child(E).cut(B) : K;
      }
    }, {
      key: "nodeBefore",
      get: function() {
        var b = this.index(this.depth), E = this.pos - this.path[this.path.length - 1];
        return E ? this.parent.child(b).cut(0, E) : b == 0 ? null : this.parent.child(b - 1);
      }
    }, {
      key: "posAtIndex",
      value: function(b, E) {
        E = this.resolveDepth(E);
        for (var B = this.path[E * 3], K = E == 0 ? 0 : this.path[E * 3 - 1] + 1, Z = 0; Z < b; Z++) K += B.child(Z).nodeSize;
        return K;
      }
    }, {
      key: "marks",
      value: function() {
        var b = this.parent, E = this.index();
        if (b.content.size == 0) return et.none;
        if (this.textOffset) return b.child(E).marks;
        var B = b.maybeChild(E - 1), K = b.maybeChild(E);
        if (!B) {
          var Z = B;
          B = K, K = Z;
        }
        for (var ae = B.marks, ye = 0; ye < ae.length; ye++) ae[ye].type.spec.inclusive === !1 && (!K || !ae[ye].isInSet(K.marks)) && (ae = ae[ye--].removeFromSet(ae));
        return ae;
      }
    }, {
      key: "marksAcross",
      value: function(b) {
        var E = this.parent.maybeChild(this.index());
        if (!E || !E.isInline) return null;
        for (var B = E.marks, K = b.parent.maybeChild(b.index()), Z = 0; Z < B.length; Z++) B[Z].type.spec.inclusive === !1 && (!K || !B[Z].isInSet(K.marks)) && (B = B[Z--].removeFromSet(B));
        return B;
      }
    }, {
      key: "sharedDepth",
      value: function(b) {
        for (var E = this.depth; E > 0; E--) if (this.start(E) <= b && this.end(E) >= b) return E;
        return 0;
      }
    }, {
      key: "blockRange",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this, E = arguments.length > 1 ? arguments[1] : void 0;
        if (b.pos < this.pos) return b.blockRange(this);
        for (var B = this.depth - (this.parent.inlineContent || this.pos == b.pos ? 1 : 0); B >= 0; B--) if (b.pos <= this.end(B) && (!E || E(this.node(B)))) return new ge(this, b, B);
        return null;
      }
    }, {
      key: "sameParent",
      value: function(b) {
        return this.pos - this.parentOffset == b.pos - b.parentOffset;
      }
    }, {
      key: "max",
      value: function(b) {
        return b.pos > this.pos ? b : this;
      }
    }, {
      key: "min",
      value: function(b) {
        return b.pos < this.pos ? b : this;
      }
    }, {
      key: "toString",
      value: function() {
        for (var b = "", E = 1; E <= this.depth; E++) b += (b ? "/" : "") + this.node(E).type.name + "_" + this.index(E - 1);
        return b + ":" + this.parentOffset;
      }
    }], [{
      key: "resolve",
      value: function(b, E) {
        if (!(E >= 0 && E <= b.content.size)) throw new RangeError("Position " + E + " out of range");
        for (var B = [], K = 0, Z = E, ae = b; ; ) {
          var ye = ae.content.findIndex(Z), Oe = ye.index, je = ye.offset, $e = Z - je;
          if (B.push(ae, Oe, K + je), !$e || (ae = ae.child(Oe), ae.isText)) break;
          Z = $e - 1, K += je + 1;
        }
        return new H(E, B, Z);
      }
    }, {
      key: "resolveCached",
      value: function(b, E) {
        var B = ue.get(b);
        if (B)
          for (var K = 0; K < B.elts.length; K++) {
            var Z = B.elts[K];
            if (Z.pos == E) return Z;
          }
        else
          ue.set(b, B = new Te());
        var ae = B.elts[B.i] = H.resolve(b, E);
        return B.i = (B.i + 1) % be, ae;
      }
    }]), H;
  })(), Te = te(function H() {
    U(this, H), this.elts = [], this.i = 0;
  }), be = 12, ue = /* @__PURE__ */ new WeakMap(), ge = (function() {
    function H(R, b, E) {
      U(this, H), this.$from = R, this.$to = b, this.depth = E;
    }
    return te(H, [{
      key: "start",
      get: function() {
        return this.$from.before(this.depth + 1);
      }
    }, {
      key: "end",
      get: function() {
        return this.$to.after(this.depth + 1);
      }
    }, {
      key: "parent",
      get: function() {
        return this.$from.node(this.depth);
      }
    }, {
      key: "startIndex",
      get: function() {
        return this.$from.index(this.depth);
      }
    }, {
      key: "endIndex",
      get: function() {
        return this.$to.indexAfter(this.depth);
      }
    }]), H;
  })(), oe = /* @__PURE__ */ Object.create(null), Pe = (function() {
    function H(R, b, E) {
      var B = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : et.none;
      U(this, H), this.type = R, this.attrs = b, this.marks = B, this.content = E || Ne.empty;
    }
    return te(H, [{
      key: "children",
      get: function() {
        return this.content.content;
      }
    }, {
      key: "nodeSize",
      get: function() {
        return this.isLeaf ? 1 : 2 + this.content.size;
      }
    }, {
      key: "childCount",
      get: function() {
        return this.content.childCount;
      }
    }, {
      key: "child",
      value: function(b) {
        return this.content.child(b);
      }
    }, {
      key: "maybeChild",
      value: function(b) {
        return this.content.maybeChild(b);
      }
    }, {
      key: "forEach",
      value: function(b) {
        this.content.forEach(b);
      }
    }, {
      key: "nodesBetween",
      value: function(b, E, B) {
        var K = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
        this.content.nodesBetween(b, E, B, K, this);
      }
    }, {
      key: "descendants",
      value: function(b) {
        this.nodesBetween(0, this.content.size, b);
      }
    }, {
      key: "textContent",
      get: function() {
        return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
      }
    }, {
      key: "textBetween",
      value: function(b, E, B, K) {
        return this.content.textBetween(b, E, B, K);
      }
    }, {
      key: "firstChild",
      get: function() {
        return this.content.firstChild;
      }
    }, {
      key: "lastChild",
      get: function() {
        return this.content.lastChild;
      }
    }, {
      key: "eq",
      value: function(b) {
        return this == b || this.sameMarkup(b) && this.content.eq(b.content);
      }
    }, {
      key: "sameMarkup",
      value: function(b) {
        return this.hasMarkup(b.type, b.attrs, b.marks);
      }
    }, {
      key: "hasMarkup",
      value: function(b, E, B) {
        return this.type == b && At(this.attrs, E || b.defaultAttrs || oe) && et.sameSet(this.marks, B || et.none);
      }
    }, {
      key: "copy",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
        return b == this.content ? this : new H(this.type, this.attrs, b, this.marks);
      }
    }, {
      key: "mark",
      value: function(b) {
        return b == this.marks ? this : new H(this.type, this.attrs, this.content, b);
      }
    }, {
      key: "cut",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.content.size;
        return b == 0 && E == this.content.size ? this : this.copy(this.content.cut(b, E));
      }
    }, {
      key: "slice",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.content.size, B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
        if (b == E) return Rt.empty;
        var K = this.resolve(b), Z = this.resolve(E), ae = B ? 0 : K.sharedDepth(E), ye = K.start(ae), Oe = K.node(ae), je = Oe.content.cut(K.pos - ye, Z.pos - ye);
        return new Rt(je, K.depth - ae, Z.depth - ae);
      }
    }, {
      key: "replace",
      value: function(b, E, B) {
        return It(this.resolve(b), this.resolve(E), B);
      }
    }, {
      key: "nodeAt",
      value: function(b) {
        for (var E = this; ; ) {
          var B = E.content.findIndex(b), K = B.index, Z = B.offset;
          if (E = E.maybeChild(K), !E) return null;
          if (Z == b || E.isText) return E;
          b -= Z + 1;
        }
      }
    }, {
      key: "childAfter",
      value: function(b) {
        var E = this.content.findIndex(b), B = E.index, K = E.offset;
        return {
          node: this.content.maybeChild(B),
          index: B,
          offset: K
        };
      }
    }, {
      key: "childBefore",
      value: function(b) {
        if (b == 0) return {
          node: null,
          index: 0,
          offset: 0
        };
        var E = this.content.findIndex(b), B = E.index, K = E.offset;
        if (K < b) return {
          node: this.content.child(B),
          index: B,
          offset: K
        };
        var Z = this.content.child(B - 1);
        return {
          node: Z,
          index: B - 1,
          offset: K - Z.nodeSize
        };
      }
    }, {
      key: "resolve",
      value: function(b) {
        return $t.resolveCached(this, b);
      }
    }, {
      key: "resolveNoCache",
      value: function(b) {
        return $t.resolve(this, b);
      }
    }, {
      key: "rangeHasMark",
      value: function(b, E, B) {
        var K = !1;
        return E > b && this.nodesBetween(b, E, function(Z) {
          return B.isInSet(Z.marks) && (K = !0), !K;
        }), K;
      }
    }, {
      key: "isBlock",
      get: function() {
        return this.type.isBlock;
      }
    }, {
      key: "isTextblock",
      get: function() {
        return this.type.isTextblock;
      }
    }, {
      key: "inlineContent",
      get: function() {
        return this.type.inlineContent;
      }
    }, {
      key: "isInline",
      get: function() {
        return this.type.isInline;
      }
    }, {
      key: "isText",
      get: function() {
        return this.type.isText;
      }
    }, {
      key: "isLeaf",
      get: function() {
        return this.type.isLeaf;
      }
    }, {
      key: "isAtom",
      get: function() {
        return this.type.isAtom;
      }
    }, {
      key: "toString",
      value: function() {
        if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
        var b = this.type.name;
        return this.content.size && (b += "(" + this.content.toStringInner() + ")"), lt(this.marks, b);
      }
    }, {
      key: "contentMatchAt",
      value: function(b) {
        var E = this.type.contentMatch.matchFragment(this.content, 0, b);
        if (!E) throw new Error("Called contentMatchAt on a node with invalid content");
        return E;
      }
    }, {
      key: "canReplace",
      value: function(b, E) {
        var B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ne.empty, K = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, Z = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : B.childCount, ae = this.contentMatchAt(b).matchFragment(B, K, Z), ye = ae && ae.matchFragment(this.content, E);
        if (!ye || !ye.validEnd) return !1;
        for (var Oe = K; Oe < Z; Oe++) if (!this.type.allowsMarks(B.child(Oe).marks)) return !1;
        return !0;
      }
    }, {
      key: "canReplaceWith",
      value: function(b, E, B, K) {
        if (K && !this.type.allowsMarks(K)) return !1;
        var Z = this.contentMatchAt(b).matchType(B), ae = Z && Z.matchFragment(this.content, E);
        return ae ? ae.validEnd : !1;
      }
    }, {
      key: "canAppend",
      value: function(b) {
        return b.content.size ? this.canReplace(this.childCount, this.childCount, b.content) : this.type.compatibleContent(b.type);
      }
    }, {
      key: "check",
      value: function() {
        this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
        for (var b = et.none, E = 0; E < this.marks.length; E++) {
          var B = this.marks[E];
          B.type.checkAttrs(B.attrs), b = B.addToSet(b);
        }
        if (!et.sameSet(b, this.marks)) throw new RangeError("Invalid collection of marks for node ".concat(this.type.name, ": ").concat(this.marks.map(function(K) {
          return K.type.name;
        })));
        this.content.forEach(function(K) {
          return K.check();
        });
      }
    }, {
      key: "toJSON",
      value: function() {
        var b = {
          type: this.type.name
        };
        for (var E in this.attrs) {
          b.attrs = this.attrs;
          break;
        }
        return this.content.size && (b.content = this.content.toJSON()), this.marks.length && (b.marks = this.marks.map(function(B) {
          return B.toJSON();
        })), b;
      }
    }], [{
      key: "fromJSON",
      value: function(b, E) {
        if (!E) throw new RangeError("Invalid input for Node.fromJSON");
        var B = void 0;
        if (E.marks) {
          if (!Array.isArray(E.marks)) throw new RangeError("Invalid mark data for Node.fromJSON");
          B = E.marks.map(b.markFromJSON);
        }
        if (E.type == "text") {
          if (typeof E.text != "string") throw new RangeError("Invalid text node in JSON");
          return b.text(E.text, B);
        }
        var K = Ne.fromJSON(b, E.content), Z = b.nodeType(E.type).create(E.attrs, K, B);
        return Z.type.checkAttrs(Z.attrs), Z;
      }
    }]), H;
  })();
  Pe.prototype.text = void 0;
  var Ve = (function(H) {
    a(b, H);
    var R = s(b);
    function b(E, B, K, Z) {
      var ae;
      if (U(this, b), ae = R.call(this, E, B, null, Z), !K) throw new RangeError("Empty text nodes are not allowed");
      return ae.text = K, ae;
    }
    return te(b, [{
      key: "toString",
      value: function() {
        return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : lt(this.marks, JSON.stringify(this.text));
      }
    }, {
      key: "textContent",
      get: function() {
        return this.text;
      }
    }, {
      key: "textBetween",
      value: function(B, K) {
        return this.text.slice(B, K);
      }
    }, {
      key: "nodeSize",
      get: function() {
        return this.text.length;
      }
    }, {
      key: "mark",
      value: function(B) {
        return B == this.marks ? this : new b(this.type, this.attrs, this.text, B);
      }
    }, {
      key: "withText",
      value: function(B) {
        return B == this.text ? this : new b(this.type, this.attrs, B, this.marks);
      }
    }, {
      key: "cut",
      value: function() {
        var B = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, K = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.text.length;
        return B == 0 && K == this.text.length ? this : this.withText(this.text.slice(B, K));
      }
    }, {
      key: "eq",
      value: function(B) {
        return this.sameMarkup(B) && this.text == B.text;
      }
    }, {
      key: "toJSON",
      value: function() {
        var B = n(A(b.prototype), "toJSON", this).call(this);
        return B.text = this.text, B;
      }
    }]), b;
  })(Pe);
  function lt(H, R) {
    for (var b = H.length - 1; b >= 0; b--) R = H[b].type.name + "(" + R + ")";
    return R;
  }
  var Tt = (function() {
    function H(R) {
      U(this, H), this.validEnd = R, this.next = [], this.wrapCache = [];
    }
    return te(H, [{
      key: "matchType",
      value: function(b) {
        for (var E = 0; E < this.next.length; E++) if (this.next[E].type == b) return this.next[E].next;
        return null;
      }
    }, {
      key: "matchFragment",
      value: function(b) {
        for (var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : b.childCount, K = this, Z = E; K && Z < B; Z++) K = K.matchType(b.child(Z).type);
        return K;
      }
    }, {
      key: "inlineContent",
      get: function() {
        return this.next.length != 0 && this.next[0].type.isInline;
      }
    }, {
      key: "defaultType",
      get: function() {
        for (var b = 0; b < this.next.length; b++) {
          var E = this.next[b].type;
          if (!(E.isText || E.hasRequiredAttrs())) return E;
        }
        return null;
      }
    }, {
      key: "compatible",
      value: function(b) {
        for (var E = 0; E < this.next.length; E++) for (var B = 0; B < b.next.length; B++) if (this.next[E].type == b.next[B].type) return !0;
        return !1;
      }
    }, {
      key: "fillBefore",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, K = [this];
        function Z(ae, ye) {
          var Oe = ae.matchFragment(b, B);
          if (Oe && (!E || Oe.validEnd)) return Ne.from(ye.map(function(hr) {
            return hr.createAndFill();
          }));
          for (var je = 0; je < ae.next.length; je++) {
            var $e = ae.next[je], at = $e.type, Ot = $e.next;
            if (!(at.isText || at.hasRequiredAttrs()) && K.indexOf(Ot) == -1) {
              K.push(Ot);
              var er = Z(Ot, ye.concat(at));
              if (er) return er;
            }
          }
          return null;
        }
        return Z(this, []);
      }
    }, {
      key: "findWrapping",
      value: function(b) {
        for (var E = 0; E < this.wrapCache.length; E += 2) if (this.wrapCache[E] == b) return this.wrapCache[E + 1];
        var B = this.computeWrapping(b);
        return this.wrapCache.push(b, B), B;
      }
    }, {
      key: "computeWrapping",
      value: function(b) {
        for (var E = /* @__PURE__ */ Object.create(null), B = [{
          match: this,
          type: null,
          via: null
        }]; B.length; ) {
          var K = B.shift(), Z = K.match;
          if (Z.matchType(b)) {
            for (var ae = [], ye = K; ye.type; ye = ye.via) ae.push(ye.type);
            return ae.reverse();
          }
          for (var Oe = 0; Oe < Z.next.length; Oe++) {
            var je = Z.next[Oe], $e = je.type, at = je.next;
            !$e.isLeaf && !$e.hasRequiredAttrs() && !($e.name in E) && (!K.type || at.validEnd) && (B.push({
              match: $e.contentMatch,
              type: $e,
              via: K
            }), E[$e.name] = !0);
          }
        }
        return null;
      }
    }, {
      key: "edgeCount",
      get: function() {
        return this.next.length;
      }
    }, {
      key: "edge",
      value: function(b) {
        if (b >= this.next.length) throw new RangeError("There's no ".concat(b, "th edge in this content match"));
        return this.next[b];
      }
    }, {
      key: "toString",
      value: function() {
        var b = [];
        function E(B) {
          b.push(B);
          for (var K = 0; K < B.next.length; K++) b.indexOf(B.next[K].next) == -1 && E(B.next[K].next);
        }
        return E(this), b.map(function(B, K) {
          for (var Z = K + (B.validEnd ? "*" : " ") + " ", ae = 0; ae < B.next.length; ae++) Z += (ae ? ", " : "") + B.next[ae].type.name + "->" + b.indexOf(B.next[ae].next);
          return Z;
        }).join(`
`);
      }
    }], [{
      key: "parse",
      value: function(b, E) {
        var B = new Yt(b, E);
        if (B.next == null) return H.empty;
        var K = jt(B);
        B.next && B.err("Unexpected trailing text");
        var Z = ut(Hn(K));
        return _t(Z, B), Z;
      }
    }]), H;
  })();
  Tt.empty = new Tt(!0);
  var Yt = (function() {
    function H(R, b) {
      U(this, H), this.string = R, this.nodeTypes = b, this.inline = null, this.pos = 0, this.tokens = R.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
    }
    return te(H, [{
      key: "next",
      get: function() {
        return this.tokens[this.pos];
      }
    }, {
      key: "eat",
      value: function(b) {
        return this.next == b && (this.pos++ || !0);
      }
    }, {
      key: "err",
      value: function(b) {
        throw new SyntaxError(b + " (in content expression '" + this.string + "')");
      }
    }]), H;
  })();
  function jt(H) {
    var R = [];
    do
      R.push(mr(H));
    while (H.eat("|"));
    return R.length == 1 ? R[0] : {
      type: "choice",
      exprs: R
    };
  }
  function mr(H) {
    var R = [];
    do
      R.push(tr(H));
    while (H.next && H.next != ")" && H.next != "|");
    return R.length == 1 ? R[0] : {
      type: "seq",
      exprs: R
    };
  }
  function tr(H) {
    for (var R = ki(H); ; )
      if (H.eat("+")) R = {
        type: "plus",
        expr: R
      };
      else if (H.eat("*")) R = {
        type: "star",
        expr: R
      };
      else if (H.eat("?")) R = {
        type: "opt",
        expr: R
      };
      else if (H.eat("{")) R = ar(H, R);
      else break;
    return R;
  }
  function yr(H) {
    /\D/.test(H.next) && H.err("Expected number, got '" + H.next + "'");
    var R = Number(H.next);
    return H.pos++, R;
  }
  function ar(H, R) {
    var b = yr(H), E = b;
    return H.eat(",") && (H.next != "}" ? E = yr(H) : E = -1), H.eat("}") || H.err("Unclosed braced range"), {
      type: "range",
      min: b,
      max: E,
      expr: R
    };
  }
  function Wr(H, R) {
    var b = H.nodeTypes, E = b[R];
    if (E) return [E];
    var B = [];
    for (var K in b) {
      var Z = b[K];
      Z.isInGroup(R) && B.push(Z);
    }
    return B.length == 0 && H.err("No node type or group '" + R + "' found"), B;
  }
  function ki(H) {
    if (H.eat("(")) {
      var R = jt(H);
      return H.eat(")") || H.err("Missing closing paren"), R;
    } else if (/\W/.test(H.next))
      H.err("Unexpected token '" + H.next + "'");
    else {
      var b = Wr(H, H.next).map(function(E) {
        return H.inline == null ? H.inline = E.isInline : H.inline != E.isInline && H.err("Mixing inline and block content"), {
          type: "name",
          value: E
        };
      });
      return H.pos++, b.length == 1 ? b[0] : {
        type: "choice",
        exprs: b
      };
    }
  }
  function Hn(H) {
    var R = [[]];
    return B(K(H, 0), b()), R;
    function b() {
      return R.push([]) - 1;
    }
    function E(Z, ae, ye) {
      var Oe = {
        term: ye,
        to: ae
      };
      return R[Z].push(Oe), Oe;
    }
    function B(Z, ae) {
      Z.forEach(function(ye) {
        return ye.to = ae;
      });
    }
    function K(Z, ae) {
      if (Z.type == "choice")
        return Z.exprs.reduce(function(Qi, Yr) {
          return Qi.concat(K(Yr, ae));
        }, []);
      if (Z.type == "seq")
        for (var ye = 0; ; ye++) {
          var Oe = K(Z.exprs[ye], ae);
          if (ye == Z.exprs.length - 1) return Oe;
          B(Oe, ae = b());
        }
      else if (Z.type == "star") {
        var je = b();
        return E(ae, je), B(K(Z.expr, je), je), [E(je)];
      } else if (Z.type == "plus") {
        var $e = b();
        return B(K(Z.expr, ae), $e), B(K(Z.expr, $e), $e), [E($e)];
      } else {
        if (Z.type == "opt")
          return [E(ae)].concat(K(Z.expr, ae));
        if (Z.type == "range") {
          for (var at = ae, Ot = 0; Ot < Z.min; Ot++) {
            var er = b();
            B(K(Z.expr, at), er), at = er;
          }
          if (Z.max == -1)
            B(K(Z.expr, at), at);
          else
            for (var hr = Z.min; hr < Z.max; hr++) {
              var Ir = b();
              E(at, Ir), B(K(Z.expr, at), Ir), at = Ir;
            }
          return [E(at)];
        } else {
          if (Z.type == "name")
            return [E(ae, void 0, Z.value)];
          throw new Error("Unknown expr type");
        }
      }
    }
  }
  function _r(H, R) {
    return R - H;
  }
  function st(H, R) {
    var b = [];
    return E(R), b.sort(_r);
    function E(B) {
      var K = H[B];
      if (K.length == 1 && !K[0].term) return E(K[0].to);
      b.push(B);
      for (var Z = 0; Z < K.length; Z++) {
        var ae = K[Z], ye = ae.term, Oe = ae.to;
        !ye && b.indexOf(Oe) == -1 && E(Oe);
      }
    }
  }
  function ut(H) {
    var R = /* @__PURE__ */ Object.create(null);
    return b(st(H, 0));
    function b(E) {
      var B = [];
      E.forEach(function(ye) {
        H[ye].forEach(function(Oe) {
          var je = Oe.term, $e = Oe.to;
          if (je) {
            for (var at, Ot = 0; Ot < B.length; Ot++) B[Ot][0] == je && (at = B[Ot][1]);
            st(H, $e).forEach(function(er) {
              at || B.push([je, at = []]), at.indexOf(er) == -1 && at.push(er);
            });
          }
        });
      });
      for (var K = R[E.join(",")] = new Tt(E.indexOf(H.length - 1) > -1), Z = 0; Z < B.length; Z++) {
        var ae = B[Z][1].sort(_r);
        K.next.push({
          type: B[Z][0],
          next: R[ae.join(",")] || b(ae)
        });
      }
      return K;
    }
  }
  function _t(H, R) {
    for (var b = 0, E = [H]; b < E.length; b++) {
      for (var B = E[b], K = !B.validEnd, Z = [], ae = 0; ae < B.next.length; ae++) {
        var ye = B.next[ae], Oe = ye.type, je = ye.next;
        Z.push(Oe.name), K && !(Oe.isText || Oe.hasRequiredAttrs()) && (K = !1), E.indexOf(je) == -1 && E.push(je);
      }
      K && R.err("Only non-generatable nodes (" + Z.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
    }
  }
  function Vt(H) {
    var R = /* @__PURE__ */ Object.create(null);
    for (var b in H) {
      var E = H[b];
      if (!E.hasDefault) return null;
      R[b] = E.default;
    }
    return R;
  }
  function Zt(H, R) {
    var b = /* @__PURE__ */ Object.create(null);
    for (var E in H) {
      var B = R && R[E];
      if (B === void 0) {
        var K = H[E];
        if (K.hasDefault) B = K.default;
        else throw new RangeError("No value supplied for attribute " + E);
      }
      b[E] = B;
    }
    return b;
  }
  function tn(H, R, b, E) {
    for (var B in R) if (!(B in H)) throw new RangeError("Unsupported attribute ".concat(B, " for ").concat(b, " of type ").concat(B));
    for (var K in H) {
      var Z = H[K];
      Z.validate && Z.validate(R[K]);
    }
  }
  function kr(H, R) {
    var b = /* @__PURE__ */ Object.create(null);
    if (R) for (var E in R) b[E] = new Vn(H, E, R[E]);
    return b;
  }
  var xr = (function() {
    function H(R, b, E) {
      U(this, H), this.name = R, this.schema = b, this.spec = E, this.markSet = null, this.groups = E.group ? E.group.split(" ") : [], this.attrs = kr(R, E.attrs), this.defaultAttrs = Vt(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(E.inline || R == "text"), this.isText = R == "text";
    }
    return te(H, [{
      key: "isInline",
      get: function() {
        return !this.isBlock;
      }
    }, {
      key: "isTextblock",
      get: function() {
        return this.isBlock && this.inlineContent;
      }
    }, {
      key: "isLeaf",
      get: function() {
        return this.contentMatch == Tt.empty;
      }
    }, {
      key: "isAtom",
      get: function() {
        return this.isLeaf || !!this.spec.atom;
      }
    }, {
      key: "isInGroup",
      value: function(b) {
        return this.groups.indexOf(b) > -1;
      }
    }, {
      key: "whitespace",
      get: function() {
        return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
      }
    }, {
      key: "hasRequiredAttrs",
      value: function() {
        for (var b in this.attrs) if (this.attrs[b].isRequired) return !0;
        return !1;
      }
    }, {
      key: "compatibleContent",
      value: function(b) {
        return this == b || this.contentMatch.compatible(b.contentMatch);
      }
    }, {
      key: "computeAttrs",
      value: function(b) {
        return !b && this.defaultAttrs ? this.defaultAttrs : Zt(this.attrs, b);
      }
    }, {
      key: "create",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, E = arguments.length > 1 ? arguments[1] : void 0, B = arguments.length > 2 ? arguments[2] : void 0;
        if (this.isText) throw new Error("NodeType.create can't construct text nodes");
        return new Pe(this, this.computeAttrs(b), Ne.from(E), et.setFrom(B));
      }
    }, {
      key: "createChecked",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, E = arguments.length > 1 ? arguments[1] : void 0, B = arguments.length > 2 ? arguments[2] : void 0;
        return E = Ne.from(E), this.checkContent(E), new Pe(this, this.computeAttrs(b), E, et.setFrom(B));
      }
    }, {
      key: "createAndFill",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, E = arguments.length > 1 ? arguments[1] : void 0, B = arguments.length > 2 ? arguments[2] : void 0;
        if (b = this.computeAttrs(b), E = Ne.from(E), E.size) {
          var K = this.contentMatch.fillBefore(E);
          if (!K) return null;
          E = K.append(E);
        }
        var Z = this.contentMatch.matchFragment(E), ae = Z && Z.fillBefore(Ne.empty, !0);
        return ae ? new Pe(this, b, E.append(ae), et.setFrom(B)) : null;
      }
    }, {
      key: "validContent",
      value: function(b) {
        var E = this.contentMatch.matchFragment(b);
        if (!E || !E.validEnd) return !1;
        for (var B = 0; B < b.childCount; B++) if (!this.allowsMarks(b.child(B).marks)) return !1;
        return !0;
      }
    }, {
      key: "checkContent",
      value: function(b) {
        if (!this.validContent(b)) throw new RangeError("Invalid content for node ".concat(this.name, ": ").concat(b.toString().slice(0, 50)));
      }
    }, {
      key: "checkAttrs",
      value: function(b) {
        tn(this.attrs, b, "node", this.name);
      }
    }, {
      key: "allowsMarkType",
      value: function(b) {
        return this.markSet == null || this.markSet.indexOf(b) > -1;
      }
    }, {
      key: "allowsMarks",
      value: function(b) {
        if (this.markSet == null) return !0;
        for (var E = 0; E < b.length; E++) if (!this.allowsMarkType(b[E].type)) return !1;
        return !0;
      }
    }, {
      key: "allowedMarks",
      value: function(b) {
        if (this.markSet == null) return b;
        for (var E, B = 0; B < b.length; B++)
          this.allowsMarkType(b[B].type) ? E && E.push(b[B]) : E || (E = b.slice(0, B));
        return E ? E.length ? E : et.none : b;
      }
    }], [{
      key: "compile",
      value: function(b, E) {
        var B = /* @__PURE__ */ Object.create(null);
        b.forEach(function(ae, ye) {
          return B[ae] = new H(ae, E, ye);
        });
        var K = E.spec.topNode || "doc";
        if (!B[K]) throw new RangeError("Schema is missing its top node type ('" + K + "')");
        if (!B.text) throw new RangeError("Every schema needs a 'text' type");
        for (var Z in B.text.attrs) throw new RangeError("The text node type should not have attributes");
        return B;
      }
    }]), H;
  })();
  function En(H, R, b) {
    var E = b.split("|");
    return function(B) {
      var K = B === null ? "null" : q(B);
      if (E.indexOf(K) < 0) throw new RangeError("Expected value of type ".concat(E, " for attribute ").concat(R, " on type ").concat(H, ", got ").concat(K));
    };
  }
  var Vn = (function() {
    function H(R, b, E) {
      U(this, H), this.hasDefault = Object.prototype.hasOwnProperty.call(E, "default"), this.default = E.default, this.validate = typeof E.validate == "string" ? En(R, b, E.validate) : E.validate;
    }
    return te(H, [{
      key: "isRequired",
      get: function() {
        return !this.hasDefault;
      }
    }]), H;
  })(), Rr = (function() {
    function H(R, b, E, B) {
      U(this, H), this.name = R, this.rank = b, this.schema = E, this.spec = B, this.attrs = kr(R, B.attrs), this.excluded = null;
      var K = Vt(this.attrs);
      this.instance = K ? new et(this, K) : null;
    }
    return te(H, [{
      key: "create",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
        return !b && this.instance ? this.instance : new et(this, Zt(this.attrs, b));
      }
    }, {
      key: "removeFromSet",
      value: function(b) {
        for (var E = 0; E < b.length; E++) b[E].type == this && (b = b.slice(0, E).concat(b.slice(E + 1)), E--);
        return b;
      }
    }, {
      key: "isInSet",
      value: function(b) {
        for (var E = 0; E < b.length; E++) if (b[E].type == this) return b[E];
      }
    }, {
      key: "checkAttrs",
      value: function(b) {
        tn(this.attrs, b, "mark", this.name);
      }
    }, {
      key: "excludes",
      value: function(b) {
        return this.excluded.indexOf(b) > -1;
      }
    }], [{
      key: "compile",
      value: function(b, E) {
        var B = /* @__PURE__ */ Object.create(null), K = 0;
        return b.forEach(function(Z, ae) {
          return B[Z] = new H(Z, K++, E, ae);
        }), B;
      }
    }]), H;
  })(), cn = (function() {
    function H(R) {
      var b = this;
      U(this, H), this.linebreakReplacement = null, this.cached = /* @__PURE__ */ Object.create(null);
      var E = this.spec = {};
      for (var B in R) E[B] = R[B];
      E.nodes = Ce.from(R.nodes), E.marks = Ce.from(R.marks || {}), this.nodes = xr.compile(this.spec.nodes, this), this.marks = Rr.compile(this.spec.marks, this);
      var K = /* @__PURE__ */ Object.create(null);
      for (var Z in this.nodes) {
        if (Z in this.marks) throw new RangeError(Z + " can not be both a node and a mark");
        var ae = this.nodes[Z], ye = ae.spec.content || "", Oe = ae.spec.marks;
        if (ae.contentMatch = K[ye] || (K[ye] = Tt.parse(ye, this.nodes)), ae.inlineContent = ae.contentMatch.inlineContent, ae.spec.linebreakReplacement) {
          if (this.linebreakReplacement) throw new RangeError("Multiple linebreak nodes defined");
          if (!ae.isInline || !ae.isLeaf) throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
          this.linebreakReplacement = ae;
        }
        ae.markSet = Oe == "_" ? null : Oe ? ri(this, Oe.split(" ")) : Oe == "" || !ae.inlineContent ? [] : null;
      }
      for (var je in this.marks) {
        var $e = this.marks[je], at = $e.spec.excludes;
        $e.excluded = at == null ? [$e] : at == "" ? [] : ri(this, at.split(" "));
      }
      this.nodeFromJSON = function(Ot) {
        return Pe.fromJSON(b, Ot);
      }, this.markFromJSON = function(Ot) {
        return et.fromJSON(b, Ot);
      }, this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
    }
    return te(H, [{
      key: "node",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, B = arguments.length > 2 ? arguments[2] : void 0, K = arguments.length > 3 ? arguments[3] : void 0;
        if (typeof b == "string") b = this.nodeType(b);
        else if (b instanceof xr) {
          if (b.schema != this) throw new RangeError("Node type from different schema used (" + b.name + ")");
        } else throw new RangeError("Invalid node type: " + b);
        return b.createChecked(E, B, K);
      }
    }, {
      key: "text",
      value: function(b, E) {
        var B = this.nodes.text;
        return new Ve(B, B.defaultAttrs, b, et.setFrom(E));
      }
    }, {
      key: "mark",
      value: function(b, E) {
        return typeof b == "string" && (b = this.marks[b]), b.create(E);
      }
    }, {
      key: "nodeType",
      value: function(b) {
        var E = this.nodes[b];
        if (!E) throw new RangeError("Unknown node type: " + b);
        return E;
      }
    }]), H;
  })();
  function ri(H, R) {
    for (var b = [], E = 0; E < R.length; E++) {
      var B = R[E], K = H.marks[B], Z = K;
      if (K)
        b.push(K);
      else
        for (var ae in H.marks) {
          var ye = H.marks[ae];
          (B == "_" || ye.spec.group && ye.spec.group.split(" ").indexOf(B) > -1) && b.push(Z = ye);
        }
      if (!Z) throw new SyntaxError("Unknown mark type: '" + R[E] + "'");
    }
    return b;
  }
  function Un(H) {
    return H.tag != null;
  }
  function rn(H) {
    return H.style != null;
  }
  var Xr = (function() {
    function H(R, b) {
      var E = this;
      U(this, H), this.schema = R, this.rules = b, this.tags = [], this.styles = [];
      var B = this.matchedStyles = [];
      b.forEach(function(K) {
        if (Un(K))
          E.tags.push(K);
        else if (rn(K)) {
          var Z = /[^=]*/.exec(K.style)[0];
          B.indexOf(Z) < 0 && B.push(Z), E.styles.push(K);
        }
      }), this.normalizeLists = !this.tags.some(function(K) {
        if (!/^(ul|ol)\b/.test(K.tag) || !K.node) return !1;
        var Z = R.nodes[K.node];
        return Z.contentMatch.matchType(Z);
      });
    }
    return te(H, [{
      key: "parse",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, B = new F(this, E, !1);
        return B.addAll(b, et.none, E.from, E.to), B.finish();
      }
    }, {
      key: "parseSlice",
      value: function(b) {
        var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, B = new F(this, E, !0);
        return B.addAll(b, et.none, E.from, E.to), Rt.maxOpen(B.finish());
      }
    }, {
      key: "matchTag",
      value: function(b, E, B) {
        for (var K = B ? this.tags.indexOf(B) + 1 : 0; K < this.tags.length; K++) {
          var Z = this.tags[K];
          if (G(b, Z.tag) && (Z.namespace === void 0 || b.namespaceURI == Z.namespace) && (!Z.context || E.matchesContext(Z.context))) {
            if (Z.getAttrs) {
              var ae = Z.getAttrs(b);
              if (ae === !1) continue;
              Z.attrs = ae || void 0;
            }
            return Z;
          }
        }
      }
    }, {
      key: "matchStyle",
      value: function(b, E, B, K) {
        for (var Z = K ? this.styles.indexOf(K) + 1 : 0; Z < this.styles.length; Z++) {
          var ae = this.styles[Z], ye = ae.style;
          if (!(ye.indexOf(b) != 0 || ae.context && !B.matchesContext(ae.context) || ye.length > b.length && (ye.charCodeAt(b.length) != 61 || ye.slice(b.length + 1) != E))) {
            if (ae.getAttrs) {
              var Oe = ae.getAttrs(E);
              if (Oe === !1) continue;
              ae.attrs = Oe || void 0;
            }
            return ae;
          }
        }
      }
    }], [{
      key: "schemaRules",
      value: function(b) {
        var E = [];
        function B(Oe) {
          for (var je = Oe.priority == null ? 50 : Oe.priority, $e = 0; $e < E.length; $e++) {
            var at = E[$e], Ot = at.priority == null ? 50 : at.priority;
            if (Ot < je) break;
          }
          E.splice($e, 0, Oe);
        }
        var K = function(je) {
          var $e = b.marks[je].spec.parseDOM;
          $e && $e.forEach(function(at) {
            B(at = re(at)), at.mark || at.ignore || at.clearMark || (at.mark = je);
          });
        };
        for (var Z in b.marks)
          K(Z);
        var ae = function(je) {
          var $e = b.nodes[je].spec.parseDOM;
          $e && $e.forEach(function(at) {
            B(at = re(at)), at.node || at.ignore || at.mark || (at.node = je);
          });
        };
        for (var ye in b.nodes)
          ae(ye);
        return E;
      }
    }, {
      key: "fromSchema",
      value: function(b) {
        return b.cached.domParser || (b.cached.domParser = new H(b, H.schemaRules(b)));
      }
    }]), H;
  })(), gn = {
    address: !0,
    article: !0,
    aside: !0,
    blockquote: !0,
    canvas: !0,
    dd: !0,
    div: !0,
    dl: !0,
    fieldset: !0,
    figcaption: !0,
    figure: !0,
    footer: !0,
    form: !0,
    h1: !0,
    h2: !0,
    h3: !0,
    h4: !0,
    h5: !0,
    h6: !0,
    header: !0,
    hgroup: !0,
    hr: !0,
    li: !0,
    noscript: !0,
    ol: !0,
    output: !0,
    p: !0,
    pre: !0,
    section: !0,
    table: !0,
    tfoot: !0,
    ul: !0
  }, qr = {
    head: !0,
    noscript: !0,
    object: !0,
    script: !0,
    style: !0,
    title: !0
  }, $n = {
    ol: !0,
    ul: !0
  }, wr = 1, jr = 2, Q = 4;
  function X(H, R, b) {
    return R != null ? (R ? wr : 0) | (R === "full" ? jr : 0) : H && H.whitespace == "pre" ? wr | jr : b & ~Q;
  }
  var z = (function() {
    function H(R, b, E, B, K, Z) {
      U(this, H), this.type = R, this.attrs = b, this.marks = E, this.solid = B, this.options = Z, this.content = [], this.activeMarks = et.none, this.match = K || (Z & Q ? null : R.contentMatch);
    }
    return te(H, [{
      key: "findWrapping",
      value: function(b) {
        if (!this.match) {
          if (!this.type) return [];
          var E = this.type.contentMatch.fillBefore(Ne.from(b));
          if (E)
            this.match = this.type.contentMatch.matchFragment(E);
          else {
            var B = this.type.contentMatch, K;
            return (K = B.findWrapping(b.type)) ? (this.match = B, K) : null;
          }
        }
        return this.match.findWrapping(b.type);
      }
    }, {
      key: "finish",
      value: function(b) {
        if (!(this.options & wr)) {
          var E = this.content[this.content.length - 1], B;
          if (E && E.isText && (B = /[ \t\r\n\u000c]+$/.exec(E.text))) {
            var K = E;
            E.text.length == B[0].length ? this.content.pop() : this.content[this.content.length - 1] = K.withText(K.text.slice(0, K.text.length - B[0].length));
          }
        }
        var Z = Ne.from(this.content);
        return !b && this.match && (Z = Z.append(this.match.fillBefore(Ne.empty, !0))), this.type ? this.type.create(this.attrs, Z, this.marks) : Z;
      }
    }, {
      key: "inlineContext",
      value: function(b) {
        return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : b.parentNode && !gn.hasOwnProperty(b.parentNode.nodeName.toLowerCase());
      }
    }]), H;
  })(), F = (function() {
    function H(R, b, E) {
      U(this, H), this.parser = R, this.options = b, this.isOpen = E, this.open = 0, this.localPreserveWS = !1;
      var B = b.topNode, K, Z = X(null, b.preserveWhitespace, 0) | (E ? Q : 0);
      B ? K = new z(B.type, B.attrs, et.none, !0, b.topMatch || B.type.contentMatch, Z) : E ? K = new z(null, null, et.none, !0, null, Z) : K = new z(R.schema.topNodeType, null, et.none, !0, null, Z), this.nodes = [K], this.find = b.findPositions, this.needsBlock = !1;
    }
    return te(H, [{
      key: "top",
      get: function() {
        return this.nodes[this.open];
      }
    }, {
      key: "addDOM",
      value: function(b, E) {
        b.nodeType == 3 ? this.addTextNode(b, E) : b.nodeType == 1 && this.addElement(b, E);
      }
    }, {
      key: "addTextNode",
      value: function(b, E) {
        var B = b.nodeValue, K = this.top, Z = K.options & jr ? "full" : this.localPreserveWS || (K.options & wr) > 0, ae = this.parser.schema;
        if (Z === "full" || K.inlineContext(b) || /[^ \t\r\n\u000c]/.test(B)) {
          if (Z)
            if (Z === "full")
              B = B.replace(/\r\n?/g, `
`);
            else if (ae.linebreakReplacement && /[\r\n]/.test(B) && this.top.findWrapping(ae.linebreakReplacement.create())) {
              for (var je = B.split(/\r?\n|\r/), $e = 0; $e < je.length; $e++)
                $e && this.insertNode(ae.linebreakReplacement.create(), E, !0), je[$e] && this.insertNode(ae.text(je[$e]), E, !/\S/.test(je[$e]));
              B = "";
            } else
              B = B.replace(/\r?\n|\r/g, " ");
          else if (B = B.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(B) && this.open == this.nodes.length - 1) {
            var ye = K.content[K.content.length - 1], Oe = b.previousSibling;
            (!ye || Oe && Oe.nodeName == "BR" || ye.isText && /[ \t\r\n\u000c]$/.test(ye.text)) && (B = B.slice(1));
          }
          B && this.insertNode(ae.text(B), E, !/\S/.test(B)), this.findInText(b);
        } else
          this.findInside(b);
      }
    }, {
      key: "addElement",
      value: function(b, E, B) {
        var K = this.localPreserveWS, Z = this.top;
        (b.tagName == "PRE" || /pre/.test(b.style && b.style.whiteSpace)) && (this.localPreserveWS = !0);
        var ae = b.nodeName.toLowerCase(), ye;
        $n.hasOwnProperty(ae) && this.parser.normalizeLists && V(b);
        var Oe = this.options.ruleFromNode && this.options.ruleFromNode(b) || (ye = this.parser.matchTag(b, this, B));
        e: if (Oe ? Oe.ignore : qr.hasOwnProperty(ae))
          this.findInside(b), this.ignoreFallback(b, E);
        else if (!Oe || Oe.skip || Oe.closeParent) {
          Oe && Oe.closeParent ? this.open = Math.max(0, this.open - 1) : Oe && Oe.skip.nodeType && (b = Oe.skip);
          var je, $e = this.needsBlock;
          if (gn.hasOwnProperty(ae))
            Z.content.length && Z.content[0].isInline && this.open && (this.open--, Z = this.top), je = !0, Z.type || (this.needsBlock = !0);
          else if (!b.firstChild) {
            this.leafFallback(b, E);
            break e;
          }
          var at = Oe && Oe.skip ? E : this.readStyles(b, E);
          at && this.addAll(b, at), je && this.sync(Z), this.needsBlock = $e;
        } else {
          var Ot = this.readStyles(b, E);
          Ot && this.addElementByRule(b, Oe, Ot, Oe.consuming === !1 ? ye : void 0);
        }
        this.localPreserveWS = K;
      }
    }, {
      key: "leafFallback",
      value: function(b, E) {
        b.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(b.ownerDocument.createTextNode(`
`), E);
      }
    }, {
      key: "ignoreFallback",
      value: function(b, E) {
        b.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), E, !0);
      }
    }, {
      key: "readStyles",
      value: function(b, E) {
        var B = this, K = b.style;
        if (K && K.length) for (var Z = 0; Z < this.parser.matchedStyles.length; Z++) {
          var ae = this.parser.matchedStyles[Z], ye = K.getPropertyValue(ae);
          if (ye) {
            for (var Oe = function(Ot) {
              var er = B.parser.matchStyle(ae, ye, B, Ot);
              if (!er)
                return $e = Ot, 0;
              if (er.ignore) return {
                v: null
              };
              if (er.clearMark ? E = E.filter(function(hr) {
                return !er.clearMark(hr);
              }) : E = E.concat(B.parser.schema.marks[er.mark].create(er.attrs)), er.consuming === !1) Ot = er;
              else
                return $e = Ot, 0;
              $e = Ot;
            }, je, $e = void 0; je = Oe($e), je !== 0; )
              if (je) return je.v;
          }
        }
        return E;
      }
    }, {
      key: "addElementByRule",
      value: function(b, E, B, K) {
        var Z = this, ae, ye;
        if (E.node)
          if (ye = this.parser.schema.nodes[E.node], ye.isLeaf)
            this.insertNode(ye.create(E.attrs), B, b.nodeName == "BR") || this.leafFallback(b, B);
          else {
            var Oe = this.enter(ye, E.attrs || null, B, E.preserveWhitespace);
            Oe && (ae = !0, B = Oe);
          }
        else {
          var je = this.parser.schema.marks[E.mark];
          B = B.concat(je.create(E.attrs));
        }
        var $e = this.top;
        if (ye && ye.isLeaf)
          this.findInside(b);
        else if (K)
          this.addElement(b, B, K);
        else if (E.getContent)
          this.findInside(b), E.getContent(b, this.parser.schema).forEach(function(Ot) {
            return Z.insertNode(Ot, B, !1);
          });
        else {
          var at = b;
          typeof E.contentElement == "string" ? at = b.querySelector(E.contentElement) : typeof E.contentElement == "function" ? at = E.contentElement(b) : E.contentElement && (at = E.contentElement), this.findAround(b, at, !0), this.addAll(at, B), this.findAround(b, at, !1);
        }
        ae && this.sync($e) && this.open--;
      }
    }, {
      key: "addAll",
      value: function(b, E, B, K) {
        for (var Z = B || 0, ae = B ? b.childNodes[B] : b.firstChild, ye = K == null ? null : b.childNodes[K]; ae != ye; ae = ae.nextSibling, ++Z)
          this.findAtPoint(b, Z), this.addDOM(ae, E);
        this.findAtPoint(b, Z);
      }
    }, {
      key: "findPlace",
      value: function(b, E, B) {
        for (var K, Z, ae = this.open, ye = 0; ae >= 0; ae--) {
          var Oe = this.nodes[ae], je = Oe.findWrapping(b);
          if (je && (!K || K.length > je.length + ye) && (K = je, Z = Oe, !je.length))
            break;
          if (Oe.solid) {
            if (B) break;
            ye += 2;
          }
        }
        if (!K) return null;
        this.sync(Z);
        for (var $e = 0; $e < K.length; $e++) E = this.enterInner(K[$e], null, E, !1);
        return E;
      }
    }, {
      key: "insertNode",
      value: function(b, E, B) {
        if (b.isInline && this.needsBlock && !this.top.type) {
          var K = this.textblockFromContext();
          K && (E = this.enterInner(K, null, E));
        }
        var Z = this.findPlace(b, E, B);
        if (Z) {
          this.closeExtra();
          var ae = this.top;
          ae.match && (ae.match = ae.match.matchType(b.type));
          var ye = et.none, Oe = r(Z.concat(b.marks)), je;
          try {
            for (Oe.s(); !(je = Oe.n()).done; ) {
              var $e = je.value;
              (ae.type ? ae.type.allowsMarkType($e.type) : Ee($e.type, b.type)) && (ye = $e.addToSet(ye));
            }
          } catch (at) {
            Oe.e(at);
          } finally {
            Oe.f();
          }
          return ae.content.push(b.mark(ye)), !0;
        }
        return !1;
      }
    }, {
      key: "enter",
      value: function(b, E, B, K) {
        var Z = this.findPlace(b.create(E), B, !1);
        return Z && (Z = this.enterInner(b, E, B, !0, K)), Z;
      }
    }, {
      key: "enterInner",
      value: function(b, E, B) {
        var K = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, Z = arguments.length > 4 ? arguments[4] : void 0;
        this.closeExtra();
        var ae = this.top;
        ae.match = ae.match && ae.match.matchType(b);
        var ye = X(b, Z, ae.options);
        ae.options & Q && ae.content.length == 0 && (ye |= Q);
        var Oe = et.none;
        return B = B.filter(function(je) {
          return (ae.type ? ae.type.allowsMarkType(je.type) : Ee(je.type, b)) ? (Oe = je.addToSet(Oe), !1) : !0;
        }), this.nodes.push(new z(b, E, Oe, K, null, ye)), this.open++, B;
      }
    }, {
      key: "closeExtra",
      value: function() {
        var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, E = this.nodes.length - 1;
        if (E > this.open) {
          for (; E > this.open; E--) this.nodes[E - 1].content.push(this.nodes[E].finish(b));
          this.nodes.length = this.open + 1;
        }
      }
    }, {
      key: "finish",
      value: function() {
        return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
      }
    }, {
      key: "sync",
      value: function(b) {
        for (var E = this.open; E >= 0; E--) {
          if (this.nodes[E] == b)
            return this.open = E, !0;
          this.localPreserveWS && (this.nodes[E].options |= wr);
        }
        return !1;
      }
    }, {
      key: "currentPos",
      get: function() {
        this.closeExtra();
        for (var b = 0, E = this.open; E >= 0; E--) {
          for (var B = this.nodes[E].content, K = B.length - 1; K >= 0; K--) b += B[K].nodeSize;
          E && b++;
        }
        return b;
      }
    }, {
      key: "findAtPoint",
      value: function(b, E) {
        if (this.find) for (var B = 0; B < this.find.length; B++)
          this.find[B].node == b && this.find[B].offset == E && (this.find[B].pos = this.currentPos);
      }
    }, {
      key: "findInside",
      value: function(b) {
        if (this.find) for (var E = 0; E < this.find.length; E++)
          this.find[E].pos == null && b.nodeType == 1 && b.contains(this.find[E].node) && (this.find[E].pos = this.currentPos);
      }
    }, {
      key: "findAround",
      value: function(b, E, B) {
        if (b != E && this.find) {
          for (var K = 0; K < this.find.length; K++)
            if (this.find[K].pos == null && b.nodeType == 1 && b.contains(this.find[K].node)) {
              var Z = E.compareDocumentPosition(this.find[K].node);
              Z & (B ? 2 : 4) && (this.find[K].pos = this.currentPos);
            }
        }
      }
    }, {
      key: "findInText",
      value: function(b) {
        if (this.find) for (var E = 0; E < this.find.length; E++)
          this.find[E].node == b && (this.find[E].pos = this.currentPos - (b.nodeValue.length - this.find[E].offset));
      }
    }, {
      key: "matchesContext",
      value: function(b) {
        var E = this;
        if (b.indexOf("|") > -1) return b.split(/\s*\|\s*/).some(this.matchesContext, this);
        var B = b.split("/"), K = this.options.context, Z = !this.isOpen && (!K || K.parent.type == this.nodes[0].type), ae = -(K ? K.depth + 1 : 0) + (Z ? 0 : 1), ye = function Oe(je, $e) {
          for (; je >= 0; je--) {
            var at = B[je];
            if (at == "") {
              if (je == B.length - 1 || je == 0) continue;
              for (; $e >= ae; $e--) if (Oe(je - 1, $e)) return !0;
              return !1;
            } else {
              var Ot = $e > 0 || $e == 0 && Z ? E.nodes[$e].type : K && $e >= ae ? K.node($e - ae).type : null;
              if (!Ot || Ot.name != at && !Ot.isInGroup(at)) return !1;
              $e--;
            }
          }
          return !0;
        };
        return ye(B.length - 1, this.open);
      }
    }, {
      key: "textblockFromContext",
      value: function() {
        var b = this.options.context;
        if (b) for (var E = b.depth; E >= 0; E--) {
          var B = b.node(E).contentMatchAt(b.indexAfter(E)).defaultType;
          if (B && B.isTextblock && B.defaultAttrs) return B;
        }
        for (var K in this.parser.schema.nodes) {
          var Z = this.parser.schema.nodes[K];
          if (Z.isTextblock && Z.defaultAttrs) return Z;
        }
      }
    }]), H;
  })();
  function V(H) {
    for (var R = H.firstChild, b = null; R; R = R.nextSibling) {
      var E = R.nodeType == 1 ? R.nodeName.toLowerCase() : null;
      E && $n.hasOwnProperty(E) && b ? (b.appendChild(R), R = b) : E == "li" ? b = R : E && (b = null);
    }
  }
  function G(H, R) {
    return (H.matches || H.msMatchesSelector || H.webkitMatchesSelector || H.mozMatchesSelector).call(H, R);
  }
  function re(H) {
    var R = {};
    for (var b in H) R[b] = H[b];
    return R;
  }
  function Ee(H, R) {
    var b = R.schema.nodes, E = function() {
      var ae = b[K];
      if (!ae.allowsMarkType(H)) return 0;
      var ye = [], Oe = function je($e) {
        ye.push($e);
        for (var at = 0; at < $e.edgeCount; at++) {
          var Ot = $e.edge(at), er = Ot.type, hr = Ot.next;
          if (er == R || ye.indexOf(hr) < 0 && je(hr)) return !0;
        }
      };
      if (Oe(ae.contentMatch)) return {
        v: !0
      };
    }, B;
    for (var K in b)
      if (B = E(), B !== 0 && B)
        return B.v;
  }
  var Be = (function() {
    function H(R, b) {
      U(this, H), this.nodes = R, this.marks = b;
    }
    return te(H, [{
      key: "serializeFragment",
      value: function(b) {
        var E = this, B = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, K = arguments.length > 2 ? arguments[2] : void 0;
        K || (K = ne(B).createDocumentFragment());
        var Z = K, ae = [];
        return b.forEach(function(ye) {
          if (ae.length || ye.marks.length) {
            for (var Oe = 0, je = 0; Oe < ae.length && je < ye.marks.length; ) {
              var $e = ye.marks[je];
              if (!E.marks[$e.type.name]) {
                je++;
                continue;
              }
              if (!$e.eq(ae[Oe][0]) || $e.type.spec.spanning === !1) break;
              Oe++, je++;
            }
            for (; Oe < ae.length; ) Z = ae.pop()[1];
            for (; je < ye.marks.length; ) {
              var at = ye.marks[je++], Ot = E.serializeMark(at, ye.isInline, B);
              Ot && (ae.push([at, Z]), Z.appendChild(Ot.dom), Z = Ot.contentDOM || Ot.dom);
            }
          }
          Z.appendChild(E.serializeNodeInner(ye, B));
        }), K;
      }
    }, {
      key: "serializeNodeInner",
      value: function(b, E) {
        var B = Nt(ne(E), this.nodes[b.type.name](b), null, b.attrs), K = B.dom, Z = B.contentDOM;
        if (Z) {
          if (b.isLeaf) throw new RangeError("Content hole not allowed in a leaf node spec");
          this.serializeFragment(b.content, E, Z);
        }
        return K;
      }
    }, {
      key: "serializeNode",
      value: function(b) {
        for (var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, B = this.serializeNodeInner(b, E), K = b.marks.length - 1; K >= 0; K--) {
          var Z = this.serializeMark(b.marks[K], b.isInline, E);
          Z && ((Z.contentDOM || Z.dom).appendChild(B), B = Z.dom);
        }
        return B;
      }
    }, {
      key: "serializeMark",
      value: function(b, E) {
        var B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, K = this.marks[b.type.name];
        return K && Nt(ne(B), K(b, E), null, b.attrs);
      }
    }], [{
      key: "renderSpec",
      value: function(b, E) {
        var B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, K = arguments.length > 3 ? arguments[3] : void 0;
        return Nt(b, E, B, K);
      }
    }, {
      key: "fromSchema",
      value: function(b) {
        return b.cached.domSerializer || (b.cached.domSerializer = new H(this.nodesFromSchema(b), this.marksFromSchema(b)));
      }
    }, {
      key: "nodesFromSchema",
      value: function(b) {
        var E = he(b.nodes);
        return E.text || (E.text = function(B) {
          return B.text;
        }), E;
      }
    }, {
      key: "marksFromSchema",
      value: function(b) {
        return he(b.marks);
      }
    }]), H;
  })();
  function he(H) {
    var R = {};
    for (var b in H) {
      var E = H[b].spec.toDOM;
      E && (R[b] = E);
    }
    return R;
  }
  function ne(H) {
    return H.document || window.document;
  }
  var Ae = /* @__PURE__ */ new WeakMap();
  function Fe(H) {
    var R = Ae.get(H);
    return R === void 0 && Ae.set(H, R = it(H)), R;
  }
  function it(H) {
    var R = null;
    function b(E) {
      if (E && q(E) == "object")
        if (Array.isArray(E))
          if (typeof E[0] == "string")
            R || (R = []), R.push(E);
          else
            for (var B = 0; B < E.length; B++) b(E[B]);
        else
          for (var K in E) b(E[K]);
    }
    return b(H), R;
  }
  function Nt(H, R, b, E) {
    if (typeof R == "string") return {
      dom: H.createTextNode(R)
    };
    if (R.nodeType != null) return {
      dom: R
    };
    if (R.dom && R.dom.nodeType != null) return R;
    var B = R[0], K;
    if (typeof B != "string") throw new RangeError("Invalid array passed to renderSpec");
    if (E && (K = Fe(E)) && K.indexOf(R) > -1) throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
    var Z = B.indexOf(" ");
    Z > 0 && (b = B.slice(0, Z), B = B.slice(Z + 1));
    var ae, ye = b ? H.createElementNS(b, B) : H.createElement(B), Oe = R[1], je = 1;
    if (Oe && q(Oe) == "object" && Oe.nodeType == null && !Array.isArray(Oe)) {
      je = 2;
      for (var $e in Oe) if (Oe[$e] != null) {
        var at = $e.indexOf(" ");
        at > 0 ? ye.setAttributeNS($e.slice(0, at), $e.slice(at + 1), Oe[$e]) : $e == "style" && ye.style ? ye.style.cssText = Oe[$e] : ye.setAttribute($e, Oe[$e]);
      }
    }
    for (var Ot = je; Ot < R.length; Ot++) {
      var er = R[Ot];
      if (er === 0) {
        if (Ot < R.length - 1 || Ot > je) throw new RangeError("Content hole must be the only child of its parent node");
        return {
          dom: ye,
          contentDOM: ye
        };
      } else {
        var hr = Nt(H, er, b, E), Ir = hr.dom, Qi = hr.contentDOM;
        if (ye.appendChild(Ir), Qi) {
          if (ae) throw new RangeError("Multiple content holes");
          ae = Qi;
        }
      }
    }
    return {
      dom: ye,
      contentDOM: ae
    };
  }
  return Oi.ContentMatch = Tt, Oi.DOMParser = Xr, Oi.DOMSerializer = Be, Oi.Fragment = Ne, Oi.Mark = et, Oi.MarkType = Rr, Oi.Node = Pe, Oi.NodeRange = ge, Oi.NodeType = xr, Oi.ReplaceError = Ht, Oi.ResolvedPos = $t, Oi.Schema = cn, Oi.Slice = Rt, Oi;
}
var Zy = {}, PT;
function qk() {
  return PT || (PT = 1, (function(r) {
    function e(Q) {
      var X = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
      return e = function(F) {
        if (F === null || !n(F)) return F;
        if (typeof F != "function")
          throw new TypeError("Super expression must either be null or a function");
        if (typeof X < "u") {
          if (X.has(F)) return X.get(F);
          X.set(F, V);
        }
        function V() {
          return t(F, arguments, y(this).constructor);
        }
        return V.prototype = Object.create(F.prototype, { constructor: { value: V, enumerable: !1, writable: !0, configurable: !0 } }), a(V, F);
      }, e(Q);
    }
    function t(Q, X, z) {
      return p() ? t = Reflect.construct.bind() : t = function(V, G, re) {
        var Ee = [null];
        Ee.push.apply(Ee, G);
        var Be = Function.bind.apply(V, Ee), he = new Be();
        return re && a(he, re.prototype), he;
      }, t.apply(null, arguments);
    }
    function n(Q) {
      try {
        return Function.toString.call(Q).indexOf("[native code]") !== -1;
      } catch {
        return typeof Q == "function";
      }
    }
    function i(Q, X) {
      if (typeof X != "function" && X !== null)
        throw new TypeError("Super expression must either be null or a function");
      Q.prototype = Object.create(X && X.prototype, { constructor: { value: Q, writable: !0, configurable: !0 } }), Object.defineProperty(Q, "prototype", { writable: !1 }), X && a(Q, X);
    }
    function a(Q, X) {
      return a = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(F, V) {
        return F.__proto__ = V, F;
      }, a(Q, X);
    }
    function s(Q) {
      var X = p();
      return function() {
        var F = y(Q), V;
        if (X) {
          var G = y(this).constructor;
          V = Reflect.construct(F, arguments, G);
        } else
          V = F.apply(this, arguments);
        return u(this, V);
      };
    }
    function u(Q, X) {
      if (X && (T(X) === "object" || typeof X == "function"))
        return X;
      if (X !== void 0)
        throw new TypeError("Derived constructors may only return object or undefined");
      return f(Q);
    }
    function f(Q) {
      if (Q === void 0)
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      return Q;
    }
    function p() {
      if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
      if (typeof Proxy == "function") return !0;
      try {
        return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
        })), !0;
      } catch {
        return !1;
      }
    }
    function y(Q) {
      return y = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(z) {
        return z.__proto__ || Object.getPrototypeOf(z);
      }, y(Q);
    }
    function T(Q) {
      "@babel/helpers - typeof";
      return T = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(X) {
        return typeof X;
      } : function(X) {
        return X && typeof Symbol == "function" && X.constructor === Symbol && X !== Symbol.prototype ? "symbol" : typeof X;
      }, T(Q);
    }
    function N(Q, X) {
      if (!(Q instanceof X))
        throw new TypeError("Cannot call a class as a function");
    }
    function O(Q, X) {
      for (var z = 0; z < X.length; z++) {
        var F = X[z];
        F.enumerable = F.enumerable || !1, F.configurable = !0, "value" in F && (F.writable = !0), Object.defineProperty(Q, q(F.key), F);
      }
    }
    function A(Q, X, z) {
      return X && O(Q.prototype, X), z && O(Q, z), Object.defineProperty(Q, "prototype", { writable: !1 }), Q;
    }
    function q(Q) {
      var X = U(Q, "string");
      return T(X) === "symbol" ? X : String(X);
    }
    function U(Q, X) {
      if (T(Q) !== "object" || Q === null) return Q;
      var z = Q[Symbol.toPrimitive];
      if (z !== void 0) {
        var F = z.call(Q, X);
        if (T(F) !== "object") return F;
        throw new TypeError("@@toPrimitive must return a primitive value.");
      }
      return String(Q);
    }
    var j = /* @__PURE__ */ Wm(), te = 65535, se = Math.pow(2, 16);
    function me(Q, X) {
      return Q + X * se;
    }
    function Ce(Q) {
      return Q & te;
    }
    function pe(Q) {
      return (Q - (Q & te)) / se;
    }
    var ke = 1, Ne = 2, ze = 4, Ze = 8, At = (function() {
      function Q(X, z, F) {
        N(this, Q), this.pos = X, this.delInfo = z, this.recover = F;
      }
      return A(Q, [{
        key: "deleted",
        get: function() {
          return (this.delInfo & Ze) > 0;
        }
      }, {
        key: "deletedBefore",
        get: function() {
          return (this.delInfo & (ke | ze)) > 0;
        }
      }, {
        key: "deletedAfter",
        get: function() {
          return (this.delInfo & (Ne | ze)) > 0;
        }
      }, {
        key: "deletedAcross",
        get: function() {
          return (this.delInfo & ze) > 0;
        }
      }]), Q;
    })(), et = (function() {
      function Q(X) {
        var z = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
        if (N(this, Q), this.ranges = X, this.inverted = z, !X.length && Q.empty) return Q.empty;
      }
      return A(Q, [{
        key: "recover",
        value: function(z) {
          var F = 0, V = Ce(z);
          if (!this.inverted) for (var G = 0; G < V; G++) F += this.ranges[G * 3 + 2] - this.ranges[G * 3 + 1];
          return this.ranges[V * 3] + F + pe(z);
        }
      }, {
        key: "mapResult",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
          return this._map(z, F, !1);
        }
      }, {
        key: "map",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
          return this._map(z, F, !0);
        }
      }, {
        key: "_map",
        value: function(z, F, V) {
          for (var G = 0, re = this.inverted ? 2 : 1, Ee = this.inverted ? 1 : 2, Be = 0; Be < this.ranges.length; Be += 3) {
            var he = this.ranges[Be] - (this.inverted ? G : 0);
            if (he > z) break;
            var ne = this.ranges[Be + re], Ae = this.ranges[Be + Ee], Fe = he + ne;
            if (z <= Fe) {
              var it = ne ? z == he ? -1 : z == Fe ? 1 : F : F, Nt = he + G + (it < 0 ? 0 : Ae);
              if (V) return Nt;
              var H = z == (F < 0 ? he : Fe) ? null : me(Be / 3, z - he), R = z == he ? Ne : z == Fe ? ke : ze;
              return (F < 0 ? z != he : z != Fe) && (R |= Ze), new At(Nt, R, H);
            }
            G += Ae - ne;
          }
          return V ? z + G : new At(z + G, 0, null);
        }
      }, {
        key: "touches",
        value: function(z, F) {
          for (var V = 0, G = Ce(F), re = this.inverted ? 2 : 1, Ee = this.inverted ? 1 : 2, Be = 0; Be < this.ranges.length; Be += 3) {
            var he = this.ranges[Be] - (this.inverted ? V : 0);
            if (he > z) break;
            var ne = this.ranges[Be + re], Ae = he + ne;
            if (z <= Ae && Be == G * 3) return !0;
            V += this.ranges[Be + Ee] - ne;
          }
          return !1;
        }
      }, {
        key: "forEach",
        value: function(z) {
          for (var F = this.inverted ? 2 : 1, V = this.inverted ? 1 : 2, G = 0, re = 0; G < this.ranges.length; G += 3) {
            var Ee = this.ranges[G], Be = Ee - (this.inverted ? re : 0), he = Ee + (this.inverted ? 0 : re), ne = this.ranges[G + F], Ae = this.ranges[G + V];
            z(Be, Be + ne, he, he + Ae), re += Ae - ne;
          }
        }
      }, {
        key: "invert",
        value: function() {
          return new Q(this.ranges, !this.inverted);
        }
      }, {
        key: "toString",
        value: function() {
          return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
        }
      }], [{
        key: "offset",
        value: function(z) {
          return z == 0 ? Q.empty : new Q(z < 0 ? [0, -z, 0] : [0, 0, z]);
        }
      }]), Q;
    })();
    et.empty = new et([]);
    var Ht = (function() {
      function Q(X, z) {
        var F = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, V = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : X ? X.length : 0;
        N(this, Q), this.mirror = z, this.from = F, this.to = V, this._maps = X || [], this.ownData = !(X || z);
      }
      return A(Q, [{
        key: "maps",
        get: function() {
          return this._maps;
        }
      }, {
        key: "slice",
        value: function() {
          var z = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.maps.length;
          return new Q(this._maps, this.mirror, z, F);
        }
      }, {
        key: "appendMap",
        value: function(z, F) {
          this.ownData || (this._maps = this._maps.slice(), this.mirror = this.mirror && this.mirror.slice(), this.ownData = !0), this.to = this._maps.push(z), F != null && this.setMirror(this._maps.length - 1, F);
        }
      }, {
        key: "appendMapping",
        value: function(z) {
          for (var F = 0, V = this._maps.length; F < z._maps.length; F++) {
            var G = z.getMirror(F);
            this.appendMap(z._maps[F], G != null && G < F ? V + G : void 0);
          }
        }
      }, {
        key: "getMirror",
        value: function(z) {
          if (this.mirror) {
            for (var F = 0; F < this.mirror.length; F++) if (this.mirror[F] == z) return this.mirror[F + (F % 2 ? -1 : 1)];
          }
        }
      }, {
        key: "setMirror",
        value: function(z, F) {
          this.mirror || (this.mirror = []), this.mirror.push(z, F);
        }
      }, {
        key: "appendMappingInverted",
        value: function(z) {
          for (var F = z.maps.length - 1, V = this._maps.length + z._maps.length; F >= 0; F--) {
            var G = z.getMirror(F);
            this.appendMap(z._maps[F].invert(), G != null && G > F ? V - G - 1 : void 0);
          }
        }
      }, {
        key: "invert",
        value: function() {
          var z = new Q();
          return z.appendMappingInverted(this), z;
        }
      }, {
        key: "map",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
          if (this.mirror) return this._map(z, F, !0);
          for (var V = this.from; V < this.to; V++) z = this._maps[V].map(z, F);
          return z;
        }
      }, {
        key: "mapResult",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
          return this._map(z, F, !1);
        }
      }, {
        key: "_map",
        value: function(z, F, V) {
          for (var G = 0, re = this.from; re < this.to; re++) {
            var Ee = this._maps[re], Be = Ee.mapResult(z, F);
            if (Be.recover != null) {
              var he = this.getMirror(re);
              if (he != null && he > re && he < this.to) {
                re = he, z = this._maps[he].recover(Be.recover);
                continue;
              }
            }
            G |= Be.delInfo, z = Be.pos;
          }
          return V ? z : new At(z, G, null);
        }
      }]), Q;
    })(), Rt = /* @__PURE__ */ Object.create(null), Ut = (function() {
      function Q() {
        N(this, Q);
      }
      return A(Q, [{
        key: "getMap",
        value: function() {
          return et.empty;
        }
      }, {
        key: "merge",
        value: function(z) {
          return null;
        }
      }], [{
        key: "fromJSON",
        value: function(z, F) {
          if (!F || !F.stepType) throw new RangeError("Invalid input for Step.fromJSON");
          var V = Rt[F.stepType];
          if (!V) throw new RangeError("No step type ".concat(F.stepType, " defined"));
          return V.fromJSON(z, F);
        }
      }, {
        key: "jsonID",
        value: function(z, F) {
          if (z in Rt) throw new RangeError("Duplicate use of step JSON ID " + z);
          return Rt[z] = F, F.prototype.jsonID = z, F;
        }
      }]), Q;
    })(), yt = (function() {
      function Q(X, z) {
        N(this, Q), this.doc = X, this.failed = z;
      }
      return A(Q, null, [{
        key: "ok",
        value: function(z) {
          return new Q(z, null);
        }
      }, {
        key: "fail",
        value: function(z) {
          return new Q(null, z);
        }
      }, {
        key: "fromReplace",
        value: function(z, F, V, G) {
          try {
            return Q.ok(z.replace(F, V, G));
          } catch (re) {
            if (re instanceof j.ReplaceError) return Q.fail(re.message);
            throw re;
          }
        }
      }]), Q;
    })();
    function It(Q, X, z) {
      for (var F = [], V = 0; V < Q.childCount; V++) {
        var G = Q.child(V);
        G.content.size && (G = G.copy(It(G.content, X, G))), G.isInline && (G = X(G, z, V)), F.push(G);
      }
      return j.Fragment.fromArray(F);
    }
    var Ke = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V, G) {
        var re;
        return N(this, z), re = X.call(this), re.from = F, re.to = V, re.mark = G, re;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          var G = this, re = V.slice(this.from, this.to), Ee = V.resolve(this.from), Be = Ee.node(Ee.sharedDepth(this.to)), he = new j.Slice(It(re.content, function(ne, Ae) {
            return !ne.isAtom || !Ae.type.allowsMarkType(G.mark.type) ? ne : ne.mark(G.mark.addToSet(ne.marks));
          }, Be), re.openStart, re.openEnd);
          return yt.fromReplace(V, this.from, this.to, he);
        }
      }, {
        key: "invert",
        value: function() {
          return new ct(this.from, this.to, this.mark);
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.from, 1), re = V.mapResult(this.to, -1);
          return G.deleted && re.deleted || G.pos >= re.pos ? null : new z(G.pos, re.pos, this.mark);
        }
      }, {
        key: "merge",
        value: function(V) {
          return V instanceof z && V.mark.eq(this.mark) && this.from <= V.to && this.to >= V.from ? new z(Math.min(this.from, V.from), Math.max(this.to, V.to), this.mark) : null;
        }
      }, {
        key: "toJSON",
        value: function() {
          return {
            stepType: "addMark",
            mark: this.mark.toJSON(),
            from: this.from,
            to: this.to
          };
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.from != "number" || typeof G.to != "number") throw new RangeError("Invalid input for AddMarkStep.fromJSON");
          return new z(G.from, G.to, V.markFromJSON(G.mark));
        }
      }]), z;
    })(Ut);
    Ut.jsonID("addMark", Ke);
    var ct = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V, G) {
        var re;
        return N(this, z), re = X.call(this), re.from = F, re.to = V, re.mark = G, re;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          var G = this, re = V.slice(this.from, this.to), Ee = new j.Slice(It(re.content, function(Be) {
            return Be.mark(G.mark.removeFromSet(Be.marks));
          }, V), re.openStart, re.openEnd);
          return yt.fromReplace(V, this.from, this.to, Ee);
        }
      }, {
        key: "invert",
        value: function() {
          return new Ke(this.from, this.to, this.mark);
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.from, 1), re = V.mapResult(this.to, -1);
          return G.deleted && re.deleted || G.pos >= re.pos ? null : new z(G.pos, re.pos, this.mark);
        }
      }, {
        key: "merge",
        value: function(V) {
          return V instanceof z && V.mark.eq(this.mark) && this.from <= V.to && this.to >= V.from ? new z(Math.min(this.from, V.from), Math.max(this.to, V.to), this.mark) : null;
        }
      }, {
        key: "toJSON",
        value: function() {
          return {
            stepType: "removeMark",
            mark: this.mark.toJSON(),
            from: this.from,
            to: this.to
          };
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.from != "number" || typeof G.to != "number") throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
          return new z(G.from, G.to, V.markFromJSON(G.mark));
        }
      }]), z;
    })(Ut);
    Ut.jsonID("removeMark", ct);
    var He = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V) {
        var G;
        return N(this, z), G = X.call(this), G.pos = F, G.mark = V, G;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          var G = V.nodeAt(this.pos);
          if (!G) return yt.fail("No node at mark step's position");
          var re = G.type.create(G.attrs, null, this.mark.addToSet(G.marks));
          return yt.fromReplace(V, this.pos, this.pos + 1, new j.Slice(j.Fragment.from(re), 0, G.isLeaf ? 0 : 1));
        }
      }, {
        key: "invert",
        value: function(V) {
          var G = V.nodeAt(this.pos);
          if (G) {
            var re = this.mark.addToSet(G.marks);
            if (re.length == G.marks.length) {
              for (var Ee = 0; Ee < G.marks.length; Ee++) if (!G.marks[Ee].isInSet(re)) return new z(this.pos, G.marks[Ee]);
              return new z(this.pos, this.mark);
            }
          }
          return new fe(this.pos, this.mark);
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.pos, 1);
          return G.deletedAfter ? null : new z(G.pos, this.mark);
        }
      }, {
        key: "toJSON",
        value: function() {
          return {
            stepType: "addNodeMark",
            pos: this.pos,
            mark: this.mark.toJSON()
          };
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.pos != "number") throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
          return new z(G.pos, V.markFromJSON(G.mark));
        }
      }]), z;
    })(Ut);
    Ut.jsonID("addNodeMark", He);
    var fe = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V) {
        var G;
        return N(this, z), G = X.call(this), G.pos = F, G.mark = V, G;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          var G = V.nodeAt(this.pos);
          if (!G) return yt.fail("No node at mark step's position");
          var re = G.type.create(G.attrs, null, this.mark.removeFromSet(G.marks));
          return yt.fromReplace(V, this.pos, this.pos + 1, new j.Slice(j.Fragment.from(re), 0, G.isLeaf ? 0 : 1));
        }
      }, {
        key: "invert",
        value: function(V) {
          var G = V.nodeAt(this.pos);
          return !G || !this.mark.isInSet(G.marks) ? this : new He(this.pos, this.mark);
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.pos, 1);
          return G.deletedAfter ? null : new z(G.pos, this.mark);
        }
      }, {
        key: "toJSON",
        value: function() {
          return {
            stepType: "removeNodeMark",
            pos: this.pos,
            mark: this.mark.toJSON()
          };
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.pos != "number") throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
          return new z(G.pos, V.markFromJSON(G.mark));
        }
      }]), z;
    })(Ut);
    Ut.jsonID("removeNodeMark", fe);
    var Le = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V, G) {
        var re, Ee = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
        return N(this, z), re = X.call(this), re.from = F, re.to = V, re.slice = G, re.structure = Ee, re;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          return this.structure && vt(V, this.from, this.to) ? yt.fail("Structure replace would overwrite content") : yt.fromReplace(V, this.from, this.to, this.slice);
        }
      }, {
        key: "getMap",
        value: function() {
          return new et([this.from, this.to - this.from, this.slice.size]);
        }
      }, {
        key: "invert",
        value: function(V) {
          return new z(this.from, this.from + this.slice.size, V.slice(this.from, this.to));
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.from, 1), re = V.mapResult(this.to, -1);
          return G.deletedAcross && re.deletedAcross ? null : new z(G.pos, Math.max(G.pos, re.pos), this.slice, this.structure);
        }
      }, {
        key: "merge",
        value: function(V) {
          if (!(V instanceof z) || V.structure || this.structure) return null;
          if (this.from + this.slice.size == V.from && !this.slice.openEnd && !V.slice.openStart) {
            var G = this.slice.size + V.slice.size == 0 ? j.Slice.empty : new j.Slice(this.slice.content.append(V.slice.content), this.slice.openStart, V.slice.openEnd);
            return new z(this.from, this.to + (V.to - V.from), G, this.structure);
          } else if (V.to == this.from && !this.slice.openStart && !V.slice.openEnd) {
            var re = this.slice.size + V.slice.size == 0 ? j.Slice.empty : new j.Slice(V.slice.content.append(this.slice.content), V.slice.openStart, this.slice.openEnd);
            return new z(V.from, this.to, re, this.structure);
          } else
            return null;
        }
      }, {
        key: "toJSON",
        value: function() {
          var V = {
            stepType: "replace",
            from: this.from,
            to: this.to
          };
          return this.slice.size && (V.slice = this.slice.toJSON()), this.structure && (V.structure = !0), V;
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.from != "number" || typeof G.to != "number") throw new RangeError("Invalid input for ReplaceStep.fromJSON");
          return new z(G.from, G.to, j.Slice.fromJSON(V, G.slice), !!G.structure);
        }
      }]), z;
    })(Ut);
    Ut.jsonID("replace", Le);
    var dt = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V, G, re, Ee, Be) {
        var he, ne = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !1;
        return N(this, z), he = X.call(this), he.from = F, he.to = V, he.gapFrom = G, he.gapTo = re, he.slice = Ee, he.insert = Be, he.structure = ne, he;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          if (this.structure && (vt(V, this.from, this.gapFrom) || vt(V, this.gapTo, this.to))) return yt.fail("Structure gap-replace would overwrite content");
          var G = V.slice(this.gapFrom, this.gapTo);
          if (G.openStart || G.openEnd) return yt.fail("Gap is not a flat range");
          var re = this.slice.insertAt(this.insert, G.content);
          return re ? yt.fromReplace(V, this.from, this.to, re) : yt.fail("Content does not fit in gap");
        }
      }, {
        key: "getMap",
        value: function() {
          return new et([this.from, this.gapFrom - this.from, this.insert, this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);
        }
      }, {
        key: "invert",
        value: function(V) {
          var G = this.gapTo - this.gapFrom;
          return new z(this.from, this.from + this.slice.size + G, this.from + this.insert, this.from + this.insert + G, V.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.from, 1), re = V.mapResult(this.to, -1), Ee = this.from == this.gapFrom ? G.pos : V.map(this.gapFrom, -1), Be = this.to == this.gapTo ? re.pos : V.map(this.gapTo, 1);
          return G.deletedAcross && re.deletedAcross || Ee < G.pos || Be > re.pos ? null : new z(G.pos, re.pos, Ee, Be, this.slice, this.insert, this.structure);
        }
      }, {
        key: "toJSON",
        value: function() {
          var V = {
            stepType: "replaceAround",
            from: this.from,
            to: this.to,
            gapFrom: this.gapFrom,
            gapTo: this.gapTo,
            insert: this.insert
          };
          return this.slice.size && (V.slice = this.slice.toJSON()), this.structure && (V.structure = !0), V;
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.from != "number" || typeof G.to != "number" || typeof G.gapFrom != "number" || typeof G.gapTo != "number" || typeof G.insert != "number") throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
          return new z(G.from, G.to, G.gapFrom, G.gapTo, j.Slice.fromJSON(V, G.slice), G.insert, !!G.structure);
        }
      }]), z;
    })(Ut);
    Ut.jsonID("replaceAround", dt);
    function vt(Q, X, z) {
      for (var F = Q.resolve(X), V = z - X, G = F.depth; V > 0 && G > 0 && F.indexAfter(G) == F.node(G).childCount; )
        G--, V--;
      if (V > 0)
        for (var re = F.node(G).maybeChild(F.indexAfter(G)); V > 0; ) {
          if (!re || re.isLeaf) return !0;
          re = re.firstChild, V--;
        }
      return !1;
    }
    function Ft(Q, X, z, F) {
      var V = [], G = [], re, Ee;
      Q.doc.nodesBetween(X, z, function(Be, he, ne) {
        if (Be.isInline) {
          var Ae = Be.marks;
          if (!F.isInSet(Ae) && ne.type.allowsMarkType(F.type)) {
            for (var Fe = Math.max(he, X), it = Math.min(he + Be.nodeSize, z), Nt = F.addToSet(Ae), H = 0; H < Ae.length; H++)
              Ae[H].isInSet(Nt) || (re && re.to == Fe && re.mark.eq(Ae[H]) ? re.to = it : V.push(re = new ct(Fe, it, Ae[H])));
            Ee && Ee.to == Fe ? Ee.to = it : G.push(Ee = new Ke(Fe, it, F));
          }
        }
      }), V.forEach(function(Be) {
        return Q.step(Be);
      }), G.forEach(function(Be) {
        return Q.step(Be);
      });
    }
    function Lt(Q, X, z, F) {
      var V = [], G = 0;
      Q.doc.nodesBetween(X, z, function(re, Ee) {
        if (re.isInline) {
          G++;
          var Be = null;
          if (F instanceof j.MarkType)
            for (var he = re.marks, ne; ne = F.isInSet(he); )
              (Be || (Be = [])).push(ne), he = ne.removeFromSet(he);
          else F ? F.isInSet(re.marks) && (Be = [F]) : Be = re.marks;
          if (Be && Be.length)
            for (var Ae = Math.min(Ee + re.nodeSize, z), Fe = 0; Fe < Be.length; Fe++) {
              for (var it = Be[Fe], Nt = void 0, H = 0; H < V.length; H++) {
                var R = V[H];
                R.step == G - 1 && it.eq(V[H].style) && (Nt = R);
              }
              Nt ? (Nt.to = Ae, Nt.step = G) : V.push({
                style: it,
                from: Math.max(Ee, X),
                to: Ae,
                step: G
              });
            }
        }
      }), V.forEach(function(re) {
        return Q.step(new ct(re.from, re.to, re.style));
      });
    }
    function $t(Q, X, z) {
      for (var F = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : z.contentMatch, V = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, G = Q.doc.nodeAt(X), re = [], Ee = X + 1, Be = 0; Be < G.childCount; Be++) {
        var he = G.child(Be), ne = Ee + he.nodeSize, Ae = F.matchType(he.type);
        if (!Ae)
          re.push(new Le(Ee, ne, j.Slice.empty));
        else {
          F = Ae;
          for (var Fe = 0; Fe < he.marks.length; Fe++) z.allowsMarkType(he.marks[Fe].type) || Q.step(new ct(Ee, ne, he.marks[Fe]));
          if (V && he.isText && z.whitespace != "pre")
            for (var it = void 0, Nt = /\r?\n|\r/g, H = void 0; it = Nt.exec(he.text); )
              H || (H = new j.Slice(j.Fragment.from(z.schema.text(" ", z.allowedMarks(he.marks))), 0, 0)), re.push(new Le(Ee + it.index, Ee + it.index + it[0].length, H));
        }
        Ee = ne;
      }
      if (!F.validEnd) {
        var R = F.fillBefore(j.Fragment.empty, !0);
        Q.replace(Ee, Ee, new j.Slice(R, 0, 0));
      }
      for (var b = re.length - 1; b >= 0; b--) Q.step(re[b]);
    }
    function Te(Q, X, z) {
      return (X == 0 || Q.canReplace(X, Q.childCount)) && (z == Q.childCount || Q.canReplace(0, z));
    }
    function be(Q) {
      for (var X = Q.parent, z = X.content.cutByIndex(Q.startIndex, Q.endIndex), F = Q.depth, V = 0, G = 0; ; --F) {
        var re = Q.$from.node(F), Ee = Q.$from.index(F) + V, Be = Q.$to.indexAfter(F) - G;
        if (F < Q.depth && re.canReplace(Ee, Be, z)) return F;
        if (F == 0 || re.type.spec.isolating || !Te(re, Ee, Be)) break;
        Ee && (V = 1), Be < re.childCount && (G = 1);
      }
      return null;
    }
    function ue(Q, X, z) {
      for (var F = X.$from, V = X.$to, G = X.depth, re = F.before(G + 1), Ee = V.after(G + 1), Be = re, he = Ee, ne = j.Fragment.empty, Ae = 0, Fe = G, it = !1; Fe > z; Fe--) it || F.index(Fe) > 0 ? (it = !0, ne = j.Fragment.from(F.node(Fe).copy(ne)), Ae++) : Be--;
      for (var Nt = j.Fragment.empty, H = 0, R = G, b = !1; R > z; R--) b || V.after(R + 1) < V.end(R) ? (b = !0, Nt = j.Fragment.from(V.node(R).copy(Nt)), H++) : he++;
      Q.step(new dt(Be, he, re, Ee, new j.Slice(ne.append(Nt), Ae, H), ne.size - Ae, !0));
    }
    function ge(Q, X) {
      var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, F = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : Q, V = Pe(Q, X), G = V && Ve(F, X);
      return G ? V.map(oe).concat({
        type: X,
        attrs: z
      }).concat(G.map(oe)) : null;
    }
    function oe(Q) {
      return {
        type: Q,
        attrs: null
      };
    }
    function Pe(Q, X) {
      var z = Q.parent, F = Q.startIndex, V = Q.endIndex, G = z.contentMatchAt(F).findWrapping(X);
      if (!G) return null;
      var re = G.length ? G[0] : X;
      return z.canReplaceWith(F, V, re) ? G : null;
    }
    function Ve(Q, X) {
      var z = Q.parent, F = Q.startIndex, V = Q.endIndex, G = z.child(F), re = X.contentMatch.findWrapping(G.type);
      if (!re) return null;
      for (var Ee = re.length ? re[re.length - 1] : X, Be = Ee.contentMatch, he = F; Be && he < V; he++) Be = Be.matchType(z.child(he).type);
      return !Be || !Be.validEnd ? null : re;
    }
    function lt(Q, X, z) {
      for (var F = j.Fragment.empty, V = z.length - 1; V >= 0; V--) {
        if (F.size) {
          var G = z[V].type.contentMatch.matchFragment(F);
          if (!G || !G.validEnd) throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
        }
        F = j.Fragment.from(z[V].type.create(z[V].attrs, F));
      }
      var re = X.start, Ee = X.end;
      Q.step(new dt(re, Ee, re, Ee, new j.Slice(F, 0, 0), z.length, !0));
    }
    function Tt(Q, X, z, F, V) {
      if (!F.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock");
      var G = Q.steps.length;
      Q.doc.nodesBetween(X, z, function(re, Ee) {
        var Be = typeof V == "function" ? V(re) : V;
        if (re.isTextblock && !re.hasMarkup(F, Be) && mr(Q.doc, Q.mapping.slice(G).map(Ee), F)) {
          var he = null;
          if (F.schema.linebreakReplacement) {
            var ne = F.whitespace == "pre", Ae = !!F.contentMatch.matchType(F.schema.linebreakReplacement);
            ne && !Ae ? he = !1 : !ne && Ae && (he = !0);
          }
          he === !1 && jt(Q, re, Ee, G), $t(Q, Q.mapping.slice(G).map(Ee, 1), F, void 0, he === null);
          var Fe = Q.mapping.slice(G), it = Fe.map(Ee, 1), Nt = Fe.map(Ee + re.nodeSize, 1);
          return Q.step(new dt(it, Nt, it + 1, Nt - 1, new j.Slice(j.Fragment.from(F.create(Be, null, re.marks)), 0, 0), 1, !0)), he === !0 && Yt(Q, re, Ee, G), !1;
        }
      });
    }
    function Yt(Q, X, z, F) {
      X.forEach(function(V, G) {
        if (V.isText)
          for (var re, Ee = /\r?\n|\r/g; re = Ee.exec(V.text); ) {
            var Be = Q.mapping.slice(F).map(z + 1 + G + re.index);
            Q.replaceWith(Be, Be + 1, X.type.schema.linebreakReplacement.create());
          }
      });
    }
    function jt(Q, X, z, F) {
      X.forEach(function(V, G) {
        if (V.type == V.type.schema.linebreakReplacement) {
          var re = Q.mapping.slice(F).map(z + 1 + G);
          Q.replaceWith(re, re + 1, X.type.schema.text(`
`));
        }
      });
    }
    function mr(Q, X, z) {
      var F = Q.resolve(X), V = F.index();
      return F.parent.canReplaceWith(V, V + 1, z);
    }
    function tr(Q, X, z, F, V) {
      var G = Q.doc.nodeAt(X);
      if (!G) throw new RangeError("No node at given position");
      z || (z = G.type);
      var re = z.create(F, null, V || G.marks);
      if (G.isLeaf) return Q.replaceWith(X, X + G.nodeSize, re);
      if (!z.validContent(G.content)) throw new RangeError("Invalid content for node type " + z.name);
      Q.step(new dt(X, X + G.nodeSize, X + 1, X + G.nodeSize - 1, new j.Slice(j.Fragment.from(re), 0, 0), 1, !0));
    }
    function yr(Q, X) {
      var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, F = arguments.length > 3 ? arguments[3] : void 0, V = Q.resolve(X), G = V.depth - z, re = F && F[F.length - 1] || V.parent;
      if (G < 0 || V.parent.type.spec.isolating || !V.parent.canReplace(V.index(), V.parent.childCount) || !re.type.validContent(V.parent.content.cutByIndex(V.index(), V.parent.childCount))) return !1;
      for (var Ee = V.depth - 1, Be = z - 2; Ee > G; Ee--, Be--) {
        var he = V.node(Ee), ne = V.index(Ee);
        if (he.type.spec.isolating) return !1;
        var Ae = he.content.cutByIndex(ne, he.childCount), Fe = F && F[Be + 1];
        Fe && (Ae = Ae.replaceChild(0, Fe.type.create(Fe.attrs)));
        var it = F && F[Be] || he;
        if (!he.canReplace(ne + 1, he.childCount) || !it.type.validContent(Ae)) return !1;
      }
      var Nt = V.indexAfter(G), H = F && F[0];
      return V.node(G).canReplaceWith(Nt, Nt, H ? H.type : V.node(G + 1).type);
    }
    function ar(Q, X) {
      for (var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, F = arguments.length > 3 ? arguments[3] : void 0, V = Q.doc.resolve(X), G = j.Fragment.empty, re = j.Fragment.empty, Ee = V.depth, Be = V.depth - z, he = z - 1; Ee > Be; Ee--, he--) {
        G = j.Fragment.from(V.node(Ee).copy(G));
        var ne = F && F[he];
        re = j.Fragment.from(ne ? ne.type.create(ne.attrs, re) : V.node(Ee).copy(re));
      }
      Q.step(new Le(X, X, new j.Slice(G.append(re), z, z), !0));
    }
    function Wr(Q, X) {
      var z = Q.resolve(X), F = z.index();
      return Hn(z.nodeBefore, z.nodeAfter) && z.parent.canReplace(F, F + 1);
    }
    function ki(Q, X) {
      X.content.size || Q.type.compatibleContent(X.type);
      for (var z = Q.contentMatchAt(Q.childCount), F = Q.type.schema.linebreakReplacement, V = 0; V < X.childCount; V++) {
        var G = X.child(V), re = G.type == F ? Q.type.schema.nodes.text : G.type;
        if (z = z.matchType(re), !z || !Q.type.allowsMarks(G.marks)) return !1;
      }
      return z.validEnd;
    }
    function Hn(Q, X) {
      return !!(Q && X && !Q.isLeaf && ki(Q, X));
    }
    function _r(Q, X) {
      for (var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1, F = Q.resolve(X), V = F.depth; ; V--) {
        var G = void 0, re = void 0, Ee = F.index(V);
        if (V == F.depth ? (G = F.nodeBefore, re = F.nodeAfter) : z > 0 ? (G = F.node(V + 1), Ee++, re = F.node(V).maybeChild(Ee)) : (G = F.node(V).maybeChild(Ee - 1), re = F.node(V + 1)), G && !G.isTextblock && Hn(G, re) && F.node(V).canReplace(Ee, Ee + 1)) return X;
        if (V == 0) break;
        X = z < 0 ? F.before(V) : F.after(V);
      }
    }
    function st(Q, X, z) {
      var F = null, V = Q.doc.type.schema.linebreakReplacement, G = Q.doc.resolve(X - z), re = G.node().type;
      if (V && re.inlineContent) {
        var Ee = re.whitespace == "pre", Be = !!re.contentMatch.matchType(V);
        Ee && !Be ? F = !1 : !Ee && Be && (F = !0);
      }
      var he = Q.steps.length;
      if (F === !1) {
        var ne = Q.doc.resolve(X + z);
        jt(Q, ne.node(), ne.before(), he);
      }
      re.inlineContent && $t(Q, X + z - 1, re, G.node().contentMatchAt(G.index()), F == null);
      var Ae = Q.mapping.slice(he), Fe = Ae.map(X - z);
      if (Q.step(new Le(Fe, Ae.map(X + z, -1), j.Slice.empty, !0)), F === !0) {
        var it = Q.doc.resolve(Fe);
        Yt(Q, it.node(), it.before(), Q.steps.length);
      }
      return Q;
    }
    function ut(Q, X, z) {
      var F = Q.resolve(X);
      if (F.parent.canReplaceWith(F.index(), F.index(), z)) return X;
      if (F.parentOffset == 0) for (var V = F.depth - 1; V >= 0; V--) {
        var G = F.index(V);
        if (F.node(V).canReplaceWith(G, G, z)) return F.before(V + 1);
        if (G > 0) return null;
      }
      if (F.parentOffset == F.parent.content.size) for (var re = F.depth - 1; re >= 0; re--) {
        var Ee = F.indexAfter(re);
        if (F.node(re).canReplaceWith(Ee, Ee, z)) return F.after(re + 1);
        if (Ee < F.node(re).childCount) return null;
      }
      return null;
    }
    function _t(Q, X, z) {
      var F = Q.resolve(X);
      if (!z.content.size) return X;
      for (var V = z.content, G = 0; G < z.openStart; G++) V = V.firstChild.content;
      for (var re = 1; re <= (z.openStart == 0 && z.size ? 2 : 1); re++)
        for (var Ee = F.depth; Ee >= 0; Ee--) {
          var Be = Ee == F.depth ? 0 : F.pos <= (F.start(Ee + 1) + F.end(Ee + 1)) / 2 ? -1 : 1, he = F.index(Ee) + (Be > 0 ? 1 : 0), ne = F.node(Ee), Ae = !1;
          if (re == 1)
            Ae = ne.canReplace(he, he, V);
          else {
            var Fe = ne.contentMatchAt(he).findWrapping(V.firstChild.type);
            Ae = Fe && ne.canReplaceWith(he, he, Fe[0]);
          }
          if (Ae) return Be == 0 ? F.pos : Be < 0 ? F.before(Ee + 1) : F.after(Ee + 1);
        }
      return null;
    }
    function Vt(Q, X) {
      var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : X, F = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : j.Slice.empty;
      if (X == z && !F.size) return null;
      var V = Q.resolve(X), G = Q.resolve(z);
      return Zt(V, G, F) ? new Le(X, z, F) : new tn(V, G, F).fit();
    }
    function Zt(Q, X, z) {
      return !z.openStart && !z.openEnd && Q.start() == X.start() && Q.parent.canReplace(Q.index(), X.index(), z.content);
    }
    var tn = (function() {
      function Q(X, z, F) {
        N(this, Q), this.$from = X, this.$to = z, this.unplaced = F, this.frontier = [], this.placed = j.Fragment.empty;
        for (var V = 0; V <= X.depth; V++) {
          var G = X.node(V);
          this.frontier.push({
            type: G.type,
            match: G.contentMatchAt(X.indexAfter(V))
          });
        }
        for (var re = X.depth; re > 0; re--) this.placed = j.Fragment.from(X.node(re).copy(this.placed));
      }
      return A(Q, [{
        key: "depth",
        get: function() {
          return this.frontier.length - 1;
        }
      }, {
        key: "fit",
        value: function() {
          for (; this.unplaced.size; ) {
            var z = this.findFittable();
            z ? this.placeNodes(z) : this.openMore() || this.dropNode();
          }
          var F = this.mustMoveInline(), V = this.placed.size - this.depth - this.$from.depth, G = this.$from, re = this.close(F < 0 ? this.$to : G.doc.resolve(F));
          if (!re) return null;
          for (var Ee = this.placed, Be = G.depth, he = re.depth; Be && he && Ee.childCount == 1; )
            Ee = Ee.firstChild.content, Be--, he--;
          var ne = new j.Slice(Ee, Be, he);
          return F > -1 ? new dt(G.pos, F, this.$to.pos, this.$to.end(), ne, V) : ne.size || G.pos != this.$to.pos ? new Le(G.pos, re.pos, ne) : null;
        }
      }, {
        key: "findFittable",
        value: function() {
          for (var z = this.unplaced.openStart, F = this.unplaced.content, V = 0, G = this.unplaced.openEnd; V < z; V++) {
            var re = F.firstChild;
            if (F.childCount > 1 && (G = 0), re.type.spec.isolating && G <= V) {
              z = V;
              break;
            }
            F = re.content;
          }
          for (var Ee = 1; Ee <= 2; Ee++)
            for (var Be = Ee == 1 ? z : this.unplaced.openStart; Be >= 0; Be--) {
              var he = void 0, ne = null;
              Be ? (ne = En(this.unplaced.content, Be - 1).firstChild, he = ne.content) : he = this.unplaced.content;
              for (var Ae = he.firstChild, Fe = this.depth; Fe >= 0; Fe--) {
                var it = this.frontier[Fe], Nt = it.type, H = it.match, R = void 0, b = null;
                if (Ee == 1 && (Ae ? H.matchType(Ae.type) || (b = H.fillBefore(j.Fragment.from(Ae), !1)) : ne && Nt.compatibleContent(ne.type))) return {
                  sliceDepth: Be,
                  frontierDepth: Fe,
                  parent: ne,
                  inject: b
                };
                if (Ee == 2 && Ae && (R = H.findWrapping(Ae.type))) return {
                  sliceDepth: Be,
                  frontierDepth: Fe,
                  parent: ne,
                  wrap: R
                };
                if (ne && H.matchType(ne.type)) break;
              }
            }
        }
      }, {
        key: "openMore",
        value: function() {
          var z = this.unplaced, F = z.content, V = z.openStart, G = z.openEnd, re = En(F, V);
          return !re.childCount || re.firstChild.isLeaf ? !1 : (this.unplaced = new j.Slice(F, V + 1, Math.max(G, re.size + V >= F.size - G ? V + 1 : 0)), !0);
        }
      }, {
        key: "dropNode",
        value: function() {
          var z = this.unplaced, F = z.content, V = z.openStart, G = z.openEnd, re = En(F, V);
          if (re.childCount <= 1 && V > 0) {
            var Ee = F.size - V <= V + re.size;
            this.unplaced = new j.Slice(kr(F, V - 1, 1), V - 1, Ee ? V - 1 : G);
          } else
            this.unplaced = new j.Slice(kr(F, V, 1), V, G);
        }
      }, {
        key: "placeNodes",
        value: function(z) {
          for (var F = z.sliceDepth, V = z.frontierDepth, G = z.parent, re = z.inject, Ee = z.wrap; this.depth > V; ) this.closeFrontierNode();
          if (Ee) for (var Be = 0; Be < Ee.length; Be++) this.openFrontierNode(Ee[Be]);
          var he = this.unplaced, ne = G ? G.content : he.content, Ae = he.openStart - F, Fe = 0, it = [], Nt = this.frontier[V], H = Nt.match, R = Nt.type;
          if (re) {
            for (var b = 0; b < re.childCount; b++) it.push(re.child(b));
            H = H.matchFragment(re);
          }
          for (var E = ne.size + F - (he.content.size - he.openEnd); Fe < ne.childCount; ) {
            var B = ne.child(Fe), K = H.matchType(B.type);
            if (!K) break;
            Fe++, (Fe > 1 || Ae == 0 || B.content.size) && (H = K, it.push(Vn(B.mark(R.allowedMarks(B.marks)), Fe == 1 ? Ae : 0, Fe == ne.childCount ? E : -1)));
          }
          var Z = Fe == ne.childCount;
          Z || (E = -1), this.placed = xr(this.placed, V, j.Fragment.from(it)), this.frontier[V].match = H, Z && E < 0 && G && G.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
          for (var ae = 0, ye = ne; ae < E; ae++) {
            var Oe = ye.lastChild;
            this.frontier.push({
              type: Oe.type,
              match: Oe.contentMatchAt(Oe.childCount)
            }), ye = Oe.content;
          }
          this.unplaced = Z ? F == 0 ? j.Slice.empty : new j.Slice(kr(he.content, F - 1, 1), F - 1, E < 0 ? he.openEnd : F - 1) : new j.Slice(kr(he.content, F, Fe), he.openStart, he.openEnd);
        }
      }, {
        key: "mustMoveInline",
        value: function() {
          if (!this.$to.parent.isTextblock) return -1;
          var z = this.frontier[this.depth], F;
          if (!z.type.isTextblock || !Rr(this.$to, this.$to.depth, z.type, z.match, !1) || this.$to.depth == this.depth && (F = this.findCloseLevel(this.$to)) && F.depth == this.depth) return -1;
          for (var V = this.$to.depth, G = this.$to.after(V); V > 1 && G == this.$to.end(--V); ) ++G;
          return G;
        }
      }, {
        key: "findCloseLevel",
        value: function(z) {
          e: for (var F = Math.min(this.depth, z.depth); F >= 0; F--) {
            var V = this.frontier[F], G = V.match, re = V.type, Ee = F < z.depth && z.end(F + 1) == z.pos + (z.depth - (F + 1)), Be = Rr(z, F, re, G, Ee);
            if (Be) {
              for (var he = F - 1; he >= 0; he--) {
                var ne = this.frontier[he], Ae = ne.match, Fe = ne.type, it = Rr(z, he, Fe, Ae, !0);
                if (!it || it.childCount) continue e;
              }
              return {
                depth: F,
                fit: Be,
                move: Ee ? z.doc.resolve(z.after(F + 1)) : z
              };
            }
          }
        }
      }, {
        key: "close",
        value: function(z) {
          var F = this.findCloseLevel(z);
          if (!F) return null;
          for (; this.depth > F.depth; ) this.closeFrontierNode();
          F.fit.childCount && (this.placed = xr(this.placed, F.depth, F.fit)), z = F.move;
          for (var V = F.depth + 1; V <= z.depth; V++) {
            var G = z.node(V), re = G.type.contentMatch.fillBefore(G.content, !0, z.index(V));
            this.openFrontierNode(G.type, G.attrs, re);
          }
          return z;
        }
      }, {
        key: "openFrontierNode",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, V = arguments.length > 2 ? arguments[2] : void 0, G = this.frontier[this.depth];
          G.match = G.match.matchType(z), this.placed = xr(this.placed, this.depth, j.Fragment.from(z.create(F, V))), this.frontier.push({
            type: z,
            match: z.contentMatch
          });
        }
      }, {
        key: "closeFrontierNode",
        value: function() {
          var z = this.frontier.pop(), F = z.match.fillBefore(j.Fragment.empty, !0);
          F.childCount && (this.placed = xr(this.placed, this.frontier.length, F));
        }
      }]), Q;
    })();
    function kr(Q, X, z) {
      return X == 0 ? Q.cutByIndex(z, Q.childCount) : Q.replaceChild(0, Q.firstChild.copy(kr(Q.firstChild.content, X - 1, z)));
    }
    function xr(Q, X, z) {
      return X == 0 ? Q.append(z) : Q.replaceChild(Q.childCount - 1, Q.lastChild.copy(xr(Q.lastChild.content, X - 1, z)));
    }
    function En(Q, X) {
      for (var z = 0; z < X; z++) Q = Q.firstChild.content;
      return Q;
    }
    function Vn(Q, X, z) {
      if (X <= 0) return Q;
      var F = Q.content;
      return X > 1 && (F = F.replaceChild(0, Vn(F.firstChild, X - 1, F.childCount == 1 ? z - 1 : 0))), X > 0 && (F = Q.type.contentMatch.fillBefore(F).append(F), z <= 0 && (F = F.append(Q.type.contentMatch.matchFragment(F).fillBefore(j.Fragment.empty, !0)))), Q.copy(F);
    }
    function Rr(Q, X, z, F, V) {
      var G = Q.node(X), re = V ? Q.indexAfter(X) : Q.index(X);
      if (re == G.childCount && !z.compatibleContent(G.type)) return null;
      var Ee = F.fillBefore(G.content, !0, re);
      return Ee && !cn(z, G.content, re) ? Ee : null;
    }
    function cn(Q, X, z) {
      for (var F = z; F < X.childCount; F++) if (!Q.allowsMarks(X.child(F).marks)) return !0;
      return !1;
    }
    function ri(Q) {
      return Q.spec.defining || Q.spec.definingForContent;
    }
    function Un(Q, X, z, F) {
      if (!F.size) return Q.deleteRange(X, z);
      var V = Q.doc.resolve(X), G = Q.doc.resolve(z);
      if (Zt(V, G, F)) return Q.step(new Le(X, z, F));
      var re = qr(V, G);
      re[re.length - 1] == 0 && re.pop();
      var Ee = -(V.depth + 1);
      re.unshift(Ee);
      for (var Be = V.depth, he = V.pos - 1; Be > 0; Be--, he--) {
        var ne = V.node(Be).type.spec;
        if (ne.defining || ne.definingAsContext || ne.isolating) break;
        re.indexOf(Be) > -1 ? Ee = Be : V.before(Be) == he && re.splice(1, 0, -Be);
      }
      for (var Ae = re.indexOf(Ee), Fe = [], it = F.openStart, Nt = F.content, H = 0; ; H++) {
        var R = Nt.firstChild;
        if (Fe.push(R), H == F.openStart) break;
        Nt = R.content;
      }
      for (var b = it - 1; b >= 0; b--) {
        var E = Fe[b], B = ri(E.type);
        if (B && !E.sameMarkup(V.node(Math.abs(Ee) - 1))) it = b;
        else if (B || !E.type.isTextblock) break;
      }
      for (var K = F.openStart; K >= 0; K--) {
        var Z = (K + it + 1) % (F.openStart + 1), ae = Fe[Z];
        if (ae)
          for (var ye = 0; ye < re.length; ye++) {
            var Oe = re[(ye + Ae) % re.length], je = !0;
            Oe < 0 && (je = !1, Oe = -Oe);
            var $e = V.node(Oe - 1), at = V.index(Oe - 1);
            if ($e.canReplaceWith(at, at, ae.type, ae.marks)) return Q.replace(V.before(Oe), je ? G.after(Oe) : z, new j.Slice(rn(F.content, 0, F.openStart, Z), Z, F.openEnd));
          }
      }
      for (var Ot = Q.steps.length, er = re.length - 1; er >= 0 && (Q.replace(X, z, F), !(Q.steps.length > Ot)); er--) {
        var hr = re[er];
        hr < 0 || (X = V.before(hr), z = G.after(hr));
      }
    }
    function rn(Q, X, z, F, V) {
      if (X < z) {
        var G = Q.firstChild;
        Q = Q.replaceChild(0, G.copy(rn(G.content, X + 1, z, F, G)));
      }
      if (X > F) {
        var re = V.contentMatchAt(0), Ee = re.fillBefore(Q).append(Q);
        Q = Ee.append(re.matchFragment(Ee).fillBefore(j.Fragment.empty, !0));
      }
      return Q;
    }
    function Xr(Q, X, z, F) {
      if (!F.isInline && X == z && Q.doc.resolve(X).parent.content.size) {
        var V = ut(Q.doc, X, F.type);
        V != null && (X = z = V);
      }
      Q.replaceRange(X, z, new j.Slice(j.Fragment.from(F), 0, 0));
    }
    function gn(Q, X, z) {
      for (var F = Q.doc.resolve(X), V = Q.doc.resolve(z), G = qr(F, V), re = 0; re < G.length; re++) {
        var Ee = G[re], Be = re == G.length - 1;
        if (Be && Ee == 0 || F.node(Ee).type.contentMatch.validEnd) return Q.delete(F.start(Ee), V.end(Ee));
        if (Ee > 0 && (Be || F.node(Ee - 1).canReplace(F.index(Ee - 1), V.indexAfter(Ee - 1)))) return Q.delete(F.before(Ee), V.after(Ee));
      }
      for (var he = 1; he <= F.depth && he <= V.depth; he++)
        if (X - F.start(he) == F.depth - he && z > F.end(he) && V.end(he) - z != V.depth - he && F.start(he - 1) == V.start(he - 1) && F.node(he - 1).canReplace(F.index(he - 1), V.index(he - 1))) return Q.delete(F.before(he), z);
      Q.delete(X, z);
    }
    function qr(Q, X) {
      for (var z = [], F = Math.min(Q.depth, X.depth), V = F; V >= 0; V--) {
        var G = Q.start(V);
        if (G < Q.pos - (Q.depth - V) || X.end(V) > X.pos + (X.depth - V) || Q.node(V).type.spec.isolating || X.node(V).type.spec.isolating) break;
        (G == X.start(V) || V == Q.depth && V == X.depth && Q.parent.inlineContent && X.parent.inlineContent && V && X.start(V - 1) == G - 1) && z.push(V);
      }
      return z;
    }
    var $n = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V, G) {
        var re;
        return N(this, z), re = X.call(this), re.pos = F, re.attr = V, re.value = G, re;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          var G = V.nodeAt(this.pos);
          if (!G) return yt.fail("No node at attribute step's position");
          var re = /* @__PURE__ */ Object.create(null);
          for (var Ee in G.attrs) re[Ee] = G.attrs[Ee];
          re[this.attr] = this.value;
          var Be = G.type.create(re, null, G.marks);
          return yt.fromReplace(V, this.pos, this.pos + 1, new j.Slice(j.Fragment.from(Be), 0, G.isLeaf ? 0 : 1));
        }
      }, {
        key: "getMap",
        value: function() {
          return et.empty;
        }
      }, {
        key: "invert",
        value: function(V) {
          return new z(this.pos, this.attr, V.nodeAt(this.pos).attrs[this.attr]);
        }
      }, {
        key: "map",
        value: function(V) {
          var G = V.mapResult(this.pos, 1);
          return G.deletedAfter ? null : new z(G.pos, this.attr, this.value);
        }
      }, {
        key: "toJSON",
        value: function() {
          return {
            stepType: "attr",
            pos: this.pos,
            attr: this.attr,
            value: this.value
          };
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.pos != "number" || typeof G.attr != "string") throw new RangeError("Invalid input for AttrStep.fromJSON");
          return new z(G.pos, G.attr, G.value);
        }
      }]), z;
    })(Ut);
    Ut.jsonID("attr", $n);
    var wr = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z(F, V) {
        var G;
        return N(this, z), G = X.call(this), G.attr = F, G.value = V, G;
      }
      return A(z, [{
        key: "apply",
        value: function(V) {
          var G = /* @__PURE__ */ Object.create(null);
          for (var re in V.attrs) G[re] = V.attrs[re];
          G[this.attr] = this.value;
          var Ee = V.type.create(G, V.content, V.marks);
          return yt.ok(Ee);
        }
      }, {
        key: "getMap",
        value: function() {
          return et.empty;
        }
      }, {
        key: "invert",
        value: function(V) {
          return new z(this.attr, V.attrs[this.attr]);
        }
      }, {
        key: "map",
        value: function(V) {
          return this;
        }
      }, {
        key: "toJSON",
        value: function() {
          return {
            stepType: "docAttr",
            attr: this.attr,
            value: this.value
          };
        }
      }], [{
        key: "fromJSON",
        value: function(V, G) {
          if (typeof G.attr != "string") throw new RangeError("Invalid input for DocAttrStep.fromJSON");
          return new z(G.attr, G.value);
        }
      }]), z;
    })(Ut);
    Ut.jsonID("docAttr", wr), r.TransformError = (function(Q) {
      i(z, Q);
      var X = s(z);
      function z() {
        return N(this, z), X.apply(this, arguments);
      }
      return A(z);
    })(e(Error)), r.TransformError = function Q(X) {
      var z = Error.call(this, X);
      return z.__proto__ = Q.prototype, z;
    }, r.TransformError.prototype = Object.create(Error.prototype), r.TransformError.prototype.constructor = r.TransformError, r.TransformError.prototype.name = "TransformError";
    var jr = (function() {
      function Q(X) {
        N(this, Q), this.doc = X, this.steps = [], this.docs = [], this.mapping = new Ht();
      }
      return A(Q, [{
        key: "before",
        get: function() {
          return this.docs.length ? this.docs[0] : this.doc;
        }
      }, {
        key: "step",
        value: function(z) {
          var F = this.maybeStep(z);
          if (F.failed) throw new r.TransformError(F.failed);
          return this;
        }
      }, {
        key: "maybeStep",
        value: function(z) {
          var F = z.apply(this.doc);
          return F.failed || this.addStep(z, F.doc), F;
        }
      }, {
        key: "docChanged",
        get: function() {
          return this.steps.length > 0;
        }
      }, {
        key: "addStep",
        value: function(z, F) {
          this.docs.push(this.doc), this.steps.push(z), this.mapping.appendMap(z.getMap()), this.doc = F;
        }
      }, {
        key: "replace",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : z, V = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : j.Slice.empty, G = Vt(this.doc, z, F, V);
          return G && this.step(G), this;
        }
      }, {
        key: "replaceWith",
        value: function(z, F, V) {
          return this.replace(z, F, new j.Slice(j.Fragment.from(V), 0, 0));
        }
      }, {
        key: "delete",
        value: function(z, F) {
          return this.replace(z, F, j.Slice.empty);
        }
      }, {
        key: "insert",
        value: function(z, F) {
          return this.replaceWith(z, z, F);
        }
      }, {
        key: "replaceRange",
        value: function(z, F, V) {
          return Un(this, z, F, V), this;
        }
      }, {
        key: "replaceRangeWith",
        value: function(z, F, V) {
          return Xr(this, z, F, V), this;
        }
      }, {
        key: "deleteRange",
        value: function(z, F) {
          return gn(this, z, F), this;
        }
      }, {
        key: "lift",
        value: function(z, F) {
          return ue(this, z, F), this;
        }
      }, {
        key: "join",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
          return st(this, z, F), this;
        }
      }, {
        key: "wrap",
        value: function(z, F) {
          return lt(this, z, F), this;
        }
      }, {
        key: "setBlockType",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : z, V = arguments.length > 2 ? arguments[2] : void 0, G = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
          return Tt(this, z, F, V, G), this;
        }
      }, {
        key: "setNodeMarkup",
        value: function(z, F) {
          var V = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, G = arguments.length > 3 ? arguments[3] : void 0;
          return tr(this, z, F, V, G), this;
        }
      }, {
        key: "setNodeAttribute",
        value: function(z, F, V) {
          return this.step(new $n(z, F, V)), this;
        }
      }, {
        key: "setDocAttribute",
        value: function(z, F) {
          return this.step(new wr(z, F)), this;
        }
      }, {
        key: "addNodeMark",
        value: function(z, F) {
          return this.step(new He(z, F)), this;
        }
      }, {
        key: "removeNodeMark",
        value: function(z, F) {
          var V = this.doc.nodeAt(z);
          if (!V) throw new RangeError("No node at position " + z);
          if (F instanceof j.Mark)
            F.isInSet(V.marks) && this.step(new fe(z, F));
          else {
            for (var G = V.marks, re, Ee = []; re = F.isInSet(G); )
              Ee.push(new fe(z, re)), G = re.removeFromSet(G);
            for (var Be = Ee.length - 1; Be >= 0; Be--) this.step(Ee[Be]);
          }
          return this;
        }
      }, {
        key: "split",
        value: function(z) {
          var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, V = arguments.length > 2 ? arguments[2] : void 0;
          return ar(this, z, F, V), this;
        }
      }, {
        key: "addMark",
        value: function(z, F, V) {
          return Ft(this, z, F, V), this;
        }
      }, {
        key: "removeMark",
        value: function(z, F, V) {
          return Lt(this, z, F, V), this;
        }
      }, {
        key: "clearIncompatible",
        value: function(z, F, V) {
          return $t(this, z, F, V), this;
        }
      }]), Q;
    })();
    r.AddMarkStep = Ke, r.AddNodeMarkStep = He, r.AttrStep = $n, r.DocAttrStep = wr, r.MapResult = At, r.Mapping = Ht, r.RemoveMarkStep = ct, r.RemoveNodeMarkStep = fe, r.ReplaceAroundStep = dt, r.ReplaceStep = Le, r.Step = Ut, r.StepMap = et, r.StepResult = yt, r.Transform = jr, r.canJoin = Wr, r.canSplit = yr, r.dropPoint = _t, r.findWrapping = ge, r.insertPoint = ut, r.joinPoint = _r, r.liftTarget = be, r.replaceStep = Vt;
  })(Zy)), Zy;
}
var BT;
function jm() {
  if (BT) return Qa;
  BT = 1;
  function r() {
    return typeof Reflect < "u" && Reflect.get ? r = Reflect.get.bind() : r = function(be, ue, ge) {
      var oe = e(be, ue);
      if (oe) {
        var Pe = Object.getOwnPropertyDescriptor(oe, ue);
        return Pe.get ? Pe.get.call(arguments.length < 3 ? be : ge) : Pe.value;
      }
    }, r.apply(this, arguments);
  }
  function e(Te, be) {
    for (; !Object.prototype.hasOwnProperty.call(Te, be) && (Te = f(Te), Te !== null); )
      ;
    return Te;
  }
  function t(Te, be) {
    if (typeof be != "function" && be !== null)
      throw new TypeError("Super expression must either be null or a function");
    Te.prototype = Object.create(be && be.prototype, { constructor: { value: Te, writable: !0, configurable: !0 } }), Object.defineProperty(Te, "prototype", { writable: !1 }), be && n(Te, be);
  }
  function n(Te, be) {
    return n = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(ge, oe) {
      return ge.__proto__ = oe, ge;
    }, n(Te, be);
  }
  function i(Te) {
    var be = u();
    return function() {
      var ge = f(Te), oe;
      if (be) {
        var Pe = f(this).constructor;
        oe = Reflect.construct(ge, arguments, Pe);
      } else
        oe = ge.apply(this, arguments);
      return a(this, oe);
    };
  }
  function a(Te, be) {
    if (be && (p(be) === "object" || typeof be == "function"))
      return be;
    if (be !== void 0)
      throw new TypeError("Derived constructors may only return object or undefined");
    return s(Te);
  }
  function s(Te) {
    if (Te === void 0)
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return Te;
  }
  function u() {
    if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
    if (typeof Proxy == "function") return !0;
    try {
      return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
      })), !0;
    } catch {
      return !1;
    }
  }
  function f(Te) {
    return f = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(ue) {
      return ue.__proto__ || Object.getPrototypeOf(ue);
    }, f(Te);
  }
  function p(Te) {
    "@babel/helpers - typeof";
    return p = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(be) {
      return typeof be;
    } : function(be) {
      return be && typeof Symbol == "function" && be.constructor === Symbol && be !== Symbol.prototype ? "symbol" : typeof be;
    }, p(Te);
  }
  function y(Te, be) {
    if (!(Te instanceof be))
      throw new TypeError("Cannot call a class as a function");
  }
  function T(Te, be) {
    for (var ue = 0; ue < be.length; ue++) {
      var ge = be[ue];
      ge.enumerable = ge.enumerable || !1, ge.configurable = !0, "value" in ge && (ge.writable = !0), Object.defineProperty(Te, O(ge.key), ge);
    }
  }
  function N(Te, be, ue) {
    return be && T(Te.prototype, be), ue && T(Te, ue), Object.defineProperty(Te, "prototype", { writable: !1 }), Te;
  }
  function O(Te) {
    var be = A(Te, "string");
    return p(be) === "symbol" ? be : String(be);
  }
  function A(Te, be) {
    if (p(Te) !== "object" || Te === null) return Te;
    var ue = Te[Symbol.toPrimitive];
    if (ue !== void 0) {
      var ge = ue.call(Te, be);
      if (p(ge) !== "object") return ge;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return String(Te);
  }
  var q = /* @__PURE__ */ Wm(), U = /* @__PURE__ */ qk(), j = /* @__PURE__ */ Object.create(null), te = (function() {
    function Te(be, ue, ge) {
      y(this, Te), this.$anchor = be, this.$head = ue, this.ranges = ge || [new se(be.min(ue), be.max(ue))];
    }
    return N(Te, [{
      key: "anchor",
      get: function() {
        return this.$anchor.pos;
      }
    }, {
      key: "head",
      get: function() {
        return this.$head.pos;
      }
    }, {
      key: "from",
      get: function() {
        return this.$from.pos;
      }
    }, {
      key: "to",
      get: function() {
        return this.$to.pos;
      }
    }, {
      key: "$from",
      get: function() {
        return this.ranges[0].$from;
      }
    }, {
      key: "$to",
      get: function() {
        return this.ranges[0].$to;
      }
    }, {
      key: "empty",
      get: function() {
        for (var ue = this.ranges, ge = 0; ge < ue.length; ge++) if (ue[ge].$from.pos != ue[ge].$to.pos) return !1;
        return !0;
      }
    }, {
      key: "content",
      value: function() {
        return this.$from.doc.slice(this.from, this.to, !0);
      }
    }, {
      key: "replace",
      value: function(ue) {
        for (var ge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : q.Slice.empty, oe = ge.content.lastChild, Pe = null, Ve = 0; Ve < ge.openEnd; Ve++)
          Pe = oe, oe = oe.lastChild;
        for (var lt = ue.steps.length, Tt = this.ranges, Yt = 0; Yt < Tt.length; Yt++) {
          var jt = Tt[Yt], mr = jt.$from, tr = jt.$to, yr = ue.mapping.slice(lt);
          ue.replaceRange(yr.map(mr.pos), yr.map(tr.pos), Yt ? q.Slice.empty : ge), Yt == 0 && Ht(ue, lt, (oe ? oe.isInline : Pe && Pe.isTextblock) ? -1 : 1);
        }
      }
    }, {
      key: "replaceWith",
      value: function(ue, ge) {
        for (var oe = ue.steps.length, Pe = this.ranges, Ve = 0; Ve < Pe.length; Ve++) {
          var lt = Pe[Ve], Tt = lt.$from, Yt = lt.$to, jt = ue.mapping.slice(oe), mr = jt.map(Tt.pos), tr = jt.map(Yt.pos);
          Ve ? ue.deleteRange(mr, tr) : (ue.replaceRangeWith(mr, tr, ge), Ht(ue, oe, ge.isInline ? -1 : 1));
        }
      }
    }, {
      key: "getBookmark",
      value: function() {
        return pe.between(this.$anchor, this.$head).getBookmark();
      }
    }], [{
      key: "findFrom",
      value: function(ue, ge) {
        var oe = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, Pe = ue.parent.inlineContent ? new pe(ue) : et(ue.node(0), ue.parent, ue.pos, ue.index(), ge, oe);
        if (Pe) return Pe;
        for (var Ve = ue.depth - 1; Ve >= 0; Ve--) {
          var lt = ge < 0 ? et(ue.node(0), ue.node(Ve), ue.before(Ve + 1), ue.index(Ve), ge, oe) : et(ue.node(0), ue.node(Ve), ue.after(Ve + 1), ue.index(Ve) + 1, ge, oe);
          if (lt) return lt;
        }
        return null;
      }
    }, {
      key: "near",
      value: function(ue) {
        var ge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
        return this.findFrom(ue, ge) || this.findFrom(ue, -ge) || new Ze(ue.node(0));
      }
    }, {
      key: "atStart",
      value: function(ue) {
        return et(ue, ue, 0, 0, 1) || new Ze(ue);
      }
    }, {
      key: "atEnd",
      value: function(ue) {
        return et(ue, ue, ue.content.size, ue.childCount, -1) || new Ze(ue);
      }
    }, {
      key: "fromJSON",
      value: function(ue, ge) {
        if (!ge || !ge.type) throw new RangeError("Invalid input for Selection.fromJSON");
        var oe = j[ge.type];
        if (!oe) throw new RangeError("No selection type ".concat(ge.type, " defined"));
        return oe.fromJSON(ue, ge);
      }
    }, {
      key: "jsonID",
      value: function(ue, ge) {
        if (ue in j) throw new RangeError("Duplicate use of selection JSON ID " + ue);
        return j[ue] = ge, ge.prototype.jsonID = ue, ge;
      }
    }]), Te;
  })();
  te.prototype.visible = !0;
  var se = N(function Te(be, ue) {
    y(this, Te), this.$from = be, this.$to = ue;
  }), me = !1;
  function Ce(Te) {
    !me && !Te.parent.inlineContent && (me = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + Te.parent.type.name + ")"));
  }
  var pe = (function(Te) {
    t(ue, Te);
    var be = i(ue);
    function ue(ge) {
      var oe = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ge;
      return y(this, ue), Ce(ge), Ce(oe), be.call(this, ge, oe);
    }
    return N(ue, [{
      key: "$cursor",
      get: function() {
        return this.$anchor.pos == this.$head.pos ? this.$head : null;
      }
    }, {
      key: "map",
      value: function(oe, Pe) {
        var Ve = oe.resolve(Pe.map(this.head));
        if (!Ve.parent.inlineContent) return te.near(Ve);
        var lt = oe.resolve(Pe.map(this.anchor));
        return new ue(lt.parent.inlineContent ? lt : Ve, Ve);
      }
    }, {
      key: "replace",
      value: function(oe) {
        var Pe = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : q.Slice.empty;
        if (r(f(ue.prototype), "replace", this).call(this, oe, Pe), Pe == q.Slice.empty) {
          var Ve = this.$from.marksAcross(this.$to);
          Ve && oe.ensureMarks(Ve);
        }
      }
    }, {
      key: "eq",
      value: function(oe) {
        return oe instanceof ue && oe.anchor == this.anchor && oe.head == this.head;
      }
    }, {
      key: "getBookmark",
      value: function() {
        return new ke(this.anchor, this.head);
      }
    }, {
      key: "toJSON",
      value: function() {
        return {
          type: "text",
          anchor: this.anchor,
          head: this.head
        };
      }
    }], [{
      key: "fromJSON",
      value: function(oe, Pe) {
        if (typeof Pe.anchor != "number" || typeof Pe.head != "number") throw new RangeError("Invalid input for TextSelection.fromJSON");
        return new ue(oe.resolve(Pe.anchor), oe.resolve(Pe.head));
      }
    }, {
      key: "create",
      value: function(oe, Pe) {
        var Ve = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Pe, lt = oe.resolve(Pe);
        return new this(lt, Ve == Pe ? lt : oe.resolve(Ve));
      }
    }, {
      key: "between",
      value: function(oe, Pe, Ve) {
        var lt = oe.pos - Pe.pos;
        if ((!Ve || lt) && (Ve = lt >= 0 ? 1 : -1), !Pe.parent.inlineContent) {
          var Tt = te.findFrom(Pe, Ve, !0) || te.findFrom(Pe, -Ve, !0);
          if (Tt) Pe = Tt.$head;
          else return te.near(Pe, Ve);
        }
        return oe.parent.inlineContent || (lt == 0 ? oe = Pe : (oe = (te.findFrom(oe, -Ve, !0) || te.findFrom(oe, Ve, !0)).$anchor, oe.pos < Pe.pos != lt < 0 && (oe = Pe))), new ue(oe, Pe);
      }
    }]), ue;
  })(te);
  te.jsonID("text", pe);
  var ke = (function() {
    function Te(be, ue) {
      y(this, Te), this.anchor = be, this.head = ue;
    }
    return N(Te, [{
      key: "map",
      value: function(ue) {
        return new Te(ue.map(this.anchor), ue.map(this.head));
      }
    }, {
      key: "resolve",
      value: function(ue) {
        return pe.between(ue.resolve(this.anchor), ue.resolve(this.head));
      }
    }]), Te;
  })(), Ne = (function(Te) {
    t(ue, Te);
    var be = i(ue);
    function ue(ge) {
      var oe;
      y(this, ue);
      var Pe = ge.nodeAfter, Ve = ge.node(0).resolve(ge.pos + Pe.nodeSize);
      return oe = be.call(this, ge, Ve), oe.node = Pe, oe;
    }
    return N(ue, [{
      key: "map",
      value: function(oe, Pe) {
        var Ve = Pe.mapResult(this.anchor), lt = Ve.deleted, Tt = Ve.pos, Yt = oe.resolve(Tt);
        return lt ? te.near(Yt) : new ue(Yt);
      }
    }, {
      key: "content",
      value: function() {
        return new q.Slice(q.Fragment.from(this.node), 0, 0);
      }
    }, {
      key: "eq",
      value: function(oe) {
        return oe instanceof ue && oe.anchor == this.anchor;
      }
    }, {
      key: "toJSON",
      value: function() {
        return {
          type: "node",
          anchor: this.anchor
        };
      }
    }, {
      key: "getBookmark",
      value: function() {
        return new ze(this.anchor);
      }
    }], [{
      key: "fromJSON",
      value: function(oe, Pe) {
        if (typeof Pe.anchor != "number") throw new RangeError("Invalid input for NodeSelection.fromJSON");
        return new ue(oe.resolve(Pe.anchor));
      }
    }, {
      key: "create",
      value: function(oe, Pe) {
        return new ue(oe.resolve(Pe));
      }
    }, {
      key: "isSelectable",
      value: function(oe) {
        return !oe.isText && oe.type.spec.selectable !== !1;
      }
    }]), ue;
  })(te);
  Ne.prototype.visible = !1, te.jsonID("node", Ne);
  var ze = (function() {
    function Te(be) {
      y(this, Te), this.anchor = be;
    }
    return N(Te, [{
      key: "map",
      value: function(ue) {
        var ge = ue.mapResult(this.anchor), oe = ge.deleted, Pe = ge.pos;
        return oe ? new ke(Pe, Pe) : new Te(Pe);
      }
    }, {
      key: "resolve",
      value: function(ue) {
        var ge = ue.resolve(this.anchor), oe = ge.nodeAfter;
        return oe && Ne.isSelectable(oe) ? new Ne(ge) : te.near(ge);
      }
    }]), Te;
  })(), Ze = (function(Te) {
    t(ue, Te);
    var be = i(ue);
    function ue(ge) {
      return y(this, ue), be.call(this, ge.resolve(0), ge.resolve(ge.content.size));
    }
    return N(ue, [{
      key: "replace",
      value: function(oe) {
        var Pe = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : q.Slice.empty;
        if (Pe == q.Slice.empty) {
          oe.delete(0, oe.doc.content.size);
          var Ve = te.atStart(oe.doc);
          Ve.eq(oe.selection) || oe.setSelection(Ve);
        } else
          r(f(ue.prototype), "replace", this).call(this, oe, Pe);
      }
    }, {
      key: "toJSON",
      value: function() {
        return {
          type: "all"
        };
      }
    }, {
      key: "map",
      value: function(oe) {
        return new ue(oe);
      }
    }, {
      key: "eq",
      value: function(oe) {
        return oe instanceof ue;
      }
    }, {
      key: "getBookmark",
      value: function() {
        return At;
      }
    }], [{
      key: "fromJSON",
      value: function(oe) {
        return new ue(oe);
      }
    }]), ue;
  })(te);
  te.jsonID("all", Ze);
  var At = {
    map: function() {
      return this;
    },
    resolve: function(be) {
      return new Ze(be);
    }
  };
  function et(Te, be, ue, ge, oe) {
    var Pe = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !1;
    if (be.inlineContent) return pe.create(Te, ue);
    for (var Ve = ge - (oe > 0 ? 0 : 1); oe > 0 ? Ve < be.childCount : Ve >= 0; Ve += oe) {
      var lt = be.child(Ve);
      if (lt.isAtom) {
        if (!Pe && Ne.isSelectable(lt))
          return Ne.create(Te, ue - (oe < 0 ? lt.nodeSize : 0));
      } else {
        var Tt = et(Te, lt, ue + oe, oe < 0 ? lt.childCount : 0, oe, Pe);
        if (Tt) return Tt;
      }
      ue += lt.nodeSize * oe;
    }
    return null;
  }
  function Ht(Te, be, ue) {
    var ge = Te.steps.length - 1;
    if (!(ge < be)) {
      var oe = Te.steps[ge];
      if (oe instanceof U.ReplaceStep || oe instanceof U.ReplaceAroundStep) {
        var Pe = Te.mapping.maps[ge], Ve;
        Pe.forEach(function(lt, Tt, Yt, jt) {
          Ve == null && (Ve = jt);
        }), Te.setSelection(te.near(Te.doc.resolve(Ve), ue));
      }
    }
  }
  var Rt = 1, Ut = 2, yt = 4, It = (function(Te) {
    t(ue, Te);
    var be = i(ue);
    function ue(ge) {
      var oe;
      return y(this, ue), oe = be.call(this, ge.doc), oe.curSelectionFor = 0, oe.updated = 0, oe.meta = /* @__PURE__ */ Object.create(null), oe.time = Date.now(), oe.curSelection = ge.selection, oe.storedMarks = ge.storedMarks, oe;
    }
    return N(ue, [{
      key: "selection",
      get: function() {
        return this.curSelectionFor < this.steps.length && (this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor)), this.curSelectionFor = this.steps.length), this.curSelection;
      }
    }, {
      key: "setSelection",
      value: function(oe) {
        if (oe.$from.doc != this.doc) throw new RangeError("Selection passed to setSelection must point at the current document");
        return this.curSelection = oe, this.curSelectionFor = this.steps.length, this.updated = (this.updated | Rt) & ~Ut, this.storedMarks = null, this;
      }
    }, {
      key: "selectionSet",
      get: function() {
        return (this.updated & Rt) > 0;
      }
    }, {
      key: "setStoredMarks",
      value: function(oe) {
        return this.storedMarks = oe, this.updated |= Ut, this;
      }
    }, {
      key: "ensureMarks",
      value: function(oe) {
        return q.Mark.sameSet(this.storedMarks || this.selection.$from.marks(), oe) || this.setStoredMarks(oe), this;
      }
    }, {
      key: "addStoredMark",
      value: function(oe) {
        return this.ensureMarks(oe.addToSet(this.storedMarks || this.selection.$head.marks()));
      }
    }, {
      key: "removeStoredMark",
      value: function(oe) {
        return this.ensureMarks(oe.removeFromSet(this.storedMarks || this.selection.$head.marks()));
      }
    }, {
      key: "storedMarksSet",
      get: function() {
        return (this.updated & Ut) > 0;
      }
    }, {
      key: "addStep",
      value: function(oe, Pe) {
        r(f(ue.prototype), "addStep", this).call(this, oe, Pe), this.updated = this.updated & ~Ut, this.storedMarks = null;
      }
    }, {
      key: "setTime",
      value: function(oe) {
        return this.time = oe, this;
      }
    }, {
      key: "replaceSelection",
      value: function(oe) {
        return this.selection.replace(this, oe), this;
      }
    }, {
      key: "replaceSelectionWith",
      value: function(oe) {
        var Pe = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, Ve = this.selection;
        return Pe && (oe = oe.mark(this.storedMarks || (Ve.empty ? Ve.$from.marks() : Ve.$from.marksAcross(Ve.$to) || q.Mark.none))), Ve.replaceWith(this, oe), this;
      }
    }, {
      key: "deleteSelection",
      value: function() {
        return this.selection.replace(this), this;
      }
    }, {
      key: "insertText",
      value: function(oe, Pe, Ve) {
        var lt = this.doc.type.schema;
        if (Pe == null)
          return oe ? this.replaceSelectionWith(lt.text(oe), !0) : this.deleteSelection();
        if (Ve == null && (Ve = Pe), !oe) return this.deleteRange(Pe, Ve);
        var Tt = this.storedMarks;
        if (!Tt) {
          var Yt = this.doc.resolve(Pe);
          Tt = Ve == Pe ? Yt.marks() : Yt.marksAcross(this.doc.resolve(Ve));
        }
        return this.replaceRangeWith(Pe, Ve, lt.text(oe, Tt)), !this.selection.empty && this.selection.to == Pe + oe.length && this.setSelection(te.near(this.selection.$to)), this;
      }
    }, {
      key: "setMeta",
      value: function(oe, Pe) {
        return this.meta[typeof oe == "string" ? oe : oe.key] = Pe, this;
      }
    }, {
      key: "getMeta",
      value: function(oe) {
        return this.meta[typeof oe == "string" ? oe : oe.key];
      }
    }, {
      key: "isGeneric",
      get: function() {
        for (var oe in this.meta) return !1;
        return !0;
      }
    }, {
      key: "scrollIntoView",
      value: function() {
        return this.updated |= yt, this;
      }
    }, {
      key: "scrolledIntoView",
      get: function() {
        return (this.updated & yt) > 0;
      }
    }]), ue;
  })(U.Transform);
  function Ke(Te, be) {
    return !be || !Te ? Te : Te.bind(be);
  }
  var ct = N(function Te(be, ue, ge) {
    y(this, Te), this.name = be, this.init = Ke(ue.init, ge), this.apply = Ke(ue.apply, ge);
  }), He = [new ct("doc", {
    init: function(be) {
      return be.doc || be.schema.topNodeType.createAndFill();
    },
    apply: function(be) {
      return be.doc;
    }
  }), new ct("selection", {
    init: function(be, ue) {
      return be.selection || te.atStart(ue.doc);
    },
    apply: function(be) {
      return be.selection;
    }
  }), new ct("storedMarks", {
    init: function(be) {
      return be.storedMarks || null;
    },
    apply: function(be, ue, ge, oe) {
      return oe.selection.$cursor ? be.storedMarks : null;
    }
  }), new ct("scrollToSelection", {
    init: function() {
      return 0;
    },
    apply: function(be, ue) {
      return be.scrolledIntoView ? ue + 1 : ue;
    }
  })], fe = N(function Te(be, ue) {
    var ge = this;
    y(this, Te), this.schema = be, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = He.slice(), ue && ue.forEach(function(oe) {
      if (ge.pluginsByKey[oe.key]) throw new RangeError("Adding different instances of a keyed plugin (" + oe.key + ")");
      ge.plugins.push(oe), ge.pluginsByKey[oe.key] = oe, oe.spec.state && ge.fields.push(new ct(oe.key, oe.spec.state, oe));
    });
  }), Le = (function() {
    function Te(be) {
      y(this, Te), this.config = be;
    }
    return N(Te, [{
      key: "schema",
      get: function() {
        return this.config.schema;
      }
    }, {
      key: "plugins",
      get: function() {
        return this.config.plugins;
      }
    }, {
      key: "apply",
      value: function(ue) {
        return this.applyTransaction(ue).state;
      }
    }, {
      key: "filterTransaction",
      value: function(ue) {
        for (var ge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1, oe = 0; oe < this.config.plugins.length; oe++) if (oe != ge) {
          var Pe = this.config.plugins[oe];
          if (Pe.spec.filterTransaction && !Pe.spec.filterTransaction.call(Pe, ue, this)) return !1;
        }
        return !0;
      }
    }, {
      key: "applyTransaction",
      value: function(ue) {
        if (!this.filterTransaction(ue)) return {
          state: this,
          transactions: []
        };
        for (var ge = [ue], oe = this.applyInner(ue), Pe = null; ; ) {
          for (var Ve = !1, lt = 0; lt < this.config.plugins.length; lt++) {
            var Tt = this.config.plugins[lt];
            if (Tt.spec.appendTransaction) {
              var Yt = Pe ? Pe[lt].n : 0, jt = Pe ? Pe[lt].state : this, mr = Yt < ge.length && Tt.spec.appendTransaction.call(Tt, Yt ? ge.slice(Yt) : ge, jt, oe);
              if (mr && oe.filterTransaction(mr, lt)) {
                if (mr.setMeta("appendedTransaction", ue), !Pe) {
                  Pe = [];
                  for (var tr = 0; tr < this.config.plugins.length; tr++) Pe.push(tr < lt ? {
                    state: oe,
                    n: ge.length
                  } : {
                    state: this,
                    n: 0
                  });
                }
                ge.push(mr), oe = oe.applyInner(mr), Ve = !0;
              }
              Pe && (Pe[lt] = {
                state: oe,
                n: ge.length
              });
            }
          }
          if (!Ve) return {
            state: oe,
            transactions: ge
          };
        }
      }
    }, {
      key: "applyInner",
      value: function(ue) {
        if (!ue.before.eq(this.doc)) throw new RangeError("Applying a mismatched transaction");
        for (var ge = new Te(this.config), oe = this.config.fields, Pe = 0; Pe < oe.length; Pe++) {
          var Ve = oe[Pe];
          ge[Ve.name] = Ve.apply(ue, this[Ve.name], this, ge);
        }
        return ge;
      }
    }, {
      key: "tr",
      get: function() {
        return new It(this);
      }
    }, {
      key: "reconfigure",
      value: function(ue) {
        for (var ge = new fe(this.schema, ue.plugins), oe = ge.fields, Pe = new Te(ge), Ve = 0; Ve < oe.length; Ve++) {
          var lt = oe[Ve].name;
          Pe[lt] = this.hasOwnProperty(lt) ? this[lt] : oe[Ve].init(ue, Pe);
        }
        return Pe;
      }
    }, {
      key: "toJSON",
      value: function(ue) {
        var ge = {
          doc: this.doc.toJSON(),
          selection: this.selection.toJSON()
        };
        if (this.storedMarks && (ge.storedMarks = this.storedMarks.map(function(lt) {
          return lt.toJSON();
        })), ue && p(ue) == "object") for (var oe in ue) {
          if (oe == "doc" || oe == "selection") throw new RangeError("The JSON fields `doc` and `selection` are reserved");
          var Pe = ue[oe], Ve = Pe.spec.state;
          Ve && Ve.toJSON && (ge[oe] = Ve.toJSON.call(Pe, this[Pe.key]));
        }
        return ge;
      }
    }], [{
      key: "create",
      value: function(ue) {
        for (var ge = new fe(ue.doc ? ue.doc.type.schema : ue.schema, ue.plugins), oe = new Te(ge), Pe = 0; Pe < ge.fields.length; Pe++) oe[ge.fields[Pe].name] = ge.fields[Pe].init(ue, oe);
        return oe;
      }
    }, {
      key: "fromJSON",
      value: function(ue, ge, oe) {
        if (!ge) throw new RangeError("Invalid input for EditorState.fromJSON");
        if (!ue.schema) throw new RangeError("Required config field 'schema' missing");
        var Pe = new fe(ue.schema, ue.plugins), Ve = new Te(Pe);
        return Pe.fields.forEach(function(lt) {
          if (lt.name == "doc")
            Ve.doc = q.Node.fromJSON(ue.schema, ge.doc);
          else if (lt.name == "selection")
            Ve.selection = te.fromJSON(Ve.doc, ge.selection);
          else if (lt.name == "storedMarks")
            ge.storedMarks && (Ve.storedMarks = ge.storedMarks.map(ue.schema.markFromJSON));
          else {
            if (oe) for (var Tt in oe) {
              var Yt = oe[Tt], jt = Yt.spec.state;
              if (Yt.key == lt.name && jt && jt.fromJSON && Object.prototype.hasOwnProperty.call(ge, Tt)) {
                Ve[lt.name] = jt.fromJSON.call(Yt, ue, ge[Tt], Ve);
                return;
              }
            }
            Ve[lt.name] = lt.init(ue, Ve);
          }
        }), Ve;
      }
    }]), Te;
  })();
  function dt(Te, be, ue) {
    for (var ge in Te) {
      var oe = Te[ge];
      oe instanceof Function ? oe = oe.bind(be) : ge == "handleDOMEvents" && (oe = dt(oe, be, {})), ue[ge] = oe;
    }
    return ue;
  }
  var vt = (function() {
    function Te(be) {
      y(this, Te), this.spec = be, this.props = {}, be.props && dt(be.props, this, this.props), this.key = be.key ? be.key.key : Lt("plugin");
    }
    return N(Te, [{
      key: "getState",
      value: function(ue) {
        return ue[this.key];
      }
    }]), Te;
  })(), Ft = /* @__PURE__ */ Object.create(null);
  function Lt(Te) {
    return Te in Ft ? Te + "$" + ++Ft[Te] : (Ft[Te] = 0, Te + "$");
  }
  var $t = (function() {
    function Te() {
      var be = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "key";
      y(this, Te), this.key = Lt(be);
    }
    return N(Te, [{
      key: "get",
      value: function(ue) {
        return ue.config.pluginsByKey[this.key];
      }
    }, {
      key: "getState",
      value: function(ue) {
        return ue[this.key];
      }
    }]), Te;
  })();
  return Qa.AllSelection = Ze, Qa.EditorState = Le, Qa.NodeSelection = Ne, Qa.Plugin = vt, Qa.PluginKey = $t, Qa.Selection = te, Qa.SelectionRange = se, Qa.TextSelection = pe, Qa.Transaction = It, Qa;
}
var FT;
function k9e() {
  if (FT) return $i;
  FT = 1;
  function r(se, me, Ce) {
    return Object.defineProperty(se, "prototype", { writable: !1 }), se;
  }
  function e(se, me) {
    if (!(se instanceof me))
      throw new TypeError("Cannot call a class as a function");
  }
  var t = /* @__PURE__ */ jm(), n = /* @__PURE__ */ qk(), i = r(function se(me, Ce) {
    var pe = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    e(this, se), this.match = me, this.match = me, this.handler = typeof Ce == "string" ? a(Ce) : Ce, this.undoable = pe.undoable !== !1, this.inCode = pe.inCode || !1, this.inCodeMark = pe.inCodeMark !== !1;
  });
  function a(se) {
    return function(me, Ce, pe, ke) {
      var Ne = se;
      if (Ce[1]) {
        var ze = Ce[0].lastIndexOf(Ce[1]);
        Ne += Ce[0].slice(ze + Ce[1].length), pe += ze;
        var Ze = pe - ke;
        Ze > 0 && (Ne = Ce[0].slice(ze - Ze, ze) + Ne, pe = ke);
      }
      return me.tr.insertText(Ne, pe, ke);
    };
  }
  var s = 500;
  function u(se) {
    var me = se.rules, Ce = new t.Plugin({
      state: {
        init: function() {
          return null;
        },
        apply: function(ke, Ne) {
          var ze = ke.getMeta(this);
          return ze || (ke.selectionSet || ke.docChanged ? null : Ne);
        }
      },
      props: {
        handleTextInput: function(ke, Ne, ze, Ze) {
          return f(ke, Ne, ze, Ze, me, Ce);
        },
        handleDOMEvents: {
          compositionend: function(ke) {
            setTimeout(function() {
              var Ne = ke.state.selection.$cursor;
              Ne && f(ke, Ne.pos, Ne.pos, "", me, Ce);
            });
          }
        }
      },
      isInputRules: !0
    });
    return Ce;
  }
  function f(se, me, Ce, pe, ke, Ne) {
    if (se.composing) return !1;
    for (var ze = se.state, Ze = ze.doc.resolve(me), At = Ze.parent.textBetween(Math.max(0, Ze.parentOffset - s), Ze.parentOffset, null, "￼") + pe, et = function() {
      var yt = ke[Rt];
      if (!yt.inCodeMark && Ze.marks().some(function(fe) {
        return fe.type.spec.code;
      })) return 0;
      if (Ze.parent.type.spec.code) {
        if (!yt.inCode) return 0;
      } else if (yt.inCode === "only")
        return 0;
      var It = yt.match.exec(At);
      if (!It || It[0].length < pe.length) return 0;
      var Ke = me - (It[0].length - pe.length);
      if (!yt.inCodeMark) {
        var ct = !1;
        if (ze.doc.nodesBetween(Ke, Ze.pos, function(fe) {
          fe.isInline && fe.marks.some(function(Le) {
            return Le.type.spec.code;
          }) && (ct = !0);
        }), ct) return 0;
      }
      var He = yt.handler(ze, It, Ke, Ce);
      return He ? (yt.undoable && He.setMeta(Ne, {
        transform: He,
        from: me,
        to: Ce,
        text: pe
      }), se.dispatch(He), {
        v: !0
      }) : 0;
    }, Ht, Rt = 0; Rt < ke.length; Rt++)
      if (Ht = et(), Ht !== 0 && Ht)
        return Ht.v;
    return !1;
  }
  var p = function(me, Ce) {
    for (var pe = me.plugins, ke = 0; ke < pe.length; ke++) {
      var Ne = pe[ke], ze = void 0;
      if (Ne.spec.isInputRules && (ze = Ne.getState(me))) {
        if (Ce) {
          for (var Ze = me.tr, At = ze.transform, et = At.steps.length - 1; et >= 0; et--) Ze.step(At.steps[et].invert(At.docs[et]));
          if (ze.text) {
            var Ht = Ze.doc.resolve(ze.from).marks();
            Ze.replaceWith(ze.from, ze.to, me.schema.text(ze.text, Ht));
          } else
            Ze.delete(ze.from, ze.to);
          Ce(Ze);
        }
        return !0;
      }
    }
    return !1;
  }, y = new i(/--$/, "—", {
    inCodeMark: !1
  }), T = new i(/\.\.\.$/, "…", {
    inCodeMark: !1
  }), N = new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "“", {
    inCodeMark: !1
  }), O = new i(/"$/, "”", {
    inCodeMark: !1
  }), A = new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "‘", {
    inCodeMark: !1
  }), q = new i(/'$/, "’", {
    inCodeMark: !1
  }), U = [N, O, A, q];
  function j(se, me) {
    var Ce = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, pe = arguments.length > 3 ? arguments[3] : void 0;
    return new i(se, function(ke, Ne, ze, Ze) {
      var At = Ce instanceof Function ? Ce(Ne) : Ce, et = ke.tr.delete(ze, Ze), Ht = et.doc.resolve(ze), Rt = Ht.blockRange(), Ut = Rt && n.findWrapping(Rt, me, At);
      if (!Ut) return null;
      et.wrap(Rt, Ut);
      var yt = et.doc.resolve(ze - 1).nodeBefore;
      return yt && yt.type == me && n.canJoin(et.doc, ze - 1) && (!pe || pe(Ne, yt)) && et.join(ze - 1), et;
    });
  }
  function te(se, me) {
    var Ce = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
    return new i(se, function(pe, ke, Ne, ze) {
      var Ze = pe.doc.resolve(Ne), At = Ce instanceof Function ? Ce(ke) : Ce;
      return Ze.node(-1).canReplaceWith(Ze.index(-1), Ze.indexAfter(-1), me) ? pe.tr.delete(Ne, ze).setBlockType(Ne, Ne, me, At) : null;
    });
  }
  return $i.InputRule = i, $i.closeDoubleQuote = O, $i.closeSingleQuote = q, $i.ellipsis = T, $i.emDash = y, $i.inputRules = u, $i.openDoubleQuote = N, $i.openSingleQuote = A, $i.smartQuotes = U, $i.textblockTypeInputRule = te, $i.undoInputRule = p, $i.wrappingInputRule = j, $i;
}
var Pv = {}, Gc = {}, _T;
function w9e() {
  if (_T) return Gc;
  _T = 1, Object.defineProperty(Gc, "__esModule", { value: !0 });
  for (var r = {
    8: "Backspace",
    9: "Tab",
    10: "Enter",
    12: "NumLock",
    13: "Enter",
    16: "Shift",
    17: "Control",
    18: "Alt",
    20: "CapsLock",
    27: "Escape",
    32: " ",
    33: "PageUp",
    34: "PageDown",
    35: "End",
    36: "Home",
    37: "ArrowLeft",
    38: "ArrowUp",
    39: "ArrowRight",
    40: "ArrowDown",
    44: "PrintScreen",
    45: "Insert",
    46: "Delete",
    59: ";",
    61: "=",
    91: "Meta",
    92: "Meta",
    106: "*",
    107: "+",
    108: ",",
    109: "-",
    110: ".",
    111: "/",
    144: "NumLock",
    145: "ScrollLock",
    160: "Shift",
    161: "Shift",
    162: "Control",
    163: "Control",
    164: "Alt",
    165: "Alt",
    173: "-",
    186: ";",
    187: "=",
    188: ",",
    189: "-",
    190: ".",
    191: "/",
    192: "`",
    219: "[",
    220: "\\",
    221: "]",
    222: "'"
  }, e = {
    48: ")",
    49: "!",
    50: "@",
    51: "#",
    52: "$",
    53: "%",
    54: "^",
    55: "&",
    56: "*",
    57: "(",
    59: ":",
    61: "+",
    173: "_",
    186: ":",
    187: "+",
    188: "<",
    189: "_",
    190: ">",
    191: "?",
    192: "~",
    219: "{",
    220: "|",
    221: "}",
    222: '"'
  }, t = typeof navigator < "u" && /Mac/.test(navigator.platform), n = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent), i = 0; i < 10; i++) r[48 + i] = r[96 + i] = String(i);
  for (var i = 1; i <= 24; i++) r[i + 111] = "F" + i;
  for (var i = 65; i <= 90; i++)
    r[i] = String.fromCharCode(i + 32), e[i] = String.fromCharCode(i);
  for (var a in r) e.hasOwnProperty(a) || (e[a] = r[a]);
  function s(u) {
    var f = t && u.metaKey && u.shiftKey && !u.ctrlKey && !u.altKey || n && u.shiftKey && u.key && u.key.length == 1 || u.key == "Unidentified", p = !f && u.key || (u.shiftKey ? e : r)[u.keyCode] || u.key || "Unidentified";
    return p == "Esc" && (p = "Escape"), p == "Del" && (p = "Delete"), p == "Left" && (p = "ArrowLeft"), p == "Up" && (p = "ArrowUp"), p == "Right" && (p = "ArrowRight"), p == "Down" && (p = "ArrowDown"), p;
  }
  return Gc.base = r, Gc.keyName = s, Gc.shift = e, Gc;
}
var qT;
function b9e() {
  if (qT) return Pv;
  qT = 1;
  var r = w9e(), e = /* @__PURE__ */ jm(), t = typeof navigator < "u" && /Mac|iP(hone|[oa]d)/.test(navigator.platform), n = typeof navigator < "u" && /Win/.test(navigator.platform);
  function i(p) {
    var y = p.split(/-(?!$)/), T = y[y.length - 1];
    T == "Space" && (T = " ");
    for (var N, O, A, q, U = 0; U < y.length - 1; U++) {
      var j = y[U];
      if (/^(cmd|meta|m)$/i.test(j)) q = !0;
      else if (/^a(lt)?$/i.test(j)) N = !0;
      else if (/^(c|ctrl|control)$/i.test(j)) O = !0;
      else if (/^s(hift)?$/i.test(j)) A = !0;
      else if (/^mod$/i.test(j))
        t ? q = !0 : O = !0;
      else throw new Error("Unrecognized modifier name: " + j);
    }
    return N && (T = "Alt-" + T), O && (T = "Ctrl-" + T), q && (T = "Meta-" + T), A && (T = "Shift-" + T), T;
  }
  function a(p) {
    var y = /* @__PURE__ */ Object.create(null);
    for (var T in p) y[i(T)] = p[T];
    return y;
  }
  function s(p, y) {
    var T = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0;
    return y.altKey && (p = "Alt-" + p), y.ctrlKey && (p = "Ctrl-" + p), y.metaKey && (p = "Meta-" + p), T && y.shiftKey && (p = "Shift-" + p), p;
  }
  function u(p) {
    return new e.Plugin({
      props: {
        handleKeyDown: f(p)
      }
    });
  }
  function f(p) {
    var y = a(p);
    return function(T, N) {
      var O = r.keyName(N), A, q = y[s(O, N)];
      if (q && q(T.state, T.dispatch, T)) return !0;
      if (O.length == 1 && O != " ") {
        if (N.shiftKey) {
          var U = y[s(O, N, !1)];
          if (U && U(T.state, T.dispatch, T)) return !0;
        }
        if ((N.altKey || N.metaKey || N.ctrlKey) && !(n && N.ctrlKey && N.altKey) && (A = r.base[N.keyCode]) && A != O) {
          var j = y[s(A, N)];
          if (j && j(T.state, T.dispatch, T)) return !0;
        }
      }
      return !1;
    };
  }
  return Pv.keydownHandler = f, Pv.keymap = u, Pv;
}
var cu = {}, zT;
function C9e() {
  if (zT) return cu;
  zT = 1;
  function r(d, w) {
    return n(d) || t(d, w) || a(d, w) || e();
  }
  function e() {
    throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
  }
  function t(d, w) {
    var h = d == null ? null : typeof Symbol < "u" && d[Symbol.iterator] || d["@@iterator"];
    if (h != null) {
      var k, S, M, P, I = [], W = !0, Y = !1;
      try {
        if (M = (h = h.call(d)).next, w !== 0) for (; !(W = (k = M.call(h)).done) && (I.push(k.value), I.length !== w); W = !0) ;
      } catch (le) {
        Y = !0, S = le;
      } finally {
        try {
          if (!W && h.return != null && (P = h.return(), Object(P) !== P)) return;
        } finally {
          if (Y) throw S;
        }
      }
      return I;
    }
  }
  function n(d) {
    if (Array.isArray(d)) return d;
  }
  function i(d, w) {
    var h = typeof Symbol < "u" && d[Symbol.iterator] || d["@@iterator"];
    if (!h) {
      if (Array.isArray(d) || (h = a(d)) || w) {
        h && (d = h);
        var k = 0, S = function() {
        };
        return { s: S, n: function() {
          return k >= d.length ? { done: !0 } : { done: !1, value: d[k++] };
        }, e: function(Y) {
          throw Y;
        }, f: S };
      }
      throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
    }
    var M = !0, P = !1, I;
    return { s: function() {
      h = h.call(d);
    }, n: function() {
      var Y = h.next();
      return M = Y.done, Y;
    }, e: function(Y) {
      P = !0, I = Y;
    }, f: function() {
      try {
        !M && h.return != null && h.return();
      } finally {
        if (P) throw I;
      }
    } };
  }
  function a(d, w) {
    if (d) {
      if (typeof d == "string") return s(d, w);
      var h = Object.prototype.toString.call(d).slice(8, -1);
      if (h === "Object" && d.constructor && (h = d.constructor.name), h === "Map" || h === "Set") return Array.from(d);
      if (h === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)) return s(d, w);
    }
  }
  function s(d, w) {
    (w == null || w > d.length) && (w = d.length);
    for (var h = 0, k = new Array(w); h < w; h++) k[h] = d[h];
    return k;
  }
  function u() {
    return typeof Reflect < "u" && Reflect.get ? u = Reflect.get.bind() : u = function(w, h, k) {
      var S = f(w, h);
      if (S) {
        var M = Object.getOwnPropertyDescriptor(S, h);
        return M.get ? M.get.call(arguments.length < 3 ? w : k) : M.value;
      }
    }, u.apply(this, arguments);
  }
  function f(d, w) {
    for (; !Object.prototype.hasOwnProperty.call(d, w) && (d = q(d), d !== null); )
      ;
    return d;
  }
  function p(d, w) {
    if (typeof w != "function" && w !== null)
      throw new TypeError("Super expression must either be null or a function");
    d.prototype = Object.create(w && w.prototype, { constructor: { value: d, writable: !0, configurable: !0 } }), Object.defineProperty(d, "prototype", { writable: !1 }), w && y(d, w);
  }
  function y(d, w) {
    return y = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(k, S) {
      return k.__proto__ = S, k;
    }, y(d, w);
  }
  function T(d) {
    var w = A();
    return function() {
      var k = q(d), S;
      if (w) {
        var M = q(this).constructor;
        S = Reflect.construct(k, arguments, M);
      } else
        S = k.apply(this, arguments);
      return N(this, S);
    };
  }
  function N(d, w) {
    if (w && (U(w) === "object" || typeof w == "function"))
      return w;
    if (w !== void 0)
      throw new TypeError("Derived constructors may only return object or undefined");
    return O(d);
  }
  function O(d) {
    if (d === void 0)
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return d;
  }
  function A() {
    if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
    if (typeof Proxy == "function") return !0;
    try {
      return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
      })), !0;
    } catch {
      return !1;
    }
  }
  function q(d) {
    return q = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(h) {
      return h.__proto__ || Object.getPrototypeOf(h);
    }, q(d);
  }
  function U(d) {
    "@babel/helpers - typeof";
    return U = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(w) {
      return typeof w;
    } : function(w) {
      return w && typeof Symbol == "function" && w.constructor === Symbol && w !== Symbol.prototype ? "symbol" : typeof w;
    }, U(d);
  }
  function j(d, w) {
    if (!(d instanceof w))
      throw new TypeError("Cannot call a class as a function");
  }
  function te(d, w) {
    for (var h = 0; h < w.length; h++) {
      var k = w[h];
      k.enumerable = k.enumerable || !1, k.configurable = !0, "value" in k && (k.writable = !0), Object.defineProperty(d, me(k.key), k);
    }
  }
  function se(d, w, h) {
    return w && te(d.prototype, w), h && te(d, h), Object.defineProperty(d, "prototype", { writable: !1 }), d;
  }
  function me(d) {
    var w = Ce(d, "string");
    return U(w) === "symbol" ? w : String(w);
  }
  function Ce(d, w) {
    if (U(d) !== "object" || d === null) return d;
    var h = d[Symbol.toPrimitive];
    if (h !== void 0) {
      var k = h.call(d, w);
      if (U(k) !== "object") return k;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return String(d);
  }
  var pe = /* @__PURE__ */ jm(), ke = /* @__PURE__ */ Wm(), Ne = /* @__PURE__ */ qk(), ze = function(w) {
    for (var h = 0; ; h++)
      if (w = w.previousSibling, !w) return h;
  }, Ze = function(w) {
    var h = w.assignedSlot || w.parentNode;
    return h && h.nodeType == 11 ? h.host : h;
  }, At = null, et = function(w, h, k) {
    var S = At || (At = document.createRange());
    return S.setEnd(w, k ?? w.nodeValue.length), S.setStart(w, h || 0), S;
  }, Ht = function() {
    At = null;
  }, Rt = function(w, h, k, S) {
    return k && (yt(w, h, k, S, -1) || yt(w, h, k, S, 1));
  }, Ut = /^(img|br|input|textarea|hr)$/i;
  function yt(d, w, h, k, S) {
    for (var M; ; ) {
      if (d == h && w == k) return !0;
      if (w == (S < 0 ? 0 : It(d))) {
        var P = d.parentNode;
        if (!P || P.nodeType != 1 || fe(d) || Ut.test(d.nodeName) || d.contentEditable == "false") return !1;
        w = ze(d) + (S < 0 ? 0 : 1), d = P;
      } else if (d.nodeType == 1) {
        var I = d.childNodes[w + (S < 0 ? -1 : 0)];
        if (I.nodeType == 1 && I.contentEditable == "false")
          if (!((M = I.pmViewDesc) === null || M === void 0) && M.ignoreForSelection) w += S;
          else return !1;
        else
          d = I, w = S < 0 ? It(d) : 0;
      } else
        return !1;
    }
  }
  function It(d) {
    return d.nodeType == 3 ? d.nodeValue.length : d.childNodes.length;
  }
  function Ke(d, w) {
    for (; ; ) {
      if (d.nodeType == 3 && w) return d;
      if (d.nodeType == 1 && w > 0) {
        if (d.contentEditable == "false") return null;
        d = d.childNodes[w - 1], w = It(d);
      } else if (d.parentNode && !fe(d))
        w = ze(d), d = d.parentNode;
      else
        return null;
    }
  }
  function ct(d, w) {
    for (; ; ) {
      if (d.nodeType == 3 && w < d.nodeValue.length) return d;
      if (d.nodeType == 1 && w < d.childNodes.length) {
        if (d.contentEditable == "false") return null;
        d = d.childNodes[w], w = 0;
      } else if (d.parentNode && !fe(d))
        w = ze(d) + 1, d = d.parentNode;
      else
        return null;
    }
  }
  function He(d, w, h) {
    for (var k = w == 0, S = w == It(d); k || S; ) {
      if (d == h) return !0;
      var M = ze(d);
      if (d = d.parentNode, !d) return !1;
      k = k && M == 0, S = S && M == It(d);
    }
  }
  function fe(d) {
    for (var w, h = d; h && !(w = h.pmViewDesc); h = h.parentNode) ;
    return w && w.node && w.node.isBlock && (w.dom == d || w.contentDOM == d);
  }
  var Le = function(w) {
    return w.focusNode && Rt(w.focusNode, w.focusOffset, w.anchorNode, w.anchorOffset);
  };
  function dt(d, w) {
    var h = document.createEvent("Event");
    return h.initEvent("keydown", !0, !0), h.keyCode = d, h.key = h.code = w, h;
  }
  function vt(d) {
    for (var w = d.activeElement; w && w.shadowRoot; ) w = w.shadowRoot.activeElement;
    return w;
  }
  function Ft(d, w, h) {
    if (d.caretPositionFromPoint)
      try {
        var k = d.caretPositionFromPoint(w, h);
        if (k) return {
          node: k.offsetNode,
          offset: Math.min(It(k.offsetNode), k.offset)
        };
      } catch {
      }
    if (d.caretRangeFromPoint) {
      var S = d.caretRangeFromPoint(w, h);
      if (S) return {
        node: S.startContainer,
        offset: Math.min(It(S.startContainer), S.startOffset)
      };
    }
  }
  var Lt = typeof navigator < "u" ? navigator : null, $t = typeof document < "u" ? document : null, Te = Lt && Lt.userAgent || "", be = /Edge\/(\d+)/.exec(Te), ue = /MSIE \d/.exec(Te), ge = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Te), oe = !!(ue || ge || be), Pe = ue ? document.documentMode : ge ? +ge[1] : be ? +be[1] : 0, Ve = !oe && /gecko\/(\d+)/i.test(Te);
  Ve && +(/Firefox\/(\d+)/.exec(Te) || [0, 0])[1];
  var lt = !oe && /Chrome\/(\d+)/.exec(Te), Tt = !!lt, Yt = lt ? +lt[1] : 0, jt = !oe && !!Lt && /Apple Computer/.test(Lt.vendor), mr = jt && (/Mobile\/\w+/.test(Te) || !!Lt && Lt.maxTouchPoints > 2), tr = mr || (Lt ? /Mac/.test(Lt.platform) : !1), yr = Lt ? /Win/.test(Lt.platform) : !1, ar = /Android \d/.test(Te), Wr = !!$t && "webkitFontSmoothing" in $t.documentElement.style, ki = Wr ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
  function Hn(d) {
    var w = d.defaultView && d.defaultView.visualViewport;
    return w ? {
      left: 0,
      right: w.width,
      top: 0,
      bottom: w.height
    } : {
      left: 0,
      right: d.documentElement.clientWidth,
      top: 0,
      bottom: d.documentElement.clientHeight
    };
  }
  function _r(d, w) {
    return typeof d == "number" ? d : d[w];
  }
  function st(d) {
    var w = d.getBoundingClientRect(), h = w.width / d.offsetWidth || 1, k = w.height / d.offsetHeight || 1;
    return {
      left: w.left,
      right: w.left + d.clientWidth * h,
      top: w.top,
      bottom: w.top + d.clientHeight * k
    };
  }
  function ut(d, w, h) {
    for (var k = d.someProp("scrollThreshold") || 0, S = d.someProp("scrollMargin") || 5, M = d.dom.ownerDocument, P = h || d.dom; P; ) {
      if (P.nodeType != 1) {
        P = Ze(P);
        continue;
      }
      var I = P, W = I == M.body, Y = W ? Hn(M) : st(I), le = 0, xe = 0;
      if (w.top < Y.top + _r(k, "top") ? xe = -(Y.top - w.top + _r(S, "top")) : w.bottom > Y.bottom - _r(k, "bottom") && (xe = w.bottom - w.top > Y.bottom - Y.top ? w.top + _r(S, "top") - Y.top : w.bottom - Y.bottom + _r(S, "bottom")), w.left < Y.left + _r(k, "left") ? le = -(Y.left - w.left + _r(S, "left")) : w.right > Y.right - _r(k, "right") && (le = w.right - Y.right + _r(S, "right")), le || xe)
        if (W)
          M.defaultView.scrollBy(le, xe);
        else {
          var ve = I.scrollLeft, Re = I.scrollTop;
          xe && (I.scrollTop += xe), le && (I.scrollLeft += le);
          var Ue = I.scrollLeft - ve, nt = I.scrollTop - Re;
          w = {
            left: w.left - Ue,
            top: w.top - nt,
            right: w.right - Ue,
            bottom: w.bottom - nt
          };
        }
      var gt = W ? "fixed" : getComputedStyle(P).position;
      if (/^(fixed|sticky)$/.test(gt)) break;
      P = gt == "absolute" ? P.offsetParent : Ze(P);
    }
  }
  function _t(d) {
    for (var w = d.dom.getBoundingClientRect(), h = Math.max(0, w.top), k, S, M = (w.left + w.right) / 2, P = h + 1; P < Math.min(innerHeight, w.bottom); P += 5) {
      var I = d.root.elementFromPoint(M, P);
      if (!(!I || I == d.dom || !d.dom.contains(I))) {
        var W = I.getBoundingClientRect();
        if (W.top >= h - 20) {
          k = I, S = W.top;
          break;
        }
      }
    }
    return {
      refDOM: k,
      refTop: S,
      stack: Vt(d.dom)
    };
  }
  function Vt(d) {
    for (var w = [], h = d.ownerDocument, k = d; k && (w.push({
      dom: k,
      top: k.scrollTop,
      left: k.scrollLeft
    }), d != h); k = Ze(k))
      ;
    return w;
  }
  function Zt(d) {
    var w = d.refDOM, h = d.refTop, k = d.stack, S = w ? w.getBoundingClientRect().top : 0;
    tn(k, S == 0 ? 0 : S - h);
  }
  function tn(d, w) {
    for (var h = 0; h < d.length; h++) {
      var k = d[h], S = k.dom, M = k.top, P = k.left;
      S.scrollTop != M + w && (S.scrollTop = M + w), S.scrollLeft != P && (S.scrollLeft = P);
    }
  }
  var kr = null;
  function xr(d) {
    if (d.setActive) return d.setActive();
    if (kr) return d.focus(kr);
    var w = Vt(d);
    d.focus(kr == null ? {
      get preventScroll() {
        return kr = {
          preventScroll: !0
        }, !0;
      }
    } : void 0), kr || (kr = !1, tn(w, 0));
  }
  function En(d, w) {
    for (var h, k = 2e8, S, M = 0, P = w.top, I = w.top, W, Y, le = d.firstChild, xe = 0; le; le = le.nextSibling, xe++) {
      var ve = void 0;
      if (le.nodeType == 1) ve = le.getClientRects();
      else if (le.nodeType == 3) ve = et(le).getClientRects();
      else continue;
      for (var Re = 0; Re < ve.length; Re++) {
        var Ue = ve[Re];
        if (Ue.top <= P && Ue.bottom >= I) {
          P = Math.max(Ue.bottom, P), I = Math.min(Ue.top, I);
          var nt = Ue.left > w.left ? Ue.left - w.left : Ue.right < w.left ? w.left - Ue.right : 0;
          if (nt < k) {
            h = le, k = nt, S = nt && h.nodeType == 3 ? {
              left: Ue.right < w.left ? Ue.right : Ue.left,
              top: w.top
            } : w, le.nodeType == 1 && nt && (M = xe + (w.left >= (Ue.left + Ue.right) / 2 ? 1 : 0));
            continue;
          }
        } else Ue.top > w.top && !W && Ue.left <= w.left && Ue.right >= w.left && (W = le, Y = {
          left: Math.max(Ue.left, Math.min(Ue.right, w.left)),
          top: Ue.top
        });
        !h && (w.left >= Ue.right && w.top >= Ue.top || w.left >= Ue.left && w.top >= Ue.bottom) && (M = xe + 1);
      }
    }
    return !h && W && (h = W, S = Y, k = 0), h && h.nodeType == 3 ? Vn(h, S) : !h || k && h.nodeType == 1 ? {
      node: d,
      offset: M
    } : En(h, S);
  }
  function Vn(d, w) {
    for (var h = d.nodeValue.length, k = document.createRange(), S, M = 0; M < h; M++) {
      k.setEnd(d, M + 1), k.setStart(d, M);
      var P = qr(k, 1);
      if (P.top != P.bottom && Rr(w, P)) {
        S = {
          node: d,
          offset: M + (w.left >= (P.left + P.right) / 2 ? 1 : 0)
        };
        break;
      }
    }
    return k.detach(), S || {
      node: d,
      offset: 0
    };
  }
  function Rr(d, w) {
    return d.left >= w.left - 1 && d.left <= w.right + 1 && d.top >= w.top - 1 && d.top <= w.bottom + 1;
  }
  function cn(d, w) {
    var h = d.parentNode;
    return h && /^li$/i.test(h.nodeName) && w.left < d.getBoundingClientRect().left ? h : d;
  }
  function ri(d, w, h) {
    var k = En(w, h), S = k.node, M = k.offset, P = -1;
    if (S.nodeType == 1 && !S.firstChild) {
      var I = S.getBoundingClientRect();
      P = I.left != I.right && h.left > (I.left + I.right) / 2 ? 1 : -1;
    }
    return d.docView.posFromDOM(S, M, P);
  }
  function Un(d, w, h, k) {
    for (var S = -1, M = w, P = !1; M != d.dom; ) {
      var I = d.docView.nearestDesc(M, !0), W = void 0;
      if (!I) return null;
      if (I.dom.nodeType == 1 && (I.node.isBlock && I.parent || !I.contentDOM) && ((W = I.dom.getBoundingClientRect()).width || W.height) && (I.node.isBlock && I.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(I.dom.nodeName) && (!P && W.left > k.left || W.top > k.top ? S = I.posBefore : (!P && W.right < k.left || W.bottom < k.top) && (S = I.posAfter), P = !0), !I.contentDOM && S < 0 && !I.node.isText)) {
        var Y = I.node.isBlock ? k.top < (W.top + W.bottom) / 2 : k.left < (W.left + W.right) / 2;
        return Y ? I.posBefore : I.posAfter;
      }
      M = I.dom.parentNode;
    }
    return S > -1 ? S : d.docView.posFromDOM(w, h, -1);
  }
  function rn(d, w, h) {
    var k = d.childNodes.length;
    if (k && h.top < h.bottom)
      for (var S = Math.max(0, Math.min(k - 1, Math.floor(k * (w.top - h.top) / (h.bottom - h.top)) - 2)), M = S; ; ) {
        var P = d.childNodes[M];
        if (P.nodeType == 1)
          for (var I = P.getClientRects(), W = 0; W < I.length; W++) {
            var Y = I[W];
            if (Rr(w, Y)) return rn(P, w, Y);
          }
        if ((M = (M + 1) % k) == S) break;
      }
    return d;
  }
  function Xr(d, w) {
    var h = d.dom.ownerDocument, k, S = 0, M = Ft(h, w.left, w.top);
    M && (k = M.node, S = M.offset);
    var P = (d.root.elementFromPoint ? d.root : h).elementFromPoint(w.left, w.top), I;
    if (!P || !d.dom.contains(P.nodeType != 1 ? P.parentNode : P)) {
      var W = d.dom.getBoundingClientRect();
      if (!Rr(w, W) || (P = rn(d.dom, w, W), !P)) return null;
    }
    if (jt)
      for (var Y = P; k && Y; Y = Ze(Y)) Y.draggable && (k = void 0);
    if (P = cn(P, w), k) {
      if (Ve && k.nodeType == 1 && (S = Math.min(S, k.childNodes.length), S < k.childNodes.length)) {
        var le = k.childNodes[S], xe;
        le.nodeName == "IMG" && (xe = le.getBoundingClientRect()).right <= w.left && xe.bottom > w.top && S++;
      }
      var ve;
      Wr && S && k.nodeType == 1 && (ve = k.childNodes[S - 1]).nodeType == 1 && ve.contentEditable == "false" && ve.getBoundingClientRect().top >= w.top && S--, k == d.dom && S == k.childNodes.length - 1 && k.lastChild.nodeType == 1 && w.top > k.lastChild.getBoundingClientRect().bottom ? I = d.state.doc.content.size : (S == 0 || k.nodeType != 1 || k.childNodes[S - 1].nodeName != "BR") && (I = Un(d, k, S, w));
    }
    I == null && (I = ri(d, P, w));
    var Re = d.docView.nearestDesc(P, !0);
    return {
      pos: I,
      inside: Re ? Re.posAtStart - Re.border : -1
    };
  }
  function gn(d) {
    return d.top < d.bottom || d.left < d.right;
  }
  function qr(d, w) {
    var h = d.getClientRects();
    if (h.length) {
      var k = h[w < 0 ? 0 : h.length - 1];
      if (gn(k)) return k;
    }
    return Array.prototype.find.call(h, gn) || d.getBoundingClientRect();
  }
  var $n = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
  function wr(d, w, h) {
    var k = d.docView.domFromPos(w, h < 0 ? -1 : 1), S = k.node, M = k.offset, P = k.atom, I = Wr || Ve;
    if (S.nodeType == 3)
      if (I && ($n.test(S.nodeValue) || (h < 0 ? !M : M == S.nodeValue.length))) {
        var W = qr(et(S, M, M), h);
        if (Ve && M && /\s/.test(S.nodeValue[M - 1]) && M < S.nodeValue.length) {
          var Y = qr(et(S, M - 1, M - 1), -1);
          if (Y.top == W.top) {
            var le = qr(et(S, M, M + 1), -1);
            if (le.top != W.top) return jr(le, le.left < Y.left);
          }
        }
        return W;
      } else {
        var xe = M, ve = M, Re = h < 0 ? 1 : -1;
        return h < 0 && !M ? (ve++, Re = -1) : h >= 0 && M == S.nodeValue.length ? (xe--, Re = 1) : h < 0 ? xe-- : ve++, jr(qr(et(S, xe, ve), Re), Re < 0);
      }
    var Ue = d.state.doc.resolve(w - (P || 0));
    if (!Ue.parent.inlineContent) {
      if (P == null && M && (h < 0 || M == It(S))) {
        var nt = S.childNodes[M - 1];
        if (nt.nodeType == 1) return Q(nt.getBoundingClientRect(), !1);
      }
      if (P == null && M < It(S)) {
        var gt = S.childNodes[M];
        if (gt.nodeType == 1) return Q(gt.getBoundingClientRect(), !0);
      }
      return Q(S.getBoundingClientRect(), h >= 0);
    }
    if (P == null && M && (h < 0 || M == It(S))) {
      var Xe = S.childNodes[M - 1], rr = Xe.nodeType == 3 ? et(Xe, It(Xe) - (I ? 0 : 1)) : Xe.nodeType == 1 && (Xe.nodeName != "BR" || !Xe.nextSibling) ? Xe : null;
      if (rr) return jr(qr(rr, 1), !1);
    }
    if (P == null && M < It(S)) {
      for (var Jt = S.childNodes[M]; Jt.pmViewDesc && Jt.pmViewDesc.ignoreForCoords; ) Jt = Jt.nextSibling;
      var Dt = Jt ? Jt.nodeType == 3 ? et(Jt, 0, I ? 0 : 1) : Jt.nodeType == 1 ? Jt : null : null;
      if (Dt) return jr(qr(Dt, -1), !0);
    }
    return jr(qr(S.nodeType == 3 ? et(S) : S, -h), h >= 0);
  }
  function jr(d, w) {
    if (d.width == 0) return d;
    var h = w ? d.left : d.right;
    return {
      top: d.top,
      bottom: d.bottom,
      left: h,
      right: h
    };
  }
  function Q(d, w) {
    if (d.height == 0) return d;
    var h = w ? d.top : d.bottom;
    return {
      top: h,
      bottom: h,
      left: d.left,
      right: d.right
    };
  }
  function X(d, w, h) {
    var k = d.state, S = d.root.activeElement;
    k != w && d.updateState(w), S != d.dom && d.focus();
    try {
      return h();
    } finally {
      k != w && d.updateState(k), S != d.dom && S && S.focus();
    }
  }
  function z(d, w, h) {
    var k = w.selection, S = h == "up" ? k.$from : k.$to;
    return X(d, w, function() {
      for (var M = d.docView.domFromPos(S.pos, h == "up" ? -1 : 1), P = M.node; ; ) {
        var I = d.docView.nearestDesc(P, !0);
        if (!I) break;
        if (I.node.isBlock) {
          P = I.contentDOM || I.dom;
          break;
        }
        P = I.dom.parentNode;
      }
      for (var W = wr(d, S.pos, 1), Y = P.firstChild; Y; Y = Y.nextSibling) {
        var le = void 0;
        if (Y.nodeType == 1) le = Y.getClientRects();
        else if (Y.nodeType == 3) le = et(Y, 0, Y.nodeValue.length).getClientRects();
        else continue;
        for (var xe = 0; xe < le.length; xe++) {
          var ve = le[xe];
          if (ve.bottom > ve.top + 1 && (h == "up" ? W.top - ve.top > (ve.bottom - W.top) * 2 : ve.bottom - W.bottom > (W.bottom - ve.top) * 2)) return !1;
        }
      }
      return !0;
    });
  }
  var F = /[\u0590-\u08ac]/;
  function V(d, w, h) {
    var k = w.selection.$head;
    if (!k.parent.isTextblock) return !1;
    var S = k.parentOffset, M = !S, P = S == k.parent.content.size, I = d.domSelection();
    return I ? !F.test(k.parent.textContent) || !I.modify ? h == "left" || h == "backward" ? M : P : X(d, w, function() {
      var W = d.domSelectionRange(), Y = W.focusNode, le = W.focusOffset, xe = W.anchorNode, ve = W.anchorOffset, Re = I.caretBidiLevel;
      I.modify("move", h, "character");
      var Ue = k.depth ? d.docView.domAfterPos(k.before()) : d.dom, nt = d.domSelectionRange(), gt = nt.focusNode, Xe = nt.focusOffset, rr = gt && !Ue.contains(gt.nodeType == 1 ? gt : gt.parentNode) || Y == gt && le == Xe;
      try {
        I.collapse(xe, ve), Y && (Y != xe || le != ve) && I.extend && I.extend(Y, le);
      } catch {
      }
      return Re != null && (I.caretBidiLevel = Re), rr;
    }) : k.pos == k.start() || k.pos == k.end();
  }
  var G = null, re = null, Ee = !1;
  function Be(d, w, h) {
    return G == w && re == h ? Ee : (G = w, re = h, Ee = h == "up" || h == "down" ? z(d, w, h) : V(d, w, h));
  }
  var he = 0, ne = 1, Ae = 2, Fe = 3, it = (function() {
    function d(w, h, k, S) {
      j(this, d), this.parent = w, this.children = h, this.dom = k, this.contentDOM = S, this.dirty = he, k.pmViewDesc = this;
    }
    return se(d, [{
      key: "matchesWidget",
      value: function(h) {
        return !1;
      }
    }, {
      key: "matchesMark",
      value: function(h) {
        return !1;
      }
    }, {
      key: "matchesNode",
      value: function(h, k, S) {
        return !1;
      }
    }, {
      key: "matchesHack",
      value: function(h) {
        return !1;
      }
    }, {
      key: "parseRule",
      value: function() {
        return null;
      }
    }, {
      key: "stopEvent",
      value: function(h) {
        return !1;
      }
    }, {
      key: "size",
      get: function() {
        for (var h = 0, k = 0; k < this.children.length; k++) h += this.children[k].size;
        return h;
      }
    }, {
      key: "border",
      get: function() {
        return 0;
      }
    }, {
      key: "destroy",
      value: function() {
        this.parent = void 0, this.dom.pmViewDesc == this && (this.dom.pmViewDesc = void 0);
        for (var h = 0; h < this.children.length; h++) this.children[h].destroy();
      }
    }, {
      key: "posBeforeChild",
      value: function(h) {
        for (var k = 0, S = this.posAtStart; ; k++) {
          var M = this.children[k];
          if (M == h) return S;
          S += M.size;
        }
      }
    }, {
      key: "posBefore",
      get: function() {
        return this.parent.posBeforeChild(this);
      }
    }, {
      key: "posAtStart",
      get: function() {
        return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
      }
    }, {
      key: "posAfter",
      get: function() {
        return this.posBefore + this.size;
      }
    }, {
      key: "posAtEnd",
      get: function() {
        return this.posAtStart + this.size - 2 * this.border;
      }
    }, {
      key: "localPosFromDOM",
      value: function(h, k, S) {
        if (this.contentDOM && this.contentDOM.contains(h.nodeType == 1 ? h : h.parentNode))
          if (S < 0) {
            var M, P;
            if (h == this.contentDOM)
              M = h.childNodes[k - 1];
            else {
              for (; h.parentNode != this.contentDOM; ) h = h.parentNode;
              M = h.previousSibling;
            }
            for (; M && !((P = M.pmViewDesc) && P.parent == this); ) M = M.previousSibling;
            return M ? this.posBeforeChild(P) + P.size : this.posAtStart;
          } else {
            var I, W;
            if (h == this.contentDOM)
              I = h.childNodes[k];
            else {
              for (; h.parentNode != this.contentDOM; ) h = h.parentNode;
              I = h.nextSibling;
            }
            for (; I && !((W = I.pmViewDesc) && W.parent == this); ) I = I.nextSibling;
            return I ? this.posBeforeChild(W) : this.posAtEnd;
          }
        var Y;
        if (h == this.dom && this.contentDOM)
          Y = k > ze(this.contentDOM);
        else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
          Y = h.compareDocumentPosition(this.contentDOM) & 2;
        else if (this.dom.firstChild) {
          if (k == 0) for (var le = h; ; le = le.parentNode) {
            if (le == this.dom) {
              Y = !1;
              break;
            }
            if (le.previousSibling) break;
          }
          if (Y == null && k == h.childNodes.length) for (var xe = h; ; xe = xe.parentNode) {
            if (xe == this.dom) {
              Y = !0;
              break;
            }
            if (xe.nextSibling) break;
          }
        }
        return Y ?? S > 0 ? this.posAtEnd : this.posAtStart;
      }
    }, {
      key: "nearestDesc",
      value: function(h) {
        for (var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, S = !0, M = h; M; M = M.parentNode) {
          var P = this.getDesc(M), I = void 0;
          if (P && (!k || P.node))
            if (S && (I = P.nodeDOM) && !(I.nodeType == 1 ? I.contains(h.nodeType == 1 ? h : h.parentNode) : I == h)) S = !1;
            else return P;
        }
      }
    }, {
      key: "getDesc",
      value: function(h) {
        for (var k = h.pmViewDesc, S = k; S; S = S.parent) if (S == this) return k;
      }
    }, {
      key: "posFromDOM",
      value: function(h, k, S) {
        for (var M = h; M; M = M.parentNode) {
          var P = this.getDesc(M);
          if (P) return P.localPosFromDOM(h, k, S);
        }
        return -1;
      }
    }, {
      key: "descAt",
      value: function(h) {
        for (var k = 0, S = 0; k < this.children.length; k++) {
          var M = this.children[k], P = S + M.size;
          if (S == h && P != S) {
            for (; !M.border && M.children.length; )
              for (var I = 0; I < M.children.length; I++) {
                var W = M.children[I];
                if (W.size) {
                  M = W;
                  break;
                }
              }
            return M;
          }
          if (h < P) return M.descAt(h - S - M.border);
          S = P;
        }
      }
    }, {
      key: "domFromPos",
      value: function(h, k) {
        if (!this.contentDOM) return {
          node: this.dom,
          offset: 0,
          atom: h + 1
        };
        for (var S = 0, M = 0, P = 0; S < this.children.length; S++) {
          var I = this.children[S], W = P + I.size;
          if (W > h || I instanceof K) {
            M = h - P;
            break;
          }
          P = W;
        }
        if (M) return this.children[S].domFromPos(M - this.children[S].border, k);
        for (var Y; S && !(Y = this.children[S - 1]).size && Y instanceof Nt && Y.side >= 0; S--)
          ;
        if (k <= 0) {
          for (var le, xe = !0; le = S ? this.children[S - 1] : null, !(!le || le.dom.parentNode == this.contentDOM); S--, xe = !1)
            ;
          return le && k && xe && !le.border && !le.domAtom ? le.domFromPos(le.size, k) : {
            node: this.contentDOM,
            offset: le ? ze(le.dom) + 1 : 0
          };
        } else {
          for (var ve, Re = !0; ve = S < this.children.length ? this.children[S] : null, !(!ve || ve.dom.parentNode == this.contentDOM); S++, Re = !1)
            ;
          return ve && Re && !ve.border && !ve.domAtom ? ve.domFromPos(0, k) : {
            node: this.contentDOM,
            offset: ve ? ze(ve.dom) : this.contentDOM.childNodes.length
          };
        }
      }
    }, {
      key: "parseRange",
      value: function(h, k) {
        var S = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
        if (this.children.length == 0) return {
          node: this.contentDOM,
          from: h,
          to: k,
          fromOffset: 0,
          toOffset: this.contentDOM.childNodes.length
        };
        for (var M = -1, P = -1, I = S, W = 0; ; W++) {
          var Y = this.children[W], le = I + Y.size;
          if (M == -1 && h <= le) {
            var xe = I + Y.border;
            if (h >= xe && k <= le - Y.border && Y.node && Y.contentDOM && this.contentDOM.contains(Y.contentDOM)) return Y.parseRange(h, k, xe);
            h = I;
            for (var ve = W; ve > 0; ve--) {
              var Re = this.children[ve - 1];
              if (Re.size && Re.dom.parentNode == this.contentDOM && !Re.emptyChildAt(1)) {
                M = ze(Re.dom) + 1;
                break;
              }
              h -= Re.size;
            }
            M == -1 && (M = 0);
          }
          if (M > -1 && (le > k || W == this.children.length - 1)) {
            k = le;
            for (var Ue = W + 1; Ue < this.children.length; Ue++) {
              var nt = this.children[Ue];
              if (nt.size && nt.dom.parentNode == this.contentDOM && !nt.emptyChildAt(-1)) {
                P = ze(nt.dom);
                break;
              }
              k += nt.size;
            }
            P == -1 && (P = this.contentDOM.childNodes.length);
            break;
          }
          I = le;
        }
        return {
          node: this.contentDOM,
          from: h,
          to: k,
          fromOffset: M,
          toOffset: P
        };
      }
    }, {
      key: "emptyChildAt",
      value: function(h) {
        if (this.border || !this.contentDOM || !this.children.length) return !1;
        var k = this.children[h < 0 ? 0 : this.children.length - 1];
        return k.size == 0 || k.emptyChildAt(h);
      }
    }, {
      key: "domAfterPos",
      value: function(h) {
        var k = this.domFromPos(h, 0), S = k.node, M = k.offset;
        if (S.nodeType != 1 || M == S.childNodes.length) throw new RangeError("No node after pos " + h);
        return S.childNodes[M];
      }
    }, {
      key: "setSelection",
      value: function(h, k, S) {
        for (var M = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, P = Math.min(h, k), I = Math.max(h, k), W = 0, Y = 0; W < this.children.length; W++) {
          var le = this.children[W], xe = Y + le.size;
          if (P > Y && I < xe) return le.setSelection(h - Y - le.border, k - Y - le.border, S, M);
          Y = xe;
        }
        var ve = this.domFromPos(h, h ? -1 : 1), Re = k == h ? ve : this.domFromPos(k, k ? -1 : 1), Ue = S.root.getSelection(), nt = S.domSelectionRange(), gt = !1;
        if ((Ve || jt) && h == k) {
          var Xe = ve, rr = Xe.node, Jt = Xe.offset;
          if (rr.nodeType == 3) {
            if (gt = !!(Jt && rr.nodeValue[Jt - 1] == `
`), gt && Jt == rr.nodeValue.length)
              for (var Dt = rr, Gt; Dt; Dt = Dt.parentNode) {
                if (Gt = Dt.nextSibling) {
                  Gt.nodeName == "BR" && (ve = Re = {
                    node: Gt.parentNode,
                    offset: ze(Gt) + 1
                  });
                  break;
                }
                var lr = Dt.pmViewDesc;
                if (lr && lr.node && lr.node.isBlock) break;
              }
          } else {
            var or = rr.childNodes[Jt - 1];
            gt = or && (or.nodeName == "BR" || or.contentEditable == "false");
          }
        }
        if (Ve && nt.focusNode && nt.focusNode != Re.node && nt.focusNode.nodeType == 1) {
          var Nr = nt.focusNode.childNodes[nt.focusOffset];
          Nr && Nr.contentEditable == "false" && (M = !0);
        }
        if (!(!(M || gt && jt) && Rt(ve.node, ve.offset, nt.anchorNode, nt.anchorOffset) && Rt(Re.node, Re.offset, nt.focusNode, nt.focusOffset))) {
          var Ar = !1;
          if ((Ue.extend || h == k) && !(gt && Ve)) {
            Ue.collapse(ve.node, ve.offset);
            try {
              h != k && Ue.extend(Re.node, Re.offset), Ar = !0;
            } catch {
            }
          }
          if (!Ar) {
            if (h > k) {
              var Vr = ve;
              ve = Re, Re = Vr;
            }
            var xi = document.createRange();
            xi.setEnd(Re.node, Re.offset), xi.setStart(ve.node, ve.offset), Ue.removeAllRanges(), Ue.addRange(xi);
          }
        }
      }
    }, {
      key: "ignoreMutation",
      value: function(h) {
        return !this.contentDOM && h.type != "selection";
      }
    }, {
      key: "contentLost",
      get: function() {
        return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
      }
    }, {
      key: "markDirty",
      value: function(h, k) {
        for (var S = 0, M = 0; M < this.children.length; M++) {
          var P = this.children[M], I = S + P.size;
          if (S == I ? h <= I && k >= S : h < I && k > S) {
            var W = S + P.border, Y = I - P.border;
            if (h >= W && k <= Y) {
              this.dirty = h == S || k == I ? Ae : ne, h == W && k == Y && (P.contentLost || P.dom.parentNode != this.contentDOM) ? P.dirty = Fe : P.markDirty(h - W, k - W);
              return;
            } else
              P.dirty = P.dom == P.contentDOM && P.dom.parentNode == this.contentDOM && !P.children.length ? Ae : Fe;
          }
          S = I;
        }
        this.dirty = Ae;
      }
    }, {
      key: "markParentsDirty",
      value: function() {
        for (var h = 1, k = this.parent; k; k = k.parent, h++) {
          var S = h == 1 ? Ae : ne;
          k.dirty < S && (k.dirty = S);
        }
      }
    }, {
      key: "domAtom",
      get: function() {
        return !1;
      }
    }, {
      key: "ignoreForCoords",
      get: function() {
        return !1;
      }
    }, {
      key: "ignoreForSelection",
      get: function() {
        return !1;
      }
    }, {
      key: "isText",
      value: function(h) {
        return !1;
      }
    }]), d;
  })(), Nt = (function(d) {
    p(h, d);
    var w = T(h);
    function h(k, S, M, P) {
      var I;
      j(this, h);
      var W, Y = S.type.toDOM;
      if (typeof Y == "function" && (Y = Y(M, function() {
        if (!W) return P;
        if (W.parent) return W.parent.posBeforeChild(W);
      })), !S.type.spec.raw) {
        if (Y.nodeType != 1) {
          var le = document.createElement("span");
          le.appendChild(Y), Y = le;
        }
        Y.contentEditable = "false", Y.classList.add("ProseMirror-widget");
      }
      return I = w.call(this, k, [], Y, null), I.widget = S, I.widget = S, W = O(I), I;
    }
    return se(h, [{
      key: "matchesWidget",
      value: function(S) {
        return this.dirty == he && S.type.eq(this.widget.type);
      }
    }, {
      key: "parseRule",
      value: function() {
        return {
          ignore: !0
        };
      }
    }, {
      key: "stopEvent",
      value: function(S) {
        var M = this.widget.spec.stopEvent;
        return M ? M(S) : !1;
      }
    }, {
      key: "ignoreMutation",
      value: function(S) {
        return S.type != "selection" || this.widget.spec.ignoreSelection;
      }
    }, {
      key: "destroy",
      value: function() {
        this.widget.type.destroy(this.dom), u(q(h.prototype), "destroy", this).call(this);
      }
    }, {
      key: "domAtom",
      get: function() {
        return !0;
      }
    }, {
      key: "ignoreForSelection",
      get: function() {
        return !!this.widget.type.spec.relaxedSide;
      }
    }, {
      key: "side",
      get: function() {
        return this.widget.type.side;
      }
    }]), h;
  })(it), H = (function(d) {
    p(h, d);
    var w = T(h);
    function h(k, S, M, P) {
      var I;
      return j(this, h), I = w.call(this, k, [], S, null), I.textDOM = M, I.text = P, I;
    }
    return se(h, [{
      key: "size",
      get: function() {
        return this.text.length;
      }
    }, {
      key: "localPosFromDOM",
      value: function(S, M) {
        return S != this.textDOM ? this.posAtStart + (M ? this.size : 0) : this.posAtStart + M;
      }
    }, {
      key: "domFromPos",
      value: function(S) {
        return {
          node: this.textDOM,
          offset: S
        };
      }
    }, {
      key: "ignoreMutation",
      value: function(S) {
        return S.type === "characterData" && S.target.nodeValue == S.oldValue;
      }
    }]), h;
  })(it), R = (function(d) {
    p(h, d);
    var w = T(h);
    function h(k, S, M, P, I) {
      var W;
      return j(this, h), W = w.call(this, k, [], M, P), W.mark = S, W.spec = I, W;
    }
    return se(h, [{
      key: "parseRule",
      value: function() {
        return this.dirty & Fe || this.mark.type.spec.reparseInView ? null : {
          mark: this.mark.type.name,
          attrs: this.mark.attrs,
          contentElement: this.contentDOM
        };
      }
    }, {
      key: "matchesMark",
      value: function(S) {
        return this.dirty != Fe && this.mark.eq(S);
      }
    }, {
      key: "markDirty",
      value: function(S, M) {
        if (u(q(h.prototype), "markDirty", this).call(this, S, M), this.dirty != he) {
          for (var P = this.parent; !P.node; ) P = P.parent;
          P.dirty < this.dirty && (P.dirty = this.dirty), this.dirty = he;
        }
      }
    }, {
      key: "slice",
      value: function(S, M, P) {
        var I = h.create(this.parent, this.mark, !0, P), W = this.children, Y = this.size;
        M < Y && (W = Wn(W, M, Y, P)), S > 0 && (W = Wn(W, 0, S, P));
        for (var le = 0; le < W.length; le++) W[le].parent = I;
        return I.children = W, I;
      }
    }, {
      key: "ignoreMutation",
      value: function(S) {
        return this.spec.ignoreMutation ? this.spec.ignoreMutation(S) : u(q(h.prototype), "ignoreMutation", this).call(this, S);
      }
    }, {
      key: "destroy",
      value: function() {
        this.spec.destroy && this.spec.destroy(), u(q(h.prototype), "destroy", this).call(this);
      }
    }], [{
      key: "create",
      value: function(S, M, P, I) {
        var W = I.nodeViews[M.type.name], Y = W && W(M, I, P);
        return (!Y || !Y.dom) && (Y = ke.DOMSerializer.renderSpec(document, M.type.spec.toDOM(M, P), null, M.attrs)), new h(S, M, Y.dom, Y.contentDOM || Y.dom, Y);
      }
    }]), h;
  })(it), b = (function(d) {
    p(h, d);
    var w = T(h);
    function h(k, S, M, P, I, W, Y, le, xe) {
      var ve;
      return j(this, h), ve = w.call(this, k, [], I, W), ve.node = S, ve.outerDeco = M, ve.innerDeco = P, ve.nodeDOM = Y, ve;
    }
    return se(h, [{
      key: "parseRule",
      value: function() {
        var S = this;
        if (this.node.type.spec.reparseInView) return null;
        var M = {
          node: this.node.type.name,
          attrs: this.node.attrs
        };
        if (this.node.type.whitespace == "pre" && (M.preserveWhitespace = "full"), !this.contentDOM)
          M.getContent = function() {
            return S.node.content;
          };
        else if (!this.contentLost)
          M.contentElement = this.contentDOM;
        else {
          for (var P = this.children.length - 1; P >= 0; P--) {
            var I = this.children[P];
            if (this.dom.contains(I.dom.parentNode)) {
              M.contentElement = I.dom.parentNode;
              break;
            }
          }
          M.contentElement || (M.getContent = function() {
            return ke.Fragment.empty;
          });
        }
        return M;
      }
    }, {
      key: "matchesNode",
      value: function(S, M, P) {
        return this.dirty == he && S.eq(this.node) && er(M, this.outerDeco) && P.eq(this.innerDeco);
      }
    }, {
      key: "size",
      get: function() {
        return this.node.nodeSize;
      }
    }, {
      key: "border",
      get: function() {
        return this.node.isLeaf ? 0 : 1;
      }
    }, {
      key: "updateChildren",
      value: function(S, M) {
        var P = this, I = this.node.inlineContent, W = M, Y = S.composing ? this.localCompositionInfo(S, M) : null, le = Y && Y.pos > -1 ? Y : null, xe = Y && Y.pos < 0, ve = new Ir(this, le && le.node, S);
        Os(this.node, this.innerDeco, function(Re, Ue, nt) {
          Re.spec.marks ? ve.syncToMarks(Re.spec.marks, I, S) : Re.type.side >= 0 && !nt && ve.syncToMarks(Ue == P.node.childCount ? ke.Mark.none : P.node.child(Ue).marks, I, S), ve.placeWidget(Re, S, W);
        }, function(Re, Ue, nt, gt) {
          ve.syncToMarks(Re.marks, I, S);
          var Xe;
          ve.findNodeMatch(Re, Ue, nt, gt) || xe && S.state.selection.from > W && S.state.selection.to < W + Re.nodeSize && (Xe = ve.findIndexWithChild(Y.node)) > -1 && ve.updateNodeAt(Re, Ue, nt, Xe, S) || ve.updateNextNode(Re, Ue, nt, S, gt, W) || ve.addNode(Re, Ue, nt, S, W), W += Re.nodeSize;
        }), ve.syncToMarks([], I, S), this.node.isTextblock && ve.addTextblockHacks(), ve.destroyRest(), (ve.changed || this.dirty == Ae) && (le && this.protectLocalComposition(S, le), ae(this.contentDOM, this.children, S), mr && zo(this.dom));
      }
    }, {
      key: "localCompositionInfo",
      value: function(S, M) {
        var P = S.state.selection, I = P.from, W = P.to;
        if (!(S.state.selection instanceof pe.TextSelection) || I < M || W > M + this.node.content.size) return null;
        var Y = S.input.compositionNode;
        if (!Y || !this.dom.contains(Y.parentNode)) return null;
        if (this.node.inlineContent) {
          var le = Y.nodeValue, xe = Oa(this.node.content, le, I - M, W - M);
          return xe < 0 ? null : {
            node: Y,
            pos: xe,
            text: le
          };
        } else
          return {
            node: Y,
            pos: -1,
            text: ""
          };
      }
    }, {
      key: "protectLocalComposition",
      value: function(S, M) {
        var P = M.node, I = M.pos, W = M.text;
        if (!this.getDesc(P)) {
          for (var Y = P; Y.parentNode != this.contentDOM; Y = Y.parentNode) {
            for (; Y.previousSibling; ) Y.parentNode.removeChild(Y.previousSibling);
            for (; Y.nextSibling; ) Y.parentNode.removeChild(Y.nextSibling);
            Y.pmViewDesc && (Y.pmViewDesc = void 0);
          }
          var le = new H(this, Y, P, W);
          S.input.compositionNodes.push(le), this.children = Wn(this.children, I, I + W.length, S, le);
        }
      }
    }, {
      key: "update",
      value: function(S, M, P, I) {
        return this.dirty == Fe || !S.sameMarkup(this.node) ? !1 : (this.updateInner(S, M, P, I), !0);
      }
    }, {
      key: "updateInner",
      value: function(S, M, P, I) {
        this.updateOuterDeco(M), this.node = S, this.innerDeco = P, this.contentDOM && this.updateChildren(I, this.posAtStart), this.dirty = he;
      }
    }, {
      key: "updateOuterDeco",
      value: function(S) {
        if (!er(S, this.outerDeco)) {
          var M = this.nodeDOM.nodeType != 1, P = this.dom;
          this.dom = $e(this.dom, this.nodeDOM, je(this.outerDeco, this.node, M), je(S, this.node, M)), this.dom != P && (P.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = S;
        }
      }
    }, {
      key: "selectNode",
      value: function() {
        this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.add("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && (this.nodeDOM.draggable = !0));
      }
    }, {
      key: "deselectNode",
      value: function() {
        this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.remove("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && this.nodeDOM.removeAttribute("draggable"));
      }
    }, {
      key: "domAtom",
      get: function() {
        return this.node.isAtom;
      }
    }], [{
      key: "create",
      value: function(S, M, P, I, W, Y) {
        var le = W.nodeViews[M.type.name], xe, ve = le && le(M, W, function() {
          if (!xe) return Y;
          if (xe.parent) return xe.parent.posBeforeChild(xe);
        }, P, I), Re = ve && ve.dom, Ue = ve && ve.contentDOM;
        if (M.isText) {
          if (!Re) Re = document.createTextNode(M.text);
          else if (Re.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node");
        } else if (!Re) {
          var nt = ke.DOMSerializer.renderSpec(document, M.type.spec.toDOM(M), null, M.attrs);
          Re = nt.dom, Ue = nt.contentDOM;
        }
        !Ue && !M.isText && Re.nodeName != "BR" && (Re.hasAttribute("contenteditable") || (Re.contentEditable = "false"), M.type.spec.draggable && (Re.draggable = !0));
        var gt = Re;
        return Re = Ot(Re, P, M), ve ? xe = new Z(S, M, P, I, Re, Ue || null, gt, ve, W, Y + 1) : M.isText ? new B(S, M, P, I, Re, gt, W) : new h(S, M, P, I, Re, Ue || null, gt);
      }
    }]), h;
  })(it);
  function E(d, w, h, k, S) {
    Ot(k, w, d);
    var M = new b(void 0, d, w, h, k, k, k, S, 0);
    return M.contentDOM && M.updateChildren(S, 0), M;
  }
  var B = (function(d) {
    p(h, d);
    var w = T(h);
    function h(k, S, M, P, I, W, Y) {
      return j(this, h), w.call(this, k, S, M, P, I, null, W, Y, 0);
    }
    return se(h, [{
      key: "parseRule",
      value: function() {
        for (var S = this.nodeDOM.parentNode; S && S != this.dom && !S.pmIsDeco; ) S = S.parentNode;
        return {
          skip: S || !0
        };
      }
    }, {
      key: "update",
      value: function(S, M, P, I) {
        return this.dirty == Fe || this.dirty != he && !this.inParent() || !S.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(M), (this.dirty != he || S.text != this.node.text) && S.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = S.text, I.trackWrites == this.nodeDOM && (I.trackWrites = null)), this.node = S, this.dirty = he, !0);
      }
    }, {
      key: "inParent",
      value: function() {
        for (var S = this.parent.contentDOM, M = this.nodeDOM; M; M = M.parentNode) if (M == S) return !0;
        return !1;
      }
    }, {
      key: "domFromPos",
      value: function(S) {
        return {
          node: this.nodeDOM,
          offset: S
        };
      }
    }, {
      key: "localPosFromDOM",
      value: function(S, M, P) {
        return S == this.nodeDOM ? this.posAtStart + Math.min(M, this.node.text.length) : u(q(h.prototype), "localPosFromDOM", this).call(this, S, M, P);
      }
    }, {
      key: "ignoreMutation",
      value: function(S) {
        return S.type != "characterData" && S.type != "selection";
      }
    }, {
      key: "slice",
      value: function(S, M, P) {
        var I = this.node.cut(S, M), W = document.createTextNode(I.text);
        return new h(this.parent, I, this.outerDeco, this.innerDeco, W, W, P);
      }
    }, {
      key: "markDirty",
      value: function(S, M) {
        u(q(h.prototype), "markDirty", this).call(this, S, M), this.dom != this.nodeDOM && (S == 0 || M == this.nodeDOM.nodeValue.length) && (this.dirty = Fe);
      }
    }, {
      key: "domAtom",
      get: function() {
        return !1;
      }
    }, {
      key: "isText",
      value: function(S) {
        return this.node.text == S;
      }
    }]), h;
  })(b), K = (function(d) {
    p(h, d);
    var w = T(h);
    function h() {
      return j(this, h), w.apply(this, arguments);
    }
    return se(h, [{
      key: "parseRule",
      value: function() {
        return {
          ignore: !0
        };
      }
    }, {
      key: "matchesHack",
      value: function(S) {
        return this.dirty == he && this.dom.nodeName == S;
      }
    }, {
      key: "domAtom",
      get: function() {
        return !0;
      }
    }, {
      key: "ignoreForCoords",
      get: function() {
        return this.dom.nodeName == "IMG";
      }
    }]), h;
  })(it), Z = (function(d) {
    p(h, d);
    var w = T(h);
    function h(k, S, M, P, I, W, Y, le, xe, ve) {
      var Re;
      return j(this, h), Re = w.call(this, k, S, M, P, I, W, Y, xe, ve), Re.spec = le, Re;
    }
    return se(h, [{
      key: "update",
      value: function(S, M, P, I) {
        if (this.dirty == Fe) return !1;
        if (this.spec.update && (this.node.type == S.type || this.spec.multiType)) {
          var W = this.spec.update(S, M, P);
          return W && this.updateInner(S, M, P, I), W;
        } else return !this.contentDOM && !S.isLeaf ? !1 : u(q(h.prototype), "update", this).call(this, S, M, P, I);
      }
    }, {
      key: "selectNode",
      value: function() {
        this.spec.selectNode ? this.spec.selectNode() : u(q(h.prototype), "selectNode", this).call(this);
      }
    }, {
      key: "deselectNode",
      value: function() {
        this.spec.deselectNode ? this.spec.deselectNode() : u(q(h.prototype), "deselectNode", this).call(this);
      }
    }, {
      key: "setSelection",
      value: function(S, M, P, I) {
        this.spec.setSelection ? this.spec.setSelection(S, M, P.root) : u(q(h.prototype), "setSelection", this).call(this, S, M, P, I);
      }
    }, {
      key: "destroy",
      value: function() {
        this.spec.destroy && this.spec.destroy(), u(q(h.prototype), "destroy", this).call(this);
      }
    }, {
      key: "stopEvent",
      value: function(S) {
        return this.spec.stopEvent ? this.spec.stopEvent(S) : !1;
      }
    }, {
      key: "ignoreMutation",
      value: function(S) {
        return this.spec.ignoreMutation ? this.spec.ignoreMutation(S) : u(q(h.prototype), "ignoreMutation", this).call(this, S);
      }
    }]), h;
  })(b);
  function ae(d, w, h) {
    for (var k = d.firstChild, S = !1, M = 0; M < w.length; M++) {
      var P = w[M], I = P.dom;
      if (I.parentNode == d) {
        for (; I != k; )
          k = hr(k), S = !0;
        k = k.nextSibling;
      } else
        S = !0, d.insertBefore(I, k);
      if (P instanceof R) {
        var W = k ? k.previousSibling : d.lastChild;
        ae(P.contentDOM, P.children, h), k = W ? W.nextSibling : d.firstChild;
      }
    }
    for (; k; )
      k = hr(k), S = !0;
    S && h.trackWrites == d && (h.trackWrites = null);
  }
  var ye = function(w) {
    w && (this.nodeName = w);
  };
  ye.prototype = /* @__PURE__ */ Object.create(null);
  var Oe = [new ye()];
  function je(d, w, h) {
    if (d.length == 0) return Oe;
    for (var k = h ? Oe[0] : new ye(), S = [k], M = 0; M < d.length; M++) {
      var P = d[M].type.attrs;
      if (P) {
        P.nodeName && S.push(k = new ye(P.nodeName));
        for (var I in P) {
          var W = P[I];
          W != null && (h && S.length == 1 && S.push(k = new ye(w.isInline ? "span" : "div")), I == "class" ? k.class = (k.class ? k.class + " " : "") + W : I == "style" ? k.style = (k.style ? k.style + ";" : "") + W : I != "nodeName" && (k[I] = W));
        }
      }
    }
    return S;
  }
  function $e(d, w, h, k) {
    if (h == Oe && k == Oe) return w;
    for (var S = w, M = 0; M < k.length; M++) {
      var P = k[M], I = h[M];
      if (M) {
        var W = void 0;
        I && I.nodeName == P.nodeName && S != d && (W = S.parentNode) && W.nodeName.toLowerCase() == P.nodeName || (W = document.createElement(P.nodeName), W.pmIsDeco = !0, W.appendChild(S), I = Oe[0]), S = W;
      }
      at(S, I || Oe[0], P);
    }
    return S;
  }
  function at(d, w, h) {
    for (var k in w) k != "class" && k != "style" && k != "nodeName" && !(k in h) && d.removeAttribute(k);
    for (var S in h) S != "class" && S != "style" && S != "nodeName" && h[S] != w[S] && d.setAttribute(S, h[S]);
    if (w.class != h.class) {
      for (var M = w.class ? w.class.split(" ").filter(Boolean) : [], P = h.class ? h.class.split(" ").filter(Boolean) : [], I = 0; I < M.length; I++) P.indexOf(M[I]) == -1 && d.classList.remove(M[I]);
      for (var W = 0; W < P.length; W++) M.indexOf(P[W]) == -1 && d.classList.add(P[W]);
      d.classList.length == 0 && d.removeAttribute("class");
    }
    if (w.style != h.style) {
      if (w.style)
        for (var Y = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, le; le = Y.exec(w.style); ) d.style.removeProperty(le[1]);
      h.style && (d.style.cssText += h.style);
    }
  }
  function Ot(d, w, h) {
    return $e(d, d, Oe, je(w, h, d.nodeType != 1));
  }
  function er(d, w) {
    if (d.length != w.length) return !1;
    for (var h = 0; h < d.length; h++) if (!d[h].type.eq(w[h].type)) return !1;
    return !0;
  }
  function hr(d) {
    var w = d.nextSibling;
    return d.parentNode.removeChild(d), w;
  }
  var Ir = (function() {
    function d(w, h, k) {
      j(this, d), this.lock = h, this.view = k, this.index = 0, this.stack = [], this.changed = !1, this.top = w, this.preMatch = Qi(w.node.content, w);
    }
    return se(d, [{
      key: "destroyBetween",
      value: function(h, k) {
        if (h != k) {
          for (var S = h; S < k; S++) this.top.children[S].destroy();
          this.top.children.splice(h, k - h), this.changed = !0;
        }
      }
    }, {
      key: "destroyRest",
      value: function() {
        this.destroyBetween(this.index, this.top.children.length);
      }
    }, {
      key: "syncToMarks",
      value: function(h, k, S) {
        for (var M = 0, P = this.stack.length >> 1, I = Math.min(P, h.length); M < I && (M == P - 1 ? this.top : this.stack[M + 1 << 1]).matchesMark(h[M]) && h[M].type.spec.spanning !== !1; ) M++;
        for (; M < P; )
          this.destroyRest(), this.top.dirty = he, this.index = this.stack.pop(), this.top = this.stack.pop(), P--;
        for (; P < h.length; ) {
          this.stack.push(this.top, this.index + 1);
          for (var W = -1, Y = this.index; Y < Math.min(this.index + 3, this.top.children.length); Y++) {
            var le = this.top.children[Y];
            if (le.matchesMark(h[P]) && !this.isLocked(le.dom)) {
              W = Y;
              break;
            }
          }
          if (W > -1)
            W > this.index && (this.changed = !0, this.destroyBetween(this.index, W)), this.top = this.top.children[this.index];
          else {
            var xe = R.create(this.top, h[P], k, S);
            this.top.children.splice(this.index, 0, xe), this.top = xe, this.changed = !0;
          }
          this.index = 0, P++;
        }
      }
    }, {
      key: "findNodeMatch",
      value: function(h, k, S, M) {
        var P = -1, I;
        if (M >= this.preMatch.index && (I = this.preMatch.matches[M - this.preMatch.index]).parent == this.top && I.matchesNode(h, k, S))
          P = this.top.children.indexOf(I, this.index);
        else
          for (var W = this.index, Y = Math.min(this.top.children.length, W + 5); W < Y; W++) {
            var le = this.top.children[W];
            if (le.matchesNode(h, k, S) && !this.preMatch.matched.has(le)) {
              P = W;
              break;
            }
          }
        return P < 0 ? !1 : (this.destroyBetween(this.index, P), this.index++, !0);
      }
    }, {
      key: "updateNodeAt",
      value: function(h, k, S, M, P) {
        var I = this.top.children[M];
        return I.dirty == Fe && I.dom == I.contentDOM && (I.dirty = Ae), I.update(h, k, S, P) ? (this.destroyBetween(this.index, M), this.index++, !0) : !1;
      }
    }, {
      key: "findIndexWithChild",
      value: function(h) {
        for (; ; ) {
          var k = h.parentNode;
          if (!k) return -1;
          if (k == this.top.contentDOM) {
            var S = h.pmViewDesc;
            if (S) {
              for (var M = this.index; M < this.top.children.length; M++)
                if (this.top.children[M] == S) return M;
            }
            return -1;
          }
          h = k;
        }
      }
    }, {
      key: "updateNextNode",
      value: function(h, k, S, M, P, I) {
        for (var W = this.index; W < this.top.children.length; W++) {
          var Y = this.top.children[W];
          if (Y instanceof b) {
            var le = this.preMatch.matched.get(Y);
            if (le != null && le != P) return !1;
            var xe = Y.dom, ve = void 0, Re = this.isLocked(xe) && !(h.isText && Y.node && Y.node.isText && Y.nodeDOM.nodeValue == h.text && Y.dirty != Fe && er(k, Y.outerDeco));
            if (!Re && Y.update(h, k, S, M))
              return this.destroyBetween(this.index, W), Y.dom != xe && (this.changed = !0), this.index++, !0;
            if (!Re && (ve = this.recreateWrapper(Y, h, k, S, M, I)))
              return this.destroyBetween(this.index, W), this.top.children[this.index] = ve, ve.contentDOM && (ve.dirty = Ae, ve.updateChildren(M, I + 1), ve.dirty = he), this.changed = !0, this.index++, !0;
            break;
          }
        }
        return !1;
      }
    }, {
      key: "recreateWrapper",
      value: function(h, k, S, M, P, I) {
        if (h.dirty || k.isAtom || !h.children.length || !h.node.content.eq(k.content) || !er(S, h.outerDeco) || !M.eq(h.innerDeco)) return null;
        var W = b.create(this.top, k, S, M, P, I);
        if (W.contentDOM) {
          W.children = h.children, h.children = [];
          var Y = i(W.children), le;
          try {
            for (Y.s(); !(le = Y.n()).done; ) {
              var xe = le.value;
              xe.parent = W;
            }
          } catch (ve) {
            Y.e(ve);
          } finally {
            Y.f();
          }
        }
        return h.destroy(), W;
      }
    }, {
      key: "addNode",
      value: function(h, k, S, M, P) {
        var I = b.create(this.top, h, k, S, M, P);
        I.contentDOM && I.updateChildren(M, P + 1), this.top.children.splice(this.index++, 0, I), this.changed = !0;
      }
    }, {
      key: "placeWidget",
      value: function(h, k, S) {
        var M = this.index < this.top.children.length ? this.top.children[this.index] : null;
        if (M && M.matchesWidget(h) && (h == M.widget || !M.widget.type.toDOM.parentNode))
          this.index++;
        else {
          var P = new Nt(this.top, h, k, S);
          this.top.children.splice(this.index++, 0, P), this.changed = !0;
        }
      }
    }, {
      key: "addTextblockHacks",
      value: function() {
        for (var h = this.top.children[this.index - 1], k = this.top; h instanceof R; )
          k = h, h = k.children[k.children.length - 1];
        (!h || !(h instanceof B) || /\n$/.test(h.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(h.node.text)) && ((jt || Tt) && h && h.dom.contentEditable == "false" && this.addHackNode("IMG", k), this.addHackNode("BR", this.top));
      }
    }, {
      key: "addHackNode",
      value: function(h, k) {
        if (k == this.top && this.index < k.children.length && k.children[this.index].matchesHack(h))
          this.index++;
        else {
          var S = document.createElement(h);
          h == "IMG" && (S.className = "ProseMirror-separator", S.alt = ""), h == "BR" && (S.className = "ProseMirror-trailingBreak");
          var M = new K(this.top, [], S, null);
          k != this.top ? k.children.push(M) : k.children.splice(this.index++, 0, M), this.changed = !0;
        }
      }
    }, {
      key: "isLocked",
      value: function(h) {
        return this.lock && (h == this.lock || h.nodeType == 1 && h.contains(this.lock.parentNode));
      }
    }]), d;
  })();
  function Qi(d, w) {
    var h = w, k = h.children.length, S = d.childCount, M = /* @__PURE__ */ new Map(), P = [];
    e: for (; S > 0; ) {
      for (var I = void 0; ; )
        if (k) {
          var W = h.children[k - 1];
          if (W instanceof R)
            h = W, k = W.children.length;
          else {
            I = W, k--;
            break;
          }
        } else {
          if (h == w)
            break e;
          k = h.parent.children.indexOf(h), h = h.parent;
        }
      var Y = I.node;
      if (Y) {
        if (Y != d.child(S - 1)) break;
        --S, M.set(I, S), P.push(I);
      }
    }
    return {
      index: S,
      matched: M,
      matches: P.reverse()
    };
  }
  function Yr(d, w) {
    return d.type.side - w.type.side;
  }
  function Os(d, w, h, k) {
    var S = w.locals(d), M = 0;
    if (S.length == 0) {
      for (var P = 0; P < d.childCount; P++) {
        var I = d.child(P);
        k(I, S, w.forChild(M, I), P), M += I.nodeSize;
      }
      return;
    }
    for (var W = 0, Y = [], le = null, xe = 0; ; ) {
      for (var ve = void 0, Re = void 0; W < S.length && S[W].to == M; ) {
        var Ue = S[W++];
        Ue.widget && (ve ? (Re || (Re = [ve])).push(Ue) : ve = Ue);
      }
      if (ve)
        if (Re) {
          Re.sort(Yr);
          for (var nt = 0; nt < Re.length; nt++) h(Re[nt], xe, !!le);
        } else
          h(ve, xe, !!le);
      var gt = void 0, Xe = void 0;
      if (le)
        Xe = -1, gt = le, le = null;
      else if (xe < d.childCount)
        Xe = xe, gt = d.child(xe++);
      else
        break;
      for (var rr = 0; rr < Y.length; rr++) Y[rr].to <= M && Y.splice(rr--, 1);
      for (; W < S.length && S[W].from <= M && S[W].to > M; ) Y.push(S[W++]);
      var Jt = M + gt.nodeSize;
      if (gt.isText) {
        var Dt = Jt;
        W < S.length && S[W].from < Dt && (Dt = S[W].from);
        for (var Gt = 0; Gt < Y.length; Gt++) Y[Gt].to < Dt && (Dt = Y[Gt].to);
        Dt < Jt && (le = gt.cut(Dt - M), gt = gt.cut(0, Dt - M), Jt = Dt, Xe = -1);
      } else
        for (; W < S.length && S[W].to < Jt; ) W++;
      var lr = gt.isInline && !gt.isLeaf ? Y.filter(function(or) {
        return !or.inline;
      }) : Y.slice();
      k(gt, lr, w.forChild(M, gt), Xe), M = Jt;
    }
  }
  function zo(d) {
    if (d.nodeName == "UL" || d.nodeName == "OL") {
      var w = d.style.cssText;
      d.style.cssText = w + "; list-style: square !important", window.getComputedStyle(d).listStyle, d.style.cssText = w;
    }
  }
  function Oa(d, w, h, k) {
    for (var S = 0, M = 0; S < d.childCount && M <= k; ) {
      var P = d.child(S++), I = M;
      if (M += P.nodeSize, !!P.isText) {
        for (var W = P.text; S < d.childCount; ) {
          var Y = d.child(S++);
          if (M += Y.nodeSize, !Y.isText) break;
          W += Y.text;
        }
        if (M >= h) {
          if (M >= k && W.slice(k - w.length - I, k - I) == w) return k - w.length;
          var le = I < k ? W.lastIndexOf(w, k - I - 1) : -1;
          if (le >= 0 && le + w.length + I >= h) return I + le;
          if (h == k && W.length >= k + w.length - I && W.slice(k - I, k - I + w.length) == w) return k;
        }
      }
    }
    return -1;
  }
  function Wn(d, w, h, k, S) {
    for (var M = [], P = 0, I = 0; P < d.length; P++) {
      var W = d[P], Y = I, le = I += W.size;
      Y >= h || le <= w ? M.push(W) : (Y < w && M.push(W.slice(0, w - Y, k)), S && (M.push(S), S = void 0), le > h && M.push(W.slice(h - Y, W.size, k)));
    }
    return M;
  }
  function jn(d) {
    var w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, h = d.domSelectionRange(), k = d.state.doc;
    if (!h.focusNode) return null;
    var S = d.docView.nearestDesc(h.focusNode), M = S && S.size == 0, P = d.docView.posFromDOM(h.focusNode, h.focusOffset, 1);
    if (P < 0) return null;
    var I = k.resolve(P), W, Y;
    if (Le(h)) {
      for (W = P; S && !S.node; ) S = S.parent;
      var le = S.node;
      if (S && le.isAtom && pe.NodeSelection.isSelectable(le) && S.parent && !(le.isInline && He(h.focusNode, h.focusOffset, S.dom))) {
        var xe = S.posBefore;
        Y = new pe.NodeSelection(P == xe ? I : k.resolve(xe));
      }
    } else {
      if (h instanceof d.dom.ownerDocument.defaultView.Selection && h.rangeCount > 1) {
        for (var ve = P, Re = P, Ue = 0; Ue < h.rangeCount; Ue++) {
          var nt = h.getRangeAt(Ue);
          ve = Math.min(ve, d.docView.posFromDOM(nt.startContainer, nt.startOffset, 1)), Re = Math.max(Re, d.docView.posFromDOM(nt.endContainer, nt.endOffset, -1));
        }
        if (ve < 0) return null;
        var gt = Re == d.state.selection.anchor ? [Re, ve] : [ve, Re], Xe = r(gt, 2);
        W = Xe[0], P = Xe[1], I = k.resolve(P);
      } else
        W = d.docView.posFromDOM(h.anchorNode, h.anchorOffset, 1);
      if (W < 0) return null;
    }
    var rr = k.resolve(W);
    if (!Y) {
      var Jt = w == "pointer" || d.state.selection.head < I.pos && !M ? 1 : -1;
      Y = Qt(d, rr, I, Jt);
    }
    return Y;
  }
  function Xi(d) {
    return d.editable ? d.hasFocus() : Uo(d) && document.activeElement && document.activeElement.contains(d.dom);
  }
  function yn(d) {
    var w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, h = d.state.selection;
    if (La(d, h), !!Xi(d)) {
      if (!w && d.input.mouseDown && d.input.mouseDown.allowDefault && Tt) {
        var k = d.domSelectionRange(), S = d.domObserver.currentSelection;
        if (k.anchorNode && S.anchorNode && Rt(k.anchorNode, k.anchorOffset, S.anchorNode, S.anchorOffset)) {
          d.input.mouseDown.delayedSelectionSync = !0, d.domObserver.setCurSelection();
          return;
        }
      }
      if (d.domObserver.disconnectSelection(), d.cursorWrapper)
        Mn(d);
      else {
        var M = h.anchor, P = h.head, I, W;
        Ho && !(h instanceof pe.TextSelection) && (h.$from.parent.inlineContent || (I = no(d, h.from)), !h.empty && !h.$from.parent.inlineContent && (W = no(d, h.to))), d.docView.setSelection(M, P, d, w), Ho && (I && Da(I), W && Da(W)), h.visible ? d.dom.classList.remove("ProseMirror-hideselection") : (d.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Aa(d));
      }
      d.domObserver.setCurSelection(), d.domObserver.connectSelection();
    }
  }
  var Ho = jt || Tt && Yt < 63;
  function no(d, w) {
    var h = d.docView.domFromPos(w, 0), k = h.node, S = h.offset, M = S < k.childNodes.length ? k.childNodes[S] : null, P = S ? k.childNodes[S - 1] : null;
    if (jt && M && M.contentEditable == "false") return ha(M);
    if ((!M || M.contentEditable == "false") && (!P || P.contentEditable == "false")) {
      if (M) return ha(M);
      if (P) return ha(P);
    }
  }
  function ha(d) {
    return d.contentEditable = "true", jt && d.draggable && (d.draggable = !1, d.wasDraggable = !0), d;
  }
  function Da(d) {
    d.contentEditable = "false", d.wasDraggable && (d.draggable = !0, d.wasDraggable = null);
  }
  function Aa(d) {
    var w = d.dom.ownerDocument;
    w.removeEventListener("selectionchange", d.input.hideSelectionGuard);
    var h = d.domSelectionRange(), k = h.anchorNode, S = h.anchorOffset;
    w.addEventListener("selectionchange", d.input.hideSelectionGuard = function() {
      (h.anchorNode != k || h.anchorOffset != S) && (w.removeEventListener("selectionchange", d.input.hideSelectionGuard), setTimeout(function() {
        (!Xi(d) || d.state.selection.visible) && d.dom.classList.remove("ProseMirror-hideselection");
      }, 20));
    });
  }
  function Mn(d) {
    var w = d.domSelection();
    if (w) {
      var h = d.cursorWrapper.dom, k = h.nodeName == "IMG";
      k ? w.collapse(h.parentNode, ze(h) + 1) : w.collapse(h, 0), !k && !d.state.selection.visible && oe && Pe <= 11 && (h.disabled = !0, h.disabled = !1);
    }
  }
  function La(d, w) {
    if (w instanceof pe.NodeSelection) {
      var h = d.docView.descAt(w.from);
      h != d.lastSelectedViewDesc && (pa(d), h && h.selectNode(), d.lastSelectedViewDesc = h);
    } else
      pa(d);
  }
  function pa(d) {
    d.lastSelectedViewDesc && (d.lastSelectedViewDesc.parent && d.lastSelectedViewDesc.deselectNode(), d.lastSelectedViewDesc = void 0);
  }
  function Qt(d, w, h, k) {
    return d.someProp("createSelectionBetween", function(S) {
      return S(d, w, h);
    }) || pe.TextSelection.between(w, h, k);
  }
  function Vo(d) {
    return d.editable && !d.hasFocus() ? !1 : Uo(d);
  }
  function Uo(d) {
    var w = d.domSelectionRange();
    if (!w.anchorNode) return !1;
    try {
      return d.dom.contains(w.anchorNode.nodeType == 3 ? w.anchorNode.parentNode : w.anchorNode) && (d.editable || d.dom.contains(w.focusNode.nodeType == 3 ? w.focusNode.parentNode : w.focusNode));
    } catch {
      return !1;
    }
  }
  function Ii(d) {
    var w = d.docView.domFromPos(d.state.selection.anchor, 0), h = d.domSelectionRange();
    return Rt(w.node, w.offset, h.anchorNode, h.anchorOffset);
  }
  function wi(d, w) {
    var h = d.selection, k = h.$anchor, S = h.$head, M = w > 0 ? k.max(S) : k.min(S), P = M.parent.inlineContent ? M.depth ? d.doc.resolve(w > 0 ? M.after() : M.before()) : null : M;
    return P && pe.Selection.findFrom(P, w);
  }
  function bi(d, w) {
    return d.dispatch(d.state.tr.setSelection(w).scrollIntoView()), !0;
  }
  function Ra(d, w, h) {
    var k = d.state.selection;
    if (k instanceof pe.TextSelection)
      if (h.indexOf("s") > -1) {
        var S = k.$head, M = S.textOffset ? null : w < 0 ? S.nodeBefore : S.nodeAfter;
        if (!M || M.isText || !M.isLeaf) return !1;
        var P = d.state.doc.resolve(S.pos + M.nodeSize * (w < 0 ? -1 : 1));
        return bi(d, new pe.TextSelection(k.$anchor, P));
      } else if (k.empty) {
        if (d.endOfTextblock(w > 0 ? "forward" : "backward")) {
          var I = wi(d.state, w);
          return I && I instanceof pe.NodeSelection ? bi(d, I) : !1;
        } else if (!(tr && h.indexOf("m") > -1)) {
          var W = k.$head, Y = W.textOffset ? null : w < 0 ? W.nodeBefore : W.nodeAfter, le;
          if (!Y || Y.isText) return !1;
          var xe = w < 0 ? W.pos - Y.nodeSize : W.pos;
          return Y.isAtom || (le = d.docView.descAt(xe)) && !le.contentDOM ? pe.NodeSelection.isSelectable(Y) ? bi(d, new pe.NodeSelection(w < 0 ? d.state.doc.resolve(W.pos - Y.nodeSize) : W)) : Wr ? bi(d, new pe.TextSelection(d.state.doc.resolve(w < 0 ? xe : xe + Y.nodeSize))) : !1 : !1;
        }
      } else return !1;
    else {
      if (k instanceof pe.NodeSelection && k.node.isInline)
        return bi(d, new pe.TextSelection(w > 0 ? k.$to : k.$from));
      var ve = wi(d.state, w);
      return ve ? bi(d, ve) : !1;
    }
  }
  function Yi(d) {
    return d.nodeType == 3 ? d.nodeValue.length : d.childNodes.length;
  }
  function Ci(d, w) {
    var h = d.pmViewDesc;
    return h && h.size == 0 && (w < 0 || d.nextSibling || d.nodeName != "BR");
  }
  function Zr(d, w) {
    return w < 0 ? ni(d) : Pi(d);
  }
  function ni(d) {
    var w = d.domSelectionRange(), h = w.focusNode, k = w.focusOffset;
    if (h) {
      var S, M, P = !1;
      for (Ve && h.nodeType == 1 && k < Yi(h) && Ci(h.childNodes[k], -1) && (P = !0); ; )
        if (k > 0) {
          if (h.nodeType != 1)
            break;
          var I = h.childNodes[k - 1];
          if (Ci(I, -1))
            S = h, M = --k;
          else if (I.nodeType == 3)
            h = I, k = h.nodeValue.length;
          else break;
        } else {
          if (fn(h))
            break;
          for (var W = h.previousSibling; W && Ci(W, -1); )
            S = h.parentNode, M = ze(W), W = W.previousSibling;
          if (W)
            h = W, k = Yi(h);
          else {
            if (h = h.parentNode, h == d.dom) break;
            k = 0;
          }
        }
      P ? io(d, h, k) : S && io(d, S, M);
    }
  }
  function Pi(d) {
    var w = d.domSelectionRange(), h = w.focusNode, k = w.focusOffset;
    if (h) {
      for (var S = Yi(h), M, P; ; )
        if (k < S) {
          if (h.nodeType != 1) break;
          var I = h.childNodes[k];
          if (Ci(I, 1))
            M = h, P = ++k;
          else break;
        } else {
          if (fn(h))
            break;
          for (var W = h.nextSibling; W && Ci(W, 1); )
            M = W.parentNode, P = ze(W) + 1, W = W.nextSibling;
          if (W)
            h = W, k = 0, S = Yi(h);
          else {
            if (h = h.parentNode, h == d.dom) break;
            k = S = 0;
          }
        }
      M && io(d, M, P);
    }
  }
  function fn(d) {
    var w = d.pmViewDesc;
    return w && w.node && w.node.isBlock;
  }
  function va(d, w) {
    for (; d && w == d.childNodes.length && !fe(d); )
      w = ze(d) + 1, d = d.parentNode;
    for (; d && w < d.childNodes.length; ) {
      var h = d.childNodes[w];
      if (h.nodeType == 3) return h;
      if (h.nodeType == 1 && h.contentEditable == "false") break;
      d = h, w = 0;
    }
  }
  function Ti(d, w) {
    for (; d && !w && !fe(d); )
      w = ze(d), d = d.parentNode;
    for (; d && w; ) {
      var h = d.childNodes[w - 1];
      if (h.nodeType == 3) return h;
      if (h.nodeType == 1 && h.contentEditable == "false") break;
      d = h, w = d.childNodes.length;
    }
  }
  function io(d, w, h) {
    if (w.nodeType != 3) {
      var k, S;
      (S = va(w, h)) ? (w = S, h = 0) : (k = Ti(w, h)) && (w = k, h = k.nodeValue.length);
    }
    var M = d.domSelection();
    if (M) {
      if (Le(M)) {
        var P = document.createRange();
        P.setEnd(w, h), P.setStart(w, h), M.removeAllRanges(), M.addRange(P);
      } else M.extend && M.extend(w, h);
      d.domObserver.setCurSelection();
      var I = d.state;
      setTimeout(function() {
        d.state == I && yn(d);
      }, 50);
    }
  }
  function $o(d, w) {
    var h = d.state.doc.resolve(w);
    if (!(Tt || yr) && h.parent.inlineContent) {
      var k = d.coordsAtPos(w);
      if (w > h.start()) {
        var S = d.coordsAtPos(w - 1), M = (S.top + S.bottom) / 2;
        if (M > k.top && M < k.bottom && Math.abs(S.left - k.left) > 1) return S.left < k.left ? "ltr" : "rtl";
      }
      if (w < h.end()) {
        var P = d.coordsAtPos(w + 1), I = (P.top + P.bottom) / 2;
        if (I > k.top && I < k.bottom && Math.abs(P.left - k.left) > 1) return P.left > k.left ? "ltr" : "rtl";
      }
    }
    var W = getComputedStyle(d.dom).direction;
    return W == "rtl" ? "rtl" : "ltr";
  }
  function ii(d, w, h) {
    var k = d.state.selection;
    if (k instanceof pe.TextSelection && !k.empty || h.indexOf("s") > -1 || tr && h.indexOf("m") > -1) return !1;
    var S = k.$from, M = k.$to;
    if (!S.parent.inlineContent || d.endOfTextblock(w < 0 ? "up" : "down")) {
      var P = wi(d.state, w);
      if (P && P instanceof pe.NodeSelection) return bi(d, P);
    }
    if (!S.parent.inlineContent) {
      var I = w < 0 ? S : M, W = k instanceof pe.AllSelection ? pe.Selection.near(I, w) : pe.Selection.findFrom(I, w);
      return W ? bi(d, W) : !1;
    }
    return !1;
  }
  function ai(d, w) {
    if (!(d.state.selection instanceof pe.TextSelection)) return !0;
    var h = d.state.selection, k = h.$head, S = h.$anchor, M = h.empty;
    if (!k.sameParent(S)) return !0;
    if (!M) return !1;
    if (d.endOfTextblock(w > 0 ? "forward" : "backward")) return !0;
    var P = !k.textOffset && (w < 0 ? k.nodeBefore : k.nodeAfter);
    if (P && !P.isText) {
      var I = d.state.tr;
      return w < 0 ? I.delete(k.pos - P.nodeSize, k.pos) : I.delete(k.pos, k.pos + P.nodeSize), d.dispatch(I), !0;
    }
    return !1;
  }
  function ao(d, w, h) {
    d.domObserver.stop(), w.contentEditable = h, d.domObserver.start();
  }
  function Ia(d) {
    if (!jt || d.state.selection.$head.parentOffset > 0) return !1;
    var w = d.domSelectionRange(), h = w.focusNode, k = w.focusOffset;
    if (h && h.nodeType == 1 && k == 0 && h.firstChild && h.firstChild.contentEditable == "false") {
      var S = h.firstChild;
      ao(d, S, "true"), setTimeout(function() {
        return ao(d, S, "false");
      }, 20);
    }
    return !1;
  }
  function Wo(d) {
    var w = "";
    return d.ctrlKey && (w += "c"), d.metaKey && (w += "m"), d.altKey && (w += "a"), d.shiftKey && (w += "s"), w;
  }
  function Sl(d, w) {
    var h = w.keyCode, k = Wo(w);
    if (h == 8 || tr && h == 72 && k == "c")
      return ai(d, -1) || Zr(d, -1);
    if (h == 46 && !w.shiftKey || tr && h == 68 && k == "c")
      return ai(d, 1) || Zr(d, 1);
    if (h == 13 || h == 27)
      return !0;
    if (h == 37 || tr && h == 66 && k == "c") {
      var S = h == 37 ? $o(d, d.state.selection.from) == "ltr" ? -1 : 1 : -1;
      return Ra(d, S, k) || Zr(d, S);
    } else if (h == 39 || tr && h == 70 && k == "c") {
      var M = h == 39 ? $o(d, d.state.selection.from) == "ltr" ? 1 : -1 : 1;
      return Ra(d, M, k) || Zr(d, M);
    } else {
      if (h == 38 || tr && h == 80 && k == "c")
        return ii(d, -1, k) || Zr(d, -1);
      if (h == 40 || tr && h == 78 && k == "c")
        return Ia(d) || ii(d, 1, k) || Zr(d, 1);
      if (k == (tr ? "m" : "c") && (h == 66 || h == 73 || h == 89 || h == 90))
        return !0;
    }
    return !1;
  }
  function St(d, w) {
    d.someProp("transformCopied", function(Xe) {
      w = Xe(w, d);
    });
    for (var h = [], k = w, S = k.content, M = k.openStart, P = k.openEnd; M > 1 && P > 1 && S.childCount == 1 && S.firstChild.childCount == 1; ) {
      M--, P--;
      var I = S.firstChild;
      h.push(I.type.name, I.attrs != I.type.defaultAttrs ? I.attrs : null), S = I.content;
    }
    var W = d.someProp("clipboardSerializer") || ke.DOMSerializer.fromSchema(d.state.schema), Y = oo(), le = Y.createElement("div");
    le.appendChild(W.serializeFragment(S, {
      document: Y
    }));
    for (var xe = le.firstChild, ve, Re = 0; xe && xe.nodeType == 1 && (ve = Zi[xe.nodeName.toLowerCase()]); ) {
      for (var Ue = ve.length - 1; Ue >= 0; Ue--) {
        for (var nt = Y.createElement(ve[Ue]); le.firstChild; ) nt.appendChild(le.firstChild);
        le.appendChild(nt), Re++;
      }
      xe = le.firstChild;
    }
    xe && xe.nodeType == 1 && xe.setAttribute("data-pm-slice", "".concat(M, " ").concat(P).concat(Re ? " -".concat(Re) : "", " ").concat(JSON.stringify(h)));
    var gt = d.someProp("clipboardTextSerializer", function(Xe) {
      return Xe(w, d);
    }) || w.content.textBetween(0, w.content.size, `

`);
    return {
      dom: le,
      text: gt,
      slice: w
    };
  }
  function Se(d, w, h, k, S) {
    var M = S.parent.type.spec.code, P, I;
    if (!h && !w) return null;
    var W = !!w && (k || M || !h);
    if (W) {
      if (d.someProp("transformPastedText", function(lr) {
        w = lr(w, M || k, d);
      }), M)
        return I = new ke.Slice(ke.Fragment.from(d.state.schema.text(w.replace(/\r\n?/g, `
`))), 0, 0), d.someProp("transformPasted", function(lr) {
          I = lr(I, d, !0);
        }), I;
      var Y = d.someProp("clipboardTextParser", function(lr) {
        return lr(w, S, k, d);
      });
      if (Y)
        I = Y;
      else {
        var le = S.marks(), xe = d.state.schema, ve = ke.DOMSerializer.fromSchema(xe);
        P = document.createElement("div"), w.split(/(?:\r\n?|\n)+/).forEach(function(lr) {
          var or = P.appendChild(document.createElement("p"));
          lr && or.appendChild(ve.serializeNode(xe.text(lr, le)));
        });
      }
    } else
      d.someProp("transformPastedHTML", function(lr) {
        h = lr(h, d);
      }), P = Ds(h), Wr && As(P);
    var Re = P && P.querySelector("[data-pm-slice]"), Ue = Re && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(Re.getAttribute("data-pm-slice") || "");
    if (Ue && Ue[3]) for (var nt = +Ue[3]; nt > 0; nt--) {
      for (var gt = P.firstChild; gt && gt.nodeType != 1; ) gt = gt.nextSibling;
      if (!gt) break;
      P = gt;
    }
    if (!I) {
      var Xe = d.someProp("clipboardParser") || d.someProp("domParser") || ke.DOMParser.fromSchema(d.state.schema);
      I = Xe.parseSlice(P, {
        preserveWhitespace: !!(W || Ue),
        context: S,
        ruleFromNode: function(or) {
          return or.nodeName == "BR" && !or.nextSibling && or.parentNode && !tt.test(or.parentNode.nodeName) ? {
            ignore: !0
          } : null;
        }
      });
    }
    if (Ue)
      I = Iu(Nn(I, +Ue[1], +Ue[2]), Ue[4]);
    else if (I = ke.Slice.maxOpen(wt(I.content, S), !0), I.openStart || I.openEnd) {
      for (var rr = 0, Jt = 0, Dt = I.content.firstChild; rr < I.openStart && !Dt.type.spec.isolating; rr++, Dt = Dt.firstChild)
        ;
      for (var Gt = I.content.lastChild; Jt < I.openEnd && !Gt.type.spec.isolating; Jt++, Gt = Gt.lastChild)
        ;
      I = Nn(I, rr, Jt);
    }
    return d.someProp("transformPasted", function(lr) {
      I = lr(I, d, W);
    }), I;
  }
  var tt = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
  function wt(d, w) {
    if (d.childCount < 2) return d;
    for (var h = function() {
      var P = w.node(S), I = P.contentMatchAt(w.index(S)), W, Y = [];
      if (d.forEach(function(le) {
        if (Y) {
          var xe = I.findWrapping(le.type), ve;
          if (!xe) return Y = null;
          if (ve = Y.length && W.length && Gr(xe, W, le, Y[Y.length - 1], 0))
            Y[Y.length - 1] = ve;
          else {
            Y.length && (Y[Y.length - 1] = Pr(Y[Y.length - 1], W.length));
            var Re = sr(le, xe);
            Y.push(Re), I = I.matchType(Re.type), W = xe;
          }
        }
      }), Y) return {
        v: ke.Fragment.from(Y)
      };
    }, k, S = w.depth; S >= 0; S--)
      if (k = h(), k) return k.v;
    return d;
  }
  function sr(d, w) {
    for (var h = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, k = w.length - 1; k >= h; k--) d = w[k].create(null, ke.Fragment.from(d));
    return d;
  }
  function Gr(d, w, h, k, S) {
    if (S < d.length && S < w.length && d[S] == w[S]) {
      var M = Gr(d, w, h, k.lastChild, S + 1);
      if (M) return k.copy(k.content.replaceChild(k.childCount - 1, M));
      var P = k.contentMatchAt(k.childCount);
      if (P.matchType(S == d.length - 1 ? h.type : d[S + 1])) return k.copy(k.content.append(ke.Fragment.from(sr(h, d, S + 1))));
    }
  }
  function Pr(d, w) {
    if (w == 0) return d;
    var h = d.content.replaceChild(d.childCount - 1, Pr(d.lastChild, w - 1)), k = d.contentMatchAt(d.childCount).fillBefore(ke.Fragment.empty, !0);
    return d.copy(h.append(k));
  }
  function Mr(d, w, h, k, S, M) {
    var P = w < 0 ? d.firstChild : d.lastChild, I = P.content;
    return d.childCount > 1 && (M = 0), S < k - 1 && (I = Mr(I, w, h, k, S + 1, M)), S >= h && (I = w < 0 ? P.contentMatchAt(0).fillBefore(I, M <= S).append(I) : I.append(P.contentMatchAt(P.childCount).fillBefore(ke.Fragment.empty, !0))), d.replaceChild(w < 0 ? 0 : d.childCount - 1, P.copy(I));
  }
  function Nn(d, w, h) {
    return w < d.openStart && (d = new ke.Slice(Mr(d.content, -1, w, d.openStart, 0, d.openEnd), w, d.openEnd)), h < d.openEnd && (d = new ke.Slice(Mr(d.content, 1, h, d.openEnd, 0, 0), d.openStart, h)), d;
  }
  var Zi = {
    thead: ["table"],
    tbody: ["table"],
    tfoot: ["table"],
    caption: ["table"],
    colgroup: ["table"],
    col: ["table", "colgroup"],
    tr: ["table", "tbody"],
    td: ["table", "tbody", "tr"],
    th: ["table", "tbody", "tr"]
  }, oi = null;
  function oo() {
    return oi || (oi = document.implementation.createHTMLDocument("title"));
  }
  var Pa = null;
  function Ru(d) {
    var w = window.trustedTypes;
    return w ? (Pa || (Pa = w.defaultPolicy || w.createPolicy("ProseMirrorClipboard", {
      createHTML: function(k) {
        return k;
      }
    })), Pa.createHTML(d)) : d;
  }
  function Ds(d) {
    var w = /^(\s*<meta [^>]*>)*/.exec(d);
    w && (d = d.slice(w[0].length));
    var h = oo().createElement("div"), k = /<([a-z][^>\s]+)/i.exec(d), S;
    if ((S = k && Zi[k[1].toLowerCase()]) && (d = S.map(function(P) {
      return "<" + P + ">";
    }).join("") + d + S.map(function(P) {
      return "</" + P + ">";
    }).reverse().join("")), h.innerHTML = Ru(d), S) for (var M = 0; M < S.length; M++) h = h.querySelector(S[M]) || h;
    return h;
  }
  function As(d) {
    for (var w = d.querySelectorAll(Tt ? "span:not([class]):not([style])" : "span.Apple-converted-space"), h = 0; h < w.length; h++) {
      var k = w[h];
      k.childNodes.length == 1 && k.textContent == " " && k.parentNode && k.parentNode.replaceChild(d.ownerDocument.createTextNode(" "), k);
    }
  }
  function Iu(d, w) {
    if (!d.size) return d;
    var h = d.content.firstChild.type.schema, k;
    try {
      k = JSON.parse(w);
    } catch {
      return d;
    }
    for (var S = d.content, M = d.openStart, P = d.openEnd, I = k.length - 2; I >= 0; I -= 2) {
      var W = h.nodes[k[I]];
      if (!W || W.hasRequiredAttrs()) break;
      S = ke.Fragment.from(W.create(k[I + 1], S)), M++, P++;
    }
    return new ke.Slice(S, M, P);
  }
  var br = {}, zr = {}, xl = {
    touchstart: !0,
    touchmove: !0
  }, jo = se(function d() {
    j(this, d), this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = {
      time: 0,
      x: 0,
      y: 0,
      type: "",
      button: 0
    }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
  });
  function bf(d) {
    var w = function() {
      var S = br[h];
      d.dom.addEventListener(h, d.input.eventHandlers[h] = function(M) {
        Pu(d, M) && !so(d, M) && (d.editable || !(M.type in zr)) && S(d, M);
      }, xl[h] ? {
        passive: !0
      } : void 0);
    };
    for (var h in br)
      w();
    jt && d.dom.addEventListener("input", function() {
      return null;
    }), Ba(d);
  }
  function Bi(d, w) {
    d.input.lastSelectionOrigin = w, d.input.lastSelectionTime = Date.now();
  }
  function El(d) {
    d.domObserver.stop();
    for (var w in d.input.eventHandlers) d.dom.removeEventListener(w, d.input.eventHandlers[w]);
    clearTimeout(d.input.composingTimeout), clearTimeout(d.input.lastIOSEnterFallbackTimeout);
  }
  function Ba(d) {
    d.someProp("handleDOMEvents", function(w) {
      for (var h in w) d.input.eventHandlers[h] || d.dom.addEventListener(h, d.input.eventHandlers[h] = function(k) {
        return so(d, k);
      });
    });
  }
  function so(d, w) {
    return d.someProp("handleDOMEvents", function(h) {
      var k = h[w.type];
      return k ? k(d, w) || w.defaultPrevented : !1;
    });
  }
  function Pu(d, w) {
    if (!w.bubbles) return !0;
    if (w.defaultPrevented) return !1;
    for (var h = w.target; h != d.dom; h = h.parentNode) if (!h || h.nodeType == 11 || h.pmViewDesc && h.pmViewDesc.stopEvent(w)) return !1;
    return !0;
  }
  function Cf(d, w) {
    !so(d, w) && br[w.type] && (d.editable || !(w.type in zr)) && br[w.type](d, w);
  }
  zr.keydown = function(d, w) {
    var h = w;
    if (d.input.shiftKey = h.keyCode == 16 || h.shiftKey, !Rs(d, h) && (d.input.lastKeyCode = h.keyCode, d.input.lastKeyCodeTime = Date.now(), !(ar && Tt && h.keyCode == 13)))
      if (h.keyCode != 229 && d.domObserver.forceFlush(), mr && h.keyCode == 13 && !h.ctrlKey && !h.altKey && !h.metaKey) {
        var k = Date.now();
        d.input.lastIOSEnter = k, d.input.lastIOSEnterFallbackTimeout = setTimeout(function() {
          d.input.lastIOSEnter == k && (d.someProp("handleKeyDown", function(S) {
            return S(d, dt(13, "Enter"));
          }), d.input.lastIOSEnter = 0);
        }, 200);
      } else d.someProp("handleKeyDown", function(S) {
        return S(d, h);
      }) || Sl(d, h) ? h.preventDefault() : Bi(d, "key");
  }, zr.keyup = function(d, w) {
    w.keyCode == 16 && (d.input.shiftKey = !1);
  }, zr.keypress = function(d, w) {
    var h = w;
    if (!(Rs(d, h) || !h.charCode || h.ctrlKey && !h.altKey || tr && h.metaKey)) {
      if (d.someProp("handleKeyPress", function(P) {
        return P(d, h);
      })) {
        h.preventDefault();
        return;
      }
      var k = d.state.selection;
      if (!(k instanceof pe.TextSelection) || !k.$from.sameParent(k.$to)) {
        var S = String.fromCharCode(h.charCode), M = function() {
          return d.state.tr.insertText(S).scrollIntoView();
        };
        !/[\r\n]/.test(S) && !d.someProp("handleTextInput", function(P) {
          return P(d, k.$from.pos, k.$to.pos, S, M);
        }) && d.dispatch(M()), h.preventDefault();
      }
    }
  };
  function Ls(d) {
    return {
      left: d.clientX,
      top: d.clientY
    };
  }
  function Tf(d, w) {
    var h = w.x - d.clientX, k = w.y - d.clientY;
    return h * h + k * k < 100;
  }
  function Go(d, w, h, k, S) {
    if (k == -1) return !1;
    for (var M = d.state.doc.resolve(k), P = function(le) {
      if (d.someProp(w, function(xe) {
        return le > M.depth ? xe(d, h, M.nodeAfter, M.before(le), S, !0) : xe(d, h, M.node(le), M.before(le), S, !1);
      })) return {
        v: !0
      };
    }, I, W = M.depth + 1; W > 0; W--)
      if (I = P(W), I) return I.v;
    return !1;
  }
  function lo(d, w, h) {
    if (d.focused || d.focus(), !d.state.selection.eq(w)) {
      var k = d.state.tr.setSelection(w);
      k.setMeta("pointer", !0), d.dispatch(k);
    }
  }
  function Sf(d, w) {
    if (w == -1) return !1;
    var h = d.state.doc.resolve(w), k = h.nodeAfter;
    return k && k.isAtom && pe.NodeSelection.isSelectable(k) ? (lo(d, new pe.NodeSelection(h)), !0) : !1;
  }
  function xf(d, w) {
    if (w == -1) return !1;
    var h = d.state.selection, k, S;
    h instanceof pe.NodeSelection && (k = h.node);
    for (var M = d.state.doc.resolve(w), P = M.depth + 1; P > 0; P--) {
      var I = P > M.depth ? M.nodeAfter : M.node(P);
      if (pe.NodeSelection.isSelectable(I)) {
        k && h.$from.depth > 0 && P >= h.$from.depth && M.before(h.$from.depth + 1) == h.$from.pos ? S = M.before(h.$from.depth) : S = M.before(P);
        break;
      }
    }
    return S != null ? (lo(d, pe.NodeSelection.create(d.state.doc, S)), !0) : !1;
  }
  function Ef(d, w, h, k, S) {
    return Go(d, "handleClickOn", w, h, k) || d.someProp("handleClick", function(M) {
      return M(d, w, k);
    }) || (S ? xf(d, h) : Sf(d, h));
  }
  function Mf(d, w, h, k) {
    return Go(d, "handleDoubleClickOn", w, h, k) || d.someProp("handleDoubleClick", function(S) {
      return S(d, w, k);
    });
  }
  function Bu(d, w, h, k) {
    return Go(d, "handleTripleClickOn", w, h, k) || d.someProp("handleTripleClick", function(S) {
      return S(d, w, k);
    }) || Nf(d, h, k);
  }
  function Nf(d, w, h) {
    if (h.button != 0) return !1;
    var k = d.state.doc;
    if (w == -1)
      return k.inlineContent ? (lo(d, pe.TextSelection.create(k, 0, k.content.size)), !0) : !1;
    for (var S = k.resolve(w), M = S.depth + 1; M > 0; M--) {
      var P = M > S.depth ? S.nodeAfter : S.node(M), I = S.before(M);
      if (P.inlineContent) lo(d, pe.TextSelection.create(k, I + 1, I + 1 + P.content.size));
      else if (pe.NodeSelection.isSelectable(P)) lo(d, pe.NodeSelection.create(k, I));
      else continue;
      return !0;
    }
  }
  function Ml(d) {
    return Ko(d);
  }
  var Fu = tr ? "metaKey" : "ctrlKey";
  br.mousedown = function(d, w) {
    var h = w;
    d.input.shiftKey = h.shiftKey;
    var k = Ml(d), S = Date.now(), M = "singleClick";
    S - d.input.lastClick.time < 500 && Tf(h, d.input.lastClick) && !h[Fu] && d.input.lastClick.button == h.button && (d.input.lastClick.type == "singleClick" ? M = "doubleClick" : d.input.lastClick.type == "doubleClick" && (M = "tripleClick")), d.input.lastClick = {
      time: S,
      x: h.clientX,
      y: h.clientY,
      type: M,
      button: h.button
    };
    var P = d.posAtCoords(Ls(h));
    P && (M == "singleClick" ? (d.input.mouseDown && d.input.mouseDown.done(), d.input.mouseDown = new Of(d, P, h, !!k)) : (M == "doubleClick" ? Mf : Bu)(d, P.pos, P.inside, h) ? h.preventDefault() : Bi(d, "pointer"));
  };
  var Of = (function() {
    function d(w, h, k, S) {
      var M = this;
      j(this, d), this.view = w, this.pos = h, this.event = k, this.flushed = S, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = w.state.doc, this.selectNode = !!k[Fu], this.allowDefault = k.shiftKey;
      var P, I;
      if (h.inside > -1)
        P = w.state.doc.nodeAt(h.inside), I = h.inside;
      else {
        var W = w.state.doc.resolve(h.pos);
        P = W.parent, I = W.depth ? W.before() : 0;
      }
      var Y = S ? null : k.target, le = Y ? w.docView.nearestDesc(Y, !0) : null;
      this.target = le && le.nodeDOM.nodeType == 1 ? le.nodeDOM : null;
      var xe = w.state.selection;
      (k.button == 0 && P.type.spec.draggable && P.type.spec.selectable !== !1 || xe instanceof pe.NodeSelection && xe.from <= I && xe.to > I) && (this.mightDrag = {
        node: P,
        pos: I,
        addAttr: !!(this.target && !this.target.draggable),
        setUneditable: !!(this.target && Ve && !this.target.hasAttribute("contentEditable"))
      }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(function() {
        M.view.input.mouseDown == M && M.target.setAttribute("contentEditable", "false");
      }, 20), this.view.domObserver.start()), w.root.addEventListener("mouseup", this.up = this.up.bind(this)), w.root.addEventListener("mousemove", this.move = this.move.bind(this)), Bi(w, "pointer");
    }
    return se(d, [{
      key: "done",
      value: function() {
        var h = this;
        this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(function() {
          return yn(h.view);
        }), this.view.input.mouseDown = null;
      }
    }, {
      key: "up",
      value: function(h) {
        if (this.done(), !!this.view.dom.contains(h.target)) {
          var k = this.pos;
          this.view.state.doc != this.startDoc && (k = this.view.posAtCoords(Ls(h))), this.updateAllowDefault(h), this.allowDefault || !k ? Bi(this.view, "pointer") : Ef(this.view, k.pos, k.inside, h, this.selectNode) ? h.preventDefault() : h.button == 0 && (this.flushed || jt && this.mightDrag && !this.mightDrag.node.isAtom || Tt && !this.view.state.selection.visible && Math.min(Math.abs(k.pos - this.view.state.selection.from), Math.abs(k.pos - this.view.state.selection.to)) <= 2) ? (lo(this.view, pe.Selection.near(this.view.state.doc.resolve(k.pos))), h.preventDefault()) : Bi(this.view, "pointer");
        }
      }
    }, {
      key: "move",
      value: function(h) {
        this.updateAllowDefault(h), Bi(this.view, "pointer"), h.buttons == 0 && this.done();
      }
    }, {
      key: "updateAllowDefault",
      value: function(h) {
        !this.allowDefault && (Math.abs(this.event.x - h.clientX) > 4 || Math.abs(this.event.y - h.clientY) > 4) && (this.allowDefault = !0);
      }
    }]), d;
  })();
  br.touchstart = function(d) {
    d.input.lastTouch = Date.now(), Ml(d), Bi(d, "pointer");
  }, br.touchmove = function(d) {
    d.input.lastTouch = Date.now(), Bi(d, "pointer");
  }, br.contextmenu = function(d) {
    return Ml(d);
  };
  function Rs(d, w) {
    return d.composing ? !0 : jt && Math.abs(w.timeStamp - d.input.compositionEndedAt) < 500 ? (d.input.compositionEndedAt = -2e8, !0) : !1;
  }
  var Df = ar ? 5e3 : -1;
  zr.compositionstart = zr.compositionupdate = function(d) {
    if (!d.composing) {
      d.domObserver.flush();
      var w = d.state, h = w.selection.$to;
      if (w.selection instanceof pe.TextSelection && (w.storedMarks || !h.textOffset && h.parentOffset && h.nodeBefore.marks.some(function(W) {
        return W.type.spec.inclusive === !1;
      }) || Tt && yr && Af(d)))
        d.markCursor = d.state.storedMarks || h.marks(), Ko(d, !0), d.markCursor = null;
      else if (Ko(d, !w.selection.empty), Ve && w.selection.empty && h.parentOffset && !h.textOffset && h.nodeBefore.marks.length)
        for (var k = d.domSelectionRange(), S = k.focusNode, M = k.focusOffset; S && S.nodeType == 1 && M != 0; ) {
          var P = M < 0 ? S.lastChild : S.childNodes[M - 1];
          if (!P) break;
          if (P.nodeType == 3) {
            var I = d.domSelection();
            I && I.collapse(P, P.nodeValue.length);
            break;
          } else
            S = P, M = -1;
        }
      d.input.composing = !0;
    }
    _u(d, Df);
  };
  function Af(d) {
    var w = d.domSelectionRange(), h = w.focusNode, k = w.focusOffset;
    if (!h || h.nodeType != 1 || k >= h.childNodes.length) return !1;
    var S = h.childNodes[k];
    return S.nodeType == 1 && S.contentEditable == "false";
  }
  zr.compositionend = function(d, w) {
    d.composing && (d.input.composing = !1, d.input.compositionEndedAt = w.timeStamp, d.input.compositionPendingChanges = d.domObserver.pendingRecords().length ? d.input.compositionID : 0, d.input.compositionNode = null, d.input.compositionPendingChanges && Promise.resolve().then(function() {
      return d.domObserver.flush();
    }), d.input.compositionID++, _u(d, 20));
  };
  function _u(d, w) {
    clearTimeout(d.input.composingTimeout), w > -1 && (d.input.composingTimeout = setTimeout(function() {
      return Ko(d);
    }, w));
  }
  function Nl(d) {
    for (d.composing && (d.input.composing = !1, d.input.compositionEndedAt = Rf()); d.input.compositionNodes.length > 0; ) d.input.compositionNodes.pop().markParentsDirty();
  }
  function Lf(d) {
    var w = d.domSelectionRange();
    if (!w.focusNode) return null;
    var h = Ke(w.focusNode, w.focusOffset), k = ct(w.focusNode, w.focusOffset);
    if (h && k && h != k) {
      var S = k.pmViewDesc, M = d.domObserver.lastChangedTextNode;
      if (h == M || k == M) return M;
      if (!S || !S.isText(k.nodeValue))
        return k;
      if (d.input.compositionNode == k) {
        var P = h.pmViewDesc;
        if (!(!P || !P.isText(h.nodeValue))) return k;
      }
    }
    return h || k;
  }
  function Rf() {
    var d = document.createEvent("Event");
    return d.initEvent("event", !0, !0), d.timeStamp;
  }
  function Ko(d) {
    var w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
    if (!(ar && d.domObserver.flushingSoon >= 0)) {
      if (d.domObserver.forceFlush(), Nl(d), w || d.docView && d.docView.dirty) {
        var h = jn(d), k = d.state.selection;
        return h && !h.eq(k) ? d.dispatch(d.state.tr.setSelection(h)) : (d.markCursor || w) && !k.$from.node(k.$from.sharedDepth(k.to)).inlineContent ? d.dispatch(d.state.tr.deleteSelection()) : d.updateState(d.state), !0;
      }
      return !1;
    }
  }
  function If(d, w) {
    if (d.dom.parentNode) {
      var h = d.dom.parentNode.appendChild(document.createElement("div"));
      h.appendChild(w), h.style.cssText = "position: fixed; left: -10000px; top: 10px";
      var k = getSelection(), S = document.createRange();
      S.selectNodeContents(w), d.dom.blur(), k.removeAllRanges(), k.addRange(S), setTimeout(function() {
        h.parentNode && h.parentNode.removeChild(h), d.focus();
      }, 50);
    }
  }
  var Jo = oe && Pe < 15 || mr && ki < 604;
  br.copy = zr.cut = function(d, w) {
    var h = w, k = d.state.selection, S = h.type == "cut";
    if (!k.empty) {
      var M = Jo ? null : h.clipboardData, P = k.content(), I = St(d, P), W = I.dom, Y = I.text;
      M ? (h.preventDefault(), M.clearData(), M.setData("text/html", W.innerHTML), M.setData("text/plain", Y)) : If(d, W), S && d.dispatch(d.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
    }
  };
  function Pf(d) {
    return d.openStart == 0 && d.openEnd == 0 && d.content.childCount == 1 ? d.content.firstChild : null;
  }
  function Bf(d, w) {
    if (d.dom.parentNode) {
      var h = d.input.shiftKey || d.state.selection.$from.parent.type.spec.code, k = d.dom.parentNode.appendChild(document.createElement(h ? "textarea" : "div"));
      h || (k.contentEditable = "true"), k.style.cssText = "position: fixed; left: -10000px; top: 10px", k.focus();
      var S = d.input.shiftKey && d.input.lastKeyCode != 45;
      setTimeout(function() {
        d.focus(), k.parentNode && k.parentNode.removeChild(k), h ? Fa(d, k.value, null, S, w) : Fa(d, k.textContent, k.innerHTML, S, w);
      }, 50);
    }
  }
  function Fa(d, w, h, k, S) {
    var M = Se(d, w, h, k, d.state.selection.$from);
    if (d.someProp("handlePaste", function(W) {
      return W(d, S, M || ke.Slice.empty);
    })) return !0;
    if (!M) return !1;
    var P = Pf(M), I = P ? d.state.tr.replaceSelectionWith(P, k) : d.state.tr.replaceSelection(M);
    return d.dispatch(I.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
  }
  function uo(d) {
    var w = d.getData("text/plain") || d.getData("Text");
    if (w) return w;
    var h = d.getData("text/uri-list");
    return h ? h.replace(/\r?\n/g, " ") : "";
  }
  zr.paste = function(d, w) {
    var h = w;
    if (!(d.composing && !ar)) {
      var k = Jo ? null : h.clipboardData, S = d.input.shiftKey && d.input.lastKeyCode != 45;
      k && Fa(d, uo(k), k.getData("text/html"), S, h) ? h.preventDefault() : Bf(d, h);
    }
  };
  var qu = se(function d(w, h, k) {
    j(this, d), this.slice = w, this.move = h, this.node = k;
  }), zu = tr ? "altKey" : "ctrlKey";
  function Ol(d, w) {
    var h = d.someProp("dragCopies", function(k) {
      return !k(w);
    });
    return h ?? !w[zu];
  }
  br.dragstart = function(d, w) {
    var h = w, k = d.input.mouseDown;
    if (k && k.done(), !!h.dataTransfer) {
      var S = d.state.selection, M = S.empty ? null : d.posAtCoords(Ls(h)), P;
      if (!(M && M.pos >= S.from && M.pos <= (S instanceof pe.NodeSelection ? S.to - 1 : S.to))) {
        if (k && k.mightDrag)
          P = pe.NodeSelection.create(d.state.doc, k.mightDrag.pos);
        else if (h.target && h.target.nodeType == 1) {
          var I = d.docView.nearestDesc(h.target, !0);
          I && I.node.type.spec.draggable && I != d.docView && (P = pe.NodeSelection.create(d.state.doc, I.posBefore));
        }
      }
      var W = (P || d.state.selection).content(), Y = St(d, W), le = Y.dom, xe = Y.text, ve = Y.slice;
      (!h.dataTransfer.files.length || !Tt || Yt > 120) && h.dataTransfer.clearData(), h.dataTransfer.setData(Jo ? "Text" : "text/html", le.innerHTML), h.dataTransfer.effectAllowed = "copyMove", Jo || h.dataTransfer.setData("text/plain", xe), d.dragging = new qu(ve, Ol(d, h), P);
    }
  }, br.dragend = function(d) {
    var w = d.dragging;
    window.setTimeout(function() {
      d.dragging == w && (d.dragging = null);
    }, 50);
  }, zr.dragover = zr.dragenter = function(d, w) {
    return w.preventDefault();
  }, zr.drop = function(d, w) {
    try {
      Hu(d, w, d.dragging);
    } finally {
      d.dragging = null;
    }
  };
  function Hu(d, w, h) {
    if (w.dataTransfer) {
      var k = d.posAtCoords(Ls(w));
      if (k) {
        var S = d.state.doc.resolve(k.pos), M = h && h.slice;
        M ? d.someProp("transformPasted", function(nt) {
          M = nt(M, d, !1);
        }) : M = Se(d, uo(w.dataTransfer), Jo ? null : w.dataTransfer.getData("text/html"), !1, S);
        var P = !!(h && Ol(d, w));
        if (d.someProp("handleDrop", function(nt) {
          return nt(d, w, M || ke.Slice.empty, P);
        })) {
          w.preventDefault();
          return;
        }
        if (M) {
          w.preventDefault();
          var I = M ? Ne.dropPoint(d.state.doc, S.pos, M) : S.pos;
          I == null && (I = S.pos);
          var W = d.state.tr;
          if (P) {
            var Y = h.node;
            Y ? Y.replace(W) : W.deleteSelection();
          }
          var le = W.mapping.map(I), xe = M.openStart == 0 && M.openEnd == 0 && M.content.childCount == 1, ve = W.doc;
          if (xe ? W.replaceRangeWith(le, le, M.content.firstChild) : W.replaceRange(le, le, M), !W.doc.eq(ve)) {
            var Re = W.doc.resolve(le);
            if (xe && pe.NodeSelection.isSelectable(M.content.firstChild) && Re.nodeAfter && Re.nodeAfter.sameMarkup(M.content.firstChild))
              W.setSelection(new pe.NodeSelection(Re));
            else {
              var Ue = W.mapping.map(I);
              W.mapping.maps[W.mapping.maps.length - 1].forEach(function(nt, gt, Xe, rr) {
                return Ue = rr;
              }), W.setSelection(Qt(d, Re, W.doc.resolve(Ue)));
            }
            d.focus(), d.dispatch(W.setMeta("uiEvent", "drop"));
          }
        }
      }
    }
  }
  br.focus = function(d) {
    d.input.lastFocus = Date.now(), d.focused || (d.domObserver.stop(), d.dom.classList.add("ProseMirror-focused"), d.domObserver.start(), d.focused = !0, setTimeout(function() {
      d.docView && d.hasFocus() && !d.domObserver.currentSelection.eq(d.domSelectionRange()) && yn(d);
    }, 20));
  }, br.blur = function(d, w) {
    var h = w;
    d.focused && (d.domObserver.stop(), d.dom.classList.remove("ProseMirror-focused"), d.domObserver.start(), h.relatedTarget && d.dom.contains(h.relatedTarget) && d.domObserver.currentSelection.clear(), d.focused = !1);
  }, br.beforeinput = function(d, w) {
    var h = w;
    if (Tt && ar && h.inputType == "deleteContentBackward") {
      d.domObserver.flushSoon();
      var k = d.input.domChangeCount;
      setTimeout(function() {
        if (d.input.domChangeCount == k && (d.dom.blur(), d.focus(), !d.someProp("handleKeyDown", function(M) {
          return M(d, dt(8, "Backspace"));
        }))) {
          var S = d.state.selection.$cursor;
          S && S.pos > 0 && d.dispatch(d.state.tr.delete(S.pos - 1, S.pos).scrollIntoView());
        }
      }, 50);
    }
  };
  for (var Dl in zr) br[Dl] = zr[Dl];
  function co(d, w) {
    if (d == w) return !0;
    for (var h in d) if (d[h] !== w[h]) return !1;
    for (var k in w) if (!(k in d)) return !1;
    return !0;
  }
  var _a = (function() {
    function d(w, h) {
      j(this, d), this.toDOM = w, this.spec = h || ma, this.side = this.spec.side || 0;
    }
    return se(d, [{
      key: "map",
      value: function(h, k, S, M) {
        var P = h.mapResult(k.from + M, this.side < 0 ? -1 : 1), I = P.pos, W = P.deleted;
        return W ? null : new qa(I - S, I - S, this);
      }
    }, {
      key: "valid",
      value: function() {
        return !0;
      }
    }, {
      key: "eq",
      value: function(h) {
        return this == h || h instanceof d && (this.spec.key && this.spec.key == h.spec.key || this.toDOM == h.toDOM && co(this.spec, h.spec));
      }
    }, {
      key: "destroy",
      value: function(h) {
        this.spec.destroy && this.spec.destroy(h);
      }
    }]), d;
  })(), Qo = (function() {
    function d(w, h) {
      j(this, d), this.attrs = w, this.spec = h || ma;
    }
    return se(d, [{
      key: "map",
      value: function(h, k, S, M) {
        var P = h.map(k.from + M, this.spec.inclusiveStart ? -1 : 1) - S, I = h.map(k.to + M, this.spec.inclusiveEnd ? 1 : -1) - S;
        return P >= I ? null : new qa(P, I, this);
      }
    }, {
      key: "valid",
      value: function(h, k) {
        return k.from < k.to;
      }
    }, {
      key: "eq",
      value: function(h) {
        return this == h || h instanceof d && co(this.attrs, h.attrs) && co(this.spec, h.spec);
      }
    }, {
      key: "destroy",
      value: function() {
      }
    }], [{
      key: "is",
      value: function(h) {
        return h.type instanceof d;
      }
    }]), d;
  })(), Ff = (function() {
    function d(w, h) {
      j(this, d), this.attrs = w, this.spec = h || ma;
    }
    return se(d, [{
      key: "map",
      value: function(h, k, S, M) {
        var P = h.mapResult(k.from + M, 1);
        if (P.deleted) return null;
        var I = h.mapResult(k.to + M, -1);
        return I.deleted || I.pos <= P.pos ? null : new qa(P.pos - S, I.pos - S, this);
      }
    }, {
      key: "valid",
      value: function(h, k) {
        var S = h.content.findIndex(k.from), M = S.index, P = S.offset, I;
        return P == k.from && !(I = h.child(M)).isText && P + I.nodeSize == k.to;
      }
    }, {
      key: "eq",
      value: function(h) {
        return this == h || h instanceof d && co(this.attrs, h.attrs) && co(this.spec, h.spec);
      }
    }, {
      key: "destroy",
      value: function() {
      }
    }]), d;
  })(), qa = (function() {
    function d(w, h, k) {
      j(this, d), this.from = w, this.to = h, this.type = k;
    }
    return se(d, [{
      key: "copy",
      value: function(h, k) {
        return new d(h, k, this.type);
      }
    }, {
      key: "eq",
      value: function(h) {
        var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        return this.type.eq(h.type) && this.from + k == h.from && this.to + k == h.to;
      }
    }, {
      key: "map",
      value: function(h, k, S) {
        return this.type.map(h, this, k, S);
      }
    }, {
      key: "spec",
      get: function() {
        return this.type.spec;
      }
    }, {
      key: "inline",
      get: function() {
        return this.type instanceof Qo;
      }
    }, {
      key: "widget",
      get: function() {
        return this.type instanceof _a;
      }
    }], [{
      key: "widget",
      value: function(h, k, S) {
        return new d(h, h, new _a(k, S));
      }
    }, {
      key: "inline",
      value: function(h, k, S, M) {
        return new d(h, k, new Qo(S, M));
      }
    }, {
      key: "node",
      value: function(h, k, S, M) {
        return new d(h, k, new Ff(S, M));
      }
    }]), d;
  })(), za = [], ma = {}, kn = (function() {
    function d(w, h) {
      j(this, d), this.local = w.length ? w : za, this.children = h.length ? h : za;
    }
    return se(d, [{
      key: "find",
      value: function(h, k, S) {
        var M = [];
        return this.findInner(h ?? 0, k ?? 1e9, M, 0, S), M;
      }
    }, {
      key: "findInner",
      value: function(h, k, S, M, P) {
        for (var I = 0; I < this.local.length; I++) {
          var W = this.local[I];
          W.from <= k && W.to >= h && (!P || P(W.spec)) && S.push(W.copy(W.from + M, W.to + M));
        }
        for (var Y = 0; Y < this.children.length; Y += 3)
          if (this.children[Y] < k && this.children[Y + 1] > h) {
            var le = this.children[Y] + 1;
            this.children[Y + 2].findInner(h - le, k - le, S, M + le, P);
          }
      }
    }, {
      key: "map",
      value: function(h, k, S) {
        return this == Hr || h.maps.length == 0 ? this : this.mapInner(h, k, 0, 0, S || ma);
      }
    }, {
      key: "mapInner",
      value: function(h, k, S, M, P) {
        for (var I, W = 0; W < this.local.length; W++) {
          var Y = this.local[W].map(h, S, M);
          Y && Y.type.valid(k, Y) ? (I || (I = [])).push(Y) : P.onRemove && P.onRemove(this.local[W].spec);
        }
        return this.children.length ? Is(this.children, I || [], h, k, S, M, P) : I ? new d(I.sort(ga), za) : Hr;
      }
    }, {
      key: "add",
      value: function(h, k) {
        return k.length ? this == Hr ? d.create(h, k) : this.addInner(h, k, 0) : this;
      }
    }, {
      key: "addInner",
      value: function(h, k, S) {
        var M = this, P, I = 0;
        h.forEach(function(le, xe) {
          var ve = xe + S, Re;
          if (Re = Ps(k, le, ve)) {
            for (P || (P = M.children.slice()); I < P.length && P[I] < xe; ) I += 3;
            P[I] == xe ? P[I + 2] = P[I + 2].addInner(le, Re, ve + 1) : P.splice(I, 0, xe, xe + le.nodeSize, Xo(Re, le, ve + 1, ma)), I += 3;
          }
        });
        for (var W = Uu(I ? Bs(k) : k, -S), Y = 0; Y < W.length; Y++) W[Y].type.valid(h, W[Y]) || W.splice(Y--, 1);
        return new d(W.length ? this.local.concat(W).sort(ga) : this.local, P || this.children);
      }
    }, {
      key: "remove",
      value: function(h) {
        return h.length == 0 || this == Hr ? this : this.removeInner(h, 0);
      }
    }, {
      key: "removeInner",
      value: function(h, k) {
        for (var S = this.children, M = this.local, P = 0; P < S.length; P += 3) {
          for (var I = void 0, W = S[P] + k, Y = S[P + 1] + k, le = 0, xe; le < h.length; le++) (xe = h[le]) && xe.from > W && xe.to < Y && (h[le] = null, (I || (I = [])).push(xe));
          if (I) {
            S == this.children && (S = this.children.slice());
            var ve = S[P + 2].removeInner(I, W + 1);
            ve != Hr ? S[P + 2] = ve : (S.splice(P, 3), P -= 3);
          }
        }
        if (M.length) {
          for (var Re = 0, Ue; Re < h.length; Re++) if (Ue = h[Re])
            for (var nt = 0; nt < M.length; nt++) M[nt].eq(Ue, k) && (M == this.local && (M = this.local.slice()), M.splice(nt--, 1));
        }
        return S == this.children && M == this.local ? this : M.length || S.length ? new d(M, S) : Hr;
      }
    }, {
      key: "forChild",
      value: function(h, k) {
        if (this == Hr) return this;
        if (k.isLeaf) return d.empty;
        for (var S, M, P = 0; P < this.children.length; P += 3) if (this.children[P] >= h) {
          this.children[P] == h && (S = this.children[P + 2]);
          break;
        }
        for (var I = h + 1, W = I + k.content.size, Y = 0; Y < this.local.length; Y++) {
          var le = this.local[Y];
          if (le.from < W && le.to > I && le.type instanceof Qo) {
            var xe = Math.max(I, le.from) - I, ve = Math.min(W, le.to) - I;
            xe < ve && (M || (M = [])).push(le.copy(xe, ve));
          }
        }
        if (M) {
          var Re = new d(M.sort(ga), za);
          return S ? new Vu([Re, S]) : Re;
        }
        return S || Hr;
      }
    }, {
      key: "eq",
      value: function(h) {
        if (this == h) return !0;
        if (!(h instanceof d) || this.local.length != h.local.length || this.children.length != h.children.length) return !1;
        for (var k = 0; k < this.local.length; k++) if (!this.local[k].eq(h.local[k])) return !1;
        for (var S = 0; S < this.children.length; S += 3) if (this.children[S] != h.children[S] || this.children[S + 1] != h.children[S + 1] || !this.children[S + 2].eq(h.children[S + 2])) return !1;
        return !0;
      }
    }, {
      key: "locals",
      value: function(h) {
        return Fs(this.localsInner(h));
      }
    }, {
      key: "localsInner",
      value: function(h) {
        if (this == Hr) return za;
        if (h.inlineContent || !this.local.some(Qo.is)) return this.local;
        for (var k = [], S = 0; S < this.local.length; S++)
          this.local[S].type instanceof Qo || k.push(this.local[S]);
        return k;
      }
    }, {
      key: "forEachSet",
      value: function(h) {
        h(this);
      }
    }], [{
      key: "create",
      value: function(h, k) {
        return k.length ? Xo(k, h, 0, ma) : Hr;
      }
    }]), d;
  })();
  kn.empty = new kn([], []), kn.removeOverlap = Fs;
  var Hr = kn.empty, Vu = (function() {
    function d(w) {
      j(this, d), this.members = w;
    }
    return se(d, [{
      key: "map",
      value: function(h, k) {
        var S = this.members.map(function(M) {
          return M.map(h, k, ma);
        });
        return d.from(S);
      }
    }, {
      key: "forChild",
      value: function(h, k) {
        if (k.isLeaf) return kn.empty;
        for (var S = [], M = 0; M < this.members.length; M++) {
          var P = this.members[M].forChild(h, k);
          P != Hr && (P instanceof d ? S = S.concat(P.members) : S.push(P));
        }
        return d.from(S);
      }
    }, {
      key: "eq",
      value: function(h) {
        if (!(h instanceof d) || h.members.length != this.members.length) return !1;
        for (var k = 0; k < this.members.length; k++) if (!this.members[k].eq(h.members[k])) return !1;
        return !0;
      }
    }, {
      key: "locals",
      value: function(h) {
        for (var k, S = !0, M = 0; M < this.members.length; M++) {
          var P = this.members[M].localsInner(h);
          if (P.length)
            if (!k)
              k = P;
            else {
              S && (k = k.slice(), S = !1);
              for (var I = 0; I < P.length; I++) k.push(P[I]);
            }
        }
        return k ? Fs(S ? k : k.sort(ga)) : za;
      }
    }, {
      key: "forEachSet",
      value: function(h) {
        for (var k = 0; k < this.members.length; k++) this.members[k].forEachSet(h);
      }
    }], [{
      key: "from",
      value: function(h) {
        switch (h.length) {
          case 0:
            return Hr;
          case 1:
            return h[0];
          default:
            return new d(h.every(function(k) {
              return k instanceof kn;
            }) ? h : h.reduce(function(k, S) {
              return k.concat(S instanceof kn ? S : S.members);
            }, []));
        }
      }
    }]), d;
  })();
  function Is(d, w, h, k, S, M, P) {
    for (var I = d.slice(), W = function(ea) {
      var ta = 0;
      h.maps[Y].forEach(function(On, go, Cr, si) {
        for (var Dn = si - Cr - (go - On), Or = 0; Or < I.length; Or += 3) {
          var Vs = I[Or + 1];
          if (!(Vs < 0 || On > Vs + ea - ta)) {
            var Xu = I[Or] + ea - ta;
            go >= Xu ? I[Or + 1] = On <= Xu ? -2 : -1 : On >= ea && Dn && (I[Or] += Dn, I[Or + 1] += Dn);
          }
        }
        ta += Dn;
      }), ea = h.maps[Y].map(ea, -1), le = ea;
    }, Y = 0, le = M; Y < h.maps.length; Y++)
      W(le);
    for (var xe = !1, ve = 0; ve < I.length; ve += 3) if (I[ve + 1] < 0) {
      if (I[ve + 1] == -2) {
        xe = !0, I[ve + 1] = -1;
        continue;
      }
      var Re = h.map(d[ve] + M), Ue = Re - S;
      if (Ue < 0 || Ue >= k.content.size) {
        xe = !0;
        continue;
      }
      var nt = h.map(d[ve + 1] + M, -1), gt = nt - S, Xe = k.content.findIndex(Ue), rr = Xe.index, Jt = Xe.offset, Dt = k.maybeChild(rr);
      if (Dt && Jt == Ue && Jt + Dt.nodeSize == gt) {
        var Gt = I[ve + 2].mapInner(h, Dt, Re + 1, d[ve] + M + 1, P);
        Gt != Hr ? (I[ve] = Ue, I[ve + 1] = gt, I[ve + 2] = Gt) : (I[ve + 1] = -2, xe = !0);
      } else
        xe = !0;
    }
    if (xe) {
      var lr = $u(I, d, w, h, S, M, P), or = Xo(lr, k, 0, P);
      w = or.local;
      for (var Nr = 0; Nr < I.length; Nr += 3) I[Nr + 1] < 0 && (I.splice(Nr, 3), Nr -= 3);
      for (var Ar = 0, Vr = 0; Ar < or.children.length; Ar += 3) {
        for (var xi = or.children[Ar]; Vr < I.length && I[Vr] < xi; ) Vr += 3;
        I.splice(Vr, 0, or.children[Ar], or.children[Ar + 1], or.children[Ar + 2]);
      }
    }
    return new kn(w.sort(ga), I);
  }
  function Uu(d, w) {
    if (!w || !d.length) return d;
    for (var h = [], k = 0; k < d.length; k++) {
      var S = d[k];
      h.push(new qa(S.from + w, S.to + w, S.type));
    }
    return h;
  }
  function $u(d, w, h, k, S, M, P) {
    function I(Y, le) {
      for (var xe = 0; xe < Y.local.length; xe++) {
        var ve = Y.local[xe].map(k, S, le);
        ve ? h.push(ve) : P.onRemove && P.onRemove(Y.local[xe].spec);
      }
      for (var Re = 0; Re < Y.children.length; Re += 3) I(Y.children[Re + 2], Y.children[Re] + le + 1);
    }
    for (var W = 0; W < d.length; W += 3) d[W + 1] == -1 && I(d[W + 2], w[W] + M + 1);
    return h;
  }
  function Ps(d, w, h) {
    if (w.isLeaf) return null;
    for (var k = h + w.nodeSize, S = null, M = 0, P; M < d.length; M++)
      (P = d[M]) && P.from > h && P.to < k && ((S || (S = [])).push(P), d[M] = null);
    return S;
  }
  function Bs(d) {
    for (var w = [], h = 0; h < d.length; h++) d[h] != null && w.push(d[h]);
    return w;
  }
  function Xo(d, w, h, k) {
    var S = [], M = !1;
    w.forEach(function(W, Y) {
      var le = Ps(d, W, Y + h);
      if (le) {
        M = !0;
        var xe = Xo(le, W, h + Y + 1, k);
        xe != Hr && S.push(Y, Y + W.nodeSize, xe);
      }
    });
    for (var P = Uu(M ? Bs(d) : d, -h).sort(ga), I = 0; I < P.length; I++) P[I].type.valid(w, P[I]) || (k.onRemove && k.onRemove(P[I].spec), P.splice(I--, 1));
    return P.length || S.length ? new kn(P, S) : Hr;
  }
  function ga(d, w) {
    return d.from - w.from || d.to - w.to;
  }
  function Fs(d) {
    for (var w = d, h = 0; h < w.length - 1; h++) {
      var k = w[h];
      if (k.from != k.to) for (var S = h + 1; S < w.length; S++) {
        var M = w[S];
        if (M.from == k.from) {
          M.to != k.to && (w == d && (w = d.slice()), w[S] = M.copy(M.from, k.to), Wu(w, S + 1, M.copy(k.to, M.to)));
          continue;
        } else {
          M.from < k.to && (w == d && (w = d.slice()), w[h] = k.copy(k.from, M.from), Wu(w, S, k.copy(M.from, k.to)));
          break;
        }
      }
    }
    return w;
  }
  function Wu(d, w, h) {
    for (; w < d.length && ga(h, d[w]) > 0; ) w++;
    d.splice(w, 0, h);
  }
  function Al(d) {
    var w = [];
    return d.someProp("decorations", function(h) {
      var k = h(d.state);
      k && k != Hr && w.push(k);
    }), d.cursorWrapper && w.push(kn.create(d.state.doc, [d.cursorWrapper.deco])), Vu.from(w);
  }
  var _f = {
    childList: !0,
    characterData: !0,
    characterDataOldValue: !0,
    attributes: !0,
    attributeOldValue: !0,
    subtree: !0
  }, qf = oe && Pe <= 11, zf = (function() {
    function d() {
      j(this, d), this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
    }
    return se(d, [{
      key: "set",
      value: function(h) {
        this.anchorNode = h.anchorNode, this.anchorOffset = h.anchorOffset, this.focusNode = h.focusNode, this.focusOffset = h.focusOffset;
      }
    }, {
      key: "clear",
      value: function() {
        this.anchorNode = this.focusNode = null;
      }
    }, {
      key: "eq",
      value: function(h) {
        return h.anchorNode == this.anchorNode && h.anchorOffset == this.anchorOffset && h.focusNode == this.focusNode && h.focusOffset == this.focusOffset;
      }
    }]), d;
  })(), Si = (function() {
    function d(w, h) {
      var k = this;
      j(this, d), this.view = w, this.handleDOMChange = h, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new zf(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver(function(S) {
        for (var M = 0; M < S.length; M++) k.queue.push(S[M]);
        oe && Pe <= 11 && S.some(function(P) {
          return P.type == "childList" && P.removedNodes.length || P.type == "characterData" && P.oldValue.length > P.target.nodeValue.length;
        }) ? k.flushSoon() : k.flush();
      }), qf && (this.onCharData = function(S) {
        k.queue.push({
          target: S.target,
          type: "characterData",
          oldValue: S.prevValue
        }), k.flushSoon();
      }), this.onSelectionChange = this.onSelectionChange.bind(this);
    }
    return se(d, [{
      key: "flushSoon",
      value: function() {
        var h = this;
        this.flushingSoon < 0 && (this.flushingSoon = window.setTimeout(function() {
          h.flushingSoon = -1, h.flush();
        }, 20));
      }
    }, {
      key: "forceFlush",
      value: function() {
        this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
      }
    }, {
      key: "start",
      value: function() {
        this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, _f)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
      }
    }, {
      key: "stop",
      value: function() {
        var h = this;
        if (this.observer) {
          var k = this.observer.takeRecords();
          if (k.length) {
            for (var S = 0; S < k.length; S++) this.queue.push(k[S]);
            window.setTimeout(function() {
              return h.flush();
            }, 20);
          }
          this.observer.disconnect();
        }
        this.onCharData && this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData), this.disconnectSelection();
      }
    }, {
      key: "connectSelection",
      value: function() {
        this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange);
      }
    }, {
      key: "disconnectSelection",
      value: function() {
        this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange);
      }
    }, {
      key: "suppressSelectionUpdates",
      value: function() {
        var h = this;
        this.suppressingSelectionUpdates = !0, setTimeout(function() {
          return h.suppressingSelectionUpdates = !1;
        }, 50);
      }
    }, {
      key: "onSelectionChange",
      value: function() {
        if (Vo(this.view)) {
          if (this.suppressingSelectionUpdates) return yn(this.view);
          if (oe && Pe <= 11 && !this.view.state.selection.empty) {
            var h = this.view.domSelectionRange();
            if (h.focusNode && Rt(h.focusNode, h.focusOffset, h.anchorNode, h.anchorOffset)) return this.flushSoon();
          }
          this.flush();
        }
      }
    }, {
      key: "setCurSelection",
      value: function() {
        this.currentSelection.set(this.view.domSelectionRange());
      }
    }, {
      key: "ignoreSelectionChange",
      value: function(h) {
        if (!h.focusNode) return !0;
        for (var k = /* @__PURE__ */ new Set(), S, M = h.focusNode; M; M = Ze(M)) k.add(M);
        for (var P = h.anchorNode; P; P = Ze(P)) if (k.has(P)) {
          S = P;
          break;
        }
        var I = S && this.view.docView.nearestDesc(S);
        if (I && I.ignoreMutation({
          type: "selection",
          target: S.nodeType == 3 ? S.parentNode : S
        }))
          return this.setCurSelection(), !0;
      }
    }, {
      key: "pendingRecords",
      value: function() {
        if (this.observer) {
          var h = i(this.observer.takeRecords()), k;
          try {
            for (h.s(); !(k = h.n()).done; ) {
              var S = k.value;
              this.queue.push(S);
            }
          } catch (M) {
            h.e(M);
          } finally {
            h.f();
          }
        }
        return this.queue;
      }
    }, {
      key: "flush",
      value: function() {
        var h = this.view;
        if (!(!h.docView || this.flushingSoon > -1)) {
          var k = this.pendingRecords();
          k.length && (this.queue = []);
          var S = h.domSelectionRange(), M = !this.suppressingSelectionUpdates && !this.currentSelection.eq(S) && Vo(h) && !this.ignoreSelectionChange(S), P = -1, I = -1, W = !1, Y = [];
          if (h.editable)
            for (var le = 0; le < k.length; le++) {
              var xe = this.registerMutation(k[le], Y);
              xe && (P = P < 0 ? xe.from : Math.min(xe.from, P), I = I < 0 ? xe.to : Math.max(xe.to, I), xe.typeOver && (W = !0));
            }
          if (Ve && Y.length) {
            var ve = Y.filter(function(Vr) {
              return Vr.nodeName == "BR";
            });
            if (ve.length == 2) {
              var Re = r(ve, 2), Ue = Re[0], nt = Re[1];
              Ue.parentNode && Ue.parentNode.parentNode == nt.parentNode ? nt.remove() : Ue.remove();
            } else {
              var gt = this.currentSelection.focusNode, Xe = i(ve), rr;
              try {
                for (Xe.s(); !(rr = Xe.n()).done; ) {
                  var Jt = rr.value, Dt = Jt.parentNode;
                  Dt && Dt.nodeName == "LI" && (!gt || Il(h, gt) != Dt) && Jt.remove();
                }
              } catch (Vr) {
                Xe.e(Vr);
              } finally {
                Xe.f();
              }
            }
          } else if ((Tt || jt) && Y.some(function(Vr) {
            return Vr.nodeName == "BR";
          }) && (h.input.lastKeyCode == 8 || h.input.lastKeyCode == 46)) {
            var Gt = i(Y), lr;
            try {
              for (Gt.s(); !(lr = Gt.n()).done; ) {
                var or = lr.value;
                if (or.nodeName == "BR" && or.parentNode) {
                  var Nr = or.nextSibling;
                  Nr && Nr.nodeType == 1 && Nr.contentEditable == "false" && or.parentNode.removeChild(or);
                }
              }
            } catch (Vr) {
              Gt.e(Vr);
            } finally {
              Gt.f();
            }
          }
          var Ar = null;
          P < 0 && M && h.input.lastFocus > Date.now() - 200 && Math.max(h.input.lastTouch, h.input.lastClick.time) < Date.now() - 300 && Le(S) && (Ar = jn(h)) && Ar.eq(pe.Selection.near(h.state.doc.resolve(0), 1)) ? (h.input.lastFocus = 0, yn(h), this.currentSelection.set(S), h.scrollToSelection()) : (P > -1 || M) && (P > -1 && (h.docView.markDirty(P, I), ju(h)), this.handleDOMChange(P, I, W, Y), h.docView && h.docView.dirty ? h.updateState(h.state) : this.currentSelection.eq(S) || yn(h), this.currentSelection.set(S));
        }
      }
    }, {
      key: "registerMutation",
      value: function(h, k) {
        if (k.indexOf(h.target) > -1) return null;
        var S = this.view.docView.nearestDesc(h.target);
        if (h.type == "attributes" && (S == this.view.docView || h.attributeName == "contenteditable" || h.attributeName == "style" && !h.oldValue && !h.target.getAttribute("style")) || !S || S.ignoreMutation(h)) return null;
        if (h.type == "childList") {
          for (var M = 0; M < h.addedNodes.length; M++) {
            var P = h.addedNodes[M];
            k.push(P), P.nodeType == 3 && (this.lastChangedTextNode = P);
          }
          if (S.contentDOM && S.contentDOM != S.dom && !S.contentDOM.contains(h.target)) return {
            from: S.posBefore,
            to: S.posAfter
          };
          var I = h.previousSibling, W = h.nextSibling;
          if (oe && Pe <= 11 && h.addedNodes.length)
            for (var Y = 0; Y < h.addedNodes.length; Y++) {
              var le = h.addedNodes[Y], xe = le.previousSibling, ve = le.nextSibling;
              (!xe || Array.prototype.indexOf.call(h.addedNodes, xe) < 0) && (I = xe), (!ve || Array.prototype.indexOf.call(h.addedNodes, ve) < 0) && (W = ve);
            }
          var Re = I && I.parentNode == h.target ? ze(I) + 1 : 0, Ue = S.localPosFromDOM(h.target, Re, -1), nt = W && W.parentNode == h.target ? ze(W) : h.target.childNodes.length, gt = S.localPosFromDOM(h.target, nt, 1);
          return {
            from: Ue,
            to: gt
          };
        } else return h.type == "attributes" ? {
          from: S.posAtStart - S.border,
          to: S.posAtEnd + S.border
        } : (this.lastChangedTextNode = h.target, {
          from: S.posAtStart,
          to: S.posAtEnd,
          typeOver: h.target.nodeValue == h.oldValue
        });
      }
    }]), d;
  })(), fo = /* @__PURE__ */ new WeakMap(), Ll = !1;
  function ju(d) {
    if (!fo.has(d) && (fo.set(d, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(d.dom).whiteSpace) !== -1)) {
      if (d.requiresGeckoHackNode = Ve, Ll) return;
      console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), Ll = !0;
    }
  }
  function Rl(d, w) {
    var h = w.startContainer, k = w.startOffset, S = w.endContainer, M = w.endOffset, P = d.domAtPos(d.state.selection.anchor);
    if (Rt(P.node, P.offset, S, M)) {
      var I = [S, M, h, k];
      h = I[0], k = I[1], S = I[2], M = I[3];
    }
    return {
      anchorNode: h,
      anchorOffset: k,
      focusNode: S,
      focusOffset: M
    };
  }
  function Gu(d, w) {
    if (w.getComposedRanges) {
      var h = w.getComposedRanges(d.root)[0];
      if (h) return Rl(d, h);
    }
    var k;
    function S(M) {
      M.preventDefault(), M.stopImmediatePropagation(), k = M.getTargetRanges()[0];
    }
    return d.dom.addEventListener("beforeinput", S, !0), document.execCommand("indent"), d.dom.removeEventListener("beforeinput", S, !0), k ? Rl(d, k) : null;
  }
  function Il(d, w) {
    for (var h = w.parentNode; h && h != d.dom; h = h.parentNode) {
      var k = d.docView.nearestDesc(h, !0);
      if (k && k.node.isBlock) return h;
    }
    return null;
  }
  function Hf(d, w, h) {
    var k = d.docView.parseRange(w, h), S = k.node, M = k.fromOffset, P = k.toOffset, I = k.from, W = k.to, Y = d.domSelectionRange(), le, xe = Y.anchorNode;
    if (xe && d.dom.contains(xe.nodeType == 1 ? xe : xe.parentNode) && (le = [{
      node: xe,
      offset: Y.anchorOffset
    }], Le(Y) || le.push({
      node: Y.focusNode,
      offset: Y.focusOffset
    })), Tt && d.input.lastKeyCode === 8)
      for (var ve = P; ve > M; ve--) {
        var Re = S.childNodes[ve - 1], Ue = Re.pmViewDesc;
        if (Re.nodeName == "BR" && !Ue) {
          P = ve;
          break;
        }
        if (!Ue || Ue.size) break;
      }
    var nt = d.state.doc, gt = d.someProp("domParser") || ke.DOMParser.fromSchema(d.state.schema), Xe = nt.resolve(I), rr = null, Jt = gt.parse(S, {
      topNode: Xe.parent,
      topMatch: Xe.parent.contentMatchAt(Xe.index()),
      topOpen: !0,
      from: M,
      to: P,
      preserveWhitespace: Xe.parent.type.whitespace == "pre" ? "full" : !0,
      findPositions: le,
      ruleFromNode: Vf,
      context: Xe
    });
    if (le && le[0].pos != null) {
      var Dt = le[0].pos, Gt = le[1] && le[1].pos;
      Gt == null && (Gt = Dt), rr = {
        anchor: Dt + I,
        head: Gt + I
      };
    }
    return {
      doc: Jt,
      sel: rr,
      from: I,
      to: W
    };
  }
  function Vf(d) {
    var w = d.pmViewDesc;
    if (w)
      return w.parseRule();
    if (d.nodeName == "BR" && d.parentNode) {
      if (jt && /^(ul|ol)$/i.test(d.parentNode.nodeName)) {
        var h = document.createElement("div");
        return h.appendChild(document.createElement("li")), {
          skip: h
        };
      } else if (d.parentNode.lastChild == d || jt && /^(tr|table)$/i.test(d.parentNode.nodeName))
        return {
          ignore: !0
        };
    } else if (d.nodeName == "IMG" && d.getAttribute("mark-placeholder"))
      return {
        ignore: !0
      };
    return null;
  }
  var ho = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
  function Pl(d, w, h, k, S) {
    var M = d.input.compositionPendingChanges || (d.composing ? d.input.compositionID : 0);
    if (d.input.compositionPendingChanges = 0, w < 0) {
      var P = d.input.lastSelectionTime > Date.now() - 50 ? d.input.lastSelectionOrigin : null, I = jn(d, P);
      if (I && !d.state.selection.eq(I)) {
        if (Tt && ar && d.input.lastKeyCode === 13 && Date.now() - 100 < d.input.lastKeyCodeTime && d.someProp("handleKeyDown", function(Cr) {
          return Cr(d, dt(13, "Enter"));
        })) return;
        var W = d.state.tr.setSelection(I);
        P == "pointer" ? W.setMeta("pointer", !0) : P == "key" && W.scrollIntoView(), M && W.setMeta("composition", M), d.dispatch(W);
      }
      return;
    }
    var Y = d.state.doc.resolve(w), le = Y.sharedDepth(h);
    w = Y.before(le + 1), h = d.state.doc.resolve(h).after(le + 1);
    var xe = d.state.selection, ve = Hf(d, w, h), Re = d.state.doc, Ue = Re.slice(ve.from, ve.to), nt, gt;
    d.input.lastKeyCode === 8 && Date.now() - 100 < d.input.lastKeyCodeTime ? (nt = d.state.selection.to, gt = "end") : (nt = d.state.selection.from, gt = "start"), d.input.lastKeyCode = null;
    var Xe = mo(Ue.content, ve.doc.content, ve.from, nt, gt);
    if (Xe && d.input.domChangeCount++, (mr && d.input.lastIOSEnter > Date.now() - 225 || ar) && S.some(function(Cr) {
      return Cr.nodeType == 1 && !ho.test(Cr.nodeName);
    }) && (!Xe || Xe.endA >= Xe.endB) && d.someProp("handleKeyDown", function(Cr) {
      return Cr(d, dt(13, "Enter"));
    })) {
      d.input.lastIOSEnter = 0;
      return;
    }
    if (!Xe)
      if (k && xe instanceof pe.TextSelection && !xe.empty && xe.$head.sameParent(xe.$anchor) && !d.composing && !(ve.sel && ve.sel.anchor != ve.sel.head))
        Xe = {
          start: xe.from,
          endA: xe.to,
          endB: xe.to
        };
      else {
        if (ve.sel) {
          var rr = po(d, d.state.doc, ve.sel);
          if (rr && !rr.eq(d.state.selection)) {
            var Jt = d.state.tr.setSelection(rr);
            M && Jt.setMeta("composition", M), d.dispatch(Jt);
          }
        }
        return;
      }
    d.state.selection.from < d.state.selection.to && Xe.start == Xe.endB && d.state.selection instanceof pe.TextSelection && (Xe.start > d.state.selection.from && Xe.start <= d.state.selection.from + 2 && d.state.selection.from >= ve.from ? Xe.start = d.state.selection.from : Xe.endA < d.state.selection.to && Xe.endA >= d.state.selection.to - 2 && d.state.selection.to <= ve.to && (Xe.endB += d.state.selection.to - Xe.endA, Xe.endA = d.state.selection.to)), oe && Pe <= 11 && Xe.endB == Xe.start + 1 && Xe.endA == Xe.start && Xe.start > ve.from && ve.doc.textBetween(Xe.start - ve.from - 1, Xe.start - ve.from + 1) == "  " && (Xe.start--, Xe.endA--, Xe.endB--);
    var Dt = ve.doc.resolveNoCache(Xe.start - ve.from), Gt = ve.doc.resolveNoCache(Xe.endB - ve.from), lr = Re.resolve(Xe.start), or = Dt.sameParent(Gt) && Dt.parent.inlineContent && lr.end() >= Xe.endA;
    if ((mr && d.input.lastIOSEnter > Date.now() - 225 && (!or || S.some(function(Cr) {
      return Cr.nodeName == "DIV" || Cr.nodeName == "P";
    })) || !or && Dt.pos < ve.doc.content.size && (!Dt.sameParent(Gt) || !Dt.parent.inlineContent) && Dt.pos < Gt.pos && !/\S/.test(ve.doc.textBetween(Dt.pos, Gt.pos, "", ""))) && d.someProp("handleKeyDown", function(Cr) {
      return Cr(d, dt(13, "Enter"));
    })) {
      d.input.lastIOSEnter = 0;
      return;
    }
    if (d.state.selection.anchor > Xe.start && Ku(Re, Xe.start, Xe.endA, Dt, Gt) && d.someProp("handleKeyDown", function(Cr) {
      return Cr(d, dt(8, "Backspace"));
    })) {
      ar && Tt && d.domObserver.suppressSelectionUpdates();
      return;
    }
    Tt && Xe.endB == Xe.start && (d.input.lastChromeDelete = Date.now()), ar && !or && Dt.start() != Gt.start() && Gt.parentOffset == 0 && Dt.depth == Gt.depth && ve.sel && ve.sel.anchor == ve.sel.head && ve.sel.head == Xe.endA && (Xe.endB -= 2, Gt = ve.doc.resolveNoCache(Xe.endB - ve.from), setTimeout(function() {
      d.someProp("handleKeyDown", function(Cr) {
        return Cr(d, dt(13, "Enter"));
      });
    }, 20));
    var Nr = Xe.start, Ar = Xe.endA, Vr = function(si) {
      var Dn = si || d.state.tr.replace(Nr, Ar, ve.doc.slice(Xe.start - ve.from, Xe.endB - ve.from));
      if (ve.sel) {
        var Or = po(d, Dn.doc, ve.sel);
        Or && !(Tt && d.composing && Or.empty && (Xe.start != Xe.endB || d.input.lastChromeDelete < Date.now() - 100) && (Or.head == Nr || Or.head == Dn.mapping.map(Ar) - 1) || oe && Or.empty && Or.head == Nr) && Dn.setSelection(Or);
      }
      return M && Dn.setMeta("composition", M), Dn.scrollIntoView();
    }, xi;
    if (or)
      if (Dt.pos == Gt.pos) {
        oe && Pe <= 11 && Dt.parentOffset == 0 && (d.domObserver.suppressSelectionUpdates(), setTimeout(function() {
          return yn(d);
        }, 20));
        var Hs = Vr(d.state.tr.delete(Nr, Ar)), ea = Re.resolve(Xe.start).marksAcross(Re.resolve(Xe.endA));
        ea && Hs.ensureMarks(ea), d.dispatch(Hs);
      } else if (Xe.endA == Xe.endB && (xi = Bl(Dt.parent.content.cut(Dt.parentOffset, Gt.parentOffset), lr.parent.content.cut(lr.parentOffset, Xe.endA - lr.start())))) {
        var ta = Vr(d.state.tr);
        xi.type == "add" ? ta.addMark(Nr, Ar, xi.mark) : ta.removeMark(Nr, Ar, xi.mark), d.dispatch(ta);
      } else if (Dt.parent.child(Dt.index()).isText && Dt.index() == Gt.index() - (Gt.textOffset ? 0 : 1)) {
        var On = Dt.parent.textBetween(Dt.parentOffset, Gt.parentOffset), go = function() {
          return Vr(d.state.tr.insertText(On, Nr, Ar));
        };
        d.someProp("handleTextInput", function(Cr) {
          return Cr(d, Nr, Ar, On, go);
        }) || d.dispatch(go());
      } else
        d.dispatch(Vr());
    else
      d.dispatch(Vr());
  }
  function po(d, w, h) {
    return Math.max(h.anchor, h.head) > w.content.size ? null : Qt(d, w.resolve(h.anchor), w.resolve(h.head));
  }
  function Bl(d, w) {
    for (var h = d.firstChild.marks, k = w.firstChild.marks, S = h, M = k, P, I, W, Y = 0; Y < k.length; Y++) S = k[Y].removeFromSet(S);
    for (var le = 0; le < h.length; le++) M = h[le].removeFromSet(M);
    if (S.length == 1 && M.length == 0)
      I = S[0], P = "add", W = function(Ue) {
        return Ue.mark(I.addToSet(Ue.marks));
      };
    else if (S.length == 0 && M.length == 1)
      I = M[0], P = "remove", W = function(Ue) {
        return Ue.mark(I.removeFromSet(Ue.marks));
      };
    else
      return null;
    for (var xe = [], ve = 0; ve < w.childCount; ve++) xe.push(W(w.child(ve)));
    if (ke.Fragment.from(xe).eq(d)) return {
      mark: I,
      type: P
    };
  }
  function Ku(d, w, h, k, S) {
    if (h - w <= S.pos - k.pos || vo(k, !0, !1) < S.pos) return !1;
    var M = d.resolve(w);
    if (!k.parent.isTextblock) {
      var P = M.nodeAfter;
      return P != null && h == w + P.nodeSize;
    }
    if (M.parentOffset < M.parent.content.size || !M.parent.isTextblock) return !1;
    var I = d.resolve(vo(M, !0, !0));
    return !I.parent.isTextblock || I.pos > h || vo(I, !0, !1) < h ? !1 : k.parent.content.cut(k.parentOffset).eq(I.parent.content);
  }
  function vo(d, w, h) {
    for (var k = d.depth, S = w ? d.end() : d.pos; k > 0 && (w || d.indexAfter(k) == d.node(k).childCount); )
      k--, S++, w = !1;
    if (h)
      for (var M = d.node(k).maybeChild(d.indexAfter(k)); M && !M.isLeaf; )
        M = M.firstChild, S++;
    return S;
  }
  function mo(d, w, h, k, S) {
    var M = d.findDiffStart(w, h);
    if (M == null) return null;
    var P = d.findDiffEnd(w, h + d.size, h + w.size), I = P.a, W = P.b;
    if (S == "end") {
      var Y = Math.max(0, M - Math.min(I, W));
      k -= I + Y - M;
    }
    if (I < M && d.size < w.size) {
      var le = k <= M && k >= I ? M - k : 0;
      M -= le, M && M < w.size && _s(w.textBetween(M - 1, M + 1)) && (M += le ? 1 : -1), W = M + (W - I), I = M;
    } else if (W < M) {
      var xe = k <= M && k >= W ? M - k : 0;
      M -= xe, M && M < d.size && _s(d.textBetween(M - 1, M + 1)) && (M += xe ? 1 : -1), I = M + (I - W), W = M;
    }
    return {
      start: M,
      endA: I,
      endB: W
    };
  }
  function _s(d) {
    if (d.length != 2) return !1;
    var w = d.charCodeAt(0), h = d.charCodeAt(1);
    return w >= 56320 && w <= 57343 && h >= 55296 && h <= 56319;
  }
  var Ju = Se, qs = Ko, Fl = (function() {
    function d(w, h) {
      var k = this;
      j(this, d), this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new jo(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = h, this.state = h.state, this.directPlugins = h.plugins || [], this.directPlugins.forEach(zs), this.dispatch = this.dispatch.bind(this), this.dom = w && w.mount || document.createElement("div"), w && (w.appendChild ? w.appendChild(this.dom) : typeof w == "function" ? w(this.dom) : w.mount && (this.mounted = !0)), this.editable = zl(this), ql(this), this.nodeViews = Hl(this), this.docView = E(this.state.doc, _l(this), Al(this), this.dom, this), this.domObserver = new Si(this, function(S, M, P, I) {
        return Pl(k, S, M, P, I);
      }), this.domObserver.start(), bf(this), this.updatePluginViews();
    }
    return se(d, [{
      key: "composing",
      get: function() {
        return this.input.composing;
      }
    }, {
      key: "props",
      get: function() {
        if (this._props.state != this.state) {
          var h = this._props;
          this._props = {};
          for (var k in h) this._props[k] = h[k];
          this._props.state = this.state;
        }
        return this._props;
      }
    }, {
      key: "update",
      value: function(h) {
        h.handleDOMEvents != this._props.handleDOMEvents && Ba(this);
        var k = this._props;
        this._props = h, h.plugins && (h.plugins.forEach(zs), this.directPlugins = h.plugins), this.updateStateInner(h.state, k);
      }
    }, {
      key: "setProps",
      value: function(h) {
        var k = {};
        for (var S in this._props) k[S] = this._props[S];
        k.state = this.state;
        for (var M in h) k[M] = h[M];
        this.update(k);
      }
    }, {
      key: "updateState",
      value: function(h) {
        this.updateStateInner(h, this._props);
      }
    }, {
      key: "updateStateInner",
      value: function(h, k) {
        var S, M = this.state, P = !1, I = !1;
        h.storedMarks && this.composing && (Nl(this), I = !0), this.state = h;
        var W = M.plugins != h.plugins || this._props.plugins != k.plugins;
        if (W || this._props.plugins != k.plugins || this._props.nodeViews != k.nodeViews) {
          var Y = Hl(this);
          ya(Y, this.nodeViews) && (this.nodeViews = Y, P = !0);
        }
        (W || k.handleDOMEvents != this._props.handleDOMEvents) && Ba(this), this.editable = zl(this), ql(this);
        var le = Al(this), xe = _l(this), ve = M.plugins != h.plugins && !M.doc.eq(h.doc) ? "reset" : h.scrollToSelection > M.scrollToSelection ? "to selection" : "preserve", Re = P || !this.docView.matchesNode(h.doc, xe, le);
        (Re || !h.selection.eq(M.selection)) && (I = !0);
        var Ue = ve == "preserve" && I && this.dom.style.overflowAnchor == null && _t(this);
        if (I) {
          this.domObserver.stop();
          var nt = Re && (oe || Tt) && !this.composing && !M.selection.empty && !h.selection.empty && Qu(M.selection, h.selection);
          if (Re) {
            var gt = Tt ? this.trackWrites = this.domSelectionRange().focusNode : null;
            this.composing && (this.input.compositionNode = Lf(this)), (P || !this.docView.update(h.doc, xe, le, this)) && (this.docView.updateOuterDeco(xe), this.docView.destroy(), this.docView = E(h.doc, xe, le, this.dom, this)), gt && !this.trackWrites && (nt = !0);
          }
          nt || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && Ii(this)) ? yn(this, nt) : (La(this, h.selection), this.domObserver.setCurSelection()), this.domObserver.start();
        }
        this.updatePluginViews(M), !((S = this.dragging) === null || S === void 0) && S.node && !M.doc.eq(h.doc) && this.updateDraggedNode(this.dragging, M), ve == "reset" ? this.dom.scrollTop = 0 : ve == "to selection" ? this.scrollToSelection() : Ue && Zt(Ue);
      }
    }, {
      key: "scrollToSelection",
      value: function() {
        var h = this, k = this.domSelectionRange().focusNode;
        if (!(!k || !this.dom.contains(k.nodeType == 1 ? k : k.parentNode))) {
          if (!this.someProp("handleScrollToSelection", function(M) {
            return M(h);
          })) if (this.state.selection instanceof pe.NodeSelection) {
            var S = this.docView.domAfterPos(this.state.selection.from);
            S.nodeType == 1 && ut(this, S.getBoundingClientRect(), k);
          } else
            ut(this, this.coordsAtPos(this.state.selection.head, 1), k);
        }
      }
    }, {
      key: "destroyPluginViews",
      value: function() {
        for (var h; h = this.pluginViews.pop(); ) h.destroy && h.destroy();
      }
    }, {
      key: "updatePluginViews",
      value: function(h) {
        if (!h || h.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
          this.prevDirectPlugins = this.directPlugins, this.destroyPluginViews();
          for (var k = 0; k < this.directPlugins.length; k++) {
            var S = this.directPlugins[k];
            S.spec.view && this.pluginViews.push(S.spec.view(this));
          }
          for (var M = 0; M < this.state.plugins.length; M++) {
            var P = this.state.plugins[M];
            P.spec.view && this.pluginViews.push(P.spec.view(this));
          }
        } else
          for (var I = 0; I < this.pluginViews.length; I++) {
            var W = this.pluginViews[I];
            W.update && W.update(this, h);
          }
      }
    }, {
      key: "updateDraggedNode",
      value: function(h, k) {
        var S = h.node, M = -1;
        if (this.state.doc.nodeAt(S.from) == S.node)
          M = S.from;
        else {
          var P = S.from + (this.state.doc.content.size - k.doc.content.size), I = P > 0 && this.state.doc.nodeAt(P);
          I == S.node && (M = P);
        }
        this.dragging = new qu(h.slice, h.move, M < 0 ? void 0 : pe.NodeSelection.create(this.state.doc, M));
      }
    }, {
      key: "someProp",
      value: function(h, k) {
        var S = this._props && this._props[h], M;
        if (S != null && (M = k ? k(S) : S)) return M;
        for (var P = 0; P < this.directPlugins.length; P++) {
          var I = this.directPlugins[P].props[h];
          if (I != null && (M = k ? k(I) : I)) return M;
        }
        var W = this.state.plugins;
        if (W) for (var Y = 0; Y < W.length; Y++) {
          var le = W[Y].props[h];
          if (le != null && (M = k ? k(le) : le)) return M;
        }
      }
    }, {
      key: "hasFocus",
      value: function() {
        if (oe) {
          var h = this.root.activeElement;
          if (h == this.dom) return !0;
          if (!h || !this.dom.contains(h)) return !1;
          for (; h && this.dom != h && this.dom.contains(h); ) {
            if (h.contentEditable == "false") return !1;
            h = h.parentElement;
          }
          return !0;
        }
        return this.root.activeElement == this.dom;
      }
    }, {
      key: "focus",
      value: function() {
        this.domObserver.stop(), this.editable && xr(this.dom), yn(this), this.domObserver.start();
      }
    }, {
      key: "root",
      get: function() {
        var h = this, k = this._root;
        if (k == null) {
          for (var S = function(W) {
            if (W.nodeType == 9 || W.nodeType == 11 && W.host)
              return W.getSelection || (Object.getPrototypeOf(W).getSelection = function() {
                return W.ownerDocument.getSelection();
              }), {
                v: h._root = W
              };
          }, M, P = this.dom.parentNode; P; P = P.parentNode)
            if (M = S(P), M) return M.v;
        }
        return k || document;
      }
    }, {
      key: "updateRoot",
      value: function() {
        this._root = null;
      }
    }, {
      key: "posAtCoords",
      value: function(h) {
        return Xr(this, h);
      }
    }, {
      key: "coordsAtPos",
      value: function(h) {
        var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
        return wr(this, h, k);
      }
    }, {
      key: "domAtPos",
      value: function(h) {
        var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
        return this.docView.domFromPos(h, k);
      }
    }, {
      key: "nodeDOM",
      value: function(h) {
        var k = this.docView.descAt(h);
        return k ? k.nodeDOM : null;
      }
    }, {
      key: "posAtDOM",
      value: function(h, k) {
        var S = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1, M = this.docView.posFromDOM(h, k, S);
        if (M == null) throw new RangeError("DOM position not inside the editor");
        return M;
      }
    }, {
      key: "endOfTextblock",
      value: function(h, k) {
        return Be(this, k || this.state, h);
      }
    }, {
      key: "pasteHTML",
      value: function(h, k) {
        return Fa(this, "", h, !1, k || new ClipboardEvent("paste"));
      }
    }, {
      key: "pasteText",
      value: function(h, k) {
        return Fa(this, h, null, !0, k || new ClipboardEvent("paste"));
      }
    }, {
      key: "serializeForClipboard",
      value: function(h) {
        return St(this, h);
      }
    }, {
      key: "destroy",
      value: function() {
        this.docView && (El(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], Al(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Ht());
      }
    }, {
      key: "isDestroyed",
      get: function() {
        return this.docView == null;
      }
    }, {
      key: "dispatchEvent",
      value: function(h) {
        return Cf(this, h);
      }
    }, {
      key: "domSelectionRange",
      value: function() {
        var h = this.domSelection();
        return h ? jt && this.root.nodeType === 11 && vt(this.dom.ownerDocument) == this.dom && Gu(this, h) || h : {
          focusNode: null,
          focusOffset: 0,
          anchorNode: null,
          anchorOffset: 0
        };
      }
    }, {
      key: "domSelection",
      value: function() {
        return this.root.getSelection();
      }
    }]), d;
  })();
  Fl.prototype.dispatch = function(d) {
    var w = this._props.dispatchTransaction;
    w ? w.call(this, d) : this.updateState(this.state.apply(d));
  };
  function _l(d) {
    var w = /* @__PURE__ */ Object.create(null);
    return w.class = "ProseMirror", w.contenteditable = String(d.editable), d.someProp("attributes", function(h) {
      if (typeof h == "function" && (h = h(d.state)), h) for (var k in h)
        k == "class" ? w.class += " " + h[k] : k == "style" ? w.style = (w.style ? w.style + ";" : "") + h[k] : !w[k] && k != "contenteditable" && k != "nodeName" && (w[k] = String(h[k]));
    }), w.translate || (w.translate = "no"), [qa.node(0, d.state.doc.content.size, w)];
  }
  function ql(d) {
    if (d.markCursor) {
      var w = document.createElement("img");
      w.className = "ProseMirror-separator", w.setAttribute("mark-placeholder", "true"), w.setAttribute("alt", ""), d.cursorWrapper = {
        dom: w,
        deco: qa.widget(d.state.selection.from, w, {
          raw: !0,
          marks: d.markCursor
        })
      };
    } else
      d.cursorWrapper = null;
  }
  function zl(d) {
    return !d.someProp("editable", function(w) {
      return w(d.state) === !1;
    });
  }
  function Qu(d, w) {
    var h = Math.min(d.$anchor.sharedDepth(d.head), w.$anchor.sharedDepth(w.head));
    return d.$anchor.start(h) != w.$anchor.start(h);
  }
  function Hl(d) {
    var w = /* @__PURE__ */ Object.create(null);
    function h(k) {
      for (var S in k) Object.prototype.hasOwnProperty.call(w, S) || (w[S] = k[S]);
    }
    return d.someProp("nodeViews", h), d.someProp("markViews", h), w;
  }
  function ya(d, w) {
    var h = 0, k = 0;
    for (var S in d) {
      if (d[S] != w[S]) return !0;
      h++;
    }
    for (var M in w) k++;
    return h != k;
  }
  function zs(d) {
    if (d.spec.state || d.spec.filterTransaction || d.spec.appendTransaction) throw new RangeError("Plugins passed directly to the view must not have a state component");
  }
  return cu.Decoration = qa, cu.DecorationSet = kn, cu.EditorView = Fl, cu.__endComposition = qs, cu.__parseFromClipboard = Ju, cu;
}
var HT;
function T9e() {
  return HT || (HT = 1, (function(r, e) {
    (function(n, i) {
      r.exports = i(/* @__PURE__ */ k9e(), /* @__PURE__ */ b9e(), /* @__PURE__ */ Wm(), /* @__PURE__ */ jm(), /* @__PURE__ */ C9e());
    })(self, function(t, n, i, a, s) {
      return (
        /******/
        (function() {
          var u = {
            /***/
            368: (
              /***/
              (function(T) {
                (function(N, O) {
                  T.exports = O();
                })(this, function() {
                  function N(st) {
                    if (Array.isArray(st)) {
                      for (var ut = 0, _t = Array(st.length); ut < st.length; ut++)
                        _t[ut] = st[ut];
                      return _t;
                    } else
                      return Array.from(st);
                  }
                  var O = Object.hasOwnProperty, A = Object.setPrototypeOf, q = Object.isFrozen, U = Object.getPrototypeOf, j = Object.getOwnPropertyDescriptor, te = Object.freeze, se = Object.seal, me = Object.create, Ce = typeof Reflect < "u" && Reflect, pe = Ce.apply, ke = Ce.construct;
                  pe || (pe = function(ut, _t, Vt) {
                    return ut.apply(_t, Vt);
                  }), te || (te = function(ut) {
                    return ut;
                  }), se || (se = function(ut) {
                    return ut;
                  }), ke || (ke = function(ut, _t) {
                    return new (Function.prototype.bind.apply(ut, [null].concat(N(_t))))();
                  });
                  var Ne = Ke(Array.prototype.forEach), ze = Ke(Array.prototype.pop), Ze = Ke(Array.prototype.push), At = Ke(String.prototype.toLowerCase), et = Ke(String.prototype.match), Ht = Ke(String.prototype.replace), Rt = Ke(String.prototype.indexOf), Ut = Ke(String.prototype.trim), yt = Ke(RegExp.prototype.test), It = ct(TypeError);
                  function Ke(st) {
                    return function(ut) {
                      for (var _t = arguments.length, Vt = Array(_t > 1 ? _t - 1 : 0), Zt = 1; Zt < _t; Zt++)
                        Vt[Zt - 1] = arguments[Zt];
                      return pe(st, ut, Vt);
                    };
                  }
                  function ct(st) {
                    return function() {
                      for (var ut = arguments.length, _t = Array(ut), Vt = 0; Vt < ut; Vt++)
                        _t[Vt] = arguments[Vt];
                      return ke(st, _t);
                    };
                  }
                  function He(st, ut) {
                    A && A(st, null);
                    for (var _t = ut.length; _t--; ) {
                      var Vt = ut[_t];
                      if (typeof Vt == "string") {
                        var Zt = At(Vt);
                        Zt !== Vt && (q(ut) || (ut[_t] = Zt), Vt = Zt);
                      }
                      st[Vt] = !0;
                    }
                    return st;
                  }
                  function fe(st) {
                    var ut = me(null), _t = void 0;
                    for (_t in st)
                      pe(O, st, [_t]) && (ut[_t] = st[_t]);
                    return ut;
                  }
                  function Le(st, ut) {
                    for (; st !== null; ) {
                      var _t = j(st, ut);
                      if (_t) {
                        if (_t.get)
                          return Ke(_t.get);
                        if (typeof _t.value == "function")
                          return Ke(_t.value);
                      }
                      st = U(st);
                    }
                    function Vt(Zt) {
                      return console.warn("fallback value for", Zt), null;
                    }
                    return Vt;
                  }
                  var dt = te(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), vt = te(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ft = te(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Lt = te(["animate", "color-profile", "cursor", "discard", "fedropshadow", "feimage", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), $t = te(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]), Te = te(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), be = te(["#text"]), ue = te(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]), ge = te(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), oe = te(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Pe = te(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ve = se(/\{\{[\s\S]*|[\s\S]*\}\}/gm), lt = se(/<%[\s\S]*|[\s\S]*%>/gm), Tt = se(/^data-[\-\w.\u00B7-\uFFFF]/), Yt = se(/^aria-[\-\w]+$/), jt = se(
                    /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
                    // eslint-disable-line no-useless-escape
                  ), mr = se(/^(?:\w+script|data):/i), tr = se(
                    /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
                    // eslint-disable-line no-control-regex
                  ), yr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(st) {
                    return typeof st;
                  } : function(st) {
                    return st && typeof Symbol == "function" && st.constructor === Symbol && st !== Symbol.prototype ? "symbol" : typeof st;
                  };
                  function ar(st) {
                    if (Array.isArray(st)) {
                      for (var ut = 0, _t = Array(st.length); ut < st.length; ut++)
                        _t[ut] = st[ut];
                      return _t;
                    } else
                      return Array.from(st);
                  }
                  var Wr = function() {
                    return typeof window > "u" ? null : window;
                  }, ki = function(ut, _t) {
                    if ((typeof ut > "u" ? "undefined" : yr(ut)) !== "object" || typeof ut.createPolicy != "function")
                      return null;
                    var Vt = null, Zt = "data-tt-policy-suffix";
                    _t.currentScript && _t.currentScript.hasAttribute(Zt) && (Vt = _t.currentScript.getAttribute(Zt));
                    var tn = "dompurify" + (Vt ? "#" + Vt : "");
                    try {
                      return ut.createPolicy(tn, {
                        createHTML: function(xr) {
                          return xr;
                        }
                      });
                    } catch {
                      return console.warn("TrustedTypes policy " + tn + " could not be created."), null;
                    }
                  };
                  function Hn() {
                    var st = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Wr(), ut = function(Se) {
                      return Hn(Se);
                    };
                    if (ut.version = "2.3.3", ut.removed = [], !st || !st.document || st.document.nodeType !== 9)
                      return ut.isSupported = !1, ut;
                    var _t = st.document, Vt = st.document, Zt = st.DocumentFragment, tn = st.HTMLTemplateElement, kr = st.Node, xr = st.Element, En = st.NodeFilter, Vn = st.NamedNodeMap, Rr = Vn === void 0 ? st.NamedNodeMap || st.MozNamedAttrMap : Vn, cn = st.Text, ri = st.Comment, Un = st.DOMParser, rn = st.trustedTypes, Xr = xr.prototype, gn = Le(Xr, "cloneNode"), qr = Le(Xr, "nextSibling"), $n = Le(Xr, "childNodes"), wr = Le(Xr, "parentNode");
                    if (typeof tn == "function") {
                      var jr = Vt.createElement("template");
                      jr.content && jr.content.ownerDocument && (Vt = jr.content.ownerDocument);
                    }
                    var Q = ki(rn, _t), X = Q && Yr ? Q.createHTML("") : "", z = Vt, F = z.implementation, V = z.createNodeIterator, G = z.createDocumentFragment, re = z.getElementsByTagName, Ee = _t.importNode, Be = {};
                    try {
                      Be = fe(Vt).documentMode ? Vt.documentMode : {};
                    } catch {
                    }
                    var he = {};
                    ut.isSupported = typeof wr == "function" && F && typeof F.createHTMLDocument < "u" && Be !== 9;
                    var ne = Ve, Ae = lt, Fe = Tt, it = Yt, Nt = mr, H = tr, R = jt, b = null, E = He({}, [].concat(ar(dt), ar(vt), ar(Ft), ar($t), ar(be))), B = null, K = He({}, [].concat(ar(ue), ar(ge), ar(oe), ar(Pe))), Z = null, ae = null, ye = !0, Oe = !0, je = !1, $e = !1, at = !1, Ot = !1, er = !1, hr = !1, Ir = !1, Qi = !0, Yr = !1, Os = !0, zo = !0, Oa = !1, Wn = {}, jn = null, Xi = He({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), yn = null, Ho = He({}, ["audio", "video", "img", "source", "image", "track"]), no = null, ha = He({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Da = "http://www.w3.org/1998/Math/MathML", Aa = "http://www.w3.org/2000/svg", Mn = "http://www.w3.org/1999/xhtml", La = Mn, pa = !1, Qt = void 0, Vo = ["application/xhtml+xml", "text/html"], Uo = "text/html", Ii = void 0, wi = null, bi = Vt.createElement("form"), Ra = function(Se) {
                      wi && wi === Se || ((!Se || (typeof Se > "u" ? "undefined" : yr(Se)) !== "object") && (Se = {}), Se = fe(Se), b = "ALLOWED_TAGS" in Se ? He({}, Se.ALLOWED_TAGS) : E, B = "ALLOWED_ATTR" in Se ? He({}, Se.ALLOWED_ATTR) : K, no = "ADD_URI_SAFE_ATTR" in Se ? He(fe(ha), Se.ADD_URI_SAFE_ATTR) : ha, yn = "ADD_DATA_URI_TAGS" in Se ? He(fe(Ho), Se.ADD_DATA_URI_TAGS) : Ho, jn = "FORBID_CONTENTS" in Se ? He({}, Se.FORBID_CONTENTS) : Xi, Z = "FORBID_TAGS" in Se ? He({}, Se.FORBID_TAGS) : {}, ae = "FORBID_ATTR" in Se ? He({}, Se.FORBID_ATTR) : {}, Wn = "USE_PROFILES" in Se ? Se.USE_PROFILES : !1, ye = Se.ALLOW_ARIA_ATTR !== !1, Oe = Se.ALLOW_DATA_ATTR !== !1, je = Se.ALLOW_UNKNOWN_PROTOCOLS || !1, $e = Se.SAFE_FOR_TEMPLATES || !1, at = Se.WHOLE_DOCUMENT || !1, hr = Se.RETURN_DOM || !1, Ir = Se.RETURN_DOM_FRAGMENT || !1, Qi = Se.RETURN_DOM_IMPORT !== !1, Yr = Se.RETURN_TRUSTED_TYPE || !1, er = Se.FORCE_BODY || !1, Os = Se.SANITIZE_DOM !== !1, zo = Se.KEEP_CONTENT !== !1, Oa = Se.IN_PLACE || !1, R = Se.ALLOWED_URI_REGEXP || R, La = Se.NAMESPACE || Mn, Qt = // eslint-disable-next-line unicorn/prefer-includes
                      Vo.indexOf(Se.PARSER_MEDIA_TYPE) === -1 ? Qt = Uo : Qt = Se.PARSER_MEDIA_TYPE, Ii = Qt === "application/xhtml+xml" ? function(tt) {
                        return tt;
                      } : At, $e && (Oe = !1), Ir && (hr = !0), Wn && (b = He({}, [].concat(ar(be))), B = [], Wn.html === !0 && (He(b, dt), He(B, ue)), Wn.svg === !0 && (He(b, vt), He(B, ge), He(B, Pe)), Wn.svgFilters === !0 && (He(b, Ft), He(B, ge), He(B, Pe)), Wn.mathMl === !0 && (He(b, $t), He(B, oe), He(B, Pe))), Se.ADD_TAGS && (b === E && (b = fe(b)), He(b, Se.ADD_TAGS)), Se.ADD_ATTR && (B === K && (B = fe(B)), He(B, Se.ADD_ATTR)), Se.ADD_URI_SAFE_ATTR && He(no, Se.ADD_URI_SAFE_ATTR), Se.FORBID_CONTENTS && (jn === Xi && (jn = fe(jn)), He(jn, Se.FORBID_CONTENTS)), zo && (b["#text"] = !0), at && He(b, ["html", "head", "body"]), b.table && (He(b, ["tbody"]), delete Z.tbody), te && te(Se), wi = Se);
                    }, Yi = He({}, ["mi", "mo", "mn", "ms", "mtext"]), Ci = He({}, ["foreignobject", "desc", "title", "annotation-xml"]), Zr = He({}, vt);
                    He(Zr, Ft), He(Zr, Lt);
                    var ni = He({}, $t);
                    He(ni, Te);
                    var Pi = function(Se) {
                      var tt = wr(Se);
                      (!tt || !tt.tagName) && (tt = {
                        namespaceURI: Mn,
                        tagName: "template"
                      });
                      var wt = At(Se.tagName), sr = At(tt.tagName);
                      if (Se.namespaceURI === Aa)
                        return tt.namespaceURI === Mn ? wt === "svg" : tt.namespaceURI === Da ? wt === "svg" && (sr === "annotation-xml" || Yi[sr]) : !!Zr[wt];
                      if (Se.namespaceURI === Da)
                        return tt.namespaceURI === Mn ? wt === "math" : tt.namespaceURI === Aa ? wt === "math" && Ci[sr] : !!ni[wt];
                      if (Se.namespaceURI === Mn) {
                        if (tt.namespaceURI === Aa && !Ci[sr] || tt.namespaceURI === Da && !Yi[sr])
                          return !1;
                        var Gr = He({}, ["title", "style", "font", "a", "script"]);
                        return !ni[wt] && (Gr[wt] || !Zr[wt]);
                      }
                      return !1;
                    }, fn = function(Se) {
                      Ze(ut.removed, { element: Se });
                      try {
                        Se.parentNode.removeChild(Se);
                      } catch {
                        try {
                          Se.outerHTML = X;
                        } catch {
                          Se.remove();
                        }
                      }
                    }, va = function(Se, tt) {
                      try {
                        Ze(ut.removed, {
                          attribute: tt.getAttributeNode(Se),
                          from: tt
                        });
                      } catch {
                        Ze(ut.removed, {
                          attribute: null,
                          from: tt
                        });
                      }
                      if (tt.removeAttribute(Se), Se === "is" && !B[Se])
                        if (hr || Ir)
                          try {
                            fn(tt);
                          } catch {
                          }
                        else
                          try {
                            tt.setAttribute(Se, "");
                          } catch {
                          }
                    }, Ti = function(Se) {
                      var tt = void 0, wt = void 0;
                      if (er)
                        Se = "<remove></remove>" + Se;
                      else {
                        var sr = et(Se, /^[\r\n\t ]+/);
                        wt = sr && sr[0];
                      }
                      Qt === "application/xhtml+xml" && (Se = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + Se + "</body></html>");
                      var Gr = Q ? Q.createHTML(Se) : Se;
                      if (La === Mn)
                        try {
                          tt = new Un().parseFromString(Gr, Qt);
                        } catch {
                        }
                      if (!tt || !tt.documentElement) {
                        tt = F.createDocument(La, "template", null);
                        try {
                          tt.documentElement.innerHTML = pa ? "" : Gr;
                        } catch {
                        }
                      }
                      var Pr = tt.body || tt.documentElement;
                      return Se && wt && Pr.insertBefore(Vt.createTextNode(wt), Pr.childNodes[0] || null), La === Mn ? re.call(tt, at ? "html" : "body")[0] : at ? tt.documentElement : Pr;
                    }, io = function(Se) {
                      return V.call(Se.ownerDocument || Se, Se, En.SHOW_ELEMENT | En.SHOW_COMMENT | En.SHOW_TEXT, null, !1);
                    }, $o = function(Se) {
                      return Se instanceof cn || Se instanceof ri ? !1 : typeof Se.nodeName != "string" || typeof Se.textContent != "string" || typeof Se.removeChild != "function" || !(Se.attributes instanceof Rr) || typeof Se.removeAttribute != "function" || typeof Se.setAttribute != "function" || typeof Se.namespaceURI != "string" || typeof Se.insertBefore != "function";
                    }, ii = function(Se) {
                      return (typeof kr > "u" ? "undefined" : yr(kr)) === "object" ? Se instanceof kr : Se && (typeof Se > "u" ? "undefined" : yr(Se)) === "object" && typeof Se.nodeType == "number" && typeof Se.nodeName == "string";
                    }, ai = function(Se, tt, wt) {
                      he[Se] && Ne(he[Se], function(sr) {
                        sr.call(ut, tt, wt, wi);
                      });
                    }, ao = function(Se) {
                      var tt = void 0;
                      if (ai("beforeSanitizeElements", Se, null), $o(Se) || et(Se.nodeName, /[\u0080-\uFFFF]/))
                        return fn(Se), !0;
                      var wt = Ii(Se.nodeName);
                      if (ai("uponSanitizeElement", Se, {
                        tagName: wt,
                        allowedTags: b
                      }), !ii(Se.firstElementChild) && (!ii(Se.content) || !ii(Se.content.firstElementChild)) && yt(/<[/\w]/g, Se.innerHTML) && yt(/<[/\w]/g, Se.textContent) || wt === "select" && yt(/<template/i, Se.innerHTML))
                        return fn(Se), !0;
                      if (!b[wt] || Z[wt]) {
                        if (zo && !jn[wt]) {
                          var sr = wr(Se) || Se.parentNode, Gr = $n(Se) || Se.childNodes;
                          if (Gr && sr)
                            for (var Pr = Gr.length, Mr = Pr - 1; Mr >= 0; --Mr)
                              sr.insertBefore(gn(Gr[Mr], !0), qr(Se));
                        }
                        return fn(Se), !0;
                      }
                      return Se instanceof xr && !Pi(Se) || (wt === "noscript" || wt === "noembed") && yt(/<\/no(script|embed)/i, Se.innerHTML) ? (fn(Se), !0) : ($e && Se.nodeType === 3 && (tt = Se.textContent, tt = Ht(tt, ne, " "), tt = Ht(tt, Ae, " "), Se.textContent !== tt && (Ze(ut.removed, { element: Se.cloneNode() }), Se.textContent = tt)), ai("afterSanitizeElements", Se, null), !1);
                    }, Ia = function(Se, tt, wt) {
                      if (Os && (tt === "id" || tt === "name") && (wt in Vt || wt in bi))
                        return !1;
                      if (!(Oe && !ae[tt] && yt(Fe, tt))) {
                        if (!(ye && yt(it, tt))) {
                          if (!B[tt] || ae[tt])
                            return !1;
                          if (!no[tt]) {
                            if (!yt(R, Ht(wt, H, ""))) {
                              if (!((tt === "src" || tt === "xlink:href" || tt === "href") && Se !== "script" && Rt(wt, "data:") === 0 && yn[Se])) {
                                if (!(je && !yt(Nt, Ht(wt, H, "")))) {
                                  if (wt) return !1;
                                }
                              }
                            }
                          }
                        }
                      }
                      return !0;
                    }, Wo = function(Se) {
                      var tt = void 0, wt = void 0, sr = void 0, Gr = void 0;
                      ai("beforeSanitizeAttributes", Se, null);
                      var Pr = Se.attributes;
                      if (Pr) {
                        var Mr = {
                          attrName: "",
                          attrValue: "",
                          keepAttr: !0,
                          allowedAttributes: B
                        };
                        for (Gr = Pr.length; Gr--; ) {
                          tt = Pr[Gr];
                          var Nn = tt, Zi = Nn.name, oi = Nn.namespaceURI;
                          if (wt = Ut(tt.value), sr = Ii(Zi), Mr.attrName = sr, Mr.attrValue = wt, Mr.keepAttr = !0, Mr.forceKeepAttr = void 0, ai("uponSanitizeAttribute", Se, Mr), wt = Mr.attrValue, !Mr.forceKeepAttr && (va(Zi, Se), !!Mr.keepAttr)) {
                            if (yt(/\/>/i, wt)) {
                              va(Zi, Se);
                              continue;
                            }
                            $e && (wt = Ht(wt, ne, " "), wt = Ht(wt, Ae, " "));
                            var oo = Ii(Se.nodeName);
                            if (Ia(oo, sr, wt))
                              try {
                                oi ? Se.setAttributeNS(oi, Zi, wt) : Se.setAttribute(Zi, wt), ze(ut.removed);
                              } catch {
                              }
                          }
                        }
                        ai("afterSanitizeAttributes", Se, null);
                      }
                    }, Sl = function St(Se) {
                      var tt = void 0, wt = io(Se);
                      for (ai("beforeSanitizeShadowDOM", Se, null); tt = wt.nextNode(); )
                        ai("uponSanitizeShadowNode", tt, null), !ao(tt) && (tt.content instanceof Zt && St(tt.content), Wo(tt));
                      ai("afterSanitizeShadowDOM", Se, null);
                    };
                    return ut.sanitize = function(St, Se) {
                      var tt = void 0, wt = void 0, sr = void 0, Gr = void 0, Pr = void 0;
                      if (pa = !St, pa && (St = "<!-->"), typeof St != "string" && !ii(St)) {
                        if (typeof St.toString != "function")
                          throw It("toString is not a function");
                        if (St = St.toString(), typeof St != "string")
                          throw It("dirty is not a string, aborting");
                      }
                      if (!ut.isSupported) {
                        if (yr(st.toStaticHTML) === "object" || typeof st.toStaticHTML == "function") {
                          if (typeof St == "string")
                            return st.toStaticHTML(St);
                          if (ii(St))
                            return st.toStaticHTML(St.outerHTML);
                        }
                        return St;
                      }
                      if (Ot || Ra(Se), ut.removed = [], typeof St == "string" && (Oa = !1), !Oa) if (St instanceof kr)
                        tt = Ti("<!---->"), wt = tt.ownerDocument.importNode(St, !0), wt.nodeType === 1 && wt.nodeName === "BODY" || wt.nodeName === "HTML" ? tt = wt : tt.appendChild(wt);
                      else {
                        if (!hr && !$e && !at && // eslint-disable-next-line unicorn/prefer-includes
                        St.indexOf("<") === -1)
                          return Q && Yr ? Q.createHTML(St) : St;
                        if (tt = Ti(St), !tt)
                          return hr ? null : X;
                      }
                      tt && er && fn(tt.firstChild);
                      for (var Mr = io(Oa ? St : tt); sr = Mr.nextNode(); )
                        sr.nodeType === 3 && sr === Gr || ao(sr) || (sr.content instanceof Zt && Sl(sr.content), Wo(sr), Gr = sr);
                      if (Gr = null, Oa)
                        return St;
                      if (hr) {
                        if (Ir)
                          for (Pr = G.call(tt.ownerDocument); tt.firstChild; )
                            Pr.appendChild(tt.firstChild);
                        else
                          Pr = tt;
                        return Qi && (Pr = Ee.call(_t, Pr, !0)), Pr;
                      }
                      var Nn = at ? tt.outerHTML : tt.innerHTML;
                      return $e && (Nn = Ht(Nn, ne, " "), Nn = Ht(Nn, Ae, " ")), Q && Yr ? Q.createHTML(Nn) : Nn;
                    }, ut.setConfig = function(St) {
                      Ra(St), Ot = !0;
                    }, ut.clearConfig = function() {
                      wi = null, Ot = !1;
                    }, ut.isValidAttribute = function(St, Se, tt) {
                      wi || Ra({});
                      var wt = Ii(St), sr = Ii(Se);
                      return Ia(wt, sr, tt);
                    }, ut.addHook = function(St, Se) {
                      typeof Se == "function" && (he[St] = he[St] || [], Ze(he[St], Se));
                    }, ut.removeHook = function(St) {
                      he[St] && ze(he[St]);
                    }, ut.removeHooks = function(St) {
                      he[St] && (he[St] = []);
                    }, ut.removeAllHooks = function() {
                      he = {};
                    }, ut;
                  }
                  var _r = Hn();
                  return _r;
                });
              })
            ),
            /***/
            928: (
              /***/
              (function(T, N, O) {
                var A = O(322);
                function q(U, j, te) {
                  var se, me;
                  if (te = te || 0, !A(j))
                    return -1;
                  if (Array.prototype.indexOf)
                    return Array.prototype.indexOf.call(j, U, te);
                  for (me = j.length, se = te; te >= 0 && se < me; se += 1)
                    if (j[se] === U)
                      return se;
                  return -1;
                }
                T.exports = q;
              })
            ),
            /***/
            690: (
              /***/
              (function(T, N, O) {
                var A = O(322), q = O(893), U = O(956);
                function j(te, se, me) {
                  A(te) ? q(te, se, me) : U(te, se, me);
                }
                T.exports = j;
              })
            ),
            /***/
            893: (
              /***/
              (function(T) {
                function N(O, A, q) {
                  var U = 0, j = O.length;
                  for (q = q || null; U < j && A.call(q, O[U], U, O) !== !1; U += 1)
                    ;
                }
                T.exports = N;
              })
            ),
            /***/
            956: (
              /***/
              (function(T) {
                function N(O, A, q) {
                  var U;
                  q = q || null;
                  for (U in O)
                    if (O.hasOwnProperty(U) && A.call(q, O[U], U, O) === !1)
                      break;
                }
                T.exports = N;
              })
            ),
            /***/
            990: (
              /***/
              (function(T, N, O) {
                var A = O(893);
                function q(U) {
                  var j;
                  try {
                    j = Array.prototype.slice.call(U);
                  } catch {
                    j = [], A(U, function(se) {
                      j.push(se);
                    });
                  }
                  return j;
                }
                T.exports = q;
              })
            ),
            /***/
            755: (
              /***/
              (function(T) {
                var N = "_feEventKey";
                function O(A, q) {
                  var U = A[N], j;
                  return U || (U = A[N] = {}), j = U[q], j || (j = U[q] = []), j;
                }
                T.exports = O;
              })
            ),
            /***/
            349: (
              /***/
              (function(T, N, O) {
                var A = O(758), q = O(690), U = O(755);
                function j(me, Ce, pe) {
                  if (A(Ce)) {
                    q(Ce.split(/\s+/g), function(ke) {
                      te(me, ke, pe);
                    });
                    return;
                  }
                  q(Ce, function(ke, Ne) {
                    te(me, Ne, ke);
                  });
                }
                function te(me, Ce, pe) {
                  var ke = U(me, Ce), Ne;
                  pe ? (q(ke, function(ze, Ze) {
                    return pe === ze.handler ? (se(me, Ce, ze.wrappedHandler), Ne = Ze, !1) : !0;
                  }), ke.splice(Ne, 1)) : (q(ke, function(ze) {
                    se(me, Ce, ze.wrappedHandler);
                  }), ke.splice(0, ke.length));
                }
                function se(me, Ce, pe) {
                  "removeEventListener" in me ? me.removeEventListener(Ce, pe) : "detachEvent" in me && me.detachEvent("on" + Ce, pe);
                }
                T.exports = j;
              })
            ),
            /***/
            348: (
              /***/
              (function(T, N, O) {
                var A = O(758), q = O(690), U = O(755);
                function j(me, Ce, pe, ke) {
                  if (A(Ce)) {
                    q(Ce.split(/\s+/g), function(Ne) {
                      te(me, Ne, pe, ke);
                    });
                    return;
                  }
                  q(Ce, function(Ne, ze) {
                    te(me, ze, Ne, pe);
                  });
                }
                function te(me, Ce, pe, ke) {
                  function Ne(ze) {
                    pe.call(ke || me, ze || window.event);
                  }
                  "addEventListener" in me ? me.addEventListener(Ce, Ne) : "attachEvent" in me && me.attachEvent("on" + Ce, Ne), se(me, Ce, pe, Ne);
                }
                function se(me, Ce, pe, ke) {
                  var Ne = U(me, Ce), ze = !1;
                  q(Ne, function(Ze) {
                    return Ze.handler === pe ? (ze = !0, !1) : !0;
                  }), ze || Ne.push({
                    handler: pe,
                    wrappedHandler: ke
                  });
                }
                T.exports = j;
              })
            ),
            /***/
            24: (
              /***/
              (function(T, N, O) {
                var A = O(322), q = O(929);
                function U(j, te) {
                  if (te = A(te) ? te.join(" ") : te, te = te.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), q(j.className.baseVal)) {
                    j.className = te;
                    return;
                  }
                  j.className.baseVal = te;
                }
                T.exports = U;
              })
            ),
            /***/
            204: (
              /***/
              (function(T, N, O) {
                var A = O(690), q = O(928), U = O(902), j = O(24);
                function te(se) {
                  var me = Array.prototype.slice.call(arguments, 1), Ce = se.classList, pe = [], ke;
                  if (Ce) {
                    A(me, function(Ne) {
                      se.classList.add(Ne);
                    });
                    return;
                  }
                  ke = U(se), ke && (me = [].concat(ke.split(/\s+/), me)), A(me, function(Ne) {
                    q(Ne, pe) < 0 && pe.push(Ne);
                  }), j(se, pe);
                }
                T.exports = te;
              })
            ),
            /***/
            522: (
              /***/
              (function(T, N, O) {
                var A = O(758), q = O(690);
                function U(j, te, se) {
                  var me = j.style;
                  if (A(te)) {
                    me[te] = se;
                    return;
                  }
                  q(te, function(Ce, pe) {
                    me[pe] = Ce;
                  });
                }
                T.exports = U;
              })
            ),
            /***/
            902: (
              /***/
              (function(T, N, O) {
                var A = O(929);
                function q(U) {
                  return !U || !U.className ? "" : A(U.className.baseVal) ? U.className : U.className.baseVal;
                }
                T.exports = q;
              })
            ),
            /***/
            714: (
              /***/
              (function(T, N, O) {
                var A = O(928), q = O(902);
                function U(j, te) {
                  var se;
                  return j.classList ? j.classList.contains(te) : (se = q(j).split(/\s+/), A(te, se) > -1);
                }
                T.exports = U;
              })
            ),
            /***/
            471: (
              /***/
              (function(T, N, O) {
                var A = O(928), q = O(990), U = Element.prototype, j = U.matches || U.webkitMatchesSelector || U.mozMatchesSelector || U.msMatchesSelector || function(se) {
                  var me = this.document || this.ownerDocument;
                  return A(this, q(me.querySelectorAll(se))) > -1;
                };
                function te(se, me) {
                  return j.call(se, me);
                }
                T.exports = te;
              })
            ),
            /***/
            462: (
              /***/
              (function(T, N, O) {
                var A = O(893), q = O(928), U = O(902), j = O(24);
                function te(se) {
                  var me = Array.prototype.slice.call(arguments, 1), Ce = se.classList, pe, ke;
                  if (Ce) {
                    A(me, function(Ne) {
                      Ce.remove(Ne);
                    });
                    return;
                  }
                  pe = U(se).split(/\s+/), ke = [], A(pe, function(Ne) {
                    q(Ne, me) < 0 && ke.push(Ne);
                  }), j(se, ke);
                }
                T.exports = te;
              })
            ),
            /***/
            969: (
              /***/
              (function(T) {
                function N(O, A) {
                  var q = Object.prototype.hasOwnProperty, U, j, te, se;
                  for (te = 1, se = arguments.length; te < se; te += 1) {
                    U = arguments[te];
                    for (j in U)
                      q.call(U, j) && (O[j] = U[j]);
                  }
                  return O;
                }
                T.exports = N;
              })
            ),
            /***/
            254: (
              /***/
              (function(T, N, O) {
                var A = O(956);
                function q(U, j) {
                  var te = document.createElement("img"), se = "";
                  return A(j, function(me, Ce) {
                    se += "&" + Ce + "=" + me;
                  }), se = se.substring(1), te.src = U + "?" + se, te.style.display = "none", document.body.appendChild(te), document.body.removeChild(te), te;
                }
                T.exports = q;
              })
            ),
            /***/
            391: (
              /***/
              (function(T, N, O) {
                var A = O(929), q = O(254), U = 10080 * 60 * 1e3;
                function j(se) {
                  var me = (/* @__PURE__ */ new Date()).getTime();
                  return me - se > U;
                }
                function te(se, me) {
                  var Ce = "https://www.google-analytics.com/collect", pe = location.hostname, ke = "event", Ne = "use", ze = "TOAST UI " + se + " for " + pe + ": Statistics", Ze = window.localStorage.getItem(ze);
                  !A(window.tui) && window.tui.usageStatistics === !1 || Ze && !j(Ze) || (window.localStorage.setItem(ze, (/* @__PURE__ */ new Date()).getTime()), setTimeout(function() {
                    (document.readyState === "interactive" || document.readyState === "complete") && q(Ce, {
                      v: 1,
                      t: ke,
                      tid: me,
                      cid: pe,
                      dp: pe,
                      dh: se,
                      el: se,
                      ec: Ne
                    });
                  }, 1e3));
                }
                T.exports = te;
              })
            ),
            /***/
            322: (
              /***/
              (function(T) {
                function N(O) {
                  return O instanceof Array;
                }
                T.exports = N;
              })
            ),
            /***/
            65: (
              /***/
              (function(T, N, O) {
                var A = O(929), q = O(934);
                function U(j) {
                  return !A(j) && !q(j);
                }
                T.exports = U;
              })
            ),
            /***/
            404: (
              /***/
              (function(T, N, O) {
                var A = O(790);
                function q(U) {
                  return !A(U);
                }
                T.exports = q;
              })
            ),
            /***/
            294: (
              /***/
              (function(T) {
                function N(O) {
                  return O instanceof Function;
                }
                T.exports = N;
              })
            ),
            /***/
            934: (
              /***/
              (function(T) {
                function N(O) {
                  return O === null;
                }
                T.exports = N;
              })
            ),
            /***/
            758: (
              /***/
              (function(T) {
                function N(O) {
                  return typeof O == "string" || O instanceof String;
                }
                T.exports = N;
              })
            ),
            /***/
            790: (
              /***/
              (function(T, N, O) {
                var A = O(65);
                function q(U) {
                  return A(U) && U !== !1;
                }
                T.exports = q;
              })
            ),
            /***/
            929: (
              /***/
              (function(T) {
                function N(O) {
                  return O === void 0;
                }
                T.exports = N;
              })
            ),
            /***/
            479: (
              /***/
              (function(T) {
                T.exports = t;
              })
            ),
            /***/
            481: (
              /***/
              (function(T) {
                T.exports = n;
              })
            ),
            /***/
            43: (
              /***/
              (function(T) {
                T.exports = i;
              })
            ),
            /***/
            814: (
              /***/
              (function(T) {
                T.exports = a;
              })
            ),
            /***/
            311: (
              /***/
              (function(T) {
                T.exports = s;
              })
            )
            /******/
          }, f = {};
          function p(T) {
            var N = f[T];
            if (N !== void 0)
              return N.exports;
            var O = f[T] = {
              /******/
              // no module.id needed
              /******/
              // no module.loaded needed
              /******/
              exports: {}
              /******/
            };
            return u[T].call(O.exports, O, O.exports, p), O.exports;
          }
          (function() {
            p.n = function(T) {
              var N = T && T.__esModule ? (
                /******/
                function() {
                  return T.default;
                }
              ) : (
                /******/
                function() {
                  return T;
                }
              );
              return p.d(N, { a: N }), N;
            };
          })(), (function() {
            p.d = function(T, N) {
              for (var O in N)
                p.o(N, O) && !p.o(T, O) && Object.defineProperty(T, O, { enumerable: !0, get: N[O] });
            };
          })(), (function() {
            p.g = (function() {
              if (typeof globalThis == "object") return globalThis;
              try {
                return this || new Function("return this")();
              } catch {
                if (typeof window == "object") return window;
              }
            })();
          })(), (function() {
            p.o = function(T, N) {
              return Object.prototype.hasOwnProperty.call(T, N);
            };
          })();
          var y = {};
          return (function() {
            p.d(y, {
              default: function() {
                return (
                  /* binding */
                  vZ
                );
              }
            });
            var T = function() {
              return T = Object.assign || function(v) {
                for (var C, D = 1, _ = arguments.length; D < _; D++) {
                  C = arguments[D];
                  for (var J in C) Object.prototype.hasOwnProperty.call(C, J) && (v[J] = C[J]);
                }
                return v;
              }, T.apply(this, arguments);
            };
            function N(m, v, C) {
              if (arguments.length === 2) for (var D = 0, _ = v.length, J; D < _; D++)
                (J || !(D in v)) && (J || (J = Array.prototype.slice.call(v, 0, D)), J[D] = v[D]);
              return m.concat(J || Array.prototype.slice.call(v));
            }
            var O = function(m, v) {
              return O = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(C, D) {
                C.__proto__ = D;
              } || function(C, D) {
                for (var _ in D)
                  Object.prototype.hasOwnProperty.call(D, _) && (C[_] = D[_]);
              }, O(m, v);
            };
            function A(m, v) {
              if (typeof v != "function" && v !== null)
                throw new TypeError("Class extends value " + String(v) + " is not a constructor or null");
              O(m, v);
              function C() {
                this.constructor = m;
              }
              m.prototype = v === null ? Object.create(v) : (C.prototype = v.prototype, new C());
            }
            var q = function() {
              return q = Object.assign || function(v) {
                for (var C, D = 1, _ = arguments.length; D < _; D++) {
                  C = arguments[D];
                  for (var J in C)
                    Object.prototype.hasOwnProperty.call(C, J) && (v[J] = C[J]);
                }
                return v;
              }, q.apply(this, arguments);
            };
            function U(m, v, C) {
              if (arguments.length === 2)
                for (var D = 0, _ = v.length, J; D < _; D++)
                  (J || !(D in v)) && (J || (J = Array.prototype.slice.call(v, 0, D)), J[D] = v[D]);
              return m.concat(J || Array.prototype.slice.call(v));
            }
            var j = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof p.g < "u" ? p.g : typeof self < "u" ? self : {}, te = {};
            function se(m) {
              var v, C, D = te[m];
              if (D)
                return D;
              for (D = te[m] = [], v = 0; v < 128; v++)
                C = String.fromCharCode(v), /^[0-9a-z]$/i.test(C) ? D.push(C) : D.push("%" + ("0" + v.toString(16).toUpperCase()).slice(-2));
              for (v = 0; v < m.length; v++)
                D[m.charCodeAt(v)] = m[v];
              return D;
            }
            function me(m, v, C) {
              var D, _, J, ee, ce, qe = "";
              for (typeof v != "string" && (C = v, v = me.defaultChars), typeof C > "u" && (C = !0), ce = se(v), D = 0, _ = m.length; D < _; D++) {
                if (J = m.charCodeAt(D), C && J === 37 && D + 2 < _ && /^[0-9a-f]{2}$/i.test(m.slice(D + 1, D + 3))) {
                  qe += m.slice(D, D + 3), D += 2;
                  continue;
                }
                if (J < 128) {
                  qe += ce[J];
                  continue;
                }
                if (J >= 55296 && J <= 57343) {
                  if (J >= 55296 && J <= 56319 && D + 1 < _ && (ee = m.charCodeAt(D + 1), ee >= 56320 && ee <= 57343)) {
                    qe += encodeURIComponent(m[D] + m[D + 1]), D++;
                    continue;
                  }
                  qe += "%EF%BF%BD";
                  continue;
                }
                qe += encodeURIComponent(m[D]);
              }
              return qe;
            }
            me.defaultChars = ";/?:@&=+$,-_.!~*'()#", me.componentChars = "-_.!~*'()";
            var Ce = me, pe = {}, ke = {}, Ne = "Á", ze = "á", Ze = "Ă", At = "ă", et = "∾", Ht = "∿", Rt = "∾̳", Ut = "Â", yt = "â", It = "´", Ke = "А", ct = "а", He = "Æ", fe = "æ", Le = "⁡", dt = "𝔄", vt = "𝔞", Ft = "À", Lt = "à", $t = "ℵ", Te = "ℵ", be = "Α", ue = "α", ge = "Ā", oe = "ā", Pe = "⨿", Ve = "&", lt = "&", Tt = "⩕", Yt = "⩓", jt = "∧", mr = "⩜", tr = "⩘", yr = "⩚", ar = "∠", Wr = "⦤", ki = "∠", Hn = "⦨", _r = "⦩", st = "⦪", ut = "⦫", _t = "⦬", Vt = "⦭", Zt = "⦮", tn = "⦯", kr = "∡", xr = "∟", En = "⊾", Vn = "⦝", Rr = "∢", cn = "Å", ri = "⍼", Un = "Ą", rn = "ą", Xr = "𝔸", gn = "𝕒", qr = "⩯", $n = "≈", wr = "⩰", jr = "≊", Q = "≋", X = "'", z = "⁡", F = "≈", V = "≊", G = "Å", re = "å", Ee = "𝒜", Be = "𝒶", he = "≔", ne = "*", Ae = "≈", Fe = "≍", it = "Ã", Nt = "ã", H = "Ä", R = "ä", b = "∳", E = "⨑", B = "≌", K = "϶", Z = "‵", ae = "∽", ye = "⋍", Oe = "∖", je = "⫧", $e = "⊽", at = "⌅", Ot = "⌆", er = "⌅", hr = "⎵", Ir = "⎶", Qi = "≌", Yr = "Б", Os = "б", zo = "„", Oa = "∵", Wn = "∵", jn = "∵", Xi = "⦰", yn = "϶", Ho = "ℬ", no = "ℬ", ha = "Β", Da = "β", Aa = "ℶ", Mn = "≬", La = "𝔅", pa = "𝔟", Qt = "⋂", Vo = "◯", Uo = "⋃", Ii = "⨀", wi = "⨁", bi = "⨂", Ra = "⨆", Yi = "★", Ci = "▽", Zr = "△", ni = "⨄", Pi = "⋁", fn = "⋀", va = "⤍", Ti = "⧫", io = "▪", $o = "▴", ii = "▾", ai = "◂", ao = "▸", Ia = "␣", Wo = "▒", Sl = "░", St = "▓", Se = "█", tt = "=⃥", wt = "≡⃥", sr = "⫭", Gr = "⌐", Pr = "𝔹", Mr = "𝕓", Nn = "⊥", Zi = "⊥", oi = "⋈", oo = "⧉", Pa = "┐", Ru = "╕", Ds = "╖", As = "╗", Iu = "┌", br = "╒", zr = "╓", xl = "╔", jo = "─", bf = "═", Bi = "┬", El = "╤", Ba = "╥", so = "╦", Pu = "┴", Cf = "╧", Ls = "╨", Tf = "╩", Go = "⊟", lo = "⊞", Sf = "⊠", xf = "┘", Ef = "╛", Mf = "╜", Bu = "╝", Nf = "└", Ml = "╘", Fu = "╙", Of = "╚", Rs = "│", Df = "║", Af = "┼", _u = "╪", Nl = "╫", Lf = "╬", Rf = "┤", Ko = "╡", If = "╢", Jo = "╣", Pf = "├", Bf = "╞", Fa = "╟", uo = "╠", qu = "‵", zu = "˘", Ol = "˘", Hu = "¦", Dl = "𝒷", co = "ℬ", _a = "⁏", Qo = "∽", Ff = "⋍", qa = "⧅", za = "\\", ma = "⟈", kn = "•", Hr = "•", Vu = "≎", Is = "⪮", Uu = "≏", $u = "≎", Ps = "≏", Bs = "Ć", Xo = "ć", ga = "⩄", Fs = "⩉", Wu = "⩋", Al = "∩", _f = "⋒", qf = "⩇", zf = "⩀", Si = "ⅅ", fo = "∩︀", Ll = "⁁", ju = "ˇ", Rl = "ℭ", Gu = "⩍", Il = "Č", Hf = "č", Vf = "Ç", ho = "ç", Pl = "Ĉ", po = "ĉ", Bl = "∰", Ku = "⩌", vo = "⩐", mo = "Ċ", _s = "ċ", Ju = "¸", qs = "¸", Fl = "⦲", _l = "¢", ql = "·", zl = "·", Qu = "𝔠", Hl = "ℭ", ya = "Ч", zs = "ч", d = "✓", w = "✓", h = "Χ", k = "χ", S = "ˆ", M = "≗", P = "↺", I = "↻", W = "⊛", Y = "⊚", le = "⊝", xe = "⊙", ve = "®", Re = "Ⓢ", Ue = "⊖", nt = "⊕", gt = "⊗", Xe = "○", rr = "⧃", Jt = "≗", Dt = "⨐", Gt = "⫯", lr = "⧂", or = "∲", Nr = "”", Ar = "’", Vr = "♣", xi = "♣", Hs = ":", ea = "∷", ta = "⩴", On = "≔", go = "≔", Cr = ",", si = "@", Dn = "∁", Or = "∘", Vs = "∁", Xu = "ℂ", Gm = "≅", Yo = "⩭", Vl = "≡", Us = "∮", Yu = "∯", Uf = "∮", $s = "𝕔", yo = "ℂ", Dr = "∐", Er = "∐", ko = "©", An = "©", li = "℗", Zo = "∳", Ws = "↵", ui = "✗", Zu = "⨯", Oh = "𝒞", Dh = "𝒸", ec = "⫏", Ah = "⫑", Ha = "⫐", tc = "⫒", $f = "⋯", Lh = "⤸", Km = "⤵", wo = "⋞", js = "⋟", Gs = "↶", rc = "⤽", nc = "⩈", Fi = "⩆", _i = "≍", es = "∪", Va = "⋓", Ua = "⩊", ts = "⊍", Rh = "⩅", Wf = "∪︀", jf = "↷", Ei = "⤼", Mi = "⋞", Lr = "⋟", ra = "⋎", Ih = "⋏", Ph = "¤", Gf = "↶", Kf = "↷", Bh = "⋎", ic = "⋏", Fh = "∲", Ks = "∱", Jf = "⌭", Jm = "†", Ul = "‡", ac = "ℸ", _h = "↓", qh = "↡", Js = "⇓", zh = "‐", oc = "⫤", sc = "⊣", Qs = "⤏", Qf = "˝", Xf = "Ď", Yf = "ď", Zf = "Д", Xs = "д", qi = "‡", rs = "⇊", ed = "ⅅ", Hh = "ⅆ", $a = "⤑", bo = "⩷", td = "°", Vh = "∇", Wa = "Δ", Co = "δ", lc = "⦱", Uh = "⥿", uc = "𝔇", $h = "𝔡", $l = "⥥", ka = "⇃", Wl = "⇂", jl = "´", ns = "˙", rd = "˝", Ys = "`", Wh = "˜", nd = "⋄", Br = "⋄", cc = "⋄", id = "♦", ad = "♦", fc = "¨", od = "ⅆ", is = "ϝ", Fr = "⋲", nn = "÷", dn = "÷", dc = "⋇", Gl = "⋇", Kl = "Ђ", Qm = "ђ", Ln = "⌞", sd = "⌍", ld = "$", ud = "𝔻", wa = "𝕕", zi = "¨", Jl = "˙", cd = "⃜", fd = "≐", jh = "≑", Gh = "≐", Kh = "∸", Jh = "∔", Qh = "⊡", Xh = "⌆", Yh = "∯", Zh = "¨", Ql = "⇓", ep = "⇐", hc = "⇔", pc = "⫤", tp = "⟸", dd = "⟺", rp = "⟹", np = "⇒", ip = "⊨", ap = "⇑", hd = "⇕", op = "∥", sp = "⤓", lp = "↓", Xm = "↓", up = "⇓", Ym = "⇵", Zm = "̑", cp = "⇊", fp = "⇃", dp = "⇂", vc = "⥐", eg = "⥞", tg = "⥖", rg = "↽", na = "⥟", pd = "⥗", mc = "⇁", hp = "↧", pp = "⊤", vp = "⤐", vd = "⌟", Zs = "⌌", md = "𝒟", gd = "𝒹", ng = "Ѕ", mp = "ѕ", gp = "⧶", yp = "Đ", kp = "đ", wp = "⋱", ig = "▿", ci = "▾", Gn = "⇵", bp = "⥯", Cp = "⦦", Tp = "Џ", Sp = "џ", xp = "⟿", yd = "É", Ep = "é", kd = "⩮", Mp = "Ě", Np = "ě", wd = "Ê", bd = "ê", Op = "≖", Cd = "≕", gc = "Э", ag = "э", Dp = "⩷", Td = "Ė", Ap = "ė", yc = "≑", ja = "ⅇ", og = "≒", Lp = "𝔈", Sd = "𝔢", Rp = "⪚", Ip = "È", Xl = "è", Rn = "⪖", sg = "⪘", lg = "⪙", kc = "∈", In = "⏧", ug = "ℓ", kt = "⪕", el = "⪗", xd = "Ē", Pp = "ē", cg = "∅", Yl = "∅", wc = "◻", Ed = "∅", Bp = "▫", Fp = " ", _p = " ", Md = " ", Nd = "Ŋ", wn = "ŋ", ia = " ", To = "Ę", qp = "ę", zp = "𝔼", aa = "𝕖", Hp = "⋕", ba = "⧣", fg = "⩱", Vp = "ε", Up = "Ε", $p = "ε", Wp = "ϵ", dg = "≖", bc = "≕", Od = "≂", Hi = "⪖", ur = "⪕", hn = "⩵", en = "=", bn = "≂", Ni = "≟", tl = "⇌", an = "≡", Zl = "⩸", as = "⧥", Cc = "⥱", Dd = "≓", eu = "ℯ", fi = "ℰ", Ad = "≐", rl = "⩳", Ga = "≂", Tc = "Η", Ld = "η", So = "Ð", Sc = "ð", xo = "Ë", xc = "ë", tu = "€", Rd = "!", Ec = "∃", Mc = "∃", Kn = "ℰ", Eo = "ⅇ", oa = "ⅇ", di = "≒", jp = "Ф", Id = "ф", Pd = "♀", hg = "ﬃ", Mo = "ﬀ", Gp = "ﬄ", Bd = "𝔉", ss = "𝔣", Fd = "ﬁ", ls = "◼", Kp = "▪", Jp = "fj", _d = "♭", Nc = "ﬂ", pg = "▱", vg = "ƒ", Qp = "𝔽", Xp = "𝕗", us = "∀", mg = "∀", nl = "⋔", Yp = "⫙", Ur = "ℱ", gg = "⨍", Zp = "½", yg = "⅓", kg = "¼", ev = "⅕", tv = "⅙", wg = "⅛", Vi = "⅔", qd = "⅖", bg = "¾", No = "⅗", Oc = "⅜", cs = "⅘", Dc = "⅚", zd = "⅝", Hd = "⅞", Cg = "⁄", Vd = "⌢", Tg = "𝒻", rv = "ℱ", nv = "ǵ", Ac = "Γ", Lc = "γ", iv = "Ϝ", Ud = "ϝ", Sg = "⪆", av = "Ğ", $d = "ğ", Rc = "Ģ", Wd = "Ĝ", Ic = "ĝ", ov = "Г", xg = "г", Pc = "Ġ", Eg = "ġ", ru = "≥", Mg = "≧", Bc = "⪌", o = "⋛", l = "≥", c = "≧", g = "⩾", x = "⪩", L = "⩾", $ = "⪀", ie = "⪂", de = "⪄", Ie = "⋛︀", Je = "⪔", Ye = "𝔊", Ge = "𝔤", pt = "≫", Ct = "⋙", xt = "⋙", Kr = "ℷ", Me = "Ѓ", we = "ѓ", De = "⪥", rt = "≷", Et = "⪒", qt = "⪤", zt = "⪊", Wt = "⪊", pn = "⪈", fr = "≩", Oo = "⪈", Ng = "≩", hM = "⋧", pM = "𝔾", vM = "𝕘", mM = "`", gM = "≥", yM = "⋛", kM = "≧", wM = "⪢", bM = "≷", CM = "⩾", TM = "≳", SM = "𝒢", xM = "ℊ", EM = "≳", MM = "⪎", NM = "⪐", OM = "⪧", DM = "⩺", AM = ">", LM = ">", RM = "≫", IM = "⋗", PM = "⦕", BM = "⩼", FM = "⪆", _M = "⥸", qM = "⋗", zM = "⋛", HM = "⪌", VM = "≷", UM = "≳", $M = "≩︀", WM = "≩︀", jM = "ˇ", GM = " ", KM = "½", JM = "ℋ", QM = "Ъ", XM = "ъ", YM = "⥈", ZM = "↔", eN = "⇔", tN = "↭", rN = "^", nN = "ℏ", iN = "Ĥ", aN = "ĥ", oN = "♥", sN = "♥", lN = "…", uN = "⊹", cN = "𝔥", fN = "ℌ", dN = "ℋ", hN = "⤥", pN = "⤦", vN = "⇿", mN = "∻", gN = "↩", yN = "↪", kN = "𝕙", wN = "ℍ", bN = "―", CN = "─", TN = "𝒽", SN = "ℋ", xN = "ℏ", EN = "Ħ", MN = "ħ", NN = "≎", ON = "≏", DN = "⁃", AN = "‐", LN = "Í", RN = "í", IN = "⁣", PN = "Î", BN = "î", FN = "И", _N = "и", qN = "İ", zN = "Е", HN = "е", VN = "¡", UN = "⇔", $N = "𝔦", WN = "ℑ", jN = "Ì", GN = "ì", KN = "ⅈ", JN = "⨌", QN = "∭", XN = "⧜", YN = "℩", ZN = "Ĳ", eO = "ĳ", tO = "Ī", rO = "ī", nO = "ℑ", iO = "ⅈ", aO = "ℐ", oO = "ℑ", sO = "ı", lO = "ℑ", uO = "⊷", cO = "Ƶ", fO = "⇒", dO = "℅", hO = "∞", pO = "⧝", vO = "ı", mO = "⊺", gO = "∫", yO = "∬", kO = "ℤ", wO = "∫", bO = "⊺", CO = "⋂", TO = "⨗", SO = "⨼", xO = "⁣", EO = "⁢", MO = "Ё", NO = "ё", OO = "Į", DO = "į", AO = "𝕀", LO = "𝕚", RO = "Ι", IO = "ι", PO = "⨼", BO = "¿", FO = "𝒾", _O = "ℐ", qO = "∈", zO = "⋵", HO = "⋹", VO = "⋴", UO = "⋳", $O = "∈", WO = "⁢", jO = "Ĩ", GO = "ĩ", KO = "І", JO = "і", QO = "Ï", XO = "ï", YO = "Ĵ", ZO = "ĵ", eD = "Й", tD = "й", rD = "𝔍", nD = "𝔧", iD = "ȷ", aD = "𝕁", oD = "𝕛", sD = "𝒥", lD = "𝒿", uD = "Ј", cD = "ј", fD = "Є", dD = "є", hD = "Κ", pD = "κ", vD = "ϰ", mD = "Ķ", gD = "ķ", yD = "К", kD = "к", wD = "𝔎", bD = "𝔨", CD = "ĸ", TD = "Х", SD = "х", xD = "Ќ", ED = "ќ", MD = "𝕂", ND = "𝕜", OD = "𝒦", DD = "𝓀", AD = "⇚", LD = "Ĺ", RD = "ĺ", ID = "⦴", PD = "ℒ", BD = "Λ", FD = "λ", _D = "⟨", qD = "⟪", zD = "⦑", HD = "⟨", VD = "⪅", UD = "ℒ", $D = "«", WD = "⇤", jD = "⤟", GD = "←", KD = "↞", JD = "⇐", QD = "⤝", XD = "↩", YD = "↫", ZD = "⤹", eA = "⥳", tA = "↢", rA = "⤙", nA = "⤛", iA = "⪫", aA = "⪭", oA = "⪭︀", sA = "⤌", lA = "⤎", uA = "❲", cA = "{", fA = "[", dA = "⦋", hA = "⦏", pA = "⦍", vA = "Ľ", mA = "ľ", gA = "Ļ", yA = "ļ", kA = "⌈", wA = "{", bA = "Л", CA = "л", TA = "⤶", SA = "“", xA = "„", EA = "⥧", MA = "⥋", NA = "↲", OA = "≤", DA = "≦", AA = "⟨", LA = "⇤", RA = "←", IA = "←", PA = "⇐", BA = "⇆", FA = "↢", _A = "⌈", qA = "⟦", zA = "⥡", HA = "⥙", VA = "⇃", UA = "⌊", $A = "↽", WA = "↼", jA = "⇇", GA = "↔", KA = "↔", JA = "⇔", QA = "⇆", XA = "⇋", YA = "↭", ZA = "⥎", eL = "↤", tL = "⊣", rL = "⥚", nL = "⋋", iL = "⧏", aL = "⊲", oL = "⊴", sL = "⥑", lL = "⥠", uL = "⥘", cL = "↿", fL = "⥒", dL = "↼", hL = "⪋", pL = "⋚", vL = "≤", mL = "≦", gL = "⩽", yL = "⪨", kL = "⩽", wL = "⩿", bL = "⪁", CL = "⪃", TL = "⋚︀", SL = "⪓", xL = "⪅", EL = "⋖", ML = "⋚", NL = "⪋", OL = "⋚", DL = "≦", AL = "≶", LL = "≶", RL = "⪡", IL = "≲", PL = "⩽", BL = "≲", FL = "⥼", _L = "⌊", qL = "𝔏", zL = "𝔩", HL = "≶", VL = "⪑", UL = "⥢", $L = "↽", WL = "↼", jL = "⥪", GL = "▄", KL = "Љ", JL = "љ", QL = "⇇", XL = "≪", YL = "⋘", ZL = "⌞", eR = "⇚", tR = "⥫", rR = "◺", nR = "Ŀ", iR = "ŀ", aR = "⎰", oR = "⎰", sR = "⪉", lR = "⪉", uR = "⪇", cR = "≨", fR = "⪇", dR = "≨", hR = "⋦", pR = "⟬", vR = "⇽", mR = "⟦", gR = "⟵", yR = "⟵", kR = "⟸", wR = "⟷", bR = "⟷", CR = "⟺", TR = "⟼", SR = "⟶", xR = "⟶", ER = "⟹", MR = "↫", NR = "↬", OR = "⦅", DR = "𝕃", AR = "𝕝", LR = "⨭", RR = "⨴", IR = "∗", PR = "_", BR = "↙", FR = "↘", _R = "◊", qR = "◊", zR = "⧫", HR = "(", VR = "⦓", UR = "⇆", $R = "⌟", WR = "⇋", jR = "⥭", GR = "‎", KR = "⊿", JR = "‹", QR = "𝓁", XR = "ℒ", YR = "↰", ZR = "↰", eI = "≲", tI = "⪍", rI = "⪏", nI = "[", iI = "‘", aI = "‚", oI = "Ł", sI = "ł", lI = "⪦", uI = "⩹", cI = "<", fI = "<", dI = "≪", hI = "⋖", pI = "⋋", vI = "⋉", mI = "⥶", gI = "⩻", yI = "◃", kI = "⊴", wI = "◂", bI = "⦖", CI = "⥊", TI = "⥦", SI = "≨︀", xI = "≨︀", EI = "¯", MI = "♂", NI = "✠", OI = "✠", DI = "↦", AI = "↦", LI = "↧", RI = "↤", II = "↥", PI = "▮", BI = "⨩", FI = "М", _I = "м", qI = "—", zI = "∺", HI = "∡", VI = " ", UI = "ℳ", $I = "𝔐", WI = "𝔪", jI = "℧", GI = "µ", KI = "*", JI = "⫰", QI = "∣", XI = "·", YI = "⊟", ZI = "−", eP = "∸", tP = "⨪", rP = "∓", nP = "⫛", iP = "…", aP = "∓", oP = "⊧", sP = "𝕄", lP = "𝕞", uP = "∓", cP = "𝓂", fP = "ℳ", dP = "∾", hP = "Μ", pP = "μ", vP = "⊸", mP = "⊸", gP = "∇", yP = "Ń", kP = "ń", wP = "∠⃒", bP = "≉", CP = "⩰̸", TP = "≋̸", SP = "ŉ", xP = "≉", EP = "♮", MP = "ℕ", NP = "♮", OP = " ", DP = "≎̸", AP = "≏̸", LP = "⩃", RP = "Ň", IP = "ň", PP = "Ņ", BP = "ņ", FP = "≇", _P = "⩭̸", qP = "⩂", zP = "Н", HP = "н", VP = "–", UP = "⤤", $P = "↗", WP = "⇗", jP = "↗", GP = "≠", KP = "≐̸", JP = "​", QP = "​", XP = "​", YP = "​", ZP = "≢", eB = "⤨", tB = "≂̸", rB = "≫", nB = "≪", iB = `
`, aB = "∄", oB = "∄", sB = "𝔑", lB = "𝔫", uB = "≧̸", cB = "≱", fB = "≱", dB = "≧̸", hB = "⩾̸", pB = "⩾̸", vB = "⋙̸", mB = "≵", gB = "≫⃒", yB = "≯", kB = "≯", wB = "≫̸", bB = "↮", CB = "⇎", TB = "⫲", SB = "∋", xB = "⋼", EB = "⋺", MB = "∋", NB = "Њ", OB = "њ", DB = "↚", AB = "⇍", LB = "‥", RB = "≦̸", IB = "≰", PB = "↚", BB = "⇍", FB = "↮", _B = "⇎", qB = "≰", zB = "≦̸", HB = "⩽̸", VB = "⩽̸", UB = "≮", $B = "⋘̸", WB = "≴", jB = "≪⃒", GB = "≮", KB = "⋪", JB = "⋬", QB = "≪̸", XB = "∤", YB = "⁠", ZB = " ", eF = "𝕟", tF = "ℕ", rF = "⫬", nF = "¬", iF = "≢", aF = "≭", oF = "∦", sF = "∉", lF = "≠", uF = "≂̸", cF = "∄", fF = "≯", dF = "≱", hF = "≧̸", pF = "≫̸", vF = "≹", mF = "⩾̸", gF = "≵", yF = "≎̸", kF = "≏̸", wF = "∉", bF = "⋵̸", CF = "⋹̸", TF = "∉", SF = "⋷", xF = "⋶", EF = "⧏̸", MF = "⋪", NF = "⋬", OF = "≮", DF = "≰", AF = "≸", LF = "≪̸", RF = "⩽̸", IF = "≴", PF = "⪢̸", BF = "⪡̸", FF = "∌", _F = "∌", qF = "⋾", zF = "⋽", HF = "⊀", VF = "⪯̸", UF = "⋠", $F = "∌", WF = "⧐̸", jF = "⋫", GF = "⋭", KF = "⊏̸", JF = "⋢", QF = "⊐̸", XF = "⋣", YF = "⊂⃒", ZF = "⊈", e_ = "⊁", t_ = "⪰̸", r_ = "⋡", n_ = "≿̸", i_ = "⊃⃒", a_ = "⊉", o_ = "≁", s_ = "≄", l_ = "≇", u_ = "≉", c_ = "∤", f_ = "∦", d_ = "∦", h_ = "⫽⃥", p_ = "∂̸", v_ = "⨔", m_ = "⊀", g_ = "⋠", y_ = "⊀", k_ = "⪯̸", w_ = "⪯̸", b_ = "⤳̸", C_ = "↛", T_ = "⇏", S_ = "↝̸", x_ = "↛", E_ = "⇏", M_ = "⋫", N_ = "⋭", O_ = "⊁", D_ = "⋡", A_ = "⪰̸", L_ = "𝒩", R_ = "𝓃", I_ = "∤", P_ = "∦", B_ = "≁", F_ = "≄", __ = "≄", q_ = "∤", z_ = "∦", H_ = "⋢", V_ = "⋣", U_ = "⊄", $_ = "⫅̸", W_ = "⊈", j_ = "⊂⃒", G_ = "⊈", K_ = "⫅̸", J_ = "⊁", Q_ = "⪰̸", X_ = "⊅", Y_ = "⫆̸", Z_ = "⊉", e2 = "⊃⃒", t2 = "⊉", r2 = "⫆̸", n2 = "≹", i2 = "Ñ", a2 = "ñ", o2 = "≸", s2 = "⋪", l2 = "⋬", u2 = "⋫", c2 = "⋭", f2 = "Ν", d2 = "ν", h2 = "#", p2 = "№", v2 = " ", m2 = "≍⃒", g2 = "⊬", y2 = "⊭", k2 = "⊮", w2 = "⊯", b2 = "≥⃒", C2 = ">⃒", T2 = "⤄", S2 = "⧞", x2 = "⤂", E2 = "≤⃒", M2 = "<⃒", N2 = "⊴⃒", O2 = "⤃", D2 = "⊵⃒", A2 = "∼⃒", L2 = "⤣", R2 = "↖", I2 = "⇖", P2 = "↖", B2 = "⤧", F2 = "Ó", _2 = "ó", q2 = "⊛", z2 = "Ô", H2 = "ô", V2 = "⊚", U2 = "О", $2 = "о", W2 = "⊝", j2 = "Ő", G2 = "ő", K2 = "⨸", J2 = "⊙", Q2 = "⦼", X2 = "Œ", Y2 = "œ", Z2 = "⦿", eq = "𝔒", tq = "𝔬", rq = "˛", nq = "Ò", iq = "ò", aq = "⧁", oq = "⦵", sq = "Ω", lq = "∮", uq = "↺", cq = "⦾", fq = "⦻", dq = "‾", hq = "⧀", pq = "Ō", vq = "ō", mq = "Ω", gq = "ω", yq = "Ο", kq = "ο", wq = "⦶", bq = "⊖", Cq = "𝕆", Tq = "𝕠", Sq = "⦷", xq = "“", Eq = "‘", Mq = "⦹", Nq = "⊕", Oq = "↻", Dq = "⩔", Aq = "∨", Lq = "⩝", Rq = "ℴ", Iq = "ℴ", Pq = "ª", Bq = "º", Fq = "⊶", _q = "⩖", qq = "⩗", zq = "⩛", Hq = "Ⓢ", Vq = "𝒪", Uq = "ℴ", $q = "Ø", Wq = "ø", jq = "⊘", Gq = "Õ", Kq = "õ", Jq = "⨶", Qq = "⨷", Xq = "⊗", Yq = "Ö", Zq = "ö", ez = "⌽", tz = "‾", rz = "⏞", nz = "⎴", iz = "⏜", az = "¶", oz = "∥", sz = "∥", lz = "⫳", uz = "⫽", cz = "∂", fz = "∂", dz = "П", hz = "п", pz = "%", vz = ".", mz = "‰", gz = "⊥", yz = "‱", kz = "𝔓", wz = "𝔭", bz = "Φ", Cz = "φ", Tz = "ϕ", Sz = "ℳ", xz = "☎", Ez = "Π", Mz = "π", Nz = "⋔", Oz = "ϖ", Dz = "ℏ", Az = "ℎ", Lz = "ℏ", Rz = "⨣", Iz = "⊞", Pz = "⨢", Bz = "+", Fz = "∔", _z = "⨥", qz = "⩲", zz = "±", Hz = "±", Vz = "⨦", Uz = "⨧", $z = "±", Wz = "ℌ", jz = "⨕", Gz = "𝕡", Kz = "ℙ", Jz = "£", Qz = "⪷", Xz = "⪻", Yz = "≺", Zz = "≼", eH = "⪷", tH = "≺", rH = "≼", nH = "≺", iH = "⪯", aH = "≼", oH = "≾", sH = "⪯", lH = "⪹", uH = "⪵", cH = "⋨", fH = "⪯", dH = "⪳", hH = "≾", pH = "′", vH = "″", mH = "ℙ", gH = "⪹", yH = "⪵", kH = "⋨", wH = "∏", bH = "∏", CH = "⌮", TH = "⌒", SH = "⌓", xH = "∝", EH = "∝", MH = "∷", NH = "∝", OH = "≾", DH = "⊰", AH = "𝒫", LH = "𝓅", RH = "Ψ", IH = "ψ", PH = " ", BH = "𝔔", FH = "𝔮", _H = "⨌", qH = "𝕢", zH = "ℚ", HH = "⁗", VH = "𝒬", UH = "𝓆", $H = "ℍ", WH = "⨖", jH = "?", GH = "≟", KH = '"', JH = '"', QH = "⇛", XH = "∽̱", YH = "Ŕ", ZH = "ŕ", e3 = "√", t3 = "⦳", r3 = "⟩", n3 = "⟫", i3 = "⦒", a3 = "⦥", o3 = "⟩", s3 = "»", l3 = "⥵", u3 = "⇥", c3 = "⤠", f3 = "⤳", d3 = "→", h3 = "↠", p3 = "⇒", v3 = "⤞", m3 = "↪", g3 = "↬", y3 = "⥅", k3 = "⥴", w3 = "⤖", b3 = "↣", C3 = "↝", T3 = "⤚", S3 = "⤜", x3 = "∶", E3 = "ℚ", M3 = "⤍", N3 = "⤏", O3 = "⤐", D3 = "❳", A3 = "}", L3 = "]", R3 = "⦌", I3 = "⦎", P3 = "⦐", B3 = "Ř", F3 = "ř", _3 = "Ŗ", q3 = "ŗ", z3 = "⌉", H3 = "}", V3 = "Р", U3 = "р", $3 = "⤷", W3 = "⥩", j3 = "”", G3 = "”", K3 = "↳", J3 = "ℜ", Q3 = "ℛ", X3 = "ℜ", Y3 = "ℝ", Z3 = "ℜ", eV = "▭", tV = "®", rV = "®", nV = "∋", iV = "⇋", aV = "⥯", oV = "⥽", sV = "⌋", lV = "𝔯", uV = "ℜ", cV = "⥤", fV = "⇁", dV = "⇀", hV = "⥬", pV = "Ρ", vV = "ρ", mV = "ϱ", gV = "⟩", yV = "⇥", kV = "→", wV = "→", bV = "⇒", CV = "⇄", TV = "↣", SV = "⌉", xV = "⟧", EV = "⥝", MV = "⥕", NV = "⇂", OV = "⌋", DV = "⇁", AV = "⇀", LV = "⇄", RV = "⇌", IV = "⇉", PV = "↝", BV = "↦", FV = "⊢", _V = "⥛", qV = "⋌", zV = "⧐", HV = "⊳", VV = "⊵", UV = "⥏", $V = "⥜", WV = "⥔", jV = "↾", GV = "⥓", KV = "⇀", JV = "˚", QV = "≓", XV = "⇄", YV = "⇌", ZV = "‏", eU = "⎱", tU = "⎱", rU = "⫮", nU = "⟭", iU = "⇾", aU = "⟧", oU = "⦆", sU = "𝕣", lU = "ℝ", uU = "⨮", cU = "⨵", fU = "⥰", dU = ")", hU = "⦔", pU = "⨒", vU = "⇉", mU = "⇛", gU = "›", yU = "𝓇", kU = "ℛ", wU = "↱", bU = "↱", CU = "]", TU = "’", SU = "’", xU = "⋌", EU = "⋊", MU = "▹", NU = "⊵", OU = "▸", DU = "⧎", AU = "⧴", LU = "⥨", RU = "℞", IU = "Ś", PU = "ś", BU = "‚", FU = "⪸", _U = "Š", qU = "š", zU = "⪼", HU = "≻", VU = "≽", UU = "⪰", $U = "⪴", WU = "Ş", jU = "ş", GU = "Ŝ", KU = "ŝ", JU = "⪺", QU = "⪶", XU = "⋩", YU = "⨓", ZU = "≿", e$ = "С", t$ = "с", r$ = "⊡", n$ = "⋅", i$ = "⩦", a$ = "⤥", o$ = "↘", s$ = "⇘", l$ = "↘", u$ = "§", c$ = ";", f$ = "⤩", d$ = "∖", h$ = "∖", p$ = "✶", v$ = "𝔖", m$ = "𝔰", g$ = "⌢", y$ = "♯", k$ = "Щ", w$ = "щ", b$ = "Ш", C$ = "ш", T$ = "↓", S$ = "←", x$ = "∣", E$ = "∥", M$ = "→", N$ = "↑", O$ = "­", D$ = "Σ", A$ = "σ", L$ = "ς", R$ = "ς", I$ = "∼", P$ = "⩪", B$ = "≃", F$ = "≃", _$ = "⪞", q$ = "⪠", z$ = "⪝", H$ = "⪟", V$ = "≆", U$ = "⨤", $$ = "⥲", W$ = "←", j$ = "∘", G$ = "∖", K$ = "⨳", J$ = "⧤", Q$ = "∣", X$ = "⌣", Y$ = "⪪", Z$ = "⪬", e4 = "⪬︀", t4 = "Ь", r4 = "ь", n4 = "⌿", i4 = "⧄", a4 = "/", o4 = "𝕊", s4 = "𝕤", l4 = "♠", u4 = "♠", c4 = "∥", f4 = "⊓", d4 = "⊓︀", h4 = "⊔", p4 = "⊔︀", v4 = "√", m4 = "⊏", g4 = "⊑", y4 = "⊏", k4 = "⊑", w4 = "⊐", b4 = "⊒", C4 = "⊐", T4 = "⊒", S4 = "□", x4 = "□", E4 = "⊓", M4 = "⊏", N4 = "⊑", O4 = "⊐", D4 = "⊒", A4 = "⊔", L4 = "▪", R4 = "□", I4 = "▪", P4 = "→", B4 = "𝒮", F4 = "𝓈", _4 = "∖", q4 = "⌣", z4 = "⋆", H4 = "⋆", V4 = "☆", U4 = "★", $4 = "ϵ", W4 = "ϕ", j4 = "¯", G4 = "⊂", K4 = "⋐", J4 = "⪽", Q4 = "⫅", X4 = "⊆", Y4 = "⫃", Z4 = "⫁", eW = "⫋", tW = "⊊", rW = "⪿", nW = "⥹", iW = "⊂", aW = "⋐", oW = "⊆", sW = "⫅", lW = "⊆", uW = "⊊", cW = "⫋", fW = "⫇", dW = "⫕", hW = "⫓", pW = "⪸", vW = "≻", mW = "≽", gW = "≻", yW = "⪰", kW = "≽", wW = "≿", bW = "⪰", CW = "⪺", TW = "⪶", SW = "⋩", xW = "≿", EW = "∋", MW = "∑", NW = "∑", OW = "♪", DW = "¹", AW = "²", LW = "³", RW = "⊃", IW = "⋑", PW = "⪾", BW = "⫘", FW = "⫆", _W = "⊇", qW = "⫄", zW = "⊃", HW = "⊇", VW = "⟉", UW = "⫗", $W = "⥻", WW = "⫂", jW = "⫌", GW = "⊋", KW = "⫀", JW = "⊃", QW = "⋑", XW = "⊇", YW = "⫆", ZW = "⊋", ej = "⫌", tj = "⫈", rj = "⫔", nj = "⫖", ij = "⤦", aj = "↙", oj = "⇙", sj = "↙", lj = "⤪", uj = "ß", cj = "	", fj = "⌖", dj = "Τ", hj = "τ", pj = "⎴", vj = "Ť", mj = "ť", gj = "Ţ", yj = "ţ", kj = "Т", wj = "т", bj = "⃛", Cj = "⌕", Tj = "𝔗", Sj = "𝔱", xj = "∴", Ej = "∴", Mj = "∴", Nj = "Θ", Oj = "θ", Dj = "ϑ", Aj = "ϑ", Lj = "≈", Rj = "∼", Ij = "  ", Pj = " ", Bj = " ", Fj = "≈", _j = "∼", qj = "Þ", zj = "þ", Hj = "˜", Vj = "∼", Uj = "≃", $j = "≅", Wj = "≈", jj = "⨱", Gj = "⊠", Kj = "×", Jj = "⨰", Qj = "∭", Xj = "⤨", Yj = "⌶", Zj = "⫱", e8 = "⊤", t8 = "𝕋", r8 = "𝕥", n8 = "⫚", i8 = "⤩", a8 = "‴", o8 = "™", s8 = "™", l8 = "▵", u8 = "▿", c8 = "◃", f8 = "⊴", d8 = "≜", h8 = "▹", p8 = "⊵", v8 = "◬", m8 = "≜", g8 = "⨺", y8 = "⃛", k8 = "⨹", w8 = "⧍", b8 = "⨻", C8 = "⏢", T8 = "𝒯", S8 = "𝓉", x8 = "Ц", E8 = "ц", M8 = "Ћ", N8 = "ћ", O8 = "Ŧ", D8 = "ŧ", A8 = "≬", L8 = "↞", R8 = "↠", I8 = "Ú", P8 = "ú", B8 = "↑", F8 = "↟", _8 = "⇑", q8 = "⥉", z8 = "Ў", H8 = "ў", V8 = "Ŭ", U8 = "ŭ", $8 = "Û", W8 = "û", j8 = "У", G8 = "у", K8 = "⇅", J8 = "Ű", Q8 = "ű", X8 = "⥮", Y8 = "⥾", Z8 = "𝔘", e5 = "𝔲", t5 = "Ù", r5 = "ù", n5 = "⥣", i5 = "↿", a5 = "↾", o5 = "▀", s5 = "⌜", l5 = "⌜", u5 = "⌏", c5 = "◸", f5 = "Ū", d5 = "ū", h5 = "¨", p5 = "_", v5 = "⏟", m5 = "⎵", g5 = "⏝", y5 = "⋃", k5 = "⊎", w5 = "Ų", b5 = "ų", C5 = "𝕌", T5 = "𝕦", S5 = "⤒", x5 = "↑", E5 = "↑", M5 = "⇑", N5 = "⇅", O5 = "↕", D5 = "↕", A5 = "⇕", L5 = "⥮", R5 = "↿", I5 = "↾", P5 = "⊎", B5 = "↖", F5 = "↗", _5 = "υ", q5 = "ϒ", z5 = "ϒ", H5 = "Υ", V5 = "υ", U5 = "↥", $5 = "⊥", W5 = "⇈", j5 = "⌝", G5 = "⌝", K5 = "⌎", J5 = "Ů", Q5 = "ů", X5 = "◹", Y5 = "𝒰", Z5 = "𝓊", e6 = "⋰", t6 = "Ũ", r6 = "ũ", n6 = "▵", i6 = "▴", a6 = "⇈", o6 = "Ü", s6 = "ü", l6 = "⦧", u6 = "⦜", c6 = "ϵ", f6 = "ϰ", d6 = "∅", h6 = "ϕ", p6 = "ϖ", v6 = "∝", m6 = "↕", g6 = "⇕", y6 = "ϱ", k6 = "ς", w6 = "⊊︀", b6 = "⫋︀", C6 = "⊋︀", T6 = "⫌︀", S6 = "ϑ", x6 = "⊲", E6 = "⊳", M6 = "⫨", N6 = "⫫", O6 = "⫩", D6 = "В", A6 = "в", L6 = "⊢", R6 = "⊨", I6 = "⊩", P6 = "⊫", B6 = "⫦", F6 = "⊻", _6 = "∨", q6 = "⋁", z6 = "≚", H6 = "⋮", V6 = "|", U6 = "‖", $6 = "|", W6 = "‖", j6 = "∣", G6 = "|", K6 = "❘", J6 = "≀", Q6 = " ", X6 = "𝔙", Y6 = "𝔳", Z6 = "⊲", e9 = "⊂⃒", t9 = "⊃⃒", r9 = "𝕍", n9 = "𝕧", i9 = "∝", a9 = "⊳", o9 = "𝒱", s9 = "𝓋", l9 = "⫋︀", u9 = "⊊︀", c9 = "⫌︀", f9 = "⊋︀", d9 = "⊪", h9 = "⦚", p9 = "Ŵ", v9 = "ŵ", m9 = "⩟", g9 = "∧", y9 = "⋀", k9 = "≙", w9 = "℘", b9 = "𝔚", C9 = "𝔴", T9 = "𝕎", S9 = "𝕨", x9 = "℘", E9 = "≀", M9 = "≀", N9 = "𝒲", O9 = "𝓌", D9 = "⋂", A9 = "◯", L9 = "⋃", R9 = "▽", I9 = "𝔛", P9 = "𝔵", B9 = "⟷", F9 = "⟺", _9 = "Ξ", q9 = "ξ", z9 = "⟵", H9 = "⟸", V9 = "⟼", U9 = "⋻", $9 = "⨀", W9 = "𝕏", j9 = "𝕩", G9 = "⨁", K9 = "⨂", J9 = "⟶", Q9 = "⟹", X9 = "𝒳", Y9 = "𝓍", Z9 = "⨆", eG = "⨄", tG = "△", rG = "⋁", nG = "⋀", iG = "Ý", aG = "ý", oG = "Я", sG = "я", lG = "Ŷ", uG = "ŷ", cG = "Ы", fG = "ы", dG = "¥", hG = "𝔜", pG = "𝔶", vG = "Ї", mG = "ї", gG = "𝕐", yG = "𝕪", kG = "𝒴", wG = "𝓎", bG = "Ю", CG = "ю", TG = "ÿ", SG = "Ÿ", xG = "Ź", EG = "ź", MG = "Ž", NG = "ž", OG = "З", DG = "з", AG = "Ż", LG = "ż", RG = "ℨ", IG = "​", PG = "Ζ", BG = "ζ", FG = "𝔷", _G = "ℨ", qG = "Ж", zG = "ж", HG = "⇝", VG = "𝕫", UG = "ℤ", $G = "𝒵", WG = "𝓏", jG = "‍", GG = "‌", zk = {
              Aacute: Ne,
              aacute: ze,
              Abreve: Ze,
              abreve: At,
              ac: et,
              acd: Ht,
              acE: Rt,
              Acirc: Ut,
              acirc: yt,
              acute: It,
              Acy: Ke,
              acy: ct,
              AElig: He,
              aelig: fe,
              af: Le,
              Afr: dt,
              afr: vt,
              Agrave: Ft,
              agrave: Lt,
              alefsym: $t,
              aleph: Te,
              Alpha: be,
              alpha: ue,
              Amacr: ge,
              amacr: oe,
              amalg: Pe,
              amp: Ve,
              AMP: lt,
              andand: Tt,
              And: Yt,
              and: jt,
              andd: mr,
              andslope: tr,
              andv: yr,
              ang: ar,
              ange: Wr,
              angle: ki,
              angmsdaa: Hn,
              angmsdab: _r,
              angmsdac: st,
              angmsdad: ut,
              angmsdae: _t,
              angmsdaf: Vt,
              angmsdag: Zt,
              angmsdah: tn,
              angmsd: kr,
              angrt: xr,
              angrtvb: En,
              angrtvbd: Vn,
              angsph: Rr,
              angst: cn,
              angzarr: ri,
              Aogon: Un,
              aogon: rn,
              Aopf: Xr,
              aopf: gn,
              apacir: qr,
              ap: $n,
              apE: wr,
              ape: jr,
              apid: Q,
              apos: X,
              ApplyFunction: z,
              approx: F,
              approxeq: V,
              Aring: G,
              aring: re,
              Ascr: Ee,
              ascr: Be,
              Assign: he,
              ast: ne,
              asymp: Ae,
              asympeq: Fe,
              Atilde: it,
              atilde: Nt,
              Auml: H,
              auml: R,
              awconint: b,
              awint: E,
              backcong: B,
              backepsilon: K,
              backprime: Z,
              backsim: ae,
              backsimeq: ye,
              Backslash: Oe,
              Barv: je,
              barvee: $e,
              barwed: at,
              Barwed: Ot,
              barwedge: er,
              bbrk: hr,
              bbrktbrk: Ir,
              bcong: Qi,
              Bcy: Yr,
              bcy: Os,
              bdquo: zo,
              becaus: Oa,
              because: Wn,
              Because: jn,
              bemptyv: Xi,
              bepsi: yn,
              bernou: Ho,
              Bernoullis: no,
              Beta: ha,
              beta: Da,
              beth: Aa,
              between: Mn,
              Bfr: La,
              bfr: pa,
              bigcap: Qt,
              bigcirc: Vo,
              bigcup: Uo,
              bigodot: Ii,
              bigoplus: wi,
              bigotimes: bi,
              bigsqcup: Ra,
              bigstar: Yi,
              bigtriangledown: Ci,
              bigtriangleup: Zr,
              biguplus: ni,
              bigvee: Pi,
              bigwedge: fn,
              bkarow: va,
              blacklozenge: Ti,
              blacksquare: io,
              blacktriangle: $o,
              blacktriangledown: ii,
              blacktriangleleft: ai,
              blacktriangleright: ao,
              blank: Ia,
              blk12: Wo,
              blk14: Sl,
              blk34: St,
              block: Se,
              bne: tt,
              bnequiv: wt,
              bNot: sr,
              bnot: Gr,
              Bopf: Pr,
              bopf: Mr,
              bot: Nn,
              bottom: Zi,
              bowtie: oi,
              boxbox: oo,
              boxdl: Pa,
              boxdL: Ru,
              boxDl: Ds,
              boxDL: As,
              boxdr: Iu,
              boxdR: br,
              boxDr: zr,
              boxDR: xl,
              boxh: jo,
              boxH: bf,
              boxhd: Bi,
              boxHd: El,
              boxhD: Ba,
              boxHD: so,
              boxhu: Pu,
              boxHu: Cf,
              boxhU: Ls,
              boxHU: Tf,
              boxminus: Go,
              boxplus: lo,
              boxtimes: Sf,
              boxul: xf,
              boxuL: Ef,
              boxUl: Mf,
              boxUL: Bu,
              boxur: Nf,
              boxuR: Ml,
              boxUr: Fu,
              boxUR: Of,
              boxv: Rs,
              boxV: Df,
              boxvh: Af,
              boxvH: _u,
              boxVh: Nl,
              boxVH: Lf,
              boxvl: Rf,
              boxvL: Ko,
              boxVl: If,
              boxVL: Jo,
              boxvr: Pf,
              boxvR: Bf,
              boxVr: Fa,
              boxVR: uo,
              bprime: qu,
              breve: zu,
              Breve: Ol,
              brvbar: Hu,
              bscr: Dl,
              Bscr: co,
              bsemi: _a,
              bsim: Qo,
              bsime: Ff,
              bsolb: qa,
              bsol: za,
              bsolhsub: ma,
              bull: kn,
              bullet: Hr,
              bump: Vu,
              bumpE: Is,
              bumpe: Uu,
              Bumpeq: $u,
              bumpeq: Ps,
              Cacute: Bs,
              cacute: Xo,
              capand: ga,
              capbrcup: Fs,
              capcap: Wu,
              cap: Al,
              Cap: _f,
              capcup: qf,
              capdot: zf,
              CapitalDifferentialD: Si,
              caps: fo,
              caret: Ll,
              caron: ju,
              Cayleys: Rl,
              ccaps: Gu,
              Ccaron: Il,
              ccaron: Hf,
              Ccedil: Vf,
              ccedil: ho,
              Ccirc: Pl,
              ccirc: po,
              Cconint: Bl,
              ccups: Ku,
              ccupssm: vo,
              Cdot: mo,
              cdot: _s,
              cedil: Ju,
              Cedilla: qs,
              cemptyv: Fl,
              cent: _l,
              centerdot: ql,
              CenterDot: zl,
              cfr: Qu,
              Cfr: Hl,
              CHcy: ya,
              chcy: zs,
              check: d,
              checkmark: w,
              Chi: h,
              chi: k,
              circ: S,
              circeq: M,
              circlearrowleft: P,
              circlearrowright: I,
              circledast: W,
              circledcirc: Y,
              circleddash: le,
              CircleDot: xe,
              circledR: ve,
              circledS: Re,
              CircleMinus: Ue,
              CirclePlus: nt,
              CircleTimes: gt,
              cir: Xe,
              cirE: rr,
              cire: Jt,
              cirfnint: Dt,
              cirmid: Gt,
              cirscir: lr,
              ClockwiseContourIntegral: or,
              CloseCurlyDoubleQuote: Nr,
              CloseCurlyQuote: Ar,
              clubs: Vr,
              clubsuit: xi,
              colon: Hs,
              Colon: ea,
              Colone: ta,
              colone: On,
              coloneq: go,
              comma: Cr,
              commat: si,
              comp: Dn,
              compfn: Or,
              complement: Vs,
              complexes: Xu,
              cong: Gm,
              congdot: Yo,
              Congruent: Vl,
              conint: Us,
              Conint: Yu,
              ContourIntegral: Uf,
              copf: $s,
              Copf: yo,
              coprod: Dr,
              Coproduct: Er,
              copy: ko,
              COPY: An,
              copysr: li,
              CounterClockwiseContourIntegral: Zo,
              crarr: Ws,
              cross: ui,
              Cross: Zu,
              Cscr: Oh,
              cscr: Dh,
              csub: ec,
              csube: Ah,
              csup: Ha,
              csupe: tc,
              ctdot: $f,
              cudarrl: Lh,
              cudarrr: Km,
              cuepr: wo,
              cuesc: js,
              cularr: Gs,
              cularrp: rc,
              cupbrcap: nc,
              cupcap: Fi,
              CupCap: _i,
              cup: es,
              Cup: Va,
              cupcup: Ua,
              cupdot: ts,
              cupor: Rh,
              cups: Wf,
              curarr: jf,
              curarrm: Ei,
              curlyeqprec: Mi,
              curlyeqsucc: Lr,
              curlyvee: ra,
              curlywedge: Ih,
              curren: Ph,
              curvearrowleft: Gf,
              curvearrowright: Kf,
              cuvee: Bh,
              cuwed: ic,
              cwconint: Fh,
              cwint: Ks,
              cylcty: Jf,
              dagger: Jm,
              Dagger: Ul,
              daleth: ac,
              darr: _h,
              Darr: qh,
              dArr: Js,
              dash: zh,
              Dashv: oc,
              dashv: sc,
              dbkarow: Qs,
              dblac: Qf,
              Dcaron: Xf,
              dcaron: Yf,
              Dcy: Zf,
              dcy: Xs,
              ddagger: qi,
              ddarr: rs,
              DD: ed,
              dd: Hh,
              DDotrahd: $a,
              ddotseq: bo,
              deg: td,
              Del: Vh,
              Delta: Wa,
              delta: Co,
              demptyv: lc,
              dfisht: Uh,
              Dfr: uc,
              dfr: $h,
              dHar: $l,
              dharl: ka,
              dharr: Wl,
              DiacriticalAcute: jl,
              DiacriticalDot: ns,
              DiacriticalDoubleAcute: rd,
              DiacriticalGrave: Ys,
              DiacriticalTilde: Wh,
              diam: nd,
              diamond: Br,
              Diamond: cc,
              diamondsuit: id,
              diams: ad,
              die: fc,
              DifferentialD: od,
              digamma: is,
              disin: Fr,
              div: nn,
              divide: dn,
              divideontimes: dc,
              divonx: Gl,
              DJcy: Kl,
              djcy: Qm,
              dlcorn: Ln,
              dlcrop: sd,
              dollar: ld,
              Dopf: ud,
              dopf: wa,
              Dot: zi,
              dot: Jl,
              DotDot: cd,
              doteq: fd,
              doteqdot: jh,
              DotEqual: Gh,
              dotminus: Kh,
              dotplus: Jh,
              dotsquare: Qh,
              doublebarwedge: Xh,
              DoubleContourIntegral: Yh,
              DoubleDot: Zh,
              DoubleDownArrow: Ql,
              DoubleLeftArrow: ep,
              DoubleLeftRightArrow: hc,
              DoubleLeftTee: pc,
              DoubleLongLeftArrow: tp,
              DoubleLongLeftRightArrow: dd,
              DoubleLongRightArrow: rp,
              DoubleRightArrow: np,
              DoubleRightTee: ip,
              DoubleUpArrow: ap,
              DoubleUpDownArrow: hd,
              DoubleVerticalBar: op,
              DownArrowBar: sp,
              downarrow: lp,
              DownArrow: Xm,
              Downarrow: up,
              DownArrowUpArrow: Ym,
              DownBreve: Zm,
              downdownarrows: cp,
              downharpoonleft: fp,
              downharpoonright: dp,
              DownLeftRightVector: vc,
              DownLeftTeeVector: eg,
              DownLeftVectorBar: tg,
              DownLeftVector: rg,
              DownRightTeeVector: na,
              DownRightVectorBar: pd,
              DownRightVector: mc,
              DownTeeArrow: hp,
              DownTee: pp,
              drbkarow: vp,
              drcorn: vd,
              drcrop: Zs,
              Dscr: md,
              dscr: gd,
              DScy: ng,
              dscy: mp,
              dsol: gp,
              Dstrok: yp,
              dstrok: kp,
              dtdot: wp,
              dtri: ig,
              dtrif: ci,
              duarr: Gn,
              duhar: bp,
              dwangle: Cp,
              DZcy: Tp,
              dzcy: Sp,
              dzigrarr: xp,
              Eacute: yd,
              eacute: Ep,
              easter: kd,
              Ecaron: Mp,
              ecaron: Np,
              Ecirc: wd,
              ecirc: bd,
              ecir: Op,
              ecolon: Cd,
              Ecy: gc,
              ecy: ag,
              eDDot: Dp,
              Edot: Td,
              edot: Ap,
              eDot: yc,
              ee: ja,
              efDot: og,
              Efr: Lp,
              efr: Sd,
              eg: Rp,
              Egrave: Ip,
              egrave: Xl,
              egs: Rn,
              egsdot: sg,
              el: lg,
              Element: kc,
              elinters: In,
              ell: ug,
              els: kt,
              elsdot: el,
              Emacr: xd,
              emacr: Pp,
              empty: cg,
              emptyset: Yl,
              EmptySmallSquare: wc,
              emptyv: Ed,
              EmptyVerySmallSquare: Bp,
              emsp13: Fp,
              emsp14: _p,
              emsp: Md,
              ENG: Nd,
              eng: wn,
              ensp: ia,
              Eogon: To,
              eogon: qp,
              Eopf: zp,
              eopf: aa,
              epar: Hp,
              eparsl: ba,
              eplus: fg,
              epsi: Vp,
              Epsilon: Up,
              epsilon: $p,
              epsiv: Wp,
              eqcirc: dg,
              eqcolon: bc,
              eqsim: Od,
              eqslantgtr: Hi,
              eqslantless: ur,
              Equal: hn,
              equals: en,
              EqualTilde: bn,
              equest: Ni,
              Equilibrium: tl,
              equiv: an,
              equivDD: Zl,
              eqvparsl: as,
              erarr: Cc,
              erDot: Dd,
              escr: eu,
              Escr: fi,
              esdot: Ad,
              Esim: rl,
              esim: Ga,
              Eta: Tc,
              eta: Ld,
              ETH: So,
              eth: Sc,
              Euml: xo,
              euml: xc,
              euro: tu,
              excl: Rd,
              exist: Ec,
              Exists: Mc,
              expectation: Kn,
              exponentiale: Eo,
              ExponentialE: oa,
              fallingdotseq: di,
              Fcy: jp,
              fcy: Id,
              female: Pd,
              ffilig: hg,
              fflig: Mo,
              ffllig: Gp,
              Ffr: Bd,
              ffr: ss,
              filig: Fd,
              FilledSmallSquare: ls,
              FilledVerySmallSquare: Kp,
              fjlig: Jp,
              flat: _d,
              fllig: Nc,
              fltns: pg,
              fnof: vg,
              Fopf: Qp,
              fopf: Xp,
              forall: us,
              ForAll: mg,
              fork: nl,
              forkv: Yp,
              Fouriertrf: Ur,
              fpartint: gg,
              frac12: Zp,
              frac13: yg,
              frac14: kg,
              frac15: ev,
              frac16: tv,
              frac18: wg,
              frac23: Vi,
              frac25: qd,
              frac34: bg,
              frac35: No,
              frac38: Oc,
              frac45: cs,
              frac56: Dc,
              frac58: zd,
              frac78: Hd,
              frasl: Cg,
              frown: Vd,
              fscr: Tg,
              Fscr: rv,
              gacute: nv,
              Gamma: Ac,
              gamma: Lc,
              Gammad: iv,
              gammad: Ud,
              gap: Sg,
              Gbreve: av,
              gbreve: $d,
              Gcedil: Rc,
              Gcirc: Wd,
              gcirc: Ic,
              Gcy: ov,
              gcy: xg,
              Gdot: Pc,
              gdot: Eg,
              ge: ru,
              gE: Mg,
              gEl: Bc,
              gel: o,
              geq: l,
              geqq: c,
              geqslant: g,
              gescc: x,
              ges: L,
              gesdot: $,
              gesdoto: ie,
              gesdotol: de,
              gesl: Ie,
              gesles: Je,
              Gfr: Ye,
              gfr: Ge,
              gg: pt,
              Gg: Ct,
              ggg: xt,
              gimel: Kr,
              GJcy: Me,
              gjcy: we,
              gla: De,
              gl: rt,
              glE: Et,
              glj: qt,
              gnap: zt,
              gnapprox: Wt,
              gne: pn,
              gnE: fr,
              gneq: Oo,
              gneqq: Ng,
              gnsim: hM,
              Gopf: pM,
              gopf: vM,
              grave: mM,
              GreaterEqual: gM,
              GreaterEqualLess: yM,
              GreaterFullEqual: kM,
              GreaterGreater: wM,
              GreaterLess: bM,
              GreaterSlantEqual: CM,
              GreaterTilde: TM,
              Gscr: SM,
              gscr: xM,
              gsim: EM,
              gsime: MM,
              gsiml: NM,
              gtcc: OM,
              gtcir: DM,
              gt: AM,
              GT: LM,
              Gt: RM,
              gtdot: IM,
              gtlPar: PM,
              gtquest: BM,
              gtrapprox: FM,
              gtrarr: _M,
              gtrdot: qM,
              gtreqless: zM,
              gtreqqless: HM,
              gtrless: VM,
              gtrsim: UM,
              gvertneqq: $M,
              gvnE: WM,
              Hacek: jM,
              hairsp: GM,
              half: KM,
              hamilt: JM,
              HARDcy: QM,
              hardcy: XM,
              harrcir: YM,
              harr: ZM,
              hArr: eN,
              harrw: tN,
              Hat: rN,
              hbar: nN,
              Hcirc: iN,
              hcirc: aN,
              hearts: oN,
              heartsuit: sN,
              hellip: lN,
              hercon: uN,
              hfr: cN,
              Hfr: fN,
              HilbertSpace: dN,
              hksearow: hN,
              hkswarow: pN,
              hoarr: vN,
              homtht: mN,
              hookleftarrow: gN,
              hookrightarrow: yN,
              hopf: kN,
              Hopf: wN,
              horbar: bN,
              HorizontalLine: CN,
              hscr: TN,
              Hscr: SN,
              hslash: xN,
              Hstrok: EN,
              hstrok: MN,
              HumpDownHump: NN,
              HumpEqual: ON,
              hybull: DN,
              hyphen: AN,
              Iacute: LN,
              iacute: RN,
              ic: IN,
              Icirc: PN,
              icirc: BN,
              Icy: FN,
              icy: _N,
              Idot: qN,
              IEcy: zN,
              iecy: HN,
              iexcl: VN,
              iff: UN,
              ifr: $N,
              Ifr: WN,
              Igrave: jN,
              igrave: GN,
              ii: KN,
              iiiint: JN,
              iiint: QN,
              iinfin: XN,
              iiota: YN,
              IJlig: ZN,
              ijlig: eO,
              Imacr: tO,
              imacr: rO,
              image: nO,
              ImaginaryI: iO,
              imagline: aO,
              imagpart: oO,
              imath: sO,
              Im: lO,
              imof: uO,
              imped: cO,
              Implies: fO,
              incare: dO,
              in: "∈",
              infin: hO,
              infintie: pO,
              inodot: vO,
              intcal: mO,
              int: gO,
              Int: yO,
              integers: kO,
              Integral: wO,
              intercal: bO,
              Intersection: CO,
              intlarhk: TO,
              intprod: SO,
              InvisibleComma: xO,
              InvisibleTimes: EO,
              IOcy: MO,
              iocy: NO,
              Iogon: OO,
              iogon: DO,
              Iopf: AO,
              iopf: LO,
              Iota: RO,
              iota: IO,
              iprod: PO,
              iquest: BO,
              iscr: FO,
              Iscr: _O,
              isin: qO,
              isindot: zO,
              isinE: HO,
              isins: VO,
              isinsv: UO,
              isinv: $O,
              it: WO,
              Itilde: jO,
              itilde: GO,
              Iukcy: KO,
              iukcy: JO,
              Iuml: QO,
              iuml: XO,
              Jcirc: YO,
              jcirc: ZO,
              Jcy: eD,
              jcy: tD,
              Jfr: rD,
              jfr: nD,
              jmath: iD,
              Jopf: aD,
              jopf: oD,
              Jscr: sD,
              jscr: lD,
              Jsercy: uD,
              jsercy: cD,
              Jukcy: fD,
              jukcy: dD,
              Kappa: hD,
              kappa: pD,
              kappav: vD,
              Kcedil: mD,
              kcedil: gD,
              Kcy: yD,
              kcy: kD,
              Kfr: wD,
              kfr: bD,
              kgreen: CD,
              KHcy: TD,
              khcy: SD,
              KJcy: xD,
              kjcy: ED,
              Kopf: MD,
              kopf: ND,
              Kscr: OD,
              kscr: DD,
              lAarr: AD,
              Lacute: LD,
              lacute: RD,
              laemptyv: ID,
              lagran: PD,
              Lambda: BD,
              lambda: FD,
              lang: _D,
              Lang: qD,
              langd: zD,
              langle: HD,
              lap: VD,
              Laplacetrf: UD,
              laquo: $D,
              larrb: WD,
              larrbfs: jD,
              larr: GD,
              Larr: KD,
              lArr: JD,
              larrfs: QD,
              larrhk: XD,
              larrlp: YD,
              larrpl: ZD,
              larrsim: eA,
              larrtl: tA,
              latail: rA,
              lAtail: nA,
              lat: iA,
              late: aA,
              lates: oA,
              lbarr: sA,
              lBarr: lA,
              lbbrk: uA,
              lbrace: cA,
              lbrack: fA,
              lbrke: dA,
              lbrksld: hA,
              lbrkslu: pA,
              Lcaron: vA,
              lcaron: mA,
              Lcedil: gA,
              lcedil: yA,
              lceil: kA,
              lcub: wA,
              Lcy: bA,
              lcy: CA,
              ldca: TA,
              ldquo: SA,
              ldquor: xA,
              ldrdhar: EA,
              ldrushar: MA,
              ldsh: NA,
              le: OA,
              lE: DA,
              LeftAngleBracket: AA,
              LeftArrowBar: LA,
              leftarrow: RA,
              LeftArrow: IA,
              Leftarrow: PA,
              LeftArrowRightArrow: BA,
              leftarrowtail: FA,
              LeftCeiling: _A,
              LeftDoubleBracket: qA,
              LeftDownTeeVector: zA,
              LeftDownVectorBar: HA,
              LeftDownVector: VA,
              LeftFloor: UA,
              leftharpoondown: $A,
              leftharpoonup: WA,
              leftleftarrows: jA,
              leftrightarrow: GA,
              LeftRightArrow: KA,
              Leftrightarrow: JA,
              leftrightarrows: QA,
              leftrightharpoons: XA,
              leftrightsquigarrow: YA,
              LeftRightVector: ZA,
              LeftTeeArrow: eL,
              LeftTee: tL,
              LeftTeeVector: rL,
              leftthreetimes: nL,
              LeftTriangleBar: iL,
              LeftTriangle: aL,
              LeftTriangleEqual: oL,
              LeftUpDownVector: sL,
              LeftUpTeeVector: lL,
              LeftUpVectorBar: uL,
              LeftUpVector: cL,
              LeftVectorBar: fL,
              LeftVector: dL,
              lEg: hL,
              leg: pL,
              leq: vL,
              leqq: mL,
              leqslant: gL,
              lescc: yL,
              les: kL,
              lesdot: wL,
              lesdoto: bL,
              lesdotor: CL,
              lesg: TL,
              lesges: SL,
              lessapprox: xL,
              lessdot: EL,
              lesseqgtr: ML,
              lesseqqgtr: NL,
              LessEqualGreater: OL,
              LessFullEqual: DL,
              LessGreater: AL,
              lessgtr: LL,
              LessLess: RL,
              lesssim: IL,
              LessSlantEqual: PL,
              LessTilde: BL,
              lfisht: FL,
              lfloor: _L,
              Lfr: qL,
              lfr: zL,
              lg: HL,
              lgE: VL,
              lHar: UL,
              lhard: $L,
              lharu: WL,
              lharul: jL,
              lhblk: GL,
              LJcy: KL,
              ljcy: JL,
              llarr: QL,
              ll: XL,
              Ll: YL,
              llcorner: ZL,
              Lleftarrow: eR,
              llhard: tR,
              lltri: rR,
              Lmidot: nR,
              lmidot: iR,
              lmoustache: aR,
              lmoust: oR,
              lnap: sR,
              lnapprox: lR,
              lne: uR,
              lnE: cR,
              lneq: fR,
              lneqq: dR,
              lnsim: hR,
              loang: pR,
              loarr: vR,
              lobrk: mR,
              longleftarrow: gR,
              LongLeftArrow: yR,
              Longleftarrow: kR,
              longleftrightarrow: wR,
              LongLeftRightArrow: bR,
              Longleftrightarrow: CR,
              longmapsto: TR,
              longrightarrow: SR,
              LongRightArrow: xR,
              Longrightarrow: ER,
              looparrowleft: MR,
              looparrowright: NR,
              lopar: OR,
              Lopf: DR,
              lopf: AR,
              loplus: LR,
              lotimes: RR,
              lowast: IR,
              lowbar: PR,
              LowerLeftArrow: BR,
              LowerRightArrow: FR,
              loz: _R,
              lozenge: qR,
              lozf: zR,
              lpar: HR,
              lparlt: VR,
              lrarr: UR,
              lrcorner: $R,
              lrhar: WR,
              lrhard: jR,
              lrm: GR,
              lrtri: KR,
              lsaquo: JR,
              lscr: QR,
              Lscr: XR,
              lsh: YR,
              Lsh: ZR,
              lsim: eI,
              lsime: tI,
              lsimg: rI,
              lsqb: nI,
              lsquo: iI,
              lsquor: aI,
              Lstrok: oI,
              lstrok: sI,
              ltcc: lI,
              ltcir: uI,
              lt: cI,
              LT: fI,
              Lt: dI,
              ltdot: hI,
              lthree: pI,
              ltimes: vI,
              ltlarr: mI,
              ltquest: gI,
              ltri: yI,
              ltrie: kI,
              ltrif: wI,
              ltrPar: bI,
              lurdshar: CI,
              luruhar: TI,
              lvertneqq: SI,
              lvnE: xI,
              macr: EI,
              male: MI,
              malt: NI,
              maltese: OI,
              Map: "⤅",
              map: DI,
              mapsto: AI,
              mapstodown: LI,
              mapstoleft: RI,
              mapstoup: II,
              marker: PI,
              mcomma: BI,
              Mcy: FI,
              mcy: _I,
              mdash: qI,
              mDDot: zI,
              measuredangle: HI,
              MediumSpace: VI,
              Mellintrf: UI,
              Mfr: $I,
              mfr: WI,
              mho: jI,
              micro: GI,
              midast: KI,
              midcir: JI,
              mid: QI,
              middot: XI,
              minusb: YI,
              minus: ZI,
              minusd: eP,
              minusdu: tP,
              MinusPlus: rP,
              mlcp: nP,
              mldr: iP,
              mnplus: aP,
              models: oP,
              Mopf: sP,
              mopf: lP,
              mp: uP,
              mscr: cP,
              Mscr: fP,
              mstpos: dP,
              Mu: hP,
              mu: pP,
              multimap: vP,
              mumap: mP,
              nabla: gP,
              Nacute: yP,
              nacute: kP,
              nang: wP,
              nap: bP,
              napE: CP,
              napid: TP,
              napos: SP,
              napprox: xP,
              natural: EP,
              naturals: MP,
              natur: NP,
              nbsp: OP,
              nbump: DP,
              nbumpe: AP,
              ncap: LP,
              Ncaron: RP,
              ncaron: IP,
              Ncedil: PP,
              ncedil: BP,
              ncong: FP,
              ncongdot: _P,
              ncup: qP,
              Ncy: zP,
              ncy: HP,
              ndash: VP,
              nearhk: UP,
              nearr: $P,
              neArr: WP,
              nearrow: jP,
              ne: GP,
              nedot: KP,
              NegativeMediumSpace: JP,
              NegativeThickSpace: QP,
              NegativeThinSpace: XP,
              NegativeVeryThinSpace: YP,
              nequiv: ZP,
              nesear: eB,
              nesim: tB,
              NestedGreaterGreater: rB,
              NestedLessLess: nB,
              NewLine: iB,
              nexist: aB,
              nexists: oB,
              Nfr: sB,
              nfr: lB,
              ngE: uB,
              nge: cB,
              ngeq: fB,
              ngeqq: dB,
              ngeqslant: hB,
              nges: pB,
              nGg: vB,
              ngsim: mB,
              nGt: gB,
              ngt: yB,
              ngtr: kB,
              nGtv: wB,
              nharr: bB,
              nhArr: CB,
              nhpar: TB,
              ni: SB,
              nis: xB,
              nisd: EB,
              niv: MB,
              NJcy: NB,
              njcy: OB,
              nlarr: DB,
              nlArr: AB,
              nldr: LB,
              nlE: RB,
              nle: IB,
              nleftarrow: PB,
              nLeftarrow: BB,
              nleftrightarrow: FB,
              nLeftrightarrow: _B,
              nleq: qB,
              nleqq: zB,
              nleqslant: HB,
              nles: VB,
              nless: UB,
              nLl: $B,
              nlsim: WB,
              nLt: jB,
              nlt: GB,
              nltri: KB,
              nltrie: JB,
              nLtv: QB,
              nmid: XB,
              NoBreak: YB,
              NonBreakingSpace: ZB,
              nopf: eF,
              Nopf: tF,
              Not: rF,
              not: nF,
              NotCongruent: iF,
              NotCupCap: aF,
              NotDoubleVerticalBar: oF,
              NotElement: sF,
              NotEqual: lF,
              NotEqualTilde: uF,
              NotExists: cF,
              NotGreater: fF,
              NotGreaterEqual: dF,
              NotGreaterFullEqual: hF,
              NotGreaterGreater: pF,
              NotGreaterLess: vF,
              NotGreaterSlantEqual: mF,
              NotGreaterTilde: gF,
              NotHumpDownHump: yF,
              NotHumpEqual: kF,
              notin: wF,
              notindot: bF,
              notinE: CF,
              notinva: TF,
              notinvb: SF,
              notinvc: xF,
              NotLeftTriangleBar: EF,
              NotLeftTriangle: MF,
              NotLeftTriangleEqual: NF,
              NotLess: OF,
              NotLessEqual: DF,
              NotLessGreater: AF,
              NotLessLess: LF,
              NotLessSlantEqual: RF,
              NotLessTilde: IF,
              NotNestedGreaterGreater: PF,
              NotNestedLessLess: BF,
              notni: FF,
              notniva: _F,
              notnivb: qF,
              notnivc: zF,
              NotPrecedes: HF,
              NotPrecedesEqual: VF,
              NotPrecedesSlantEqual: UF,
              NotReverseElement: $F,
              NotRightTriangleBar: WF,
              NotRightTriangle: jF,
              NotRightTriangleEqual: GF,
              NotSquareSubset: KF,
              NotSquareSubsetEqual: JF,
              NotSquareSuperset: QF,
              NotSquareSupersetEqual: XF,
              NotSubset: YF,
              NotSubsetEqual: ZF,
              NotSucceeds: e_,
              NotSucceedsEqual: t_,
              NotSucceedsSlantEqual: r_,
              NotSucceedsTilde: n_,
              NotSuperset: i_,
              NotSupersetEqual: a_,
              NotTilde: o_,
              NotTildeEqual: s_,
              NotTildeFullEqual: l_,
              NotTildeTilde: u_,
              NotVerticalBar: c_,
              nparallel: f_,
              npar: d_,
              nparsl: h_,
              npart: p_,
              npolint: v_,
              npr: m_,
              nprcue: g_,
              nprec: y_,
              npreceq: k_,
              npre: w_,
              nrarrc: b_,
              nrarr: C_,
              nrArr: T_,
              nrarrw: S_,
              nrightarrow: x_,
              nRightarrow: E_,
              nrtri: M_,
              nrtrie: N_,
              nsc: O_,
              nsccue: D_,
              nsce: A_,
              Nscr: L_,
              nscr: R_,
              nshortmid: I_,
              nshortparallel: P_,
              nsim: B_,
              nsime: F_,
              nsimeq: __,
              nsmid: q_,
              nspar: z_,
              nsqsube: H_,
              nsqsupe: V_,
              nsub: U_,
              nsubE: $_,
              nsube: W_,
              nsubset: j_,
              nsubseteq: G_,
              nsubseteqq: K_,
              nsucc: J_,
              nsucceq: Q_,
              nsup: X_,
              nsupE: Y_,
              nsupe: Z_,
              nsupset: e2,
              nsupseteq: t2,
              nsupseteqq: r2,
              ntgl: n2,
              Ntilde: i2,
              ntilde: a2,
              ntlg: o2,
              ntriangleleft: s2,
              ntrianglelefteq: l2,
              ntriangleright: u2,
              ntrianglerighteq: c2,
              Nu: f2,
              nu: d2,
              num: h2,
              numero: p2,
              numsp: v2,
              nvap: m2,
              nvdash: g2,
              nvDash: y2,
              nVdash: k2,
              nVDash: w2,
              nvge: b2,
              nvgt: C2,
              nvHarr: T2,
              nvinfin: S2,
              nvlArr: x2,
              nvle: E2,
              nvlt: M2,
              nvltrie: N2,
              nvrArr: O2,
              nvrtrie: D2,
              nvsim: A2,
              nwarhk: L2,
              nwarr: R2,
              nwArr: I2,
              nwarrow: P2,
              nwnear: B2,
              Oacute: F2,
              oacute: _2,
              oast: q2,
              Ocirc: z2,
              ocirc: H2,
              ocir: V2,
              Ocy: U2,
              ocy: $2,
              odash: W2,
              Odblac: j2,
              odblac: G2,
              odiv: K2,
              odot: J2,
              odsold: Q2,
              OElig: X2,
              oelig: Y2,
              ofcir: Z2,
              Ofr: eq,
              ofr: tq,
              ogon: rq,
              Ograve: nq,
              ograve: iq,
              ogt: aq,
              ohbar: oq,
              ohm: sq,
              oint: lq,
              olarr: uq,
              olcir: cq,
              olcross: fq,
              oline: dq,
              olt: hq,
              Omacr: pq,
              omacr: vq,
              Omega: mq,
              omega: gq,
              Omicron: yq,
              omicron: kq,
              omid: wq,
              ominus: bq,
              Oopf: Cq,
              oopf: Tq,
              opar: Sq,
              OpenCurlyDoubleQuote: xq,
              OpenCurlyQuote: Eq,
              operp: Mq,
              oplus: Nq,
              orarr: Oq,
              Or: Dq,
              or: Aq,
              ord: Lq,
              order: Rq,
              orderof: Iq,
              ordf: Pq,
              ordm: Bq,
              origof: Fq,
              oror: _q,
              orslope: qq,
              orv: zq,
              oS: Hq,
              Oscr: Vq,
              oscr: Uq,
              Oslash: $q,
              oslash: Wq,
              osol: jq,
              Otilde: Gq,
              otilde: Kq,
              otimesas: Jq,
              Otimes: Qq,
              otimes: Xq,
              Ouml: Yq,
              ouml: Zq,
              ovbar: ez,
              OverBar: tz,
              OverBrace: rz,
              OverBracket: nz,
              OverParenthesis: iz,
              para: az,
              parallel: oz,
              par: sz,
              parsim: lz,
              parsl: uz,
              part: cz,
              PartialD: fz,
              Pcy: dz,
              pcy: hz,
              percnt: pz,
              period: vz,
              permil: mz,
              perp: gz,
              pertenk: yz,
              Pfr: kz,
              pfr: wz,
              Phi: bz,
              phi: Cz,
              phiv: Tz,
              phmmat: Sz,
              phone: xz,
              Pi: Ez,
              pi: Mz,
              pitchfork: Nz,
              piv: Oz,
              planck: Dz,
              planckh: Az,
              plankv: Lz,
              plusacir: Rz,
              plusb: Iz,
              pluscir: Pz,
              plus: Bz,
              plusdo: Fz,
              plusdu: _z,
              pluse: qz,
              PlusMinus: zz,
              plusmn: Hz,
              plussim: Vz,
              plustwo: Uz,
              pm: $z,
              Poincareplane: Wz,
              pointint: jz,
              popf: Gz,
              Popf: Kz,
              pound: Jz,
              prap: Qz,
              Pr: Xz,
              pr: Yz,
              prcue: Zz,
              precapprox: eH,
              prec: tH,
              preccurlyeq: rH,
              Precedes: nH,
              PrecedesEqual: iH,
              PrecedesSlantEqual: aH,
              PrecedesTilde: oH,
              preceq: sH,
              precnapprox: lH,
              precneqq: uH,
              precnsim: cH,
              pre: fH,
              prE: dH,
              precsim: hH,
              prime: pH,
              Prime: vH,
              primes: mH,
              prnap: gH,
              prnE: yH,
              prnsim: kH,
              prod: wH,
              Product: bH,
              profalar: CH,
              profline: TH,
              profsurf: SH,
              prop: xH,
              Proportional: EH,
              Proportion: MH,
              propto: NH,
              prsim: OH,
              prurel: DH,
              Pscr: AH,
              pscr: LH,
              Psi: RH,
              psi: IH,
              puncsp: PH,
              Qfr: BH,
              qfr: FH,
              qint: _H,
              qopf: qH,
              Qopf: zH,
              qprime: HH,
              Qscr: VH,
              qscr: UH,
              quaternions: $H,
              quatint: WH,
              quest: jH,
              questeq: GH,
              quot: KH,
              QUOT: JH,
              rAarr: QH,
              race: XH,
              Racute: YH,
              racute: ZH,
              radic: e3,
              raemptyv: t3,
              rang: r3,
              Rang: n3,
              rangd: i3,
              range: a3,
              rangle: o3,
              raquo: s3,
              rarrap: l3,
              rarrb: u3,
              rarrbfs: c3,
              rarrc: f3,
              rarr: d3,
              Rarr: h3,
              rArr: p3,
              rarrfs: v3,
              rarrhk: m3,
              rarrlp: g3,
              rarrpl: y3,
              rarrsim: k3,
              Rarrtl: w3,
              rarrtl: b3,
              rarrw: C3,
              ratail: T3,
              rAtail: S3,
              ratio: x3,
              rationals: E3,
              rbarr: M3,
              rBarr: N3,
              RBarr: O3,
              rbbrk: D3,
              rbrace: A3,
              rbrack: L3,
              rbrke: R3,
              rbrksld: I3,
              rbrkslu: P3,
              Rcaron: B3,
              rcaron: F3,
              Rcedil: _3,
              rcedil: q3,
              rceil: z3,
              rcub: H3,
              Rcy: V3,
              rcy: U3,
              rdca: $3,
              rdldhar: W3,
              rdquo: j3,
              rdquor: G3,
              rdsh: K3,
              real: J3,
              realine: Q3,
              realpart: X3,
              reals: Y3,
              Re: Z3,
              rect: eV,
              reg: tV,
              REG: rV,
              ReverseElement: nV,
              ReverseEquilibrium: iV,
              ReverseUpEquilibrium: aV,
              rfisht: oV,
              rfloor: sV,
              rfr: lV,
              Rfr: uV,
              rHar: cV,
              rhard: fV,
              rharu: dV,
              rharul: hV,
              Rho: pV,
              rho: vV,
              rhov: mV,
              RightAngleBracket: gV,
              RightArrowBar: yV,
              rightarrow: kV,
              RightArrow: wV,
              Rightarrow: bV,
              RightArrowLeftArrow: CV,
              rightarrowtail: TV,
              RightCeiling: SV,
              RightDoubleBracket: xV,
              RightDownTeeVector: EV,
              RightDownVectorBar: MV,
              RightDownVector: NV,
              RightFloor: OV,
              rightharpoondown: DV,
              rightharpoonup: AV,
              rightleftarrows: LV,
              rightleftharpoons: RV,
              rightrightarrows: IV,
              rightsquigarrow: PV,
              RightTeeArrow: BV,
              RightTee: FV,
              RightTeeVector: _V,
              rightthreetimes: qV,
              RightTriangleBar: zV,
              RightTriangle: HV,
              RightTriangleEqual: VV,
              RightUpDownVector: UV,
              RightUpTeeVector: $V,
              RightUpVectorBar: WV,
              RightUpVector: jV,
              RightVectorBar: GV,
              RightVector: KV,
              ring: JV,
              risingdotseq: QV,
              rlarr: XV,
              rlhar: YV,
              rlm: ZV,
              rmoustache: eU,
              rmoust: tU,
              rnmid: rU,
              roang: nU,
              roarr: iU,
              robrk: aU,
              ropar: oU,
              ropf: sU,
              Ropf: lU,
              roplus: uU,
              rotimes: cU,
              RoundImplies: fU,
              rpar: dU,
              rpargt: hU,
              rppolint: pU,
              rrarr: vU,
              Rrightarrow: mU,
              rsaquo: gU,
              rscr: yU,
              Rscr: kU,
              rsh: wU,
              Rsh: bU,
              rsqb: CU,
              rsquo: TU,
              rsquor: SU,
              rthree: xU,
              rtimes: EU,
              rtri: MU,
              rtrie: NU,
              rtrif: OU,
              rtriltri: DU,
              RuleDelayed: AU,
              ruluhar: LU,
              rx: RU,
              Sacute: IU,
              sacute: PU,
              sbquo: BU,
              scap: FU,
              Scaron: _U,
              scaron: qU,
              Sc: zU,
              sc: HU,
              sccue: VU,
              sce: UU,
              scE: $U,
              Scedil: WU,
              scedil: jU,
              Scirc: GU,
              scirc: KU,
              scnap: JU,
              scnE: QU,
              scnsim: XU,
              scpolint: YU,
              scsim: ZU,
              Scy: e$,
              scy: t$,
              sdotb: r$,
              sdot: n$,
              sdote: i$,
              searhk: a$,
              searr: o$,
              seArr: s$,
              searrow: l$,
              sect: u$,
              semi: c$,
              seswar: f$,
              setminus: d$,
              setmn: h$,
              sext: p$,
              Sfr: v$,
              sfr: m$,
              sfrown: g$,
              sharp: y$,
              SHCHcy: k$,
              shchcy: w$,
              SHcy: b$,
              shcy: C$,
              ShortDownArrow: T$,
              ShortLeftArrow: S$,
              shortmid: x$,
              shortparallel: E$,
              ShortRightArrow: M$,
              ShortUpArrow: N$,
              shy: O$,
              Sigma: D$,
              sigma: A$,
              sigmaf: L$,
              sigmav: R$,
              sim: I$,
              simdot: P$,
              sime: B$,
              simeq: F$,
              simg: _$,
              simgE: q$,
              siml: z$,
              simlE: H$,
              simne: V$,
              simplus: U$,
              simrarr: $$,
              slarr: W$,
              SmallCircle: j$,
              smallsetminus: G$,
              smashp: K$,
              smeparsl: J$,
              smid: Q$,
              smile: X$,
              smt: Y$,
              smte: Z$,
              smtes: e4,
              SOFTcy: t4,
              softcy: r4,
              solbar: n4,
              solb: i4,
              sol: a4,
              Sopf: o4,
              sopf: s4,
              spades: l4,
              spadesuit: u4,
              spar: c4,
              sqcap: f4,
              sqcaps: d4,
              sqcup: h4,
              sqcups: p4,
              Sqrt: v4,
              sqsub: m4,
              sqsube: g4,
              sqsubset: y4,
              sqsubseteq: k4,
              sqsup: w4,
              sqsupe: b4,
              sqsupset: C4,
              sqsupseteq: T4,
              square: S4,
              Square: x4,
              SquareIntersection: E4,
              SquareSubset: M4,
              SquareSubsetEqual: N4,
              SquareSuperset: O4,
              SquareSupersetEqual: D4,
              SquareUnion: A4,
              squarf: L4,
              squ: R4,
              squf: I4,
              srarr: P4,
              Sscr: B4,
              sscr: F4,
              ssetmn: _4,
              ssmile: q4,
              sstarf: z4,
              Star: H4,
              star: V4,
              starf: U4,
              straightepsilon: $4,
              straightphi: W4,
              strns: j4,
              sub: G4,
              Sub: K4,
              subdot: J4,
              subE: Q4,
              sube: X4,
              subedot: Y4,
              submult: Z4,
              subnE: eW,
              subne: tW,
              subplus: rW,
              subrarr: nW,
              subset: iW,
              Subset: aW,
              subseteq: oW,
              subseteqq: sW,
              SubsetEqual: lW,
              subsetneq: uW,
              subsetneqq: cW,
              subsim: fW,
              subsub: dW,
              subsup: hW,
              succapprox: pW,
              succ: vW,
              succcurlyeq: mW,
              Succeeds: gW,
              SucceedsEqual: yW,
              SucceedsSlantEqual: kW,
              SucceedsTilde: wW,
              succeq: bW,
              succnapprox: CW,
              succneqq: TW,
              succnsim: SW,
              succsim: xW,
              SuchThat: EW,
              sum: MW,
              Sum: NW,
              sung: OW,
              sup1: DW,
              sup2: AW,
              sup3: LW,
              sup: RW,
              Sup: IW,
              supdot: PW,
              supdsub: BW,
              supE: FW,
              supe: _W,
              supedot: qW,
              Superset: zW,
              SupersetEqual: HW,
              suphsol: VW,
              suphsub: UW,
              suplarr: $W,
              supmult: WW,
              supnE: jW,
              supne: GW,
              supplus: KW,
              supset: JW,
              Supset: QW,
              supseteq: XW,
              supseteqq: YW,
              supsetneq: ZW,
              supsetneqq: ej,
              supsim: tj,
              supsub: rj,
              supsup: nj,
              swarhk: ij,
              swarr: aj,
              swArr: oj,
              swarrow: sj,
              swnwar: lj,
              szlig: uj,
              Tab: cj,
              target: fj,
              Tau: dj,
              tau: hj,
              tbrk: pj,
              Tcaron: vj,
              tcaron: mj,
              Tcedil: gj,
              tcedil: yj,
              Tcy: kj,
              tcy: wj,
              tdot: bj,
              telrec: Cj,
              Tfr: Tj,
              tfr: Sj,
              there4: xj,
              therefore: Ej,
              Therefore: Mj,
              Theta: Nj,
              theta: Oj,
              thetasym: Dj,
              thetav: Aj,
              thickapprox: Lj,
              thicksim: Rj,
              ThickSpace: Ij,
              ThinSpace: Pj,
              thinsp: Bj,
              thkap: Fj,
              thksim: _j,
              THORN: qj,
              thorn: zj,
              tilde: Hj,
              Tilde: Vj,
              TildeEqual: Uj,
              TildeFullEqual: $j,
              TildeTilde: Wj,
              timesbar: jj,
              timesb: Gj,
              times: Kj,
              timesd: Jj,
              tint: Qj,
              toea: Xj,
              topbot: Yj,
              topcir: Zj,
              top: e8,
              Topf: t8,
              topf: r8,
              topfork: n8,
              tosa: i8,
              tprime: a8,
              trade: o8,
              TRADE: s8,
              triangle: l8,
              triangledown: u8,
              triangleleft: c8,
              trianglelefteq: f8,
              triangleq: d8,
              triangleright: h8,
              trianglerighteq: p8,
              tridot: v8,
              trie: m8,
              triminus: g8,
              TripleDot: y8,
              triplus: k8,
              trisb: w8,
              tritime: b8,
              trpezium: C8,
              Tscr: T8,
              tscr: S8,
              TScy: x8,
              tscy: E8,
              TSHcy: M8,
              tshcy: N8,
              Tstrok: O8,
              tstrok: D8,
              twixt: A8,
              twoheadleftarrow: L8,
              twoheadrightarrow: R8,
              Uacute: I8,
              uacute: P8,
              uarr: B8,
              Uarr: F8,
              uArr: _8,
              Uarrocir: q8,
              Ubrcy: z8,
              ubrcy: H8,
              Ubreve: V8,
              ubreve: U8,
              Ucirc: $8,
              ucirc: W8,
              Ucy: j8,
              ucy: G8,
              udarr: K8,
              Udblac: J8,
              udblac: Q8,
              udhar: X8,
              ufisht: Y8,
              Ufr: Z8,
              ufr: e5,
              Ugrave: t5,
              ugrave: r5,
              uHar: n5,
              uharl: i5,
              uharr: a5,
              uhblk: o5,
              ulcorn: s5,
              ulcorner: l5,
              ulcrop: u5,
              ultri: c5,
              Umacr: f5,
              umacr: d5,
              uml: h5,
              UnderBar: p5,
              UnderBrace: v5,
              UnderBracket: m5,
              UnderParenthesis: g5,
              Union: y5,
              UnionPlus: k5,
              Uogon: w5,
              uogon: b5,
              Uopf: C5,
              uopf: T5,
              UpArrowBar: S5,
              uparrow: x5,
              UpArrow: E5,
              Uparrow: M5,
              UpArrowDownArrow: N5,
              updownarrow: O5,
              UpDownArrow: D5,
              Updownarrow: A5,
              UpEquilibrium: L5,
              upharpoonleft: R5,
              upharpoonright: I5,
              uplus: P5,
              UpperLeftArrow: B5,
              UpperRightArrow: F5,
              upsi: _5,
              Upsi: q5,
              upsih: z5,
              Upsilon: H5,
              upsilon: V5,
              UpTeeArrow: U5,
              UpTee: $5,
              upuparrows: W5,
              urcorn: j5,
              urcorner: G5,
              urcrop: K5,
              Uring: J5,
              uring: Q5,
              urtri: X5,
              Uscr: Y5,
              uscr: Z5,
              utdot: e6,
              Utilde: t6,
              utilde: r6,
              utri: n6,
              utrif: i6,
              uuarr: a6,
              Uuml: o6,
              uuml: s6,
              uwangle: l6,
              vangrt: u6,
              varepsilon: c6,
              varkappa: f6,
              varnothing: d6,
              varphi: h6,
              varpi: p6,
              varpropto: v6,
              varr: m6,
              vArr: g6,
              varrho: y6,
              varsigma: k6,
              varsubsetneq: w6,
              varsubsetneqq: b6,
              varsupsetneq: C6,
              varsupsetneqq: T6,
              vartheta: S6,
              vartriangleleft: x6,
              vartriangleright: E6,
              vBar: M6,
              Vbar: N6,
              vBarv: O6,
              Vcy: D6,
              vcy: A6,
              vdash: L6,
              vDash: R6,
              Vdash: I6,
              VDash: P6,
              Vdashl: B6,
              veebar: F6,
              vee: _6,
              Vee: q6,
              veeeq: z6,
              vellip: H6,
              verbar: V6,
              Verbar: U6,
              vert: $6,
              Vert: W6,
              VerticalBar: j6,
              VerticalLine: G6,
              VerticalSeparator: K6,
              VerticalTilde: J6,
              VeryThinSpace: Q6,
              Vfr: X6,
              vfr: Y6,
              vltri: Z6,
              vnsub: e9,
              vnsup: t9,
              Vopf: r9,
              vopf: n9,
              vprop: i9,
              vrtri: a9,
              Vscr: o9,
              vscr: s9,
              vsubnE: l9,
              vsubne: u9,
              vsupnE: c9,
              vsupne: f9,
              Vvdash: d9,
              vzigzag: h9,
              Wcirc: p9,
              wcirc: v9,
              wedbar: m9,
              wedge: g9,
              Wedge: y9,
              wedgeq: k9,
              weierp: w9,
              Wfr: b9,
              wfr: C9,
              Wopf: T9,
              wopf: S9,
              wp: x9,
              wr: E9,
              wreath: M9,
              Wscr: N9,
              wscr: O9,
              xcap: D9,
              xcirc: A9,
              xcup: L9,
              xdtri: R9,
              Xfr: I9,
              xfr: P9,
              xharr: B9,
              xhArr: F9,
              Xi: _9,
              xi: q9,
              xlarr: z9,
              xlArr: H9,
              xmap: V9,
              xnis: U9,
              xodot: $9,
              Xopf: W9,
              xopf: j9,
              xoplus: G9,
              xotime: K9,
              xrarr: J9,
              xrArr: Q9,
              Xscr: X9,
              xscr: Y9,
              xsqcup: Z9,
              xuplus: eG,
              xutri: tG,
              xvee: rG,
              xwedge: nG,
              Yacute: iG,
              yacute: aG,
              YAcy: oG,
              yacy: sG,
              Ycirc: lG,
              ycirc: uG,
              Ycy: cG,
              ycy: fG,
              yen: dG,
              Yfr: hG,
              yfr: pG,
              YIcy: vG,
              yicy: mG,
              Yopf: gG,
              yopf: yG,
              Yscr: kG,
              yscr: wG,
              YUcy: bG,
              yucy: CG,
              yuml: TG,
              Yuml: SG,
              Zacute: xG,
              zacute: EG,
              Zcaron: MG,
              zcaron: NG,
              Zcy: OG,
              zcy: DG,
              Zdot: AG,
              zdot: LG,
              zeetrf: RG,
              ZeroWidthSpace: IG,
              Zeta: PG,
              zeta: BG,
              zfr: FG,
              Zfr: _G,
              ZHcy: qG,
              zhcy: zG,
              zigrarr: HG,
              zopf: VG,
              Zopf: UG,
              Zscr: $G,
              zscr: WG,
              zwj: jG,
              zwnj: GG
            }, KG = "Á", JG = "á", QG = "Â", XG = "â", YG = "´", ZG = "Æ", e7 = "æ", t7 = "À", r7 = "à", n7 = "&", i7 = "&", a7 = "Å", o7 = "å", s7 = "Ã", l7 = "ã", u7 = "Ä", c7 = "ä", f7 = "¦", d7 = "Ç", h7 = "ç", p7 = "¸", v7 = "¢", m7 = "©", g7 = "©", y7 = "¤", k7 = "°", w7 = "÷", b7 = "É", C7 = "é", T7 = "Ê", S7 = "ê", x7 = "È", E7 = "è", M7 = "Ð", N7 = "ð", O7 = "Ë", D7 = "ë", A7 = "½", L7 = "¼", R7 = "¾", I7 = ">", P7 = ">", B7 = "Í", F7 = "í", _7 = "Î", q7 = "î", z7 = "¡", H7 = "Ì", V7 = "ì", U7 = "¿", $7 = "Ï", W7 = "ï", j7 = "«", G7 = "<", K7 = "<", J7 = "¯", Q7 = "µ", X7 = "·", Y7 = " ", Z7 = "¬", eK = "Ñ", tK = "ñ", rK = "Ó", nK = "ó", iK = "Ô", aK = "ô", oK = "Ò", sK = "ò", lK = "ª", uK = "º", cK = "Ø", fK = "ø", dK = "Õ", hK = "õ", pK = "Ö", vK = "ö", mK = "¶", gK = "±", yK = "£", kK = '"', wK = '"', bK = "»", CK = "®", TK = "®", SK = "§", xK = "­", EK = "¹", MK = "²", NK = "³", OK = "ß", DK = "Þ", AK = "þ", LK = "×", RK = "Ú", IK = "ú", PK = "Û", BK = "û", FK = "Ù", _K = "ù", qK = "¨", zK = "Ü", HK = "ü", VK = "Ý", UK = "ý", $K = "¥", WK = "ÿ", jK = {
              Aacute: KG,
              aacute: JG,
              Acirc: QG,
              acirc: XG,
              acute: YG,
              AElig: ZG,
              aelig: e7,
              Agrave: t7,
              agrave: r7,
              amp: n7,
              AMP: i7,
              Aring: a7,
              aring: o7,
              Atilde: s7,
              atilde: l7,
              Auml: u7,
              auml: c7,
              brvbar: f7,
              Ccedil: d7,
              ccedil: h7,
              cedil: p7,
              cent: v7,
              copy: m7,
              COPY: g7,
              curren: y7,
              deg: k7,
              divide: w7,
              Eacute: b7,
              eacute: C7,
              Ecirc: T7,
              ecirc: S7,
              Egrave: x7,
              egrave: E7,
              ETH: M7,
              eth: N7,
              Euml: O7,
              euml: D7,
              frac12: A7,
              frac14: L7,
              frac34: R7,
              gt: I7,
              GT: P7,
              Iacute: B7,
              iacute: F7,
              Icirc: _7,
              icirc: q7,
              iexcl: z7,
              Igrave: H7,
              igrave: V7,
              iquest: U7,
              Iuml: $7,
              iuml: W7,
              laquo: j7,
              lt: G7,
              LT: K7,
              macr: J7,
              micro: Q7,
              middot: X7,
              nbsp: Y7,
              not: Z7,
              Ntilde: eK,
              ntilde: tK,
              Oacute: rK,
              oacute: nK,
              Ocirc: iK,
              ocirc: aK,
              Ograve: oK,
              ograve: sK,
              ordf: lK,
              ordm: uK,
              Oslash: cK,
              oslash: fK,
              Otilde: dK,
              otilde: hK,
              Ouml: pK,
              ouml: vK,
              para: mK,
              plusmn: gK,
              pound: yK,
              quot: kK,
              QUOT: wK,
              raquo: bK,
              reg: CK,
              REG: TK,
              sect: SK,
              shy: xK,
              sup1: EK,
              sup2: MK,
              sup3: NK,
              szlig: OK,
              THORN: DK,
              thorn: AK,
              times: LK,
              Uacute: RK,
              uacute: IK,
              Ucirc: PK,
              ucirc: BK,
              Ugrave: FK,
              ugrave: _K,
              uml: qK,
              Uuml: zK,
              uuml: HK,
              Yacute: VK,
              yacute: UK,
              yen: $K,
              yuml: WK
            }, GK = "&", KK = "'", JK = ">", QK = "<", XK = '"', Hk = {
              amp: GK,
              apos: KK,
              gt: JK,
              lt: QK,
              quot: XK
            }, Og = {}, YK = {
              0: 65533,
              128: 8364,
              130: 8218,
              131: 402,
              132: 8222,
              133: 8230,
              134: 8224,
              135: 8225,
              136: 710,
              137: 8240,
              138: 352,
              139: 8249,
              140: 338,
              142: 381,
              145: 8216,
              146: 8217,
              147: 8220,
              148: 8221,
              149: 8226,
              150: 8211,
              151: 8212,
              152: 732,
              153: 8482,
              154: 353,
              155: 8250,
              156: 339,
              158: 382,
              159: 376
            }, ZK = j && j.__importDefault || function(m) {
              return m && m.__esModule ? m : { default: m };
            };
            Object.defineProperty(Og, "__esModule", { value: !0 });
            var Vk = ZK(YK), eJ = (
              // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
              String.fromCodePoint || function(m) {
                var v = "";
                return m > 65535 && (m -= 65536, v += String.fromCharCode(m >>> 10 & 1023 | 55296), m = 56320 | m & 1023), v += String.fromCharCode(m), v;
              }
            );
            function tJ(m) {
              return m >= 55296 && m <= 57343 || m > 1114111 ? "�" : (m in Vk.default && (m = Vk.default[m]), eJ(m));
            }
            Og.default = tJ;
            var sv = j && j.__importDefault || function(m) {
              return m && m.__esModule ? m : { default: m };
            };
            Object.defineProperty(ke, "__esModule", { value: !0 }), ke.decodeHTML = ke.decodeHTMLStrict = ke.decodeXML = void 0;
            var Dg = sv(zk), rJ = sv(jK), nJ = sv(Hk), Uk = sv(Og), iJ = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
            ke.decodeXML = $k(nJ.default), ke.decodeHTMLStrict = $k(Dg.default);
            function $k(m) {
              var v = jk(m);
              return function(C) {
                return String(C).replace(iJ, v);
              };
            }
            var Wk = function(m, v) {
              return m < v ? 1 : -1;
            };
            ke.decodeHTML = (function() {
              for (var m = Object.keys(rJ.default).sort(Wk), v = Object.keys(Dg.default).sort(Wk), C = 0, D = 0; C < v.length; C++)
                m[D] === v[C] ? (v[C] += ";?", D++) : v[C] += ";";
              var _ = new RegExp("&(?:" + v.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"), J = jk(Dg.default);
              function ee(ce) {
                return ce.substr(-1) !== ";" && (ce += ";"), J(ce);
              }
              return function(ce) {
                return String(ce).replace(_, ee);
              };
            })();
            function jk(m) {
              return function(C) {
                if (C.charAt(1) === "#") {
                  var D = C.charAt(2);
                  return D === "X" || D === "x" ? Uk.default(parseInt(C.substr(3), 16)) : Uk.default(parseInt(C.substr(2), 10));
                }
                return m[C.slice(1, -1)] || C;
              };
            }
            var sa = {}, Gk = j && j.__importDefault || function(m) {
              return m && m.__esModule ? m : { default: m };
            };
            Object.defineProperty(sa, "__esModule", { value: !0 }), sa.escapeUTF8 = sa.escape = sa.encodeNonAsciiHTML = sa.encodeHTML = sa.encodeXML = void 0;
            var aJ = Gk(Hk), Kk = Qk(aJ.default), Jk = Xk(Kk);
            sa.encodeXML = ew(Kk);
            var oJ = Gk(zk), Ag = Qk(oJ.default), sJ = Xk(Ag);
            sa.encodeHTML = uJ(Ag, sJ), sa.encodeNonAsciiHTML = ew(Ag);
            function Qk(m) {
              return Object.keys(m).sort().reduce(function(v, C) {
                return v[m[C]] = "&" + C + ";", v;
              }, {});
            }
            function Xk(m) {
              for (var v = [], C = [], D = 0, _ = Object.keys(m); D < _.length; D++) {
                var J = _[D];
                J.length === 1 ? v.push("\\" + J) : C.push(J);
              }
              v.sort();
              for (var ee = 0; ee < v.length - 1; ee++) {
                for (var ce = ee; ce < v.length - 1 && v[ce].charCodeAt(1) + 1 === v[ce + 1].charCodeAt(1); )
                  ce += 1;
                var qe = 1 + ce - ee;
                qe < 3 || v.splice(ee, qe, v[ee] + "-" + v[ce]);
              }
              return C.unshift("[" + v.join("") + "]"), new RegExp(C.join("|"), "g");
            }
            var Yk = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, lJ = (
              // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
              String.prototype.codePointAt != null ? (
                // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
                function(m) {
                  return m.codePointAt(0);
                }
              ) : (
                // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
                function(m) {
                  return (m.charCodeAt(0) - 55296) * 1024 + m.charCodeAt(1) - 56320 + 65536;
                }
              )
            );
            function lv(m) {
              return "&#x" + (m.length > 1 ? lJ(m) : m.charCodeAt(0)).toString(16).toUpperCase() + ";";
            }
            function uJ(m, v) {
              return function(C) {
                return C.replace(v, function(D) {
                  return m[D];
                }).replace(Yk, lv);
              };
            }
            var Zk = new RegExp(Jk.source + "|" + Yk.source, "g");
            function cJ(m) {
              return m.replace(Zk, lv);
            }
            sa.escape = cJ;
            function fJ(m) {
              return m.replace(Jk, lv);
            }
            sa.escapeUTF8 = fJ;
            function ew(m) {
              return function(v) {
                return v.replace(Zk, function(C) {
                  return m[C] || lv(C);
                });
              };
            }
            (function(m) {
              Object.defineProperty(m, "__esModule", { value: !0 }), m.decodeXMLStrict = m.decodeHTML5Strict = m.decodeHTML4Strict = m.decodeHTML5 = m.decodeHTML4 = m.decodeHTMLStrict = m.decodeHTML = m.decodeXML = m.encodeHTML5 = m.encodeHTML4 = m.escapeUTF8 = m.escape = m.encodeNonAsciiHTML = m.encodeHTML = m.encodeXML = m.encode = m.decodeStrict = m.decode = void 0;
              var v = ke, C = sa;
              function D(qe, We) {
                return (!We || We <= 0 ? v.decodeXML : v.decodeHTML)(qe);
              }
              m.decode = D;
              function _(qe, We) {
                return (!We || We <= 0 ? v.decodeXML : v.decodeHTMLStrict)(qe);
              }
              m.decodeStrict = _;
              function J(qe, We) {
                return (!We || We <= 0 ? C.encodeXML : C.encodeHTML)(qe);
              }
              m.encode = J;
              var ee = sa;
              Object.defineProperty(m, "encodeXML", { enumerable: !0, get: function() {
                return ee.encodeXML;
              } }), Object.defineProperty(m, "encodeHTML", { enumerable: !0, get: function() {
                return ee.encodeHTML;
              } }), Object.defineProperty(m, "encodeNonAsciiHTML", { enumerable: !0, get: function() {
                return ee.encodeNonAsciiHTML;
              } }), Object.defineProperty(m, "escape", { enumerable: !0, get: function() {
                return ee.escape;
              } }), Object.defineProperty(m, "escapeUTF8", { enumerable: !0, get: function() {
                return ee.escapeUTF8;
              } }), Object.defineProperty(m, "encodeHTML4", { enumerable: !0, get: function() {
                return ee.encodeHTML;
              } }), Object.defineProperty(m, "encodeHTML5", { enumerable: !0, get: function() {
                return ee.encodeHTML;
              } });
              var ce = ke;
              Object.defineProperty(m, "decodeXML", { enumerable: !0, get: function() {
                return ce.decodeXML;
              } }), Object.defineProperty(m, "decodeHTML", { enumerable: !0, get: function() {
                return ce.decodeHTML;
              } }), Object.defineProperty(m, "decodeHTMLStrict", { enumerable: !0, get: function() {
                return ce.decodeHTMLStrict;
              } }), Object.defineProperty(m, "decodeHTML4", { enumerable: !0, get: function() {
                return ce.decodeHTML;
              } }), Object.defineProperty(m, "decodeHTML5", { enumerable: !0, get: function() {
                return ce.decodeHTML;
              } }), Object.defineProperty(m, "decodeHTML4Strict", { enumerable: !0, get: function() {
                return ce.decodeHTMLStrict;
              } }), Object.defineProperty(m, "decodeHTML5Strict", { enumerable: !0, get: function() {
                return ce.decodeHTMLStrict;
              } }), Object.defineProperty(m, "decodeXMLStrict", { enumerable: !0, get: function() {
                return ce.decodeXML;
              } });
            })(pe);
            var tw = "&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});", dJ = 92, hJ = /[\\&]/, Lg = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]", pJ = new RegExp("\\\\" + Lg + "|" + tw, "gi"), vJ = '[&<>"]', rw = new RegExp(vJ, "g"), mJ = function(m) {
              return m.charCodeAt(0) === dJ ? m.charAt(1) : pe.decodeHTML(m);
            };
            function jd(m) {
              return hJ.test(m) ? m.replace(pJ, mJ) : m;
            }
            function uv(m) {
              try {
                return Ce(m);
              } catch {
                return m;
              }
            }
            function gJ(m) {
              switch (m) {
                case "&":
                  return "&amp;";
                case "<":
                  return "&lt;";
                case ">":
                  return "&gt;";
                case '"':
                  return "&quot;";
                default:
                  return m;
              }
            }
            function Fc(m) {
              return rw.test(m) ? m.replace(rw, gJ) : m;
            }
            function Rg(m, v) {
              for (var C = [], D = 0; D < v; D++)
                C.push(m);
              return C.join("");
            }
            function nw(m) {
              return m ? !/[^ \t]+/.test(m) : !0;
            }
            var yJ = (
              /** @class */
              (function() {
                function m(v) {
                  this.current = v, this.root = v, this.entering = !0;
                }
                return m.prototype.next = function() {
                  var v = this.current, C = this.entering;
                  if (v === null)
                    return null;
                  var D = Ig(v);
                  return C && D ? v.firstChild ? (this.current = v.firstChild, this.entering = !0) : this.entering = !1 : v === this.root ? this.current = null : v.next === null ? (this.current = v.parent, this.entering = !1) : (this.current = v.next, this.entering = !0), { entering: C, node: v };
                }, m.prototype.resumeAt = function(v, C) {
                  this.current = v, this.entering = C === !0;
                }, m;
              })()
            );
            function Ig(m) {
              switch (m.type) {
                case "document":
                case "blockQuote":
                case "list":
                case "item":
                case "paragraph":
                case "heading":
                case "emph":
                case "strong":
                case "strike":
                case "link":
                case "image":
                case "table":
                case "tableHead":
                case "tableBody":
                case "tableRow":
                case "tableCell":
                case "tableDelimRow":
                case "customInline":
                  return !0;
                default:
                  return !1;
              }
            }
            var kJ = 1, cv = {};
            function wJ(m) {
              return cv[m];
            }
            function Pg(m) {
              delete cv[m];
            }
            function bJ() {
              cv = {};
            }
            var Gd = (
              /** @class */
              (function() {
                function m(v, C) {
                  this.parent = null, this.prev = null, this.next = null, this.firstChild = null, this.lastChild = null, this.literal = null, v === "document" ? this.id = -1 : this.id = kJ++, this.type = v, this.sourcepos = C, cv[this.id] = this;
                }
                return m.prototype.isContainer = function() {
                  return Ig(this);
                }, m.prototype.unlink = function() {
                  this.prev ? this.prev.next = this.next : this.parent && (this.parent.firstChild = this.next), this.next ? this.next.prev = this.prev : this.parent && (this.parent.lastChild = this.prev), this.parent = null, this.next = null, this.prev = null;
                }, m.prototype.replaceWith = function(v) {
                  this.insertBefore(v), this.unlink();
                }, m.prototype.insertAfter = function(v) {
                  v.unlink(), v.next = this.next, v.next && (v.next.prev = v), v.prev = this, this.next = v, this.parent && (v.parent = this.parent, v.next || (v.parent.lastChild = v));
                }, m.prototype.insertBefore = function(v) {
                  v.unlink(), v.prev = this.prev, v.prev && (v.prev.next = v), v.next = this, this.prev = v, v.parent = this.parent, v.prev || (v.parent.firstChild = v);
                }, m.prototype.appendChild = function(v) {
                  v.unlink(), v.parent = this, this.lastChild ? (this.lastChild.next = v, v.prev = this.lastChild, this.lastChild = v) : (this.firstChild = v, this.lastChild = v);
                }, m.prototype.prependChild = function(v) {
                  v.unlink(), v.parent = this, this.firstChild ? (this.firstChild.prev = v, v.next = this.firstChild, this.firstChild = v) : (this.firstChild = v, this.lastChild = v);
                }, m.prototype.walker = function() {
                  return new yJ(this);
                }, m;
              })()
            ), fs = (
              /** @class */
              (function(m) {
                A(v, m);
                function v(C, D) {
                  var _ = m.call(this, C, D) || this;
                  return _.open = !0, _.lineOffsets = null, _.stringContent = null, _.lastLineBlank = !1, _.lastLineChecked = !1, _.type = C, _;
                }
                return v;
              })(Gd)
            ), CJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.listData = null, C;
                }
                return v;
              })(fs)
            ), TJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.level = 0, C.headingType = "atx", C;
                }
                return v;
              })(fs)
            ), SJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.isFenced = !1, C.fenceChar = null, C.fenceLength = 0, C.fenceOffset = -1, C.info = null, C.infoPadding = 0, C;
                }
                return v;
              })(fs)
            ), xJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.columns = [], C;
                }
                return v;
              })(fs)
            ), EJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.startIdx = 0, C.endIdx = 0, C.paddingLeft = 0, C.paddingRight = 0, C.ignored = !1, C;
                }
                return v;
              })(fs)
            ), MJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.title = "", C.dest = "", C.label = "", C;
                }
                return v;
              })(fs)
            ), NJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.syntaxLength = 0, C.offset = -1, C.info = "", C;
                }
                return v;
              })(fs)
            ), OJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.htmlBlockType = -1, C;
                }
                return v;
              })(fs)
            ), DJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.destination = null, C.title = null, C.extendedAutolink = !1, C;
                }
                return v;
              })(Gd)
            ), AJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.tickCount = 0, C;
                }
                return v;
              })(Gd)
            ), LJ = (
              /** @class */
              (function(m) {
                A(v, m);
                function v() {
                  var C = m !== null && m.apply(this, arguments) || this;
                  return C.info = "", C;
                }
                return v;
              })(Gd)
            );
            function on(m, v) {
              switch (m) {
                case "heading":
                  return new TJ(m, v);
                case "list":
                case "item":
                  return new CJ(m, v);
                case "link":
                case "image":
                  return new DJ(m, v);
                case "codeBlock":
                  return new SJ(m, v);
                case "htmlBlock":
                  return new OJ(m, v);
                case "table":
                  return new xJ(m, v);
                case "tableCell":
                  return new EJ(m, v);
                case "document":
                case "paragraph":
                case "blockQuote":
                case "thematicBreak":
                case "tableRow":
                case "tableBody":
                case "tableHead":
                case "frontMatter":
                  return new fs(m, v);
                case "code":
                  return new AJ(m, v);
                case "refDef":
                  return new MJ(m, v);
                case "customBlock":
                  return new NJ(m, v);
                case "customInline":
                  return new LJ(m, v);
                default:
                  return new Gd(m, v);
              }
            }
            function iw(m) {
              return m.type === "codeBlock";
            }
            function RJ(m) {
              return m.type === "htmlBlock";
            }
            function IJ(m) {
              return m.type === "heading";
            }
            function aw(m) {
              return m.type === "list";
            }
            function PJ(m) {
              return m.type === "table";
            }
            function _c(m) {
              return m.type === "refDef";
            }
            function ow(m) {
              return m.type === "customBlock";
            }
            function BJ(m) {
              return m.type === "customInline";
            }
            function Cn(m, v) {
              var C = on("text", v);
              return C.literal = m, C;
            }
            var sw = "[A-Za-z][A-Za-z0-9-]*", FJ = "[a-zA-Z_:][a-zA-Z0-9:._-]*", _J = "[^\"'=<>`\\x00-\\x20]+", qJ = "'[^']*'", zJ = '"[^"]*"', HJ = "(?:" + _J + "|" + qJ + "|" + zJ + ")", VJ = "(?:\\s*=\\s*" + HJ + ")", UJ = "(?:\\s+" + FJ + VJ + "?)", lw = "<" + sw + UJ + "*\\s*/?>", uw = "</" + sw + "\\s*[>]", $J = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->", WJ = "[<][?].*?[?][>]", jJ = "<![A-Z]+\\s+[^>]*>", GJ = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>", KJ = "(?:" + lw + "|" + uw + "|" + $J + "|" + WJ + "|" + jJ + "|" + GJ + ")", JJ = new RegExp("^" + KJ, "i");
            var Bg;
            if (String.fromCodePoint)
              Bg = function(m) {
                try {
                  return String.fromCodePoint(m);
                } catch (v) {
                  if (v instanceof RangeError)
                    return "�";
                  throw v;
                }
              };
            else {
              var QJ = String.fromCharCode, XJ = Math.floor;
              Bg = function() {
                for (var m = [], v = 0; v < arguments.length; v++)
                  m[v] = arguments[v];
                var C = 16384, D = [], _, J, ee = -1, ce = m.length;
                if (!ce)
                  return "";
                for (var qe = ""; ++ee < ce; ) {
                  var We = Number(m[ee]);
                  if (!isFinite(We) || // `NaN`, `+Infinity`, or `-Infinity`
                  We < 0 || // not a valid Unicode code point
                  We > 1114111 || // not a valid Unicode code point
                  XJ(We) !== We)
                    return "�";
                  We <= 65535 ? D.push(We) : (We -= 65536, _ = (We >> 10) + 55296, J = We % 1024 + 56320, D.push(_, J)), (ee + 1 === ce || D.length > C) && (qe += QJ.apply(void 0, D), D.length = 0);
                }
                return qe;
              };
            }
            var Fg = Bg, YJ = "(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+", ZJ = "[^<\\s]*[^<?!.,:*_?~\\s]", eQ = "[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+";
            function tQ(m) {
              var v = /\)+$/.exec(m);
              if (v) {
                for (var C = 0, D = 0, _ = m; D < _.length; D++) {
                  var J = _[D];
                  J === "(" ? C < 0 ? C = 1 : C += 1 : J === ")" && (C -= 1);
                }
                if (C < 0) {
                  var ee = Math.min(-C, v[0].length);
                  return m.substring(0, m.length - ee);
                }
              }
              return m;
            }
            function rQ(m) {
              return m.replace(/&[A-Za-z0-9]+;$/, "");
            }
            function nQ(m) {
              for (var v = new RegExp(eQ, "g"), C = [], D; D = v.exec(m); ) {
                var _ = D[0];
                /[_-]+$/.test(_) || C.push({
                  text: _,
                  range: [D.index, D.index + _.length - 1],
                  url: "mailto:" + _
                });
              }
              return C;
            }
            function iQ(m) {
              for (var v = new RegExp("(www|https?://)." + YJ + ZJ, "g"), C = [], D; D = v.exec(m); ) {
                var _ = rQ(tQ(D[0])), J = D[1] === "www" ? "http://" : "";
                C.push({
                  text: _,
                  range: [D.index, D.index + _.length - 1],
                  url: "" + J + _
                });
              }
              return C;
            }
            function aQ(m) {
              return U(U([], iQ(m)), nQ(m)).sort(function(v, C) {
                return v.range[0] - C.range[0];
              });
            }
            function oQ(m, v) {
              typeof v == "boolean" && (v = aQ);
              for (var C, D = function() {
                var _ = C.entering, J = C.node;
                if (_ && J.type === "text" && J.parent.type !== "link") {
                  var ee = J.literal, ce = v(ee);
                  if (!ce || !ce.length)
                    return "continue";
                  for (var qe = 0, We = J.sourcepos[0], ft = We[0], mt = We[1], ot = function(vs, mZ) {
                    return [
                      [ft, mt + vs],
                      [ft, mt + mZ]
                    ];
                  }, Bt = [], Pt = 0, gr = ce; Pt < gr.length; Pt++) {
                    var sn = gr[Pt], Pn = sn.range, ds = sn.url, Ca = sn.text;
                    Pn[0] > qe && Bt.push(Cn(ee.substring(qe, Pn[0]), ot(qe, Pn[0] - 1)));
                    var ua = on("link", ot.apply(void 0, Pn));
                    ua.appendChild(Cn(Ca, ot.apply(void 0, Pn))), ua.destination = ds, ua.extendedAutolink = !0, Bt.push(ua), qe = Pn[1] + 1;
                  }
                  qe < ee.length && Bt.push(Cn(ee.substring(qe), ot(qe, ee.length - 1)));
                  for (var Ka = 0, hs = Bt; Ka < hs.length; Ka++) {
                    var ps = hs[Ka];
                    J.insertBefore(ps);
                  }
                  J.unlink();
                }
              }; C = m.next(); )
                D();
            }
            function fv(m) {
              return m[m.length - 1];
            }
            function cw(m) {
              return m.slice(1, m.length - 1).trim().replace(/[ \t\r\n]+/, " ").toLowerCase().toUpperCase();
            }
            function dv(m, v) {
              Object.keys(m).forEach(function(C) {
                v(C, m[C]);
              });
            }
            function sQ(m) {
              for (var v = [], C = 1; C < arguments.length; C++)
                v[C - 1] = arguments[C];
              var D = q({}, m);
              return v.forEach(function(_) {
                delete D[_];
              }), D;
            }
            function qc(m) {
              return !Object.keys(m).length;
            }
            function lQ(m) {
              Object.keys(m).forEach(function(v) {
                delete m[v];
              });
            }
            var _g = 10, qg = 42, hv = 95, uQ = 96, fw = 91, cQ = 93, pv = 126, dw = 60, fQ = 33, hw = 92, dQ = 38, pw = 40, zg = 41, hQ = 58, nu = 39, iu = 34, au = 36, Hg = "\\\\" + Lg, vw = new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/), pQ = new RegExp('^(?:"(' + Hg + '|[^"\\x00])*"|' + ("'(" + Hg + "|[^'\\x00])*'") + "|" + ("\\((" + Hg + "|[^()\\x00])*\\))")), vQ = /^(?:<(?:[^<>\n\\\x00]|\\.)*>)/, mw = new RegExp("^" + Lg), mQ = new RegExp("^" + tw, "i"), gQ = /`+/, yQ = /^`+/, kQ = /\.\.\./g, wQ = /--+/g, bQ = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/, CQ = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i, TQ = /^ *(?:\n *)?/, Vg = /^[ \t\n\x0b\x0c\x0d]/, gw = /^\s/, SQ = / *$/, xQ = /^ */, yw = /^ *(?:\n|$)/, EQ = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/, MQ = /^[^\n`\[\]\\!<&*_'"~$]+/m, NQ = (
              /** @class */
              (function() {
                function m(v) {
                  this.subject = "", this.delimiters = null, this.brackets = null, this.pos = 0, this.lineStartNum = 0, this.lineIdx = 0, this.lineOffsets = [0], this.linePosOffset = 0, this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.options = v;
                }
                return m.prototype.sourcepos = function(v, C) {
                  var D = this.linePosOffset + this.lineOffsets[this.lineIdx], _ = this.lineStartNum + this.lineIdx, J = [_, v + D];
                  return typeof C == "number" ? [J, [_, C + D]] : J;
                }, m.prototype.nextLine = function() {
                  this.lineIdx += 1, this.linePosOffset = -this.pos;
                }, m.prototype.match = function(v) {
                  var C = v.exec(this.subject.slice(this.pos));
                  return C === null ? null : (this.pos += C.index + C[0].length, C[0]);
                }, m.prototype.peek = function() {
                  return this.pos < this.subject.length ? this.subject.charCodeAt(this.pos) : -1;
                }, m.prototype.spnl = function() {
                  return this.match(TQ), !0;
                }, m.prototype.parseBackticks = function(v) {
                  var C = this.pos + 1, D = this.match(yQ);
                  if (D === null)
                    return !1;
                  for (var _ = this.pos, J; (J = this.match(gQ)) !== null; )
                    if (J === D) {
                      var ee = this.subject.slice(_, this.pos - D.length), ce = this.sourcepos(C, this.pos), qe = ee.split(`
`);
                      if (qe.length > 1) {
                        var We = fv(qe);
                        this.lineIdx += qe.length - 1, this.linePosOffset = -(this.pos - We.length - D.length), ce[1] = this.sourcepos(this.pos), ee = qe.join(" ");
                      }
                      var ft = on("code", ce);
                      return ee.length > 0 && ee.match(/[^ ]/) !== null && ee[0] == " " && ee[ee.length - 1] == " " ? ft.literal = ee.slice(1, ee.length - 1) : ft.literal = ee, ft.tickCount = D.length, v.appendChild(ft), !0;
                    }
                  return this.pos = _, v.appendChild(Cn(D, this.sourcepos(C, this.pos - 1))), !0;
                }, m.prototype.parseBackslash = function(v) {
                  var C = this.subject, D;
                  this.pos += 1;
                  var _ = this.pos;
                  return this.peek() === _g ? (this.pos += 1, D = on("linebreak", this.sourcepos(this.pos - 1, this.pos)), v.appendChild(D), this.nextLine()) : mw.test(C.charAt(this.pos)) ? (v.appendChild(Cn(C.charAt(this.pos), this.sourcepos(_, this.pos))), this.pos += 1) : v.appendChild(Cn("\\", this.sourcepos(_, _))), !0;
                }, m.prototype.parseAutolink = function(v) {
                  var C, D, _, J = this.pos + 1;
                  return (C = this.match(bQ)) ? (D = C.slice(1, C.length - 1), _ = on("link", this.sourcepos(J, this.pos)), _.destination = uv("mailto:" + D), _.title = "", _.appendChild(Cn(D, this.sourcepos(J + 1, this.pos - 1))), v.appendChild(_), !0) : (C = this.match(CQ)) ? (D = C.slice(1, C.length - 1), _ = on("link", this.sourcepos(J, this.pos)), _.destination = uv(D), _.title = "", _.appendChild(Cn(D, this.sourcepos(J + 1, this.pos - 1))), v.appendChild(_), !0) : !1;
                }, m.prototype.parseHtmlTag = function(v) {
                  var C = this.pos + 1, D = this.match(JJ);
                  if (D === null)
                    return !1;
                  var _ = on("htmlInline", this.sourcepos(C, this.pos));
                  return _.literal = D, v.appendChild(_), !0;
                }, m.prototype.scanDelims = function(v) {
                  var C = 0, D = this.pos;
                  if (v === nu || v === iu)
                    C++, this.pos++;
                  else
                    for (; this.peek() === v; )
                      C++, this.pos++;
                  if (C === 0 || C < 2 && (v === pv || v === au))
                    return this.pos = D, null;
                  var _ = D === 0 ? `
` : this.subject.charAt(D - 1), J = this.peek(), ee;
                  J === -1 ? ee = `
` : ee = Fg(J);
                  var ce = gw.test(ee), qe = vw.test(ee), We = gw.test(_), ft = vw.test(_), mt = !ce && (!qe || We || ft), ot = !We && (!ft || ce || qe), Bt, Pt;
                  return v === hv ? (Bt = mt && (!ot || ft), Pt = ot && (!mt || qe)) : v === nu || v === iu ? (Bt = mt && !ot, Pt = ot) : v === au ? (Bt = !ce, Pt = !We) : (Bt = mt, Pt = ot), this.pos = D, { numdelims: C, canOpen: Bt, canClose: Pt };
                }, m.prototype.handleDelim = function(v, C) {
                  var D = this.scanDelims(v);
                  if (!D)
                    return !1;
                  var _ = D.numdelims, J = this.pos + 1, ee;
                  this.pos += _, v === nu ? ee = "’" : v === iu ? ee = "“" : ee = this.subject.slice(J - 1, this.pos);
                  var ce = Cn(ee, this.sourcepos(J, this.pos));
                  return C.appendChild(ce), (D.canOpen || D.canClose) && (this.options.smart || v !== nu && v !== iu) && (this.delimiters = {
                    cc: v,
                    numdelims: _,
                    origdelims: _,
                    node: ce,
                    previous: this.delimiters,
                    next: null,
                    canOpen: D.canOpen,
                    canClose: D.canClose
                  }, this.delimiters.previous && (this.delimiters.previous.next = this.delimiters)), !0;
                }, m.prototype.removeDelimiter = function(v) {
                  v.previous !== null && (v.previous.next = v.next), v.next === null ? this.delimiters = v.previous : v.next.previous = v.previous;
                }, m.prototype.removeDelimitersBetween = function(v, C) {
                  v.next !== C && (v.next = C, C.previous = v);
                }, m.prototype.processEmphasis = function(v) {
                  var C, D, _, J, ee, ce, qe, We = !1, ft = (C = {}, C[hv] = [v, v, v], C[qg] = [v, v, v], C[nu] = [v], C[iu] = [v], C[pv] = [v], C[au] = [v], C);
                  for (_ = this.delimiters; _ !== null && _.previous !== v; )
                    _ = _.previous;
                  for (; _ !== null; ) {
                    var mt = _.cc, ot = mt === hv || mt === qg;
                    if (!_.canClose)
                      _ = _.next;
                    else {
                      for (D = _.previous, qe = !1; D !== null && D !== v && D !== ft[mt][ot ? _.origdelims % 3 : 0]; ) {
                        if (We = ot && (_.canOpen || D.canClose) && _.origdelims % 3 !== 0 && (D.origdelims + _.origdelims) % 3 === 0, D.cc === _.cc && D.canOpen && !We) {
                          qe = !0;
                          break;
                        }
                        D = D.previous;
                      }
                      if (J = _, ot || mt === pv || mt === au) {
                        if (!qe)
                          _ = _.next;
                        else if (D) {
                          var Bt = _.numdelims >= 2 && D.numdelims >= 2 ? 2 : 1, Pt = ot ? 0 : 1;
                          ee = D.node, ce = _.node;
                          var gr = ot ? Bt === 1 ? "emph" : "strong" : "strike";
                          mt === au && (gr = "customInline");
                          var sn = on(gr), Pn = ee.sourcepos[1], ds = ce.sourcepos[0];
                          sn.sourcepos = [
                            [Pn[0], Pn[1] - Bt + 1],
                            [ds[0], ds[1] + Bt - 1]
                          ], ee.sourcepos[1][1] -= Bt, ce.sourcepos[0][1] += Bt, ee.literal = ee.literal.slice(Bt), ce.literal = ce.literal.slice(Bt), D.numdelims -= Bt, _.numdelims -= Bt;
                          for (var Ca = ee.next, ua = void 0; Ca && Ca !== ce; )
                            ua = Ca.next, Ca.unlink(), sn.appendChild(Ca), Ca = ua;
                          if (mt === au) {
                            var Ka = sn.firstChild, hs = Ka.literal || "", ps = hs.split(/\s/)[0];
                            sn.info = ps, hs.length <= ps.length ? Ka.unlink() : (Ka.sourcepos[0][1] += ps.length, Ka.literal = hs.replace(ps + " ", ""));
                          }
                          if (ee.insertAfter(sn), this.removeDelimitersBetween(D, _), D.numdelims <= Pt && (D.numdelims === 0 && ee.unlink(), this.removeDelimiter(D)), _.numdelims <= Pt) {
                            _.numdelims === 0 && ce.unlink();
                            var vs = _.next;
                            this.removeDelimiter(_), _ = vs;
                          }
                        }
                      } else mt === nu ? (_.node.literal = "’", qe && (D.node.literal = "‘"), _ = _.next) : mt === iu && (_.node.literal = "”", qe && (D.node.literal = "“"), _ = _.next);
                      qe || (ft[mt][ot ? J.origdelims % 3 : 0] = J.previous, J.canOpen || this.removeDelimiter(J));
                    }
                  }
                  for (; this.delimiters !== null && this.delimiters !== v; )
                    this.removeDelimiter(this.delimiters);
                }, m.prototype.parseLinkTitle = function() {
                  var v = this.match(pQ);
                  return v === null ? null : jd(v.substr(1, v.length - 2));
                }, m.prototype.parseLinkDestination = function() {
                  var v = this.match(vQ);
                  if (v === null) {
                    if (this.peek() === dw)
                      return null;
                    for (var C = this.pos, D = 0, _ = void 0; (_ = this.peek()) !== -1; )
                      if (_ === hw && mw.test(this.subject.charAt(this.pos + 1)))
                        this.pos += 1, this.peek() !== -1 && (this.pos += 1);
                      else if (_ === pw)
                        this.pos += 1, D += 1;
                      else if (_ === zg) {
                        if (D < 1)
                          break;
                        this.pos += 1, D -= 1;
                      } else {
                        if (Vg.exec(Fg(_)) !== null)
                          break;
                        this.pos += 1;
                      }
                    return this.pos === C && _ !== zg || D !== 0 ? null : (v = this.subject.substr(C, this.pos - C), uv(jd(v)));
                  }
                  return uv(jd(v.substr(1, v.length - 2)));
                }, m.prototype.parseLinkLabel = function() {
                  var v = this.match(EQ);
                  return v === null || v.length > 1001 ? 0 : v.length;
                }, m.prototype.parseOpenBracket = function(v) {
                  var C = this.pos;
                  this.pos += 1;
                  var D = Cn("[", this.sourcepos(this.pos, this.pos));
                  return v.appendChild(D), this.addBracket(D, C, !1), !0;
                }, m.prototype.parseBang = function(v) {
                  var C = this.pos;
                  if (this.pos += 1, this.peek() === fw) {
                    this.pos += 1;
                    var D = Cn("![", this.sourcepos(this.pos - 1, this.pos));
                    v.appendChild(D), this.addBracket(D, C + 1, !0);
                  } else {
                    var D = Cn("!", this.sourcepos(this.pos, this.pos));
                    v.appendChild(D);
                  }
                  return !0;
                }, m.prototype.parseCloseBracket = function(v) {
                  var C = null, D = null, _ = !1;
                  this.pos += 1;
                  var J = this.pos, ee = this.brackets;
                  if (ee === null)
                    return v.appendChild(Cn("]", this.sourcepos(J, J))), !0;
                  if (!ee.active)
                    return v.appendChild(Cn("]", this.sourcepos(J, J))), this.removeBracket(), !0;
                  var ce = ee.image, qe = this.pos;
                  this.peek() === pw && (this.pos++, this.spnl() && (C = this.parseLinkDestination()) !== null && this.spnl() && // make sure there's a space before the title:
                  (Vg.test(this.subject.charAt(this.pos - 1)) && (D = this.parseLinkTitle()) || !0) && this.spnl() && this.peek() === zg ? (this.pos += 1, _ = !0) : this.pos = qe);
                  var We = "";
                  if (!_) {
                    var ft = this.pos, mt = this.parseLinkLabel();
                    if (mt > 2 ? We = this.subject.slice(ft, ft + mt) : ee.bracketAfter || (We = this.subject.slice(ee.index, J)), mt === 0 && (this.pos = qe), We) {
                      We = cw(We);
                      var ot = this.refMap[We];
                      ot && (C = ot.destination, D = ot.title, _ = !0);
                    }
                  }
                  if (_) {
                    var Bt = on(ce ? "image" : "link");
                    Bt.destination = C, Bt.title = D || "", Bt.sourcepos = [ee.startpos, this.sourcepos(this.pos)];
                    for (var Pt = ee.node.next, gr = void 0; Pt; )
                      gr = Pt.next, Pt.unlink(), Bt.appendChild(Pt), Pt = gr;
                    if (v.appendChild(Bt), this.processEmphasis(ee.previousDelimiter), this.removeBracket(), ee.node.unlink(), !ce)
                      for (ee = this.brackets; ee !== null; )
                        ee.image || (ee.active = !1), ee = ee.previous;
                    return this.options.referenceDefinition && (this.refLinkCandidateMap[v.id] = { node: v, refLabel: We }), !0;
                  }
                  return this.removeBracket(), this.pos = J, v.appendChild(Cn("]", this.sourcepos(J, J))), this.options.referenceDefinition && (this.refLinkCandidateMap[v.id] = { node: v, refLabel: We }), !0;
                }, m.prototype.addBracket = function(v, C, D) {
                  this.brackets !== null && (this.brackets.bracketAfter = !0), this.brackets = {
                    node: v,
                    startpos: this.sourcepos(C + (D ? 0 : 1)),
                    previous: this.brackets,
                    previousDelimiter: this.delimiters,
                    index: C,
                    image: D,
                    active: !0
                  };
                }, m.prototype.removeBracket = function() {
                  this.brackets && (this.brackets = this.brackets.previous);
                }, m.prototype.parseEntity = function(v) {
                  var C, D = this.pos + 1;
                  return (C = this.match(mQ)) ? (v.appendChild(Cn(pe.decodeHTML(C), this.sourcepos(D, this.pos))), !0) : !1;
                }, m.prototype.parseString = function(v) {
                  var C, D = this.pos + 1;
                  if (C = this.match(MQ)) {
                    if (this.options.smart) {
                      var _ = C.replace(kQ, "…").replace(wQ, function(ee) {
                        var ce = 0, qe = 0;
                        return ee.length % 3 === 0 ? qe = ee.length / 3 : ee.length % 2 === 0 ? ce = ee.length / 2 : ee.length % 3 === 2 ? (ce = 1, qe = (ee.length - 2) / 3) : (ce = 2, qe = (ee.length - 4) / 3), Rg("—", qe) + Rg("–", ce);
                      });
                      v.appendChild(Cn(_, this.sourcepos(D, this.pos)));
                    } else {
                      var J = Cn(C, this.sourcepos(D, this.pos));
                      v.appendChild(J);
                    }
                    return !0;
                  }
                  return !1;
                }, m.prototype.parseNewline = function(v) {
                  this.pos += 1;
                  var C = v.lastChild;
                  if (C && C.type === "text" && C.literal[C.literal.length - 1] === " ") {
                    var D = C.literal[C.literal.length - 2] === " ", _ = C.literal.length;
                    C.literal = C.literal.replace(SQ, "");
                    var J = _ - C.literal.length;
                    C.sourcepos[1][1] -= J, v.appendChild(on(D ? "linebreak" : "softbreak", this.sourcepos(this.pos - J, this.pos)));
                  } else
                    v.appendChild(on("softbreak", this.sourcepos(this.pos, this.pos)));
                  return this.nextLine(), this.match(xQ), !0;
                }, m.prototype.parseReference = function(v, C) {
                  if (!this.options.referenceDefinition)
                    return 0;
                  this.subject = v.stringContent, this.pos = 0;
                  var D = null, _ = this.pos, J = this.parseLinkLabel();
                  if (J === 0)
                    return 0;
                  var ee = this.subject.substr(0, J);
                  if (this.peek() === hQ)
                    this.pos++;
                  else
                    return this.pos = _, 0;
                  this.spnl();
                  var ce = this.parseLinkDestination();
                  if (ce === null)
                    return this.pos = _, 0;
                  var qe = this.pos;
                  this.spnl(), this.pos !== qe && (D = this.parseLinkTitle()), D === null && (D = "", this.pos = qe);
                  var We = !0;
                  if (this.match(yw) === null && (D === "" ? We = !1 : (D = "", this.pos = qe, We = this.match(yw) !== null)), !We)
                    return this.pos = _, 0;
                  var ft = cw(ee);
                  if (ft === "")
                    return this.pos = _, 0;
                  var mt = this.getReferenceDefSourcepos(v);
                  v.sourcepos[0][0] = mt[1][0] + 1;
                  var ot = on("refDef", mt);
                  return ot.title = D, ot.dest = ce, ot.label = ft, v.insertBefore(ot), C[ft] ? this.refDefCandidateMap[ot.id] = ot : C[ft] = Kg(ot), this.pos - _;
                }, m.prototype.mergeTextNodes = function(v) {
                  for (var C, D = []; C = v.next(); ) {
                    var _ = C.entering, J = C.node;
                    if (_ && J.type === "text")
                      D.push(J);
                    else if (D.length === 1)
                      D = [];
                    else if (D.length > 1) {
                      var ee = D[0], ce = D[D.length - 1];
                      ee.sourcepos && ce.sourcepos && (ee.sourcepos[1] = ce.sourcepos[1]), ee.next = ce.next, ee.next && (ee.next.prev = ee);
                      for (var qe = 1; qe < D.length; qe += 1)
                        ee.literal += D[qe].literal, D[qe].unlink();
                      D = [];
                    }
                  }
                }, m.prototype.getReferenceDefSourcepos = function(v) {
                  for (var C = v.stringContent.split(/\n|\r\n/), D = !1, _ = 0, J = { line: 0, ch: 0 }, ee = 0; ee < C.length; ee += 1) {
                    var ce = C[ee];
                    if (Vg.test(ce))
                      break;
                    if (/\:/.test(ce) && _ === 0) {
                      if (D)
                        break;
                      var qe = ce.indexOf(":") === ce.length - 1 ? ee + 1 : ee;
                      J = { line: qe, ch: C[qe].length }, D = !0;
                    }
                    var We = ce.match(/'|"/g);
                    if (We && (_ += We.length), _ === 2) {
                      J = { line: ee, ch: ce.length };
                      break;
                    }
                  }
                  return [
                    [v.sourcepos[0][0], v.sourcepos[0][1]],
                    [v.sourcepos[0][0] + J.line, J.ch]
                  ];
                }, m.prototype.parseInline = function(v) {
                  var C, D = !1, _ = this.peek();
                  if (_ === -1)
                    return !1;
                  switch (_) {
                    case _g:
                      D = this.parseNewline(v);
                      break;
                    case hw:
                      D = this.parseBackslash(v);
                      break;
                    case uQ:
                      D = this.parseBackticks(v);
                      break;
                    case qg:
                    case hv:
                    case pv:
                    case au:
                      D = this.handleDelim(_, v);
                      break;
                    case nu:
                    case iu:
                      D = !!(!((C = this.options) === null || C === void 0) && C.smart) && this.handleDelim(_, v);
                      break;
                    case fw:
                      D = this.parseOpenBracket(v);
                      break;
                    case fQ:
                      D = this.parseBang(v);
                      break;
                    case cQ:
                      D = this.parseCloseBracket(v);
                      break;
                    case dw:
                      D = this.parseAutolink(v) || this.parseHtmlTag(v);
                      break;
                    case dQ:
                      v.disabledEntityParse || (D = this.parseEntity(v));
                      break;
                    default:
                      D = this.parseString(v);
                      break;
                  }
                  return D || (this.pos += 1, v.appendChild(Cn(Fg(_), this.sourcepos(this.pos, this.pos + 1)))), !0;
                }, m.prototype.parse = function(v) {
                  for (this.subject = v.stringContent.trim(), this.pos = 0, this.delimiters = null, this.brackets = null, this.lineOffsets = v.lineOffsets || [0], this.lineIdx = 0, this.linePosOffset = 0, this.lineStartNum = v.sourcepos[0][0], IJ(v) && (this.lineOffsets[0] += v.level + 1); this.parseInline(v); )
                    ;
                  v.stringContent = null, this.processEmphasis(null), this.mergeTextNodes(v.walker());
                  var C = this.options, D = C.extendedAutolinks, _ = C.customParser;
                  if (D && oQ(v.walker(), D), _ && v.firstChild)
                    for (var J, ee = v.firstChild.walker(); J = ee.next(); ) {
                      var ce = J.node, qe = J.entering;
                      _[ce.type] && _[ce.type](ce, { entering: qe, options: this.options });
                    }
                }, m;
              })()
            ), OQ = /^\[([ \txX])\][ \t]+/;
            function DQ(m, v) {
              if (v.firstChild && v.firstChild.type === "paragraph") {
                var C = v.firstChild, D = C.stringContent.match(OQ);
                if (D) {
                  var _ = D[0].length;
                  C.stringContent = C.stringContent.substring(_ - 1), C.sourcepos[0][1] += _, C.lineOffsets[0] += _, v.listData.task = !0, v.listData.checked = /[xX]/.test(D[1]);
                }
              }
            }
            var AQ = {
              continue: function() {
                return 0;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m === "tableHead" || m === "tableBody";
              },
              acceptsLines: !1
            }, LQ = {
              continue: function() {
                return 0;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m === "tableRow";
              },
              acceptsLines: !1
            }, RQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m === "tableRow" || m === "tableDelimRow";
              },
              acceptsLines: !1
            }, IQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m === "tableDelimCell";
              },
              acceptsLines: !1
            }, PQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !1
            }, BQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m === "tableCell";
              },
              acceptsLines: !1
            }, FQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !1
            }, vv = 4, kw = 9, ww = 62, _Q = 60, bw = 32, Cw = 91, Tw = /[^ \t\f\v\r\n]/, qQ = /^(?:`{3,}|~{3,})(?= *$)/;
            function Sw(m) {
              for (var v = m; v; ) {
                if (v.lastLineBlank)
                  return !0;
                var C = v.type;
                if (!v.lastLineChecked && (C === "list" || C === "item"))
                  v.lastLineChecked = !0, v = v.lastChild;
                else {
                  v.lastLineChecked = !0;
                  break;
                }
              }
              return !1;
            }
            function la(m, v) {
              return v < m.length ? m.charCodeAt(v) : -1;
            }
            function xw(m) {
              return !Tw.test(m);
            }
            function zc(m) {
              return m === bw || m === kw;
            }
            var zQ = /^\$\$$/, HQ = {
              continue: function(m, v) {
                var C = m.currentLine, D = C.match(zQ);
                if (D)
                  return m.lastLineLength = D[0].length, m.finalize(v, m.lineNumber), 2;
                for (var _ = v.offset; _ > 0 && zc(la(C, m.offset)); )
                  m.advanceOffset(1, !0), _--;
                return 0;
              },
              finalize: function(m, v) {
                if (v.stringContent !== null) {
                  var C = v.stringContent, D = C.indexOf(`
`), _ = C.slice(0, D), J = C.slice(D + 1), ee = _.match(/^(\s*)(.*)/);
                  v.info = jd(ee[2].trim()), v.literal = J, v.stringContent = null;
                }
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !0
            }, Ew = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !0
            }, VQ = {
              continue: function() {
                return 0;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m !== "item";
              },
              acceptsLines: !1
            }, UQ = {
              continue: function() {
                return 0;
              },
              finalize: function(m, v) {
                for (var C = v.firstChild; C; ) {
                  if (Sw(C) && C.next) {
                    v.listData.tight = !1;
                    break;
                  }
                  for (var D = C.firstChild; D; ) {
                    if (Sw(D) && (C.next || D.next)) {
                      v.listData.tight = !1;
                      break;
                    }
                    D = D.next;
                  }
                  C = C.next;
                }
              },
              canContain: function(m) {
                return m === "item";
              },
              acceptsLines: !1
            }, $Q = {
              continue: function(m) {
                var v = m.currentLine;
                if (!m.indented && la(v, m.nextNonspace) === ww)
                  m.advanceNextNonspace(), m.advanceOffset(1, !1), zc(la(v, m.offset)) && m.advanceOffset(1, !0);
                else
                  return 1;
                return 0;
              },
              finalize: function() {
              },
              canContain: function(m) {
                return m !== "item";
              },
              acceptsLines: !1
            }, WQ = {
              continue: function(m, v) {
                if (m.blank) {
                  if (v.firstChild === null)
                    return 1;
                  m.advanceNextNonspace();
                } else if (m.indent >= v.listData.markerOffset + v.listData.padding)
                  m.advanceOffset(v.listData.markerOffset + v.listData.padding, !0);
                else
                  return 1;
                return 0;
              },
              finalize: DQ,
              canContain: function(m) {
                return m !== "item";
              },
              acceptsLines: !1
            }, jQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !1
            }, GQ = {
              continue: function() {
                return 1;
              },
              finalize: function() {
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !1
            }, KQ = {
              continue: function(m, v) {
                var C = m.currentLine, D = m.indent;
                if (v.isFenced) {
                  var _ = D <= 3 && C.charAt(m.nextNonspace) === v.fenceChar && C.slice(m.nextNonspace).match(qQ);
                  if (_ && _[0].length >= v.fenceLength)
                    return m.lastLineLength = m.offset + D + _[0].length, m.finalize(v, m.lineNumber), 2;
                  for (var J = v.fenceOffset; J > 0 && zc(la(C, m.offset)); )
                    m.advanceOffset(1, !0), J--;
                } else if (D >= vv)
                  m.advanceOffset(vv, !0);
                else if (m.blank)
                  m.advanceNextNonspace();
                else
                  return 1;
                return 0;
              },
              finalize: function(m, v) {
                var C;
                if (v.stringContent !== null) {
                  if (v.isFenced) {
                    var D = v.stringContent, _ = D.indexOf(`
`), J = D.slice(0, _), ee = D.slice(_ + 1), ce = J.match(/^(\s*)(.*)/);
                    v.infoPadding = ce[1].length, v.info = jd(ce[2].trim()), v.literal = ee;
                  } else
                    v.literal = (C = v.stringContent) === null || C === void 0 ? void 0 : C.replace(/(\n *)+$/, `
`);
                  v.stringContent = null;
                }
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !0
            }, JQ = {
              continue: function(m, v) {
                return m.blank && (v.htmlBlockType === 6 || v.htmlBlockType === 7) ? 1 : 0;
              },
              finalize: function(m, v) {
                var C;
                v.literal = ((C = v.stringContent) === null || C === void 0 ? void 0 : C.replace(/(\n *)+$/, "")) || null, v.stringContent = null;
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !0
            }, QQ = {
              continue: function(m) {
                return m.blank ? 1 : 0;
              },
              finalize: function(m, v) {
                if (v.stringContent !== null) {
                  for (var C, D = !1; la(v.stringContent, 0) === Cw && (C = m.inlineParser.parseReference(v, m.refMap)); )
                    v.stringContent = v.stringContent.slice(C), D = !0;
                  D && xw(v.stringContent) && v.unlink();
                }
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !0
            }, XQ = Ew, YQ = Ew, Hc = {
              document: VQ,
              list: UQ,
              blockQuote: $Q,
              item: WQ,
              heading: jQ,
              thematicBreak: GQ,
              codeBlock: KQ,
              htmlBlock: JQ,
              paragraph: QQ,
              table: AQ,
              tableBody: LQ,
              tableHead: RQ,
              tableRow: BQ,
              tableCell: FQ,
              tableDelimRow: IQ,
              tableDelimCell: PQ,
              refDef: XQ,
              customBlock: HQ,
              frontMatter: YQ
            };
            function Ug(m) {
              for (var v = 0, C = 0, D = [], _ = 0; _ < m.length; _ += 1)
                if (m[_] === "|" && m[_ - 1] !== "\\") {
                  var J = m.substring(v, _);
                  v === 0 && nw(J) ? C = _ + 1 : D.push(J), v = _ + 1;
                }
              if (v < m.length) {
                var J = m.substring(v, m.length);
                nw(J) || D.push(J);
              }
              return [C, D];
            }
            function $g(m, v, C, D) {
              for (var _ = [], J = 0, ee = v; J < ee.length; J++) {
                var ce = ee[J], qe = ce.match(/^[ \t]+/), We = qe ? qe[0].length : 0, ft = void 0, mt = void 0;
                if (We === ce.length)
                  We = 0, ft = 0, mt = "";
                else {
                  var ot = ce.match(/[ \t]+$/);
                  ft = ot ? ot[0].length : 0, mt = ce.slice(We, ce.length - ft);
                }
                var Bt = D + We, Pt = on(m, [
                  [C, D],
                  [C, D + ce.length - 1]
                ]);
                Pt.stringContent = mt.replace(/\\\|/g, "|"), Pt.startIdx = _.length, Pt.endIdx = _.length, Pt.lineOffsets = [Bt - 1], Pt.paddingLeft = We, Pt.paddingRight = ft, _.push(Pt), D += ce.length + 1;
              }
              return _;
            }
            function ZQ(m) {
              var v = null, C = m.stringContent, D = C[0], _ = C[C.length - 1];
              return _ === ":" ? v = D === ":" ? "center" : "right" : D === ":" && (v = "left"), { align: v };
            }
            var eX = function(m, v) {
              var C = v.stringContent;
              if (v.type === "paragraph" && !m.indented && !m.blank) {
                var D = C.length - 1, _ = C.lastIndexOf(`
`, D - 1) + 1, J = C.slice(_, D), ee = m.currentLine.slice(m.nextNonspace), ce = Ug(J), qe = ce[0], We = ce[1], ft = Ug(ee), mt = ft[0], ot = ft[1], Bt = /^[ \t]*:?-+:?[ \t]*$/;
                if (
                  // not checking if the number of header cells and delimiter cells are the same
                  // to consider the case of merged-column (via plugin)
                  !We.length || !ot.length || ot.some(function(vs) {
                    return !Bt.test(vs);
                  }) || // to prevent to regard setTextHeading as tabel delim cell with 'disallowDeepHeading' option
                  ot.length === 1 && ee.indexOf("|") !== 0
                )
                  return 0;
                var Pt = v.lineOffsets, gr = m.lineNumber - 1, sn = fv(Pt) + 1, Pn = on("table", [
                  [gr, sn],
                  [m.lineNumber, m.offset]
                ]);
                if (Pn.columns = ot.map(function() {
                  return { align: null };
                }), v.insertAfter(Pn), Pt.length === 1)
                  v.unlink();
                else {
                  v.stringContent = C.slice(0, _);
                  var ds = C.lastIndexOf(`
`, _ - 2) + 1, Ca = _ - ds - 1;
                  m.lastLineLength = Pt[Pt.length - 2] + Ca, m.finalize(v, gr - 1);
                }
                m.advanceOffset(m.currentLine.length - m.offset, !1);
                var ua = on("tableHead", [
                  [gr, sn],
                  [m.lineNumber, m.offset]
                ]);
                Pn.appendChild(ua);
                var Ka = on("tableRow", [
                  [gr, sn],
                  [gr, sn + J.length - 1]
                ]), hs = on("tableDelimRow", [
                  [m.lineNumber, m.nextNonspace + 1],
                  [m.lineNumber, m.offset]
                ]);
                ua.appendChild(Ka), ua.appendChild(hs), $g("tableCell", We, gr, sn + qe).forEach(function(vs) {
                  Ka.appendChild(vs);
                });
                var ps = $g("tableDelimCell", ot, m.lineNumber, m.nextNonspace + 1 + mt);
                return ps.forEach(function(vs) {
                  hs.appendChild(vs);
                }), Pn.columns = ps.map(ZQ), m.tip = Pn, 2;
              }
              return 0;
            }, tX = function(m, v) {
              if (v.type !== "table" && v.type !== "tableBody" || !m.blank && m.currentLine.indexOf("|") === -1)
                return 0;
              if (m.advanceOffset(m.currentLine.length - m.offset, !1), m.blank) {
                var C = v;
                return v.type === "tableBody" && (C = v.parent, m.finalize(v, m.lineNumber - 1)), m.finalize(C, m.lineNumber - 1), 0;
              }
              var D = v;
              v.type === "table" && (D = m.addChild("tableBody", m.nextNonspace), D.stringContent = null);
              var _ = on("tableRow", [
                [m.lineNumber, m.nextNonspace + 1],
                [m.lineNumber, m.currentLine.length]
              ]);
              D.appendChild(_);
              var J = D.parent, ee = m.currentLine.slice(m.nextNonspace), ce = Ug(ee), qe = ce[0], We = ce[1];
              return $g("tableCell", We, m.lineNumber, m.nextNonspace + 1 + qe).forEach(function(ft, mt) {
                mt >= J.columns.length && (ft.ignored = !0), _.appendChild(ft);
              }), 2;
            }, rX = /^(\$\$)(\s*[a-zA-Z])+/, nX = /^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/, iX = function(m) {
              var v;
              if (!m.indented && !nX.test(m.currentLine) && (v = m.currentLine.match(rX))) {
                var C = v[1].length;
                m.closeUnmatchedBlocks();
                var D = m.addChild("customBlock", m.nextNonspace);
                return D.syntaxLength = C, D.offset = m.indent, m.advanceNextNonspace(), m.advanceOffset(C, !1), 2;
              }
              return 0;
            }, aX = /^`{3,}(?!.*`)|^~{3,}/, oX = [
              /./,
              /^<(?:script|pre|style)(?:\s|>|$)/i,
              /^<!--/,
              /^<[?]/,
              /^<![A-Z]/,
              /^<!\[CDATA\[/,
              /^<[/]?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[123456]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|[/]?[>]|$)/i,
              new RegExp("^(?:" + lw + "|" + uw + ")\\s*$", "i")
            ], sX = /^(?:=+|-+)[ \t]*$/, lX = /^#{1,6}(?:[ \t]+|$)/, uX = /^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/, Mw = /^[*+-]/, Nw = /^(\d{1,9})([.)])/;
            function cX(m, v) {
              var C = m.currentLine.slice(m.nextNonspace), D, _, J = {
                type: "bullet",
                tight: !0,
                bulletChar: "",
                start: 0,
                delimiter: "",
                padding: 0,
                markerOffset: m.indent,
                // GFM: Task List Item
                task: !1,
                checked: !1
              };
              if (m.indent >= 4)
                return null;
              if (D = C.match(Mw))
                J.type = "bullet", J.bulletChar = D[0][0];
              else if ((D = C.match(Nw)) && (v.type !== "paragraph" || D[1] === "1"))
                J.type = "ordered", J.start = parseInt(D[1], 10), J.delimiter = D[2];
              else
                return null;
              if (_ = la(m.currentLine, m.nextNonspace + D[0].length), !(_ === -1 || _ === kw || _ === bw) || v.type === "paragraph" && !m.currentLine.slice(m.nextNonspace + D[0].length).match(Tw))
                return null;
              m.advanceNextNonspace(), m.advanceOffset(D[0].length, !0);
              var ee = m.column, ce = m.offset;
              do
                m.advanceOffset(1, !0), _ = la(m.currentLine, m.offset);
              while (m.column - ee < 5 && zc(_));
              var qe = la(m.currentLine, m.offset) === -1, We = m.column - ee;
              return We >= 5 || We < 1 || qe ? (J.padding = D[0].length + 1, m.column = ee, m.offset = ce, zc(la(m.currentLine, m.offset)) && m.advanceOffset(1, !0)) : J.padding = D[0].length + We, J;
            }
            function fX(m, v) {
              return m.type === v.type && m.delimiter === v.delimiter && m.bulletChar === v.bulletChar;
            }
            function Ow(m, v) {
              return m.options.disallowDeepHeading && (v.type === "blockQuote" || v.type === "item");
            }
            var dX = function(m) {
              return !m.indented && la(m.currentLine, m.nextNonspace) === ww ? (m.advanceNextNonspace(), m.advanceOffset(1, !1), zc(la(m.currentLine, m.offset)) && m.advanceOffset(1, !0), m.closeUnmatchedBlocks(), m.addChild("blockQuote", m.nextNonspace), 1) : 0;
            }, hX = function(m, v) {
              var C;
              if (!m.indented && // The nested Heading is disallowed in list and blockquote with 'disallowDeepHeading' option
              !Ow(m, v) && (C = m.currentLine.slice(m.nextNonspace).match(lX))) {
                m.advanceNextNonspace(), m.advanceOffset(C[0].length, !1), m.closeUnmatchedBlocks();
                var D = m.addChild("heading", m.nextNonspace);
                return D.level = C[0].trim().length, D.headingType = "atx", D.stringContent = m.currentLine.slice(m.offset).replace(/^[ \t]*#+[ \t]*$/, "").replace(/[ \t]+#+[ \t]*$/, ""), m.advanceOffset(m.currentLine.length - m.offset), 2;
              }
              return 0;
            }, pX = function(m) {
              var v;
              if (!m.indented && (v = m.currentLine.slice(m.nextNonspace).match(aX))) {
                var C = v[0].length;
                m.closeUnmatchedBlocks();
                var D = m.addChild("codeBlock", m.nextNonspace);
                return D.isFenced = !0, D.fenceLength = C, D.fenceChar = v[0][0], D.fenceOffset = m.indent, m.advanceNextNonspace(), m.advanceOffset(C, !1), 2;
              }
              return 0;
            }, vX = function(m, v) {
              if (!m.indented && la(m.currentLine, m.nextNonspace) === _Q) {
                var C = m.currentLine.slice(m.nextNonspace), D = m.options.disallowedHtmlBlockTags, _ = void 0;
                for (_ = 1; _ <= 7; _++) {
                  var J = C.match(oX[_]);
                  if (J) {
                    if (_ === 7) {
                      if (v.type === "paragraph")
                        return 0;
                      if (D.length > 0) {
                        var ee = new RegExp("</?(?:" + D.join("|") + ")", "i");
                        if (ee.test(J[0]))
                          return 0;
                      }
                    }
                    m.closeUnmatchedBlocks();
                    var ce = m.addChild("htmlBlock", m.offset);
                    return ce.htmlBlockType = _, 2;
                  }
                }
              }
              return 0;
            }, mX = function(m, v) {
              var C;
              if (v.stringContent !== null && !m.indented && v.type === "paragraph" && // The nested Heading is disallowed in list and blockquote with 'disallowDeepHeading' option
              !Ow(m, v.parent) && (C = m.currentLine.slice(m.nextNonspace).match(sX))) {
                m.closeUnmatchedBlocks();
                for (var D = void 0; la(v.stringContent, 0) === Cw && (D = m.inlineParser.parseReference(v, m.refMap)); )
                  v.stringContent = v.stringContent.slice(D);
                if (v.stringContent.length > 0) {
                  var _ = on("heading", v.sourcepos);
                  return _.level = C[0][0] === "=" ? 1 : 2, _.headingType = "setext", _.stringContent = v.stringContent, v.insertAfter(_), v.unlink(), m.tip = _, m.advanceOffset(m.currentLine.length - m.offset, !1), 2;
                }
                return 0;
              }
              return 0;
            }, gX = function(m) {
              return !m.indented && uX.test(m.currentLine.slice(m.nextNonspace)) ? (m.closeUnmatchedBlocks(), m.addChild("thematicBreak", m.nextNonspace), m.advanceOffset(m.currentLine.length - m.offset, !1), 2) : 0;
            }, yX = function(m, v) {
              var C, D = v;
              return (!m.indented || v.type === "list") && (C = cX(m, D)) ? (m.closeUnmatchedBlocks(), (m.tip.type !== "list" || !fX(D.listData, C)) && (D = m.addChild("list", m.nextNonspace), D.listData = C), D = m.addChild("item", m.nextNonspace), D.listData = C, 1) : 0;
            }, kX = function(m) {
              return m.indented && m.tip.type !== "paragraph" && !m.blank ? (m.advanceOffset(vv, !0), m.closeUnmatchedBlocks(), m.addChild("codeBlock", m.offset), 2) : 0;
            }, Wg = [
              dX,
              hX,
              pX,
              vX,
              mX,
              gX,
              yX,
              kX,
              eX,
              tX,
              iX
            ], Dw = /^(-{3}|\+{3}|;{3})$/, wX = function(m, v) {
              var C = m.currentLine, D = m.lineNumber, _ = m.indented;
              if (D === 1 && !_ && v.type === "document" && Dw.test(C)) {
                m.closeUnmatchedBlocks();
                var J = m.addChild("frontMatter", m.nextNonspace);
                return J.stringContent = C, m.advanceNextNonspace(), m.advanceOffset(C.length, !1), 2;
              }
              return 0;
            }, bX = {
              continue: function(m, v) {
                var C = m.currentLine, D = C.match(Dw);
                return v.type === "frontMatter" && D ? (v.stringContent += C, m.lastLineLength = D[0].length, m.finalize(v, m.lineNumber), 2) : 0;
              },
              finalize: function(m, v) {
                v.stringContent !== null && (v.literal = v.stringContent, v.stringContent = null);
              },
              canContain: function() {
                return !1;
              },
              acceptsLines: !0
            }, CX = [
              /./,
              /<\/(?:script|pre|style)>/i,
              /-->/,
              /\?>/,
              />/,
              /\]\]>/
            ], TX = /^[#`~*+_=<>0-9-;$]/, SX = /\r\n|\n|\r/;
            function jg() {
              return on("document", [
                [1, 1],
                [0, 0]
              ]);
            }
            var xX = {
              smart: !1,
              tagFilter: !1,
              extendedAutolinks: !1,
              disallowedHtmlBlockTags: [],
              referenceDefinition: !1,
              disallowDeepHeading: !1,
              customParser: null,
              frontMatter: !1
            }, EX = (
              /** @class */
              (function() {
                function m(v) {
                  this.options = q(q({}, xX), v), this.doc = jg(), this.tip = this.doc, this.oldtip = this.doc, this.lineNumber = 0, this.offset = 0, this.column = 0, this.nextNonspace = 0, this.nextNonspaceColumn = 0, this.indent = 0, this.currentLine = "", this.indented = !1, this.blank = !1, this.partiallyConsumedTab = !1, this.allClosed = !0, this.lastMatchedContainer = this.doc, this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.lastLineLength = 0, this.lines = [], this.options.frontMatter && (Hc.frontMatter = bX, Wg.unshift(wX)), this.inlineParser = new NQ(this.options);
                }
                return m.prototype.advanceOffset = function(v, C) {
                  C === void 0 && (C = !1);
                  for (var D = this.currentLine, _, J, ee; v > 0 && (ee = D[this.offset]); )
                    ee === "	" ? (_ = 4 - this.column % 4, C ? (this.partiallyConsumedTab = _ > v, J = _ > v ? v : _, this.column += J, this.offset += this.partiallyConsumedTab ? 0 : 1, v -= J) : (this.partiallyConsumedTab = !1, this.column += _, this.offset += 1, v -= 1)) : (this.partiallyConsumedTab = !1, this.offset += 1, this.column += 1, v -= 1);
                }, m.prototype.advanceNextNonspace = function() {
                  this.offset = this.nextNonspace, this.column = this.nextNonspaceColumn, this.partiallyConsumedTab = !1;
                }, m.prototype.findNextNonspace = function() {
                  for (var v = this.currentLine, C = this.offset, D = this.column, _; (_ = v.charAt(C)) !== ""; )
                    if (_ === " ")
                      C++, D++;
                    else if (_ === "	")
                      C++, D += 4 - D % 4;
                    else
                      break;
                  this.blank = _ === `
` || _ === "\r" || _ === "", this.nextNonspace = C, this.nextNonspaceColumn = D, this.indent = this.nextNonspaceColumn - this.column, this.indented = this.indent >= vv;
                }, m.prototype.addLine = function() {
                  if (this.partiallyConsumedTab) {
                    this.offset += 1;
                    var v = 4 - this.column % 4;
                    this.tip.stringContent += Rg(" ", v);
                  }
                  this.tip.lineOffsets ? this.tip.lineOffsets.push(this.offset) : this.tip.lineOffsets = [this.offset], this.tip.stringContent += this.currentLine.slice(this.offset) + `
`;
                }, m.prototype.addChild = function(v, C) {
                  for (; !Hc[this.tip.type].canContain(v); )
                    this.finalize(this.tip, this.lineNumber - 1);
                  var D = C + 1, _ = on(v, [
                    [this.lineNumber, D],
                    [0, 0]
                  ]);
                  return _.stringContent = "", this.tip.appendChild(_), this.tip = _, _;
                }, m.prototype.closeUnmatchedBlocks = function() {
                  if (!this.allClosed) {
                    for (; this.oldtip !== this.lastMatchedContainer; ) {
                      var v = this.oldtip.parent;
                      this.finalize(this.oldtip, this.lineNumber - 1), this.oldtip = v;
                    }
                    this.allClosed = !0;
                  }
                }, m.prototype.finalize = function(v, C) {
                  var D = v.parent;
                  v.open = !1, v.sourcepos[1] = [C, this.lastLineLength], Hc[v.type].finalize(this, v), this.tip = D;
                }, m.prototype.processInlines = function(v) {
                  var C, D = this.options.customParser, _ = v.walker();
                  for (this.inlineParser.refMap = this.refMap, this.inlineParser.refLinkCandidateMap = this.refLinkCandidateMap, this.inlineParser.refDefCandidateMap = this.refDefCandidateMap, this.inlineParser.options = this.options; C = _.next(); ) {
                    var J = C.node, ee = C.entering, ce = J.type;
                    D && D[ce] && D[ce](J, { entering: ee, options: this.options }), !ee && (ce === "paragraph" || ce === "heading" || ce === "tableCell" && !J.ignored) && this.inlineParser.parse(J);
                  }
                }, m.prototype.incorporateLine = function(v) {
                  var C = this.doc;
                  this.oldtip = this.tip, this.offset = 0, this.column = 0, this.blank = !1, this.partiallyConsumedTab = !1, this.lineNumber += 1, v.indexOf("\0") !== -1 && (v = v.replace(/\0/g, "�")), this.currentLine = v;
                  for (var D = !0, _; (_ = C.lastChild) && _.open; ) {
                    switch (C = _, this.findNextNonspace(), Hc[C.type].continue(this, C)) {
                      case 0:
                        break;
                      case 1:
                        D = !1;
                        break;
                      case 2:
                        this.lastLineLength = v.length;
                        return;
                      default:
                        throw new Error("continue returned illegal value, must be 0, 1, or 2");
                    }
                    if (!D) {
                      C = C.parent;
                      break;
                    }
                  }
                  this.allClosed = C === this.oldtip, this.lastMatchedContainer = C;
                  for (var J = C.type !== "paragraph" && Hc[C.type].acceptsLines, ee = Wg.length; !J; ) {
                    if (this.findNextNonspace(), C.type !== "table" && C.type !== "tableBody" && C.type !== "paragraph" && !this.indented && !TX.test(v.slice(this.nextNonspace))) {
                      this.advanceNextNonspace();
                      break;
                    }
                    for (var ce = 0; ce < ee; ) {
                      var qe = Wg[ce](this, C);
                      if (qe === 1) {
                        C = this.tip;
                        break;
                      } else if (qe === 2) {
                        C = this.tip, J = !0;
                        break;
                      } else
                        ce++;
                    }
                    if (ce === ee) {
                      this.advanceNextNonspace();
                      break;
                    }
                  }
                  if (!this.allClosed && !this.blank && this.tip.type === "paragraph")
                    this.addLine();
                  else {
                    this.closeUnmatchedBlocks(), this.blank && C.lastChild && (C.lastChild.lastLineBlank = !0);
                    for (var We = C.type, ft = this.blank && !(We === "blockQuote" || iw(C) && C.isFenced || We === "item" && !C.firstChild && C.sourcepos[0][0] === this.lineNumber), mt = C; mt; )
                      mt.lastLineBlank = ft, mt = mt.parent;
                    Hc[We].acceptsLines ? (this.addLine(), RJ(C) && C.htmlBlockType >= 1 && C.htmlBlockType <= 5 && CX[C.htmlBlockType].test(this.currentLine.slice(this.offset)) && (this.lastLineLength = v.length, this.finalize(C, this.lineNumber))) : this.offset < v.length && !this.blank && (C = this.addChild("paragraph", this.offset), this.advanceNextNonspace(), this.addLine());
                  }
                  this.lastLineLength = v.length;
                }, m.prototype.parse = function(v, C) {
                  this.doc = jg(), this.tip = this.doc, this.lineNumber = 0, this.lastLineLength = 0, this.offset = 0, this.column = 0, this.lastMatchedContainer = this.doc, this.currentLine = "";
                  var D = v.split(SX), _ = D.length;
                  this.lines = C || D, this.options.referenceDefinition && this.clearRefMaps(), v.charCodeAt(v.length - 1) === _g && (_ -= 1);
                  for (var J = 0; J < _; J++)
                    this.incorporateLine(D[J]);
                  for (; this.tip; )
                    this.finalize(this.tip, _);
                  return this.processInlines(this.doc), this.doc;
                }, m.prototype.partialParseStart = function(v, C) {
                  this.doc = jg(), this.tip = this.doc, this.lineNumber = v - 1, this.lastLineLength = 0, this.offset = 0, this.column = 0, this.lastMatchedContainer = this.doc, this.currentLine = "";
                  for (var D = C.length, _ = 0; _ < D; _++)
                    this.incorporateLine(C[_]);
                  return this.doc;
                }, m.prototype.partialParseExtends = function(v) {
                  for (var C = 0; C < v.length; C++)
                    this.incorporateLine(v[C]);
                }, m.prototype.partialParseFinish = function() {
                  for (; this.tip; )
                    this.finalize(this.tip, this.lineNumber);
                  this.processInlines(this.doc);
                }, m.prototype.setRefMaps = function(v, C, D) {
                  this.refMap = v, this.refLinkCandidateMap = C, this.refDefCandidateMap = D;
                }, m.prototype.clearRefMaps = function() {
                  [this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function(v) {
                    lQ(v);
                  });
                }, m;
              })()
            );
            function Aw(m, v) {
              return m[0] < v[0] ? 1 : m[0] > v[0] ? -1 : m[1] < v[1] ? 1 : m[1] > v[1] ? -1 : 0;
            }
            function MX(m, v) {
              var C = m[0], D = m[1];
              return Aw(D, v) === 1 ? 1 : Aw(C, v) === -1 ? -1 : 0;
            }
            function NX(m, v) {
              if (!(m.parent !== v.parent || m === v)) {
                for (var C = m.next; C && C !== v; ) {
                  for (var D = C.next, _ = 0, J = ["parent", "prev", "next"]; _ < J.length; _++) {
                    var ee = J[_];
                    C[ee] && (Pg(C[ee].id), C[ee] = null);
                  }
                  C = D;
                }
                m.next = v.next, v.next ? v.next.prev = m : m.parent.lastChild = m;
              }
            }
            function OX(m) {
              for (var v = [], C = m.firstChild; C; )
                v.push(C), C = C.next;
              return v;
            }
            function Lw(m, v) {
              for (var C = 0, D = v; C < D.length; C++) {
                var _ = D[C];
                m.insertBefore(_);
              }
            }
            function DX(m, v) {
              for (var C = v.length - 1; C >= 0; C -= 1)
                m.prependChild(v[C]);
            }
            function AX(m, v) {
              if (!(!m || !m.parent || v === 0)) {
                var C = m.parent.walker();
                C.resumeAt(m, !0);
                for (var D; D = C.next(); ) {
                  var _ = D.node, J = D.entering;
                  J && (_.sourcepos[0][0] += v, _.sourcepos[1][0] += v);
                }
              }
            }
            function Rw(m, v) {
              var C = m[0], D = m[1];
              return D[0] < v ? 1 : C[0] > v ? -1 : 0;
            }
            function mv(m, v) {
              for (var C = m.firstChild; C; ) {
                var D = Rw(C.sourcepos, v);
                if (D === 0)
                  return C;
                if (D === -1)
                  return C.prev || C;
                C = C.next;
              }
              return m.lastChild;
            }
            function LX(m) {
              for (; m.lastChild; )
                m = m.lastChild;
              return m;
            }
            function RX(m) {
              for (; m.parent && m.parent.type !== "document" && m.parent.sourcepos[0][0] === m.sourcepos[0][0]; )
                m = m.parent;
              return m;
            }
            function IX(m, v) {
              for (var C = m.firstChild, D = null; C; ) {
                var _ = Rw(C.sourcepos, v);
                if (_ === 0) {
                  if (C.sourcepos[0][0] === v || !C.firstChild)
                    return C;
                  D = C, C = C.firstChild;
                } else {
                  if (_ === -1)
                    break;
                  D = C, C = C.next;
                }
              }
              return D ? RX(LX(D)) : null;
            }
            function PX(m, v) {
              for (var C = m, D = null; C; ) {
                var _ = MX(C.sourcepos, v);
                if (_ === 0)
                  if (C.firstChild)
                    D = C, C = C.firstChild;
                  else
                    return C;
                else {
                  if (_ === -1)
                    return D;
                  if (C.next)
                    C = C.next;
                  else
                    return D;
                }
              }
              return C;
            }
            function Iw(m) {
              return wJ(m) || null;
            }
            function Gg(m, v, C) {
              if (C === void 0 && (C = null), v)
                for (var D = v.walker(); v && v !== C; ) {
                  m(v);
                  var _ = D.next();
                  if (_)
                    v = _.node;
                  else
                    break;
                }
            }
            function BX(m) {
              var v = Iw(m);
              if (!v)
                return !0;
              for (; v && v.type !== "document"; ) {
                if (!v.parent && !v.prev && !v.next)
                  return !0;
                v = v.parent;
              }
              return !1;
            }
            var Pw = /\r\n|\n|\r/;
            function FX(m) {
              var v = m.match(/^[ \t]+/);
              if (v && (v[0].length >= 2 || /\t/.test(v[0])))
                return !0;
              var C = v ? m.slice(v.length) : m;
              return Mw.test(C) || Nw.test(C);
            }
            function _X(m) {
              return !xw(m) && m.indexOf("|") !== -1;
            }
            function Kg(m) {
              var v = m.id, C = m.title, D = m.sourcepos, _ = m.dest;
              return {
                id: v,
                title: C,
                sourcepos: D,
                unlinked: !1,
                destination: _
              };
            }
            var qX = (
              /** @class */
              (function() {
                function m(v, C) {
                  this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.referenceDefinition = !!C?.referenceDefinition, this.parser = new EX(C), this.parser.setRefMaps(this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap), this.eventHandlerMap = { change: [] }, v = v || "", this.lineTexts = v.split(Pw), this.root = this.parser.parse(v, this.lineTexts);
                }
                return m.prototype.updateLineTexts = function(v, C, D) {
                  var _, J = v[0], ee = v[1], ce = C[0], qe = C[1], We = D.split(Pw), ft = We.length, mt = this.lineTexts[J - 1], ot = this.lineTexts[ce - 1];
                  We[0] = mt.slice(0, ee - 1) + We[0], We[ft - 1] = We[ft - 1] + ot.slice(qe - 1);
                  var Bt = ce - J + 1;
                  return (_ = this.lineTexts).splice.apply(_, U([J - 1, Bt], We)), ft - Bt;
                }, m.prototype.updateRootNodeState = function() {
                  if (this.lineTexts.length === 1 && this.lineTexts[0] === "") {
                    this.root.lastLineBlank = !0, this.root.sourcepos = [
                      [1, 1],
                      [1, 0]
                    ];
                    return;
                  }
                  this.root.lastChild && (this.root.lastLineBlank = this.root.lastChild.lastLineBlank);
                  for (var v = this.lineTexts, C = v.length - 1; v[C] === ""; )
                    C -= 1;
                  v.length - 2 > C && (C += 1), this.root.sourcepos[1] = [C + 1, v[C].length];
                }, m.prototype.replaceRangeNodes = function(v, C, D) {
                  v ? (Lw(v, D), NX(v, C), [v.id, C.id].forEach(function(_) {
                    return Pg(_);
                  }), v.unlink()) : C ? (Lw(C, D), Pg(C.id), C.unlink()) : DX(this.root, D);
                }, m.prototype.getNodeRange = function(v, C) {
                  var D = mv(this.root, v[0]), _ = mv(this.root, C[0]);
                  return _ && _.next && C[0] + 1 === _.next.sourcepos[0][0] && (_ = _.next), [D, _];
                }, m.prototype.trigger = function(v, C) {
                  this.eventHandlerMap[v].forEach(function(D) {
                    D(C);
                  });
                }, m.prototype.extendEndLine = function(v) {
                  for (; this.lineTexts[v] === ""; )
                    v += 1;
                  return v;
                }, m.prototype.parseRange = function(v, C, D, _) {
                  v && v.prev && (aw(v.prev) && FX(this.lineTexts[D - 1]) || PJ(v.prev) && _X(this.lineTexts[D - 1])) && (v = v.prev, D = v.sourcepos[0][0]);
                  for (var J = this.lineTexts.slice(D - 1, _), ee = this.parser.partialParseStart(D, J), ce = C ? C.next : this.root.firstChild, qe = ee.lastChild, We = qe && iw(qe) && qe.open, ft = qe && ow(qe) && qe.open, mt = qe && aw(qe); (We || ft) && ce || mt && ce && (ce.type === "list" || ce.sourcepos[0][1] >= 2); ) {
                    var ot = this.extendEndLine(ce.sourcepos[1][0]);
                    this.parser.partialParseExtends(this.lineTexts.slice(_, ot)), v || (v = C), C = ce, _ = ot, ce = ce.next;
                  }
                  this.parser.partialParseFinish();
                  var Bt = OX(ee);
                  return { newNodes: Bt, extStartNode: v, extEndNode: C };
                }, m.prototype.getRemovedNodeRange = function(v, C) {
                  return !v || v && _c(v) || C && _c(C) ? null : {
                    id: [v.id, C.id],
                    line: [v.sourcepos[0][0] - 1, C.sourcepos[1][0] - 1]
                  };
                }, m.prototype.markDeletedRefMap = function(v, C) {
                  var D = this;
                  if (!qc(this.refMap)) {
                    var _ = function(J) {
                      if (_c(J)) {
                        var ee = D.refMap[J.label];
                        ee && J.id === ee.id && (ee.unlinked = !0);
                      }
                    };
                    v && Gg(_, v.parent, C), C && Gg(_, C);
                  }
                }, m.prototype.replaceWithNewRefDefState = function(v) {
                  var C = this;
                  if (!qc(this.refMap)) {
                    var D = function(_) {
                      if (_c(_)) {
                        var J = _.label, ee = C.refMap[J];
                        (!ee || ee.unlinked) && (C.refMap[J] = Kg(_));
                      }
                    };
                    v.forEach(function(_) {
                      Gg(D, _);
                    });
                  }
                }, m.prototype.replaceWithRefDefCandidate = function() {
                  var v = this;
                  qc(this.refDefCandidateMap) || dv(this.refDefCandidateMap, function(C, D) {
                    var _ = D.label, J = D.sourcepos, ee = v.refMap[_];
                    (!ee || ee.unlinked || ee.sourcepos[0][0] > J[0][0]) && (v.refMap[_] = Kg(D));
                  });
                }, m.prototype.getRangeWithRefDef = function(v, C, D, _, J) {
                  if (this.referenceDefinition && !qc(this.refMap)) {
                    var ee = mv(this.root, v - 1), ce = mv(this.root, C + 1);
                    ee && _c(ee) && ee !== D && ee !== _ && (D = ee, v = D.sourcepos[0][0]), ce && _c(ce) && ce !== D && ce !== _ && (_ = ce, C = this.extendEndLine(_.sourcepos[1][0] + J));
                  }
                  return [D, _, v, C];
                }, m.prototype.parse = function(v, C, D) {
                  D === void 0 && (D = 0);
                  var _ = this.getNodeRange(v, C), J = _[0], ee = _[1], ce = J ? Math.min(J.sourcepos[0][0], v[0]) : v[0], qe = this.extendEndLine((ee ? Math.max(ee.sourcepos[1][0], C[0]) : C[0]) + D), We = this.parseRange.apply(this, this.getRangeWithRefDef(ce, qe, J, ee, D)), ft = We.newNodes, mt = We.extStartNode, ot = We.extEndNode, Bt = this.getRemovedNodeRange(mt, ot), Pt = ot ? ot.next : this.root.firstChild;
                  return this.referenceDefinition ? (this.markDeletedRefMap(mt, ot), this.replaceRangeNodes(mt, ot, ft), this.replaceWithNewRefDefState(ft)) : this.replaceRangeNodes(mt, ot, ft), { nodes: ft, removedNodeRange: Bt, nextNode: Pt };
                }, m.prototype.parseRefLink = function() {
                  var v = this, C = [];
                  return qc(this.refMap) || dv(this.refMap, function(D, _) {
                    _.unlinked && delete v.refMap[D], dv(v.refLinkCandidateMap, function(J, ee) {
                      var ce = ee.node, qe = ee.refLabel;
                      qe === D && C.push(v.parse(ce.sourcepos[0], ce.sourcepos[1]));
                    });
                  }), C;
                }, m.prototype.removeUnlinkedCandidate = function() {
                  qc(this.refDefCandidateMap) || [this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function(v) {
                    dv(v, function(C) {
                      BX(C) && delete v[C];
                    });
                  });
                }, m.prototype.editMarkdown = function(v, C, D) {
                  var _ = this.updateLineTexts(v, C, D), J = this.parse(v, C, _), ee = sQ(J, "nextNode");
                  AX(J.nextNode, _), this.updateRootNodeState();
                  var ce = [ee];
                  return this.referenceDefinition && (this.removeUnlinkedCandidate(), this.replaceWithRefDefCandidate(), ce = ce.concat(this.parseRefLink())), this.trigger("change", ce), ce;
                }, m.prototype.getLineTexts = function() {
                  return this.lineTexts;
                }, m.prototype.getRootNode = function() {
                  return this.root;
                }, m.prototype.findNodeAtPosition = function(v) {
                  var C = PX(this.root, v);
                  return !C || C === this.root ? null : C;
                }, m.prototype.findFirstNodeAtLine = function(v) {
                  return IX(this.root, v);
                }, m.prototype.on = function(v, C) {
                  this.eventHandlerMap[v].push(C);
                }, m.prototype.off = function(v, C) {
                  var D = this.eventHandlerMap[v], _ = D.indexOf(C);
                  D.splice(_, 1);
                }, m.prototype.findNodeById = function(v) {
                  return Iw(v);
                }, m.prototype.removeAllNode = function() {
                  bJ();
                }, m;
              })()
            ), zX = [
              "title",
              "textarea",
              "style",
              "xmp",
              "iframe",
              "noembed",
              "noframes",
              "script",
              "plaintext"
            ], Bw = new RegExp("<(/?(?:" + zX.join("|") + ")[^>]*>)", "ig");
            function Fw(m) {
              return Bw.test(m) ? m.replace(Bw, function(v, C) {
                return "&lt;" + C;
              }) : m;
            }
            var _w = {
              heading: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "h" + m.level,
                  outerNewLine: !0
                };
              },
              text: function(m) {
                return {
                  type: "text",
                  content: m.literal
                };
              },
              softbreak: function(m, v) {
                var C = v.options;
                return {
                  type: "html",
                  content: C.softbreak
                };
              },
              linebreak: function() {
                return {
                  type: "html",
                  content: `<br />
`
                };
              },
              emph: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "em"
                };
              },
              strong: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "strong"
                };
              },
              paragraph: function(m, v) {
                var C, D = v.entering, _ = (C = m.parent) === null || C === void 0 ? void 0 : C.parent;
                return _ && _.type === "list" && _.listData.tight ? null : {
                  type: D ? "openTag" : "closeTag",
                  tagName: "p",
                  outerNewLine: !0
                };
              },
              thematicBreak: function() {
                return {
                  type: "openTag",
                  tagName: "hr",
                  outerNewLine: !0,
                  selfClose: !0
                };
              },
              blockQuote: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "blockquote",
                  outerNewLine: !0,
                  innerNewLine: !0
                };
              },
              list: function(m, v) {
                var C = v.entering, D = m.listData, _ = D.type, J = D.start, ee = _ === "bullet" ? "ul" : "ol", ce = {};
                return ee === "ol" && J !== null && J !== 1 && (ce.start = J.toString()), {
                  type: C ? "openTag" : "closeTag",
                  tagName: ee,
                  attributes: ce,
                  outerNewLine: !0
                };
              },
              item: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "li",
                  outerNewLine: !0
                };
              },
              htmlInline: function(m, v) {
                var C = v.options, D = C.tagFilter ? Fw(m.literal) : m.literal;
                return { type: "html", content: D };
              },
              htmlBlock: function(m, v) {
                var C = v.options, D = C.tagFilter ? Fw(m.literal) : m.literal;
                return C.nodeId ? [
                  { type: "openTag", tagName: "div", outerNewLine: !0 },
                  { type: "html", content: D },
                  { type: "closeTag", tagName: "div", outerNewLine: !0 }
                ] : { type: "html", content: D, outerNewLine: !0 };
              },
              code: function(m) {
                return [
                  { type: "openTag", tagName: "code" },
                  { type: "text", content: m.literal },
                  { type: "closeTag", tagName: "code" }
                ];
              },
              codeBlock: function(m) {
                var v = m.info, C = v ? v.split(/\s+/) : [], D = [];
                return C.length > 0 && C[0].length > 0 && D.push("language-" + Fc(C[0])), [
                  { type: "openTag", tagName: "pre", outerNewLine: !0 },
                  { type: "openTag", tagName: "code", classNames: D },
                  { type: "text", content: m.literal },
                  { type: "closeTag", tagName: "code" },
                  { type: "closeTag", tagName: "pre", outerNewLine: !0 }
                ];
              },
              link: function(m, v) {
                var C = v.entering;
                if (C) {
                  var D = m, _ = D.title, J = D.destination;
                  return {
                    type: "openTag",
                    tagName: "a",
                    attributes: q({ href: Fc(J) }, _ && { title: Fc(_) })
                  };
                }
                return { type: "closeTag", tagName: "a" };
              },
              image: function(m, v) {
                var C = v.getChildrenText, D = v.skipChildren, _ = m, J = _.title, ee = _.destination;
                return D(), {
                  type: "openTag",
                  tagName: "img",
                  selfClose: !0,
                  attributes: q({ src: Fc(ee), alt: C(m) }, J && { title: Fc(J) })
                };
              },
              customBlock: function(m, v, C) {
                var D = m.info.trim().toLowerCase(), _ = C[D];
                if (_)
                  try {
                    return _(m, v);
                  } catch (J) {
                    console.warn("[@toast-ui/editor] - The error occurred when " + D + " block node was parsed in markdown renderer: " + J);
                  }
                return [
                  { type: "openTag", tagName: "div", outerNewLine: !0 },
                  { type: "text", content: m.literal },
                  { type: "closeTag", tagName: "div", outerNewLine: !0 }
                ];
              },
              frontMatter: function(m) {
                return [
                  {
                    type: "openTag",
                    tagName: "div",
                    outerNewLine: !0,
                    // Because front matter is metadata, it should not be render.
                    attributes: { style: "white-space: pre; display: none;" }
                  },
                  { type: "text", content: m.literal },
                  { type: "closeTag", tagName: "div", outerNewLine: !0 }
                ];
              },
              customInline: function(m, v, C) {
                var D = m, _ = D.info, J = D.firstChild, ee = _.trim().toLowerCase(), ce = C[ee], qe = v.entering;
                if (ce)
                  try {
                    return ce(m, v);
                  } catch (We) {
                    console.warn("[@toast-ui/editor] - The error occurred when " + ee + " inline node was parsed in markdown renderer: " + We);
                  }
                return qe ? [
                  { type: "openTag", tagName: "span" },
                  { type: "text", content: "$$" + _ + (J ? " " : "") }
                ] : [
                  { type: "text", content: "$$" },
                  { type: "closeTag", tagName: "span" }
                ];
              }
            }, qw = {
              strike: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "del"
                };
              },
              item: function(m, v) {
                var C = v.entering, D = m.listData, _ = D.checked, J = D.task;
                if (C) {
                  var ee = {
                    type: "openTag",
                    tagName: "li",
                    outerNewLine: !0
                  };
                  return J ? [
                    ee,
                    {
                      type: "openTag",
                      tagName: "input",
                      selfClose: !0,
                      attributes: q(q({}, _ && { checked: "" }), { disabled: "", type: "checkbox" })
                    },
                    {
                      type: "text",
                      content: " "
                    }
                  ] : ee;
                }
                return {
                  type: "closeTag",
                  tagName: "li",
                  outerNewLine: !0
                };
              },
              table: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "table",
                  outerNewLine: !0
                };
              },
              tableHead: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "thead",
                  outerNewLine: !0
                };
              },
              tableBody: function(m, v) {
                var C = v.entering;
                return {
                  type: C ? "openTag" : "closeTag",
                  tagName: "tbody",
                  outerNewLine: !0
                };
              },
              tableRow: function(m, v) {
                var C = v.entering;
                if (C)
                  return {
                    type: "openTag",
                    tagName: "tr",
                    outerNewLine: !0
                  };
                var D = [];
                if (m.lastChild)
                  for (var _ = m.parent.parent.columns.length, J = m.lastChild.endIdx, ee = J + 1; ee < _; ee += 1)
                    D.push({
                      type: "openTag",
                      tagName: "td",
                      outerNewLine: !0
                    }, {
                      type: "closeTag",
                      tagName: "td",
                      outerNewLine: !0
                    });
                return D.push({
                  type: "closeTag",
                  tagName: "tr",
                  outerNewLine: !0
                }), D;
              },
              tableCell: function(m, v) {
                var C = v.entering;
                if (m.ignored)
                  return {
                    type: "text",
                    content: ""
                  };
                var D = m.parent.parent, _ = D.type === "tableHead" ? "th" : "td", J = D.parent, ee = J.columns[m.startIdx], ce = ee?.align ? { align: ee.align } : null;
                return C ? q({ type: "openTag", tagName: _, outerNewLine: !0 }, ce && { attributes: ce }) : {
                  type: "closeTag",
                  tagName: _,
                  outerNewLine: !0
                };
              }
            }, HX = {
              softbreak: `
`,
              gfm: !1,
              tagFilter: !1,
              nodeId: !1
            };
            function VX(m) {
              for (var v = [], C = m.walker(), D = null; D = C.next(); ) {
                var _ = D.node;
                _.type === "text" && v.push(_.literal);
              }
              return v.join("");
            }
            var UX = (
              /** @class */
              (function() {
                function m(v) {
                  this.buffer = [], this.options = q(q({}, HX), v), this.convertors = this.createConvertors(), delete this.options.convertors;
                }
                return m.prototype.createConvertors = function() {
                  var v = q({}, _w);
                  if (this.options.gfm && (v = q(q({}, v), qw)), this.options.convertors) {
                    var C = this.options.convertors, D = Object.keys(C), _ = q(q({}, _w), qw);
                    D.forEach(function(J) {
                      var ee = v[J], ce = C[J], qe = Object.keys(_).indexOf(J) === -1 ? J.toLowerCase() : J;
                      ee ? v[qe] = function(We, ft, mt) {
                        return ft.origin = function() {
                          return ee(We, ft, mt);
                        }, ce(We, ft);
                      } : v[qe] = ce;
                    });
                  }
                  return v;
                }, m.prototype.getConvertors = function() {
                  return this.convertors;
                }, m.prototype.getOptions = function() {
                  return this.options;
                }, m.prototype.render = function(v) {
                  var C = this;
                  this.buffer = [];
                  for (var D = v.walker(), _ = null, J = function() {
                    var ce = _.node, qe = _.entering, We = ee.convertors[ce.type];
                    if (!We)
                      return "continue";
                    var ft = !1, mt = {
                      entering: qe,
                      leaf: !Ig(ce),
                      options: ee.options,
                      getChildrenText: VX,
                      skipChildren: function() {
                        ft = !0;
                      }
                    }, ot = ow(ce) || BJ(ce) ? We(ce, mt, ee.convertors) : We(ce, mt);
                    if (ot) {
                      var Bt = Array.isArray(ot) ? ot : [ot];
                      Bt.forEach(function(Pt, gr) {
                        Pt.type === "openTag" && C.options.nodeId && gr === 0 && (Pt.attributes || (Pt.attributes = {}), Pt.attributes["data-nodeid"] = String(ce.id)), C.renderHTMLNode(Pt);
                      }), ft && (D.resumeAt(ce, !1), D.next());
                    }
                  }, ee = this; _ = D.next(); )
                    J();
                  return this.addNewLine(), this.buffer.join("");
                }, m.prototype.renderHTMLNode = function(v) {
                  switch (v.type) {
                    case "openTag":
                    case "closeTag":
                      this.renderElementNode(v);
                      break;
                    case "text":
                      this.renderTextNode(v);
                      break;
                    case "html":
                      this.renderRawHtmlNode(v);
                      break;
                  }
                }, m.prototype.generateOpenTagString = function(v) {
                  var C = this, D = v.tagName, _ = v.classNames, J = v.attributes;
                  this.buffer.push("<" + D), _ && _.length > 0 && this.buffer.push(' class="' + _.join(" ") + '"'), J && Object.keys(J).forEach(function(ee) {
                    var ce = J[ee];
                    C.buffer.push(" " + ee + '="' + ce + '"');
                  }), v.selfClose && this.buffer.push(" /"), this.buffer.push(">");
                }, m.prototype.generateCloseTagString = function(v) {
                  var C = v.tagName;
                  this.buffer.push("</" + C + ">");
                }, m.prototype.addNewLine = function() {
                  this.buffer.length && fv(fv(this.buffer)) !== `
` && this.buffer.push(`
`);
                }, m.prototype.addOuterNewLine = function(v) {
                  v.outerNewLine && this.addNewLine();
                }, m.prototype.addInnerNewLine = function(v) {
                  v.innerNewLine && this.addNewLine();
                }, m.prototype.renderTextNode = function(v) {
                  this.buffer.push(Fc(v.content));
                }, m.prototype.renderRawHtmlNode = function(v) {
                  this.addOuterNewLine(v), this.buffer.push(v.content), this.addOuterNewLine(v);
                }, m.prototype.renderElementNode = function(v) {
                  v.type === "openTag" ? (this.addOuterNewLine(v), this.generateOpenTagString(v), v.selfClose ? this.addOuterNewLine(v) : this.addInnerNewLine(v)) : (this.addInnerNewLine(v), this.generateCloseTagString(v), this.addOuterNewLine(v));
                }, m;
              })()
            ), $X = p(956), WX = /* @__PURE__ */ p.n($X), jX = p(969), zw = /* @__PURE__ */ p.n(jX), GX = p(348), Hw = /* @__PURE__ */ p.n(GX), KX = p(349), Vw = /* @__PURE__ */ p.n(KX), JX = p(204), Uw = /* @__PURE__ */ p.n(JX), QX = p(462), Jg = /* @__PURE__ */ p.n(QX), XX = p(522), $w = /* @__PURE__ */ p.n(XX), YX = p(990), ZX = /* @__PURE__ */ p.n(YX), eY = p(322), tY = /* @__PURE__ */ p.n(eY), rY = p(758), nY = /* @__PURE__ */ p.n(rY), iY = p(929), gv = /* @__PURE__ */ p.n(iY), aY = p(714), oY = /* @__PURE__ */ p.n(aY);
            p(471);
            var Ww = "[A-Za-z][A-Za-z0-9-]*", sY = "[a-zA-Z_:][a-zA-Z0-9:._-]*", lY = "[^\"'=<>`\\x00-\\x20]+", uY = "'[^']*'", cY = '"[^"]*"', fY = "(?:" + lY + "|" + uY + "|" + cY + ")", dY = "(?:\\s*=\\s*" + fY + ")", jw = "(?:\\s+" + sY + dY + "?)", hY = "<(" + Ww + ")(" + jw + ")*\\s*/?>", pY = "</(" + Ww + ")\\s*[>]", vY = "(?:" + hY + "|" + pY + ")", Gw = new RegExp("^" + vY, "i");
            p(934), p(391);
            function Qg(m, v) {
              return m.indexOf(v) !== -1;
            }
            var mY = ["rel", "target", "hreflang", "type"];
            function gY(m) {
              if (!m)
                return null;
              var v = {};
              return mY.forEach(function(C) {
                gv()(m[C]) || (v[C] = m[C]);
              }), v;
            }
            function yY(m) {
              return m[m.length - 1];
            }
            function Xg(m) {
              return typeof m == "object" && m !== null;
            }
            function Yg(m, v) {
              var C = T({}, m);
              return m && v && Object.keys(v).forEach(function(D) {
                Xg(C[D]) ? Array.isArray(v[D]) ? C[D] = Zg(v[D]) : C.hasOwnProperty(D) ? C[D] = Yg(C[D], v[D]) : C[D] = ey(v[D]) : C[D] = v[D];
              }), C;
            }
            function Zg(m) {
              return m.map(function(v) {
                return Xg(v) ? Array.isArray(v) ? Zg(v) : ey(v) : v;
              });
            }
            function ey(m) {
              var v = Object.keys(m);
              return v.length ? v.reduce(function(C, D) {
                return Xg(m[D]) ? C[D] = Array.isArray(m[D]) ? Zg(m[D]) : ey(m[D]) : C[D] = m[D], C;
              }, {}) : m;
            }
            function Kw(m, v) {
              return v === void 0 && (v = {}), Object.keys(v).forEach(function(C) {
                m.hasOwnProperty(C) && typeof m[C] == "object" ? Array.isArray(v[C]) ? m[C] = v[C] : Kw(m[C], v[C]) : m[C] = v[C];
              }), m;
            }
            function Jw(m, v) {
              return m > v ? [v, m] : [m, v];
            }
            function kY(m, v, C) {
              var D = parseInt(m.left, 10), _ = parseInt(m.top, 10), J = parseInt(m.width, 10) + parseInt(m.paddingLeft, 10) + parseInt(m.paddingRight, 10), ee = parseInt(m.height, 10) + parseInt(m.paddingTop, 10) + parseInt(m.paddingBottom, 10);
              return v >= D && v <= D + J && C >= _ && C <= _ + ee;
            }
            var wY = "toastui-editor-";
            function yv() {
              for (var m = [], v = 0; v < arguments.length; v++)
                m[v] = arguments[v];
              for (var C = [], D = 0, _ = m; D < _.length; D++) {
                var J = _[D], ee = void 0;
                Array.isArray(J) ? ee = J[0] ? J[1] : null : ee = J, ee && C.push("" + wY + ee);
              }
              return C.join(" ");
            }
            function Qw(m) {
              m.parentNode && m.parentNode.removeChild(m);
            }
            function Xw(m, v, C) {
              gv()(C) && (C = !oY()(m, v));
              var D = C ? Uw() : Jg();
              D(m, v);
            }
            function bY(m, v) {
              var C = document.createElement("div");
              nY()(m) ? C.innerHTML = m : C.appendChild(m);
              var D = C.firstChild;
              return D;
            }
            function CY(m) {
              var v = /<img class="ProseMirror-separator" alt="">/g, C = / class="ProseMirror-trailingBreak"/g, D = m;
              return D = D.replace(v, ""), D = D.replace(C, ""), D;
            }
            var TY = p(294), Yw = /* @__PURE__ */ p.n(TY);
            function SY(m) {
              return m.sourcepos[0][1];
            }
            function xY(m) {
              switch (m.type) {
                case "code":
                case "text":
                case "emph":
                case "strong":
                case "strike":
                case "link":
                case "image":
                case "htmlInline":
                case "linebreak":
                case "softbreak":
                case "customInline":
                  return !0;
                default:
                  return !1;
              }
            }
            function EY(m, v, C) {
              for (C === void 0 && (C = !0), m = C ? m : m.parent; m && m.type !== "document"; ) {
                if (v(m))
                  return m;
                m = m.parent;
              }
              return null;
            }
            function MY(m) {
              var v = m.firstChild.literal;
              switch (m.type) {
                case "emph":
                  return "*" + v + "*";
                case "strong":
                  return "**" + v + "**";
                case "strike":
                  return "~~" + v + "~~";
                case "code":
                  return "`" + v + "`";
                case "link":
                case "image":
                  var C = m, D = C.destination, _ = C.title, J = m.type === "link" ? "" : "!";
                  return J + "[" + v + "](" + D + (_ ? ' "' + _ + '"' : "") + ")";
                default:
                  return null;
              }
            }
            var NY = {}, Zw = /\$\$widget\d+\s/;
            function e1(m) {
              var v = m.search(Zw);
              if (v !== -1) {
                var C = m.substring(v), D = C.replace(Zw, "").replace("$$", "");
                m = m.substring(0, v), m += e1(D);
              }
              return m;
            }
            function OY(m, v) {
              var C = NY[m], D = C.rule, _ = C.toDOM, J = e1(v).match(D);
              return J && (v = J[0]), _(v);
            }
            function DY(m) {
              for (var v, C = "", D = m.walker(); v = D.next(); ) {
                var _ = v.node, J = v.entering;
                J && (_ !== m && _.type !== "text" ? (C += MY(_), D.resumeAt(m, !1), D.next()) : _.type === "text" && (C += _.literal));
              }
              return C;
            }
            var AY = p(368), LY = /* @__PURE__ */ p.n(AY), RY = ["iframe", "embed"], t1 = [];
            function IY(m) {
              Qg(RY, m) && t1.push(m.toLowerCase());
            }
            function PY(m, v) {
              return LY().sanitize(m, T({ ADD_TAGS: t1, ADD_ATTR: ["rel", "target", "hreflang", "type"], FORBID_TAGS: [
                "input",
                "script",
                "textarea",
                "form",
                "button",
                "select",
                "meta",
                "style",
                "link",
                "title",
                "object",
                "base"
              ] }, v));
            }
            function BY(m, v) {
              return m.literal.replace(new RegExp("(<\\s*" + v + "[^>]*>)|(</" + v + "\\s*[>])", "ig"), "").trim();
            }
            function FY(m) {
              m = m.match(Gw)[0];
              var v = m.match(new RegExp(jw, "g"));
              return v ? v.reduce(function(C, D) {
                var _ = D.trim().split("="), J = _[0], ee = _.slice(1);
                return ee.length && (C[J] = ee.join("=").replace(/'|"/g, "").trim()), C;
              }, {}) : {};
            }
            var _Y = /^\s*<\s*\//, qY = {
              paragraph: function(m, v) {
                var C = v.entering, D = v.origin, _ = v.options;
                return _.nodeId ? {
                  type: C ? "openTag" : "closeTag",
                  outerNewLine: !0,
                  tagName: "p"
                } : D();
              },
              softbreak: function(m) {
                var v = m.prev && m.prev.type === "htmlInline", C = v && /<br ?\/?>/.test(m.prev.literal), D = C ? `
` : `<br>
`;
                return { type: "html", content: D };
              },
              item: function(m, v) {
                var C = v.entering;
                if (C) {
                  var D = {}, _ = [];
                  return m.listData.task && (D["data-task"] = "", _.push("task-list-item"), m.listData.checked && (_.push("checked"), D["data-task-checked"] = "")), {
                    type: "openTag",
                    tagName: "li",
                    classNames: _,
                    attributes: D,
                    outerNewLine: !0
                  };
                }
                return {
                  type: "closeTag",
                  tagName: "li",
                  outerNewLine: !0
                };
              },
              code: function(m) {
                var v = { "data-backticks": String(m.tickCount) };
                return [
                  { type: "openTag", tagName: "code", attributes: v },
                  { type: "text", content: m.literal },
                  { type: "closeTag", tagName: "code" }
                ];
              },
              codeBlock: function(m) {
                var v = m, C = v.fenceLength, D = v.info, _ = D ? D.split(/\s+/) : [], J = [], ee = {};
                if (C > 3 && (ee["data-backticks"] = C), _.length > 0 && _[0].length > 0) {
                  var ce = _[0];
                  J.push("lang-" + ce), ee["data-language"] = ce;
                }
                return [
                  { type: "openTag", tagName: "pre", classNames: J },
                  { type: "openTag", tagName: "code", attributes: ee },
                  { type: "text", content: m.literal },
                  { type: "closeTag", tagName: "code" },
                  { type: "closeTag", tagName: "pre" }
                ];
              },
              customInline: function(m, v) {
                var C = v.origin, D = v.entering, _ = v.skipChildren, J = m.info;
                if (J.indexOf("widget") !== -1 && D) {
                  _();
                  var ee = DY(m), ce = OY(J, ee).outerHTML;
                  return [
                    { type: "openTag", tagName: "span", classNames: ["tui-widget"] },
                    { type: "html", content: ce },
                    { type: "closeTag", tagName: "span" }
                  ];
                }
                return C();
              }
            };
            function zY(m, v) {
              var C = T({}, qY);
              return m && (C.link = function(D, _) {
                var J = _.entering, ee = _.origin, ce = ee();
                return J && (ce.attributes = T(T({}, ce.attributes), m)), ce;
              }), v && Object.keys(v).forEach(function(D) {
                var _ = C[D], J = v[D];
                _ && Yw()(J) ? C[D] = function(ee, ce) {
                  var qe = T({}, ce);
                  return qe.origin = function() {
                    return _(ee, ce);
                  }, J(ee, qe);
                } : Qg(["htmlBlock", "htmlInline"], D) && !Yw()(J) ? C[D] = function(ee, ce) {
                  var qe = ee.literal.match(Gw);
                  if (qe) {
                    var We = qe[0], ft = qe[1], mt = qe[3], ot = (ft || mt).toLowerCase(), Bt = J[ot], Pt = BY(ee, ot);
                    if (Bt) {
                      var gr = T({}, ee);
                      return gr.attrs = FY(We), gr.childrenHTML = Pt, gr.type = ot, ce.entering = !_Y.test(ee.literal), Bt(gr, ce);
                    }
                  }
                  return ce.origin();
                } : C[D] = J;
              }), C;
            }
            var HY = ["UL", "OL", "BLOCKQUOTE"];
            function VY(m, v) {
              for (var C = 0; m && m !== v && (Qg(HY, m.tagName) || (C += m.offsetTop), m.offsetParent !== v.offsetParent); )
                m = m.parentElement;
              return C;
            }
            function UY(m, v) {
              for (var C = v, D = null; C; ) {
                var _ = C.firstElementChild;
                if (!_)
                  break;
                var J = r1(_, m, VY(C, v));
                D = C, C = J;
              }
              var ee = C || D;
              return ee === v ? null : ee;
            }
            function r1(m, v, C) {
              return m && v > C + m.offsetTop ? r1(m.nextElementSibling, v, C) || m : null;
            }
            var $Y = {};
            function ty(m) {
              m && (delete $Y[Number(m.getAttribute("data-nodeid"))], ZX()(m.children).forEach(function(v) {
                ty(v);
              }));
            }
            var ry = yv("md-preview-highlight");
            function WY(m, v) {
              for (var C = m.firstChild; C && C.next && !(SY(C.next) > v + 1); )
                C = C.next;
              return C;
            }
            var jY = (
              /** @class */
              (function() {
                function m(v, C) {
                  var D = document.createElement("div");
                  this.el = D, this.eventEmitter = v, this.isViewer = !!C.isViewer, this.el.className = yv("md-preview");
                  var _ = C.linkAttributes, J = C.customHTMLRenderer, ee = C.sanitizer, ce = C.highlight, qe = ce === void 0 ? !1 : ce;
                  this.renderer = new UX({
                    gfm: !0,
                    nodeId: !0,
                    convertors: zY(_, J)
                  }), this.cursorNodeId = null, this.sanitizer = ee, this.initEvent(qe), this.initContentSection(), this.isViewer && (this.previewContent.style.overflowWrap = "break-word");
                }
                return m.prototype.initContentSection = function() {
                  this.previewContent = bY('<div class="' + yv("contents") + '"></div>'), this.isViewer || this.el.appendChild(this.previewContent);
                }, m.prototype.toggleActive = function(v) {
                  Xw(this.el, "active", v);
                }, m.prototype.initEvent = function(v) {
                  var C = this;
                  this.eventEmitter.listen("updatePreview", this.update.bind(this)), !this.isViewer && (v && (this.eventEmitter.listen("changeToolbarState", function(D) {
                    var _ = D.mdNode, J = D.cursorPos;
                    C.updateCursorNode(_, J);
                  }), this.eventEmitter.listen("blur", function() {
                    C.removeHighlight();
                  })), Hw()(this.el, "scroll", function(D) {
                    C.eventEmitter.emit("scroll", "preview", UY(D.target.scrollTop, C.previewContent));
                  }), this.eventEmitter.listen("changePreviewTabPreview", function() {
                    return C.toggleActive(!0);
                  }), this.eventEmitter.listen("changePreviewTabWrite", function() {
                    return C.toggleActive(!1);
                  }));
                }, m.prototype.removeHighlight = function() {
                  if (this.cursorNodeId) {
                    var v = this.getElementByNodeId(this.cursorNodeId);
                    v && Jg()(v, ry);
                  }
                }, m.prototype.updateCursorNode = function(v, C) {
                  v && (v = EY(v, function(ee) {
                    return !xY(ee);
                  }), v.type === "tableRow" ? v = WY(v, C[1]) : v.type === "tableBody" && (v = null));
                  var D = v ? v.id : null;
                  if (this.cursorNodeId !== D) {
                    var _ = this.getElementByNodeId(this.cursorNodeId), J = this.getElementByNodeId(D);
                    _ && Jg()(_, ry), J && Uw()(J, ry), this.cursorNodeId = D;
                  }
                }, m.prototype.getElementByNodeId = function(v) {
                  return v ? this.previewContent.querySelector('[data-nodeid="' + v + '"]') : null;
                }, m.prototype.update = function(v) {
                  var C = this;
                  v.forEach(function(D) {
                    return C.replaceRangeNodes(D);
                  }), this.eventEmitter.emit("afterPreviewRender", this);
                }, m.prototype.replaceRangeNodes = function(v) {
                  var C = this, D = v.nodes, _ = v.removedNodeRange, J = this.previewContent, ee = this.eventEmitter.emitReduce("beforePreviewRender", this.sanitizer(D.map(function(Pt) {
                    return C.renderer.render(Pt);
                  }).join("")));
                  if (!_)
                    J.insertAdjacentHTML("afterbegin", ee);
                  else {
                    var ce = _.id, qe = ce[0], We = ce[1], ft = this.getElementByNodeId(qe), mt = this.getElementByNodeId(We);
                    if (ft) {
                      ft.insertAdjacentHTML("beforebegin", ee);
                      for (var ot = ft; ot && ot !== mt; ) {
                        var Bt = ot.nextElementSibling;
                        Qw(ot), ty(ot), ot = Bt;
                      }
                      ot?.parentNode && (Qw(ot), ty(ot));
                    }
                  }
                }, m.prototype.getRenderer = function() {
                  return this.renderer;
                }, m.prototype.destroy = function() {
                  Vw()(this.el, "scroll"), this.el = null;
                }, m.prototype.getElement = function() {
                  return this.el;
                }, m.prototype.getHTML = function() {
                  return CY(this.previewContent.innerHTML);
                }, m.prototype.setHTML = function(v) {
                  this.previewContent.innerHTML = v;
                }, m.prototype.setHeight = function(v) {
                  $w()(this.el, { height: v + "px" });
                }, m.prototype.setMinHeight = function(v) {
                  $w()(this.el, { minHeight: v + "px" });
                }, m;
              })()
            ), GY = jY, kv = p(814), ny = p(479), n1 = p(311), KY = p(481), JY = p(43), QY = p(928), XY = /* @__PURE__ */ p.n(QY), YY = (
              /** @class */
              (function() {
                function m() {
                  this.keys = [], this.values = [];
                }
                return m.prototype.getKeyIndex = function(v) {
                  return XY()(v, this.keys);
                }, m.prototype.get = function(v) {
                  return this.values[this.getKeyIndex(v)];
                }, m.prototype.set = function(v, C) {
                  var D = this.getKeyIndex(v);
                  return D > -1 ? this.values[D] = C : (this.keys.push(v), this.values.push(C)), this;
                }, m.prototype.has = function(v) {
                  return this.getKeyIndex(v) > -1;
                }, m.prototype.delete = function(v) {
                  var C = this.getKeyIndex(v);
                  return C > -1 ? (this.keys.splice(C, 1), this.values.splice(C, 1), !0) : !1;
                }, m.prototype.forEach = function(v, C) {
                  var D = this;
                  C === void 0 && (C = this), this.values.forEach(function(_, J) {
                    _ && D.keys[J] && v.call(C, _, D.keys[J], D);
                  });
                }, m.prototype.clear = function() {
                  this.keys = [], this.values = [];
                }, m;
              })()
            ), i1 = YY, iy = "en-US", ZY = (
              /** @class */
              (function() {
                function m() {
                  this.code = iy, this.langs = new i1();
                }
                return m.prototype.setCode = function(v) {
                  this.code = v || iy;
                }, m.prototype.setLanguage = function(v, C) {
                  var D = this;
                  v = [].concat(v), v.forEach(function(_) {
                    if (!D.langs.has(_))
                      D.langs.set(_, C);
                    else {
                      var J = D.langs.get(_);
                      D.langs.set(_, zw()(J, C));
                    }
                  });
                }, m.prototype.get = function(v, C) {
                  C || (C = this.code);
                  var D = this.langs.get(C);
                  D || (D = this.langs.get(iy));
                  var _ = D[v];
                  if (!_)
                    throw new Error('There is no text key "' + v + '" in ' + C);
                  return _;
                }, m;
              })()
            ), eZ = new ZY();
            function tZ(m, v) {
              for (var C = m.depth; C; ) {
                var D = m.node(C);
                if (v(D, C))
                  return {
                    node: D,
                    depth: C,
                    offset: C > 0 ? m.before(C) : 0
                  };
                C -= 1;
              }
              return null;
            }
            var a1 = /* @__PURE__ */ new Map(), o1 = (
              /** @class */
              (function() {
                function m(v, C, D, _) {
                  this.table = v, this.tableRows = C, this.tableStartPos = D, this.rowInfo = _;
                }
                return m.create = function(v) {
                  var C = tZ(v, function(Pt) {
                    var gr = Pt.type;
                    return gr.name === "table";
                  });
                  if (C) {
                    var D = C.node, _ = C.depth, J = C.offset, ee = a1.get(D);
                    if (ee?.tableStartPos === J + 1)
                      return ee;
                    var ce = [], qe = v.start(_), We = D.child(0), ft = D.child(1), mt = ay(We, qe), ot = ay(ft, qe + We.nodeSize);
                    We.forEach(function(Pt) {
                      return ce.push(Pt);
                    }), ft.forEach(function(Pt) {
                      return ce.push(Pt);
                    });
                    var Bt = new m(D, ce, qe, mt.concat(ot));
                    return a1.set(D, Bt), Bt;
                  }
                  return null;
                }, Object.defineProperty(m.prototype, "totalRowCount", {
                  get: function() {
                    return this.rowInfo.length;
                  },
                  enumerable: !1,
                  configurable: !0
                }), Object.defineProperty(m.prototype, "totalColumnCount", {
                  get: function() {
                    return this.rowInfo[0].length;
                  },
                  enumerable: !1,
                  configurable: !0
                }), Object.defineProperty(m.prototype, "tableStartOffset", {
                  get: function() {
                    return this.tableStartPos;
                  },
                  enumerable: !1,
                  configurable: !0
                }), Object.defineProperty(m.prototype, "tableEndOffset", {
                  get: function() {
                    return this.tableStartPos + this.table.nodeSize - 1;
                  },
                  enumerable: !1,
                  configurable: !0
                }), m.prototype.getCellInfo = function(v, C) {
                  return this.rowInfo[v][C];
                }, m.prototype.posAt = function(v, C) {
                  for (var D = 0, _ = this.tableStartPos; ; D += 1) {
                    var J = _ + this.tableRows[D].nodeSize;
                    if (D === v) {
                      for (var ee = C; ee < this.totalColumnCount && this.rowInfo[D][ee].offset < _; )
                        ee += 1;
                      return ee === this.totalColumnCount ? J : this.rowInfo[D][ee].offset;
                    }
                    _ = J;
                  }
                }, m.prototype.getNodeAndPos = function(v, C) {
                  var D = this.rowInfo[v][C];
                  return {
                    node: this.table.nodeAt(D.offset - this.tableStartOffset),
                    pos: D.offset
                  };
                }, m.prototype.extendedRowspan = function(v, C) {
                  return !1;
                }, m.prototype.extendedColspan = function(v, C) {
                  return !1;
                }, m.prototype.getRowspanCount = function(v, C) {
                  return 0;
                }, m.prototype.getColspanCount = function(v, C) {
                  return 0;
                }, m.prototype.decreaseColspanCount = function(v, C) {
                  return 0;
                }, m.prototype.decreaseRowspanCount = function(v, C) {
                  return 0;
                }, m.prototype.getColspanStartInfo = function(v, C) {
                  return null;
                }, m.prototype.getRowspanStartInfo = function(v, C) {
                  return null;
                }, m.prototype.getCellStartOffset = function(v, C) {
                  var D = this.rowInfo[v][C].offset;
                  return this.extendedRowspan(v, C) ? this.posAt(v, C) : D;
                }, m.prototype.getCellEndOffset = function(v, C) {
                  var D = this.rowInfo[v][C], _ = D.offset, J = D.nodeSize;
                  return this.extendedRowspan(v, C) ? this.posAt(v, C) : _ + J;
                }, m.prototype.getCellIndex = function(v) {
                  for (var C = 0; C < this.totalRowCount; C += 1)
                    for (var D = this.rowInfo[C], _ = 0; _ < this.totalColumnCount; _ += 1)
                      if (D[_].offset + 1 > v.pos)
                        return [C, _];
                  return [0, 0];
                }, m.prototype.getRectOffsets = function(v, C) {
                  var D, _, J;
                  C === void 0 && (C = v), v.pos > C.pos && (D = [C, v], v = D[0], C = D[1]);
                  var ee = this.getCellIndex(v), ce = ee[0], qe = ee[1], We = this.getCellIndex(C), ft = We[0], mt = We[1];
                  return _ = Jw(ce, ft), ce = _[0], ft = _[1], J = Jw(qe, mt), qe = J[0], mt = J[1], this.getSpannedOffsets({ startRowIdx: ce, startColIdx: qe, endRowIdx: ft, endColIdx: mt });
                }, m.prototype.getSpannedOffsets = function(v) {
                  return v;
                }, m;
              })()
            ), ay = function(m, v) {
              var C = [];
              return m.forEach(function(D, _) {
                var J = { rowspanMap: {}, colspanMap: {}, length: 0 };
                D.forEach(function(ee, ce) {
                  for (var qe = ee.nodeSize, We = 0; J[We]; )
                    We += 1;
                  J[We] = {
                    // 2 is the sum of the front and back positions of the tag
                    offset: v + _ + ce + 2,
                    nodeSize: qe
                  }, J.length += 1;
                }), C.push(J);
              }), C;
            };
            function rZ(m, v) {
              return Kw(o1.prototype, m), ay = v, o1;
            }
            function nZ(m) {
              var v = m.plugin, C = m.eventEmitter, D = m.usageStatistics, _ = m.instance, J = { Plugin: kv.Plugin, PluginKey: kv.PluginKey, Selection: kv.Selection, TextSelection: kv.TextSelection }, ee = { Decoration: n1.Decoration, DecorationSet: n1.DecorationSet }, ce = { Fragment: JY.Fragment }, qe = { InputRule: ny.InputRule, inputRules: ny.inputRules, undoInputRule: ny.undoInputRule }, We = { keymap: KY.keymap }, ft = {
                eventEmitter: C,
                usageStatistics: D,
                instance: _,
                pmState: J,
                pmView: ee,
                pmModel: ce,
                pmRules: qe,
                pmKeymap: We,
                i18n: eZ
              };
              if (tY()(v)) {
                var mt = v[0], ot = v[1], Bt = ot === void 0 ? {} : ot;
                return mt(ft, Bt);
              }
              return v(ft);
            }
            function iZ(m) {
              var v = m.plugins, C = m.eventEmitter, D = m.usageStatistics, _ = m.instance;
              return C.listen("mixinTableOffsetMapPrototype", rZ), (v ?? []).reduce(function(J, ee) {
                var ce = nZ({
                  plugin: ee,
                  eventEmitter: C,
                  usageStatistics: D,
                  instance: _
                });
                if (!ce)
                  throw new Error("The return value of the executed plugin is empty.");
                var qe = ce.markdownParsers, We = ce.toHTMLRenderers, ft = ce.toMarkdownRenderers, mt = ce.markdownPlugins, ot = ce.wysiwygPlugins, Bt = ce.wysiwygNodeViews, Pt = ce.markdownCommands, gr = ce.wysiwygCommands, sn = ce.toolbarItems;
                return We && (J.toHTMLRenderers = Yg(J.toHTMLRenderers, We)), ft && (J.toMarkdownRenderers = Yg(J.toMarkdownRenderers, ft)), mt && (J.mdPlugins = J.mdPlugins.concat(mt)), ot && (J.wwPlugins = J.wwPlugins.concat(ot)), Bt && (J.wwNodeViews = T(T({}, J.wwNodeViews), Bt)), Pt && (J.mdCommands = T(T({}, J.mdCommands), Pt)), gr && (J.wwCommands = T(T({}, J.wwCommands), gr)), sn && (J.toolbarItems = J.toolbarItems.concat(sn)), qe && (J.markdownParsers = T(T({}, J.markdownParsers), qe)), J;
              }, {
                toHTMLRenderers: {},
                toMarkdownRenderers: {},
                mdPlugins: [],
                wwPlugins: [],
                wwNodeViews: {},
                mdCommands: {},
                wwCommands: {},
                toolbarItems: [],
                markdownParsers: {}
              });
            }
            var aZ = p(404), oZ = /* @__PURE__ */ p.n(aZ), s1 = [
              "afterPreviewRender",
              "updatePreview",
              "changeMode",
              "needChangeMode",
              "command",
              "changePreviewStyle",
              "changePreviewTabPreview",
              "changePreviewTabWrite",
              "scroll",
              "contextmenu",
              "show",
              "hide",
              "changeLanguage",
              "changeToolbarState",
              "toggleScrollSync",
              "mixinTableOffsetMapPrototype",
              "setFocusedNode",
              "removePopupWidget",
              "query",
              // provide event for user
              "openPopup",
              "closePopup",
              "addImageBlobHook",
              "beforePreviewRender",
              "beforeConvertWysiwygToMarkdown",
              "load",
              "loadUI",
              "change",
              "caretChange",
              "destroy",
              "focus",
              "blur",
              "keydown",
              "keyup"
            ], sZ = (
              /** @class */
              (function() {
                function m() {
                  var v = this;
                  this.events = new i1(), this.eventTypes = s1.reduce(function(C, D) {
                    return T(T({}, C), { type: D });
                  }, {}), this.hold = !1, s1.forEach(function(C) {
                    v.addEventType(C);
                  });
                }
                return m.prototype.listen = function(v, C) {
                  var D = this.getTypeInfo(v), _ = this.events.get(D.type) || [];
                  if (!this.hasEventType(D.type))
                    throw new Error("There is no event type " + D.type);
                  D.namespace && (C.namespace = D.namespace), _.push(C), this.events.set(D.type, _);
                }, m.prototype.emit = function(v) {
                  for (var C = [], D = 1; D < arguments.length; D++)
                    C[D - 1] = arguments[D];
                  var _ = this.getTypeInfo(v), J = this.events.get(_.type), ee = [];
                  return !this.hold && J && J.forEach(function(ce) {
                    var qe = ce.apply(void 0, C);
                    gv()(qe) || ee.push(qe);
                  }), ee;
                }, m.prototype.emitReduce = function(v, C) {
                  for (var D = [], _ = 2; _ < arguments.length; _++)
                    D[_ - 2] = arguments[_];
                  var J = this.events.get(v);
                  return !this.hold && J && J.forEach(function(ee) {
                    var ce = ee.apply(void 0, N([C], D));
                    oZ()(ce) || (C = ce);
                  }), C;
                }, m.prototype.getTypeInfo = function(v) {
                  var C = v.split(".");
                  return {
                    type: C[0],
                    namespace: C[1]
                  };
                }, m.prototype.hasEventType = function(v) {
                  return !gv()(this.eventTypes[this.getTypeInfo(v).type]);
                }, m.prototype.addEventType = function(v) {
                  if (this.hasEventType(v))
                    throw new Error("There is already have event type " + v);
                  this.eventTypes[v] = v;
                }, m.prototype.removeEventHandler = function(v, C) {
                  var D = this, _ = this.getTypeInfo(v), J = _.type, ee = _.namespace;
                  J && C ? this.removeEventHandlerWithHandler(J, C) : J && !ee ? this.events.delete(J) : !J && ee ? this.events.forEach(function(ce, qe) {
                    D.removeEventHandlerWithTypeInfo(qe, ee);
                  }) : J && ee && this.removeEventHandlerWithTypeInfo(J, ee);
                }, m.prototype.removeEventHandlerWithHandler = function(v, C) {
                  var D = this.events.get(v);
                  if (D) {
                    var _ = D.indexOf(C);
                    D.indexOf(C) >= 0 && D.splice(_, 1);
                  }
                }, m.prototype.removeEventHandlerWithTypeInfo = function(v, C) {
                  var D = [], _ = this.events.get(v);
                  _ && (_.map(function(J) {
                    return J.namespace !== C && D.push(J), null;
                  }), this.events.set(v, D));
                }, m.prototype.getEvents = function() {
                  return this.events;
                }, m.prototype.holdEventInvoke = function(v) {
                  this.hold = !0, v(), this.hold = !1;
                }, m;
              })()
            ), lZ = sZ, uZ = "data-task", cZ = "data-task-disabled", fZ = "checked";
            function dZ(m) {
              ["htmlBlock", "htmlInline"].forEach(function(v) {
                m[v] && Object.keys(m[v]).forEach(function(C) {
                  return IY(C);
                });
              });
            }
            var hZ = (
              /** @class */
              (function() {
                function m(v) {
                  var C = this;
                  this.options = zw()({
                    linkAttributes: null,
                    extendedAutolinks: !1,
                    customHTMLRenderer: null,
                    referenceDefinition: !1,
                    customHTMLSanitizer: null,
                    frontMatter: !1,
                    usageStatistics: !0,
                    theme: "light"
                  }, v), this.eventEmitter = new lZ();
                  var D = gY(this.options.linkAttributes), _ = iZ({
                    plugins: this.options.plugins,
                    eventEmitter: this.eventEmitter,
                    usageStatistics: this.options.usageStatistics,
                    instance: this
                  }) || {}, J = _.toHTMLRenderers, ee = _.markdownParsers, ce = this.options, qe = ce.customHTMLRenderer, We = ce.extendedAutolinks, ft = ce.referenceDefinition, mt = ce.frontMatter, ot = ce.customHTMLSanitizer, Bt = {
                    linkAttributes: D,
                    customHTMLRenderer: T(T({}, J), qe),
                    extendedAutolinks: We,
                    referenceDefinition: ft,
                    frontMatter: mt,
                    sanitizer: ot || PY
                  };
                  dZ(Bt.customHTMLRenderer), this.options.events && WX()(this.options.events, function(Ca, ua) {
                    C.on(ua, Ca);
                  });
                  var Pt = this.options, gr = Pt.el, sn = Pt.initialValue, Pn = Pt.theme, ds = gr.innerHTML;
                  Pn !== "light" && gr.classList.add(yv(Pn)), gr.innerHTML = "", this.toastMark = new qX("", {
                    disallowedHtmlBlockTags: ["br", "img"],
                    extendedAutolinks: We,
                    referenceDefinition: ft,
                    disallowDeepHeading: !0,
                    frontMatter: mt,
                    customParser: ee
                  }), this.preview = new GY(this.eventEmitter, T(T({}, Bt), { isViewer: !0 })), Hw()(this.preview.previewContent, "mousedown", this.toggleTask.bind(this)), sn ? this.setMarkdown(sn) : ds && this.preview.setHTML(ds), gr.appendChild(this.preview.previewContent), this.eventEmitter.emit("load", this);
                }
                return m.prototype.toggleTask = function(v) {
                  var C = v.target, D = getComputedStyle(C, ":before");
                  !C.hasAttribute(cZ) && C.hasAttribute(uZ) && kY(D, v.offsetX, v.offsetY) && (Xw(C, fZ), this.eventEmitter.emit("change", {
                    source: "viewer",
                    date: v
                  }));
                }, m.prototype.setMarkdown = function(v) {
                  var C = this.toastMark.getLineTexts(), D = C.length, _ = yY(C), J = [D, _.length + 1], ee = this.toastMark.editMarkdown([1, 1], J, v || "");
                  this.eventEmitter.emit("updatePreview", ee);
                }, m.prototype.on = function(v, C) {
                  this.eventEmitter.listen(v, C);
                }, m.prototype.off = function(v) {
                  this.eventEmitter.removeEventHandler(v);
                }, m.prototype.addHook = function(v, C) {
                  this.eventEmitter.removeEventHandler(v), this.eventEmitter.listen(v, C);
                }, m.prototype.destroy = function() {
                  Vw()(this.preview.el, "mousedown", this.toggleTask.bind(this)), this.preview.destroy(), this.eventEmitter.emit("destroy");
                }, m.prototype.isViewer = function() {
                  return !0;
                }, m.prototype.isMarkdownMode = function() {
                  return !1;
                }, m.prototype.isWysiwygMode = function() {
                  return !1;
                }, m;
              })()
            ), pZ = hZ, vZ = pZ;
          })(), y = y.default, y;
        })()
      );
    });
  })(Xy)), Xy.exports;
}
var S9e = T9e();
const x9e = /* @__PURE__ */ VT(S9e);
var V0 = function(r, e) {
  return V0 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
    t.__proto__ = n;
  } || function(t, n) {
    for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
  }, V0(r, e);
};
function dM(r, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  V0(r, e);
  function t() {
    this.constructor = r;
  }
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
var yf = function() {
  return yf = Object.assign || function(e) {
    for (var t, n = 1, i = arguments.length; n < i; n++) {
      t = arguments[n];
      for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
    }
    return e;
  }, yf.apply(this, arguments);
}, E9e = (
  /** @class */
  (function(r) {
    dM(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.rootEl = Zc.createRef(), t;
    }
    return e.prototype.getRootElement = function() {
      return this.rootEl.current;
    }, e.prototype.getInstance = function() {
      return this.editorInst;
    }, e.prototype.getBindingEventNames = function() {
      var t = this;
      return Object.keys(this.props).filter(function(n) {
        return /^on[A-Z][a-zA-Z]+/.test(n);
      }).filter(function(n) {
        return t.props[n];
      });
    }, e.prototype.bindEventHandlers = function(t) {
      var n = this;
      this.getBindingEventNames().forEach(function(i) {
        var a = i[2].toLowerCase() + i.slice(3);
        n.editorInst.off(a), n.editorInst.on(a, t[i]);
      });
    }, e.prototype.getInitEvents = function() {
      var t = this;
      return this.getBindingEventNames().reduce(function(n, i) {
        var a = i[2].toLowerCase() + i.slice(3);
        return n[a] = t.props[i], n;
      }, {});
    }, e.prototype.componentDidMount = function() {
      this.editorInst = new g9e(yf(yf({ el: this.rootEl.current }, this.props), { events: this.getInitEvents() }));
    }, e.prototype.shouldComponentUpdate = function(t) {
      var n = this.getInstance(), i = t.height, a = t.previewStyle;
      return i && this.props.height !== i && n.setHeight(i), a && this.props.previewStyle !== a && n.changePreviewStyle(a), this.bindEventHandlers(t), !1;
    }, e.prototype.render = function() {
      return Zc.createElement("div", { ref: this.rootEl });
    }, e;
  })(Zc.Component)
), M9e = (
  /** @class */
  (function(r) {
    dM(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.rootEl = Zc.createRef(), t;
    }
    return e.prototype.getRootElement = function() {
      return this.rootEl.current;
    }, e.prototype.getInstance = function() {
      return this.viewerInst;
    }, e.prototype.getBindingEventNames = function() {
      var t = this;
      return Object.keys(this.props).filter(function(n) {
        return /^on[A-Z][a-zA-Z]+/.test(n);
      }).filter(function(n) {
        return t.props[n];
      });
    }, e.prototype.bindEventHandlers = function(t) {
      var n = this;
      this.getBindingEventNames().forEach(function(i) {
        var a = i[2].toLowerCase() + i.slice(3);
        n.viewerInst.off(a), n.viewerInst.on(a, t[i]);
      });
    }, e.prototype.getInitEvents = function() {
      var t = this;
      return this.getBindingEventNames().reduce(function(n, i) {
        var a = i[2].toLowerCase() + i.slice(3);
        return n[a] = t.props[i], n;
      }, {});
    }, e.prototype.componentDidMount = function() {
      this.viewerInst = new x9e(yf(yf({ el: this.rootEl.current }, this.props), { events: this.getInitEvents() }));
    }, e.prototype.shouldComponentUpdate = function(t) {
      return this.bindEventHandlers(t), !1;
    }, e.prototype.render = function() {
      return Zc.createElement("div", { ref: this.rootEl });
    }, e;
  })(Zc.Component)
);
const N9e = ({
  initialValue: r,
  setStateValue: e,
  viewer: t,
  ...n
}) => {
  const i = du.useRef(null), a = du.useRef(e);
  du.useEffect(() => {
    a.current = e;
  }, [e]);
  const s = du.useMemo(() => `${n.theme || "light"}-${n.initialEditType || "markdown"}`, [n.theme, n.initialEditType]);
  return du.useEffect(() => {
    if (!t && i.current) {
      const u = i.current.getInstance(), p = ((y) => {
        const T = document.createElement("button");
        return T.className = "toastui-editor-toolbar-icons save", T.style.backgroundImage = "none", T.style.margin = "0", T.style.display = "flex", T.style.alignItems = "center", T.style.justifyContent = "center", T.style.color = y === "dark" ? "#d5d5d5" : "#333", T.innerHTML = `
          <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16" width="20" height="20">
            <path d="M14 3a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM2 2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z"/>
            <path fill-rule="evenodd" d="M9.146 8.146a.5.5 0 0 1 .708 0L11.5 9.793l1.646-1.647a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 0-.708"/>
            <path fill-rule="evenodd" d="M11.5 5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 1 .5-.5"/>
            <path d="M3.56 11V7.01h.056l1.428 3.239h.774l1.42-3.24h.056V11h1.073V5.001h-1.2l-1.71 3.894h-.039l-1.71-3.894H2.5V11z"/>
          </svg>
        `, T;
      })(
        n.theme || "light"
      );
      p.onclick = () => {
        const y = u.getMarkdown();
        a.current("content", { markdown: y });
      }, u.insertToolbarItem(
        { groupIndex: 5, itemIndex: 0 },
        {
          name: "save",
          el: p,
          tooltip: "Save Markdown"
        }
      );
    }
  }, [s, t]), t ? /* @__PURE__ */ Gv.jsx(
    M9e,
    {
      initialValue: r || " ",
      ...n
    },
    `viewer-${s}`
  ) : /* @__PURE__ */ Gv.jsx(
    E9e,
    {
      initialValue: r || " ",
      ref: i,
      ...n
    },
    `editor-${s}`
  );
}, Bv = /* @__PURE__ */ new WeakMap(), O9e = (r) => {
  const { data: e, parentElement: t, setStateValue: n } = r, i = t.querySelector(".react-root");
  if (!i)
    throw new Error("Unexpected: React root element not found");
  let a = Bv.get(t);
  return a || (a = xZ.createRoot(i), Bv.set(t, a)), a.render(
    /* @__PURE__ */ Gv.jsx(du.StrictMode, { children: /* @__PURE__ */ Gv.jsx(N9e, { setStateValue: n, ...e }) })
  ), () => {
    const s = Bv.get(t);
    s && (s.unmount(), Bv.delete(t));
  };
};
export {
  O9e as default
};
