var ad = { exports: {} }, cs = {}, sd = { exports: {} }, ve = {};
var sg;
function $T() {
  if (sg) return ve;
  sg = 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"), o = /* @__PURE__ */ Symbol.for("react.provider"), s = /* @__PURE__ */ Symbol.for("react.context"), u = /* @__PURE__ */ Symbol.for("react.forward_ref"), f = /* @__PURE__ */ Symbol.for("react.suspense"), d = /* @__PURE__ */ Symbol.for("react.memo"), h = /* @__PURE__ */ Symbol.for("react.lazy"), m = Symbol.iterator;
  function y(O) {
    return O === null || typeof O != "object" ? null : (O = m && O[m] || O["@@iterator"], typeof O == "function" ? O : null);
  }
  var w = { isMounted: function() {
    return !1;
  }, enqueueForceUpdate: function() {
  }, enqueueReplaceState: function() {
  }, enqueueSetState: function() {
  } }, k = Object.assign, b = {};
  function T(O, B, pe) {
    this.props = O, this.context = B, this.refs = b, this.updater = pe || w;
  }
  T.prototype.isReactComponent = {}, T.prototype.setState = function(O, B) {
    if (typeof O != "object" && typeof O != "function" && O != 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, O, B, "setState");
  }, T.prototype.forceUpdate = function(O) {
    this.updater.enqueueForceUpdate(this, O, "forceUpdate");
  };
  function E() {
  }
  E.prototype = T.prototype;
  function I(O, B, pe) {
    this.props = O, this.context = B, this.refs = b, this.updater = pe || w;
  }
  var P = I.prototype = new E();
  P.constructor = I, k(P, T.prototype), P.isPureReactComponent = !0;
  var _ = Array.isArray, V = Object.prototype.hasOwnProperty, W = { current: null }, q = { key: !0, ref: !0, __self: !0, __source: !0 };
  function K(O, B, pe) {
    var ae, we = {}, ge = null, Oe = null;
    if (B != null) for (ae in B.ref !== void 0 && (Oe = B.ref), B.key !== void 0 && (ge = "" + B.key), B) V.call(B, ae) && !q.hasOwnProperty(ae) && (we[ae] = B[ae]);
    var Ee = arguments.length - 2;
    if (Ee === 1) we.children = pe;
    else if (1 < Ee) {
      for (var Ae = Array(Ee), Mt = 0; Mt < Ee; Mt++) Ae[Mt] = arguments[Mt + 2];
      we.children = Ae;
    }
    if (O && O.defaultProps) for (ae in Ee = O.defaultProps, Ee) we[ae] === void 0 && (we[ae] = Ee[ae]);
    return { $$typeof: r, type: O, key: ge, ref: Oe, props: we, _owner: W.current };
  }
  function ce(O, B) {
    return { $$typeof: r, type: O.type, key: B, ref: O.ref, props: O.props, _owner: O._owner };
  }
  function be(O) {
    return typeof O == "object" && O !== null && O.$$typeof === r;
  }
  function Re(O) {
    var B = { "=": "=0", ":": "=2" };
    return "$" + O.replace(/[=:]/g, function(pe) {
      return B[pe];
    });
  }
  var ze = /\/+/g;
  function st(O, B) {
    return typeof O == "object" && O !== null && O.key != null ? Re("" + O.key) : B.toString(36);
  }
  function je(O, B, pe, ae, we) {
    var ge = typeof O;
    (ge === "undefined" || ge === "boolean") && (O = null);
    var Oe = !1;
    if (O === null) Oe = !0;
    else switch (ge) {
      case "string":
      case "number":
        Oe = !0;
        break;
      case "object":
        switch (O.$$typeof) {
          case r:
          case e:
            Oe = !0;
        }
    }
    if (Oe) return Oe = O, we = we(Oe), O = ae === "" ? "." + st(Oe, 0) : ae, _(we) ? (pe = "", O != null && (pe = O.replace(ze, "$&/") + "/"), je(we, B, pe, "", function(Mt) {
      return Mt;
    })) : we != null && (be(we) && (we = ce(we, pe + (!we.key || Oe && Oe.key === we.key ? "" : ("" + we.key).replace(ze, "$&/") + "/") + O)), B.push(we)), 1;
    if (Oe = 0, ae = ae === "" ? "." : ae + ":", _(O)) for (var Ee = 0; Ee < O.length; Ee++) {
      ge = O[Ee];
      var Ae = ae + st(ge, Ee);
      Oe += je(ge, B, pe, Ae, we);
    }
    else if (Ae = y(O), typeof Ae == "function") for (O = Ae.call(O), Ee = 0; !(ge = O.next()).done; ) ge = ge.value, Ae = ae + st(ge, Ee++), Oe += je(ge, B, pe, Ae, we);
    else if (ge === "object") throw B = String(O), Error("Objects are not valid as a React child (found: " + (B === "[object Object]" ? "object with keys {" + Object.keys(O).join(", ") + "}" : B) + "). If you meant to render a collection of children, use an array instead.");
    return Oe;
  }
  function jt(O, B, pe) {
    if (O == null) return O;
    var ae = [], we = 0;
    return je(O, ae, "", "", function(ge) {
      return B.call(pe, ge, we++);
    }), ae;
  }
  function lt(O) {
    if (O._status === -1) {
      var B = O._result;
      B = B(), B.then(function(pe) {
        (O._status === 0 || O._status === -1) && (O._status = 1, O._result = pe);
      }, function(pe) {
        (O._status === 0 || O._status === -1) && (O._status = 2, O._result = pe);
      }), O._status === -1 && (O._status = 0, O._result = B);
    }
    if (O._status === 1) return O._result.default;
    throw O._result;
  }
  var _e = { current: null }, G = { transition: null }, ue = { ReactCurrentDispatcher: _e, ReactCurrentBatchConfig: G, ReactCurrentOwner: W };
  function X() {
    throw Error("act(...) is not supported in production builds of React.");
  }
  return ve.Children = { map: jt, forEach: function(O, B, pe) {
    jt(O, function() {
      B.apply(this, arguments);
    }, pe);
  }, count: function(O) {
    var B = 0;
    return jt(O, function() {
      B++;
    }), B;
  }, toArray: function(O) {
    return jt(O, function(B) {
      return B;
    }) || [];
  }, only: function(O) {
    if (!be(O)) throw Error("React.Children.only expected to receive a single React element child.");
    return O;
  } }, ve.Component = T, ve.Fragment = t, ve.Profiler = i, ve.PureComponent = I, ve.StrictMode = n, ve.Suspense = f, ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ue, ve.act = X, ve.cloneElement = function(O, B, pe) {
    if (O == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + O + ".");
    var ae = k({}, O.props), we = O.key, ge = O.ref, Oe = O._owner;
    if (B != null) {
      if (B.ref !== void 0 && (ge = B.ref, Oe = W.current), B.key !== void 0 && (we = "" + B.key), O.type && O.type.defaultProps) var Ee = O.type.defaultProps;
      for (Ae in B) V.call(B, Ae) && !q.hasOwnProperty(Ae) && (ae[Ae] = B[Ae] === void 0 && Ee !== void 0 ? Ee[Ae] : B[Ae]);
    }
    var Ae = arguments.length - 2;
    if (Ae === 1) ae.children = pe;
    else if (1 < Ae) {
      Ee = Array(Ae);
      for (var Mt = 0; Mt < Ae; Mt++) Ee[Mt] = arguments[Mt + 2];
      ae.children = Ee;
    }
    return { $$typeof: r, type: O.type, key: we, ref: ge, props: ae, _owner: Oe };
  }, ve.createContext = function(O) {
    return O = { $$typeof: s, _currentValue: O, _currentValue2: O, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, O.Provider = { $$typeof: o, _context: O }, O.Consumer = O;
  }, ve.createElement = K, ve.createFactory = function(O) {
    var B = K.bind(null, O);
    return B.type = O, B;
  }, ve.createRef = function() {
    return { current: null };
  }, ve.forwardRef = function(O) {
    return { $$typeof: u, render: O };
  }, ve.isValidElement = be, ve.lazy = function(O) {
    return { $$typeof: h, _payload: { _status: -1, _result: O }, _init: lt };
  }, ve.memo = function(O, B) {
    return { $$typeof: d, type: O, compare: B === void 0 ? null : B };
  }, ve.startTransition = function(O) {
    var B = G.transition;
    G.transition = {};
    try {
      O();
    } finally {
      G.transition = B;
    }
  }, ve.unstable_act = X, ve.useCallback = function(O, B) {
    return _e.current.useCallback(O, B);
  }, ve.useContext = function(O) {
    return _e.current.useContext(O);
  }, ve.useDebugValue = function() {
  }, ve.useDeferredValue = function(O) {
    return _e.current.useDeferredValue(O);
  }, ve.useEffect = function(O, B) {
    return _e.current.useEffect(O, B);
  }, ve.useId = function() {
    return _e.current.useId();
  }, ve.useImperativeHandle = function(O, B, pe) {
    return _e.current.useImperativeHandle(O, B, pe);
  }, ve.useInsertionEffect = function(O, B) {
    return _e.current.useInsertionEffect(O, B);
  }, ve.useLayoutEffect = function(O, B) {
    return _e.current.useLayoutEffect(O, B);
  }, ve.useMemo = function(O, B) {
    return _e.current.useMemo(O, B);
  }, ve.useReducer = function(O, B, pe) {
    return _e.current.useReducer(O, B, pe);
  }, ve.useRef = function(O) {
    return _e.current.useRef(O);
  }, ve.useState = function(O) {
    return _e.current.useState(O);
  }, ve.useSyncExternalStore = function(O, B, pe) {
    return _e.current.useSyncExternalStore(O, B, pe);
  }, ve.useTransition = function() {
    return _e.current.useTransition();
  }, ve.version = "18.3.1", ve;
}
var lg;
function Fp() {
  return lg || (lg = 1, sd.exports = $T()), sd.exports;
}
var ug;
function UT() {
  if (ug) return cs;
  ug = 1;
  var r = Fp(), 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, o = { key: !0, ref: !0, __self: !0, __source: !0 };
  function s(u, f, d) {
    var h, m = {}, y = null, w = null;
    d !== void 0 && (y = "" + d), f.key !== void 0 && (y = "" + f.key), f.ref !== void 0 && (w = f.ref);
    for (h in f) n.call(f, h) && !o.hasOwnProperty(h) && (m[h] = f[h]);
    if (u && u.defaultProps) for (h in f = u.defaultProps, f) m[h] === void 0 && (m[h] = f[h]);
    return { $$typeof: e, type: u, key: y, ref: w, props: m, _owner: i.current };
  }
  return cs.Fragment = t, cs.jsx = s, cs.jsxs = s, cs;
}
var cg;
function jT() {
  return cg || (cg = 1, ad.exports = UT()), ad.exports;
}
var Eu = jT(), gs = Fp(), eu = {}, ld = { exports: {} }, Yt = {}, ud = { exports: {} }, cd = {};
var fg;
function WT() {
  return fg || (fg = 1, (function(r) {
    function e(G, ue) {
      var X = G.length;
      G.push(ue);
      e: for (; 0 < X; ) {
        var O = X - 1 >>> 1, B = G[O];
        if (0 < i(B, ue)) G[O] = ue, G[X] = B, X = O;
        else break e;
      }
    }
    function t(G) {
      return G.length === 0 ? null : G[0];
    }
    function n(G) {
      if (G.length === 0) return null;
      var ue = G[0], X = G.pop();
      if (X !== ue) {
        G[0] = X;
        e: for (var O = 0, B = G.length, pe = B >>> 1; O < pe; ) {
          var ae = 2 * (O + 1) - 1, we = G[ae], ge = ae + 1, Oe = G[ge];
          if (0 > i(we, X)) ge < B && 0 > i(Oe, we) ? (G[O] = Oe, G[ge] = X, O = ge) : (G[O] = we, G[ae] = X, O = ae);
          else if (ge < B && 0 > i(Oe, X)) G[O] = Oe, G[ge] = X, O = ge;
          else break e;
        }
      }
      return ue;
    }
    function i(G, ue) {
      var X = G.sortIndex - ue.sortIndex;
      return X !== 0 ? X : G.id - ue.id;
    }
    if (typeof performance == "object" && typeof performance.now == "function") {
      var o = performance;
      r.unstable_now = function() {
        return o.now();
      };
    } else {
      var s = Date, u = s.now();
      r.unstable_now = function() {
        return s.now() - u;
      };
    }
    var f = [], d = [], h = 1, m = null, y = 3, w = !1, k = !1, b = !1, T = typeof setTimeout == "function" ? setTimeout : null, E = typeof clearTimeout == "function" ? clearTimeout : null, I = typeof setImmediate < "u" ? setImmediate : null;
    typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling);
    function P(G) {
      for (var ue = t(d); ue !== null; ) {
        if (ue.callback === null) n(d);
        else if (ue.startTime <= G) n(d), ue.sortIndex = ue.expirationTime, e(f, ue);
        else break;
        ue = t(d);
      }
    }
    function _(G) {
      if (b = !1, P(G), !k) if (t(f) !== null) k = !0, lt(V);
      else {
        var ue = t(d);
        ue !== null && _e(_, ue.startTime - G);
      }
    }
    function V(G, ue) {
      k = !1, b && (b = !1, E(K), K = -1), w = !0;
      var X = y;
      try {
        for (P(ue), m = t(f); m !== null && (!(m.expirationTime > ue) || G && !Re()); ) {
          var O = m.callback;
          if (typeof O == "function") {
            m.callback = null, y = m.priorityLevel;
            var B = O(m.expirationTime <= ue);
            ue = r.unstable_now(), typeof B == "function" ? m.callback = B : m === t(f) && n(f), P(ue);
          } else n(f);
          m = t(f);
        }
        if (m !== null) var pe = !0;
        else {
          var ae = t(d);
          ae !== null && _e(_, ae.startTime - ue), pe = !1;
        }
        return pe;
      } finally {
        m = null, y = X, w = !1;
      }
    }
    var W = !1, q = null, K = -1, ce = 5, be = -1;
    function Re() {
      return !(r.unstable_now() - be < ce);
    }
    function ze() {
      if (q !== null) {
        var G = r.unstable_now();
        be = G;
        var ue = !0;
        try {
          ue = q(!0, G);
        } finally {
          ue ? st() : (W = !1, q = null);
        }
      } else W = !1;
    }
    var st;
    if (typeof I == "function") st = function() {
      I(ze);
    };
    else if (typeof MessageChannel < "u") {
      var je = new MessageChannel(), jt = je.port2;
      je.port1.onmessage = ze, st = function() {
        jt.postMessage(null);
      };
    } else st = function() {
      T(ze, 0);
    };
    function lt(G) {
      q = G, W || (W = !0, st());
    }
    function _e(G, ue) {
      K = T(function() {
        G(r.unstable_now());
      }, ue);
    }
    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(G) {
      G.callback = null;
    }, r.unstable_continueExecution = function() {
      k || w || (k = !0, lt(V));
    }, r.unstable_forceFrameRate = function(G) {
      0 > G || 125 < G ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : ce = 0 < G ? Math.floor(1e3 / G) : 5;
    }, r.unstable_getCurrentPriorityLevel = function() {
      return y;
    }, r.unstable_getFirstCallbackNode = function() {
      return t(f);
    }, r.unstable_next = function(G) {
      switch (y) {
        case 1:
        case 2:
        case 3:
          var ue = 3;
          break;
        default:
          ue = y;
      }
      var X = y;
      y = ue;
      try {
        return G();
      } finally {
        y = X;
      }
    }, r.unstable_pauseExecution = function() {
    }, r.unstable_requestPaint = function() {
    }, r.unstable_runWithPriority = function(G, ue) {
      switch (G) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
          break;
        default:
          G = 3;
      }
      var X = y;
      y = G;
      try {
        return ue();
      } finally {
        y = X;
      }
    }, r.unstable_scheduleCallback = function(G, ue, X) {
      var O = r.unstable_now();
      switch (typeof X == "object" && X !== null ? (X = X.delay, X = typeof X == "number" && 0 < X ? O + X : O) : X = O, G) {
        case 1:
          var B = -1;
          break;
        case 2:
          B = 250;
          break;
        case 5:
          B = 1073741823;
          break;
        case 4:
          B = 1e4;
          break;
        default:
          B = 5e3;
      }
      return B = X + B, G = { id: h++, callback: ue, priorityLevel: G, startTime: X, expirationTime: B, sortIndex: -1 }, X > O ? (G.sortIndex = X, e(d, G), t(f) === null && G === t(d) && (b ? (E(K), K = -1) : b = !0, _e(_, X - O))) : (G.sortIndex = B, e(f, G), k || w || (k = !0, lt(V))), G;
    }, r.unstable_shouldYield = Re, r.unstable_wrapCallback = function(G) {
      var ue = y;
      return function() {
        var X = y;
        y = ue;
        try {
          return G.apply(this, arguments);
        } finally {
          y = X;
        }
      };
    };
  })(cd)), cd;
}
var dg;
function GT() {
  return dg || (dg = 1, ud.exports = WT()), ud.exports;
}
var pg;
function KT() {
  if (pg) return Yt;
  pg = 1;
  var r = Fp(), e = GT();
  function t(a) {
    for (var l = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) l += "&args[]=" + encodeURIComponent(arguments[c]);
    return "Minified React error #" + a + "; 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 o(a, l) {
    s(a, l), s(a + "Capture", l);
  }
  function s(a, l) {
    for (i[a] = l, a = 0; a < l.length; a++) n.add(l[a]);
  }
  var u = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"), f = Object.prototype.hasOwnProperty, d = /^[: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]*$/, h = {}, m = {};
  function y(a) {
    return f.call(m, a) ? !0 : f.call(h, a) ? !1 : d.test(a) ? m[a] = !0 : (h[a] = !0, !1);
  }
  function w(a, l, c, p) {
    if (c !== null && c.type === 0) return !1;
    switch (typeof l) {
      case "function":
      case "symbol":
        return !0;
      case "boolean":
        return p ? !1 : c !== null ? !c.acceptsBooleans : (a = a.toLowerCase().slice(0, 5), a !== "data-" && a !== "aria-");
      default:
        return !1;
    }
  }
  function k(a, l, c, p) {
    if (l === null || typeof l > "u" || w(a, l, c, p)) return !0;
    if (p) 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 b(a, l, c, p, v, g, C) {
    this.acceptsBooleans = l === 2 || l === 3 || l === 4, this.attributeName = p, this.attributeNamespace = v, this.mustUseProperty = c, this.propertyName = a, this.type = l, this.sanitizeURL = g, this.removeEmptyString = C;
  }
  var T = {};
  "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a) {
    T[a] = new b(a, 0, !1, a, null, !1, !1);
  }), [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a) {
    var l = a[0];
    T[l] = new b(l, 1, !1, a[1], null, !1, !1);
  }), ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a) {
    T[a] = new b(a, 2, !1, a.toLowerCase(), null, !1, !1);
  }), ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a) {
    T[a] = new b(a, 2, !1, a, 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(a) {
    T[a] = new b(a, 3, !1, a.toLowerCase(), null, !1, !1);
  }), ["checked", "multiple", "muted", "selected"].forEach(function(a) {
    T[a] = new b(a, 3, !0, a, null, !1, !1);
  }), ["capture", "download"].forEach(function(a) {
    T[a] = new b(a, 4, !1, a, null, !1, !1);
  }), ["cols", "rows", "size", "span"].forEach(function(a) {
    T[a] = new b(a, 6, !1, a, null, !1, !1);
  }), ["rowSpan", "start"].forEach(function(a) {
    T[a] = new b(a, 5, !1, a.toLowerCase(), null, !1, !1);
  });
  var E = /[\-:]([a-z])/g;
  function I(a) {
    return a[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(a) {
    var l = a.replace(
      E,
      I
    );
    T[l] = new b(l, 1, !1, a, null, !1, !1);
  }), "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a) {
    var l = a.replace(E, I);
    T[l] = new b(l, 1, !1, a, "http://www.w3.org/1999/xlink", !1, !1);
  }), ["xml:base", "xml:lang", "xml:space"].forEach(function(a) {
    var l = a.replace(E, I);
    T[l] = new b(l, 1, !1, a, "http://www.w3.org/XML/1998/namespace", !1, !1);
  }), ["tabIndex", "crossOrigin"].forEach(function(a) {
    T[a] = new b(a, 1, !1, a.toLowerCase(), null, !1, !1);
  }), T.xlinkHref = new b("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1), ["src", "href", "action", "formAction"].forEach(function(a) {
    T[a] = new b(a, 1, !1, a.toLowerCase(), null, !0, !0);
  });
  function P(a, l, c, p) {
    var v = T.hasOwnProperty(l) ? T[l] : null;
    (v !== null ? v.type !== 0 : p || !(2 < l.length) || l[0] !== "o" && l[0] !== "O" || l[1] !== "n" && l[1] !== "N") && (k(l, c, v, p) && (c = null), p || v === null ? y(l) && (c === null ? a.removeAttribute(l) : a.setAttribute(l, "" + c)) : v.mustUseProperty ? a[v.propertyName] = c === null ? v.type === 3 ? !1 : "" : c : (l = v.attributeName, p = v.attributeNamespace, c === null ? a.removeAttribute(l) : (v = v.type, c = v === 3 || v === 4 && c === !0 ? "" : "" + c, p ? a.setAttributeNS(p, l, c) : a.setAttribute(l, c))));
  }
  var _ = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, V = /* @__PURE__ */ Symbol.for("react.element"), W = /* @__PURE__ */ Symbol.for("react.portal"), q = /* @__PURE__ */ Symbol.for("react.fragment"), K = /* @__PURE__ */ Symbol.for("react.strict_mode"), ce = /* @__PURE__ */ Symbol.for("react.profiler"), be = /* @__PURE__ */ Symbol.for("react.provider"), Re = /* @__PURE__ */ Symbol.for("react.context"), ze = /* @__PURE__ */ Symbol.for("react.forward_ref"), st = /* @__PURE__ */ Symbol.for("react.suspense"), je = /* @__PURE__ */ Symbol.for("react.suspense_list"), jt = /* @__PURE__ */ Symbol.for("react.memo"), lt = /* @__PURE__ */ Symbol.for("react.lazy"), _e = /* @__PURE__ */ Symbol.for("react.offscreen"), G = Symbol.iterator;
  function ue(a) {
    return a === null || typeof a != "object" ? null : (a = G && a[G] || a["@@iterator"], typeof a == "function" ? a : null);
  }
  var X = Object.assign, O;
  function B(a) {
    if (O === void 0) try {
      throw Error();
    } catch (c) {
      var l = c.stack.trim().match(/\n( *(at )?)/);
      O = l && l[1] || "";
    }
    return `
` + O + a;
  }
  var pe = !1;
  function ae(a, l) {
    if (!a || pe) return "";
    pe = !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 (A) {
          var p = A;
        }
        Reflect.construct(a, [], l);
      } else {
        try {
          l.call();
        } catch (A) {
          p = A;
        }
        a.call(l.prototype);
      }
      else {
        try {
          throw Error();
        } catch (A) {
          p = A;
        }
        a();
      }
    } catch (A) {
      if (A && p && typeof A.stack == "string") {
        for (var v = A.stack.split(`
`), g = p.stack.split(`
`), C = v.length - 1, x = g.length - 1; 1 <= C && 0 <= x && v[C] !== g[x]; ) x--;
        for (; 1 <= C && 0 <= x; C--, x--) if (v[C] !== g[x]) {
          if (C !== 1 || x !== 1)
            do
              if (C--, x--, 0 > x || v[C] !== g[x]) {
                var S = `
` + v[C].replace(" at new ", " at ");
                return a.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", a.displayName)), S;
              }
            while (1 <= C && 0 <= x);
          break;
        }
      }
    } finally {
      pe = !1, Error.prepareStackTrace = c;
    }
    return (a = a ? a.displayName || a.name : "") ? B(a) : "";
  }
  function we(a) {
    switch (a.tag) {
      case 5:
        return B(a.type);
      case 16:
        return B("Lazy");
      case 13:
        return B("Suspense");
      case 19:
        return B("SuspenseList");
      case 0:
      case 2:
      case 15:
        return a = ae(a.type, !1), a;
      case 11:
        return a = ae(a.type.render, !1), a;
      case 1:
        return a = ae(a.type, !0), a;
      default:
        return "";
    }
  }
  function ge(a) {
    if (a == null) return null;
    if (typeof a == "function") return a.displayName || a.name || null;
    if (typeof a == "string") return a;
    switch (a) {
      case q:
        return "Fragment";
      case W:
        return "Portal";
      case ce:
        return "Profiler";
      case K:
        return "StrictMode";
      case st:
        return "Suspense";
      case je:
        return "SuspenseList";
    }
    if (typeof a == "object") switch (a.$$typeof) {
      case Re:
        return (a.displayName || "Context") + ".Consumer";
      case be:
        return (a._context.displayName || "Context") + ".Provider";
      case ze:
        var l = a.render;
        return a = a.displayName, a || (a = l.displayName || l.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
      case jt:
        return l = a.displayName || null, l !== null ? l : ge(a.type) || "Memo";
      case lt:
        l = a._payload, a = a._init;
        try {
          return ge(a(l));
        } catch {
        }
    }
    return null;
  }
  function Oe(a) {
    var l = a.type;
    switch (a.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 a = l.render, a = a.displayName || a.name || "", l.displayName || (a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef");
      case 7:
        return "Fragment";
      case 5:
        return l;
      case 4:
        return "Portal";
      case 3:
        return "Root";
      case 6:
        return "Text";
      case 16:
        return ge(l);
      case 8:
        return l === K ? "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 Ee(a) {
    switch (typeof a) {
      case "boolean":
      case "number":
      case "string":
      case "undefined":
        return a;
      case "object":
        return a;
      default:
        return "";
    }
  }
  function Ae(a) {
    var l = a.type;
    return (a = a.nodeName) && a.toLowerCase() === "input" && (l === "checkbox" || l === "radio");
  }
  function Mt(a) {
    var l = Ae(a) ? "checked" : "value", c = Object.getOwnPropertyDescriptor(a.constructor.prototype, l), p = "" + a[l];
    if (!a.hasOwnProperty(l) && typeof c < "u" && typeof c.get == "function" && typeof c.set == "function") {
      var v = c.get, g = c.set;
      return Object.defineProperty(a, l, { configurable: !0, get: function() {
        return v.call(this);
      }, set: function(C) {
        p = "" + C, g.call(this, C);
      } }), Object.defineProperty(a, l, { enumerable: c.enumerable }), { getValue: function() {
        return p;
      }, setValue: function(C) {
        p = "" + C;
      }, stopTracking: function() {
        a._valueTracker = null, delete a[l];
      } };
    }
  }
  function Er(a) {
    a._valueTracker || (a._valueTracker = Mt(a));
  }
  function an(a) {
    if (!a) return !1;
    var l = a._valueTracker;
    if (!l) return !0;
    var c = l.getValue(), p = "";
    return a && (p = Ae(a) ? a.checked ? "true" : "false" : a.value), a = p, a !== c ? (l.setValue(a), !0) : !1;
  }
  function Bn(a) {
    if (a = a || (typeof document < "u" ? document : void 0), typeof a > "u") return null;
    try {
      return a.activeElement || a.body;
    } catch {
      return a.body;
    }
  }
  function xi(a, l) {
    var c = l.checked;
    return X({}, l, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: c ?? a._wrapperState.initialChecked });
  }
  function sn(a, l) {
    var c = l.defaultValue == null ? "" : l.defaultValue, p = l.checked != null ? l.checked : l.defaultChecked;
    c = Ee(l.value != null ? l.value : c), a._wrapperState = { initialChecked: p, initialValue: c, controlled: l.type === "checkbox" || l.type === "radio" ? l.checked != null : l.value != null };
  }
  function Si(a, l) {
    l = l.checked, l != null && P(a, "checked", l, !1);
  }
  function go(a, l) {
    Si(a, l);
    var c = Ee(l.value), p = l.type;
    if (c != null) p === "number" ? (c === 0 && a.value === "" || a.value != c) && (a.value = "" + c) : a.value !== "" + c && (a.value = "" + c);
    else if (p === "submit" || p === "reset") {
      a.removeAttribute("value");
      return;
    }
    l.hasOwnProperty("value") ? yo(a, l.type, c) : l.hasOwnProperty("defaultValue") && yo(a, l.type, Ee(l.defaultValue)), l.checked == null && l.defaultChecked != null && (a.defaultChecked = !!l.defaultChecked);
  }
  function Ei(a, l, c) {
    if (l.hasOwnProperty("value") || l.hasOwnProperty("defaultValue")) {
      var p = l.type;
      if (!(p !== "submit" && p !== "reset" || l.value !== void 0 && l.value !== null)) return;
      l = "" + a._wrapperState.initialValue, c || l === a.value || (a.value = l), a.defaultValue = l;
    }
    c = a.name, c !== "" && (a.name = ""), a.defaultChecked = !!a._wrapperState.initialChecked, c !== "" && (a.name = c);
  }
  function yo(a, l, c) {
    (l !== "number" || Bn(a.ownerDocument) !== a) && (c == null ? a.defaultValue = "" + a._wrapperState.initialValue : a.defaultValue !== "" + c && (a.defaultValue = "" + c));
  }
  var ln = Array.isArray;
  function fr(a, l, c, p) {
    if (a = a.options, l) {
      l = {};
      for (var v = 0; v < c.length; v++) l["$" + c[v]] = !0;
      for (c = 0; c < a.length; c++) v = l.hasOwnProperty("$" + a[c].value), a[c].selected !== v && (a[c].selected = v), v && p && (a[c].defaultSelected = !0);
    } else {
      for (c = "" + Ee(c), l = null, v = 0; v < a.length; v++) {
        if (a[v].value === c) {
          a[v].selected = !0, p && (a[v].defaultSelected = !0);
          return;
        }
        l !== null || a[v].disabled || (l = a[v]);
      }
      l !== null && (l.selected = !0);
    }
  }
  function Vr(a, l) {
    if (l.dangerouslySetInnerHTML != null) throw Error(t(91));
    return X({}, l, { value: void 0, defaultValue: void 0, children: "" + a._wrapperState.initialValue });
  }
  function un(a, 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 (ln(c)) {
          if (1 < c.length) throw Error(t(93));
          c = c[0];
        }
        l = c;
      }
      l == null && (l = ""), c = l;
    }
    a._wrapperState = { initialValue: Ee(c) };
  }
  function ba(a, l) {
    var c = Ee(l.value), p = Ee(l.defaultValue);
    c != null && (c = "" + c, c !== a.value && (a.value = c), l.defaultValue == null && a.defaultValue !== c && (a.defaultValue = c)), p != null && (a.defaultValue = "" + p);
  }
  function Ta(a) {
    var l = a.textContent;
    l === a._wrapperState.initialValue && l !== "" && l !== null && (a.value = l);
  }
  function xa(a) {
    switch (a) {
      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 Mi(a, l) {
    return a == null || a === "http://www.w3.org/1999/xhtml" ? xa(l) : a === "http://www.w3.org/2000/svg" && l === "foreignObject" ? "http://www.w3.org/1999/xhtml" : a;
  }
  var Oi, wo = (function(a) {
    return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function(l, c, p, v) {
      MSApp.execUnsafeLocalFunction(function() {
        return a(l, c, p, v);
      });
    } : a;
  })(function(a, l) {
    if (a.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in a) a.innerHTML = l;
    else {
      for (Oi = Oi || document.createElement("div"), Oi.innerHTML = "<svg>" + l.valueOf().toString() + "</svg>", l = Oi.firstChild; a.firstChild; ) a.removeChild(a.firstChild);
      for (; l.firstChild; ) a.appendChild(l.firstChild);
    }
  });
  function cn(a, l) {
    if (l) {
      var c = a.firstChild;
      if (c && c === a.lastChild && c.nodeType === 3) {
        c.nodeValue = l;
        return;
      }
    }
    a.textContent = l;
  }
  var Wt = {
    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
  }, ko = ["Webkit", "ms", "Moz", "O"];
  Object.keys(Wt).forEach(function(a) {
    ko.forEach(function(l) {
      l = l + a.charAt(0).toUpperCase() + a.substring(1), Wt[l] = Wt[a];
    });
  });
  function Co(a, l, c) {
    return l == null || typeof l == "boolean" || l === "" ? "" : c || typeof l != "number" || l === 0 || Wt.hasOwnProperty(a) && Wt[a] ? ("" + l).trim() : l + "px";
  }
  function fn(a, l) {
    a = a.style;
    for (var c in l) if (l.hasOwnProperty(c)) {
      var p = c.indexOf("--") === 0, v = Co(c, l[c], p);
      c === "float" && (c = "cssFloat"), p ? a.setProperty(c, v) : a[c] = v;
    }
  }
  var xc = X({ 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 Sa(a, l) {
    if (l) {
      if (xc[a] && (l.children != null || l.dangerouslySetInnerHTML != null)) throw Error(t(137, a));
      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 qr(a, l) {
    if (a.indexOf("-") === -1) return typeof l.is == "string";
    switch (a) {
      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 $r = null;
  function Ea(a) {
    return a = a.target || a.srcElement || window, a.correspondingUseElement && (a = a.correspondingUseElement), a.nodeType === 3 ? a.parentNode : a;
  }
  var Ni = null, dn = null, pn = null;
  function Li(a) {
    if (a = Ka(a)) {
      if (typeof Ni != "function") throw Error(t(280));
      var l = a.stateNode;
      l && (l = vl(l), Ni(a.stateNode, a.type, l));
    }
  }
  function bo(a) {
    dn ? pn ? pn.push(a) : pn = [a] : dn = a;
  }
  function Ws() {
    if (dn) {
      var a = dn, l = pn;
      if (pn = dn = null, Li(a), l) for (a = 0; a < l.length; a++) Li(l[a]);
    }
  }
  function dr(a, l) {
    return a(l);
  }
  function Ma() {
  }
  var To = !1;
  function Oa(a, l, c) {
    if (To) return a(l, c);
    To = !0;
    try {
      return dr(a, l, c);
    } finally {
      To = !1, (dn !== null || pn !== null) && (Ma(), Ws());
    }
  }
  function Di(a, l) {
    var c = a.stateNode;
    if (c === null) return null;
    var p = vl(c);
    if (p === null) return null;
    c = p[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":
        (p = !p.disabled) || (a = a.type, p = !(a === "button" || a === "input" || a === "select" || a === "textarea")), a = !p;
        break e;
      default:
        a = !1;
    }
    if (a) return null;
    if (c && typeof c != "function") throw Error(t(231, l, typeof c));
    return c;
  }
  var hn = !1;
  if (u) try {
    var Ht = {};
    Object.defineProperty(Ht, "passive", { get: function() {
      hn = !0;
    } }), window.addEventListener("test", Ht, Ht), window.removeEventListener("test", Ht, Ht);
  } catch {
    hn = !1;
  }
  function Gs(a, l, c, p, v, g, C, x, S) {
    var A = Array.prototype.slice.call(arguments, 3);
    try {
      l.apply(c, A);
    } catch (z) {
      this.onError(z);
    }
  }
  var _n = !1, Ai = null, xo = !1, oe = null, L = { onError: function(a) {
    _n = !0, Ai = a;
  } };
  function j(a, l, c, p, v, g, C, x, S) {
    _n = !1, Ai = null, Gs.apply(L, arguments);
  }
  function ne(a, l, c, p, v, g, C, x, S) {
    if (j.apply(this, arguments), _n) {
      if (_n) {
        var A = Ai;
        _n = !1, Ai = null;
      } else throw Error(t(198));
      xo || (xo = !0, oe = A);
    }
  }
  function ye(a) {
    var l = a, c = a;
    if (a.alternate) for (; l.return; ) l = l.return;
    else {
      a = l;
      do
        l = a, (l.flags & 4098) !== 0 && (c = l.return), a = l.return;
      while (a);
    }
    return l.tag === 3 ? c : null;
  }
  function et(a) {
    if (a.tag === 13) {
      var l = a.memoizedState;
      if (l === null && (a = a.alternate, a !== null && (l = a.memoizedState)), l !== null) return l.dehydrated;
    }
    return null;
  }
  function tt(a) {
    if (ye(a) !== a) throw Error(t(188));
  }
  function ut(a) {
    var l = a.alternate;
    if (!l) {
      if (l = ye(a), l === null) throw Error(t(188));
      return l !== a ? null : a;
    }
    for (var c = a, p = l; ; ) {
      var v = c.return;
      if (v === null) break;
      var g = v.alternate;
      if (g === null) {
        if (p = v.return, p !== null) {
          c = p;
          continue;
        }
        break;
      }
      if (v.child === g.child) {
        for (g = v.child; g; ) {
          if (g === c) return tt(v), a;
          if (g === p) return tt(v), l;
          g = g.sibling;
        }
        throw Error(t(188));
      }
      if (c.return !== p.return) c = v, p = g;
      else {
        for (var C = !1, x = v.child; x; ) {
          if (x === c) {
            C = !0, c = v, p = g;
            break;
          }
          if (x === p) {
            C = !0, p = v, c = g;
            break;
          }
          x = x.sibling;
        }
        if (!C) {
          for (x = g.child; x; ) {
            if (x === c) {
              C = !0, c = g, p = v;
              break;
            }
            if (x === p) {
              C = !0, p = g, c = v;
              break;
            }
            x = x.sibling;
          }
          if (!C) throw Error(t(189));
        }
      }
      if (c.alternate !== p) throw Error(t(190));
    }
    if (c.tag !== 3) throw Error(t(188));
    return c.stateNode.current === c ? a : l;
  }
  function pr(a) {
    return a = ut(a), a !== null ? Hn(a) : null;
  }
  function Hn(a) {
    if (a.tag === 5 || a.tag === 6) return a;
    for (a = a.child; a !== null; ) {
      var l = Hn(a);
      if (l !== null) return l;
      a = a.sibling;
    }
    return null;
  }
  var Na = e.unstable_scheduleCallback, Ks = e.unstable_cancelCallback, Ph = e.unstable_shouldYield, tb = e.unstable_requestPaint, Ge = e.unstable_now, rb = e.unstable_getCurrentPriorityLevel, Sc = e.unstable_ImmediatePriority, Bh = e.unstable_UserBlockingPriority, Qs = e.unstable_NormalPriority, nb = e.unstable_LowPriority, _h = e.unstable_IdlePriority, Js = null, Ur = null;
  function ib(a) {
    if (Ur && typeof Ur.onCommitFiberRoot == "function") try {
      Ur.onCommitFiberRoot(Js, a, void 0, (a.current.flags & 128) === 128);
    } catch {
    }
  }
  var Mr = Math.clz32 ? Math.clz32 : sb, ob = Math.log, ab = Math.LN2;
  function sb(a) {
    return a >>>= 0, a === 0 ? 32 : 31 - (ob(a) / ab | 0) | 0;
  }
  var Xs = 64, Ys = 4194304;
  function La(a) {
    switch (a & -a) {
      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 a & 4194240;
      case 4194304:
      case 8388608:
      case 16777216:
      case 33554432:
      case 67108864:
        return a & 130023424;
      case 134217728:
        return 134217728;
      case 268435456:
        return 268435456;
      case 536870912:
        return 536870912;
      case 1073741824:
        return 1073741824;
      default:
        return a;
    }
  }
  function Zs(a, l) {
    var c = a.pendingLanes;
    if (c === 0) return 0;
    var p = 0, v = a.suspendedLanes, g = a.pingedLanes, C = c & 268435455;
    if (C !== 0) {
      var x = C & ~v;
      x !== 0 ? p = La(x) : (g &= C, g !== 0 && (p = La(g)));
    } else C = c & ~v, C !== 0 ? p = La(C) : g !== 0 && (p = La(g));
    if (p === 0) return 0;
    if (l !== 0 && l !== p && (l & v) === 0 && (v = p & -p, g = l & -l, v >= g || v === 16 && (g & 4194240) !== 0)) return l;
    if ((p & 4) !== 0 && (p |= c & 16), l = a.entangledLanes, l !== 0) for (a = a.entanglements, l &= p; 0 < l; ) c = 31 - Mr(l), v = 1 << c, p |= a[c], l &= ~v;
    return p;
  }
  function lb(a, l) {
    switch (a) {
      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 ub(a, l) {
    for (var c = a.suspendedLanes, p = a.pingedLanes, v = a.expirationTimes, g = a.pendingLanes; 0 < g; ) {
      var C = 31 - Mr(g), x = 1 << C, S = v[C];
      S === -1 ? ((x & c) === 0 || (x & p) !== 0) && (v[C] = lb(x, l)) : S <= l && (a.expiredLanes |= x), g &= ~x;
    }
  }
  function Ec(a) {
    return a = a.pendingLanes & -1073741825, a !== 0 ? a : a & 1073741824 ? 1073741824 : 0;
  }
  function Hh() {
    var a = Xs;
    return Xs <<= 1, (Xs & 4194240) === 0 && (Xs = 64), a;
  }
  function Mc(a) {
    for (var l = [], c = 0; 31 > c; c++) l.push(a);
    return l;
  }
  function Da(a, l, c) {
    a.pendingLanes |= l, l !== 536870912 && (a.suspendedLanes = 0, a.pingedLanes = 0), a = a.eventTimes, l = 31 - Mr(l), a[l] = c;
  }
  function cb(a, l) {
    var c = a.pendingLanes & ~l;
    a.pendingLanes = l, a.suspendedLanes = 0, a.pingedLanes = 0, a.expiredLanes &= l, a.mutableReadLanes &= l, a.entangledLanes &= l, l = a.entanglements;
    var p = a.eventTimes;
    for (a = a.expirationTimes; 0 < c; ) {
      var v = 31 - Mr(c), g = 1 << v;
      l[v] = 0, p[v] = -1, a[v] = -1, c &= ~g;
    }
  }
  function Oc(a, l) {
    var c = a.entangledLanes |= l;
    for (a = a.entanglements; c; ) {
      var p = 31 - Mr(c), v = 1 << p;
      v & l | a[p] & l && (a[p] |= l), c &= ~v;
    }
  }
  var De = 0;
  function Fh(a) {
    return a &= -a, 1 < a ? 4 < a ? (a & 268435455) !== 0 ? 16 : 536870912 : 4 : 1;
  }
  var zh, Nc, Vh, qh, $h, Lc = !1, el = [], Fn = null, zn = null, Vn = null, Aa = /* @__PURE__ */ new Map(), Ia = /* @__PURE__ */ new Map(), qn = [], fb = "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 Uh(a, l) {
    switch (a) {
      case "focusin":
      case "focusout":
        Fn = null;
        break;
      case "dragenter":
      case "dragleave":
        zn = null;
        break;
      case "mouseover":
      case "mouseout":
        Vn = null;
        break;
      case "pointerover":
      case "pointerout":
        Aa.delete(l.pointerId);
        break;
      case "gotpointercapture":
      case "lostpointercapture":
        Ia.delete(l.pointerId);
    }
  }
  function Ra(a, l, c, p, v, g) {
    return a === null || a.nativeEvent !== g ? (a = { blockedOn: l, domEventName: c, eventSystemFlags: p, nativeEvent: g, targetContainers: [v] }, l !== null && (l = Ka(l), l !== null && Nc(l)), a) : (a.eventSystemFlags |= p, l = a.targetContainers, v !== null && l.indexOf(v) === -1 && l.push(v), a);
  }
  function db(a, l, c, p, v) {
    switch (l) {
      case "focusin":
        return Fn = Ra(Fn, a, l, c, p, v), !0;
      case "dragenter":
        return zn = Ra(zn, a, l, c, p, v), !0;
      case "mouseover":
        return Vn = Ra(Vn, a, l, c, p, v), !0;
      case "pointerover":
        var g = v.pointerId;
        return Aa.set(g, Ra(Aa.get(g) || null, a, l, c, p, v)), !0;
      case "gotpointercapture":
        return g = v.pointerId, Ia.set(g, Ra(Ia.get(g) || null, a, l, c, p, v)), !0;
    }
    return !1;
  }
  function jh(a) {
    var l = Ii(a.target);
    if (l !== null) {
      var c = ye(l);
      if (c !== null) {
        if (l = c.tag, l === 13) {
          if (l = et(c), l !== null) {
            a.blockedOn = l, $h(a.priority, function() {
              Vh(c);
            });
            return;
          }
        } else if (l === 3 && c.stateNode.current.memoizedState.isDehydrated) {
          a.blockedOn = c.tag === 3 ? c.stateNode.containerInfo : null;
          return;
        }
      }
    }
    a.blockedOn = null;
  }
  function tl(a) {
    if (a.blockedOn !== null) return !1;
    for (var l = a.targetContainers; 0 < l.length; ) {
      var c = Ac(a.domEventName, a.eventSystemFlags, l[0], a.nativeEvent);
      if (c === null) {
        c = a.nativeEvent;
        var p = new c.constructor(c.type, c);
        $r = p, c.target.dispatchEvent(p), $r = null;
      } else return l = Ka(c), l !== null && Nc(l), a.blockedOn = c, !1;
      l.shift();
    }
    return !0;
  }
  function Wh(a, l, c) {
    tl(a) && c.delete(l);
  }
  function pb() {
    Lc = !1, Fn !== null && tl(Fn) && (Fn = null), zn !== null && tl(zn) && (zn = null), Vn !== null && tl(Vn) && (Vn = null), Aa.forEach(Wh), Ia.forEach(Wh);
  }
  function Pa(a, l) {
    a.blockedOn === l && (a.blockedOn = null, Lc || (Lc = !0, e.unstable_scheduleCallback(e.unstable_NormalPriority, pb)));
  }
  function Ba(a) {
    function l(v) {
      return Pa(v, a);
    }
    if (0 < el.length) {
      Pa(el[0], a);
      for (var c = 1; c < el.length; c++) {
        var p = el[c];
        p.blockedOn === a && (p.blockedOn = null);
      }
    }
    for (Fn !== null && Pa(Fn, a), zn !== null && Pa(zn, a), Vn !== null && Pa(Vn, a), Aa.forEach(l), Ia.forEach(l), c = 0; c < qn.length; c++) p = qn[c], p.blockedOn === a && (p.blockedOn = null);
    for (; 0 < qn.length && (c = qn[0], c.blockedOn === null); ) jh(c), c.blockedOn === null && qn.shift();
  }
  var So = _.ReactCurrentBatchConfig, rl = !0;
  function hb(a, l, c, p) {
    var v = De, g = So.transition;
    So.transition = null;
    try {
      De = 1, Dc(a, l, c, p);
    } finally {
      De = v, So.transition = g;
    }
  }
  function vb(a, l, c, p) {
    var v = De, g = So.transition;
    So.transition = null;
    try {
      De = 4, Dc(a, l, c, p);
    } finally {
      De = v, So.transition = g;
    }
  }
  function Dc(a, l, c, p) {
    if (rl) {
      var v = Ac(a, l, c, p);
      if (v === null) Qc(a, l, p, nl, c), Uh(a, p);
      else if (db(v, a, l, c, p)) p.stopPropagation();
      else if (Uh(a, p), l & 4 && -1 < fb.indexOf(a)) {
        for (; v !== null; ) {
          var g = Ka(v);
          if (g !== null && zh(g), g = Ac(a, l, c, p), g === null && Qc(a, l, p, nl, c), g === v) break;
          v = g;
        }
        v !== null && p.stopPropagation();
      } else Qc(a, l, p, null, c);
    }
  }
  var nl = null;
  function Ac(a, l, c, p) {
    if (nl = null, a = Ea(p), a = Ii(a), a !== null) if (l = ye(a), l === null) a = null;
    else if (c = l.tag, c === 13) {
      if (a = et(l), a !== null) return a;
      a = null;
    } else if (c === 3) {
      if (l.stateNode.current.memoizedState.isDehydrated) return l.tag === 3 ? l.stateNode.containerInfo : null;
      a = null;
    } else l !== a && (a = null);
    return nl = a, null;
  }
  function Gh(a) {
    switch (a) {
      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 (rb()) {
          case Sc:
            return 1;
          case Bh:
            return 4;
          case Qs:
          case nb:
            return 16;
          case _h:
            return 536870912;
          default:
            return 16;
        }
      default:
        return 16;
    }
  }
  var $n = null, Ic = null, il = null;
  function Kh() {
    if (il) return il;
    var a, l = Ic, c = l.length, p, v = "value" in $n ? $n.value : $n.textContent, g = v.length;
    for (a = 0; a < c && l[a] === v[a]; a++) ;
    var C = c - a;
    for (p = 1; p <= C && l[c - p] === v[g - p]; p++) ;
    return il = v.slice(a, 1 < p ? 1 - p : void 0);
  }
  function ol(a) {
    var l = a.keyCode;
    return "charCode" in a ? (a = a.charCode, a === 0 && l === 13 && (a = 13)) : a = l, a === 10 && (a = 13), 32 <= a || a === 13 ? a : 0;
  }
  function al() {
    return !0;
  }
  function Qh() {
    return !1;
  }
  function ir(a) {
    function l(c, p, v, g, C) {
      this._reactName = c, this._targetInst = v, this.type = p, this.nativeEvent = g, this.target = C, this.currentTarget = null;
      for (var x in a) a.hasOwnProperty(x) && (c = a[x], this[x] = c ? c(g) : g[x]);
      return this.isDefaultPrevented = (g.defaultPrevented != null ? g.defaultPrevented : g.returnValue === !1) ? al : Qh, this.isPropagationStopped = Qh, this;
    }
    return X(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 = al);
    }, stopPropagation: function() {
      var c = this.nativeEvent;
      c && (c.stopPropagation ? c.stopPropagation() : typeof c.cancelBubble != "unknown" && (c.cancelBubble = !0), this.isPropagationStopped = al);
    }, persist: function() {
    }, isPersistent: al }), l;
  }
  var Eo = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(a) {
    return a.timeStamp || Date.now();
  }, defaultPrevented: 0, isTrusted: 0 }, Rc = ir(Eo), _a = X({}, Eo, { view: 0, detail: 0 }), mb = ir(_a), Pc, Bc, Ha, sl = X({}, _a, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: Hc, button: 0, buttons: 0, relatedTarget: function(a) {
    return a.relatedTarget === void 0 ? a.fromElement === a.srcElement ? a.toElement : a.fromElement : a.relatedTarget;
  }, movementX: function(a) {
    return "movementX" in a ? a.movementX : (a !== Ha && (Ha && a.type === "mousemove" ? (Pc = a.screenX - Ha.screenX, Bc = a.screenY - Ha.screenY) : Bc = Pc = 0, Ha = a), Pc);
  }, movementY: function(a) {
    return "movementY" in a ? a.movementY : Bc;
  } }), Jh = ir(sl), gb = X({}, sl, { dataTransfer: 0 }), yb = ir(gb), wb = X({}, _a, { relatedTarget: 0 }), _c = ir(wb), kb = X({}, Eo, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), Cb = ir(kb), bb = X({}, Eo, { clipboardData: function(a) {
    return "clipboardData" in a ? a.clipboardData : window.clipboardData;
  } }), Tb = ir(bb), xb = X({}, Eo, { data: 0 }), Xh = ir(xb), Sb = {
    Esc: "Escape",
    Spacebar: " ",
    Left: "ArrowLeft",
    Up: "ArrowUp",
    Right: "ArrowRight",
    Down: "ArrowDown",
    Del: "Delete",
    Win: "OS",
    Menu: "ContextMenu",
    Apps: "ContextMenu",
    Scroll: "ScrollLock",
    MozPrintableKey: "Unidentified"
  }, Eb = {
    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"
  }, Mb = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" };
  function Ob(a) {
    var l = this.nativeEvent;
    return l.getModifierState ? l.getModifierState(a) : (a = Mb[a]) ? !!l[a] : !1;
  }
  function Hc() {
    return Ob;
  }
  var Nb = X({}, _a, { key: function(a) {
    if (a.key) {
      var l = Sb[a.key] || a.key;
      if (l !== "Unidentified") return l;
    }
    return a.type === "keypress" ? (a = ol(a), a === 13 ? "Enter" : String.fromCharCode(a)) : a.type === "keydown" || a.type === "keyup" ? Eb[a.keyCode] || "Unidentified" : "";
  }, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: Hc, charCode: function(a) {
    return a.type === "keypress" ? ol(a) : 0;
  }, keyCode: function(a) {
    return a.type === "keydown" || a.type === "keyup" ? a.keyCode : 0;
  }, which: function(a) {
    return a.type === "keypress" ? ol(a) : a.type === "keydown" || a.type === "keyup" ? a.keyCode : 0;
  } }), Lb = ir(Nb), Db = X({}, sl, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Yh = ir(Db), Ab = X({}, _a, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: Hc }), Ib = ir(Ab), Rb = X({}, Eo, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Pb = ir(Rb), Bb = X({}, sl, {
    deltaX: function(a) {
      return "deltaX" in a ? a.deltaX : "wheelDeltaX" in a ? -a.wheelDeltaX : 0;
    },
    deltaY: function(a) {
      return "deltaY" in a ? a.deltaY : "wheelDeltaY" in a ? -a.wheelDeltaY : "wheelDelta" in a ? -a.wheelDelta : 0;
    },
    deltaZ: 0,
    deltaMode: 0
  }), _b = ir(Bb), Hb = [9, 13, 27, 32], Fc = u && "CompositionEvent" in window, Fa = null;
  u && "documentMode" in document && (Fa = document.documentMode);
  var Fb = u && "TextEvent" in window && !Fa, Zh = u && (!Fc || Fa && 8 < Fa && 11 >= Fa), ev = " ", tv = !1;
  function rv(a, l) {
    switch (a) {
      case "keyup":
        return Hb.indexOf(l.keyCode) !== -1;
      case "keydown":
        return l.keyCode !== 229;
      case "keypress":
      case "mousedown":
      case "focusout":
        return !0;
      default:
        return !1;
    }
  }
  function nv(a) {
    return a = a.detail, typeof a == "object" && "data" in a ? a.data : null;
  }
  var Mo = !1;
  function zb(a, l) {
    switch (a) {
      case "compositionend":
        return nv(l);
      case "keypress":
        return l.which !== 32 ? null : (tv = !0, ev);
      case "textInput":
        return a = l.data, a === ev && tv ? null : a;
      default:
        return null;
    }
  }
  function Vb(a, l) {
    if (Mo) return a === "compositionend" || !Fc && rv(a, l) ? (a = Kh(), il = Ic = $n = null, Mo = !1, a) : null;
    switch (a) {
      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 Zh && l.locale !== "ko" ? null : l.data;
      default:
        return null;
    }
  }
  var qb = { 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 iv(a) {
    var l = a && a.nodeName && a.nodeName.toLowerCase();
    return l === "input" ? !!qb[a.type] : l === "textarea";
  }
  function ov(a, l, c, p) {
    bo(p), l = dl(l, "onChange"), 0 < l.length && (c = new Rc("onChange", "change", null, c, p), a.push({ event: c, listeners: l }));
  }
  var za = null, Va = null;
  function $b(a) {
    Tv(a, 0);
  }
  function ll(a) {
    var l = Ao(a);
    if (an(l)) return a;
  }
  function Ub(a, l) {
    if (a === "change") return l;
  }
  var av = !1;
  if (u) {
    var zc;
    if (u) {
      var Vc = "oninput" in document;
      if (!Vc) {
        var sv = document.createElement("div");
        sv.setAttribute("oninput", "return;"), Vc = typeof sv.oninput == "function";
      }
      zc = Vc;
    } else zc = !1;
    av = zc && (!document.documentMode || 9 < document.documentMode);
  }
  function lv() {
    za && (za.detachEvent("onpropertychange", uv), Va = za = null);
  }
  function uv(a) {
    if (a.propertyName === "value" && ll(Va)) {
      var l = [];
      ov(l, Va, a, Ea(a)), Oa($b, l);
    }
  }
  function jb(a, l, c) {
    a === "focusin" ? (lv(), za = l, Va = c, za.attachEvent("onpropertychange", uv)) : a === "focusout" && lv();
  }
  function Wb(a) {
    if (a === "selectionchange" || a === "keyup" || a === "keydown") return ll(Va);
  }
  function Gb(a, l) {
    if (a === "click") return ll(l);
  }
  function Kb(a, l) {
    if (a === "input" || a === "change") return ll(l);
  }
  function Qb(a, l) {
    return a === l && (a !== 0 || 1 / a === 1 / l) || a !== a && l !== l;
  }
  var Or = typeof Object.is == "function" ? Object.is : Qb;
  function qa(a, l) {
    if (Or(a, l)) return !0;
    if (typeof a != "object" || a === null || typeof l != "object" || l === null) return !1;
    var c = Object.keys(a), p = Object.keys(l);
    if (c.length !== p.length) return !1;
    for (p = 0; p < c.length; p++) {
      var v = c[p];
      if (!f.call(l, v) || !Or(a[v], l[v])) return !1;
    }
    return !0;
  }
  function cv(a) {
    for (; a && a.firstChild; ) a = a.firstChild;
    return a;
  }
  function fv(a, l) {
    var c = cv(a);
    a = 0;
    for (var p; c; ) {
      if (c.nodeType === 3) {
        if (p = a + c.textContent.length, a <= l && p >= l) return { node: c, offset: l - a };
        a = p;
      }
      e: {
        for (; c; ) {
          if (c.nextSibling) {
            c = c.nextSibling;
            break e;
          }
          c = c.parentNode;
        }
        c = void 0;
      }
      c = cv(c);
    }
  }
  function dv(a, l) {
    return a && l ? a === l ? !0 : a && a.nodeType === 3 ? !1 : l && l.nodeType === 3 ? dv(a, l.parentNode) : "contains" in a ? a.contains(l) : a.compareDocumentPosition ? !!(a.compareDocumentPosition(l) & 16) : !1 : !1;
  }
  function pv() {
    for (var a = window, l = Bn(); l instanceof a.HTMLIFrameElement; ) {
      try {
        var c = typeof l.contentWindow.location.href == "string";
      } catch {
        c = !1;
      }
      if (c) a = l.contentWindow;
      else break;
      l = Bn(a.document);
    }
    return l;
  }
  function qc(a) {
    var l = a && a.nodeName && a.nodeName.toLowerCase();
    return l && (l === "input" && (a.type === "text" || a.type === "search" || a.type === "tel" || a.type === "url" || a.type === "password") || l === "textarea" || a.contentEditable === "true");
  }
  function Jb(a) {
    var l = pv(), c = a.focusedElem, p = a.selectionRange;
    if (l !== c && c && c.ownerDocument && dv(c.ownerDocument.documentElement, c)) {
      if (p !== null && qc(c)) {
        if (l = p.start, a = p.end, a === void 0 && (a = l), "selectionStart" in c) c.selectionStart = l, c.selectionEnd = Math.min(a, c.value.length);
        else if (a = (l = c.ownerDocument || document) && l.defaultView || window, a.getSelection) {
          a = a.getSelection();
          var v = c.textContent.length, g = Math.min(p.start, v);
          p = p.end === void 0 ? g : Math.min(p.end, v), !a.extend && g > p && (v = p, p = g, g = v), v = fv(c, g);
          var C = fv(
            c,
            p
          );
          v && C && (a.rangeCount !== 1 || a.anchorNode !== v.node || a.anchorOffset !== v.offset || a.focusNode !== C.node || a.focusOffset !== C.offset) && (l = l.createRange(), l.setStart(v.node, v.offset), a.removeAllRanges(), g > p ? (a.addRange(l), a.extend(C.node, C.offset)) : (l.setEnd(C.node, C.offset), a.addRange(l)));
        }
      }
      for (l = [], a = c; a = a.parentNode; ) a.nodeType === 1 && l.push({ element: a, left: a.scrollLeft, top: a.scrollTop });
      for (typeof c.focus == "function" && c.focus(), c = 0; c < l.length; c++) a = l[c], a.element.scrollLeft = a.left, a.element.scrollTop = a.top;
    }
  }
  var Xb = u && "documentMode" in document && 11 >= document.documentMode, Oo = null, $c = null, $a = null, Uc = !1;
  function hv(a, l, c) {
    var p = c.window === c ? c.document : c.nodeType === 9 ? c : c.ownerDocument;
    Uc || Oo == null || Oo !== Bn(p) || (p = Oo, "selectionStart" in p && qc(p) ? p = { start: p.selectionStart, end: p.selectionEnd } : (p = (p.ownerDocument && p.ownerDocument.defaultView || window).getSelection(), p = { anchorNode: p.anchorNode, anchorOffset: p.anchorOffset, focusNode: p.focusNode, focusOffset: p.focusOffset }), $a && qa($a, p) || ($a = p, p = dl($c, "onSelect"), 0 < p.length && (l = new Rc("onSelect", "select", null, l, c), a.push({ event: l, listeners: p }), l.target = Oo)));
  }
  function ul(a, l) {
    var c = {};
    return c[a.toLowerCase()] = l.toLowerCase(), c["Webkit" + a] = "webkit" + l, c["Moz" + a] = "moz" + l, c;
  }
  var No = { animationend: ul("Animation", "AnimationEnd"), animationiteration: ul("Animation", "AnimationIteration"), animationstart: ul("Animation", "AnimationStart"), transitionend: ul("Transition", "TransitionEnd") }, jc = {}, vv = {};
  u && (vv = document.createElement("div").style, "AnimationEvent" in window || (delete No.animationend.animation, delete No.animationiteration.animation, delete No.animationstart.animation), "TransitionEvent" in window || delete No.transitionend.transition);
  function cl(a) {
    if (jc[a]) return jc[a];
    if (!No[a]) return a;
    var l = No[a], c;
    for (c in l) if (l.hasOwnProperty(c) && c in vv) return jc[a] = l[c];
    return a;
  }
  var mv = cl("animationend"), gv = cl("animationiteration"), yv = cl("animationstart"), wv = cl("transitionend"), kv = /* @__PURE__ */ new Map(), Cv = "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 Un(a, l) {
    kv.set(a, l), o(l, [a]);
  }
  for (var Wc = 0; Wc < Cv.length; Wc++) {
    var Gc = Cv[Wc], Yb = Gc.toLowerCase(), Zb = Gc[0].toUpperCase() + Gc.slice(1);
    Un(Yb, "on" + Zb);
  }
  Un(mv, "onAnimationEnd"), Un(gv, "onAnimationIteration"), Un(yv, "onAnimationStart"), Un("dblclick", "onDoubleClick"), Un("focusin", "onFocus"), Un("focusout", "onBlur"), Un(wv, "onTransitionEnd"), s("onMouseEnter", ["mouseout", "mouseover"]), s("onMouseLeave", ["mouseout", "mouseover"]), s("onPointerEnter", ["pointerout", "pointerover"]), s("onPointerLeave", ["pointerout", "pointerover"]), o("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")), o("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")), o("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]), o("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")), o("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")), o("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
  var Ua = "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(" "), eT = new Set("cancel close invalid load scroll toggle".split(" ").concat(Ua));
  function bv(a, l, c) {
    var p = a.type || "unknown-event";
    a.currentTarget = c, ne(p, l, void 0, a), a.currentTarget = null;
  }
  function Tv(a, l) {
    l = (l & 4) !== 0;
    for (var c = 0; c < a.length; c++) {
      var p = a[c], v = p.event;
      p = p.listeners;
      e: {
        var g = void 0;
        if (l) for (var C = p.length - 1; 0 <= C; C--) {
          var x = p[C], S = x.instance, A = x.currentTarget;
          if (x = x.listener, S !== g && v.isPropagationStopped()) break e;
          bv(v, x, A), g = S;
        }
        else for (C = 0; C < p.length; C++) {
          if (x = p[C], S = x.instance, A = x.currentTarget, x = x.listener, S !== g && v.isPropagationStopped()) break e;
          bv(v, x, A), g = S;
        }
      }
    }
    if (xo) throw a = oe, xo = !1, oe = null, a;
  }
  function Pe(a, l) {
    var c = l[tf];
    c === void 0 && (c = l[tf] = /* @__PURE__ */ new Set());
    var p = a + "__bubble";
    c.has(p) || (xv(l, a, 2, !1), c.add(p));
  }
  function Kc(a, l, c) {
    var p = 0;
    l && (p |= 4), xv(c, a, p, l);
  }
  var fl = "_reactListening" + Math.random().toString(36).slice(2);
  function ja(a) {
    if (!a[fl]) {
      a[fl] = !0, n.forEach(function(c) {
        c !== "selectionchange" && (eT.has(c) || Kc(c, !1, a), Kc(c, !0, a));
      });
      var l = a.nodeType === 9 ? a : a.ownerDocument;
      l === null || l[fl] || (l[fl] = !0, Kc("selectionchange", !1, l));
    }
  }
  function xv(a, l, c, p) {
    switch (Gh(l)) {
      case 1:
        var v = hb;
        break;
      case 4:
        v = vb;
        break;
      default:
        v = Dc;
    }
    c = v.bind(null, l, c, a), v = void 0, !hn || l !== "touchstart" && l !== "touchmove" && l !== "wheel" || (v = !0), p ? v !== void 0 ? a.addEventListener(l, c, { capture: !0, passive: v }) : a.addEventListener(l, c, !0) : v !== void 0 ? a.addEventListener(l, c, { passive: v }) : a.addEventListener(l, c, !1);
  }
  function Qc(a, l, c, p, v) {
    var g = p;
    if ((l & 1) === 0 && (l & 2) === 0 && p !== null) e: for (; ; ) {
      if (p === null) return;
      var C = p.tag;
      if (C === 3 || C === 4) {
        var x = p.stateNode.containerInfo;
        if (x === v || x.nodeType === 8 && x.parentNode === v) break;
        if (C === 4) for (C = p.return; C !== null; ) {
          var S = C.tag;
          if ((S === 3 || S === 4) && (S = C.stateNode.containerInfo, S === v || S.nodeType === 8 && S.parentNode === v)) return;
          C = C.return;
        }
        for (; x !== null; ) {
          if (C = Ii(x), C === null) return;
          if (S = C.tag, S === 5 || S === 6) {
            p = g = C;
            continue e;
          }
          x = x.parentNode;
        }
      }
      p = p.return;
    }
    Oa(function() {
      var A = g, z = Ea(c), $ = [];
      e: {
        var H = kv.get(a);
        if (H !== void 0) {
          var J = Rc, ee = a;
          switch (a) {
            case "keypress":
              if (ol(c) === 0) break e;
            case "keydown":
            case "keyup":
              J = Lb;
              break;
            case "focusin":
              ee = "focus", J = _c;
              break;
            case "focusout":
              ee = "blur", J = _c;
              break;
            case "beforeblur":
            case "afterblur":
              J = _c;
              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":
              J = Jh;
              break;
            case "drag":
            case "dragend":
            case "dragenter":
            case "dragexit":
            case "dragleave":
            case "dragover":
            case "dragstart":
            case "drop":
              J = yb;
              break;
            case "touchcancel":
            case "touchend":
            case "touchmove":
            case "touchstart":
              J = Ib;
              break;
            case mv:
            case gv:
            case yv:
              J = Cb;
              break;
            case wv:
              J = Pb;
              break;
            case "scroll":
              J = mb;
              break;
            case "wheel":
              J = _b;
              break;
            case "copy":
            case "cut":
            case "paste":
              J = Tb;
              break;
            case "gotpointercapture":
            case "lostpointercapture":
            case "pointercancel":
            case "pointerdown":
            case "pointermove":
            case "pointerout":
            case "pointerover":
            case "pointerup":
              J = Yh;
          }
          var te = (l & 4) !== 0, Ke = !te && a === "scroll", N = te ? H !== null ? H + "Capture" : null : H;
          te = [];
          for (var M = A, D; M !== null; ) {
            D = M;
            var U = D.stateNode;
            if (D.tag === 5 && U !== null && (D = U, N !== null && (U = Di(M, N), U != null && te.push(Wa(M, U, D)))), Ke) break;
            M = M.return;
          }
          0 < te.length && (H = new J(H, ee, null, c, z), $.push({ event: H, listeners: te }));
        }
      }
      if ((l & 7) === 0) {
        e: {
          if (H = a === "mouseover" || a === "pointerover", J = a === "mouseout" || a === "pointerout", H && c !== $r && (ee = c.relatedTarget || c.fromElement) && (Ii(ee) || ee[vn])) break e;
          if ((J || H) && (H = z.window === z ? z : (H = z.ownerDocument) ? H.defaultView || H.parentWindow : window, J ? (ee = c.relatedTarget || c.toElement, J = A, ee = ee ? Ii(ee) : null, ee !== null && (Ke = ye(ee), ee !== Ke || ee.tag !== 5 && ee.tag !== 6) && (ee = null)) : (J = null, ee = A), J !== ee)) {
            if (te = Jh, U = "onMouseLeave", N = "onMouseEnter", M = "mouse", (a === "pointerout" || a === "pointerover") && (te = Yh, U = "onPointerLeave", N = "onPointerEnter", M = "pointer"), Ke = J == null ? H : Ao(J), D = ee == null ? H : Ao(ee), H = new te(U, M + "leave", J, c, z), H.target = Ke, H.relatedTarget = D, U = null, Ii(z) === A && (te = new te(N, M + "enter", ee, c, z), te.target = D, te.relatedTarget = Ke, U = te), Ke = U, J && ee) t: {
              for (te = J, N = ee, M = 0, D = te; D; D = Lo(D)) M++;
              for (D = 0, U = N; U; U = Lo(U)) D++;
              for (; 0 < M - D; ) te = Lo(te), M--;
              for (; 0 < D - M; ) N = Lo(N), D--;
              for (; M--; ) {
                if (te === N || N !== null && te === N.alternate) break t;
                te = Lo(te), N = Lo(N);
              }
              te = null;
            }
            else te = null;
            J !== null && Sv($, H, J, te, !1), ee !== null && Ke !== null && Sv($, Ke, ee, te, !0);
          }
        }
        e: {
          if (H = A ? Ao(A) : window, J = H.nodeName && H.nodeName.toLowerCase(), J === "select" || J === "input" && H.type === "file") var ie = Ub;
          else if (iv(H)) if (av) ie = Kb;
          else {
            ie = Wb;
            var se = jb;
          }
          else (J = H.nodeName) && J.toLowerCase() === "input" && (H.type === "checkbox" || H.type === "radio") && (ie = Gb);
          if (ie && (ie = ie(a, A))) {
            ov($, ie, c, z);
            break e;
          }
          se && se(a, H, A), a === "focusout" && (se = H._wrapperState) && se.controlled && H.type === "number" && yo(H, "number", H.value);
        }
        switch (se = A ? Ao(A) : window, a) {
          case "focusin":
            (iv(se) || se.contentEditable === "true") && (Oo = se, $c = A, $a = null);
            break;
          case "focusout":
            $a = $c = Oo = null;
            break;
          case "mousedown":
            Uc = !0;
            break;
          case "contextmenu":
          case "mouseup":
          case "dragend":
            Uc = !1, hv($, c, z);
            break;
          case "selectionchange":
            if (Xb) break;
          case "keydown":
          case "keyup":
            hv($, c, z);
        }
        var le;
        if (Fc) e: {
          switch (a) {
            case "compositionstart":
              var fe = "onCompositionStart";
              break e;
            case "compositionend":
              fe = "onCompositionEnd";
              break e;
            case "compositionupdate":
              fe = "onCompositionUpdate";
              break e;
          }
          fe = void 0;
        }
        else Mo ? rv(a, c) && (fe = "onCompositionEnd") : a === "keydown" && c.keyCode === 229 && (fe = "onCompositionStart");
        fe && (Zh && c.locale !== "ko" && (Mo || fe !== "onCompositionStart" ? fe === "onCompositionEnd" && Mo && (le = Kh()) : ($n = z, Ic = "value" in $n ? $n.value : $n.textContent, Mo = !0)), se = dl(A, fe), 0 < se.length && (fe = new Xh(fe, a, null, c, z), $.push({ event: fe, listeners: se }), le ? fe.data = le : (le = nv(c), le !== null && (fe.data = le)))), (le = Fb ? zb(a, c) : Vb(a, c)) && (A = dl(A, "onBeforeInput"), 0 < A.length && (z = new Xh("onBeforeInput", "beforeinput", null, c, z), $.push({ event: z, listeners: A }), z.data = le));
      }
      Tv($, l);
    });
  }
  function Wa(a, l, c) {
    return { instance: a, listener: l, currentTarget: c };
  }
  function dl(a, l) {
    for (var c = l + "Capture", p = []; a !== null; ) {
      var v = a, g = v.stateNode;
      v.tag === 5 && g !== null && (v = g, g = Di(a, c), g != null && p.unshift(Wa(a, g, v)), g = Di(a, l), g != null && p.push(Wa(a, g, v))), a = a.return;
    }
    return p;
  }
  function Lo(a) {
    if (a === null) return null;
    do
      a = a.return;
    while (a && a.tag !== 5);
    return a || null;
  }
  function Sv(a, l, c, p, v) {
    for (var g = l._reactName, C = []; c !== null && c !== p; ) {
      var x = c, S = x.alternate, A = x.stateNode;
      if (S !== null && S === p) break;
      x.tag === 5 && A !== null && (x = A, v ? (S = Di(c, g), S != null && C.unshift(Wa(c, S, x))) : v || (S = Di(c, g), S != null && C.push(Wa(c, S, x)))), c = c.return;
    }
    C.length !== 0 && a.push({ event: l, listeners: C });
  }
  var tT = /\r\n?/g, rT = /\u0000|\uFFFD/g;
  function Ev(a) {
    return (typeof a == "string" ? a : "" + a).replace(tT, `
`).replace(rT, "");
  }
  function pl(a, l, c) {
    if (l = Ev(l), Ev(a) !== l && c) throw Error(t(425));
  }
  function hl() {
  }
  var Jc = null, Xc = null;
  function Yc(a, l) {
    return a === "textarea" || a === "noscript" || typeof l.children == "string" || typeof l.children == "number" || typeof l.dangerouslySetInnerHTML == "object" && l.dangerouslySetInnerHTML !== null && l.dangerouslySetInnerHTML.__html != null;
  }
  var Zc = typeof setTimeout == "function" ? setTimeout : void 0, nT = typeof clearTimeout == "function" ? clearTimeout : void 0, Mv = typeof Promise == "function" ? Promise : void 0, iT = typeof queueMicrotask == "function" ? queueMicrotask : typeof Mv < "u" ? function(a) {
    return Mv.resolve(null).then(a).catch(oT);
  } : Zc;
  function oT(a) {
    setTimeout(function() {
      throw a;
    });
  }
  function ef(a, l) {
    var c = l, p = 0;
    do {
      var v = c.nextSibling;
      if (a.removeChild(c), v && v.nodeType === 8) if (c = v.data, c === "/$") {
        if (p === 0) {
          a.removeChild(v), Ba(l);
          return;
        }
        p--;
      } else c !== "$" && c !== "$?" && c !== "$!" || p++;
      c = v;
    } while (c);
    Ba(l);
  }
  function jn(a) {
    for (; a != null; a = a.nextSibling) {
      var l = a.nodeType;
      if (l === 1 || l === 3) break;
      if (l === 8) {
        if (l = a.data, l === "$" || l === "$!" || l === "$?") break;
        if (l === "/$") return null;
      }
    }
    return a;
  }
  function Ov(a) {
    a = a.previousSibling;
    for (var l = 0; a; ) {
      if (a.nodeType === 8) {
        var c = a.data;
        if (c === "$" || c === "$!" || c === "$?") {
          if (l === 0) return a;
          l--;
        } else c === "/$" && l++;
      }
      a = a.previousSibling;
    }
    return null;
  }
  var Do = Math.random().toString(36).slice(2), jr = "__reactFiber$" + Do, Ga = "__reactProps$" + Do, vn = "__reactContainer$" + Do, tf = "__reactEvents$" + Do, aT = "__reactListeners$" + Do, sT = "__reactHandles$" + Do;
  function Ii(a) {
    var l = a[jr];
    if (l) return l;
    for (var c = a.parentNode; c; ) {
      if (l = c[vn] || c[jr]) {
        if (c = l.alternate, l.child !== null || c !== null && c.child !== null) for (a = Ov(a); a !== null; ) {
          if (c = a[jr]) return c;
          a = Ov(a);
        }
        return l;
      }
      a = c, c = a.parentNode;
    }
    return null;
  }
  function Ka(a) {
    return a = a[jr] || a[vn], !a || a.tag !== 5 && a.tag !== 6 && a.tag !== 13 && a.tag !== 3 ? null : a;
  }
  function Ao(a) {
    if (a.tag === 5 || a.tag === 6) return a.stateNode;
    throw Error(t(33));
  }
  function vl(a) {
    return a[Ga] || null;
  }
  var rf = [], Io = -1;
  function Wn(a) {
    return { current: a };
  }
  function Be(a) {
    0 > Io || (a.current = rf[Io], rf[Io] = null, Io--);
  }
  function Ie(a, l) {
    Io++, rf[Io] = a.current, a.current = l;
  }
  var Gn = {}, Ot = Wn(Gn), Gt = Wn(!1), Ri = Gn;
  function Ro(a, l) {
    var c = a.type.contextTypes;
    if (!c) return Gn;
    var p = a.stateNode;
    if (p && p.__reactInternalMemoizedUnmaskedChildContext === l) return p.__reactInternalMemoizedMaskedChildContext;
    var v = {}, g;
    for (g in c) v[g] = l[g];
    return p && (a = a.stateNode, a.__reactInternalMemoizedUnmaskedChildContext = l, a.__reactInternalMemoizedMaskedChildContext = v), v;
  }
  function Kt(a) {
    return a = a.childContextTypes, a != null;
  }
  function ml() {
    Be(Gt), Be(Ot);
  }
  function Nv(a, l, c) {
    if (Ot.current !== Gn) throw Error(t(168));
    Ie(Ot, l), Ie(Gt, c);
  }
  function Lv(a, l, c) {
    var p = a.stateNode;
    if (l = l.childContextTypes, typeof p.getChildContext != "function") return c;
    p = p.getChildContext();
    for (var v in p) if (!(v in l)) throw Error(t(108, Oe(a) || "Unknown", v));
    return X({}, c, p);
  }
  function gl(a) {
    return a = (a = a.stateNode) && a.__reactInternalMemoizedMergedChildContext || Gn, Ri = Ot.current, Ie(Ot, a), Ie(Gt, Gt.current), !0;
  }
  function Dv(a, l, c) {
    var p = a.stateNode;
    if (!p) throw Error(t(169));
    c ? (a = Lv(a, l, Ri), p.__reactInternalMemoizedMergedChildContext = a, Be(Gt), Be(Ot), Ie(Ot, a)) : Be(Gt), Ie(Gt, c);
  }
  var mn = null, yl = !1, nf = !1;
  function Av(a) {
    mn === null ? mn = [a] : mn.push(a);
  }
  function lT(a) {
    yl = !0, Av(a);
  }
  function Kn() {
    if (!nf && mn !== null) {
      nf = !0;
      var a = 0, l = De;
      try {
        var c = mn;
        for (De = 1; a < c.length; a++) {
          var p = c[a];
          do
            p = p(!0);
          while (p !== null);
        }
        mn = null, yl = !1;
      } catch (v) {
        throw mn !== null && (mn = mn.slice(a + 1)), Na(Sc, Kn), v;
      } finally {
        De = l, nf = !1;
      }
    }
    return null;
  }
  var Po = [], Bo = 0, wl = null, kl = 0, hr = [], vr = 0, Pi = null, gn = 1, yn = "";
  function Bi(a, l) {
    Po[Bo++] = kl, Po[Bo++] = wl, wl = a, kl = l;
  }
  function Iv(a, l, c) {
    hr[vr++] = gn, hr[vr++] = yn, hr[vr++] = Pi, Pi = a;
    var p = gn;
    a = yn;
    var v = 32 - Mr(p) - 1;
    p &= ~(1 << v), c += 1;
    var g = 32 - Mr(l) + v;
    if (30 < g) {
      var C = v - v % 5;
      g = (p & (1 << C) - 1).toString(32), p >>= C, v -= C, gn = 1 << 32 - Mr(l) + v | c << v | p, yn = g + a;
    } else gn = 1 << g | c << v | p, yn = a;
  }
  function of(a) {
    a.return !== null && (Bi(a, 1), Iv(a, 1, 0));
  }
  function af(a) {
    for (; a === wl; ) wl = Po[--Bo], Po[Bo] = null, kl = Po[--Bo], Po[Bo] = null;
    for (; a === Pi; ) Pi = hr[--vr], hr[vr] = null, yn = hr[--vr], hr[vr] = null, gn = hr[--vr], hr[vr] = null;
  }
  var or = null, ar = null, He = !1, Nr = null;
  function Rv(a, l) {
    var c = wr(5, null, null, 0);
    c.elementType = "DELETED", c.stateNode = l, c.return = a, l = a.deletions, l === null ? (a.deletions = [c], a.flags |= 16) : l.push(c);
  }
  function Pv(a, l) {
    switch (a.tag) {
      case 5:
        var c = a.type;
        return l = l.nodeType !== 1 || c.toLowerCase() !== l.nodeName.toLowerCase() ? null : l, l !== null ? (a.stateNode = l, or = a, ar = jn(l.firstChild), !0) : !1;
      case 6:
        return l = a.pendingProps === "" || l.nodeType !== 3 ? null : l, l !== null ? (a.stateNode = l, or = a, ar = null, !0) : !1;
      case 13:
        return l = l.nodeType !== 8 ? null : l, l !== null ? (c = Pi !== null ? { id: gn, overflow: yn } : null, a.memoizedState = { dehydrated: l, treeContext: c, retryLane: 1073741824 }, c = wr(18, null, null, 0), c.stateNode = l, c.return = a, a.child = c, or = a, ar = null, !0) : !1;
      default:
        return !1;
    }
  }
  function sf(a) {
    return (a.mode & 1) !== 0 && (a.flags & 128) === 0;
  }
  function lf(a) {
    if (He) {
      var l = ar;
      if (l) {
        var c = l;
        if (!Pv(a, l)) {
          if (sf(a)) throw Error(t(418));
          l = jn(c.nextSibling);
          var p = or;
          l && Pv(a, l) ? Rv(p, c) : (a.flags = a.flags & -4097 | 2, He = !1, or = a);
        }
      } else {
        if (sf(a)) throw Error(t(418));
        a.flags = a.flags & -4097 | 2, He = !1, or = a;
      }
    }
  }
  function Bv(a) {
    for (a = a.return; a !== null && a.tag !== 5 && a.tag !== 3 && a.tag !== 13; ) a = a.return;
    or = a;
  }
  function Cl(a) {
    if (a !== or) return !1;
    if (!He) return Bv(a), He = !0, !1;
    var l;
    if ((l = a.tag !== 3) && !(l = a.tag !== 5) && (l = a.type, l = l !== "head" && l !== "body" && !Yc(a.type, a.memoizedProps)), l && (l = ar)) {
      if (sf(a)) throw _v(), Error(t(418));
      for (; l; ) Rv(a, l), l = jn(l.nextSibling);
    }
    if (Bv(a), a.tag === 13) {
      if (a = a.memoizedState, a = a !== null ? a.dehydrated : null, !a) throw Error(t(317));
      e: {
        for (a = a.nextSibling, l = 0; a; ) {
          if (a.nodeType === 8) {
            var c = a.data;
            if (c === "/$") {
              if (l === 0) {
                ar = jn(a.nextSibling);
                break e;
              }
              l--;
            } else c !== "$" && c !== "$!" && c !== "$?" || l++;
          }
          a = a.nextSibling;
        }
        ar = null;
      }
    } else ar = or ? jn(a.stateNode.nextSibling) : null;
    return !0;
  }
  function _v() {
    for (var a = ar; a; ) a = jn(a.nextSibling);
  }
  function _o() {
    ar = or = null, He = !1;
  }
  function uf(a) {
    Nr === null ? Nr = [a] : Nr.push(a);
  }
  var uT = _.ReactCurrentBatchConfig;
  function Qa(a, l, c) {
    if (a = c.ref, a !== null && typeof a != "function" && typeof a != "object") {
      if (c._owner) {
        if (c = c._owner, c) {
          if (c.tag !== 1) throw Error(t(309));
          var p = c.stateNode;
        }
        if (!p) throw Error(t(147, a));
        var v = p, g = "" + a;
        return l !== null && l.ref !== null && typeof l.ref == "function" && l.ref._stringRef === g ? l.ref : (l = function(C) {
          var x = v.refs;
          C === null ? delete x[g] : x[g] = C;
        }, l._stringRef = g, l);
      }
      if (typeof a != "string") throw Error(t(284));
      if (!c._owner) throw Error(t(290, a));
    }
    return a;
  }
  function bl(a, l) {
    throw a = Object.prototype.toString.call(l), Error(t(31, a === "[object Object]" ? "object with keys {" + Object.keys(l).join(", ") + "}" : a));
  }
  function Hv(a) {
    var l = a._init;
    return l(a._payload);
  }
  function Fv(a) {
    function l(N, M) {
      if (a) {
        var D = N.deletions;
        D === null ? (N.deletions = [M], N.flags |= 16) : D.push(M);
      }
    }
    function c(N, M) {
      if (!a) return null;
      for (; M !== null; ) l(N, M), M = M.sibling;
      return null;
    }
    function p(N, M) {
      for (N = /* @__PURE__ */ new Map(); M !== null; ) M.key !== null ? N.set(M.key, M) : N.set(M.index, M), M = M.sibling;
      return N;
    }
    function v(N, M) {
      return N = ri(N, M), N.index = 0, N.sibling = null, N;
    }
    function g(N, M, D) {
      return N.index = D, a ? (D = N.alternate, D !== null ? (D = D.index, D < M ? (N.flags |= 2, M) : D) : (N.flags |= 2, M)) : (N.flags |= 1048576, M);
    }
    function C(N) {
      return a && N.alternate === null && (N.flags |= 2), N;
    }
    function x(N, M, D, U) {
      return M === null || M.tag !== 6 ? (M = ed(D, N.mode, U), M.return = N, M) : (M = v(M, D), M.return = N, M);
    }
    function S(N, M, D, U) {
      var ie = D.type;
      return ie === q ? z(N, M, D.props.children, U, D.key) : M !== null && (M.elementType === ie || typeof ie == "object" && ie !== null && ie.$$typeof === lt && Hv(ie) === M.type) ? (U = v(M, D.props), U.ref = Qa(N, M, D), U.return = N, U) : (U = Wl(D.type, D.key, D.props, null, N.mode, U), U.ref = Qa(N, M, D), U.return = N, U);
    }
    function A(N, M, D, U) {
      return M === null || M.tag !== 4 || M.stateNode.containerInfo !== D.containerInfo || M.stateNode.implementation !== D.implementation ? (M = td(D, N.mode, U), M.return = N, M) : (M = v(M, D.children || []), M.return = N, M);
    }
    function z(N, M, D, U, ie) {
      return M === null || M.tag !== 7 ? (M = Ui(D, N.mode, U, ie), M.return = N, M) : (M = v(M, D), M.return = N, M);
    }
    function $(N, M, D) {
      if (typeof M == "string" && M !== "" || typeof M == "number") return M = ed("" + M, N.mode, D), M.return = N, M;
      if (typeof M == "object" && M !== null) {
        switch (M.$$typeof) {
          case V:
            return D = Wl(M.type, M.key, M.props, null, N.mode, D), D.ref = Qa(N, null, M), D.return = N, D;
          case W:
            return M = td(M, N.mode, D), M.return = N, M;
          case lt:
            var U = M._init;
            return $(N, U(M._payload), D);
        }
        if (ln(M) || ue(M)) return M = Ui(M, N.mode, D, null), M.return = N, M;
        bl(N, M);
      }
      return null;
    }
    function H(N, M, D, U) {
      var ie = M !== null ? M.key : null;
      if (typeof D == "string" && D !== "" || typeof D == "number") return ie !== null ? null : x(N, M, "" + D, U);
      if (typeof D == "object" && D !== null) {
        switch (D.$$typeof) {
          case V:
            return D.key === ie ? S(N, M, D, U) : null;
          case W:
            return D.key === ie ? A(N, M, D, U) : null;
          case lt:
            return ie = D._init, H(
              N,
              M,
              ie(D._payload),
              U
            );
        }
        if (ln(D) || ue(D)) return ie !== null ? null : z(N, M, D, U, null);
        bl(N, D);
      }
      return null;
    }
    function J(N, M, D, U, ie) {
      if (typeof U == "string" && U !== "" || typeof U == "number") return N = N.get(D) || null, x(M, N, "" + U, ie);
      if (typeof U == "object" && U !== null) {
        switch (U.$$typeof) {
          case V:
            return N = N.get(U.key === null ? D : U.key) || null, S(M, N, U, ie);
          case W:
            return N = N.get(U.key === null ? D : U.key) || null, A(M, N, U, ie);
          case lt:
            var se = U._init;
            return J(N, M, D, se(U._payload), ie);
        }
        if (ln(U) || ue(U)) return N = N.get(D) || null, z(M, N, U, ie, null);
        bl(M, U);
      }
      return null;
    }
    function ee(N, M, D, U) {
      for (var ie = null, se = null, le = M, fe = M = 0, dt = null; le !== null && fe < D.length; fe++) {
        le.index > fe ? (dt = le, le = null) : dt = le.sibling;
        var Me = H(N, le, D[fe], U);
        if (Me === null) {
          le === null && (le = dt);
          break;
        }
        a && le && Me.alternate === null && l(N, le), M = g(Me, M, fe), se === null ? ie = Me : se.sibling = Me, se = Me, le = dt;
      }
      if (fe === D.length) return c(N, le), He && Bi(N, fe), ie;
      if (le === null) {
        for (; fe < D.length; fe++) le = $(N, D[fe], U), le !== null && (M = g(le, M, fe), se === null ? ie = le : se.sibling = le, se = le);
        return He && Bi(N, fe), ie;
      }
      for (le = p(N, le); fe < D.length; fe++) dt = J(le, N, fe, D[fe], U), dt !== null && (a && dt.alternate !== null && le.delete(dt.key === null ? fe : dt.key), M = g(dt, M, fe), se === null ? ie = dt : se.sibling = dt, se = dt);
      return a && le.forEach(function(ni) {
        return l(N, ni);
      }), He && Bi(N, fe), ie;
    }
    function te(N, M, D, U) {
      var ie = ue(D);
      if (typeof ie != "function") throw Error(t(150));
      if (D = ie.call(D), D == null) throw Error(t(151));
      for (var se = ie = null, le = M, fe = M = 0, dt = null, Me = D.next(); le !== null && !Me.done; fe++, Me = D.next()) {
        le.index > fe ? (dt = le, le = null) : dt = le.sibling;
        var ni = H(N, le, Me.value, U);
        if (ni === null) {
          le === null && (le = dt);
          break;
        }
        a && le && ni.alternate === null && l(N, le), M = g(ni, M, fe), se === null ? ie = ni : se.sibling = ni, se = ni, le = dt;
      }
      if (Me.done) return c(
        N,
        le
      ), He && Bi(N, fe), ie;
      if (le === null) {
        for (; !Me.done; fe++, Me = D.next()) Me = $(N, Me.value, U), Me !== null && (M = g(Me, M, fe), se === null ? ie = Me : se.sibling = Me, se = Me);
        return He && Bi(N, fe), ie;
      }
      for (le = p(N, le); !Me.done; fe++, Me = D.next()) Me = J(le, N, fe, Me.value, U), Me !== null && (a && Me.alternate !== null && le.delete(Me.key === null ? fe : Me.key), M = g(Me, M, fe), se === null ? ie = Me : se.sibling = Me, se = Me);
      return a && le.forEach(function(qT) {
        return l(N, qT);
      }), He && Bi(N, fe), ie;
    }
    function Ke(N, M, D, U) {
      if (typeof D == "object" && D !== null && D.type === q && D.key === null && (D = D.props.children), typeof D == "object" && D !== null) {
        switch (D.$$typeof) {
          case V:
            e: {
              for (var ie = D.key, se = M; se !== null; ) {
                if (se.key === ie) {
                  if (ie = D.type, ie === q) {
                    if (se.tag === 7) {
                      c(N, se.sibling), M = v(se, D.props.children), M.return = N, N = M;
                      break e;
                    }
                  } else if (se.elementType === ie || typeof ie == "object" && ie !== null && ie.$$typeof === lt && Hv(ie) === se.type) {
                    c(N, se.sibling), M = v(se, D.props), M.ref = Qa(N, se, D), M.return = N, N = M;
                    break e;
                  }
                  c(N, se);
                  break;
                } else l(N, se);
                se = se.sibling;
              }
              D.type === q ? (M = Ui(D.props.children, N.mode, U, D.key), M.return = N, N = M) : (U = Wl(D.type, D.key, D.props, null, N.mode, U), U.ref = Qa(N, M, D), U.return = N, N = U);
            }
            return C(N);
          case W:
            e: {
              for (se = D.key; M !== null; ) {
                if (M.key === se) if (M.tag === 4 && M.stateNode.containerInfo === D.containerInfo && M.stateNode.implementation === D.implementation) {
                  c(N, M.sibling), M = v(M, D.children || []), M.return = N, N = M;
                  break e;
                } else {
                  c(N, M);
                  break;
                }
                else l(N, M);
                M = M.sibling;
              }
              M = td(D, N.mode, U), M.return = N, N = M;
            }
            return C(N);
          case lt:
            return se = D._init, Ke(N, M, se(D._payload), U);
        }
        if (ln(D)) return ee(N, M, D, U);
        if (ue(D)) return te(N, M, D, U);
        bl(N, D);
      }
      return typeof D == "string" && D !== "" || typeof D == "number" ? (D = "" + D, M !== null && M.tag === 6 ? (c(N, M.sibling), M = v(M, D), M.return = N, N = M) : (c(N, M), M = ed(D, N.mode, U), M.return = N, N = M), C(N)) : c(N, M);
    }
    return Ke;
  }
  var Ho = Fv(!0), zv = Fv(!1), Tl = Wn(null), xl = null, Fo = null, cf = null;
  function ff() {
    cf = Fo = xl = null;
  }
  function df(a) {
    var l = Tl.current;
    Be(Tl), a._currentValue = l;
  }
  function pf(a, l, c) {
    for (; a !== null; ) {
      var p = a.alternate;
      if ((a.childLanes & l) !== l ? (a.childLanes |= l, p !== null && (p.childLanes |= l)) : p !== null && (p.childLanes & l) !== l && (p.childLanes |= l), a === c) break;
      a = a.return;
    }
  }
  function zo(a, l) {
    xl = a, cf = Fo = null, a = a.dependencies, a !== null && a.firstContext !== null && ((a.lanes & l) !== 0 && (Qt = !0), a.firstContext = null);
  }
  function mr(a) {
    var l = a._currentValue;
    if (cf !== a) if (a = { context: a, memoizedValue: l, next: null }, Fo === null) {
      if (xl === null) throw Error(t(308));
      Fo = a, xl.dependencies = { lanes: 0, firstContext: a };
    } else Fo = Fo.next = a;
    return l;
  }
  var _i = null;
  function hf(a) {
    _i === null ? _i = [a] : _i.push(a);
  }
  function Vv(a, l, c, p) {
    var v = l.interleaved;
    return v === null ? (c.next = c, hf(l)) : (c.next = v.next, v.next = c), l.interleaved = c, wn(a, p);
  }
  function wn(a, l) {
    a.lanes |= l;
    var c = a.alternate;
    for (c !== null && (c.lanes |= l), c = a, a = a.return; a !== null; ) a.childLanes |= l, c = a.alternate, c !== null && (c.childLanes |= l), c = a, a = a.return;
    return c.tag === 3 ? c.stateNode : null;
  }
  var Qn = !1;
  function vf(a) {
    a.updateQueue = { baseState: a.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null };
  }
  function qv(a, l) {
    a = a.updateQueue, l.updateQueue === a && (l.updateQueue = { baseState: a.baseState, firstBaseUpdate: a.firstBaseUpdate, lastBaseUpdate: a.lastBaseUpdate, shared: a.shared, effects: a.effects });
  }
  function kn(a, l) {
    return { eventTime: a, lane: l, tag: 0, payload: null, callback: null, next: null };
  }
  function Jn(a, l, c) {
    var p = a.updateQueue;
    if (p === null) return null;
    if (p = p.shared, (Te & 2) !== 0) {
      var v = p.pending;
      return v === null ? l.next = l : (l.next = v.next, v.next = l), p.pending = l, wn(a, c);
    }
    return v = p.interleaved, v === null ? (l.next = l, hf(p)) : (l.next = v.next, v.next = l), p.interleaved = l, wn(a, c);
  }
  function Sl(a, l, c) {
    if (l = l.updateQueue, l !== null && (l = l.shared, (c & 4194240) !== 0)) {
      var p = l.lanes;
      p &= a.pendingLanes, c |= p, l.lanes = c, Oc(a, c);
    }
  }
  function $v(a, l) {
    var c = a.updateQueue, p = a.alternate;
    if (p !== null && (p = p.updateQueue, c === p)) {
      var v = null, g = null;
      if (c = c.firstBaseUpdate, c !== null) {
        do {
          var C = { eventTime: c.eventTime, lane: c.lane, tag: c.tag, payload: c.payload, callback: c.callback, next: null };
          g === null ? v = g = C : g = g.next = C, c = c.next;
        } while (c !== null);
        g === null ? v = g = l : g = g.next = l;
      } else v = g = l;
      c = { baseState: p.baseState, firstBaseUpdate: v, lastBaseUpdate: g, shared: p.shared, effects: p.effects }, a.updateQueue = c;
      return;
    }
    a = c.lastBaseUpdate, a === null ? c.firstBaseUpdate = l : a.next = l, c.lastBaseUpdate = l;
  }
  function El(a, l, c, p) {
    var v = a.updateQueue;
    Qn = !1;
    var g = v.firstBaseUpdate, C = v.lastBaseUpdate, x = v.shared.pending;
    if (x !== null) {
      v.shared.pending = null;
      var S = x, A = S.next;
      S.next = null, C === null ? g = A : C.next = A, C = S;
      var z = a.alternate;
      z !== null && (z = z.updateQueue, x = z.lastBaseUpdate, x !== C && (x === null ? z.firstBaseUpdate = A : x.next = A, z.lastBaseUpdate = S));
    }
    if (g !== null) {
      var $ = v.baseState;
      C = 0, z = A = S = null, x = g;
      do {
        var H = x.lane, J = x.eventTime;
        if ((p & H) === H) {
          z !== null && (z = z.next = {
            eventTime: J,
            lane: 0,
            tag: x.tag,
            payload: x.payload,
            callback: x.callback,
            next: null
          });
          e: {
            var ee = a, te = x;
            switch (H = l, J = c, te.tag) {
              case 1:
                if (ee = te.payload, typeof ee == "function") {
                  $ = ee.call(J, $, H);
                  break e;
                }
                $ = ee;
                break e;
              case 3:
                ee.flags = ee.flags & -65537 | 128;
              case 0:
                if (ee = te.payload, H = typeof ee == "function" ? ee.call(J, $, H) : ee, H == null) break e;
                $ = X({}, $, H);
                break e;
              case 2:
                Qn = !0;
            }
          }
          x.callback !== null && x.lane !== 0 && (a.flags |= 64, H = v.effects, H === null ? v.effects = [x] : H.push(x));
        } else J = { eventTime: J, lane: H, tag: x.tag, payload: x.payload, callback: x.callback, next: null }, z === null ? (A = z = J, S = $) : z = z.next = J, C |= H;
        if (x = x.next, x === null) {
          if (x = v.shared.pending, x === null) break;
          H = x, x = H.next, H.next = null, v.lastBaseUpdate = H, v.shared.pending = null;
        }
      } while (!0);
      if (z === null && (S = $), v.baseState = S, v.firstBaseUpdate = A, v.lastBaseUpdate = z, l = v.shared.interleaved, l !== null) {
        v = l;
        do
          C |= v.lane, v = v.next;
        while (v !== l);
      } else g === null && (v.shared.lanes = 0);
      zi |= C, a.lanes = C, a.memoizedState = $;
    }
  }
  function Uv(a, l, c) {
    if (a = l.effects, l.effects = null, a !== null) for (l = 0; l < a.length; l++) {
      var p = a[l], v = p.callback;
      if (v !== null) {
        if (p.callback = null, p = c, typeof v != "function") throw Error(t(191, v));
        v.call(p);
      }
    }
  }
  var Ja = {}, Wr = Wn(Ja), Xa = Wn(Ja), Ya = Wn(Ja);
  function Hi(a) {
    if (a === Ja) throw Error(t(174));
    return a;
  }
  function mf(a, l) {
    switch (Ie(Ya, l), Ie(Xa, a), Ie(Wr, Ja), a = l.nodeType, a) {
      case 9:
      case 11:
        l = (l = l.documentElement) ? l.namespaceURI : Mi(null, "");
        break;
      default:
        a = a === 8 ? l.parentNode : l, l = a.namespaceURI || null, a = a.tagName, l = Mi(l, a);
    }
    Be(Wr), Ie(Wr, l);
  }
  function Vo() {
    Be(Wr), Be(Xa), Be(Ya);
  }
  function jv(a) {
    Hi(Ya.current);
    var l = Hi(Wr.current), c = Mi(l, a.type);
    l !== c && (Ie(Xa, a), Ie(Wr, c));
  }
  function gf(a) {
    Xa.current === a && (Be(Wr), Be(Xa));
  }
  var Ve = Wn(0);
  function Ml(a) {
    for (var l = a; 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 === a) break;
      for (; l.sibling === null; ) {
        if (l.return === null || l.return === a) return null;
        l = l.return;
      }
      l.sibling.return = l.return, l = l.sibling;
    }
    return null;
  }
  var yf = [];
  function wf() {
    for (var a = 0; a < yf.length; a++) yf[a]._workInProgressVersionPrimary = null;
    yf.length = 0;
  }
  var Ol = _.ReactCurrentDispatcher, kf = _.ReactCurrentBatchConfig, Fi = 0, qe = null, rt = null, ct = null, Nl = !1, Za = !1, es = 0, cT = 0;
  function Nt() {
    throw Error(t(321));
  }
  function Cf(a, l) {
    if (l === null) return !1;
    for (var c = 0; c < l.length && c < a.length; c++) if (!Or(a[c], l[c])) return !1;
    return !0;
  }
  function bf(a, l, c, p, v, g) {
    if (Fi = g, qe = l, l.memoizedState = null, l.updateQueue = null, l.lanes = 0, Ol.current = a === null || a.memoizedState === null ? hT : vT, a = c(p, v), Za) {
      g = 0;
      do {
        if (Za = !1, es = 0, 25 <= g) throw Error(t(301));
        g += 1, ct = rt = null, l.updateQueue = null, Ol.current = mT, a = c(p, v);
      } while (Za);
    }
    if (Ol.current = Al, l = rt !== null && rt.next !== null, Fi = 0, ct = rt = qe = null, Nl = !1, l) throw Error(t(300));
    return a;
  }
  function Tf() {
    var a = es !== 0;
    return es = 0, a;
  }
  function Gr() {
    var a = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null };
    return ct === null ? qe.memoizedState = ct = a : ct = ct.next = a, ct;
  }
  function gr() {
    if (rt === null) {
      var a = qe.alternate;
      a = a !== null ? a.memoizedState : null;
    } else a = rt.next;
    var l = ct === null ? qe.memoizedState : ct.next;
    if (l !== null) ct = l, rt = a;
    else {
      if (a === null) throw Error(t(310));
      rt = a, a = { memoizedState: rt.memoizedState, baseState: rt.baseState, baseQueue: rt.baseQueue, queue: rt.queue, next: null }, ct === null ? qe.memoizedState = ct = a : ct = ct.next = a;
    }
    return ct;
  }
  function ts(a, l) {
    return typeof l == "function" ? l(a) : l;
  }
  function xf(a) {
    var l = gr(), c = l.queue;
    if (c === null) throw Error(t(311));
    c.lastRenderedReducer = a;
    var p = rt, v = p.baseQueue, g = c.pending;
    if (g !== null) {
      if (v !== null) {
        var C = v.next;
        v.next = g.next, g.next = C;
      }
      p.baseQueue = v = g, c.pending = null;
    }
    if (v !== null) {
      g = v.next, p = p.baseState;
      var x = C = null, S = null, A = g;
      do {
        var z = A.lane;
        if ((Fi & z) === z) S !== null && (S = S.next = { lane: 0, action: A.action, hasEagerState: A.hasEagerState, eagerState: A.eagerState, next: null }), p = A.hasEagerState ? A.eagerState : a(p, A.action);
        else {
          var $ = {
            lane: z,
            action: A.action,
            hasEagerState: A.hasEagerState,
            eagerState: A.eagerState,
            next: null
          };
          S === null ? (x = S = $, C = p) : S = S.next = $, qe.lanes |= z, zi |= z;
        }
        A = A.next;
      } while (A !== null && A !== g);
      S === null ? C = p : S.next = x, Or(p, l.memoizedState) || (Qt = !0), l.memoizedState = p, l.baseState = C, l.baseQueue = S, c.lastRenderedState = p;
    }
    if (a = c.interleaved, a !== null) {
      v = a;
      do
        g = v.lane, qe.lanes |= g, zi |= g, v = v.next;
      while (v !== a);
    } else v === null && (c.lanes = 0);
    return [l.memoizedState, c.dispatch];
  }
  function Sf(a) {
    var l = gr(), c = l.queue;
    if (c === null) throw Error(t(311));
    c.lastRenderedReducer = a;
    var p = c.dispatch, v = c.pending, g = l.memoizedState;
    if (v !== null) {
      c.pending = null;
      var C = v = v.next;
      do
        g = a(g, C.action), C = C.next;
      while (C !== v);
      Or(g, l.memoizedState) || (Qt = !0), l.memoizedState = g, l.baseQueue === null && (l.baseState = g), c.lastRenderedState = g;
    }
    return [g, p];
  }
  function Wv() {
  }
  function Gv(a, l) {
    var c = qe, p = gr(), v = l(), g = !Or(p.memoizedState, v);
    if (g && (p.memoizedState = v, Qt = !0), p = p.queue, Ef(Jv.bind(null, c, p, a), [a]), p.getSnapshot !== l || g || ct !== null && ct.memoizedState.tag & 1) {
      if (c.flags |= 2048, rs(9, Qv.bind(null, c, p, v, l), void 0, null), ft === null) throw Error(t(349));
      (Fi & 30) !== 0 || Kv(c, l, v);
    }
    return v;
  }
  function Kv(a, l, c) {
    a.flags |= 16384, a = { getSnapshot: l, value: c }, l = qe.updateQueue, l === null ? (l = { lastEffect: null, stores: null }, qe.updateQueue = l, l.stores = [a]) : (c = l.stores, c === null ? l.stores = [a] : c.push(a));
  }
  function Qv(a, l, c, p) {
    l.value = c, l.getSnapshot = p, Xv(l) && Yv(a);
  }
  function Jv(a, l, c) {
    return c(function() {
      Xv(l) && Yv(a);
    });
  }
  function Xv(a) {
    var l = a.getSnapshot;
    a = a.value;
    try {
      var c = l();
      return !Or(a, c);
    } catch {
      return !0;
    }
  }
  function Yv(a) {
    var l = wn(a, 1);
    l !== null && Ir(l, a, 1, -1);
  }
  function Zv(a) {
    var l = Gr();
    return typeof a == "function" && (a = a()), l.memoizedState = l.baseState = a, a = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: ts, lastRenderedState: a }, l.queue = a, a = a.dispatch = pT.bind(null, qe, a), [l.memoizedState, a];
  }
  function rs(a, l, c, p) {
    return a = { tag: a, create: l, destroy: c, deps: p, next: null }, l = qe.updateQueue, l === null ? (l = { lastEffect: null, stores: null }, qe.updateQueue = l, l.lastEffect = a.next = a) : (c = l.lastEffect, c === null ? l.lastEffect = a.next = a : (p = c.next, c.next = a, a.next = p, l.lastEffect = a)), a;
  }
  function em() {
    return gr().memoizedState;
  }
  function Ll(a, l, c, p) {
    var v = Gr();
    qe.flags |= a, v.memoizedState = rs(1 | l, c, void 0, p === void 0 ? null : p);
  }
  function Dl(a, l, c, p) {
    var v = gr();
    p = p === void 0 ? null : p;
    var g = void 0;
    if (rt !== null) {
      var C = rt.memoizedState;
      if (g = C.destroy, p !== null && Cf(p, C.deps)) {
        v.memoizedState = rs(l, c, g, p);
        return;
      }
    }
    qe.flags |= a, v.memoizedState = rs(1 | l, c, g, p);
  }
  function tm(a, l) {
    return Ll(8390656, 8, a, l);
  }
  function Ef(a, l) {
    return Dl(2048, 8, a, l);
  }
  function rm(a, l) {
    return Dl(4, 2, a, l);
  }
  function nm(a, l) {
    return Dl(4, 4, a, l);
  }
  function im(a, l) {
    if (typeof l == "function") return a = a(), l(a), function() {
      l(null);
    };
    if (l != null) return a = a(), l.current = a, function() {
      l.current = null;
    };
  }
  function om(a, l, c) {
    return c = c != null ? c.concat([a]) : null, Dl(4, 4, im.bind(null, l, a), c);
  }
  function Mf() {
  }
  function am(a, l) {
    var c = gr();
    l = l === void 0 ? null : l;
    var p = c.memoizedState;
    return p !== null && l !== null && Cf(l, p[1]) ? p[0] : (c.memoizedState = [a, l], a);
  }
  function sm(a, l) {
    var c = gr();
    l = l === void 0 ? null : l;
    var p = c.memoizedState;
    return p !== null && l !== null && Cf(l, p[1]) ? p[0] : (a = a(), c.memoizedState = [a, l], a);
  }
  function lm(a, l, c) {
    return (Fi & 21) === 0 ? (a.baseState && (a.baseState = !1, Qt = !0), a.memoizedState = c) : (Or(c, l) || (c = Hh(), qe.lanes |= c, zi |= c, a.baseState = !0), l);
  }
  function fT(a, l) {
    var c = De;
    De = c !== 0 && 4 > c ? c : 4, a(!0);
    var p = kf.transition;
    kf.transition = {};
    try {
      a(!1), l();
    } finally {
      De = c, kf.transition = p;
    }
  }
  function um() {
    return gr().memoizedState;
  }
  function dT(a, l, c) {
    var p = ei(a);
    if (c = { lane: p, action: c, hasEagerState: !1, eagerState: null, next: null }, cm(a)) fm(l, c);
    else if (c = Vv(a, l, c, p), c !== null) {
      var v = zt();
      Ir(c, a, p, v), dm(c, l, p);
    }
  }
  function pT(a, l, c) {
    var p = ei(a), v = { lane: p, action: c, hasEagerState: !1, eagerState: null, next: null };
    if (cm(a)) fm(l, v);
    else {
      var g = a.alternate;
      if (a.lanes === 0 && (g === null || g.lanes === 0) && (g = l.lastRenderedReducer, g !== null)) try {
        var C = l.lastRenderedState, x = g(C, c);
        if (v.hasEagerState = !0, v.eagerState = x, Or(x, C)) {
          var S = l.interleaved;
          S === null ? (v.next = v, hf(l)) : (v.next = S.next, S.next = v), l.interleaved = v;
          return;
        }
      } catch {
      }
      c = Vv(a, l, v, p), c !== null && (v = zt(), Ir(c, a, p, v), dm(c, l, p));
    }
  }
  function cm(a) {
    var l = a.alternate;
    return a === qe || l !== null && l === qe;
  }
  function fm(a, l) {
    Za = Nl = !0;
    var c = a.pending;
    c === null ? l.next = l : (l.next = c.next, c.next = l), a.pending = l;
  }
  function dm(a, l, c) {
    if ((c & 4194240) !== 0) {
      var p = l.lanes;
      p &= a.pendingLanes, c |= p, l.lanes = c, Oc(a, c);
    }
  }
  var Al = { readContext: mr, useCallback: Nt, useContext: Nt, useEffect: Nt, useImperativeHandle: Nt, useInsertionEffect: Nt, useLayoutEffect: Nt, useMemo: Nt, useReducer: Nt, useRef: Nt, useState: Nt, useDebugValue: Nt, useDeferredValue: Nt, useTransition: Nt, useMutableSource: Nt, useSyncExternalStore: Nt, useId: Nt, unstable_isNewReconciler: !1 }, hT = { readContext: mr, useCallback: function(a, l) {
    return Gr().memoizedState = [a, l === void 0 ? null : l], a;
  }, useContext: mr, useEffect: tm, useImperativeHandle: function(a, l, c) {
    return c = c != null ? c.concat([a]) : null, Ll(
      4194308,
      4,
      im.bind(null, l, a),
      c
    );
  }, useLayoutEffect: function(a, l) {
    return Ll(4194308, 4, a, l);
  }, useInsertionEffect: function(a, l) {
    return Ll(4, 2, a, l);
  }, useMemo: function(a, l) {
    var c = Gr();
    return l = l === void 0 ? null : l, a = a(), c.memoizedState = [a, l], a;
  }, useReducer: function(a, l, c) {
    var p = Gr();
    return l = c !== void 0 ? c(l) : l, p.memoizedState = p.baseState = l, a = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: a, lastRenderedState: l }, p.queue = a, a = a.dispatch = dT.bind(null, qe, a), [p.memoizedState, a];
  }, useRef: function(a) {
    var l = Gr();
    return a = { current: a }, l.memoizedState = a;
  }, useState: Zv, useDebugValue: Mf, useDeferredValue: function(a) {
    return Gr().memoizedState = a;
  }, useTransition: function() {
    var a = Zv(!1), l = a[0];
    return a = fT.bind(null, a[1]), Gr().memoizedState = a, [l, a];
  }, useMutableSource: function() {
  }, useSyncExternalStore: function(a, l, c) {
    var p = qe, v = Gr();
    if (He) {
      if (c === void 0) throw Error(t(407));
      c = c();
    } else {
      if (c = l(), ft === null) throw Error(t(349));
      (Fi & 30) !== 0 || Kv(p, l, c);
    }
    v.memoizedState = c;
    var g = { value: c, getSnapshot: l };
    return v.queue = g, tm(Jv.bind(
      null,
      p,
      g,
      a
    ), [a]), p.flags |= 2048, rs(9, Qv.bind(null, p, g, c, l), void 0, null), c;
  }, useId: function() {
    var a = Gr(), l = ft.identifierPrefix;
    if (He) {
      var c = yn, p = gn;
      c = (p & ~(1 << 32 - Mr(p) - 1)).toString(32) + c, l = ":" + l + "R" + c, c = es++, 0 < c && (l += "H" + c.toString(32)), l += ":";
    } else c = cT++, l = ":" + l + "r" + c.toString(32) + ":";
    return a.memoizedState = l;
  }, unstable_isNewReconciler: !1 }, vT = {
    readContext: mr,
    useCallback: am,
    useContext: mr,
    useEffect: Ef,
    useImperativeHandle: om,
    useInsertionEffect: rm,
    useLayoutEffect: nm,
    useMemo: sm,
    useReducer: xf,
    useRef: em,
    useState: function() {
      return xf(ts);
    },
    useDebugValue: Mf,
    useDeferredValue: function(a) {
      var l = gr();
      return lm(l, rt.memoizedState, a);
    },
    useTransition: function() {
      var a = xf(ts)[0], l = gr().memoizedState;
      return [a, l];
    },
    useMutableSource: Wv,
    useSyncExternalStore: Gv,
    useId: um,
    unstable_isNewReconciler: !1
  }, mT = { readContext: mr, useCallback: am, useContext: mr, useEffect: Ef, useImperativeHandle: om, useInsertionEffect: rm, useLayoutEffect: nm, useMemo: sm, useReducer: Sf, useRef: em, useState: function() {
    return Sf(ts);
  }, useDebugValue: Mf, useDeferredValue: function(a) {
    var l = gr();
    return rt === null ? l.memoizedState = a : lm(l, rt.memoizedState, a);
  }, useTransition: function() {
    var a = Sf(ts)[0], l = gr().memoizedState;
    return [a, l];
  }, useMutableSource: Wv, useSyncExternalStore: Gv, useId: um, unstable_isNewReconciler: !1 };
  function Lr(a, l) {
    if (a && a.defaultProps) {
      l = X({}, l), a = a.defaultProps;
      for (var c in a) l[c] === void 0 && (l[c] = a[c]);
      return l;
    }
    return l;
  }
  function Of(a, l, c, p) {
    l = a.memoizedState, c = c(p, l), c = c == null ? l : X({}, l, c), a.memoizedState = c, a.lanes === 0 && (a.updateQueue.baseState = c);
  }
  var Il = { isMounted: function(a) {
    return (a = a._reactInternals) ? ye(a) === a : !1;
  }, enqueueSetState: function(a, l, c) {
    a = a._reactInternals;
    var p = zt(), v = ei(a), g = kn(p, v);
    g.payload = l, c != null && (g.callback = c), l = Jn(a, g, v), l !== null && (Ir(l, a, v, p), Sl(l, a, v));
  }, enqueueReplaceState: function(a, l, c) {
    a = a._reactInternals;
    var p = zt(), v = ei(a), g = kn(p, v);
    g.tag = 1, g.payload = l, c != null && (g.callback = c), l = Jn(a, g, v), l !== null && (Ir(l, a, v, p), Sl(l, a, v));
  }, enqueueForceUpdate: function(a, l) {
    a = a._reactInternals;
    var c = zt(), p = ei(a), v = kn(c, p);
    v.tag = 2, l != null && (v.callback = l), l = Jn(a, v, p), l !== null && (Ir(l, a, p, c), Sl(l, a, p));
  } };
  function pm(a, l, c, p, v, g, C) {
    return a = a.stateNode, typeof a.shouldComponentUpdate == "function" ? a.shouldComponentUpdate(p, g, C) : l.prototype && l.prototype.isPureReactComponent ? !qa(c, p) || !qa(v, g) : !0;
  }
  function hm(a, l, c) {
    var p = !1, v = Gn, g = l.contextType;
    return typeof g == "object" && g !== null ? g = mr(g) : (v = Kt(l) ? Ri : Ot.current, p = l.contextTypes, g = (p = p != null) ? Ro(a, v) : Gn), l = new l(c, g), a.memoizedState = l.state !== null && l.state !== void 0 ? l.state : null, l.updater = Il, a.stateNode = l, l._reactInternals = a, p && (a = a.stateNode, a.__reactInternalMemoizedUnmaskedChildContext = v, a.__reactInternalMemoizedMaskedChildContext = g), l;
  }
  function vm(a, l, c, p) {
    a = l.state, typeof l.componentWillReceiveProps == "function" && l.componentWillReceiveProps(c, p), typeof l.UNSAFE_componentWillReceiveProps == "function" && l.UNSAFE_componentWillReceiveProps(c, p), l.state !== a && Il.enqueueReplaceState(l, l.state, null);
  }
  function Nf(a, l, c, p) {
    var v = a.stateNode;
    v.props = c, v.state = a.memoizedState, v.refs = {}, vf(a);
    var g = l.contextType;
    typeof g == "object" && g !== null ? v.context = mr(g) : (g = Kt(l) ? Ri : Ot.current, v.context = Ro(a, g)), v.state = a.memoizedState, g = l.getDerivedStateFromProps, typeof g == "function" && (Of(a, l, g, c), v.state = a.memoizedState), typeof l.getDerivedStateFromProps == "function" || typeof v.getSnapshotBeforeUpdate == "function" || typeof v.UNSAFE_componentWillMount != "function" && typeof v.componentWillMount != "function" || (l = v.state, typeof v.componentWillMount == "function" && v.componentWillMount(), typeof v.UNSAFE_componentWillMount == "function" && v.UNSAFE_componentWillMount(), l !== v.state && Il.enqueueReplaceState(v, v.state, null), El(a, c, v, p), v.state = a.memoizedState), typeof v.componentDidMount == "function" && (a.flags |= 4194308);
  }
  function qo(a, l) {
    try {
      var c = "", p = l;
      do
        c += we(p), p = p.return;
      while (p);
      var v = c;
    } catch (g) {
      v = `
Error generating stack: ` + g.message + `
` + g.stack;
    }
    return { value: a, source: l, stack: v, digest: null };
  }
  function Lf(a, l, c) {
    return { value: a, source: null, stack: c ?? null, digest: l ?? null };
  }
  function Df(a, l) {
    try {
      console.error(l.value);
    } catch (c) {
      setTimeout(function() {
        throw c;
      });
    }
  }
  var gT = typeof WeakMap == "function" ? WeakMap : Map;
  function mm(a, l, c) {
    c = kn(-1, c), c.tag = 3, c.payload = { element: null };
    var p = l.value;
    return c.callback = function() {
      zl || (zl = !0, Wf = p), Df(a, l);
    }, c;
  }
  function gm(a, l, c) {
    c = kn(-1, c), c.tag = 3;
    var p = a.type.getDerivedStateFromError;
    if (typeof p == "function") {
      var v = l.value;
      c.payload = function() {
        return p(v);
      }, c.callback = function() {
        Df(a, l);
      };
    }
    var g = a.stateNode;
    return g !== null && typeof g.componentDidCatch == "function" && (c.callback = function() {
      Df(a, l), typeof p != "function" && (Yn === null ? Yn = /* @__PURE__ */ new Set([this]) : Yn.add(this));
      var C = l.stack;
      this.componentDidCatch(l.value, { componentStack: C !== null ? C : "" });
    }), c;
  }
  function ym(a, l, c) {
    var p = a.pingCache;
    if (p === null) {
      p = a.pingCache = new gT();
      var v = /* @__PURE__ */ new Set();
      p.set(l, v);
    } else v = p.get(l), v === void 0 && (v = /* @__PURE__ */ new Set(), p.set(l, v));
    v.has(c) || (v.add(c), a = DT.bind(null, a, l, c), l.then(a, a));
  }
  function wm(a) {
    do {
      var l;
      if ((l = a.tag === 13) && (l = a.memoizedState, l = l !== null ? l.dehydrated !== null : !0), l) return a;
      a = a.return;
    } while (a !== null);
    return null;
  }
  function km(a, l, c, p, v) {
    return (a.mode & 1) === 0 ? (a === l ? a.flags |= 65536 : (a.flags |= 128, c.flags |= 131072, c.flags &= -52805, c.tag === 1 && (c.alternate === null ? c.tag = 17 : (l = kn(-1, 1), l.tag = 2, Jn(c, l, 1))), c.lanes |= 1), a) : (a.flags |= 65536, a.lanes = v, a);
  }
  var yT = _.ReactCurrentOwner, Qt = !1;
  function Ft(a, l, c, p) {
    l.child = a === null ? zv(l, null, c, p) : Ho(l, a.child, c, p);
  }
  function Cm(a, l, c, p, v) {
    c = c.render;
    var g = l.ref;
    return zo(l, v), p = bf(a, l, c, p, g, v), c = Tf(), a !== null && !Qt ? (l.updateQueue = a.updateQueue, l.flags &= -2053, a.lanes &= ~v, Cn(a, l, v)) : (He && c && of(l), l.flags |= 1, Ft(a, l, p, v), l.child);
  }
  function bm(a, l, c, p, v) {
    if (a === null) {
      var g = c.type;
      return typeof g == "function" && !Zf(g) && g.defaultProps === void 0 && c.compare === null && c.defaultProps === void 0 ? (l.tag = 15, l.type = g, Tm(a, l, g, p, v)) : (a = Wl(c.type, null, p, l, l.mode, v), a.ref = l.ref, a.return = l, l.child = a);
    }
    if (g = a.child, (a.lanes & v) === 0) {
      var C = g.memoizedProps;
      if (c = c.compare, c = c !== null ? c : qa, c(C, p) && a.ref === l.ref) return Cn(a, l, v);
    }
    return l.flags |= 1, a = ri(g, p), a.ref = l.ref, a.return = l, l.child = a;
  }
  function Tm(a, l, c, p, v) {
    if (a !== null) {
      var g = a.memoizedProps;
      if (qa(g, p) && a.ref === l.ref) if (Qt = !1, l.pendingProps = p = g, (a.lanes & v) !== 0) (a.flags & 131072) !== 0 && (Qt = !0);
      else return l.lanes = a.lanes, Cn(a, l, v);
    }
    return Af(a, l, c, p, v);
  }
  function xm(a, l, c) {
    var p = l.pendingProps, v = p.children, g = a !== null ? a.memoizedState : null;
    if (p.mode === "hidden") if ((l.mode & 1) === 0) l.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, Ie(Uo, sr), sr |= c;
    else {
      if ((c & 1073741824) === 0) return a = g !== null ? g.baseLanes | c : c, l.lanes = l.childLanes = 1073741824, l.memoizedState = { baseLanes: a, cachePool: null, transitions: null }, l.updateQueue = null, Ie(Uo, sr), sr |= a, null;
      l.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, p = g !== null ? g.baseLanes : c, Ie(Uo, sr), sr |= p;
    }
    else g !== null ? (p = g.baseLanes | c, l.memoizedState = null) : p = c, Ie(Uo, sr), sr |= p;
    return Ft(a, l, v, c), l.child;
  }
  function Sm(a, l) {
    var c = l.ref;
    (a === null && c !== null || a !== null && a.ref !== c) && (l.flags |= 512, l.flags |= 2097152);
  }
  function Af(a, l, c, p, v) {
    var g = Kt(c) ? Ri : Ot.current;
    return g = Ro(l, g), zo(l, v), c = bf(a, l, c, p, g, v), p = Tf(), a !== null && !Qt ? (l.updateQueue = a.updateQueue, l.flags &= -2053, a.lanes &= ~v, Cn(a, l, v)) : (He && p && of(l), l.flags |= 1, Ft(a, l, c, v), l.child);
  }
  function Em(a, l, c, p, v) {
    if (Kt(c)) {
      var g = !0;
      gl(l);
    } else g = !1;
    if (zo(l, v), l.stateNode === null) Pl(a, l), hm(l, c, p), Nf(l, c, p, v), p = !0;
    else if (a === null) {
      var C = l.stateNode, x = l.memoizedProps;
      C.props = x;
      var S = C.context, A = c.contextType;
      typeof A == "object" && A !== null ? A = mr(A) : (A = Kt(c) ? Ri : Ot.current, A = Ro(l, A));
      var z = c.getDerivedStateFromProps, $ = typeof z == "function" || typeof C.getSnapshotBeforeUpdate == "function";
      $ || typeof C.UNSAFE_componentWillReceiveProps != "function" && typeof C.componentWillReceiveProps != "function" || (x !== p || S !== A) && vm(l, C, p, A), Qn = !1;
      var H = l.memoizedState;
      C.state = H, El(l, p, C, v), S = l.memoizedState, x !== p || H !== S || Gt.current || Qn ? (typeof z == "function" && (Of(l, c, z, p), S = l.memoizedState), (x = Qn || pm(l, c, x, p, H, S, A)) ? ($ || typeof C.UNSAFE_componentWillMount != "function" && typeof C.componentWillMount != "function" || (typeof C.componentWillMount == "function" && C.componentWillMount(), typeof C.UNSAFE_componentWillMount == "function" && C.UNSAFE_componentWillMount()), typeof C.componentDidMount == "function" && (l.flags |= 4194308)) : (typeof C.componentDidMount == "function" && (l.flags |= 4194308), l.memoizedProps = p, l.memoizedState = S), C.props = p, C.state = S, C.context = A, p = x) : (typeof C.componentDidMount == "function" && (l.flags |= 4194308), p = !1);
    } else {
      C = l.stateNode, qv(a, l), x = l.memoizedProps, A = l.type === l.elementType ? x : Lr(l.type, x), C.props = A, $ = l.pendingProps, H = C.context, S = c.contextType, typeof S == "object" && S !== null ? S = mr(S) : (S = Kt(c) ? Ri : Ot.current, S = Ro(l, S));
      var J = c.getDerivedStateFromProps;
      (z = typeof J == "function" || typeof C.getSnapshotBeforeUpdate == "function") || typeof C.UNSAFE_componentWillReceiveProps != "function" && typeof C.componentWillReceiveProps != "function" || (x !== $ || H !== S) && vm(l, C, p, S), Qn = !1, H = l.memoizedState, C.state = H, El(l, p, C, v);
      var ee = l.memoizedState;
      x !== $ || H !== ee || Gt.current || Qn ? (typeof J == "function" && (Of(l, c, J, p), ee = l.memoizedState), (A = Qn || pm(l, c, A, p, H, ee, S) || !1) ? (z || typeof C.UNSAFE_componentWillUpdate != "function" && typeof C.componentWillUpdate != "function" || (typeof C.componentWillUpdate == "function" && C.componentWillUpdate(p, ee, S), typeof C.UNSAFE_componentWillUpdate == "function" && C.UNSAFE_componentWillUpdate(p, ee, S)), typeof C.componentDidUpdate == "function" && (l.flags |= 4), typeof C.getSnapshotBeforeUpdate == "function" && (l.flags |= 1024)) : (typeof C.componentDidUpdate != "function" || x === a.memoizedProps && H === a.memoizedState || (l.flags |= 4), typeof C.getSnapshotBeforeUpdate != "function" || x === a.memoizedProps && H === a.memoizedState || (l.flags |= 1024), l.memoizedProps = p, l.memoizedState = ee), C.props = p, C.state = ee, C.context = S, p = A) : (typeof C.componentDidUpdate != "function" || x === a.memoizedProps && H === a.memoizedState || (l.flags |= 4), typeof C.getSnapshotBeforeUpdate != "function" || x === a.memoizedProps && H === a.memoizedState || (l.flags |= 1024), p = !1);
    }
    return If(a, l, c, p, g, v);
  }
  function If(a, l, c, p, v, g) {
    Sm(a, l);
    var C = (l.flags & 128) !== 0;
    if (!p && !C) return v && Dv(l, c, !1), Cn(a, l, g);
    p = l.stateNode, yT.current = l;
    var x = C && typeof c.getDerivedStateFromError != "function" ? null : p.render();
    return l.flags |= 1, a !== null && C ? (l.child = Ho(l, a.child, null, g), l.child = Ho(l, null, x, g)) : Ft(a, l, x, g), l.memoizedState = p.state, v && Dv(l, c, !0), l.child;
  }
  function Mm(a) {
    var l = a.stateNode;
    l.pendingContext ? Nv(a, l.pendingContext, l.pendingContext !== l.context) : l.context && Nv(a, l.context, !1), mf(a, l.containerInfo);
  }
  function Om(a, l, c, p, v) {
    return _o(), uf(v), l.flags |= 256, Ft(a, l, c, p), l.child;
  }
  var Rf = { dehydrated: null, treeContext: null, retryLane: 0 };
  function Pf(a) {
    return { baseLanes: a, cachePool: null, transitions: null };
  }
  function Nm(a, l, c) {
    var p = l.pendingProps, v = Ve.current, g = !1, C = (l.flags & 128) !== 0, x;
    if ((x = C) || (x = a !== null && a.memoizedState === null ? !1 : (v & 2) !== 0), x ? (g = !0, l.flags &= -129) : (a === null || a.memoizedState !== null) && (v |= 1), Ie(Ve, v & 1), a === null)
      return lf(l), a = l.memoizedState, a !== null && (a = a.dehydrated, a !== null) ? ((l.mode & 1) === 0 ? l.lanes = 1 : a.data === "$!" ? l.lanes = 8 : l.lanes = 1073741824, null) : (C = p.children, a = p.fallback, g ? (p = l.mode, g = l.child, C = { mode: "hidden", children: C }, (p & 1) === 0 && g !== null ? (g.childLanes = 0, g.pendingProps = C) : g = Gl(C, p, 0, null), a = Ui(a, p, c, null), g.return = l, a.return = l, g.sibling = a, l.child = g, l.child.memoizedState = Pf(c), l.memoizedState = Rf, a) : Bf(l, C));
    if (v = a.memoizedState, v !== null && (x = v.dehydrated, x !== null)) return wT(a, l, C, p, x, v, c);
    if (g) {
      g = p.fallback, C = l.mode, v = a.child, x = v.sibling;
      var S = { mode: "hidden", children: p.children };
      return (C & 1) === 0 && l.child !== v ? (p = l.child, p.childLanes = 0, p.pendingProps = S, l.deletions = null) : (p = ri(v, S), p.subtreeFlags = v.subtreeFlags & 14680064), x !== null ? g = ri(x, g) : (g = Ui(g, C, c, null), g.flags |= 2), g.return = l, p.return = l, p.sibling = g, l.child = p, p = g, g = l.child, C = a.child.memoizedState, C = C === null ? Pf(c) : { baseLanes: C.baseLanes | c, cachePool: null, transitions: C.transitions }, g.memoizedState = C, g.childLanes = a.childLanes & ~c, l.memoizedState = Rf, p;
    }
    return g = a.child, a = g.sibling, p = ri(g, { mode: "visible", children: p.children }), (l.mode & 1) === 0 && (p.lanes = c), p.return = l, p.sibling = null, a !== null && (c = l.deletions, c === null ? (l.deletions = [a], l.flags |= 16) : c.push(a)), l.child = p, l.memoizedState = null, p;
  }
  function Bf(a, l) {
    return l = Gl({ mode: "visible", children: l }, a.mode, 0, null), l.return = a, a.child = l;
  }
  function Rl(a, l, c, p) {
    return p !== null && uf(p), Ho(l, a.child, null, c), a = Bf(l, l.pendingProps.children), a.flags |= 2, l.memoizedState = null, a;
  }
  function wT(a, l, c, p, v, g, C) {
    if (c)
      return l.flags & 256 ? (l.flags &= -257, p = Lf(Error(t(422))), Rl(a, l, C, p)) : l.memoizedState !== null ? (l.child = a.child, l.flags |= 128, null) : (g = p.fallback, v = l.mode, p = Gl({ mode: "visible", children: p.children }, v, 0, null), g = Ui(g, v, C, null), g.flags |= 2, p.return = l, g.return = l, p.sibling = g, l.child = p, (l.mode & 1) !== 0 && Ho(l, a.child, null, C), l.child.memoizedState = Pf(C), l.memoizedState = Rf, g);
    if ((l.mode & 1) === 0) return Rl(a, l, C, null);
    if (v.data === "$!") {
      if (p = v.nextSibling && v.nextSibling.dataset, p) var x = p.dgst;
      return p = x, g = Error(t(419)), p = Lf(g, p, void 0), Rl(a, l, C, p);
    }
    if (x = (C & a.childLanes) !== 0, Qt || x) {
      if (p = ft, p !== null) {
        switch (C & -C) {
          case 4:
            v = 2;
            break;
          case 16:
            v = 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:
            v = 32;
            break;
          case 536870912:
            v = 268435456;
            break;
          default:
            v = 0;
        }
        v = (v & (p.suspendedLanes | C)) !== 0 ? 0 : v, v !== 0 && v !== g.retryLane && (g.retryLane = v, wn(a, v), Ir(p, a, v, -1));
      }
      return Yf(), p = Lf(Error(t(421))), Rl(a, l, C, p);
    }
    return v.data === "$?" ? (l.flags |= 128, l.child = a.child, l = AT.bind(null, a), v._reactRetry = l, null) : (a = g.treeContext, ar = jn(v.nextSibling), or = l, He = !0, Nr = null, a !== null && (hr[vr++] = gn, hr[vr++] = yn, hr[vr++] = Pi, gn = a.id, yn = a.overflow, Pi = l), l = Bf(l, p.children), l.flags |= 4096, l);
  }
  function Lm(a, l, c) {
    a.lanes |= l;
    var p = a.alternate;
    p !== null && (p.lanes |= l), pf(a.return, l, c);
  }
  function _f(a, l, c, p, v) {
    var g = a.memoizedState;
    g === null ? a.memoizedState = { isBackwards: l, rendering: null, renderingStartTime: 0, last: p, tail: c, tailMode: v } : (g.isBackwards = l, g.rendering = null, g.renderingStartTime = 0, g.last = p, g.tail = c, g.tailMode = v);
  }
  function Dm(a, l, c) {
    var p = l.pendingProps, v = p.revealOrder, g = p.tail;
    if (Ft(a, l, p.children, c), p = Ve.current, (p & 2) !== 0) p = p & 1 | 2, l.flags |= 128;
    else {
      if (a !== null && (a.flags & 128) !== 0) e: for (a = l.child; a !== null; ) {
        if (a.tag === 13) a.memoizedState !== null && Lm(a, c, l);
        else if (a.tag === 19) Lm(a, c, l);
        else if (a.child !== null) {
          a.child.return = a, a = a.child;
          continue;
        }
        if (a === l) break e;
        for (; a.sibling === null; ) {
          if (a.return === null || a.return === l) break e;
          a = a.return;
        }
        a.sibling.return = a.return, a = a.sibling;
      }
      p &= 1;
    }
    if (Ie(Ve, p), (l.mode & 1) === 0) l.memoizedState = null;
    else switch (v) {
      case "forwards":
        for (c = l.child, v = null; c !== null; ) a = c.alternate, a !== null && Ml(a) === null && (v = c), c = c.sibling;
        c = v, c === null ? (v = l.child, l.child = null) : (v = c.sibling, c.sibling = null), _f(l, !1, v, c, g);
        break;
      case "backwards":
        for (c = null, v = l.child, l.child = null; v !== null; ) {
          if (a = v.alternate, a !== null && Ml(a) === null) {
            l.child = v;
            break;
          }
          a = v.sibling, v.sibling = c, c = v, v = a;
        }
        _f(l, !0, c, null, g);
        break;
      case "together":
        _f(l, !1, null, null, void 0);
        break;
      default:
        l.memoizedState = null;
    }
    return l.child;
  }
  function Pl(a, l) {
    (l.mode & 1) === 0 && a !== null && (a.alternate = null, l.alternate = null, l.flags |= 2);
  }
  function Cn(a, l, c) {
    if (a !== null && (l.dependencies = a.dependencies), zi |= l.lanes, (c & l.childLanes) === 0) return null;
    if (a !== null && l.child !== a.child) throw Error(t(153));
    if (l.child !== null) {
      for (a = l.child, c = ri(a, a.pendingProps), l.child = c, c.return = l; a.sibling !== null; ) a = a.sibling, c = c.sibling = ri(a, a.pendingProps), c.return = l;
      c.sibling = null;
    }
    return l.child;
  }
  function kT(a, l, c) {
    switch (l.tag) {
      case 3:
        Mm(l), _o();
        break;
      case 5:
        jv(l);
        break;
      case 1:
        Kt(l.type) && gl(l);
        break;
      case 4:
        mf(l, l.stateNode.containerInfo);
        break;
      case 10:
        var p = l.type._context, v = l.memoizedProps.value;
        Ie(Tl, p._currentValue), p._currentValue = v;
        break;
      case 13:
        if (p = l.memoizedState, p !== null)
          return p.dehydrated !== null ? (Ie(Ve, Ve.current & 1), l.flags |= 128, null) : (c & l.child.childLanes) !== 0 ? Nm(a, l, c) : (Ie(Ve, Ve.current & 1), a = Cn(a, l, c), a !== null ? a.sibling : null);
        Ie(Ve, Ve.current & 1);
        break;
      case 19:
        if (p = (c & l.childLanes) !== 0, (a.flags & 128) !== 0) {
          if (p) return Dm(a, l, c);
          l.flags |= 128;
        }
        if (v = l.memoizedState, v !== null && (v.rendering = null, v.tail = null, v.lastEffect = null), Ie(Ve, Ve.current), p) break;
        return null;
      case 22:
      case 23:
        return l.lanes = 0, xm(a, l, c);
    }
    return Cn(a, l, c);
  }
  var Am, Hf, Im, Rm;
  Am = function(a, l) {
    for (var c = l.child; c !== null; ) {
      if (c.tag === 5 || c.tag === 6) a.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;
    }
  }, Hf = function() {
  }, Im = function(a, l, c, p) {
    var v = a.memoizedProps;
    if (v !== p) {
      a = l.stateNode, Hi(Wr.current);
      var g = null;
      switch (c) {
        case "input":
          v = xi(a, v), p = xi(a, p), g = [];
          break;
        case "select":
          v = X({}, v, { value: void 0 }), p = X({}, p, { value: void 0 }), g = [];
          break;
        case "textarea":
          v = Vr(a, v), p = Vr(a, p), g = [];
          break;
        default:
          typeof v.onClick != "function" && typeof p.onClick == "function" && (a.onclick = hl);
      }
      Sa(c, p);
      var C;
      c = null;
      for (A in v) if (!p.hasOwnProperty(A) && v.hasOwnProperty(A) && v[A] != null) if (A === "style") {
        var x = v[A];
        for (C in x) x.hasOwnProperty(C) && (c || (c = {}), c[C] = "");
      } else A !== "dangerouslySetInnerHTML" && A !== "children" && A !== "suppressContentEditableWarning" && A !== "suppressHydrationWarning" && A !== "autoFocus" && (i.hasOwnProperty(A) ? g || (g = []) : (g = g || []).push(A, null));
      for (A in p) {
        var S = p[A];
        if (x = v?.[A], p.hasOwnProperty(A) && S !== x && (S != null || x != null)) if (A === "style") if (x) {
          for (C in x) !x.hasOwnProperty(C) || S && S.hasOwnProperty(C) || (c || (c = {}), c[C] = "");
          for (C in S) S.hasOwnProperty(C) && x[C] !== S[C] && (c || (c = {}), c[C] = S[C]);
        } else c || (g || (g = []), g.push(
          A,
          c
        )), c = S;
        else A === "dangerouslySetInnerHTML" ? (S = S ? S.__html : void 0, x = x ? x.__html : void 0, S != null && x !== S && (g = g || []).push(A, S)) : A === "children" ? typeof S != "string" && typeof S != "number" || (g = g || []).push(A, "" + S) : A !== "suppressContentEditableWarning" && A !== "suppressHydrationWarning" && (i.hasOwnProperty(A) ? (S != null && A === "onScroll" && Pe("scroll", a), g || x === S || (g = [])) : (g = g || []).push(A, S));
      }
      c && (g = g || []).push("style", c);
      var A = g;
      (l.updateQueue = A) && (l.flags |= 4);
    }
  }, Rm = function(a, l, c, p) {
    c !== p && (l.flags |= 4);
  };
  function ns(a, l) {
    if (!He) switch (a.tailMode) {
      case "hidden":
        l = a.tail;
        for (var c = null; l !== null; ) l.alternate !== null && (c = l), l = l.sibling;
        c === null ? a.tail = null : c.sibling = null;
        break;
      case "collapsed":
        c = a.tail;
        for (var p = null; c !== null; ) c.alternate !== null && (p = c), c = c.sibling;
        p === null ? l || a.tail === null ? a.tail = null : a.tail.sibling = null : p.sibling = null;
    }
  }
  function Lt(a) {
    var l = a.alternate !== null && a.alternate.child === a.child, c = 0, p = 0;
    if (l) for (var v = a.child; v !== null; ) c |= v.lanes | v.childLanes, p |= v.subtreeFlags & 14680064, p |= v.flags & 14680064, v.return = a, v = v.sibling;
    else for (v = a.child; v !== null; ) c |= v.lanes | v.childLanes, p |= v.subtreeFlags, p |= v.flags, v.return = a, v = v.sibling;
    return a.subtreeFlags |= p, a.childLanes = c, l;
  }
  function CT(a, l, c) {
    var p = l.pendingProps;
    switch (af(l), l.tag) {
      case 2:
      case 16:
      case 15:
      case 0:
      case 11:
      case 7:
      case 8:
      case 12:
      case 9:
      case 14:
        return Lt(l), null;
      case 1:
        return Kt(l.type) && ml(), Lt(l), null;
      case 3:
        return p = l.stateNode, Vo(), Be(Gt), Be(Ot), wf(), p.pendingContext && (p.context = p.pendingContext, p.pendingContext = null), (a === null || a.child === null) && (Cl(l) ? l.flags |= 4 : a === null || a.memoizedState.isDehydrated && (l.flags & 256) === 0 || (l.flags |= 1024, Nr !== null && (Qf(Nr), Nr = null))), Hf(a, l), Lt(l), null;
      case 5:
        gf(l);
        var v = Hi(Ya.current);
        if (c = l.type, a !== null && l.stateNode != null) Im(a, l, c, p, v), a.ref !== l.ref && (l.flags |= 512, l.flags |= 2097152);
        else {
          if (!p) {
            if (l.stateNode === null) throw Error(t(166));
            return Lt(l), null;
          }
          if (a = Hi(Wr.current), Cl(l)) {
            p = l.stateNode, c = l.type;
            var g = l.memoizedProps;
            switch (p[jr] = l, p[Ga] = g, a = (l.mode & 1) !== 0, c) {
              case "dialog":
                Pe("cancel", p), Pe("close", p);
                break;
              case "iframe":
              case "object":
              case "embed":
                Pe("load", p);
                break;
              case "video":
              case "audio":
                for (v = 0; v < Ua.length; v++) Pe(Ua[v], p);
                break;
              case "source":
                Pe("error", p);
                break;
              case "img":
              case "image":
              case "link":
                Pe(
                  "error",
                  p
                ), Pe("load", p);
                break;
              case "details":
                Pe("toggle", p);
                break;
              case "input":
                sn(p, g), Pe("invalid", p);
                break;
              case "select":
                p._wrapperState = { wasMultiple: !!g.multiple }, Pe("invalid", p);
                break;
              case "textarea":
                un(p, g), Pe("invalid", p);
            }
            Sa(c, g), v = null;
            for (var C in g) if (g.hasOwnProperty(C)) {
              var x = g[C];
              C === "children" ? typeof x == "string" ? p.textContent !== x && (g.suppressHydrationWarning !== !0 && pl(p.textContent, x, a), v = ["children", x]) : typeof x == "number" && p.textContent !== "" + x && (g.suppressHydrationWarning !== !0 && pl(
                p.textContent,
                x,
                a
              ), v = ["children", "" + x]) : i.hasOwnProperty(C) && x != null && C === "onScroll" && Pe("scroll", p);
            }
            switch (c) {
              case "input":
                Er(p), Ei(p, g, !0);
                break;
              case "textarea":
                Er(p), Ta(p);
                break;
              case "select":
              case "option":
                break;
              default:
                typeof g.onClick == "function" && (p.onclick = hl);
            }
            p = v, l.updateQueue = p, p !== null && (l.flags |= 4);
          } else {
            C = v.nodeType === 9 ? v : v.ownerDocument, a === "http://www.w3.org/1999/xhtml" && (a = xa(c)), a === "http://www.w3.org/1999/xhtml" ? c === "script" ? (a = C.createElement("div"), a.innerHTML = "<script><\/script>", a = a.removeChild(a.firstChild)) : typeof p.is == "string" ? a = C.createElement(c, { is: p.is }) : (a = C.createElement(c), c === "select" && (C = a, p.multiple ? C.multiple = !0 : p.size && (C.size = p.size))) : a = C.createElementNS(a, c), a[jr] = l, a[Ga] = p, Am(a, l, !1, !1), l.stateNode = a;
            e: {
              switch (C = qr(c, p), c) {
                case "dialog":
                  Pe("cancel", a), Pe("close", a), v = p;
                  break;
                case "iframe":
                case "object":
                case "embed":
                  Pe("load", a), v = p;
                  break;
                case "video":
                case "audio":
                  for (v = 0; v < Ua.length; v++) Pe(Ua[v], a);
                  v = p;
                  break;
                case "source":
                  Pe("error", a), v = p;
                  break;
                case "img":
                case "image":
                case "link":
                  Pe(
                    "error",
                    a
                  ), Pe("load", a), v = p;
                  break;
                case "details":
                  Pe("toggle", a), v = p;
                  break;
                case "input":
                  sn(a, p), v = xi(a, p), Pe("invalid", a);
                  break;
                case "option":
                  v = p;
                  break;
                case "select":
                  a._wrapperState = { wasMultiple: !!p.multiple }, v = X({}, p, { value: void 0 }), Pe("invalid", a);
                  break;
                case "textarea":
                  un(a, p), v = Vr(a, p), Pe("invalid", a);
                  break;
                default:
                  v = p;
              }
              Sa(c, v), x = v;
              for (g in x) if (x.hasOwnProperty(g)) {
                var S = x[g];
                g === "style" ? fn(a, S) : g === "dangerouslySetInnerHTML" ? (S = S ? S.__html : void 0, S != null && wo(a, S)) : g === "children" ? typeof S == "string" ? (c !== "textarea" || S !== "") && cn(a, S) : typeof S == "number" && cn(a, "" + S) : g !== "suppressContentEditableWarning" && g !== "suppressHydrationWarning" && g !== "autoFocus" && (i.hasOwnProperty(g) ? S != null && g === "onScroll" && Pe("scroll", a) : S != null && P(a, g, S, C));
              }
              switch (c) {
                case "input":
                  Er(a), Ei(a, p, !1);
                  break;
                case "textarea":
                  Er(a), Ta(a);
                  break;
                case "option":
                  p.value != null && a.setAttribute("value", "" + Ee(p.value));
                  break;
                case "select":
                  a.multiple = !!p.multiple, g = p.value, g != null ? fr(a, !!p.multiple, g, !1) : p.defaultValue != null && fr(
                    a,
                    !!p.multiple,
                    p.defaultValue,
                    !0
                  );
                  break;
                default:
                  typeof v.onClick == "function" && (a.onclick = hl);
              }
              switch (c) {
                case "button":
                case "input":
                case "select":
                case "textarea":
                  p = !!p.autoFocus;
                  break e;
                case "img":
                  p = !0;
                  break e;
                default:
                  p = !1;
              }
            }
            p && (l.flags |= 4);
          }
          l.ref !== null && (l.flags |= 512, l.flags |= 2097152);
        }
        return Lt(l), null;
      case 6:
        if (a && l.stateNode != null) Rm(a, l, a.memoizedProps, p);
        else {
          if (typeof p != "string" && l.stateNode === null) throw Error(t(166));
          if (c = Hi(Ya.current), Hi(Wr.current), Cl(l)) {
            if (p = l.stateNode, c = l.memoizedProps, p[jr] = l, (g = p.nodeValue !== c) && (a = or, a !== null)) switch (a.tag) {
              case 3:
                pl(p.nodeValue, c, (a.mode & 1) !== 0);
                break;
              case 5:
                a.memoizedProps.suppressHydrationWarning !== !0 && pl(p.nodeValue, c, (a.mode & 1) !== 0);
            }
            g && (l.flags |= 4);
          } else p = (c.nodeType === 9 ? c : c.ownerDocument).createTextNode(p), p[jr] = l, l.stateNode = p;
        }
        return Lt(l), null;
      case 13:
        if (Be(Ve), p = l.memoizedState, a === null || a.memoizedState !== null && a.memoizedState.dehydrated !== null) {
          if (He && ar !== null && (l.mode & 1) !== 0 && (l.flags & 128) === 0) _v(), _o(), l.flags |= 98560, g = !1;
          else if (g = Cl(l), p !== null && p.dehydrated !== null) {
            if (a === null) {
              if (!g) throw Error(t(318));
              if (g = l.memoizedState, g = g !== null ? g.dehydrated : null, !g) throw Error(t(317));
              g[jr] = l;
            } else _o(), (l.flags & 128) === 0 && (l.memoizedState = null), l.flags |= 4;
            Lt(l), g = !1;
          } else Nr !== null && (Qf(Nr), Nr = null), g = !0;
          if (!g) return l.flags & 65536 ? l : null;
        }
        return (l.flags & 128) !== 0 ? (l.lanes = c, l) : (p = p !== null, p !== (a !== null && a.memoizedState !== null) && p && (l.child.flags |= 8192, (l.mode & 1) !== 0 && (a === null || (Ve.current & 1) !== 0 ? nt === 0 && (nt = 3) : Yf())), l.updateQueue !== null && (l.flags |= 4), Lt(l), null);
      case 4:
        return Vo(), Hf(a, l), a === null && ja(l.stateNode.containerInfo), Lt(l), null;
      case 10:
        return df(l.type._context), Lt(l), null;
      case 17:
        return Kt(l.type) && ml(), Lt(l), null;
      case 19:
        if (Be(Ve), g = l.memoizedState, g === null) return Lt(l), null;
        if (p = (l.flags & 128) !== 0, C = g.rendering, C === null) if (p) ns(g, !1);
        else {
          if (nt !== 0 || a !== null && (a.flags & 128) !== 0) for (a = l.child; a !== null; ) {
            if (C = Ml(a), C !== null) {
              for (l.flags |= 128, ns(g, !1), p = C.updateQueue, p !== null && (l.updateQueue = p, l.flags |= 4), l.subtreeFlags = 0, p = c, c = l.child; c !== null; ) g = c, a = p, g.flags &= 14680066, C = g.alternate, C === null ? (g.childLanes = 0, g.lanes = a, g.child = null, g.subtreeFlags = 0, g.memoizedProps = null, g.memoizedState = null, g.updateQueue = null, g.dependencies = null, g.stateNode = null) : (g.childLanes = C.childLanes, g.lanes = C.lanes, g.child = C.child, g.subtreeFlags = 0, g.deletions = null, g.memoizedProps = C.memoizedProps, g.memoizedState = C.memoizedState, g.updateQueue = C.updateQueue, g.type = C.type, a = C.dependencies, g.dependencies = a === null ? null : { lanes: a.lanes, firstContext: a.firstContext }), c = c.sibling;
              return Ie(Ve, Ve.current & 1 | 2), l.child;
            }
            a = a.sibling;
          }
          g.tail !== null && Ge() > jo && (l.flags |= 128, p = !0, ns(g, !1), l.lanes = 4194304);
        }
        else {
          if (!p) if (a = Ml(C), a !== null) {
            if (l.flags |= 128, p = !0, c = a.updateQueue, c !== null && (l.updateQueue = c, l.flags |= 4), ns(g, !0), g.tail === null && g.tailMode === "hidden" && !C.alternate && !He) return Lt(l), null;
          } else 2 * Ge() - g.renderingStartTime > jo && c !== 1073741824 && (l.flags |= 128, p = !0, ns(g, !1), l.lanes = 4194304);
          g.isBackwards ? (C.sibling = l.child, l.child = C) : (c = g.last, c !== null ? c.sibling = C : l.child = C, g.last = C);
        }
        return g.tail !== null ? (l = g.tail, g.rendering = l, g.tail = l.sibling, g.renderingStartTime = Ge(), l.sibling = null, c = Ve.current, Ie(Ve, p ? c & 1 | 2 : c & 1), l) : (Lt(l), null);
      case 22:
      case 23:
        return Xf(), p = l.memoizedState !== null, a !== null && a.memoizedState !== null !== p && (l.flags |= 8192), p && (l.mode & 1) !== 0 ? (sr & 1073741824) !== 0 && (Lt(l), l.subtreeFlags & 6 && (l.flags |= 8192)) : Lt(l), null;
      case 24:
        return null;
      case 25:
        return null;
    }
    throw Error(t(156, l.tag));
  }
  function bT(a, l) {
    switch (af(l), l.tag) {
      case 1:
        return Kt(l.type) && ml(), a = l.flags, a & 65536 ? (l.flags = a & -65537 | 128, l) : null;
      case 3:
        return Vo(), Be(Gt), Be(Ot), wf(), a = l.flags, (a & 65536) !== 0 && (a & 128) === 0 ? (l.flags = a & -65537 | 128, l) : null;
      case 5:
        return gf(l), null;
      case 13:
        if (Be(Ve), a = l.memoizedState, a !== null && a.dehydrated !== null) {
          if (l.alternate === null) throw Error(t(340));
          _o();
        }
        return a = l.flags, a & 65536 ? (l.flags = a & -65537 | 128, l) : null;
      case 19:
        return Be(Ve), null;
      case 4:
        return Vo(), null;
      case 10:
        return df(l.type._context), null;
      case 22:
      case 23:
        return Xf(), null;
      case 24:
        return null;
      default:
        return null;
    }
  }
  var Bl = !1, Dt = !1, TT = typeof WeakSet == "function" ? WeakSet : Set, Z = null;
  function $o(a, l) {
    var c = a.ref;
    if (c !== null) if (typeof c == "function") try {
      c(null);
    } catch (p) {
      We(a, l, p);
    }
    else c.current = null;
  }
  function Ff(a, l, c) {
    try {
      c();
    } catch (p) {
      We(a, l, p);
    }
  }
  var Pm = !1;
  function xT(a, l) {
    if (Jc = rl, a = pv(), qc(a)) {
      if ("selectionStart" in a) var c = { start: a.selectionStart, end: a.selectionEnd };
      else e: {
        c = (c = a.ownerDocument) && c.defaultView || window;
        var p = c.getSelection && c.getSelection();
        if (p && p.rangeCount !== 0) {
          c = p.anchorNode;
          var v = p.anchorOffset, g = p.focusNode;
          p = p.focusOffset;
          try {
            c.nodeType, g.nodeType;
          } catch {
            c = null;
            break e;
          }
          var C = 0, x = -1, S = -1, A = 0, z = 0, $ = a, H = null;
          t: for (; ; ) {
            for (var J; $ !== c || v !== 0 && $.nodeType !== 3 || (x = C + v), $ !== g || p !== 0 && $.nodeType !== 3 || (S = C + p), $.nodeType === 3 && (C += $.nodeValue.length), (J = $.firstChild) !== null; )
              H = $, $ = J;
            for (; ; ) {
              if ($ === a) break t;
              if (H === c && ++A === v && (x = C), H === g && ++z === p && (S = C), (J = $.nextSibling) !== null) break;
              $ = H, H = $.parentNode;
            }
            $ = J;
          }
          c = x === -1 || S === -1 ? null : { start: x, end: S };
        } else c = null;
      }
      c = c || { start: 0, end: 0 };
    } else c = null;
    for (Xc = { focusedElem: a, selectionRange: c }, rl = !1, Z = l; Z !== null; ) if (l = Z, a = l.child, (l.subtreeFlags & 1028) !== 0 && a !== null) a.return = l, Z = a;
    else for (; Z !== null; ) {
      l = Z;
      try {
        var ee = l.alternate;
        if ((l.flags & 1024) !== 0) switch (l.tag) {
          case 0:
          case 11:
          case 15:
            break;
          case 1:
            if (ee !== null) {
              var te = ee.memoizedProps, Ke = ee.memoizedState, N = l.stateNode, M = N.getSnapshotBeforeUpdate(l.elementType === l.type ? te : Lr(l.type, te), Ke);
              N.__reactInternalSnapshotBeforeUpdate = M;
            }
            break;
          case 3:
            var D = l.stateNode.containerInfo;
            D.nodeType === 1 ? D.textContent = "" : D.nodeType === 9 && D.documentElement && D.removeChild(D.documentElement);
            break;
          case 5:
          case 6:
          case 4:
          case 17:
            break;
          default:
            throw Error(t(163));
        }
      } catch (U) {
        We(l, l.return, U);
      }
      if (a = l.sibling, a !== null) {
        a.return = l.return, Z = a;
        break;
      }
      Z = l.return;
    }
    return ee = Pm, Pm = !1, ee;
  }
  function is(a, l, c) {
    var p = l.updateQueue;
    if (p = p !== null ? p.lastEffect : null, p !== null) {
      var v = p = p.next;
      do {
        if ((v.tag & a) === a) {
          var g = v.destroy;
          v.destroy = void 0, g !== void 0 && Ff(l, c, g);
        }
        v = v.next;
      } while (v !== p);
    }
  }
  function _l(a, l) {
    if (l = l.updateQueue, l = l !== null ? l.lastEffect : null, l !== null) {
      var c = l = l.next;
      do {
        if ((c.tag & a) === a) {
          var p = c.create;
          c.destroy = p();
        }
        c = c.next;
      } while (c !== l);
    }
  }
  function zf(a) {
    var l = a.ref;
    if (l !== null) {
      var c = a.stateNode;
      a.tag, a = c, typeof l == "function" ? l(a) : l.current = a;
    }
  }
  function Bm(a) {
    var l = a.alternate;
    l !== null && (a.alternate = null, Bm(l)), a.child = null, a.deletions = null, a.sibling = null, a.tag === 5 && (l = a.stateNode, l !== null && (delete l[jr], delete l[Ga], delete l[tf], delete l[aT], delete l[sT])), a.stateNode = null, a.return = null, a.dependencies = null, a.memoizedProps = null, a.memoizedState = null, a.pendingProps = null, a.stateNode = null, a.updateQueue = null;
  }
  function _m(a) {
    return a.tag === 5 || a.tag === 3 || a.tag === 4;
  }
  function Hm(a) {
    e: for (; ; ) {
      for (; a.sibling === null; ) {
        if (a.return === null || _m(a.return)) return null;
        a = a.return;
      }
      for (a.sibling.return = a.return, a = a.sibling; a.tag !== 5 && a.tag !== 6 && a.tag !== 18; ) {
        if (a.flags & 2 || a.child === null || a.tag === 4) continue e;
        a.child.return = a, a = a.child;
      }
      if (!(a.flags & 2)) return a.stateNode;
    }
  }
  function Vf(a, l, c) {
    var p = a.tag;
    if (p === 5 || p === 6) a = a.stateNode, l ? c.nodeType === 8 ? c.parentNode.insertBefore(a, l) : c.insertBefore(a, l) : (c.nodeType === 8 ? (l = c.parentNode, l.insertBefore(a, c)) : (l = c, l.appendChild(a)), c = c._reactRootContainer, c != null || l.onclick !== null || (l.onclick = hl));
    else if (p !== 4 && (a = a.child, a !== null)) for (Vf(a, l, c), a = a.sibling; a !== null; ) Vf(a, l, c), a = a.sibling;
  }
  function qf(a, l, c) {
    var p = a.tag;
    if (p === 5 || p === 6) a = a.stateNode, l ? c.insertBefore(a, l) : c.appendChild(a);
    else if (p !== 4 && (a = a.child, a !== null)) for (qf(a, l, c), a = a.sibling; a !== null; ) qf(a, l, c), a = a.sibling;
  }
  var yt = null, Dr = !1;
  function Xn(a, l, c) {
    for (c = c.child; c !== null; ) Fm(a, l, c), c = c.sibling;
  }
  function Fm(a, l, c) {
    if (Ur && typeof Ur.onCommitFiberUnmount == "function") try {
      Ur.onCommitFiberUnmount(Js, c);
    } catch {
    }
    switch (c.tag) {
      case 5:
        Dt || $o(c, l);
      case 6:
        var p = yt, v = Dr;
        yt = null, Xn(a, l, c), yt = p, Dr = v, yt !== null && (Dr ? (a = yt, c = c.stateNode, a.nodeType === 8 ? a.parentNode.removeChild(c) : a.removeChild(c)) : yt.removeChild(c.stateNode));
        break;
      case 18:
        yt !== null && (Dr ? (a = yt, c = c.stateNode, a.nodeType === 8 ? ef(a.parentNode, c) : a.nodeType === 1 && ef(a, c), Ba(a)) : ef(yt, c.stateNode));
        break;
      case 4:
        p = yt, v = Dr, yt = c.stateNode.containerInfo, Dr = !0, Xn(a, l, c), yt = p, Dr = v;
        break;
      case 0:
      case 11:
      case 14:
      case 15:
        if (!Dt && (p = c.updateQueue, p !== null && (p = p.lastEffect, p !== null))) {
          v = p = p.next;
          do {
            var g = v, C = g.destroy;
            g = g.tag, C !== void 0 && ((g & 2) !== 0 || (g & 4) !== 0) && Ff(c, l, C), v = v.next;
          } while (v !== p);
        }
        Xn(a, l, c);
        break;
      case 1:
        if (!Dt && ($o(c, l), p = c.stateNode, typeof p.componentWillUnmount == "function")) try {
          p.props = c.memoizedProps, p.state = c.memoizedState, p.componentWillUnmount();
        } catch (x) {
          We(c, l, x);
        }
        Xn(a, l, c);
        break;
      case 21:
        Xn(a, l, c);
        break;
      case 22:
        c.mode & 1 ? (Dt = (p = Dt) || c.memoizedState !== null, Xn(a, l, c), Dt = p) : Xn(a, l, c);
        break;
      default:
        Xn(a, l, c);
    }
  }
  function zm(a) {
    var l = a.updateQueue;
    if (l !== null) {
      a.updateQueue = null;
      var c = a.stateNode;
      c === null && (c = a.stateNode = new TT()), l.forEach(function(p) {
        var v = IT.bind(null, a, p);
        c.has(p) || (c.add(p), p.then(v, v));
      });
    }
  }
  function Ar(a, l) {
    var c = l.deletions;
    if (c !== null) for (var p = 0; p < c.length; p++) {
      var v = c[p];
      try {
        var g = a, C = l, x = C;
        e: for (; x !== null; ) {
          switch (x.tag) {
            case 5:
              yt = x.stateNode, Dr = !1;
              break e;
            case 3:
              yt = x.stateNode.containerInfo, Dr = !0;
              break e;
            case 4:
              yt = x.stateNode.containerInfo, Dr = !0;
              break e;
          }
          x = x.return;
        }
        if (yt === null) throw Error(t(160));
        Fm(g, C, v), yt = null, Dr = !1;
        var S = v.alternate;
        S !== null && (S.return = null), v.return = null;
      } catch (A) {
        We(v, l, A);
      }
    }
    if (l.subtreeFlags & 12854) for (l = l.child; l !== null; ) Vm(l, a), l = l.sibling;
  }
  function Vm(a, l) {
    var c = a.alternate, p = a.flags;
    switch (a.tag) {
      case 0:
      case 11:
      case 14:
      case 15:
        if (Ar(l, a), Kr(a), p & 4) {
          try {
            is(3, a, a.return), _l(3, a);
          } catch (te) {
            We(a, a.return, te);
          }
          try {
            is(5, a, a.return);
          } catch (te) {
            We(a, a.return, te);
          }
        }
        break;
      case 1:
        Ar(l, a), Kr(a), p & 512 && c !== null && $o(c, c.return);
        break;
      case 5:
        if (Ar(l, a), Kr(a), p & 512 && c !== null && $o(c, c.return), a.flags & 32) {
          var v = a.stateNode;
          try {
            cn(v, "");
          } catch (te) {
            We(a, a.return, te);
          }
        }
        if (p & 4 && (v = a.stateNode, v != null)) {
          var g = a.memoizedProps, C = c !== null ? c.memoizedProps : g, x = a.type, S = a.updateQueue;
          if (a.updateQueue = null, S !== null) try {
            x === "input" && g.type === "radio" && g.name != null && Si(v, g), qr(x, C);
            var A = qr(x, g);
            for (C = 0; C < S.length; C += 2) {
              var z = S[C], $ = S[C + 1];
              z === "style" ? fn(v, $) : z === "dangerouslySetInnerHTML" ? wo(v, $) : z === "children" ? cn(v, $) : P(v, z, $, A);
            }
            switch (x) {
              case "input":
                go(v, g);
                break;
              case "textarea":
                ba(v, g);
                break;
              case "select":
                var H = v._wrapperState.wasMultiple;
                v._wrapperState.wasMultiple = !!g.multiple;
                var J = g.value;
                J != null ? fr(v, !!g.multiple, J, !1) : H !== !!g.multiple && (g.defaultValue != null ? fr(
                  v,
                  !!g.multiple,
                  g.defaultValue,
                  !0
                ) : fr(v, !!g.multiple, g.multiple ? [] : "", !1));
            }
            v[Ga] = g;
          } catch (te) {
            We(a, a.return, te);
          }
        }
        break;
      case 6:
        if (Ar(l, a), Kr(a), p & 4) {
          if (a.stateNode === null) throw Error(t(162));
          v = a.stateNode, g = a.memoizedProps;
          try {
            v.nodeValue = g;
          } catch (te) {
            We(a, a.return, te);
          }
        }
        break;
      case 3:
        if (Ar(l, a), Kr(a), p & 4 && c !== null && c.memoizedState.isDehydrated) try {
          Ba(l.containerInfo);
        } catch (te) {
          We(a, a.return, te);
        }
        break;
      case 4:
        Ar(l, a), Kr(a);
        break;
      case 13:
        Ar(l, a), Kr(a), v = a.child, v.flags & 8192 && (g = v.memoizedState !== null, v.stateNode.isHidden = g, !g || v.alternate !== null && v.alternate.memoizedState !== null || (jf = Ge())), p & 4 && zm(a);
        break;
      case 22:
        if (z = c !== null && c.memoizedState !== null, a.mode & 1 ? (Dt = (A = Dt) || z, Ar(l, a), Dt = A) : Ar(l, a), Kr(a), p & 8192) {
          if (A = a.memoizedState !== null, (a.stateNode.isHidden = A) && !z && (a.mode & 1) !== 0) for (Z = a, z = a.child; z !== null; ) {
            for ($ = Z = z; Z !== null; ) {
              switch (H = Z, J = H.child, H.tag) {
                case 0:
                case 11:
                case 14:
                case 15:
                  is(4, H, H.return);
                  break;
                case 1:
                  $o(H, H.return);
                  var ee = H.stateNode;
                  if (typeof ee.componentWillUnmount == "function") {
                    p = H, c = H.return;
                    try {
                      l = p, ee.props = l.memoizedProps, ee.state = l.memoizedState, ee.componentWillUnmount();
                    } catch (te) {
                      We(p, c, te);
                    }
                  }
                  break;
                case 5:
                  $o(H, H.return);
                  break;
                case 22:
                  if (H.memoizedState !== null) {
                    Um($);
                    continue;
                  }
              }
              J !== null ? (J.return = H, Z = J) : Um($);
            }
            z = z.sibling;
          }
          e: for (z = null, $ = a; ; ) {
            if ($.tag === 5) {
              if (z === null) {
                z = $;
                try {
                  v = $.stateNode, A ? (g = v.style, typeof g.setProperty == "function" ? g.setProperty("display", "none", "important") : g.display = "none") : (x = $.stateNode, S = $.memoizedProps.style, C = S != null && S.hasOwnProperty("display") ? S.display : null, x.style.display = Co("display", C));
                } catch (te) {
                  We(a, a.return, te);
                }
              }
            } else if ($.tag === 6) {
              if (z === null) try {
                $.stateNode.nodeValue = A ? "" : $.memoizedProps;
              } catch (te) {
                We(a, a.return, te);
              }
            } else if (($.tag !== 22 && $.tag !== 23 || $.memoizedState === null || $ === a) && $.child !== null) {
              $.child.return = $, $ = $.child;
              continue;
            }
            if ($ === a) break e;
            for (; $.sibling === null; ) {
              if ($.return === null || $.return === a) break e;
              z === $ && (z = null), $ = $.return;
            }
            z === $ && (z = null), $.sibling.return = $.return, $ = $.sibling;
          }
        }
        break;
      case 19:
        Ar(l, a), Kr(a), p & 4 && zm(a);
        break;
      case 21:
        break;
      default:
        Ar(
          l,
          a
        ), Kr(a);
    }
  }
  function Kr(a) {
    var l = a.flags;
    if (l & 2) {
      try {
        e: {
          for (var c = a.return; c !== null; ) {
            if (_m(c)) {
              var p = c;
              break e;
            }
            c = c.return;
          }
          throw Error(t(160));
        }
        switch (p.tag) {
          case 5:
            var v = p.stateNode;
            p.flags & 32 && (cn(v, ""), p.flags &= -33);
            var g = Hm(a);
            qf(a, g, v);
            break;
          case 3:
          case 4:
            var C = p.stateNode.containerInfo, x = Hm(a);
            Vf(a, x, C);
            break;
          default:
            throw Error(t(161));
        }
      } catch (S) {
        We(a, a.return, S);
      }
      a.flags &= -3;
    }
    l & 4096 && (a.flags &= -4097);
  }
  function ST(a, l, c) {
    Z = a, qm(a);
  }
  function qm(a, l, c) {
    for (var p = (a.mode & 1) !== 0; Z !== null; ) {
      var v = Z, g = v.child;
      if (v.tag === 22 && p) {
        var C = v.memoizedState !== null || Bl;
        if (!C) {
          var x = v.alternate, S = x !== null && x.memoizedState !== null || Dt;
          x = Bl;
          var A = Dt;
          if (Bl = C, (Dt = S) && !A) for (Z = v; Z !== null; ) C = Z, S = C.child, C.tag === 22 && C.memoizedState !== null ? jm(v) : S !== null ? (S.return = C, Z = S) : jm(v);
          for (; g !== null; ) Z = g, qm(g), g = g.sibling;
          Z = v, Bl = x, Dt = A;
        }
        $m(a);
      } else (v.subtreeFlags & 8772) !== 0 && g !== null ? (g.return = v, Z = g) : $m(a);
    }
  }
  function $m(a) {
    for (; Z !== null; ) {
      var l = Z;
      if ((l.flags & 8772) !== 0) {
        var c = l.alternate;
        try {
          if ((l.flags & 8772) !== 0) switch (l.tag) {
            case 0:
            case 11:
            case 15:
              Dt || _l(5, l);
              break;
            case 1:
              var p = l.stateNode;
              if (l.flags & 4 && !Dt) if (c === null) p.componentDidMount();
              else {
                var v = l.elementType === l.type ? c.memoizedProps : Lr(l.type, c.memoizedProps);
                p.componentDidUpdate(v, c.memoizedState, p.__reactInternalSnapshotBeforeUpdate);
              }
              var g = l.updateQueue;
              g !== null && Uv(l, g, p);
              break;
            case 3:
              var C = l.updateQueue;
              if (C !== null) {
                if (c = null, l.child !== null) switch (l.child.tag) {
                  case 5:
                    c = l.child.stateNode;
                    break;
                  case 1:
                    c = l.child.stateNode;
                }
                Uv(l, C, c);
              }
              break;
            case 5:
              var x = l.stateNode;
              if (c === null && l.flags & 4) {
                c = x;
                var S = l.memoizedProps;
                switch (l.type) {
                  case "button":
                  case "input":
                  case "select":
                  case "textarea":
                    S.autoFocus && c.focus();
                    break;
                  case "img":
                    S.src && (c.src = S.src);
                }
              }
              break;
            case 6:
              break;
            case 4:
              break;
            case 12:
              break;
            case 13:
              if (l.memoizedState === null) {
                var A = l.alternate;
                if (A !== null) {
                  var z = A.memoizedState;
                  if (z !== null) {
                    var $ = z.dehydrated;
                    $ !== null && Ba($);
                  }
                }
              }
              break;
            case 19:
            case 17:
            case 21:
            case 22:
            case 23:
            case 25:
              break;
            default:
              throw Error(t(163));
          }
          Dt || l.flags & 512 && zf(l);
        } catch (H) {
          We(l, l.return, H);
        }
      }
      if (l === a) {
        Z = null;
        break;
      }
      if (c = l.sibling, c !== null) {
        c.return = l.return, Z = c;
        break;
      }
      Z = l.return;
    }
  }
  function Um(a) {
    for (; Z !== null; ) {
      var l = Z;
      if (l === a) {
        Z = null;
        break;
      }
      var c = l.sibling;
      if (c !== null) {
        c.return = l.return, Z = c;
        break;
      }
      Z = l.return;
    }
  }
  function jm(a) {
    for (; Z !== null; ) {
      var l = Z;
      try {
        switch (l.tag) {
          case 0:
          case 11:
          case 15:
            var c = l.return;
            try {
              _l(4, l);
            } catch (S) {
              We(l, c, S);
            }
            break;
          case 1:
            var p = l.stateNode;
            if (typeof p.componentDidMount == "function") {
              var v = l.return;
              try {
                p.componentDidMount();
              } catch (S) {
                We(l, v, S);
              }
            }
            var g = l.return;
            try {
              zf(l);
            } catch (S) {
              We(l, g, S);
            }
            break;
          case 5:
            var C = l.return;
            try {
              zf(l);
            } catch (S) {
              We(l, C, S);
            }
        }
      } catch (S) {
        We(l, l.return, S);
      }
      if (l === a) {
        Z = null;
        break;
      }
      var x = l.sibling;
      if (x !== null) {
        x.return = l.return, Z = x;
        break;
      }
      Z = l.return;
    }
  }
  var ET = Math.ceil, Hl = _.ReactCurrentDispatcher, $f = _.ReactCurrentOwner, yr = _.ReactCurrentBatchConfig, Te = 0, ft = null, Xe = null, wt = 0, sr = 0, Uo = Wn(0), nt = 0, as = null, zi = 0, Fl = 0, Uf = 0, ss = null, Jt = null, jf = 0, jo = 1 / 0, bn = null, zl = !1, Wf = null, Yn = null, Vl = !1, Zn = null, ql = 0, ls = 0, Gf = null, $l = -1, Ul = 0;
  function zt() {
    return (Te & 6) !== 0 ? Ge() : $l !== -1 ? $l : $l = Ge();
  }
  function ei(a) {
    return (a.mode & 1) === 0 ? 1 : (Te & 2) !== 0 && wt !== 0 ? wt & -wt : uT.transition !== null ? (Ul === 0 && (Ul = Hh()), Ul) : (a = De, a !== 0 || (a = window.event, a = a === void 0 ? 16 : Gh(a.type)), a);
  }
  function Ir(a, l, c, p) {
    if (50 < ls) throw ls = 0, Gf = null, Error(t(185));
    Da(a, c, p), ((Te & 2) === 0 || a !== ft) && (a === ft && ((Te & 2) === 0 && (Fl |= c), nt === 4 && ti(a, wt)), Xt(a, p), c === 1 && Te === 0 && (l.mode & 1) === 0 && (jo = Ge() + 500, yl && Kn()));
  }
  function Xt(a, l) {
    var c = a.callbackNode;
    ub(a, l);
    var p = Zs(a, a === ft ? wt : 0);
    if (p === 0) c !== null && Ks(c), a.callbackNode = null, a.callbackPriority = 0;
    else if (l = p & -p, a.callbackPriority !== l) {
      if (c != null && Ks(c), l === 1) a.tag === 0 ? lT(Gm.bind(null, a)) : Av(Gm.bind(null, a)), iT(function() {
        (Te & 6) === 0 && Kn();
      }), c = null;
      else {
        switch (Fh(p)) {
          case 1:
            c = Sc;
            break;
          case 4:
            c = Bh;
            break;
          case 16:
            c = Qs;
            break;
          case 536870912:
            c = _h;
            break;
          default:
            c = Qs;
        }
        c = tg(c, Wm.bind(null, a));
      }
      a.callbackPriority = l, a.callbackNode = c;
    }
  }
  function Wm(a, l) {
    if ($l = -1, Ul = 0, (Te & 6) !== 0) throw Error(t(327));
    var c = a.callbackNode;
    if (Wo() && a.callbackNode !== c) return null;
    var p = Zs(a, a === ft ? wt : 0);
    if (p === 0) return null;
    if ((p & 30) !== 0 || (p & a.expiredLanes) !== 0 || l) l = jl(a, p);
    else {
      l = p;
      var v = Te;
      Te |= 2;
      var g = Qm();
      (ft !== a || wt !== l) && (bn = null, jo = Ge() + 500, qi(a, l));
      do
        try {
          NT();
          break;
        } catch (x) {
          Km(a, x);
        }
      while (!0);
      ff(), Hl.current = g, Te = v, Xe !== null ? l = 0 : (ft = null, wt = 0, l = nt);
    }
    if (l !== 0) {
      if (l === 2 && (v = Ec(a), v !== 0 && (p = v, l = Kf(a, v))), l === 1) throw c = as, qi(a, 0), ti(a, p), Xt(a, Ge()), c;
      if (l === 6) ti(a, p);
      else {
        if (v = a.current.alternate, (p & 30) === 0 && !MT(v) && (l = jl(a, p), l === 2 && (g = Ec(a), g !== 0 && (p = g, l = Kf(a, g))), l === 1)) throw c = as, qi(a, 0), ti(a, p), Xt(a, Ge()), c;
        switch (a.finishedWork = v, a.finishedLanes = p, l) {
          case 0:
          case 1:
            throw Error(t(345));
          case 2:
            $i(a, Jt, bn);
            break;
          case 3:
            if (ti(a, p), (p & 130023424) === p && (l = jf + 500 - Ge(), 10 < l)) {
              if (Zs(a, 0) !== 0) break;
              if (v = a.suspendedLanes, (v & p) !== p) {
                zt(), a.pingedLanes |= a.suspendedLanes & v;
                break;
              }
              a.timeoutHandle = Zc($i.bind(null, a, Jt, bn), l);
              break;
            }
            $i(a, Jt, bn);
            break;
          case 4:
            if (ti(a, p), (p & 4194240) === p) break;
            for (l = a.eventTimes, v = -1; 0 < p; ) {
              var C = 31 - Mr(p);
              g = 1 << C, C = l[C], C > v && (v = C), p &= ~g;
            }
            if (p = v, p = Ge() - p, p = (120 > p ? 120 : 480 > p ? 480 : 1080 > p ? 1080 : 1920 > p ? 1920 : 3e3 > p ? 3e3 : 4320 > p ? 4320 : 1960 * ET(p / 1960)) - p, 10 < p) {
              a.timeoutHandle = Zc($i.bind(null, a, Jt, bn), p);
              break;
            }
            $i(a, Jt, bn);
            break;
          case 5:
            $i(a, Jt, bn);
            break;
          default:
            throw Error(t(329));
        }
      }
    }
    return Xt(a, Ge()), a.callbackNode === c ? Wm.bind(null, a) : null;
  }
  function Kf(a, l) {
    var c = ss;
    return a.current.memoizedState.isDehydrated && (qi(a, l).flags |= 256), a = jl(a, l), a !== 2 && (l = Jt, Jt = c, l !== null && Qf(l)), a;
  }
  function Qf(a) {
    Jt === null ? Jt = a : Jt.push.apply(Jt, a);
  }
  function MT(a) {
    for (var l = a; ; ) {
      if (l.flags & 16384) {
        var c = l.updateQueue;
        if (c !== null && (c = c.stores, c !== null)) for (var p = 0; p < c.length; p++) {
          var v = c[p], g = v.getSnapshot;
          v = v.value;
          try {
            if (!Or(g(), v)) return !1;
          } catch {
            return !1;
          }
        }
      }
      if (c = l.child, l.subtreeFlags & 16384 && c !== null) c.return = l, l = c;
      else {
        if (l === a) break;
        for (; l.sibling === null; ) {
          if (l.return === null || l.return === a) return !0;
          l = l.return;
        }
        l.sibling.return = l.return, l = l.sibling;
      }
    }
    return !0;
  }
  function ti(a, l) {
    for (l &= ~Uf, l &= ~Fl, a.suspendedLanes |= l, a.pingedLanes &= ~l, a = a.expirationTimes; 0 < l; ) {
      var c = 31 - Mr(l), p = 1 << c;
      a[c] = -1, l &= ~p;
    }
  }
  function Gm(a) {
    if ((Te & 6) !== 0) throw Error(t(327));
    Wo();
    var l = Zs(a, 0);
    if ((l & 1) === 0) return Xt(a, Ge()), null;
    var c = jl(a, l);
    if (a.tag !== 0 && c === 2) {
      var p = Ec(a);
      p !== 0 && (l = p, c = Kf(a, p));
    }
    if (c === 1) throw c = as, qi(a, 0), ti(a, l), Xt(a, Ge()), c;
    if (c === 6) throw Error(t(345));
    return a.finishedWork = a.current.alternate, a.finishedLanes = l, $i(a, Jt, bn), Xt(a, Ge()), null;
  }
  function Jf(a, l) {
    var c = Te;
    Te |= 1;
    try {
      return a(l);
    } finally {
      Te = c, Te === 0 && (jo = Ge() + 500, yl && Kn());
    }
  }
  function Vi(a) {
    Zn !== null && Zn.tag === 0 && (Te & 6) === 0 && Wo();
    var l = Te;
    Te |= 1;
    var c = yr.transition, p = De;
    try {
      if (yr.transition = null, De = 1, a) return a();
    } finally {
      De = p, yr.transition = c, Te = l, (Te & 6) === 0 && Kn();
    }
  }
  function Xf() {
    sr = Uo.current, Be(Uo);
  }
  function qi(a, l) {
    a.finishedWork = null, a.finishedLanes = 0;
    var c = a.timeoutHandle;
    if (c !== -1 && (a.timeoutHandle = -1, nT(c)), Xe !== null) for (c = Xe.return; c !== null; ) {
      var p = c;
      switch (af(p), p.tag) {
        case 1:
          p = p.type.childContextTypes, p != null && ml();
          break;
        case 3:
          Vo(), Be(Gt), Be(Ot), wf();
          break;
        case 5:
          gf(p);
          break;
        case 4:
          Vo();
          break;
        case 13:
          Be(Ve);
          break;
        case 19:
          Be(Ve);
          break;
        case 10:
          df(p.type._context);
          break;
        case 22:
        case 23:
          Xf();
      }
      c = c.return;
    }
    if (ft = a, Xe = a = ri(a.current, null), wt = sr = l, nt = 0, as = null, Uf = Fl = zi = 0, Jt = ss = null, _i !== null) {
      for (l = 0; l < _i.length; l++) if (c = _i[l], p = c.interleaved, p !== null) {
        c.interleaved = null;
        var v = p.next, g = c.pending;
        if (g !== null) {
          var C = g.next;
          g.next = v, p.next = C;
        }
        c.pending = p;
      }
      _i = null;
    }
    return a;
  }
  function Km(a, l) {
    do {
      var c = Xe;
      try {
        if (ff(), Ol.current = Al, Nl) {
          for (var p = qe.memoizedState; p !== null; ) {
            var v = p.queue;
            v !== null && (v.pending = null), p = p.next;
          }
          Nl = !1;
        }
        if (Fi = 0, ct = rt = qe = null, Za = !1, es = 0, $f.current = null, c === null || c.return === null) {
          nt = 1, as = l, Xe = null;
          break;
        }
        e: {
          var g = a, C = c.return, x = c, S = l;
          if (l = wt, x.flags |= 32768, S !== null && typeof S == "object" && typeof S.then == "function") {
            var A = S, z = x, $ = z.tag;
            if ((z.mode & 1) === 0 && ($ === 0 || $ === 11 || $ === 15)) {
              var H = z.alternate;
              H ? (z.updateQueue = H.updateQueue, z.memoizedState = H.memoizedState, z.lanes = H.lanes) : (z.updateQueue = null, z.memoizedState = null);
            }
            var J = wm(C);
            if (J !== null) {
              J.flags &= -257, km(J, C, x, g, l), J.mode & 1 && ym(g, A, l), l = J, S = A;
              var ee = l.updateQueue;
              if (ee === null) {
                var te = /* @__PURE__ */ new Set();
                te.add(S), l.updateQueue = te;
              } else ee.add(S);
              break e;
            } else {
              if ((l & 1) === 0) {
                ym(g, A, l), Yf();
                break e;
              }
              S = Error(t(426));
            }
          } else if (He && x.mode & 1) {
            var Ke = wm(C);
            if (Ke !== null) {
              (Ke.flags & 65536) === 0 && (Ke.flags |= 256), km(Ke, C, x, g, l), uf(qo(S, x));
              break e;
            }
          }
          g = S = qo(S, x), nt !== 4 && (nt = 2), ss === null ? ss = [g] : ss.push(g), g = C;
          do {
            switch (g.tag) {
              case 3:
                g.flags |= 65536, l &= -l, g.lanes |= l;
                var N = mm(g, S, l);
                $v(g, N);
                break e;
              case 1:
                x = S;
                var M = g.type, D = g.stateNode;
                if ((g.flags & 128) === 0 && (typeof M.getDerivedStateFromError == "function" || D !== null && typeof D.componentDidCatch == "function" && (Yn === null || !Yn.has(D)))) {
                  g.flags |= 65536, l &= -l, g.lanes |= l;
                  var U = gm(g, x, l);
                  $v(g, U);
                  break e;
                }
            }
            g = g.return;
          } while (g !== null);
        }
        Xm(c);
      } catch (ie) {
        l = ie, Xe === c && c !== null && (Xe = c = c.return);
        continue;
      }
      break;
    } while (!0);
  }
  function Qm() {
    var a = Hl.current;
    return Hl.current = Al, a === null ? Al : a;
  }
  function Yf() {
    (nt === 0 || nt === 3 || nt === 2) && (nt = 4), ft === null || (zi & 268435455) === 0 && (Fl & 268435455) === 0 || ti(ft, wt);
  }
  function jl(a, l) {
    var c = Te;
    Te |= 2;
    var p = Qm();
    (ft !== a || wt !== l) && (bn = null, qi(a, l));
    do
      try {
        OT();
        break;
      } catch (v) {
        Km(a, v);
      }
    while (!0);
    if (ff(), Te = c, Hl.current = p, Xe !== null) throw Error(t(261));
    return ft = null, wt = 0, nt;
  }
  function OT() {
    for (; Xe !== null; ) Jm(Xe);
  }
  function NT() {
    for (; Xe !== null && !Ph(); ) Jm(Xe);
  }
  function Jm(a) {
    var l = eg(a.alternate, a, sr);
    a.memoizedProps = a.pendingProps, l === null ? Xm(a) : Xe = l, $f.current = null;
  }
  function Xm(a) {
    var l = a;
    do {
      var c = l.alternate;
      if (a = l.return, (l.flags & 32768) === 0) {
        if (c = CT(c, l, sr), c !== null) {
          Xe = c;
          return;
        }
      } else {
        if (c = bT(c, l), c !== null) {
          c.flags &= 32767, Xe = c;
          return;
        }
        if (a !== null) a.flags |= 32768, a.subtreeFlags = 0, a.deletions = null;
        else {
          nt = 6, Xe = null;
          return;
        }
      }
      if (l = l.sibling, l !== null) {
        Xe = l;
        return;
      }
      Xe = l = a;
    } while (l !== null);
    nt === 0 && (nt = 5);
  }
  function $i(a, l, c) {
    var p = De, v = yr.transition;
    try {
      yr.transition = null, De = 1, LT(a, l, c, p);
    } finally {
      yr.transition = v, De = p;
    }
    return null;
  }
  function LT(a, l, c, p) {
    do
      Wo();
    while (Zn !== null);
    if ((Te & 6) !== 0) throw Error(t(327));
    c = a.finishedWork;
    var v = a.finishedLanes;
    if (c === null) return null;
    if (a.finishedWork = null, a.finishedLanes = 0, c === a.current) throw Error(t(177));
    a.callbackNode = null, a.callbackPriority = 0;
    var g = c.lanes | c.childLanes;
    if (cb(a, g), a === ft && (Xe = ft = null, wt = 0), (c.subtreeFlags & 2064) === 0 && (c.flags & 2064) === 0 || Vl || (Vl = !0, tg(Qs, function() {
      return Wo(), null;
    })), g = (c.flags & 15990) !== 0, (c.subtreeFlags & 15990) !== 0 || g) {
      g = yr.transition, yr.transition = null;
      var C = De;
      De = 1;
      var x = Te;
      Te |= 4, $f.current = null, xT(a, c), Vm(c, a), Jb(Xc), rl = !!Jc, Xc = Jc = null, a.current = c, ST(c), tb(), Te = x, De = C, yr.transition = g;
    } else a.current = c;
    if (Vl && (Vl = !1, Zn = a, ql = v), g = a.pendingLanes, g === 0 && (Yn = null), ib(c.stateNode), Xt(a, Ge()), l !== null) for (p = a.onRecoverableError, c = 0; c < l.length; c++) v = l[c], p(v.value, { componentStack: v.stack, digest: v.digest });
    if (zl) throw zl = !1, a = Wf, Wf = null, a;
    return (ql & 1) !== 0 && a.tag !== 0 && Wo(), g = a.pendingLanes, (g & 1) !== 0 ? a === Gf ? ls++ : (ls = 0, Gf = a) : ls = 0, Kn(), null;
  }
  function Wo() {
    if (Zn !== null) {
      var a = Fh(ql), l = yr.transition, c = De;
      try {
        if (yr.transition = null, De = 16 > a ? 16 : a, Zn === null) var p = !1;
        else {
          if (a = Zn, Zn = null, ql = 0, (Te & 6) !== 0) throw Error(t(331));
          var v = Te;
          for (Te |= 4, Z = a.current; Z !== null; ) {
            var g = Z, C = g.child;
            if ((Z.flags & 16) !== 0) {
              var x = g.deletions;
              if (x !== null) {
                for (var S = 0; S < x.length; S++) {
                  var A = x[S];
                  for (Z = A; Z !== null; ) {
                    var z = Z;
                    switch (z.tag) {
                      case 0:
                      case 11:
                      case 15:
                        is(8, z, g);
                    }
                    var $ = z.child;
                    if ($ !== null) $.return = z, Z = $;
                    else for (; Z !== null; ) {
                      z = Z;
                      var H = z.sibling, J = z.return;
                      if (Bm(z), z === A) {
                        Z = null;
                        break;
                      }
                      if (H !== null) {
                        H.return = J, Z = H;
                        break;
                      }
                      Z = J;
                    }
                  }
                }
                var ee = g.alternate;
                if (ee !== null) {
                  var te = ee.child;
                  if (te !== null) {
                    ee.child = null;
                    do {
                      var Ke = te.sibling;
                      te.sibling = null, te = Ke;
                    } while (te !== null);
                  }
                }
                Z = g;
              }
            }
            if ((g.subtreeFlags & 2064) !== 0 && C !== null) C.return = g, Z = C;
            else e: for (; Z !== null; ) {
              if (g = Z, (g.flags & 2048) !== 0) switch (g.tag) {
                case 0:
                case 11:
                case 15:
                  is(9, g, g.return);
              }
              var N = g.sibling;
              if (N !== null) {
                N.return = g.return, Z = N;
                break e;
              }
              Z = g.return;
            }
          }
          var M = a.current;
          for (Z = M; Z !== null; ) {
            C = Z;
            var D = C.child;
            if ((C.subtreeFlags & 2064) !== 0 && D !== null) D.return = C, Z = D;
            else e: for (C = M; Z !== null; ) {
              if (x = Z, (x.flags & 2048) !== 0) try {
                switch (x.tag) {
                  case 0:
                  case 11:
                  case 15:
                    _l(9, x);
                }
              } catch (ie) {
                We(x, x.return, ie);
              }
              if (x === C) {
                Z = null;
                break e;
              }
              var U = x.sibling;
              if (U !== null) {
                U.return = x.return, Z = U;
                break e;
              }
              Z = x.return;
            }
          }
          if (Te = v, Kn(), Ur && typeof Ur.onPostCommitFiberRoot == "function") try {
            Ur.onPostCommitFiberRoot(Js, a);
          } catch {
          }
          p = !0;
        }
        return p;
      } finally {
        De = c, yr.transition = l;
      }
    }
    return !1;
  }
  function Ym(a, l, c) {
    l = qo(c, l), l = mm(a, l, 1), a = Jn(a, l, 1), l = zt(), a !== null && (Da(a, 1, l), Xt(a, l));
  }
  function We(a, l, c) {
    if (a.tag === 3) Ym(a, a, c);
    else for (; l !== null; ) {
      if (l.tag === 3) {
        Ym(l, a, c);
        break;
      } else if (l.tag === 1) {
        var p = l.stateNode;
        if (typeof l.type.getDerivedStateFromError == "function" || typeof p.componentDidCatch == "function" && (Yn === null || !Yn.has(p))) {
          a = qo(c, a), a = gm(l, a, 1), l = Jn(l, a, 1), a = zt(), l !== null && (Da(l, 1, a), Xt(l, a));
          break;
        }
      }
      l = l.return;
    }
  }
  function DT(a, l, c) {
    var p = a.pingCache;
    p !== null && p.delete(l), l = zt(), a.pingedLanes |= a.suspendedLanes & c, ft === a && (wt & c) === c && (nt === 4 || nt === 3 && (wt & 130023424) === wt && 500 > Ge() - jf ? qi(a, 0) : Uf |= c), Xt(a, l);
  }
  function Zm(a, l) {
    l === 0 && ((a.mode & 1) === 0 ? l = 1 : (l = Ys, Ys <<= 1, (Ys & 130023424) === 0 && (Ys = 4194304)));
    var c = zt();
    a = wn(a, l), a !== null && (Da(a, l, c), Xt(a, c));
  }
  function AT(a) {
    var l = a.memoizedState, c = 0;
    l !== null && (c = l.retryLane), Zm(a, c);
  }
  function IT(a, l) {
    var c = 0;
    switch (a.tag) {
      case 13:
        var p = a.stateNode, v = a.memoizedState;
        v !== null && (c = v.retryLane);
        break;
      case 19:
        p = a.stateNode;
        break;
      default:
        throw Error(t(314));
    }
    p !== null && p.delete(l), Zm(a, c);
  }
  var eg;
  eg = function(a, l, c) {
    if (a !== null) if (a.memoizedProps !== l.pendingProps || Gt.current) Qt = !0;
    else {
      if ((a.lanes & c) === 0 && (l.flags & 128) === 0) return Qt = !1, kT(a, l, c);
      Qt = (a.flags & 131072) !== 0;
    }
    else Qt = !1, He && (l.flags & 1048576) !== 0 && Iv(l, kl, l.index);
    switch (l.lanes = 0, l.tag) {
      case 2:
        var p = l.type;
        Pl(a, l), a = l.pendingProps;
        var v = Ro(l, Ot.current);
        zo(l, c), v = bf(null, l, p, a, v, c);
        var g = Tf();
        return l.flags |= 1, typeof v == "object" && v !== null && typeof v.render == "function" && v.$$typeof === void 0 ? (l.tag = 1, l.memoizedState = null, l.updateQueue = null, Kt(p) ? (g = !0, gl(l)) : g = !1, l.memoizedState = v.state !== null && v.state !== void 0 ? v.state : null, vf(l), v.updater = Il, l.stateNode = v, v._reactInternals = l, Nf(l, p, a, c), l = If(null, l, p, !0, g, c)) : (l.tag = 0, He && g && of(l), Ft(null, l, v, c), l = l.child), l;
      case 16:
        p = l.elementType;
        e: {
          switch (Pl(a, l), a = l.pendingProps, v = p._init, p = v(p._payload), l.type = p, v = l.tag = PT(p), a = Lr(p, a), v) {
            case 0:
              l = Af(null, l, p, a, c);
              break e;
            case 1:
              l = Em(null, l, p, a, c);
              break e;
            case 11:
              l = Cm(null, l, p, a, c);
              break e;
            case 14:
              l = bm(null, l, p, Lr(p.type, a), c);
              break e;
          }
          throw Error(t(
            306,
            p,
            ""
          ));
        }
        return l;
      case 0:
        return p = l.type, v = l.pendingProps, v = l.elementType === p ? v : Lr(p, v), Af(a, l, p, v, c);
      case 1:
        return p = l.type, v = l.pendingProps, v = l.elementType === p ? v : Lr(p, v), Em(a, l, p, v, c);
      case 3:
        e: {
          if (Mm(l), a === null) throw Error(t(387));
          p = l.pendingProps, g = l.memoizedState, v = g.element, qv(a, l), El(l, p, null, c);
          var C = l.memoizedState;
          if (p = C.element, g.isDehydrated) if (g = { element: p, isDehydrated: !1, cache: C.cache, pendingSuspenseBoundaries: C.pendingSuspenseBoundaries, transitions: C.transitions }, l.updateQueue.baseState = g, l.memoizedState = g, l.flags & 256) {
            v = qo(Error(t(423)), l), l = Om(a, l, p, c, v);
            break e;
          } else if (p !== v) {
            v = qo(Error(t(424)), l), l = Om(a, l, p, c, v);
            break e;
          } else for (ar = jn(l.stateNode.containerInfo.firstChild), or = l, He = !0, Nr = null, c = zv(l, null, p, c), l.child = c; c; ) c.flags = c.flags & -3 | 4096, c = c.sibling;
          else {
            if (_o(), p === v) {
              l = Cn(a, l, c);
              break e;
            }
            Ft(a, l, p, c);
          }
          l = l.child;
        }
        return l;
      case 5:
        return jv(l), a === null && lf(l), p = l.type, v = l.pendingProps, g = a !== null ? a.memoizedProps : null, C = v.children, Yc(p, v) ? C = null : g !== null && Yc(p, g) && (l.flags |= 32), Sm(a, l), Ft(a, l, C, c), l.child;
      case 6:
        return a === null && lf(l), null;
      case 13:
        return Nm(a, l, c);
      case 4:
        return mf(l, l.stateNode.containerInfo), p = l.pendingProps, a === null ? l.child = Ho(l, null, p, c) : Ft(a, l, p, c), l.child;
      case 11:
        return p = l.type, v = l.pendingProps, v = l.elementType === p ? v : Lr(p, v), Cm(a, l, p, v, c);
      case 7:
        return Ft(a, l, l.pendingProps, c), l.child;
      case 8:
        return Ft(a, l, l.pendingProps.children, c), l.child;
      case 12:
        return Ft(a, l, l.pendingProps.children, c), l.child;
      case 10:
        e: {
          if (p = l.type._context, v = l.pendingProps, g = l.memoizedProps, C = v.value, Ie(Tl, p._currentValue), p._currentValue = C, g !== null) if (Or(g.value, C)) {
            if (g.children === v.children && !Gt.current) {
              l = Cn(a, l, c);
              break e;
            }
          } else for (g = l.child, g !== null && (g.return = l); g !== null; ) {
            var x = g.dependencies;
            if (x !== null) {
              C = g.child;
              for (var S = x.firstContext; S !== null; ) {
                if (S.context === p) {
                  if (g.tag === 1) {
                    S = kn(-1, c & -c), S.tag = 2;
                    var A = g.updateQueue;
                    if (A !== null) {
                      A = A.shared;
                      var z = A.pending;
                      z === null ? S.next = S : (S.next = z.next, z.next = S), A.pending = S;
                    }
                  }
                  g.lanes |= c, S = g.alternate, S !== null && (S.lanes |= c), pf(
                    g.return,
                    c,
                    l
                  ), x.lanes |= c;
                  break;
                }
                S = S.next;
              }
            } else if (g.tag === 10) C = g.type === l.type ? null : g.child;
            else if (g.tag === 18) {
              if (C = g.return, C === null) throw Error(t(341));
              C.lanes |= c, x = C.alternate, x !== null && (x.lanes |= c), pf(C, c, l), C = g.sibling;
            } else C = g.child;
            if (C !== null) C.return = g;
            else for (C = g; C !== null; ) {
              if (C === l) {
                C = null;
                break;
              }
              if (g = C.sibling, g !== null) {
                g.return = C.return, C = g;
                break;
              }
              C = C.return;
            }
            g = C;
          }
          Ft(a, l, v.children, c), l = l.child;
        }
        return l;
      case 9:
        return v = l.type, p = l.pendingProps.children, zo(l, c), v = mr(v), p = p(v), l.flags |= 1, Ft(a, l, p, c), l.child;
      case 14:
        return p = l.type, v = Lr(p, l.pendingProps), v = Lr(p.type, v), bm(a, l, p, v, c);
      case 15:
        return Tm(a, l, l.type, l.pendingProps, c);
      case 17:
        return p = l.type, v = l.pendingProps, v = l.elementType === p ? v : Lr(p, v), Pl(a, l), l.tag = 1, Kt(p) ? (a = !0, gl(l)) : a = !1, zo(l, c), hm(l, p, v), Nf(l, p, v, c), If(null, l, p, !0, a, c);
      case 19:
        return Dm(a, l, c);
      case 22:
        return xm(a, l, c);
    }
    throw Error(t(156, l.tag));
  };
  function tg(a, l) {
    return Na(a, l);
  }
  function RT(a, l, c, p) {
    this.tag = a, 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 = p, this.subtreeFlags = this.flags = 0, this.deletions = null, this.childLanes = this.lanes = 0, this.alternate = null;
  }
  function wr(a, l, c, p) {
    return new RT(a, l, c, p);
  }
  function Zf(a) {
    return a = a.prototype, !(!a || !a.isReactComponent);
  }
  function PT(a) {
    if (typeof a == "function") return Zf(a) ? 1 : 0;
    if (a != null) {
      if (a = a.$$typeof, a === ze) return 11;
      if (a === jt) return 14;
    }
    return 2;
  }
  function ri(a, l) {
    var c = a.alternate;
    return c === null ? (c = wr(a.tag, l, a.key, a.mode), c.elementType = a.elementType, c.type = a.type, c.stateNode = a.stateNode, c.alternate = a, a.alternate = c) : (c.pendingProps = l, c.type = a.type, c.flags = 0, c.subtreeFlags = 0, c.deletions = null), c.flags = a.flags & 14680064, c.childLanes = a.childLanes, c.lanes = a.lanes, c.child = a.child, c.memoizedProps = a.memoizedProps, c.memoizedState = a.memoizedState, c.updateQueue = a.updateQueue, l = a.dependencies, c.dependencies = l === null ? null : { lanes: l.lanes, firstContext: l.firstContext }, c.sibling = a.sibling, c.index = a.index, c.ref = a.ref, c;
  }
  function Wl(a, l, c, p, v, g) {
    var C = 2;
    if (p = a, typeof a == "function") Zf(a) && (C = 1);
    else if (typeof a == "string") C = 5;
    else e: switch (a) {
      case q:
        return Ui(c.children, v, g, l);
      case K:
        C = 8, v |= 8;
        break;
      case ce:
        return a = wr(12, c, l, v | 2), a.elementType = ce, a.lanes = g, a;
      case st:
        return a = wr(13, c, l, v), a.elementType = st, a.lanes = g, a;
      case je:
        return a = wr(19, c, l, v), a.elementType = je, a.lanes = g, a;
      case _e:
        return Gl(c, v, g, l);
      default:
        if (typeof a == "object" && a !== null) switch (a.$$typeof) {
          case be:
            C = 10;
            break e;
          case Re:
            C = 9;
            break e;
          case ze:
            C = 11;
            break e;
          case jt:
            C = 14;
            break e;
          case lt:
            C = 16, p = null;
            break e;
        }
        throw Error(t(130, a == null ? a : typeof a, ""));
    }
    return l = wr(C, c, l, v), l.elementType = a, l.type = p, l.lanes = g, l;
  }
  function Ui(a, l, c, p) {
    return a = wr(7, a, p, l), a.lanes = c, a;
  }
  function Gl(a, l, c, p) {
    return a = wr(22, a, p, l), a.elementType = _e, a.lanes = c, a.stateNode = { isHidden: !1 }, a;
  }
  function ed(a, l, c) {
    return a = wr(6, a, null, l), a.lanes = c, a;
  }
  function td(a, l, c) {
    return l = wr(4, a.children !== null ? a.children : [], a.key, l), l.lanes = c, l.stateNode = { containerInfo: a.containerInfo, pendingChildren: null, implementation: a.implementation }, l;
  }
  function BT(a, l, c, p, v) {
    this.tag = l, this.containerInfo = a, this.finishedWork = this.pingCache = this.current = this.pendingChildren = null, this.timeoutHandle = -1, this.callbackNode = this.pendingContext = this.context = null, this.callbackPriority = 0, this.eventTimes = Mc(0), this.expirationTimes = Mc(-1), this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0, this.entanglements = Mc(0), this.identifierPrefix = p, this.onRecoverableError = v, this.mutableSourceEagerHydrationData = null;
  }
  function rd(a, l, c, p, v, g, C, x, S) {
    return a = new BT(a, l, c, x, S), l === 1 ? (l = 1, g === !0 && (l |= 8)) : l = 0, g = wr(3, null, null, l), a.current = g, g.stateNode = a, g.memoizedState = { element: p, isDehydrated: c, cache: null, transitions: null, pendingSuspenseBoundaries: null }, vf(g), a;
  }
  function _T(a, l, c) {
    var p = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
    return { $$typeof: W, key: p == null ? null : "" + p, children: a, containerInfo: l, implementation: c };
  }
  function rg(a) {
    if (!a) return Gn;
    a = a._reactInternals;
    e: {
      if (ye(a) !== a || a.tag !== 1) throw Error(t(170));
      var l = a;
      do {
        switch (l.tag) {
          case 3:
            l = l.stateNode.context;
            break e;
          case 1:
            if (Kt(l.type)) {
              l = l.stateNode.__reactInternalMemoizedMergedChildContext;
              break e;
            }
        }
        l = l.return;
      } while (l !== null);
      throw Error(t(171));
    }
    if (a.tag === 1) {
      var c = a.type;
      if (Kt(c)) return Lv(a, c, l);
    }
    return l;
  }
  function ng(a, l, c, p, v, g, C, x, S) {
    return a = rd(c, p, !0, a, v, g, C, x, S), a.context = rg(null), c = a.current, p = zt(), v = ei(c), g = kn(p, v), g.callback = l ?? null, Jn(c, g, v), a.current.lanes = v, Da(a, v, p), Xt(a, p), a;
  }
  function Kl(a, l, c, p) {
    var v = l.current, g = zt(), C = ei(v);
    return c = rg(c), l.context === null ? l.context = c : l.pendingContext = c, l = kn(g, C), l.payload = { element: a }, p = p === void 0 ? null : p, p !== null && (l.callback = p), a = Jn(v, l, C), a !== null && (Ir(a, v, C, g), Sl(a, v, C)), C;
  }
  function Ql(a) {
    return a = a.current, a.child ? (a.child.tag === 5, a.child.stateNode) : null;
  }
  function ig(a, l) {
    if (a = a.memoizedState, a !== null && a.dehydrated !== null) {
      var c = a.retryLane;
      a.retryLane = c !== 0 && c < l ? c : l;
    }
  }
  function nd(a, l) {
    ig(a, l), (a = a.alternate) && ig(a, l);
  }
  function HT() {
    return null;
  }
  var og = typeof reportError == "function" ? reportError : function(a) {
    console.error(a);
  };
  function id(a) {
    this._internalRoot = a;
  }
  Jl.prototype.render = id.prototype.render = function(a) {
    var l = this._internalRoot;
    if (l === null) throw Error(t(409));
    Kl(a, l, null, null);
  }, Jl.prototype.unmount = id.prototype.unmount = function() {
    var a = this._internalRoot;
    if (a !== null) {
      this._internalRoot = null;
      var l = a.containerInfo;
      Vi(function() {
        Kl(null, a, null, null);
      }), l[vn] = null;
    }
  };
  function Jl(a) {
    this._internalRoot = a;
  }
  Jl.prototype.unstable_scheduleHydration = function(a) {
    if (a) {
      var l = qh();
      a = { blockedOn: null, target: a, priority: l };
      for (var c = 0; c < qn.length && l !== 0 && l < qn[c].priority; c++) ;
      qn.splice(c, 0, a), c === 0 && jh(a);
    }
  };
  function od(a) {
    return !(!a || a.nodeType !== 1 && a.nodeType !== 9 && a.nodeType !== 11);
  }
  function Xl(a) {
    return !(!a || a.nodeType !== 1 && a.nodeType !== 9 && a.nodeType !== 11 && (a.nodeType !== 8 || a.nodeValue !== " react-mount-point-unstable "));
  }
  function ag() {
  }
  function FT(a, l, c, p, v) {
    if (v) {
      if (typeof p == "function") {
        var g = p;
        p = function() {
          var A = Ql(C);
          g.call(A);
        };
      }
      var C = ng(l, p, a, 0, null, !1, !1, "", ag);
      return a._reactRootContainer = C, a[vn] = C.current, ja(a.nodeType === 8 ? a.parentNode : a), Vi(), C;
    }
    for (; v = a.lastChild; ) a.removeChild(v);
    if (typeof p == "function") {
      var x = p;
      p = function() {
        var A = Ql(S);
        x.call(A);
      };
    }
    var S = rd(a, 0, !1, null, null, !1, !1, "", ag);
    return a._reactRootContainer = S, a[vn] = S.current, ja(a.nodeType === 8 ? a.parentNode : a), Vi(function() {
      Kl(l, S, c, p);
    }), S;
  }
  function Yl(a, l, c, p, v) {
    var g = c._reactRootContainer;
    if (g) {
      var C = g;
      if (typeof v == "function") {
        var x = v;
        v = function() {
          var S = Ql(C);
          x.call(S);
        };
      }
      Kl(l, C, a, v);
    } else C = FT(c, l, a, v, p);
    return Ql(C);
  }
  zh = function(a) {
    switch (a.tag) {
      case 3:
        var l = a.stateNode;
        if (l.current.memoizedState.isDehydrated) {
          var c = La(l.pendingLanes);
          c !== 0 && (Oc(l, c | 1), Xt(l, Ge()), (Te & 6) === 0 && (jo = Ge() + 500, Kn()));
        }
        break;
      case 13:
        Vi(function() {
          var p = wn(a, 1);
          if (p !== null) {
            var v = zt();
            Ir(p, a, 1, v);
          }
        }), nd(a, 1);
    }
  }, Nc = function(a) {
    if (a.tag === 13) {
      var l = wn(a, 134217728);
      if (l !== null) {
        var c = zt();
        Ir(l, a, 134217728, c);
      }
      nd(a, 134217728);
    }
  }, Vh = function(a) {
    if (a.tag === 13) {
      var l = ei(a), c = wn(a, l);
      if (c !== null) {
        var p = zt();
        Ir(c, a, l, p);
      }
      nd(a, l);
    }
  }, qh = function() {
    return De;
  }, $h = function(a, l) {
    var c = De;
    try {
      return De = a, l();
    } finally {
      De = c;
    }
  }, Ni = function(a, l, c) {
    switch (l) {
      case "input":
        if (go(a, c), l = c.name, c.type === "radio" && l != null) {
          for (c = a; c.parentNode; ) c = c.parentNode;
          for (c = c.querySelectorAll("input[name=" + JSON.stringify("" + l) + '][type="radio"]'), l = 0; l < c.length; l++) {
            var p = c[l];
            if (p !== a && p.form === a.form) {
              var v = vl(p);
              if (!v) throw Error(t(90));
              an(p), go(p, v);
            }
          }
        }
        break;
      case "textarea":
        ba(a, c);
        break;
      case "select":
        l = c.value, l != null && fr(a, !!c.multiple, l, !1);
    }
  }, dr = Jf, Ma = Vi;
  var zT = { usingClientEntryPoint: !1, Events: [Ka, Ao, vl, bo, Ws, Jf] }, us = { findFiberByHostInstance: Ii, bundleType: 0, version: "18.3.1", rendererPackageName: "react-dom" }, VT = { bundleType: us.bundleType, version: us.version, rendererPackageName: us.rendererPackageName, rendererConfig: us.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, overrideProps: null, overridePropsDeletePath: null, overridePropsRenamePath: null, setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, currentDispatcherRef: _.ReactCurrentDispatcher, findHostInstanceByFiber: function(a) {
    return a = pr(a), a === null ? null : a.stateNode;
  }, findFiberByHostInstance: us.findFiberByHostInstance || HT, 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 Zl = __REACT_DEVTOOLS_GLOBAL_HOOK__;
    if (!Zl.isDisabled && Zl.supportsFiber) try {
      Js = Zl.inject(VT), Ur = Zl;
    } catch {
    }
  }
  return Yt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = zT, Yt.createPortal = function(a, l) {
    var c = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
    if (!od(l)) throw Error(t(200));
    return _T(a, l, null, c);
  }, Yt.createRoot = function(a, l) {
    if (!od(a)) throw Error(t(299));
    var c = !1, p = "", v = og;
    return l != null && (l.unstable_strictMode === !0 && (c = !0), l.identifierPrefix !== void 0 && (p = l.identifierPrefix), l.onRecoverableError !== void 0 && (v = l.onRecoverableError)), l = rd(a, 1, !1, null, null, c, !1, p, v), a[vn] = l.current, ja(a.nodeType === 8 ? a.parentNode : a), new id(l);
  }, Yt.findDOMNode = function(a) {
    if (a == null) return null;
    if (a.nodeType === 1) return a;
    var l = a._reactInternals;
    if (l === void 0)
      throw typeof a.render == "function" ? Error(t(188)) : (a = Object.keys(a).join(","), Error(t(268, a)));
    return a = pr(l), a = a === null ? null : a.stateNode, a;
  }, Yt.flushSync = function(a) {
    return Vi(a);
  }, Yt.hydrate = function(a, l, c) {
    if (!Xl(l)) throw Error(t(200));
    return Yl(null, a, l, !0, c);
  }, Yt.hydrateRoot = function(a, l, c) {
    if (!od(a)) throw Error(t(405));
    var p = c != null && c.hydratedSources || null, v = !1, g = "", C = og;
    if (c != null && (c.unstable_strictMode === !0 && (v = !0), c.identifierPrefix !== void 0 && (g = c.identifierPrefix), c.onRecoverableError !== void 0 && (C = c.onRecoverableError)), l = ng(l, null, a, 1, c ?? null, v, !1, g, C), a[vn] = l.current, ja(a), p) for (a = 0; a < p.length; a++) c = p[a], v = c._getVersion, v = v(c._source), l.mutableSourceEagerHydrationData == null ? l.mutableSourceEagerHydrationData = [c, v] : l.mutableSourceEagerHydrationData.push(
      c,
      v
    );
    return new Jl(l);
  }, Yt.render = function(a, l, c) {
    if (!Xl(l)) throw Error(t(200));
    return Yl(null, a, l, !1, c);
  }, Yt.unmountComponentAtNode = function(a) {
    if (!Xl(a)) throw Error(t(40));
    return a._reactRootContainer ? (Vi(function() {
      Yl(null, null, a, !1, function() {
        a._reactRootContainer = null, a[vn] = null;
      });
    }), !0) : !1;
  }, Yt.unstable_batchedUpdates = Jf, Yt.unstable_renderSubtreeIntoContainer = function(a, l, c, p) {
    if (!Xl(c)) throw Error(t(200));
    if (a == null || a._reactInternals === void 0) throw Error(t(38));
    return Yl(a, l, c, !1, p);
  }, Yt.version = "18.3.1-next-f1338f8080-20240426", Yt;
}
var hg;
function QT() {
  if (hg) return ld.exports;
  hg = 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(), ld.exports = KT(), ld.exports;
}
var vg;
function JT() {
  if (vg) return eu;
  vg = 1;
  var r = QT();
  return eu.createRoot = r.createRoot, eu.hydrateRoot = r.hydrateRoot, eu;
}
var XT = JT();
function kt(r) {
  this.content = r;
}
kt.prototype = {
  constructor: kt,
  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), o = n.content.slice();
    return i == -1 ? o.push(t || r, e) : (o[i + 1] = e, t && (o[i] = t)), new kt(o);
  },
  // :: (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 kt(t);
  },
  // :: (string, any) → OrderedMap
  // Add a new key to the start of the map.
  addToStart: function(r, e) {
    return new kt([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 kt(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(), o = n.find(r);
    return i.splice(o == -1 ? i.length : o, 0, e, t), new kt(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 = kt.from(r), r.size ? new kt(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 = kt.from(r), r.size ? new kt(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 = kt.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;
  }
};
kt.from = function(r) {
  if (r instanceof kt) return r;
  var e = [];
  if (r) for (var t in r) e.push(t, r[t]);
  return new kt(e);
};
function A0(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), o = e.child(n);
    if (i == o) {
      t += i.nodeSize;
      continue;
    }
    if (!i.sameMarkup(o))
      return t;
    if (i.isText && i.text != o.text) {
      for (let s = 0; i.text[s] == o.text[s]; s++)
        t++;
      return t;
    }
    if (i.content.size || o.content.size) {
      let s = A0(i.content, o.content, t + 1);
      if (s != null)
        return s;
    }
    t += i.nodeSize;
  }
}
function I0(r, e, t, n) {
  for (let i = r.childCount, o = e.childCount; ; ) {
    if (i == 0 || o == 0)
      return i == o ? null : { a: t, b: n };
    let s = r.child(--i), u = e.child(--o), 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 d = 0, h = Math.min(s.text.length, u.text.length);
      for (; d < h && s.text[s.text.length - d - 1] == u.text[u.text.length - d - 1]; )
        d++, t--, n--;
      return { a: t, b: n };
    }
    if (s.content.size || u.content.size) {
      let d = I0(s.content, u.content, t - 1, n - 1);
      if (d)
        return d;
    }
    t -= f, n -= f;
  }
}
class F {
  /**
  @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, o) {
    for (let s = 0, u = 0; u < t; s++) {
      let f = this.content[s], d = u + f.nodeSize;
      if (d > e && n(f, i + u, o || null, s) !== !1 && f.content.size) {
        let h = u + 1;
        f.nodesBetween(Math.max(0, e - h), Math.min(f.content.size, t - h), n, i + h);
      }
      u = d;
    }
  }
  /**
  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 o = "", s = !0;
    return this.nodesBetween(e, t, (u, f) => {
      let d = 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 && d || u.isTextblock) && n && (s ? s = !1 : o += n), o += d;
    }, 0), o;
  }
  /**
  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(), o = 0;
    for (t.isText && t.sameMarkup(n) && (i[i.length - 1] = t.withText(t.text + n.text), o = 1); o < e.content.length; o++)
      i.push(e.content[o]);
    return new F(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 o = 0, s = 0; s < t; o++) {
        let u = this.content[o], 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 F(n, i);
  }
  /**
  @internal
  */
  cutByIndex(e, t) {
    return e == t ? F.empty : e == 0 && t == this.content.length ? this : new F(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(), o = this.size + t.nodeSize - n.nodeSize;
    return i[e] = t, new F(i, o);
  }
  /**
  Create a new fragment by prepending the given node to this
  fragment.
  */
  addToStart(e) {
    return new F([e].concat(this.content), this.size + e.nodeSize);
  }
  /**
  Create a new fragment by appending the given node to this
  fragment.
  */
  addToEnd(e) {
    return new F(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 A0(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 I0(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 tu(0, e);
    if (e == this.size)
      return tu(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), o = n + i.nodeSize;
      if (o >= e)
        return o == e ? tu(t + 1, o) : tu(t, n);
      n = o;
    }
  }
  /**
  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 F.empty;
    if (!Array.isArray(t))
      throw new RangeError("Invalid input for Fragment.fromJSON");
    return new F(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 F.empty;
    let t, n = 0;
    for (let i = 0; i < e.length; i++) {
      let o = e[i];
      n += o.nodeSize, i && o.isText && e[i - 1].sameMarkup(o) ? (t || (t = e.slice(0, i)), t[t.length - 1] = o.withText(t[t.length - 1].text + o.text)) : t && t.push(o);
    }
    return new F(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 F.empty;
    if (e instanceof F)
      return e;
    if (Array.isArray(e))
      return this.fromArray(e);
    if (e.attrs)
      return new F([e], e.nodeSize);
    throw new RangeError("Can not convert " + e + " to a Fragment" + (e.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
  }
}
F.empty = new F([], 0);
const fd = { index: 0, offset: 0 };
function tu(r, e) {
  return fd.index = r, fd.offset = e, fd;
}
function Mu(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 (!Mu(r[n], e[n]))
        return !1;
  } else {
    for (let n in r)
      if (!(n in e) || !Mu(r[n], e[n]))
        return !1;
    for (let n in e)
      if (!(n in r))
        return !1;
  }
  return !0;
}
let Ne = class Xd {
  /**
  @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 o = e[i];
      if (this.eq(o))
        return e;
      if (this.type.excludes(o.type))
        t || (t = e.slice(0, i));
      else {
        if (o.type.excludes(this.type))
          return e;
        !n && o.type.rank > this.type.rank && (t || (t = e.slice(0, i)), t.push(this), n = !0), t && t.push(o);
      }
    }
    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 && Mu(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 Xd.none;
    if (e instanceof Xd)
      return [e];
    let t = e.slice();
    return t.sort((n, i) => n.type.rank - i.type.rank), t;
  }
};
Ne.none = [];
class Ou extends Error {
}
class Q {
  /**
  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 = P0(this.content, e + this.openStart, t);
    return n && new Q(n, this.openStart, this.openEnd);
  }
  /**
  @internal
  */
  removeBetween(e, t) {
    return new Q(R0(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 Q.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 Q(F.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 o = e.firstChild; o && !o.isLeaf && (t || !o.type.spec.isolating); o = o.firstChild)
      n++;
    for (let o = e.lastChild; o && !o.isLeaf && (t || !o.type.spec.isolating); o = o.lastChild)
      i++;
    return new Q(e, n, i);
  }
}
Q.empty = new Q(F.empty, 0, 0);
function R0(r, e, t) {
  let { index: n, offset: i } = r.findIndex(e), o = r.maybeChild(n), { index: s, offset: u } = r.findIndex(t);
  if (i == e || o.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, o.copy(R0(o.content, e - i - 1, t - i - 1)));
}
function P0(r, e, t, n) {
  let { index: i, offset: o } = r.findIndex(e), s = r.maybeChild(i);
  if (o == e || s.isText)
    return n && !n.canReplace(i, i, t) ? null : r.cut(0, e).append(t).append(r.cut(e));
  let u = P0(s.content, e - o - 1, t, s);
  return u && r.replaceChild(i, s.copy(u));
}
function YT(r, e, t) {
  if (t.openStart > r.depth)
    throw new Ou("Inserted content deeper than insertion position");
  if (r.depth - t.openStart != e.depth - t.openEnd)
    throw new Ou("Inconsistent open depths");
  return B0(r, e, t, 0);
}
function B0(r, e, t, n) {
  let i = r.index(n), o = r.node(n);
  if (i == e.index(n) && n < r.depth - t.openStart) {
    let s = B0(r, e, t, n + 1);
    return o.copy(o.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 to(s, u.cut(0, r.parentOffset).append(t.content).append(u.cut(e.parentOffset)));
    } else {
      let { start: s, end: u } = ZT(t, r);
      return to(o, H0(r, s, u, e, n));
    }
  else return to(o, Nu(r, e, n));
}
function _0(r, e) {
  if (!e.type.compatibleContent(r.type))
    throw new Ou("Cannot join " + e.type.name + " onto " + r.type.name);
}
function Yd(r, e, t) {
  let n = r.node(t);
  return _0(n, e.node(t)), n;
}
function eo(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 Ts(r, e, t, n) {
  let i = (e || r).node(t), o = 0, s = e ? e.index(t) : i.childCount;
  r && (o = r.index(t), r.depth > t ? o++ : r.textOffset && (eo(r.nodeAfter, n), o++));
  for (let u = o; u < s; u++)
    eo(i.child(u), n);
  e && e.depth == t && e.textOffset && eo(e.nodeBefore, n);
}
function to(r, e) {
  return r.type.checkContent(e), r.copy(e);
}
function H0(r, e, t, n, i) {
  let o = r.depth > i && Yd(r, e, i + 1), s = n.depth > i && Yd(t, n, i + 1), u = [];
  return Ts(null, r, i, u), o && s && e.index(i) == t.index(i) ? (_0(o, s), eo(to(o, H0(r, e, t, n, i + 1)), u)) : (o && eo(to(o, Nu(r, e, i + 1)), u), Ts(e, t, i, u), s && eo(to(s, Nu(t, n, i + 1)), u)), Ts(n, null, i, u), new F(u);
}
function Nu(r, e, t) {
  let n = [];
  if (Ts(null, r, t, n), r.depth > t) {
    let i = Yd(r, e, t + 1);
    eo(to(i, Nu(r, e, t + 1)), n);
  }
  return Ts(e, null, t, n), new F(n);
}
function ZT(r, e) {
  let t = e.depth - r.openStart, i = e.node(t).copy(r.content);
  for (let o = t - 1; o >= 0; o--)
    i = e.node(o).copy(F.from(i));
  return {
    start: i.resolveNoCache(r.openStart + t),
    end: i.resolveNoCache(i.content.size - r.openEnd - t)
  };
}
class Ns {
  /**
  @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 o = 0; o < e; o++)
      i += n.child(o).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 Ne.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 o = n.marks;
    for (var s = 0; s < o.length; s++)
      o[s].type.spec.inclusive === !1 && (!i || !o[s].isInSet(i.marks)) && (o = o[s--].removeFromSet(o));
    return o;
  }
  /**
  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 o = 0; o < n.length; o++)
      n[o].type.spec.inclusive === !1 && (!i || !n[o].isInSet(i.marks)) && (n = n[o--].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 Lu(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, o = t;
    for (let s = e; ; ) {
      let { index: u, offset: f } = s.content.findIndex(o), d = o - f;
      if (n.push(s, u, i + f), !d || (s = s.child(u), s.isText))
        break;
      o = d - 1, i += f + 1;
    }
    return new Ns(t, n, o);
  }
  /**
  @internal
  */
  static resolveCached(e, t) {
    let n = mg.get(e);
    if (n)
      for (let o = 0; o < n.elts.length; o++) {
        let s = n.elts[o];
        if (s.pos == t)
          return s;
      }
    else
      mg.set(e, n = new ex());
    let i = n.elts[n.i] = Ns.resolve(e, t);
    return n.i = (n.i + 1) % tx, i;
  }
}
class ex {
  constructor() {
    this.elts = [], this.i = 0;
  }
}
const tx = 12, mg = /* @__PURE__ */ new WeakMap();
class Lu {
  /**
  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 rx = /* @__PURE__ */ Object.create(null);
let pi = class Zd {
  /**
  @internal
  */
  constructor(e, t, n, i = Ne.none) {
    this.type = e, this.attrs = t, this.marks = i, this.content = n || F.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 && Mu(this.attrs, t || e.defaultAttrs || rx) && Ne.sameSet(this.marks, n || Ne.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 Zd(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 Zd(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 Q.empty;
    let i = this.resolve(e), o = this.resolve(t), s = n ? 0 : i.sharedDepth(t), u = i.start(s), d = i.node(s).content.cut(i.pos - u, o.pos - u);
    return new Q(d, i.depth - s, o.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 YT(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 Ns.resolveCached(this, e);
  }
  /**
  @internal
  */
  resolveNoCache(e) {
    return Ns.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, (o) => (n.isInSet(o.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() + ")"), F0(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 = F.empty, i = 0, o = n.childCount) {
    let s = this.contentMatchAt(e).matchFragment(n, i, o), u = s && s.matchFragment(this.content, t);
    if (!u || !u.validEnd)
      return !1;
    for (let f = i; f < o; 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 o = this.contentMatchAt(e).matchType(n), s = o && o.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 = Ne.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 (!Ne.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 = F.fromJSON(e, t.content), o = e.nodeType(t.type).create(t.attrs, i, n);
    return o.type.checkAttrs(o.attrs), o;
  }
};
pi.prototype.text = void 0;
class Du extends pi {
  /**
  @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) : F0(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 Du(this.type, this.attrs, this.text, e);
  }
  withText(e) {
    return e == this.text ? this : new Du(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 F0(r, e) {
  for (let t = r.length - 1; t >= 0; t--)
    e = r[t].type.name + "(" + e + ")";
  return e;
}
class oo {
  /**
  @internal
  */
  constructor(e) {
    this.validEnd = e, this.next = [], this.wrapCache = [];
  }
  /**
  @internal
  */
  static parse(e, t) {
    let n = new nx(e, t);
    if (n.next == null)
      return oo.empty;
    let i = z0(n);
    n.next && n.err("Unexpected trailing text");
    let o = cx(ux(i));
    return fx(o, n), o;
  }
  /**
  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 o = t; i && o < n; o++)
      i = i.matchType(e.child(o).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 o(s, u) {
      let f = s.matchFragment(e, n);
      if (f && (!t || f.validEnd))
        return F.from(u.map((d) => d.createAndFill()));
      for (let d = 0; d < s.next.length; d++) {
        let { type: h, next: m } = s.next[d];
        if (!(h.isText || h.hasRequiredAttrs()) && i.indexOf(m) == -1) {
          i.push(m);
          let y = o(m, u.concat(h));
          if (y)
            return y;
        }
      }
      return null;
    }
    return o(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(), o = i.match;
      if (o.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 < o.next.length; s++) {
        let { type: u, next: f } = o.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 o = i + (n.validEnd ? "*" : " ") + " ";
      for (let s = 0; s < n.next.length; s++)
        o += (s ? ", " : "") + n.next[s].type.name + "->" + e.indexOf(n.next[s].next);
      return o;
    }).join(`
`);
  }
}
oo.empty = new oo(!0);
class nx {
  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 z0(r) {
  let e = [];
  do
    e.push(ix(r));
  while (r.eat("|"));
  return e.length == 1 ? e[0] : { type: "choice", exprs: e };
}
function ix(r) {
  let e = [];
  do
    e.push(ox(r));
  while (r.next && r.next != ")" && r.next != "|");
  return e.length == 1 ? e[0] : { type: "seq", exprs: e };
}
function ox(r) {
  let e = lx(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 = ax(r, e);
    else
      break;
  return e;
}
function gg(r) {
  /\D/.test(r.next) && r.err("Expected number, got '" + r.next + "'");
  let e = Number(r.next);
  return r.pos++, e;
}
function ax(r, e) {
  let t = gg(r), n = t;
  return r.eat(",") && (r.next != "}" ? n = gg(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: t, max: n, expr: e };
}
function sx(r, e) {
  let t = r.nodeTypes, n = t[e];
  if (n)
    return [n];
  let i = [];
  for (let o in t) {
    let s = t[o];
    s.isInGroup(e) && i.push(s);
  }
  return i.length == 0 && r.err("No node type or group '" + e + "' found"), i;
}
function lx(r) {
  if (r.eat("(")) {
    let e = z0(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 = sx(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 ux(r) {
  let e = [[]];
  return i(o(r, 0), t()), e;
  function t() {
    return e.push([]) - 1;
  }
  function n(s, u, f) {
    let d = { term: f, to: u };
    return e[s].push(d), d;
  }
  function i(s, u) {
    s.forEach((f) => f.to = u);
  }
  function o(s, u) {
    if (s.type == "choice")
      return s.exprs.reduce((f, d) => f.concat(o(d, u)), []);
    if (s.type == "seq")
      for (let f = 0; ; f++) {
        let d = o(s.exprs[f], u);
        if (f == s.exprs.length - 1)
          return d;
        i(d, u = t());
      }
    else if (s.type == "star") {
      let f = t();
      return n(u, f), i(o(s.expr, f), f), [n(f)];
    } else if (s.type == "plus") {
      let f = t();
      return i(o(s.expr, u), f), i(o(s.expr, f), f), [n(f)];
    } else {
      if (s.type == "opt")
        return [n(u)].concat(o(s.expr, u));
      if (s.type == "range") {
        let f = u;
        for (let d = 0; d < s.min; d++) {
          let h = t();
          i(o(s.expr, f), h), f = h;
        }
        if (s.max == -1)
          i(o(s.expr, f), f);
        else
          for (let d = s.min; d < s.max; d++) {
            let h = t();
            n(f, h), i(o(s.expr, f), h), f = h;
          }
        return [n(f)];
      } else {
        if (s.type == "name")
          return [n(u, void 0, s.value)];
        throw new Error("Unknown expr type");
      }
    }
  }
}
function V0(r, e) {
  return e - r;
}
function yg(r, e) {
  let t = [];
  return n(e), t.sort(V0);
  function n(i) {
    let o = r[i];
    if (o.length == 1 && !o[0].term)
      return n(o[0].to);
    t.push(i);
    for (let s = 0; s < o.length; s++) {
      let { term: u, to: f } = o[s];
      !u && t.indexOf(f) == -1 && n(f);
    }
  }
}
function cx(r) {
  let e = /* @__PURE__ */ Object.create(null);
  return t(yg(r, 0));
  function t(n) {
    let i = [];
    n.forEach((s) => {
      r[s].forEach(({ term: u, to: f }) => {
        if (!u)
          return;
        let d;
        for (let h = 0; h < i.length; h++)
          i[h][0] == u && (d = i[h][1]);
        yg(r, f).forEach((h) => {
          d || i.push([u, d = []]), d.indexOf(h) == -1 && d.push(h);
        });
      });
    });
    let o = e[n.join(",")] = new oo(n.indexOf(r.length - 1) > -1);
    for (let s = 0; s < i.length; s++) {
      let u = i[s][1].sort(V0);
      o.next.push({ type: i[s][0], next: e[u.join(",")] || t(u) });
    }
    return o;
  }
}
function fx(r, e) {
  for (let t = 0, n = [r]; t < n.length; t++) {
    let i = n[t], o = !i.validEnd, s = [];
    for (let u = 0; u < i.next.length; u++) {
      let { type: f, next: d } = i.next[u];
      s.push(f.name), o && !(f.isText || f.hasRequiredAttrs()) && (o = !1), n.indexOf(d) == -1 && n.push(d);
    }
    o && e.err("Only non-generatable nodes (" + s.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
  }
}
function q0(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 $0(r, e) {
  let t = /* @__PURE__ */ Object.create(null);
  for (let n in r) {
    let i = e && e[n];
    if (i === void 0) {
      let o = r[n];
      if (o.hasDefault)
        i = o.default;
      else
        throw new RangeError("No value supplied for attribute " + n);
    }
    t[n] = i;
  }
  return t;
}
function U0(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 o = r[i];
    o.validate && o.validate(e[i]);
  }
}
function j0(r, e) {
  let t = /* @__PURE__ */ Object.create(null);
  if (e)
    for (let n in e)
      t[n] = new px(r, n, e[n]);
  return t;
}
let wg = class W0 {
  /**
  @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 = j0(e, n.attrs), this.defaultAttrs = q0(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 == oo.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 : $0(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 pi(this, this.computeAttrs(e), F.from(t), Ne.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 = F.from(t), this.checkContent(t), new pi(this, this.computeAttrs(e), t, Ne.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 = F.from(t), t.size) {
      let s = this.contentMatch.fillBefore(t);
      if (!s)
        return null;
      t = s.append(t);
    }
    let i = this.contentMatch.matchFragment(t), o = i && i.fillBefore(F.empty, !0);
    return o ? new pi(this, e, t.append(o), Ne.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) {
    U0(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 : Ne.none : e;
  }
  /**
  @internal
  */
  static compile(e, t) {
    let n = /* @__PURE__ */ Object.create(null);
    e.forEach((o, s) => n[o] = new W0(o, 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 o in n.text.attrs)
      throw new RangeError("The text node type should not have attributes");
    return n;
  }
};
function dx(r, e, t) {
  let n = t.split("|");
  return (i) => {
    let o = i === null ? "null" : typeof i;
    if (n.indexOf(o) < 0)
      throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${o}`);
  };
}
class px {
  constructor(e, t, n) {
    this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? dx(e, t, n.validate) : n.validate;
  }
  get isRequired() {
    return !this.hasDefault;
  }
}
class nc {
  /**
  @internal
  */
  constructor(e, t, n, i) {
    this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = j0(e, i.attrs), this.excluded = null;
    let o = q0(this.attrs);
    this.instance = o ? new Ne(this, o) : 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 Ne(this, $0(this.attrs, e));
  }
  /**
  @internal
  */
  static compile(e, t) {
    let n = /* @__PURE__ */ Object.create(null), i = 0;
    return e.forEach((o, s) => n[o] = new nc(o, 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) {
    U0(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 G0 {
  /**
  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 = kt.from(e.nodes), t.marks = kt.from(e.marks || {}), this.nodes = wg.compile(this.spec.nodes, this), this.marks = nc.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 o = this.nodes[i], s = o.spec.content || "", u = o.spec.marks;
      if (o.contentMatch = n[s] || (n[s] = oo.parse(s, this.nodes)), o.inlineContent = o.contentMatch.inlineContent, o.spec.linebreakReplacement) {
        if (this.linebreakReplacement)
          throw new RangeError("Multiple linebreak nodes defined");
        if (!o.isInline || !o.isLeaf)
          throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
        this.linebreakReplacement = o;
      }
      o.markSet = u == "_" ? null : u ? kg(this, u.split(" ")) : u == "" || !o.inlineContent ? [] : null;
    }
    for (let i in this.marks) {
      let o = this.marks[i], s = o.spec.excludes;
      o.excluded = s == null ? [o] : s == "" ? [] : kg(this, s.split(" "));
    }
    this.nodeFromJSON = (i) => pi.fromJSON(this, i), this.markFromJSON = (i) => Ne.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 wg) {
      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 Du(n, n.defaultAttrs, e, Ne.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 kg(r, e) {
  let t = [];
  for (let n = 0; n < e.length; n++) {
    let i = e[n], o = r.marks[i], s = o;
    if (o)
      t.push(o);
    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 hx(r) {
  return r.tag != null;
}
function vx(r) {
  return r.style != null;
}
class ao {
  /**
  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 (hx(i))
        this.tags.push(i);
      else if (vx(i)) {
        let o = /[^=]*/.exec(i.style)[0];
        n.indexOf(o) < 0 && n.push(o), this.styles.push(i);
      }
    }), this.normalizeLists = !this.tags.some((i) => {
      if (!/^(ul|ol)\b/.test(i.tag) || !i.node)
        return !1;
      let o = e.nodes[i.node];
      return o.contentMatch.matchType(o);
    });
  }
  /**
  Parse a document from the content of a DOM node.
  */
  parse(e, t = {}) {
    let n = new bg(this, t, !1);
    return n.addAll(e, Ne.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 bg(this, t, !0);
    return n.addAll(e, Ne.none, t.from, t.to), Q.maxOpen(n.finish());
  }
  /**
  @internal
  */
  matchTag(e, t, n) {
    for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
      let o = this.tags[i];
      if (yx(e, o.tag) && (o.namespace === void 0 || e.namespaceURI == o.namespace) && (!o.context || t.matchesContext(o.context))) {
        if (o.getAttrs) {
          let s = o.getAttrs(e);
          if (s === !1)
            continue;
          o.attrs = s || void 0;
        }
        return o;
      }
    }
  }
  /**
  @internal
  */
  matchStyle(e, t, n, i) {
    for (let o = i ? this.styles.indexOf(i) + 1 : 0; o < this.styles.length; o++) {
      let s = this.styles[o], 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 o = i.priority == null ? 50 : i.priority, s = 0;
      for (; s < t.length; s++) {
        let u = t[s];
        if ((u.priority == null ? 50 : u.priority) < o)
          break;
      }
      t.splice(s, 0, i);
    }
    for (let i in e.marks) {
      let o = e.marks[i].spec.parseDOM;
      o && o.forEach((s) => {
        n(s = Tg(s)), s.mark || s.ignore || s.clearMark || (s.mark = i);
      });
    }
    for (let i in e.nodes) {
      let o = e.nodes[i].spec.parseDOM;
      o && o.forEach((s) => {
        n(s = Tg(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 ao(e, ao.schemaRules(e)));
  }
}
const K0 = {
  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
}, mx = {
  head: !0,
  noscript: !0,
  object: !0,
  script: !0,
  style: !0,
  title: !0
}, Q0 = { ol: !0, ul: !0 }, Ls = 1, ep = 2, xs = 4;
function Cg(r, e, t) {
  return e != null ? (e ? Ls : 0) | (e === "full" ? ep : 0) : r && r.whitespace == "pre" ? Ls | ep : t & ~xs;
}
class ru {
  constructor(e, t, n, i, o, s) {
    this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = s, this.content = [], this.activeMarks = Ne.none, this.match = o || (s & xs ? null : e.contentMatch);
  }
  findWrapping(e) {
    if (!this.match) {
      if (!this.type)
        return [];
      let t = this.type.contentMatch.fillBefore(F.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 & Ls)) {
      let n = this.content[this.content.length - 1], i;
      if (n && n.isText && (i = /[ \t\r\n\u000c]+$/.exec(n.text))) {
        let o = n;
        n.text.length == i[0].length ? this.content.pop() : this.content[this.content.length - 1] = o.withText(o.text.slice(0, o.text.length - i[0].length));
      }
    }
    let t = F.from(this.content);
    return !e && this.match && (t = t.append(this.match.fillBefore(F.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 && !K0.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
  }
}
class bg {
  constructor(e, t, n) {
    this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
    let i = t.topNode, o, s = Cg(null, t.preserveWhitespace, 0) | (n ? xs : 0);
    i ? o = new ru(i.type, i.attrs, Ne.none, !0, t.topMatch || i.type.contentMatch, s) : n ? o = new ru(null, null, Ne.none, !0, null, s) : o = new ru(e.schema.topNodeType, null, Ne.none, !0, null, s), this.nodes = [o], 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, o = i.options & ep ? "full" : this.localPreserveWS || (i.options & Ls) > 0, { schema: s } = this.parser;
    if (o === "full" || i.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
      if (o)
        if (o === "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, o = this.top;
    (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
    let s = e.nodeName.toLowerCase(), u;
    Q0.hasOwnProperty(s) && this.parser.normalizeLists && gx(e);
    let f = this.options.ruleFromNode && this.options.ruleFromNode(e) || (u = this.parser.matchTag(e, this, n));
    e: if (f ? f.ignore : mx.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 d, h = this.needsBlock;
      if (K0.hasOwnProperty(s))
        o.content.length && o.content[0].isInline && this.open && (this.open--, o = this.top), d = !0, o.type || (this.needsBlock = !0);
      else if (!e.firstChild) {
        this.leafFallback(e, t);
        break e;
      }
      let m = f && f.skip ? t : this.readStyles(e, t);
      m && this.addAll(e, m), d && this.sync(o), this.needsBlock = h;
    } else {
      let d = this.readStyles(e, t);
      d && this.addElementByRule(e, f, d, 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 o = this.parser.matchedStyles[i], s = n.getPropertyValue(o);
        if (s)
          for (let u = void 0; ; ) {
            let f = this.parser.matchStyle(o, s, this, u);
            if (!f)
              break;
            if (f.ignore)
              return null;
            if (f.clearMark ? t = t.filter((d) => !f.clearMark(d)) : 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 o, 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 && (o = !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);
    }
    o && 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 o = n || 0;
    for (let s = n ? e.childNodes[n] : e.firstChild, u = i == null ? null : e.childNodes[i]; s != u; s = s.nextSibling, ++o)
      this.findAtPoint(e, o), this.addDOM(s, t);
    this.findAtPoint(e, o);
  }
  // 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, o;
    for (let s = this.open, u = 0; s >= 0; s--) {
      let f = this.nodes[s], d = f.findWrapping(e);
      if (d && (!i || i.length > d.length + u) && (i = d, o = f, !d.length))
        break;
      if (f.solid) {
        if (n)
          break;
        u += 2;
      }
    }
    if (!i)
      return null;
    this.sync(o);
    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 o = this.textblockFromContext();
      o && (t = this.enterInner(o, null, t));
    }
    let i = this.findPlace(e, t, n);
    if (i) {
      this.closeExtra();
      let o = this.top;
      o.match && (o.match = o.match.matchType(e.type));
      let s = Ne.none;
      for (let u of i.concat(e.marks))
        (o.type ? o.type.allowsMarkType(u.type) : xg(u.type, e.type)) && (s = u.addToSet(s));
      return o.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 o = this.findPlace(e.create(t), n, !1);
    return o && (o = this.enterInner(e, t, n, !0, i)), o;
  }
  // Open a node of the given type
  enterInner(e, t, n, i = !1, o) {
    this.closeExtra();
    let s = this.top;
    s.match = s.match && s.match.matchType(e);
    let u = Cg(e, o, s.options);
    s.options & xs && s.content.length == 0 && (u |= xs);
    let f = Ne.none;
    return n = n.filter((d) => (s.type ? s.type.allowsMarkType(d.type) : xg(d.type, e)) ? (f = d.addToSet(f), !1) : !0), this.nodes.push(new ru(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 |= Ls);
    }
    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), o = -(n ? n.depth + 1 : 0) + (i ? 0 : 1), s = (u, f) => {
      for (; u >= 0; u--) {
        let d = t[u];
        if (d == "") {
          if (u == t.length - 1 || u == 0)
            continue;
          for (; f >= o; f--)
            if (s(u - 1, f))
              return !0;
          return !1;
        } else {
          let h = f > 0 || f == 0 && i ? this.nodes[f].type : n && f >= o ? n.node(f - o).type : null;
          if (!h || h.name != d && !h.isInGroup(d))
            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 gx(r) {
  for (let e = r.firstChild, t = null; e; e = e.nextSibling) {
    let n = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
    n && Q0.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
  }
}
function yx(r, e) {
  return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, e);
}
function Tg(r) {
  let e = {};
  for (let t in r)
    e[t] = r[t];
  return e;
}
function xg(r, e) {
  let t = e.schema.nodes;
  for (let n in t) {
    let i = t[n];
    if (!i.allowsMarkType(r))
      continue;
    let o = [], s = (u) => {
      o.push(u);
      for (let f = 0; f < u.edgeCount; f++) {
        let { type: d, next: h } = u.edge(f);
        if (d == e || o.indexOf(h) < 0 && s(h))
          return !0;
      }
    };
    if (s(i.contentMatch))
      return !0;
  }
}
class ka {
  /**
  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 = dd(t).createDocumentFragment());
    let i = n, o = [];
    return e.forEach((s) => {
      if (o.length || s.marks.length) {
        let u = 0, f = 0;
        for (; u < o.length && f < s.marks.length; ) {
          let d = s.marks[f];
          if (!this.marks[d.type.name]) {
            f++;
            continue;
          }
          if (!d.eq(o[u][0]) || d.type.spec.spanning === !1)
            break;
          u++, f++;
        }
        for (; u < o.length; )
          i = o.pop()[1];
        for (; f < s.marks.length; ) {
          let d = s.marks[f++], h = this.serializeMark(d, s.isInline, t);
          h && (o.push([d, i]), i.appendChild(h.dom), i = h.contentDOM || h.dom);
        }
      }
      i.appendChild(this.serializeNodeInner(s, t));
    }), n;
  }
  /**
  @internal
  */
  serializeNodeInner(e, t) {
    let { dom: n, contentDOM: i } = mu(dd(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 o = this.serializeMark(e.marks[i], e.isInline, t);
      o && ((o.contentDOM || o.dom).appendChild(n), n = o.dom);
    }
    return n;
  }
  /**
  @internal
  */
  serializeMark(e, t, n = {}) {
    let i = this.marks[e.type.name];
    return i && mu(dd(n), i(e, t), null, e.attrs);
  }
  static renderSpec(e, t, n = null, i) {
    return mu(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 ka(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 = Sg(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 Sg(e.marks);
  }
}
function Sg(r) {
  let e = {};
  for (let t in r) {
    let n = r[t].spec.toDOM;
    n && (e[t] = n);
  }
  return e;
}
function dd(r) {
  return r.document || window.document;
}
const Eg = /* @__PURE__ */ new WeakMap();
function wx(r) {
  let e = Eg.get(r);
  return e === void 0 && Eg.set(r, e = kx(r)), e;
}
function kx(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 mu(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], o;
  if (typeof i != "string")
    throw new RangeError("Invalid array passed to renderSpec");
  if (n && (o = wx(n)) && o.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), d = e[1], h = 1;
  if (d && typeof d == "object" && d.nodeType == null && !Array.isArray(d)) {
    h = 2;
    for (let m in d)
      if (d[m] != null) {
        let y = m.indexOf(" ");
        y > 0 ? f.setAttributeNS(m.slice(0, y), m.slice(y + 1), d[m]) : m == "style" && f.style ? f.style.cssText = d[m] : f.setAttribute(m, d[m]);
      }
  }
  for (let m = h; m < e.length; m++) {
    let y = e[m];
    if (y === 0) {
      if (m < e.length - 1 || m > h)
        throw new RangeError("Content hole must be the only child of its parent node");
      return { dom: f, contentDOM: f };
    } else {
      let { dom: w, contentDOM: k } = mu(r, y, t, n);
      if (f.appendChild(w), k) {
        if (u)
          throw new RangeError("Multiple content holes");
        u = k;
      }
    }
  }
  return { dom: f, contentDOM: u };
}
const J0 = 65535, X0 = Math.pow(2, 16);
function Cx(r, e) {
  return r + e * X0;
}
function Mg(r) {
  return r & J0;
}
function bx(r) {
  return (r - (r & J0)) / X0;
}
const Y0 = 1, Z0 = 2, gu = 4, e1 = 8;
class tp {
  /**
  @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 & e1) > 0;
  }
  /**
  Tells you whether the token before the mapped position was deleted.
  */
  get deletedBefore() {
    return (this.delInfo & (Y0 | gu)) > 0;
  }
  /**
  True when the token after the mapped position was deleted.
  */
  get deletedAfter() {
    return (this.delInfo & (Z0 | gu)) > 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 & gu) > 0;
  }
}
class Zt {
  /**
  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 && Zt.empty)
      return Zt.empty;
  }
  /**
  @internal
  */
  recover(e) {
    let t = 0, n = Mg(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 + bx(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, o = 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 d = this.ranges[u + o], h = this.ranges[u + s], m = f + d;
      if (e <= m) {
        let y = d ? e == f ? -1 : e == m ? 1 : t : t, w = f + i + (y < 0 ? 0 : h);
        if (n)
          return w;
        let k = e == (t < 0 ? f : m) ? null : Cx(u / 3, e - f), b = e == f ? Z0 : e == m ? Y0 : gu;
        return (t < 0 ? e != f : e != m) && (b |= e1), new tp(w, b, k);
      }
      i += h - d;
    }
    return n ? e + i : new tp(e + i, 0, null);
  }
  /**
  @internal
  */
  touches(e, t) {
    let n = 0, i = Mg(t), o = 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 d = this.ranges[u + o], h = f + d;
      if (e <= h && u == i * 3)
        return !0;
      n += this.ranges[u + s] - d;
    }
    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, o = 0; i < this.ranges.length; i += 3) {
      let s = this.ranges[i], u = s - (this.inverted ? o : 0), f = s + (this.inverted ? 0 : o), d = this.ranges[i + t], h = this.ranges[i + n];
      e(u, u + d, f, f + h), o += h - d;
    }
  }
  /**
  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 Zt(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 ? Zt.empty : new Zt(e < 0 ? [0, -e, 0] : [0, 0, e]);
  }
}
Zt.empty = new Zt([]);
class Ds {
  /**
  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 Ds(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 Ds();
    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 o = this.from; o < this.to; o++) {
      let s = this._maps[o], u = s.mapResult(e, t);
      if (u.recover != null) {
        let f = this.getMirror(o);
        if (f != null && f > o && f < this.to) {
          o = f, e = this._maps[f].recover(u.recover);
          continue;
        }
      }
      i |= u.delInfo, e = u.pos;
    }
    return n ? e : new tp(e, i, null);
  }
}
const pd = /* @__PURE__ */ Object.create(null);
class Bt {
  /**
  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 Zt.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 = pd[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 pd)
      throw new RangeError("Duplicate use of step JSON ID " + e);
    return pd[e] = t, t.prototype.jsonID = e, t;
  }
}
class Ye {
  /**
  @internal
  */
  constructor(e, t) {
    this.doc = e, this.failed = t;
  }
  /**
  Create a successful step result.
  */
  static ok(e) {
    return new Ye(e, null);
  }
  /**
  Create a failed step result.
  */
  static fail(e) {
    return new Ye(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 Ye.ok(e.replace(t, n, i));
    } catch (o) {
      if (o instanceof Ou)
        return Ye.fail(o.message);
      throw o;
    }
  }
}
function zp(r, e, t) {
  let n = [];
  for (let i = 0; i < r.childCount; i++) {
    let o = r.child(i);
    o.content.size && (o = o.copy(zp(o.content, e, o))), o.isInline && (o = e(o, t, i)), n.push(o);
  }
  return F.fromArray(n);
}
class ci extends Bt {
  /**
  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)), o = new Q(zp(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 Ye.fromReplace(e, this.from, this.to, o);
  }
  invert() {
    return new Yr(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 ci(t.pos, n.pos, this.mark);
  }
  merge(e) {
    return e instanceof ci && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new ci(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 ci(t.from, t.to, e.markFromJSON(t.mark));
  }
}
Bt.jsonID("addMark", ci);
class Yr extends Bt {
  /**
  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 Q(zp(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
    return Ye.fromReplace(e, this.from, this.to, n);
  }
  invert() {
    return new ci(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 Yr(t.pos, n.pos, this.mark);
  }
  merge(e) {
    return e instanceof Yr && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new Yr(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 Yr(t.from, t.to, e.markFromJSON(t.mark));
  }
}
Bt.jsonID("removeMark", Yr);
class fi extends Bt {
  /**
  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 Ye.fail("No node at mark step's position");
    let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
    return Ye.fromReplace(e, this.pos, this.pos + 1, new Q(F.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 fi(this.pos, t.marks[i]);
        return new fi(this.pos, this.mark);
      }
    }
    return new so(this.pos, this.mark);
  }
  map(e) {
    let t = e.mapResult(this.pos, 1);
    return t.deletedAfter ? null : new fi(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 fi(t.pos, e.markFromJSON(t.mark));
  }
}
Bt.jsonID("addNodeMark", fi);
class so extends Bt {
  /**
  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 Ye.fail("No node at mark step's position");
    let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
    return Ye.fromReplace(e, this.pos, this.pos + 1, new Q(F.from(n), 0, t.isLeaf ? 0 : 1));
  }
  invert(e) {
    let t = e.nodeAt(this.pos);
    return !t || !this.mark.isInSet(t.marks) ? this : new fi(this.pos, this.mark);
  }
  map(e) {
    let t = e.mapResult(this.pos, 1);
    return t.deletedAfter ? null : new so(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 so(t.pos, e.markFromJSON(t.mark));
  }
}
Bt.jsonID("removeNodeMark", so);
class It extends Bt {
  /**
  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 && rp(e, this.from, this.to) ? Ye.fail("Structure replace would overwrite content") : Ye.fromReplace(e, this.from, this.to, this.slice);
  }
  getMap() {
    return new Zt([this.from, this.to - this.from, this.slice.size]);
  }
  invert(e) {
    return new It(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 It(t.pos, Math.max(t.pos, n.pos), this.slice, this.structure);
  }
  merge(e) {
    if (!(e instanceof It) || 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 ? Q.empty : new Q(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
      return new It(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 ? Q.empty : new Q(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
      return new It(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 It(t.from, t.to, Q.fromJSON(e, t.slice), !!t.structure);
  }
}
Bt.jsonID("replace", It);
class vt extends Bt {
  /**
  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, o, s, u = !1) {
    super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = i, this.slice = o, this.insert = s, this.structure = u;
  }
  apply(e) {
    if (this.structure && (rp(e, this.from, this.gapFrom) || rp(e, this.gapTo, this.to)))
      return Ye.fail("Structure gap-replace would overwrite content");
    let t = e.slice(this.gapFrom, this.gapTo);
    if (t.openStart || t.openEnd)
      return Ye.fail("Gap is not a flat range");
    let n = this.slice.insertAt(this.insert, t.content);
    return n ? Ye.fromReplace(e, this.from, this.to, n) : Ye.fail("Content does not fit in gap");
  }
  getMap() {
    return new Zt([
      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 vt(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), o = this.to == this.gapTo ? n.pos : e.map(this.gapTo, 1);
    return t.deletedAcross && n.deletedAcross || i < t.pos || o > n.pos ? null : new vt(t.pos, n.pos, i, o, 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 vt(t.from, t.to, t.gapFrom, t.gapTo, Q.fromJSON(e, t.slice), t.insert, !!t.structure);
  }
}
Bt.jsonID("replaceAround", vt);
function rp(r, e, t) {
  let n = r.resolve(e), i = t - e, o = n.depth;
  for (; i > 0 && o > 0 && n.indexAfter(o) == n.node(o).childCount; )
    o--, i--;
  if (i > 0) {
    let s = n.node(o).maybeChild(n.indexAfter(o));
    for (; i > 0; ) {
      if (!s || s.isLeaf)
        return !0;
      s = s.firstChild, i--;
    }
  }
  return !1;
}
function Tx(r, e, t, n) {
  let i = [], o = [], s, u;
  r.doc.nodesBetween(e, t, (f, d, h) => {
    if (!f.isInline)
      return;
    let m = f.marks;
    if (!n.isInSet(m) && h.type.allowsMarkType(n.type)) {
      let y = Math.max(d, e), w = Math.min(d + f.nodeSize, t), k = n.addToSet(m);
      for (let b = 0; b < m.length; b++)
        m[b].isInSet(k) || (s && s.to == y && s.mark.eq(m[b]) ? s.to = w : i.push(s = new Yr(y, w, m[b])));
      u && u.to == y ? u.to = w : o.push(u = new ci(y, w, n));
    }
  }), i.forEach((f) => r.step(f)), o.forEach((f) => r.step(f));
}
function xx(r, e, t, n) {
  let i = [], o = 0;
  r.doc.nodesBetween(e, t, (s, u) => {
    if (!s.isInline)
      return;
    o++;
    let f = null;
    if (n instanceof nc) {
      let d = s.marks, h;
      for (; h = n.isInSet(d); )
        (f || (f = [])).push(h), d = h.removeFromSet(d);
    } else n ? n.isInSet(s.marks) && (f = [n]) : f = s.marks;
    if (f && f.length) {
      let d = Math.min(u + s.nodeSize, t);
      for (let h = 0; h < f.length; h++) {
        let m = f[h], y;
        for (let w = 0; w < i.length; w++) {
          let k = i[w];
          k.step == o - 1 && m.eq(i[w].style) && (y = k);
        }
        y ? (y.to = d, y.step = o) : i.push({ style: m, from: Math.max(u, e), to: d, step: o });
      }
    }
  }), i.forEach((s) => r.step(new Yr(s.from, s.to, s.style)));
}
function Vp(r, e, t, n = t.contentMatch, i = !0) {
  let o = r.doc.nodeAt(e), s = [], u = e + 1;
  for (let f = 0; f < o.childCount; f++) {
    let d = o.child(f), h = u + d.nodeSize, m = n.matchType(d.type);
    if (!m)
      s.push(new It(u, h, Q.empty));
    else {
      n = m;
      for (let y = 0; y < d.marks.length; y++)
        t.allowsMarkType(d.marks[y].type) || r.step(new Yr(u, h, d.marks[y]));
      if (i && d.isText && t.whitespace != "pre") {
        let y, w = /\r?\n|\r/g, k;
        for (; y = w.exec(d.text); )
          k || (k = new Q(F.from(t.schema.text(" ", t.allowedMarks(d.marks))), 0, 0)), s.push(new It(u + y.index, u + y.index + y[0].length, k));
      }
    }
    u = h;
  }
  if (!n.validEnd) {
    let f = n.fillBefore(F.empty, !0);
    r.replace(u, u, new Q(f, 0, 0));
  }
  for (let f = s.length - 1; f >= 0; f--)
    r.step(s[f]);
}
function Sx(r, e, t) {
  return (e == 0 || r.canReplace(e, r.childCount)) && (t == r.childCount || r.canReplace(0, t));
}
function ic(r) {
  let t = r.parent.content.cutByIndex(r.startIndex, r.endIndex);
  for (let n = r.depth, i = 0, o = 0; ; --n) {
    let s = r.$from.node(n), u = r.$from.index(n) + i, f = r.$to.indexAfter(n) - o;
    if (n < r.depth && s.canReplace(u, f, t))
      return n;
    if (n == 0 || s.type.spec.isolating || !Sx(s, u, f))
      break;
    u && (i = 1), f < s.childCount && (o = 1);
  }
  return null;
}
function Ex(r, e, t) {
  let { $from: n, $to: i, depth: o } = e, s = n.before(o + 1), u = i.after(o + 1), f = s, d = u, h = F.empty, m = 0;
  for (let k = o, b = !1; k > t; k--)
    b || n.index(k) > 0 ? (b = !0, h = F.from(n.node(k).copy(h)), m++) : f--;
  let y = F.empty, w = 0;
  for (let k = o, b = !1; k > t; k--)
    b || i.after(k + 1) < i.end(k) ? (b = !0, y = F.from(i.node(k).copy(y)), w++) : d++;
  r.step(new vt(f, d, s, u, new Q(h.append(y), m, w), h.size - m, !0));
}
function Mx(r, e, t = null, n = r) {
  let i = Ox(r, e), o = i && Nx(n, e);
  return o ? i.map(Og).concat({ type: e, attrs: t }).concat(o.map(Og)) : null;
}
function Og(r) {
  return { type: r, attrs: null };
}
function Ox(r, e) {
  let { parent: t, startIndex: n, endIndex: i } = r, o = t.contentMatchAt(n).findWrapping(e);
  if (!o)
    return null;
  let s = o.length ? o[0] : e;
  return t.canReplaceWith(n, i, s) ? o : null;
}
function Nx(r, e) {
  let { parent: t, startIndex: n, endIndex: i } = r, o = t.child(n), s = e.contentMatch.findWrapping(o.type);
  if (!s)
    return null;
  let f = (s.length ? s[s.length - 1] : e).contentMatch;
  for (let d = n; f && d < i; d++)
    f = f.matchType(t.child(d).type);
  return !f || !f.validEnd ? null : s;
}
function Lx(r, e, t) {
  let n = F.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 = F.from(t[s].type.create(t[s].attrs, n));
  }
  let i = e.start, o = e.end;
  r.step(new vt(i, o, i, o, new Q(n, 0, 0), t.length, !0));
}
function Dx(r, e, t, n, i) {
  if (!n.isTextblock)
    throw new RangeError("Type given to setBlockType should be a textblock");
  let o = 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) && Ax(r.doc, r.mapping.slice(o).map(u), n)) {
      let d = null;
      if (n.schema.linebreakReplacement) {
        let w = n.whitespace == "pre", k = !!n.contentMatch.matchType(n.schema.linebreakReplacement);
        w && !k ? d = !1 : !w && k && (d = !0);
      }
      d === !1 && r1(r, s, u, o), Vp(r, r.mapping.slice(o).map(u, 1), n, void 0, d === null);
      let h = r.mapping.slice(o), m = h.map(u, 1), y = h.map(u + s.nodeSize, 1);
      return r.step(new vt(m, y, m + 1, y - 1, new Q(F.from(n.create(f, null, s.marks)), 0, 0), 1, !0)), d === !0 && t1(r, s, u, o), !1;
    }
  });
}
function t1(r, e, t, n) {
  e.forEach((i, o) => {
    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 + o + s.index);
        r.replaceWith(f, f + 1, e.type.schema.linebreakReplacement.create());
      }
    }
  });
}
function r1(r, e, t, n) {
  e.forEach((i, o) => {
    if (i.type == i.type.schema.linebreakReplacement) {
      let s = r.mapping.slice(n).map(t + 1 + o);
      r.replaceWith(s, s + 1, e.type.schema.text(`
`));
    }
  });
}
function Ax(r, e, t) {
  let n = r.resolve(e), i = n.index();
  return n.parent.canReplaceWith(i, i + 1, t);
}
function Ix(r, e, t, n, i) {
  let o = r.doc.nodeAt(e);
  if (!o)
    throw new RangeError("No node at given position");
  t || (t = o.type);
  let s = t.create(n, null, i || o.marks);
  if (o.isLeaf)
    return r.replaceWith(e, e + o.nodeSize, s);
  if (!t.validContent(o.content))
    throw new RangeError("Invalid content for node type " + t.name);
  r.step(new vt(e, e + o.nodeSize, e + 1, e + o.nodeSize - 1, new Q(F.from(s), 0, 0), 1, !0));
}
function na(r, e, t = 1, n) {
  let i = r.resolve(e), o = i.depth - t, s = n && n[n.length - 1] || i.parent;
  if (o < 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 d = i.depth - 1, h = t - 2; d > o; d--, h--) {
    let m = i.node(d), y = i.index(d);
    if (m.type.spec.isolating)
      return !1;
    let w = m.content.cutByIndex(y, m.childCount), k = n && n[h + 1];
    k && (w = w.replaceChild(0, k.type.create(k.attrs)));
    let b = n && n[h] || m;
    if (!m.canReplace(y + 1, m.childCount) || !b.type.validContent(w))
      return !1;
  }
  let u = i.indexAfter(o), f = n && n[0];
  return i.node(o).canReplaceWith(u, u, f ? f.type : i.node(o + 1).type);
}
function Rx(r, e, t = 1, n) {
  let i = r.doc.resolve(e), o = F.empty, s = F.empty;
  for (let u = i.depth, f = i.depth - t, d = t - 1; u > f; u--, d--) {
    o = F.from(i.node(u).copy(o));
    let h = n && n[d];
    s = F.from(h ? h.type.create(h.attrs, s) : i.node(u).copy(s));
  }
  r.step(new It(e, e, new Q(o.append(s), t, t), !0));
}
function n1(r, e) {
  let t = r.resolve(e), n = t.index();
  return Bx(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
}
function Px(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 o = e.child(i), s = o.type == n ? r.type.schema.nodes.text : o.type;
    if (t = t.matchType(s), !t || !r.type.allowsMarks(o.marks))
      return !1;
  }
  return t.validEnd;
}
function Bx(r, e) {
  return !!(r && e && !r.isLeaf && Px(r, e));
}
function _x(r, e, t) {
  let n = null, { linebreakReplacement: i } = r.doc.type.schema, o = r.doc.resolve(e - t), s = o.node().type;
  if (i && s.inlineContent) {
    let h = s.whitespace == "pre", m = !!s.contentMatch.matchType(i);
    h && !m ? n = !1 : !h && m && (n = !0);
  }
  let u = r.steps.length;
  if (n === !1) {
    let h = r.doc.resolve(e + t);
    r1(r, h.node(), h.before(), u);
  }
  s.inlineContent && Vp(r, e + t - 1, s, o.node().contentMatchAt(o.index()), n == null);
  let f = r.mapping.slice(u), d = f.map(e - t);
  if (r.step(new It(d, f.map(e + t, -1), Q.empty, !0)), n === !0) {
    let h = r.doc.resolve(d);
    t1(r, h.node(), h.before(), r.steps.length);
  }
  return r;
}
function Hx(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 o = n.index(i);
      if (n.node(i).canReplaceWith(o, o, t))
        return n.before(i + 1);
      if (o > 0)
        return null;
    }
  if (n.parentOffset == n.parent.content.size)
    for (let i = n.depth - 1; i >= 0; i--) {
      let o = n.indexAfter(i);
      if (n.node(i).canReplaceWith(o, o, t))
        return n.after(i + 1);
      if (o < n.node(i).childCount)
        return null;
    }
  return null;
}
function Fx(r, e, t) {
  let n = r.resolve(e);
  if (!t.content.size)
    return e;
  let i = t.content;
  for (let o = 0; o < t.openStart; o++)
    i = i.firstChild.content;
  for (let o = 1; o <= (t.openStart == 0 && t.size ? 2 : 1); o++)
    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), d = n.node(s), h = !1;
      if (o == 1)
        h = d.canReplace(f, f, i);
      else {
        let m = d.contentMatchAt(f).findWrapping(i.firstChild.type);
        h = m && d.canReplaceWith(f, f, m[0]);
      }
      if (h)
        return u == 0 ? n.pos : u < 0 ? n.before(s + 1) : n.after(s + 1);
    }
  return null;
}
function qp(r, e, t = e, n = Q.empty) {
  if (e == t && !n.size)
    return null;
  let i = r.resolve(e), o = r.resolve(t);
  return i1(i, o, n) ? new It(e, t, n) : new zx(i, o, n).fit();
}
function i1(r, e, t) {
  return !t.openStart && !t.openEnd && r.start() == e.start() && r.parent.canReplace(r.index(), e.index(), t.content);
}
class zx {
  constructor(e, t, n) {
    this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = F.empty;
    for (let i = 0; i <= e.depth; i++) {
      let o = e.node(i);
      this.frontier.push({
        type: o.type,
        match: o.contentMatchAt(e.indexAfter(i))
      });
    }
    for (let i = e.depth; i > 0; i--)
      this.placed = F.from(e.node(i).copy(this.placed));
  }
  get depth() {
    return this.frontier.length - 1;
  }
  fit() {
    for (; this.unplaced.size; ) {
      let d = this.findFittable();
      d ? this.placeNodes(d) : 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 o = this.placed, s = n.depth, u = i.depth;
    for (; s && u && o.childCount == 1; )
      o = o.firstChild.content, s--, u--;
    let f = new Q(o, s, u);
    return e > -1 ? new vt(n.pos, e, this.$to.pos, this.$to.end(), f, t) : f.size || n.pos != this.$to.pos ? new It(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 o = t.firstChild;
      if (t.childCount > 1 && (i = 0), o.type.spec.isolating && i <= n) {
        e = n;
        break;
      }
      t = o.content;
    }
    for (let t = 1; t <= 2; t++)
      for (let n = t == 1 ? e : this.unplaced.openStart; n >= 0; n--) {
        let i, o = null;
        n ? (o = hd(this.unplaced.content, n - 1).firstChild, i = o.content) : i = this.unplaced.content;
        let s = i.firstChild;
        for (let u = this.depth; u >= 0; u--) {
          let { type: f, match: d } = this.frontier[u], h, m = null;
          if (t == 1 && (s ? d.matchType(s.type) || (m = d.fillBefore(F.from(s), !1)) : o && f.compatibleContent(o.type)))
            return { sliceDepth: n, frontierDepth: u, parent: o, inject: m };
          if (t == 2 && s && (h = d.findWrapping(s.type)))
            return { sliceDepth: n, frontierDepth: u, parent: o, wrap: h };
          if (o && d.matchType(o.type))
            break;
        }
      }
  }
  openMore() {
    let { content: e, openStart: t, openEnd: n } = this.unplaced, i = hd(e, t);
    return !i.childCount || i.firstChild.isLeaf ? !1 : (this.unplaced = new Q(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 = hd(e, t);
    if (i.childCount <= 1 && t > 0) {
      let o = e.size - t <= t + i.size;
      this.unplaced = new Q(ys(e, t - 1, 1), t - 1, o ? t - 1 : n);
    } else
      this.unplaced = new Q(ys(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: o }) {
    for (; this.depth > t; )
      this.closeFrontierNode();
    if (o)
      for (let b = 0; b < o.length; b++)
        this.openFrontierNode(o[b]);
    let s = this.unplaced, u = n ? n.content : s.content, f = s.openStart - e, d = 0, h = [], { match: m, type: y } = this.frontier[t];
    if (i) {
      for (let b = 0; b < i.childCount; b++)
        h.push(i.child(b));
      m = m.matchFragment(i);
    }
    let w = u.size + e - (s.content.size - s.openEnd);
    for (; d < u.childCount; ) {
      let b = u.child(d), T = m.matchType(b.type);
      if (!T)
        break;
      d++, (d > 1 || f == 0 || b.content.size) && (m = T, h.push(o1(b.mark(y.allowedMarks(b.marks)), d == 1 ? f : 0, d == u.childCount ? w : -1)));
    }
    let k = d == u.childCount;
    k || (w = -1), this.placed = ws(this.placed, t, F.from(h)), this.frontier[t].match = m, k && w < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
    for (let b = 0, T = u; b < w; b++) {
      let E = T.lastChild;
      this.frontier.push({ type: E.type, match: E.contentMatchAt(E.childCount) }), T = E.content;
    }
    this.unplaced = k ? e == 0 ? Q.empty : new Q(ys(s.content, e - 1, 1), e - 1, w < 0 ? s.openEnd : e - 1) : new Q(ys(s.content, e, d), s.openStart, s.openEnd);
  }
  mustMoveInline() {
    if (!this.$to.parent.isTextblock)
      return -1;
    let e = this.frontier[this.depth], t;
    if (!e.type.isTextblock || !vd(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], o = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), s = vd(e, t, i, n, o);
      if (s) {
        for (let u = t - 1; u >= 0; u--) {
          let { match: f, type: d } = this.frontier[u], h = vd(e, u, d, f, !0);
          if (!h || h.childCount)
            continue e;
        }
        return { depth: t, fit: s, move: o ? 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 = ws(this.placed, t.depth, t.fit)), e = t.move;
    for (let n = t.depth + 1; n <= e.depth; n++) {
      let i = e.node(n), o = i.type.contentMatch.fillBefore(i.content, !0, e.index(n));
      this.openFrontierNode(i.type, i.attrs, o);
    }
    return e;
  }
  openFrontierNode(e, t = null, n) {
    let i = this.frontier[this.depth];
    i.match = i.match.matchType(e), this.placed = ws(this.placed, this.depth, F.from(e.create(t, n))), this.frontier.push({ type: e, match: e.contentMatch });
  }
  closeFrontierNode() {
    let t = this.frontier.pop().match.fillBefore(F.empty, !0);
    t.childCount && (this.placed = ws(this.placed, this.frontier.length, t));
  }
}
function ys(r, e, t) {
  return e == 0 ? r.cutByIndex(t, r.childCount) : r.replaceChild(0, r.firstChild.copy(ys(r.firstChild.content, e - 1, t)));
}
function ws(r, e, t) {
  return e == 0 ? r.append(t) : r.replaceChild(r.childCount - 1, r.lastChild.copy(ws(r.lastChild.content, e - 1, t)));
}
function hd(r, e) {
  for (let t = 0; t < e; t++)
    r = r.firstChild.content;
  return r;
}
function o1(r, e, t) {
  if (e <= 0)
    return r;
  let n = r.content;
  return e > 1 && (n = n.replaceChild(0, o1(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(F.empty, !0)))), r.copy(n);
}
function vd(r, e, t, n, i) {
  let o = r.node(e), s = i ? r.indexAfter(e) : r.index(e);
  if (s == o.childCount && !t.compatibleContent(o.type))
    return null;
  let u = n.fillBefore(o.content, !0, s);
  return u && !Vx(t, o.content, s) ? u : null;
}
function Vx(r, e, t) {
  for (let n = t; n < e.childCount; n++)
    if (!r.allowsMarks(e.child(n).marks))
      return !0;
  return !1;
}
function qx(r) {
  return r.spec.defining || r.spec.definingForContent;
}
function $x(r, e, t, n) {
  if (!n.size)
    return r.deleteRange(e, t);
  let i = r.doc.resolve(e), o = r.doc.resolve(t);
  if (i1(i, o, n))
    return r.step(new It(e, t, n));
  let s = s1(i, o);
  s[s.length - 1] == 0 && s.pop();
  let u = -(i.depth + 1);
  s.unshift(u);
  for (let y = i.depth, w = i.pos - 1; y > 0; y--, w--) {
    let k = i.node(y).type.spec;
    if (k.defining || k.definingAsContext || k.isolating)
      break;
    s.indexOf(y) > -1 ? u = y : i.before(y) == w && s.splice(1, 0, -y);
  }
  let f = s.indexOf(u), d = [], h = n.openStart;
  for (let y = n.content, w = 0; ; w++) {
    let k = y.firstChild;
    if (d.push(k), w == n.openStart)
      break;
    y = k.content;
  }
  for (let y = h - 1; y >= 0; y--) {
    let w = d[y], k = qx(w.type);
    if (k && !w.sameMarkup(i.node(Math.abs(u) - 1)))
      h = y;
    else if (k || !w.type.isTextblock)
      break;
  }
  for (let y = n.openStart; y >= 0; y--) {
    let w = (y + h + 1) % (n.openStart + 1), k = d[w];
    if (k)
      for (let b = 0; b < s.length; b++) {
        let T = s[(b + f) % s.length], E = !0;
        T < 0 && (E = !1, T = -T);
        let I = i.node(T - 1), P = i.index(T - 1);
        if (I.canReplaceWith(P, P, k.type, k.marks))
          return r.replace(i.before(T), E ? o.after(T) : t, new Q(a1(n.content, 0, n.openStart, w), w, n.openEnd));
      }
  }
  let m = r.steps.length;
  for (let y = s.length - 1; y >= 0 && (r.replace(e, t, n), !(r.steps.length > m)); y--) {
    let w = s[y];
    w < 0 || (e = i.before(w), t = o.after(w));
  }
}
function a1(r, e, t, n, i) {
  if (e < t) {
    let o = r.firstChild;
    r = r.replaceChild(0, o.copy(a1(o.content, e + 1, t, n, o)));
  }
  if (e > n) {
    let o = i.contentMatchAt(0), s = o.fillBefore(r).append(r);
    r = s.append(o.matchFragment(s).fillBefore(F.empty, !0));
  }
  return r;
}
function Ux(r, e, t, n) {
  if (!n.isInline && e == t && r.doc.resolve(e).parent.content.size) {
    let i = Hx(r.doc, e, n.type);
    i != null && (e = t = i);
  }
  r.replaceRange(e, t, new Q(F.from(n), 0, 0));
}
function jx(r, e, t) {
  let n = r.doc.resolve(e), i = r.doc.resolve(t), o = s1(n, i);
  for (let s = 0; s < o.length; s++) {
    let u = o[s], f = s == o.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 s1(r, e) {
  let t = [], n = Math.min(r.depth, e.depth);
  for (let i = n; i >= 0; i--) {
    let o = r.start(i);
    if (o < 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;
    (o == e.start(i) || i == r.depth && i == e.depth && r.parent.inlineContent && e.parent.inlineContent && i && e.start(i - 1) == o - 1) && t.push(i);
  }
  return t;
}
class ia extends Bt {
  /**
  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 Ye.fail("No node at attribute step's position");
    let n = /* @__PURE__ */ Object.create(null);
    for (let o in t.attrs)
      n[o] = t.attrs[o];
    n[this.attr] = this.value;
    let i = t.type.create(n, null, t.marks);
    return Ye.fromReplace(e, this.pos, this.pos + 1, new Q(F.from(i), 0, t.isLeaf ? 0 : 1));
  }
  getMap() {
    return Zt.empty;
  }
  invert(e) {
    return new ia(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 ia(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 ia(t.pos, t.attr, t.value);
  }
}
Bt.jsonID("attr", ia);
class As extends Bt {
  /**
  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 Ye.ok(n);
  }
  getMap() {
    return Zt.empty;
  }
  invert(e) {
    return new As(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 As(t.attr, t.value);
  }
}
Bt.jsonID("docAttr", As);
let aa = class extends Error {
};
aa = function r(e) {
  let t = Error.call(this, e);
  return t.__proto__ = r.prototype, t;
};
aa.prototype = Object.create(Error.prototype);
aa.prototype.constructor = aa;
aa.prototype.name = "TransformError";
class Wx {
  /**
  Create a transform that starts with the given document.
  */
  constructor(e) {
    this.doc = e, this.steps = [], this.docs = [], this.mapping = new Ds();
  }
  /**
  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 aa(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 = Q.empty) {
    let i = qp(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 Q(F.from(n), 0, 0));
  }
  /**
  Delete the content between the given positions.
  */
  delete(e, t) {
    return this.replace(e, t, Q.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 $x(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 Ux(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 jx(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 Ex(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 _x(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 Lx(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 Dx(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 Ix(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 ia(e, t, n)), this;
  }
  /**
  Set a single attribute on the document to a new value.
  */
  setDocAttribute(e, t) {
    return this.step(new As(e, t)), this;
  }
  /**
  Add a mark to the node at position `pos`.
  */
  addNodeMark(e, t) {
    return this.step(new fi(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 Ne)
      t.isInSet(n.marks) && this.step(new so(e, t));
    else {
      let i = n.marks, o, s = [];
      for (; o = t.isInSet(i); )
        s.push(new so(e, o)), i = o.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 Rx(this, e, t, n), this;
  }
  /**
  Add the given mark to the inline content between `from` and `to`.
  */
  addMark(e, t, n) {
    return Tx(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 xx(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 Vp(this, e, t, n), this;
  }
}
const md = /* @__PURE__ */ Object.create(null);
class ke {
  /**
  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 l1(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 = Q.empty) {
    let n = t.content.lastChild, i = null;
    for (let u = 0; u < t.openEnd; u++)
      i = n, n = n.lastChild;
    let o = e.steps.length, s = this.ranges;
    for (let u = 0; u < s.length; u++) {
      let { $from: f, $to: d } = s[u], h = e.mapping.slice(o);
      e.replaceRange(h.map(f.pos), h.map(d.pos), u ? Q.empty : t), u == 0 && Dg(e, o, (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 o = 0; o < i.length; o++) {
      let { $from: s, $to: u } = i[o], f = e.mapping.slice(n), d = f.map(s.pos), h = f.map(u.pos);
      o ? e.deleteRange(d, h) : (e.replaceRangeWith(d, h, t), Dg(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 Ce(e) : Yo(e.node(0), e.parent, e.pos, e.index(), t, n);
    if (i)
      return i;
    for (let o = e.depth - 1; o >= 0; o--) {
      let s = t < 0 ? Yo(e.node(0), e.node(o), e.before(o + 1), e.index(o), t, n) : Yo(e.node(0), e.node(o), e.after(o + 1), e.index(o) + 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 Vt(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 Yo(e, e, 0, 0, 1) || new Vt(e);
  }
  /**
  Find the cursor or leaf node selection closest to the end of the
  given document.
  */
  static atEnd(e) {
    return Yo(e, e, e.content.size, e.childCount, -1) || new Vt(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 = md[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 md)
      throw new RangeError("Duplicate use of selection JSON ID " + e);
    return md[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 Ce.between(this.$anchor, this.$head).getBookmark();
  }
}
ke.prototype.visible = !0;
class l1 {
  /**
  Create a range.
  */
  constructor(e, t) {
    this.$from = e, this.$to = t;
  }
}
let Ng = !1;
function Lg(r) {
  !Ng && !r.parent.inlineContent && (Ng = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
}
class Ce extends ke {
  /**
  Construct a text selection between the given points.
  */
  constructor(e, t = e) {
    Lg(e), Lg(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 ke.near(n);
    let i = e.resolve(t.map(this.anchor));
    return new Ce(i.parent.inlineContent ? i : n, n);
  }
  replace(e, t = Q.empty) {
    if (super.replace(e, t), t == Q.empty) {
      let n = this.$from.marksAcross(this.$to);
      n && e.ensureMarks(n);
    }
  }
  eq(e) {
    return e instanceof Ce && e.anchor == this.anchor && e.head == this.head;
  }
  getBookmark() {
    return new oc(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 Ce(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 o = ke.findFrom(t, n, !0) || ke.findFrom(t, -n, !0);
      if (o)
        t = o.$head;
      else
        return ke.near(t, n);
    }
    return e.parent.inlineContent || (i == 0 ? e = t : (e = (ke.findFrom(e, -n, !0) || ke.findFrom(e, n, !0)).$anchor, e.pos < t.pos != i < 0 && (e = t))), new Ce(e, t);
  }
}
ke.jsonID("text", Ce);
class oc {
  constructor(e, t) {
    this.anchor = e, this.head = t;
  }
  map(e) {
    return new oc(e.map(this.anchor), e.map(this.head));
  }
  resolve(e) {
    return Ce.between(e.resolve(this.anchor), e.resolve(this.head));
  }
}
class de extends ke {
  /**
  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), o = e.resolve(i);
    return n ? ke.near(o) : new de(o);
  }
  content() {
    return new Q(F.from(this.node), 0, 0);
  }
  eq(e) {
    return e instanceof de && e.anchor == this.anchor;
  }
  toJSON() {
    return { type: "node", anchor: this.anchor };
  }
  getBookmark() {
    return new $p(this.anchor);
  }
  /**
  @internal
  */
  static fromJSON(e, t) {
    if (typeof t.anchor != "number")
      throw new RangeError("Invalid input for NodeSelection.fromJSON");
    return new de(e.resolve(t.anchor));
  }
  /**
  Create a node selection from non-resolved positions.
  */
  static create(e, t) {
    return new de(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;
  }
}
de.prototype.visible = !1;
ke.jsonID("node", de);
class $p {
  constructor(e) {
    this.anchor = e;
  }
  map(e) {
    let { deleted: t, pos: n } = e.mapResult(this.anchor);
    return t ? new oc(n, n) : new $p(n);
  }
  resolve(e) {
    let t = e.resolve(this.anchor), n = t.nodeAfter;
    return n && de.isSelectable(n) ? new de(t) : ke.near(t);
  }
}
class Vt extends ke {
  /**
  Create an all-selection over the given document.
  */
  constructor(e) {
    super(e.resolve(0), e.resolve(e.content.size));
  }
  replace(e, t = Q.empty) {
    if (t == Q.empty) {
      e.delete(0, e.doc.content.size);
      let n = ke.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 Vt(e);
  }
  map(e) {
    return new Vt(e);
  }
  eq(e) {
    return e instanceof Vt;
  }
  getBookmark() {
    return Gx;
  }
}
ke.jsonID("all", Vt);
const Gx = {
  map() {
    return this;
  },
  resolve(r) {
    return new Vt(r);
  }
};
function Yo(r, e, t, n, i, o = !1) {
  if (e.inlineContent)
    return Ce.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 (!o && de.isSelectable(u))
        return de.create(r, t - (i < 0 ? u.nodeSize : 0));
    } else {
      let f = Yo(r, u, t + i, i < 0 ? u.childCount : 0, i, o);
      if (f)
        return f;
    }
    t += u.nodeSize * i;
  }
  return null;
}
function Dg(r, e, t) {
  let n = r.steps.length - 1;
  if (n < e)
    return;
  let i = r.steps[n];
  if (!(i instanceof It || i instanceof vt))
    return;
  let o = r.mapping.maps[n], s;
  o.forEach((u, f, d, h) => {
    s == null && (s = h);
  }), r.setSelection(ke.near(r.doc.resolve(s), t));
}
const Ag = 1, nu = 2, Ig = 4;
class Kx extends Wx {
  /**
  @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 | Ag) & ~nu, this.storedMarks = null, this;
  }
  /**
  Whether the selection was explicitly updated by this transaction.
  */
  get selectionSet() {
    return (this.updated & Ag) > 0;
  }
  /**
  Set the current stored marks.
  */
  setStoredMarks(e) {
    return this.storedMarks = e, this.updated |= nu, 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 Ne.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 & nu) > 0;
  }
  /**
  @internal
  */
  addStep(e, t) {
    super.addStep(e, t), this.updated = this.updated & ~nu, 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) || Ne.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 o = this.storedMarks;
      if (!o) {
        let s = this.doc.resolve(t);
        o = n == t ? s.marks() : s.marksAcross(this.doc.resolve(n));
      }
      return this.replaceRangeWith(t, n, i.text(e, o)), !this.selection.empty && this.selection.to == t + e.length && this.setSelection(ke.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 |= Ig, this;
  }
  /**
  True when this transaction has had `scrollIntoView` called on it.
  */
  get scrolledIntoView() {
    return (this.updated & Ig) > 0;
  }
}
function Rg(r, e) {
  return !e || !r ? r : r.bind(e);
}
class ks {
  constructor(e, t, n) {
    this.name = e, this.init = Rg(t.init, n), this.apply = Rg(t.apply, n);
  }
}
const Qx = [
  new ks("doc", {
    init(r) {
      return r.doc || r.schema.topNodeType.createAndFill();
    },
    apply(r) {
      return r.doc;
    }
  }),
  new ks("selection", {
    init(r, e) {
      return r.selection || ke.atStart(e.doc);
    },
    apply(r) {
      return r.selection;
    }
  }),
  new ks("storedMarks", {
    init(r) {
      return r.storedMarks || null;
    },
    apply(r, e, t, n) {
      return n.selection.$cursor ? r.storedMarks : null;
    }
  }),
  new ks("scrollToSelection", {
    init() {
      return 0;
    },
    apply(r, e) {
      return r.scrolledIntoView ? e + 1 : e;
    }
  })
];
class gd {
  constructor(e, t) {
    this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = Qx.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 ks(n.key, n.spec.state, n));
    });
  }
}
class Xi {
  /**
  @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 o = !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, d = i ? i[s].state : this, h = f < t.length && u.spec.appendTransaction.call(u, f ? t.slice(f) : t, d, n);
          if (h && n.filterTransaction(h, s)) {
            if (h.setMeta("appendedTransaction", e), !i) {
              i = [];
              for (let m = 0; m < this.config.plugins.length; m++)
                i.push(m < s ? { state: n, n: t.length } : { state: this, n: 0 });
            }
            t.push(h), n = n.applyInner(h), o = !0;
          }
          i && (i[s] = { state: n, n: t.length });
        }
      }
      if (!o)
        return { state: n, transactions: t };
    }
  }
  /**
  @internal
  */
  applyInner(e) {
    if (!e.before.eq(this.doc))
      throw new RangeError("Applying a mismatched transaction");
    let t = new Xi(this.config), n = this.config.fields;
    for (let i = 0; i < n.length; i++) {
      let o = n[i];
      t[o.name] = o.apply(e, this[o.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 Kx(this);
  }
  /**
  Create a new state.
  */
  static create(e) {
    let t = new gd(e.doc ? e.doc.type.schema : e.schema, e.plugins), n = new Xi(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 gd(this.schema, e.plugins), n = t.fields, i = new Xi(t);
    for (let o = 0; o < n.length; o++) {
      let s = n[o].name;
      i[s] = this.hasOwnProperty(s) ? this[s] : n[o].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], o = i.spec.state;
        o && o.toJSON && (t[n] = o.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 gd(e.schema, e.plugins), o = new Xi(i);
    return i.fields.forEach((s) => {
      if (s.name == "doc")
        o.doc = pi.fromJSON(e.schema, t.doc);
      else if (s.name == "selection")
        o.selection = ke.fromJSON(o.doc, t.selection);
      else if (s.name == "storedMarks")
        t.storedMarks && (o.storedMarks = t.storedMarks.map(e.schema.markFromJSON));
      else {
        if (n)
          for (let u in n) {
            let f = n[u], d = f.spec.state;
            if (f.key == s.name && d && d.fromJSON && Object.prototype.hasOwnProperty.call(t, u)) {
              o[s.name] = d.fromJSON.call(f, e, t[u], o);
              return;
            }
          }
        o[s.name] = s.init(e, o);
      }
    }), o;
  }
}
function u1(r, e, t) {
  for (let n in r) {
    let i = r[n];
    i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = u1(i, e, {})), t[n] = i;
  }
  return t;
}
class nr {
  /**
  Create a plugin.
  */
  constructor(e) {
    this.spec = e, this.props = {}, e.props && u1(e.props, this, this.props), this.key = e.key ? e.key.key : c1("plugin");
  }
  /**
  Extract the plugin's state field from an editor state.
  */
  getState(e) {
    return e[this.key];
  }
}
const yd = /* @__PURE__ */ Object.create(null);
function c1(r) {
  return r in yd ? r + "$" + ++yd[r] : (yd[r] = 0, r + "$");
}
class Fs {
  /**
  Create a plugin key.
  */
  constructor(e = "key") {
    this.key = c1(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 Tt = function(r) {
  for (var e = 0; ; e++)
    if (r = r.previousSibling, !r)
      return e;
}, sa = function(r) {
  let e = r.assignedSlot || r.parentNode;
  return e && e.nodeType == 11 ? e.host : e;
};
let np = null;
const Sn = function(r, e, t) {
  let n = np || (np = document.createRange());
  return n.setEnd(r, t ?? r.nodeValue.length), n.setStart(r, e || 0), n;
}, Jx = function() {
  np = null;
}, lo = function(r, e, t, n) {
  return t && (Pg(r, e, t, n, -1) || Pg(r, e, t, n, 1));
}, Xx = /^(img|br|input|textarea|hr)$/i;
function Pg(r, e, t, n, i) {
  for (var o; ; ) {
    if (r == t && e == n)
      return !0;
    if (e == (i < 0 ? 0 : Cr(r))) {
      let s = r.parentNode;
      if (!s || s.nodeType != 1 || zs(r) || Xx.test(r.nodeName) || r.contentEditable == "false")
        return !1;
      e = Tt(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 (!((o = s.pmViewDesc) === null || o === void 0) && o.ignoreForSelection)
          e += i;
        else
          return !1;
      else
        r = s, e = i < 0 ? Cr(r) : 0;
    } else
      return !1;
  }
}
function Cr(r) {
  return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
}
function Yx(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 = Cr(r);
    } else if (r.parentNode && !zs(r))
      e = Tt(r), r = r.parentNode;
    else
      return null;
  }
}
function Zx(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 && !zs(r))
      e = Tt(r) + 1, r = r.parentNode;
    else
      return null;
  }
}
function eS(r, e, t) {
  for (let n = e == 0, i = e == Cr(r); n || i; ) {
    if (r == t)
      return !0;
    let o = Tt(r);
    if (r = r.parentNode, !r)
      return !1;
    n = n && o == 0, i = i && o == Cr(r);
  }
}
function zs(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 ac = function(r) {
  return r.focusNode && lo(r.focusNode, r.focusOffset, r.anchorNode, r.anchorOffset);
};
function Ji(r, e) {
  let t = document.createEvent("Event");
  return t.initEvent("keydown", !0, !0), t.keyCode = r, t.key = t.code = e, t;
}
function tS(r) {
  let e = r.activeElement;
  for (; e && e.shadowRoot; )
    e = e.shadowRoot.activeElement;
  return e;
}
function rS(r, e, t) {
  if (r.caretPositionFromPoint)
    try {
      let n = r.caretPositionFromPoint(e, t);
      if (n)
        return { node: n.offsetNode, offset: Math.min(Cr(n.offsetNode), n.offset) };
    } catch {
    }
  if (r.caretRangeFromPoint) {
    let n = r.caretRangeFromPoint(e, t);
    if (n)
      return { node: n.startContainer, offset: Math.min(Cr(n.startContainer), n.startOffset) };
  }
}
const tn = typeof navigator < "u" ? navigator : null, Bg = typeof document < "u" ? document : null, bi = tn && tn.userAgent || "", ip = /Edge\/(\d+)/.exec(bi), f1 = /MSIE \d/.exec(bi), op = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bi), tr = !!(f1 || op || ip), hi = f1 ? document.documentMode : op ? +op[1] : ip ? +ip[1] : 0, br = !tr && /gecko\/(\d+)/i.test(bi);
br && +(/Firefox\/(\d+)/.exec(bi) || [0, 0])[1];
const ap = !tr && /Chrome\/(\d+)/.exec(bi), ht = !!ap, d1 = ap ? +ap[1] : 0, Pt = !tr && !!tn && /Apple Computer/.test(tn.vendor), la = Pt && (/Mobile\/\w+/.test(bi) || !!tn && tn.maxTouchPoints > 2), kr = la || (tn ? /Mac/.test(tn.platform) : !1), p1 = tn ? /Win/.test(tn.platform) : !1, On = /Android \d/.test(bi), Vs = !!Bg && "webkitFontSmoothing" in Bg.documentElement.style, nS = Vs ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
function iS(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 Tn(r, e) {
  return typeof r == "number" ? r : r[e];
}
function oS(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 _g(r, e, t) {
  let n = r.someProp("scrollThreshold") || 0, i = r.someProp("scrollMargin") || 5, o = r.dom.ownerDocument;
  for (let s = t || r.dom; s; ) {
    if (s.nodeType != 1) {
      s = sa(s);
      continue;
    }
    let u = s, f = u == o.body, d = f ? iS(o) : oS(u), h = 0, m = 0;
    if (e.top < d.top + Tn(n, "top") ? m = -(d.top - e.top + Tn(i, "top")) : e.bottom > d.bottom - Tn(n, "bottom") && (m = e.bottom - e.top > d.bottom - d.top ? e.top + Tn(i, "top") - d.top : e.bottom - d.bottom + Tn(i, "bottom")), e.left < d.left + Tn(n, "left") ? h = -(d.left - e.left + Tn(i, "left")) : e.right > d.right - Tn(n, "right") && (h = e.right - d.right + Tn(i, "right")), h || m)
      if (f)
        o.defaultView.scrollBy(h, m);
      else {
        let w = u.scrollLeft, k = u.scrollTop;
        m && (u.scrollTop += m), h && (u.scrollLeft += h);
        let b = u.scrollLeft - w, T = u.scrollTop - k;
        e = { left: e.left - b, top: e.top - T, right: e.right - b, bottom: e.bottom - T };
      }
    let y = f ? "fixed" : getComputedStyle(s).position;
    if (/^(fixed|sticky)$/.test(y))
      break;
    s = y == "absolute" ? s.offsetParent : sa(s);
  }
}
function aS(r) {
  let e = r.dom.getBoundingClientRect(), t = Math.max(0, e.top), n, i;
  for (let o = (e.left + e.right) / 2, s = t + 1; s < Math.min(innerHeight, e.bottom); s += 5) {
    let u = r.root.elementFromPoint(o, 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: h1(r.dom) };
}
function h1(r) {
  let e = [], t = r.ownerDocument;
  for (let n = r; n && (e.push({ dom: n, top: n.scrollTop, left: n.scrollLeft }), r != t); n = sa(n))
    ;
  return e;
}
function sS({ refDOM: r, refTop: e, stack: t }) {
  let n = r ? r.getBoundingClientRect().top : 0;
  v1(t, n == 0 ? 0 : n - e);
}
function v1(r, e) {
  for (let t = 0; t < r.length; t++) {
    let { dom: n, top: i, left: o } = r[t];
    n.scrollTop != i + e && (n.scrollTop = i + e), n.scrollLeft != o && (n.scrollLeft = o);
  }
}
let Go = null;
function lS(r) {
  if (r.setActive)
    return r.setActive();
  if (Go)
    return r.focus(Go);
  let e = h1(r);
  r.focus(Go == null ? {
    get preventScroll() {
      return Go = { preventScroll: !0 }, !0;
    }
  } : void 0), Go || (Go = !1, v1(e, 0));
}
function m1(r, e) {
  let t, n = 2e8, i, o = 0, s = e.top, u = e.top, f, d;
  for (let h = r.firstChild, m = 0; h; h = h.nextSibling, m++) {
    let y;
    if (h.nodeType == 1)
      y = h.getClientRects();
    else if (h.nodeType == 3)
      y = Sn(h).getClientRects();
    else
      continue;
    for (let w = 0; w < y.length; w++) {
      let k = y[w];
      if (k.top <= s && k.bottom >= u) {
        s = Math.max(k.bottom, s), u = Math.min(k.top, u);
        let b = k.left > e.left ? k.left - e.left : k.right < e.left ? e.left - k.right : 0;
        if (b < n) {
          t = h, n = b, i = b && t.nodeType == 3 ? {
            left: k.right < e.left ? k.right : k.left,
            top: e.top
          } : e, h.nodeType == 1 && b && (o = m + (e.left >= (k.left + k.right) / 2 ? 1 : 0));
          continue;
        }
      } else k.top > e.top && !f && k.left <= e.left && k.right >= e.left && (f = h, d = { left: Math.max(k.left, Math.min(k.right, e.left)), top: k.top });
      !t && (e.left >= k.right && e.top >= k.top || e.left >= k.left && e.top >= k.bottom) && (o = m + 1);
    }
  }
  return !t && f && (t = f, i = d, n = 0), t && t.nodeType == 3 ? uS(t, i) : !t || n && t.nodeType == 1 ? { node: r, offset: o } : m1(t, i);
}
function uS(r, e) {
  let t = r.nodeValue.length, n = document.createRange(), i;
  for (let o = 0; o < t; o++) {
    n.setEnd(r, o + 1), n.setStart(r, o);
    let s = oi(n, 1);
    if (s.top != s.bottom && Up(e, s)) {
      i = { node: r, offset: o + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
      break;
    }
  }
  return n.detach(), i || { node: r, offset: 0 };
}
function Up(r, e) {
  return r.left >= e.left - 1 && r.left <= e.right + 1 && r.top >= e.top - 1 && r.top <= e.bottom + 1;
}
function cS(r, e) {
  let t = r.parentNode;
  return t && /^li$/i.test(t.nodeName) && e.left < r.getBoundingClientRect().left ? t : r;
}
function fS(r, e, t) {
  let { node: n, offset: i } = m1(e, t), o = -1;
  if (n.nodeType == 1 && !n.firstChild) {
    let s = n.getBoundingClientRect();
    o = s.left != s.right && t.left > (s.left + s.right) / 2 ? 1 : -1;
  }
  return r.docView.posFromDOM(n, i, o);
}
function dS(r, e, t, n) {
  let i = -1;
  for (let o = e, s = !1; o != r.dom; ) {
    let u = r.docView.nearestDesc(o, !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;
    o = u.dom.parentNode;
  }
  return i > -1 ? i : r.docView.posFromDOM(e, t, -1);
}
function g1(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)), o = i; ; ) {
      let s = r.childNodes[o];
      if (s.nodeType == 1) {
        let u = s.getClientRects();
        for (let f = 0; f < u.length; f++) {
          let d = u[f];
          if (Up(e, d))
            return g1(s, e, d);
        }
      }
      if ((o = (o + 1) % n) == i)
        break;
    }
  return r;
}
function pS(r, e) {
  let t = r.dom.ownerDocument, n, i = 0, o = rS(t, e.left, e.top);
  o && ({ node: n, offset: i } = o);
  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 d = r.dom.getBoundingClientRect();
    if (!Up(e, d) || (s = g1(r.dom, e, d), !s))
      return null;
  }
  if (Pt)
    for (let d = s; n && d; d = sa(d))
      d.draggable && (n = void 0);
  if (s = cS(s, e), n) {
    if (br && n.nodeType == 1 && (i = Math.min(i, n.childNodes.length), i < n.childNodes.length)) {
      let h = n.childNodes[i], m;
      h.nodeName == "IMG" && (m = h.getBoundingClientRect()).right <= e.left && m.bottom > e.top && i++;
    }
    let d;
    Vs && i && n.nodeType == 1 && (d = n.childNodes[i - 1]).nodeType == 1 && d.contentEditable == "false" && d.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 = dS(r, n, i, e));
  }
  u == null && (u = fS(r, s, e));
  let f = r.docView.nearestDesc(s, !0);
  return { pos: u, inside: f ? f.posAtStart - f.border : -1 };
}
function Hg(r) {
  return r.top < r.bottom || r.left < r.right;
}
function oi(r, e) {
  let t = r.getClientRects();
  if (t.length) {
    let n = t[e < 0 ? 0 : t.length - 1];
    if (Hg(n))
      return n;
  }
  return Array.prototype.find.call(t, Hg) || r.getBoundingClientRect();
}
const hS = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
function y1(r, e, t) {
  let { node: n, offset: i, atom: o } = r.docView.domFromPos(e, t < 0 ? -1 : 1), s = Vs || br;
  if (n.nodeType == 3)
    if (s && (hS.test(n.nodeValue) || (t < 0 ? !i : i == n.nodeValue.length))) {
      let f = oi(Sn(n, i, i), t);
      if (br && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
        let d = oi(Sn(n, i - 1, i - 1), -1);
        if (d.top == f.top) {
          let h = oi(Sn(n, i, i + 1), -1);
          if (h.top != f.top)
            return fs(h, h.left < d.left);
        }
      }
      return f;
    } else {
      let f = i, d = i, h = t < 0 ? 1 : -1;
      return t < 0 && !i ? (d++, h = -1) : t >= 0 && i == n.nodeValue.length ? (f--, h = 1) : t < 0 ? f-- : d++, fs(oi(Sn(n, f, d), h), h < 0);
    }
  if (!r.state.doc.resolve(e - (o || 0)).parent.inlineContent) {
    if (o == null && i && (t < 0 || i == Cr(n))) {
      let f = n.childNodes[i - 1];
      if (f.nodeType == 1)
        return wd(f.getBoundingClientRect(), !1);
    }
    if (o == null && i < Cr(n)) {
      let f = n.childNodes[i];
      if (f.nodeType == 1)
        return wd(f.getBoundingClientRect(), !0);
    }
    return wd(n.getBoundingClientRect(), t >= 0);
  }
  if (o == null && i && (t < 0 || i == Cr(n))) {
    let f = n.childNodes[i - 1], d = f.nodeType == 3 ? Sn(f, Cr(f) - (s ? 0 : 1)) : f.nodeType == 1 && (f.nodeName != "BR" || !f.nextSibling) ? f : null;
    if (d)
      return fs(oi(d, 1), !1);
  }
  if (o == null && i < Cr(n)) {
    let f = n.childNodes[i];
    for (; f.pmViewDesc && f.pmViewDesc.ignoreForCoords; )
      f = f.nextSibling;
    let d = f ? f.nodeType == 3 ? Sn(f, 0, s ? 0 : 1) : f.nodeType == 1 ? f : null : null;
    if (d)
      return fs(oi(d, -1), !0);
  }
  return fs(oi(n.nodeType == 3 ? Sn(n) : n, -t), t >= 0);
}
function fs(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 wd(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 w1(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 vS(r, e, t) {
  let n = e.selection, i = t == "up" ? n.$from : n.$to;
  return w1(r, e, () => {
    let { node: o } = r.docView.domFromPos(i.pos, t == "up" ? -1 : 1);
    for (; ; ) {
      let u = r.docView.nearestDesc(o, !0);
      if (!u)
        break;
      if (u.node.isBlock) {
        o = u.contentDOM || u.dom;
        break;
      }
      o = u.dom.parentNode;
    }
    let s = y1(r, i.pos, 1);
    for (let u = o.firstChild; u; u = u.nextSibling) {
      let f;
      if (u.nodeType == 1)
        f = u.getClientRects();
      else if (u.nodeType == 3)
        f = Sn(u, 0, u.nodeValue.length).getClientRects();
      else
        continue;
      for (let d = 0; d < f.length; d++) {
        let h = f[d];
        if (h.bottom > h.top + 1 && (t == "up" ? s.top - h.top > (h.bottom - s.top) * 2 : h.bottom - s.bottom > (s.bottom - h.top) * 2))
          return !1;
      }
    }
    return !0;
  });
}
const mS = /[\u0590-\u08ac]/;
function gS(r, e, t) {
  let { $head: n } = e.selection;
  if (!n.parent.isTextblock)
    return !1;
  let i = n.parentOffset, o = !i, s = i == n.parent.content.size, u = r.domSelection();
  return u ? !mS.test(n.parent.textContent) || !u.modify ? t == "left" || t == "backward" ? o : s : w1(r, e, () => {
    let { focusNode: f, focusOffset: d, anchorNode: h, anchorOffset: m } = r.domSelectionRange(), y = u.caretBidiLevel;
    u.modify("move", t, "character");
    let w = n.depth ? r.docView.domAfterPos(n.before()) : r.dom, { focusNode: k, focusOffset: b } = r.domSelectionRange(), T = k && !w.contains(k.nodeType == 1 ? k : k.parentNode) || f == k && d == b;
    try {
      u.collapse(h, m), f && (f != h || d != m) && u.extend && u.extend(f, d);
    } catch {
    }
    return y != null && (u.caretBidiLevel = y), T;
  }) : n.pos == n.start() || n.pos == n.end();
}
let Fg = null, zg = null, Vg = !1;
function yS(r, e, t) {
  return Fg == e && zg == t ? Vg : (Fg = e, zg = t, Vg = t == "up" || t == "down" ? vS(r, e, t) : gS(r, e, t));
}
const Tr = 0, qg = 1, Yi = 2, rn = 3;
class qs {
  constructor(e, t, n, i) {
    this.parent = e, this.children = t, this.dom = n, this.contentDOM = i, this.dirty = Tr, 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 o, s;
        if (e == this.contentDOM)
          o = e.childNodes[t - 1];
        else {
          for (; e.parentNode != this.contentDOM; )
            e = e.parentNode;
          o = e.previousSibling;
        }
        for (; o && !((s = o.pmViewDesc) && s.parent == this); )
          o = o.previousSibling;
        return o ? this.posBeforeChild(s) + s.size : this.posAtStart;
      } else {
        let o, s;
        if (e == this.contentDOM)
          o = e.childNodes[t];
        else {
          for (; e.parentNode != this.contentDOM; )
            e = e.parentNode;
          o = e.nextSibling;
        }
        for (; o && !((s = o.pmViewDesc) && s.parent == this); )
          o = o.nextSibling;
        return o ? this.posBeforeChild(s) : this.posAtEnd;
      }
    let i;
    if (e == this.dom && this.contentDOM)
      i = t > Tt(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 o = e; ; o = o.parentNode) {
          if (o == this.dom) {
            i = !1;
            break;
          }
          if (o.previousSibling)
            break;
        }
      if (i == null && t == e.childNodes.length)
        for (let o = e; ; o = o.parentNode) {
          if (o == this.dom) {
            i = !0;
            break;
          }
          if (o.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 o = this.getDesc(i), s;
      if (o && (!t || o.node))
        if (n && (s = o.nodeDOM) && !(s.nodeType == 1 ? s.contains(e.nodeType == 1 ? e : e.parentNode) : s == e))
          n = !1;
        else
          return o;
    }
  }
  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 o = this.getDesc(i);
      if (o)
        return o.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], o = n + i.size;
      if (n == e && o != 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 < o)
        return i.descAt(e - n - i.border);
      n = o;
    }
  }
  domFromPos(e, t) {
    if (!this.contentDOM)
      return { node: this.dom, offset: 0, atom: e + 1 };
    let n = 0, i = 0;
    for (let o = 0; n < this.children.length; n++) {
      let s = this.children[n], u = o + s.size;
      if (u > e || s instanceof C1) {
        i = e - o;
        break;
      }
      o = u;
    }
    if (i)
      return this.children[n].domFromPos(i - this.children[n].border, t);
    for (let o; n && !(o = this.children[n - 1]).size && o instanceof k1 && o.side >= 0; n--)
      ;
    if (t <= 0) {
      let o, s = !0;
      for (; o = n ? this.children[n - 1] : null, !(!o || o.dom.parentNode == this.contentDOM); n--, s = !1)
        ;
      return o && t && s && !o.border && !o.domAtom ? o.domFromPos(o.size, t) : { node: this.contentDOM, offset: o ? Tt(o.dom) + 1 : 0 };
    } else {
      let o, s = !0;
      for (; o = n < this.children.length ? this.children[n] : null, !(!o || o.dom.parentNode == this.contentDOM); n++, s = !1)
        ;
      return o && s && !o.border && !o.domAtom ? o.domFromPos(0, t) : { node: this.contentDOM, offset: o ? Tt(o.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, o = -1;
    for (let s = n, u = 0; ; u++) {
      let f = this.children[u], d = s + f.size;
      if (i == -1 && e <= d) {
        let h = s + f.border;
        if (e >= h && t <= d - f.border && f.node && f.contentDOM && this.contentDOM.contains(f.contentDOM))
          return f.parseRange(e, t, h);
        e = s;
        for (let m = u; m > 0; m--) {
          let y = this.children[m - 1];
          if (y.size && y.dom.parentNode == this.contentDOM && !y.emptyChildAt(1)) {
            i = Tt(y.dom) + 1;
            break;
          }
          e -= y.size;
        }
        i == -1 && (i = 0);
      }
      if (i > -1 && (d > t || u == this.children.length - 1)) {
        t = d;
        for (let h = u + 1; h < this.children.length; h++) {
          let m = this.children[h];
          if (m.size && m.dom.parentNode == this.contentDOM && !m.emptyChildAt(-1)) {
            o = Tt(m.dom);
            break;
          }
          t += m.size;
        }
        o == -1 && (o = this.contentDOM.childNodes.length);
        break;
      }
      s = d;
    }
    return { node: this.contentDOM, from: e, to: t, fromOffset: i, toOffset: o };
  }
  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 o = Math.min(e, t), s = Math.max(e, t);
    for (let w = 0, k = 0; w < this.children.length; w++) {
      let b = this.children[w], T = k + b.size;
      if (o > k && s < T)
        return b.setSelection(e - k - b.border, t - k - b.border, n, i);
      k = T;
    }
    let u = this.domFromPos(e, e ? -1 : 1), f = t == e ? u : this.domFromPos(t, t ? -1 : 1), d = n.root.getSelection(), h = n.domSelectionRange(), m = !1;
    if ((br || Pt) && e == t) {
      let { node: w, offset: k } = u;
      if (w.nodeType == 3) {
        if (m = !!(k && w.nodeValue[k - 1] == `
`), m && k == w.nodeValue.length)
          for (let b = w, T; b; b = b.parentNode) {
            if (T = b.nextSibling) {
              T.nodeName == "BR" && (u = f = { node: T.parentNode, offset: Tt(T) + 1 });
              break;
            }
            let E = b.pmViewDesc;
            if (E && E.node && E.node.isBlock)
              break;
          }
      } else {
        let b = w.childNodes[k - 1];
        m = b && (b.nodeName == "BR" || b.contentEditable == "false");
      }
    }
    if (br && h.focusNode && h.focusNode != f.node && h.focusNode.nodeType == 1) {
      let w = h.focusNode.childNodes[h.focusOffset];
      w && w.contentEditable == "false" && (i = !0);
    }
    if (!(i || m && Pt) && lo(u.node, u.offset, h.anchorNode, h.anchorOffset) && lo(f.node, f.offset, h.focusNode, h.focusOffset))
      return;
    let y = !1;
    if ((d.extend || e == t) && !(m && br)) {
      d.collapse(u.node, u.offset);
      try {
        e != t && d.extend(f.node, f.offset), y = !0;
      } catch {
      }
    }
    if (!y) {
      if (e > t) {
        let k = u;
        u = f, f = k;
      }
      let w = document.createRange();
      w.setEnd(f.node, f.offset), w.setStart(u.node, u.offset), d.removeAllRanges(), d.addRange(w);
    }
  }
  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 o = this.children[i], s = n + o.size;
      if (n == s ? e <= s && t >= n : e < s && t > n) {
        let u = n + o.border, f = s - o.border;
        if (e >= u && t <= f) {
          this.dirty = e == n || t == s ? Yi : qg, e == u && t == f && (o.contentLost || o.dom.parentNode != this.contentDOM) ? o.dirty = rn : o.markDirty(e - u, t - u);
          return;
        } else
          o.dirty = o.dom == o.contentDOM && o.dom.parentNode == this.contentDOM && !o.children.length ? Yi : rn;
      }
      n = s;
    }
    this.dirty = Yi;
  }
  markParentsDirty() {
    let e = 1;
    for (let t = this.parent; t; t = t.parent, e++) {
      let n = e == 1 ? Yi : qg;
      t.dirty < n && (t.dirty = n);
    }
  }
  get domAtom() {
    return !1;
  }
  get ignoreForCoords() {
    return !1;
  }
  get ignoreForSelection() {
    return !1;
  }
  isText(e) {
    return !1;
  }
}
class k1 extends qs {
  constructor(e, t, n, i) {
    let o, s = t.type.toDOM;
    if (typeof s == "function" && (s = s(n, () => {
      if (!o)
        return i;
      if (o.parent)
        return o.parent.posBeforeChild(o);
    })), !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, o = this;
  }
  matchesWidget(e) {
    return this.dirty == Tr && 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 wS extends qs {
  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 uo extends qs {
  constructor(e, t, n, i, o) {
    super(e, [], n, i), this.mark = t, this.spec = o;
  }
  static create(e, t, n, i) {
    let o = i.nodeViews[t.type.name], s = o && o(t, i, n);
    return (!s || !s.dom) && (s = ka.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new uo(e, t, s.dom, s.contentDOM || s.dom, s);
  }
  parseRule() {
    return this.dirty & rn || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
  }
  matchesMark(e) {
    return this.dirty != rn && this.mark.eq(e);
  }
  markDirty(e, t) {
    if (super.markDirty(e, t), this.dirty != Tr) {
      let n = this.parent;
      for (; !n.node; )
        n = n.parent;
      n.dirty < this.dirty && (n.dirty = this.dirty), this.dirty = Tr;
    }
  }
  slice(e, t, n) {
    let i = uo.create(this.parent, this.mark, !0, n), o = this.children, s = this.size;
    t < s && (o = lp(o, t, s, n)), e > 0 && (o = lp(o, 0, e, n));
    for (let u = 0; u < o.length; u++)
      o[u].parent = i;
    return i.children = o, i;
  }
  ignoreMutation(e) {
    return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
  }
  destroy() {
    this.spec.destroy && this.spec.destroy(), super.destroy();
  }
}
class vi extends qs {
  constructor(e, t, n, i, o, s, u, f, d) {
    super(e, [], o, 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, o, s) {
    let u = o.nodeViews[t.type.name], f, d = u && u(t, o, () => {
      if (!f)
        return s;
      if (f.parent)
        return f.parent.posBeforeChild(f);
    }, n, i), h = d && d.dom, m = d && d.contentDOM;
    if (t.isText) {
      if (!h)
        h = document.createTextNode(t.text);
      else if (h.nodeType != 3)
        throw new RangeError("Text must be rendered as a DOM text node");
    } else h || ({ dom: h, contentDOM: m } = ka.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
    !m && !t.isText && h.nodeName != "BR" && (h.hasAttribute("contenteditable") || (h.contentEditable = "false"), t.type.spec.draggable && (h.draggable = !0));
    let y = h;
    return h = x1(h, n, t), d ? f = new kS(e, t, n, i, h, m || null, y, d, o, s + 1) : t.isText ? new sc(e, t, n, i, h, y, o) : new vi(e, t, n, i, h, m || null, y, o, 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 = () => F.empty);
    }
    return e;
  }
  matchesNode(e, t, n) {
    return this.dirty == Tr && e.eq(this.node) && Au(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, o = e.composing ? this.localCompositionInfo(e, t) : null, s = o && o.pos > -1 ? o : null, u = o && o.pos < 0, f = new bS(this, s && s.node, e);
    SS(this.node, this.innerDeco, (d, h, m) => {
      d.spec.marks ? f.syncToMarks(d.spec.marks, n, e) : d.type.side >= 0 && !m && f.syncToMarks(h == this.node.childCount ? Ne.none : this.node.child(h).marks, n, e), f.placeWidget(d, e, i);
    }, (d, h, m, y) => {
      f.syncToMarks(d.marks, n, e);
      let w;
      f.findNodeMatch(d, h, m, y) || u && e.state.selection.from > i && e.state.selection.to < i + d.nodeSize && (w = f.findIndexWithChild(o.node)) > -1 && f.updateNodeAt(d, h, m, w, e) || f.updateNextNode(d, h, m, e, y, i) || f.addNode(d, h, m, e, i), i += d.nodeSize;
    }), f.syncToMarks([], n, e), this.node.isTextblock && f.addTextblockHacks(), f.destroyRest(), (f.changed || this.dirty == Yi) && (s && this.protectLocalComposition(e, s), b1(this.contentDOM, this.children, e), la && ES(this.dom));
  }
  localCompositionInfo(e, t) {
    let { from: n, to: i } = e.state.selection;
    if (!(e.state.selection instanceof Ce) || n < t || i > t + this.node.content.size)
      return null;
    let o = e.input.compositionNode;
    if (!o || !this.dom.contains(o.parentNode))
      return null;
    if (this.node.inlineContent) {
      let s = o.nodeValue, u = MS(this.node.content, s, n - t, i - t);
      return u < 0 ? null : { node: o, pos: u, text: s };
    } else
      return { node: o, pos: -1, text: "" };
  }
  protectLocalComposition(e, { node: t, pos: n, text: i }) {
    if (this.getDesc(t))
      return;
    let o = t;
    for (; o.parentNode != this.contentDOM; o = o.parentNode) {
      for (; o.previousSibling; )
        o.parentNode.removeChild(o.previousSibling);
      for (; o.nextSibling; )
        o.parentNode.removeChild(o.nextSibling);
      o.pmViewDesc && (o.pmViewDesc = void 0);
    }
    let s = new wS(this, o, t, i);
    e.input.compositionNodes.push(s), this.children = lp(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 == rn || !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 = Tr;
  }
  updateOuterDeco(e) {
    if (Au(e, this.outerDeco))
      return;
    let t = this.nodeDOM.nodeType != 1, n = this.dom;
    this.dom = T1(this.dom, this.nodeDOM, sp(this.outerDeco, this.node, t), sp(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 $g(r, e, t, n, i) {
  x1(n, e, r);
  let o = new vi(void 0, r, e, t, n, n, n, i, 0);
  return o.contentDOM && o.updateChildren(i, 0), o;
}
class sc extends vi {
  constructor(e, t, n, i, o, s, u) {
    super(e, t, n, i, o, 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 == rn || this.dirty != Tr && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != Tr || 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 = Tr, !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), o = document.createTextNode(i.text);
    return new sc(this.parent, i, this.outerDeco, this.innerDeco, o, o, n);
  }
  markDirty(e, t) {
    super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = rn);
  }
  get domAtom() {
    return !1;
  }
  isText(e) {
    return this.node.text == e;
  }
}
class C1 extends qs {
  parseRule() {
    return { ignore: !0 };
  }
  matchesHack(e) {
    return this.dirty == Tr && this.dom.nodeName == e;
  }
  get domAtom() {
    return !0;
  }
  get ignoreForCoords() {
    return this.dom.nodeName == "IMG";
  }
}
class kS extends vi {
  constructor(e, t, n, i, o, s, u, f, d, h) {
    super(e, t, n, i, o, s, u, d, h), 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 == rn)
      return !1;
    if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
      let o = this.spec.update(e, t, n);
      return o && this.updateInner(e, t, n, i), o;
    } 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 b1(r, e, t) {
  let n = r.firstChild, i = !1;
  for (let o = 0; o < e.length; o++) {
    let s = e[o], u = s.dom;
    if (u.parentNode == r) {
      for (; u != n; )
        n = Ug(n), i = !0;
      n = n.nextSibling;
    } else
      i = !0, r.insertBefore(u, n);
    if (s instanceof uo) {
      let f = n ? n.previousSibling : r.lastChild;
      b1(s.contentDOM, s.children, t), n = f ? f.nextSibling : r.firstChild;
    }
  }
  for (; n; )
    n = Ug(n), i = !0;
  i && t.trackWrites == r && (t.trackWrites = null);
}
const Ss = function(r) {
  r && (this.nodeName = r);
};
Ss.prototype = /* @__PURE__ */ Object.create(null);
const Zi = [new Ss()];
function sp(r, e, t) {
  if (r.length == 0)
    return Zi;
  let n = t ? Zi[0] : new Ss(), i = [n];
  for (let o = 0; o < r.length; o++) {
    let s = r[o].type.attrs;
    if (s) {
      s.nodeName && i.push(n = new Ss(s.nodeName));
      for (let u in s) {
        let f = s[u];
        f != null && (t && i.length == 1 && i.push(n = new Ss(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 T1(r, e, t, n) {
  if (t == Zi && n == Zi)
    return e;
  let i = e;
  for (let o = 0; o < n.length; o++) {
    let s = n[o], u = t[o];
    if (o) {
      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 = Zi[0]), i = f;
    }
    CS(i, u || Zi[0], s);
  }
  return i;
}
function CS(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 o = 0; o < n.length; o++)
      i.indexOf(n[o]) == -1 && r.classList.remove(n[o]);
    for (let o = 0; o < i.length; o++)
      n.indexOf(i[o]) == -1 && r.classList.add(i[o]);
    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 x1(r, e, t) {
  return T1(r, r, Zi, sp(e, t, r.nodeType != 1));
}
function Au(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 Ug(r) {
  let e = r.nextSibling;
  return r.parentNode.removeChild(r), e;
}
class bS {
  constructor(e, t, n) {
    this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = TS(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, o = this.stack.length >> 1, s = Math.min(o, e.length);
    for (; i < s && (i == o - 1 ? this.top : this.stack[i + 1 << 1]).matchesMark(e[i]) && e[i].type.spec.spanning !== !1; )
      i++;
    for (; i < o; )
      this.destroyRest(), this.top.dirty = Tr, this.index = this.stack.pop(), this.top = this.stack.pop(), o--;
    for (; o < 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 d = this.top.children[f];
        if (d.matchesMark(e[o]) && !this.isLocked(d.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 = uo.create(this.top, e[o], t, n);
        this.top.children.splice(this.index, 0, f), this.top = f, this.changed = !0;
      }
      this.index = 0, o++;
    }
  }
  // Try to find a node desc matching the given data. Skip over it and
  // return true when successful.
  findNodeMatch(e, t, n, i) {
    let o = -1, s;
    if (i >= this.preMatch.index && (s = this.preMatch.matches[i - this.preMatch.index]).parent == this.top && s.matchesNode(e, t, n))
      o = 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 d = this.top.children[u];
        if (d.matchesNode(e, t, n) && !this.preMatch.matched.has(d)) {
          o = u;
          break;
        }
      }
    return o < 0 ? !1 : (this.destroyBetween(this.index, o), this.index++, !0);
  }
  updateNodeAt(e, t, n, i, o) {
    let s = this.top.children[i];
    return s.dirty == rn && s.dom == s.contentDOM && (s.dirty = Yi), s.update(e, t, n, o) ? (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, o, s) {
    for (let u = this.index; u < this.top.children.length; u++) {
      let f = this.top.children[u];
      if (f instanceof vi) {
        let d = this.preMatch.matched.get(f);
        if (d != null && d != o)
          return !1;
        let h = f.dom, m, y = this.isLocked(h) && !(e.isText && f.node && f.node.isText && f.nodeDOM.nodeValue == e.text && f.dirty != rn && Au(t, f.outerDeco));
        if (!y && f.update(e, t, n, i))
          return this.destroyBetween(this.index, u), f.dom != h && (this.changed = !0), this.index++, !0;
        if (!y && (m = this.recreateWrapper(f, e, t, n, i, s)))
          return this.destroyBetween(this.index, u), this.top.children[this.index] = m, m.contentDOM && (m.dirty = Yi, m.updateChildren(i, s + 1), m.dirty = Tr), 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, o, s) {
    if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !Au(n, e.outerDeco) || !i.eq(e.innerDeco))
      return null;
    let u = vi.create(this.top, t, n, i, o, 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, o) {
    let s = vi.create(this.top, e, t, n, i, o);
    s.contentDOM && s.updateChildren(i, o + 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 o = new k1(this.top, e, t, n);
      this.top.children.splice(this.index++, 0, o), 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 uo; )
      t = e, e = t.children[t.children.length - 1];
    (!e || // Empty textblock
    !(e instanceof sc) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((Pt || ht) && 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 C1(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 TS(r, e) {
  let t = e, n = t.children.length, i = r.childCount, o = /* @__PURE__ */ new Map(), s = [];
  e: for (; i > 0; ) {
    let u;
    for (; ; )
      if (n) {
        let d = t.children[n - 1];
        if (d instanceof uo)
          t = d, n = d.children.length;
        else {
          u = d, 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, o.set(u, i), s.push(u);
    }
  }
  return { index: i, matched: o, matches: s.reverse() };
}
function xS(r, e) {
  return r.type.side - e.type.side;
}
function SS(r, e, t, n) {
  let i = e.locals(r), o = 0;
  if (i.length == 0) {
    for (let d = 0; d < r.childCount; d++) {
      let h = r.child(d);
      n(h, i, e.forChild(o, h), d), o += h.nodeSize;
    }
    return;
  }
  let s = 0, u = [], f = null;
  for (let d = 0; ; ) {
    let h, m;
    for (; s < i.length && i[s].to == o; ) {
      let T = i[s++];
      T.widget && (h ? (m || (m = [h])).push(T) : h = T);
    }
    if (h)
      if (m) {
        m.sort(xS);
        for (let T = 0; T < m.length; T++)
          t(m[T], d, !!f);
      } else
        t(h, d, !!f);
    let y, w;
    if (f)
      w = -1, y = f, f = null;
    else if (d < r.childCount)
      w = d, y = r.child(d++);
    else
      break;
    for (let T = 0; T < u.length; T++)
      u[T].to <= o && u.splice(T--, 1);
    for (; s < i.length && i[s].from <= o && i[s].to > o; )
      u.push(i[s++]);
    let k = o + y.nodeSize;
    if (y.isText) {
      let T = k;
      s < i.length && i[s].from < T && (T = i[s].from);
      for (let E = 0; E < u.length; E++)
        u[E].to < T && (T = u[E].to);
      T < k && (f = y.cut(T - o), y = y.cut(0, T - o), k = T, w = -1);
    } else
      for (; s < i.length && i[s].to < k; )
        s++;
    let b = y.isInline && !y.isLeaf ? u.filter((T) => !T.inline) : u.slice();
    n(y, b, e.forChild(o, y), w), o = k;
  }
}
function ES(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 MS(r, e, t, n) {
  for (let i = 0, o = 0; i < r.childCount && o <= n; ) {
    let s = r.child(i++), u = o;
    if (o += s.nodeSize, !s.isText)
      continue;
    let f = s.text;
    for (; i < r.childCount; ) {
      let d = r.child(i++);
      if (o += d.nodeSize, !d.isText)
        break;
      f += d.text;
    }
    if (o >= t) {
      if (o >= n && f.slice(n - e.length - u, n - u) == e)
        return n - e.length;
      let d = u < n ? f.lastIndexOf(e, n - u - 1) : -1;
      if (d >= 0 && d + e.length + u >= t)
        return u + d;
      if (t == n && f.length >= n + e.length - u && f.slice(n - u, n - u + e.length) == e)
        return n;
    }
  }
  return -1;
}
function lp(r, e, t, n, i) {
  let o = [];
  for (let s = 0, u = 0; s < r.length; s++) {
    let f = r[s], d = u, h = u += f.size;
    d >= t || h <= e ? o.push(f) : (d < e && o.push(f.slice(0, e - d, n)), i && (o.push(i), i = void 0), h > t && o.push(f.slice(t - d, f.size, n)));
  }
  return o;
}
function jp(r, e = null) {
  let t = r.domSelectionRange(), n = r.state.doc;
  if (!t.focusNode)
    return null;
  let i = r.docView.nearestDesc(t.focusNode), o = i && i.size == 0, s = r.docView.posFromDOM(t.focusNode, t.focusOffset, 1);
  if (s < 0)
    return null;
  let u = n.resolve(s), f, d;
  if (ac(t)) {
    for (f = s; i && !i.node; )
      i = i.parent;
    let m = i.node;
    if (i && m.isAtom && de.isSelectable(m) && i.parent && !(m.isInline && eS(t.focusNode, t.focusOffset, i.dom))) {
      let y = i.posBefore;
      d = new de(s == y ? u : n.resolve(y));
    }
  } else {
    if (t instanceof r.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
      let m = s, y = s;
      for (let w = 0; w < t.rangeCount; w++) {
        let k = t.getRangeAt(w);
        m = Math.min(m, r.docView.posFromDOM(k.startContainer, k.startOffset, 1)), y = Math.max(y, r.docView.posFromDOM(k.endContainer, k.endOffset, -1));
      }
      if (m < 0)
        return null;
      [f, s] = y == r.state.selection.anchor ? [y, m] : [m, y], u = n.resolve(s);
    } else
      f = r.docView.posFromDOM(t.anchorNode, t.anchorOffset, 1);
    if (f < 0)
      return null;
  }
  let h = n.resolve(f);
  if (!d) {
    let m = e == "pointer" || r.state.selection.head < u.pos && !o ? 1 : -1;
    d = Wp(r, h, u, m);
  }
  return d;
}
function S1(r) {
  return r.editable ? r.hasFocus() : M1(r) && document.activeElement && document.activeElement.contains(r.dom);
}
function Ln(r, e = !1) {
  let t = r.state.selection;
  if (E1(r, t), !!S1(r)) {
    if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault && ht) {
      let n = r.domSelectionRange(), i = r.domObserver.currentSelection;
      if (n.anchorNode && i.anchorNode && lo(n.anchorNode, n.anchorOffset, i.anchorNode, i.anchorOffset)) {
        r.input.mouseDown.delayedSelectionSync = !0, r.domObserver.setCurSelection();
        return;
      }
    }
    if (r.domObserver.disconnectSelection(), r.cursorWrapper)
      NS(r);
    else {
      let { anchor: n, head: i } = t, o, s;
      jg && !(t instanceof Ce) && (t.$from.parent.inlineContent || (o = Wg(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (s = Wg(r, t.to))), r.docView.setSelection(n, i, r, e), jg && (o && Gg(o), s && Gg(s)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && OS(r));
    }
    r.domObserver.setCurSelection(), r.domObserver.connectSelection();
  }
}
const jg = Pt || ht && d1 < 63;
function Wg(r, e) {
  let { node: t, offset: n } = r.docView.domFromPos(e, 0), i = n < t.childNodes.length ? t.childNodes[n] : null, o = n ? t.childNodes[n - 1] : null;
  if (Pt && i && i.contentEditable == "false")
    return kd(i);
  if ((!i || i.contentEditable == "false") && (!o || o.contentEditable == "false")) {
    if (i)
      return kd(i);
    if (o)
      return kd(o);
  }
}
function kd(r) {
  return r.contentEditable = "true", Pt && r.draggable && (r.draggable = !1, r.wasDraggable = !0), r;
}
function Gg(r) {
  r.contentEditable = "false", r.wasDraggable && (r.draggable = !0, r.wasDraggable = null);
}
function OS(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(() => {
      (!S1(r) || r.state.selection.visible) && r.dom.classList.remove("ProseMirror-hideselection");
    }, 20));
  });
}
function NS(r) {
  let e = r.domSelection();
  if (!e)
    return;
  let t = r.cursorWrapper.dom, n = t.nodeName == "IMG";
  n ? e.collapse(t.parentNode, Tt(t) + 1) : e.collapse(t, 0), !n && !r.state.selection.visible && tr && hi <= 11 && (t.disabled = !0, t.disabled = !1);
}
function E1(r, e) {
  if (e instanceof de) {
    let t = r.docView.descAt(e.from);
    t != r.lastSelectedViewDesc && (Kg(r), t && t.selectNode(), r.lastSelectedViewDesc = t);
  } else
    Kg(r);
}
function Kg(r) {
  r.lastSelectedViewDesc && (r.lastSelectedViewDesc.parent && r.lastSelectedViewDesc.deselectNode(), r.lastSelectedViewDesc = void 0);
}
function Wp(r, e, t, n) {
  return r.someProp("createSelectionBetween", (i) => i(r, e, t)) || Ce.between(e, t, n);
}
function Qg(r) {
  return r.editable && !r.hasFocus() ? !1 : M1(r);
}
function M1(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 LS(r) {
  let e = r.docView.domFromPos(r.state.selection.anchor, 0), t = r.domSelectionRange();
  return lo(e.node, e.offset, t.anchorNode, t.anchorOffset);
}
function up(r, e) {
  let { $anchor: t, $head: n } = r.selection, i = e > 0 ? t.max(n) : t.min(n), o = i.parent.inlineContent ? i.depth ? r.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
  return o && ke.findFrom(o, e);
}
function ai(r, e) {
  return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()), !0;
}
function Jg(r, e, t) {
  let n = r.state.selection;
  if (n instanceof Ce)
    if (t.indexOf("s") > -1) {
      let { $head: i } = n, o = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter;
      if (!o || o.isText || !o.isLeaf)
        return !1;
      let s = r.state.doc.resolve(i.pos + o.nodeSize * (e < 0 ? -1 : 1));
      return ai(r, new Ce(n.$anchor, s));
    } else if (n.empty) {
      if (r.endOfTextblock(e > 0 ? "forward" : "backward")) {
        let i = up(r.state, e);
        return i && i instanceof de ? ai(r, i) : !1;
      } else if (!(kr && t.indexOf("m") > -1)) {
        let i = n.$head, o = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, s;
        if (!o || o.isText)
          return !1;
        let u = e < 0 ? i.pos - o.nodeSize : i.pos;
        return o.isAtom || (s = r.docView.descAt(u)) && !s.contentDOM ? de.isSelectable(o) ? ai(r, new de(e < 0 ? r.state.doc.resolve(i.pos - o.nodeSize) : i)) : Vs ? ai(r, new Ce(r.state.doc.resolve(e < 0 ? u : u + o.nodeSize))) : !1 : !1;
      }
    } else return !1;
  else {
    if (n instanceof de && n.node.isInline)
      return ai(r, new Ce(e > 0 ? n.$to : n.$from));
    {
      let i = up(r.state, e);
      return i ? ai(r, i) : !1;
    }
  }
}
function Iu(r) {
  return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
}
function Es(r, e) {
  let t = r.pmViewDesc;
  return t && t.size == 0 && (e < 0 || r.nextSibling || r.nodeName != "BR");
}
function Ko(r, e) {
  return e < 0 ? DS(r) : AS(r);
}
function DS(r) {
  let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
  if (!t)
    return;
  let i, o, s = !1;
  for (br && t.nodeType == 1 && n < Iu(t) && Es(t.childNodes[n], -1) && (s = !0); ; )
    if (n > 0) {
      if (t.nodeType != 1)
        break;
      {
        let u = t.childNodes[n - 1];
        if (Es(u, -1))
          i = t, o = --n;
        else if (u.nodeType == 3)
          t = u, n = t.nodeValue.length;
        else
          break;
      }
    } else {
      if (O1(t))
        break;
      {
        let u = t.previousSibling;
        for (; u && Es(u, -1); )
          i = t.parentNode, o = Tt(u), u = u.previousSibling;
        if (u)
          t = u, n = Iu(t);
        else {
          if (t = t.parentNode, t == r.dom)
            break;
          n = 0;
        }
      }
    }
  s ? cp(r, t, n) : i && cp(r, i, o);
}
function AS(r) {
  let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
  if (!t)
    return;
  let i = Iu(t), o, s;
  for (; ; )
    if (n < i) {
      if (t.nodeType != 1)
        break;
      let u = t.childNodes[n];
      if (Es(u, 1))
        o = t, s = ++n;
      else
        break;
    } else {
      if (O1(t))
        break;
      {
        let u = t.nextSibling;
        for (; u && Es(u, 1); )
          o = u.parentNode, s = Tt(u) + 1, u = u.nextSibling;
        if (u)
          t = u, n = 0, i = Iu(t);
        else {
          if (t = t.parentNode, t == r.dom)
            break;
          n = i = 0;
        }
      }
    }
  o && cp(r, o, s);
}
function O1(r) {
  let e = r.pmViewDesc;
  return e && e.node && e.node.isBlock;
}
function IS(r, e) {
  for (; r && e == r.childNodes.length && !zs(r); )
    e = Tt(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 RS(r, e) {
  for (; r && !e && !zs(r); )
    e = Tt(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 cp(r, e, t) {
  if (e.nodeType != 3) {
    let o, s;
    (s = IS(e, t)) ? (e = s, t = 0) : (o = RS(e, t)) && (e = o, t = o.nodeValue.length);
  }
  let n = r.domSelection();
  if (!n)
    return;
  if (ac(n)) {
    let o = document.createRange();
    o.setEnd(e, t), o.setStart(e, t), n.removeAllRanges(), n.addRange(o);
  } else n.extend && n.extend(e, t);
  r.domObserver.setCurSelection();
  let { state: i } = r;
  setTimeout(() => {
    r.state == i && Ln(r);
  }, 50);
}
function Xg(r, e) {
  let t = r.state.doc.resolve(e);
  if (!(ht || p1) && t.parent.inlineContent) {
    let i = r.coordsAtPos(e);
    if (e > t.start()) {
      let o = r.coordsAtPos(e - 1), s = (o.top + o.bottom) / 2;
      if (s > i.top && s < i.bottom && Math.abs(o.left - i.left) > 1)
        return o.left < i.left ? "ltr" : "rtl";
    }
    if (e < t.end()) {
      let o = r.coordsAtPos(e + 1), s = (o.top + o.bottom) / 2;
      if (s > i.top && s < i.bottom && Math.abs(o.left - i.left) > 1)
        return o.left > i.left ? "ltr" : "rtl";
    }
  }
  return getComputedStyle(r.dom).direction == "rtl" ? "rtl" : "ltr";
}
function Yg(r, e, t) {
  let n = r.state.selection;
  if (n instanceof Ce && !n.empty || t.indexOf("s") > -1 || kr && t.indexOf("m") > -1)
    return !1;
  let { $from: i, $to: o } = n;
  if (!i.parent.inlineContent || r.endOfTextblock(e < 0 ? "up" : "down")) {
    let s = up(r.state, e);
    if (s && s instanceof de)
      return ai(r, s);
  }
  if (!i.parent.inlineContent) {
    let s = e < 0 ? i : o, u = n instanceof Vt ? ke.near(s, e) : ke.findFrom(s, e);
    return u ? ai(r, u) : !1;
  }
  return !1;
}
function Zg(r, e) {
  if (!(r.state.selection instanceof Ce))
    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 o = !t.textOffset && (e < 0 ? t.nodeBefore : t.nodeAfter);
  if (o && !o.isText) {
    let s = r.state.tr;
    return e < 0 ? s.delete(t.pos - o.nodeSize, t.pos) : s.delete(t.pos, t.pos + o.nodeSize), r.dispatch(s), !0;
  }
  return !1;
}
function ey(r, e, t) {
  r.domObserver.stop(), e.contentEditable = t, r.domObserver.start();
}
function PS(r) {
  if (!Pt || 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;
    ey(r, n, "true"), setTimeout(() => ey(r, n, "false"), 20);
  }
  return !1;
}
function BS(r) {
  let e = "";
  return r.ctrlKey && (e += "c"), r.metaKey && (e += "m"), r.altKey && (e += "a"), r.shiftKey && (e += "s"), e;
}
function _S(r, e) {
  let t = e.keyCode, n = BS(e);
  if (t == 8 || kr && t == 72 && n == "c")
    return Zg(r, -1) || Ko(r, -1);
  if (t == 46 && !e.shiftKey || kr && t == 68 && n == "c")
    return Zg(r, 1) || Ko(r, 1);
  if (t == 13 || t == 27)
    return !0;
  if (t == 37 || kr && t == 66 && n == "c") {
    let i = t == 37 ? Xg(r, r.state.selection.from) == "ltr" ? -1 : 1 : -1;
    return Jg(r, i, n) || Ko(r, i);
  } else if (t == 39 || kr && t == 70 && n == "c") {
    let i = t == 39 ? Xg(r, r.state.selection.from) == "ltr" ? 1 : -1 : 1;
    return Jg(r, i, n) || Ko(r, i);
  } else {
    if (t == 38 || kr && t == 80 && n == "c")
      return Yg(r, -1, n) || Ko(r, -1);
    if (t == 40 || kr && t == 78 && n == "c")
      return PS(r) || Yg(r, 1, n) || Ko(r, 1);
    if (n == (kr ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
      return !0;
  }
  return !1;
}
function Gp(r, e) {
  r.someProp("transformCopied", (w) => {
    e = w(e, r);
  });
  let t = [], { content: n, openStart: i, openEnd: o } = e;
  for (; i > 1 && o > 1 && n.childCount == 1 && n.firstChild.childCount == 1; ) {
    i--, o--;
    let w = n.firstChild;
    t.push(w.type.name, w.attrs != w.type.defaultAttrs ? w.attrs : null), n = w.content;
  }
  let s = r.someProp("clipboardSerializer") || ka.fromSchema(r.state.schema), u = R1(), f = u.createElement("div");
  f.appendChild(s.serializeFragment(n, { document: u }));
  let d = f.firstChild, h, m = 0;
  for (; d && d.nodeType == 1 && (h = I1[d.nodeName.toLowerCase()]); ) {
    for (let w = h.length - 1; w >= 0; w--) {
      let k = u.createElement(h[w]);
      for (; f.firstChild; )
        k.appendChild(f.firstChild);
      f.appendChild(k), m++;
    }
    d = f.firstChild;
  }
  d && d.nodeType == 1 && d.setAttribute("data-pm-slice", `${i} ${o}${m ? ` -${m}` : ""} ${JSON.stringify(t)}`);
  let y = r.someProp("clipboardTextSerializer", (w) => w(e, r)) || e.content.textBetween(0, e.content.size, `

`);
  return { dom: f, text: y, slice: e };
}
function N1(r, e, t, n, i) {
  let o = i.parent.type.spec.code, s, u;
  if (!t && !e)
    return null;
  let f = !!e && (n || o || !t);
  if (f) {
    if (r.someProp("transformPastedText", (y) => {
      e = y(e, o || n, r);
    }), o)
      return u = new Q(F.from(r.state.schema.text(e.replace(/\r\n?/g, `
`))), 0, 0), r.someProp("transformPasted", (y) => {
        u = y(u, r, !0);
      }), u;
    let m = r.someProp("clipboardTextParser", (y) => y(e, i, n, r));
    if (m)
      u = m;
    else {
      let y = i.marks(), { schema: w } = r.state, k = ka.fromSchema(w);
      s = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((b) => {
        let T = s.appendChild(document.createElement("p"));
        b && T.appendChild(k.serializeNode(w.text(b, y)));
      });
    }
  } else
    r.someProp("transformPastedHTML", (m) => {
      t = m(t, r);
    }), s = VS(t), Vs && qS(s);
  let d = s && s.querySelector("[data-pm-slice]"), h = d && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice") || "");
  if (h && h[3])
    for (let m = +h[3]; m > 0; m--) {
      let y = s.firstChild;
      for (; y && y.nodeType != 1; )
        y = y.nextSibling;
      if (!y)
        break;
      s = y;
    }
  if (u || (u = (r.someProp("clipboardParser") || r.someProp("domParser") || ao.fromSchema(r.state.schema)).parseSlice(s, {
    preserveWhitespace: !!(f || h),
    context: i,
    ruleFromNode(y) {
      return y.nodeName == "BR" && !y.nextSibling && y.parentNode && !HS.test(y.parentNode.nodeName) ? { ignore: !0 } : null;
    }
  })), h)
    u = $S(ty(u, +h[1], +h[2]), h[4]);
  else if (u = Q.maxOpen(FS(u.content, i), !0), u.openStart || u.openEnd) {
    let m = 0, y = 0;
    for (let w = u.content.firstChild; m < u.openStart && !w.type.spec.isolating; m++, w = w.firstChild)
      ;
    for (let w = u.content.lastChild; y < u.openEnd && !w.type.spec.isolating; y++, w = w.lastChild)
      ;
    u = ty(u, m, y);
  }
  return r.someProp("transformPasted", (m) => {
    u = m(u, r, f);
  }), u;
}
const HS = /^(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 FS(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)), o, s = [];
    if (r.forEach((u) => {
      if (!s)
        return;
      let f = i.findWrapping(u.type), d;
      if (!f)
        return s = null;
      if (d = s.length && o.length && D1(f, o, u, s[s.length - 1], 0))
        s[s.length - 1] = d;
      else {
        s.length && (s[s.length - 1] = A1(s[s.length - 1], o.length));
        let h = L1(u, f);
        s.push(h), i = i.matchType(h.type), o = f;
      }
    }), s)
      return F.from(s);
  }
  return r;
}
function L1(r, e, t = 0) {
  for (let n = e.length - 1; n >= t; n--)
    r = e[n].create(null, F.from(r));
  return r;
}
function D1(r, e, t, n, i) {
  if (i < r.length && i < e.length && r[i] == e[i]) {
    let o = D1(r, e, t, n.lastChild, i + 1);
    if (o)
      return n.copy(n.content.replaceChild(n.childCount - 1, o));
    if (n.contentMatchAt(n.childCount).matchType(i == r.length - 1 ? t.type : r[i + 1]))
      return n.copy(n.content.append(F.from(L1(t, r, i + 1))));
  }
}
function A1(r, e) {
  if (e == 0)
    return r;
  let t = r.content.replaceChild(r.childCount - 1, A1(r.lastChild, e - 1)), n = r.contentMatchAt(r.childCount).fillBefore(F.empty, !0);
  return r.copy(t.append(n));
}
function fp(r, e, t, n, i, o) {
  let s = e < 0 ? r.firstChild : r.lastChild, u = s.content;
  return r.childCount > 1 && (o = 0), i < n - 1 && (u = fp(u, e, t, n, i + 1, o)), i >= t && (u = e < 0 ? s.contentMatchAt(0).fillBefore(u, o <= i).append(u) : u.append(s.contentMatchAt(s.childCount).fillBefore(F.empty, !0))), r.replaceChild(e < 0 ? 0 : r.childCount - 1, s.copy(u));
}
function ty(r, e, t) {
  return e < r.openStart && (r = new Q(fp(r.content, -1, e, r.openStart, 0, r.openEnd), e, r.openEnd)), t < r.openEnd && (r = new Q(fp(r.content, 1, t, r.openEnd, 0, 0), r.openStart, t)), r;
}
const I1 = {
  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 ry = null;
function R1() {
  return ry || (ry = document.implementation.createHTMLDocument("title"));
}
let Cd = null;
function zS(r) {
  let e = window.trustedTypes;
  return e ? (Cd || (Cd = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), Cd.createHTML(r)) : r;
}
function VS(r) {
  let e = /^(\s*<meta [^>]*>)*/.exec(r);
  e && (r = r.slice(e[0].length));
  let t = R1().createElement("div"), n = /<([a-z][^>\s]+)/i.exec(r), i;
  if ((i = n && I1[n[1].toLowerCase()]) && (r = i.map((o) => "<" + o + ">").join("") + r + i.map((o) => "</" + o + ">").reverse().join("")), t.innerHTML = zS(r), i)
    for (let o = 0; o < i.length; o++)
      t = t.querySelector(i[o]) || t;
  return t;
}
function qS(r) {
  let e = r.querySelectorAll(ht ? "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 $S(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: o, 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 = F.from(f.create(n[u + 1], i)), o++, s++;
  }
  return new Q(i, o, s);
}
const qt = {}, $t = {}, US = { touchstart: !0, touchmove: !0 };
class jS {
  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 WS(r) {
  for (let e in qt) {
    let t = qt[e];
    r.dom.addEventListener(e, r.input.eventHandlers[e] = (n) => {
      KS(r, n) && !Kp(r, n) && (r.editable || !(n.type in $t)) && t(r, n);
    }, US[e] ? { passive: !0 } : void 0);
  }
  Pt && r.dom.addEventListener("input", () => null), dp(r);
}
function di(r, e) {
  r.input.lastSelectionOrigin = e, r.input.lastSelectionTime = Date.now();
}
function GS(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 dp(r) {
  r.someProp("handleDOMEvents", (e) => {
    for (let t in e)
      r.input.eventHandlers[t] || r.dom.addEventListener(t, r.input.eventHandlers[t] = (n) => Kp(r, n));
  });
}
function Kp(r, e) {
  return r.someProp("handleDOMEvents", (t) => {
    let n = t[e.type];
    return n ? n(r, e) || e.defaultPrevented : !1;
  });
}
function KS(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 QS(r, e) {
  !Kp(r, e) && qt[e.type] && (r.editable || !(e.type in $t)) && qt[e.type](r, e);
}
$t.keydown = (r, e) => {
  let t = e;
  if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !B1(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(On && ht && t.keyCode == 13)))
    if (t.keyCode != 229 && r.domObserver.forceFlush(), la && 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, Ji(13, "Enter"))), r.input.lastIOSEnter = 0);
      }, 200);
    } else r.someProp("handleKeyDown", (n) => n(r, t)) || _S(r, t) ? t.preventDefault() : di(r, "key");
};
$t.keyup = (r, e) => {
  e.keyCode == 16 && (r.input.shiftKey = !1);
};
$t.keypress = (r, e) => {
  let t = e;
  if (B1(r, t) || !t.charCode || t.ctrlKey && !t.altKey || kr && t.metaKey)
    return;
  if (r.someProp("handleKeyPress", (i) => i(r, t))) {
    t.preventDefault();
    return;
  }
  let n = r.state.selection;
  if (!(n instanceof Ce) || !n.$from.sameParent(n.$to)) {
    let i = String.fromCharCode(t.charCode), o = () => r.state.tr.insertText(i).scrollIntoView();
    !/[\r\n]/.test(i) && !r.someProp("handleTextInput", (s) => s(r, n.$from.pos, n.$to.pos, i, o)) && r.dispatch(o()), t.preventDefault();
  }
};
function lc(r) {
  return { left: r.clientX, top: r.clientY };
}
function JS(r, e) {
  let t = e.x - r.clientX, n = e.y - r.clientY;
  return t * t + n * n < 100;
}
function Qp(r, e, t, n, i) {
  if (n == -1)
    return !1;
  let o = r.state.doc.resolve(n);
  for (let s = o.depth + 1; s > 0; s--)
    if (r.someProp(e, (u) => s > o.depth ? u(r, t, o.nodeAfter, o.before(s), i, !0) : u(r, t, o.node(s), o.before(s), i, !1)))
      return !0;
  return !1;
}
function oa(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 XS(r, e) {
  if (e == -1)
    return !1;
  let t = r.state.doc.resolve(e), n = t.nodeAfter;
  return n && n.isAtom && de.isSelectable(n) ? (oa(r, new de(t)), !0) : !1;
}
function YS(r, e) {
  if (e == -1)
    return !1;
  let t = r.state.selection, n, i;
  t instanceof de && (n = t.node);
  let o = r.state.doc.resolve(e);
  for (let s = o.depth + 1; s > 0; s--) {
    let u = s > o.depth ? o.nodeAfter : o.node(s);
    if (de.isSelectable(u)) {
      n && t.$from.depth > 0 && s >= t.$from.depth && o.before(t.$from.depth + 1) == t.$from.pos ? i = o.before(t.$from.depth) : i = o.before(s);
      break;
    }
  }
  return i != null ? (oa(r, de.create(r.state.doc, i)), !0) : !1;
}
function ZS(r, e, t, n, i) {
  return Qp(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (o) => o(r, e, n)) || (i ? YS(r, t) : XS(r, t));
}
function eE(r, e, t, n) {
  return Qp(r, "handleDoubleClickOn", e, t, n) || r.someProp("handleDoubleClick", (i) => i(r, e, n));
}
function tE(r, e, t, n) {
  return Qp(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) || rE(r, t, n);
}
function rE(r, e, t) {
  if (t.button != 0)
    return !1;
  let n = r.state.doc;
  if (e == -1)
    return n.inlineContent ? (oa(r, Ce.create(n, 0, n.content.size)), !0) : !1;
  let i = n.resolve(e);
  for (let o = i.depth + 1; o > 0; o--) {
    let s = o > i.depth ? i.nodeAfter : i.node(o), u = i.before(o);
    if (s.inlineContent)
      oa(r, Ce.create(n, u + 1, u + 1 + s.content.size));
    else if (de.isSelectable(s))
      oa(r, de.create(n, u));
    else
      continue;
    return !0;
  }
}
function Jp(r) {
  return Ru(r);
}
const P1 = kr ? "metaKey" : "ctrlKey";
qt.mousedown = (r, e) => {
  let t = e;
  r.input.shiftKey = t.shiftKey;
  let n = Jp(r), i = Date.now(), o = "singleClick";
  i - r.input.lastClick.time < 500 && JS(t, r.input.lastClick) && !t[P1] && r.input.lastClick.button == t.button && (r.input.lastClick.type == "singleClick" ? o = "doubleClick" : r.input.lastClick.type == "doubleClick" && (o = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: o, button: t.button };
  let s = r.posAtCoords(lc(t));
  s && (o == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new nE(r, s, t, !!n)) : (o == "doubleClick" ? eE : tE)(r, s.pos, s.inside, t) ? t.preventDefault() : di(r, "pointer"));
};
class nE {
  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[P1], this.allowDefault = n.shiftKey;
    let o, s;
    if (t.inside > -1)
      o = e.state.doc.nodeAt(t.inside), s = t.inside;
    else {
      let h = e.state.doc.resolve(t.pos);
      o = h.parent, s = h.depth ? h.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: d } = e.state;
    (n.button == 0 && o.type.spec.draggable && o.type.spec.selectable !== !1 || d instanceof de && d.from <= s && d.to > s) && (this.mightDrag = {
      node: o,
      pos: s,
      addAttr: !!(this.target && !this.target.draggable),
      setUneditable: !!(this.target && br && !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)), di(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(() => Ln(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(lc(e))), this.updateAllowDefault(e), this.allowDefault || !t ? di(this.view, "pointer") : ZS(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
    Pt && 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.
    ht && !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) ? (oa(this.view, ke.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : di(this.view, "pointer");
  }
  move(e) {
    this.updateAllowDefault(e), di(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);
  }
}
qt.touchstart = (r) => {
  r.input.lastTouch = Date.now(), Jp(r), di(r, "pointer");
};
qt.touchmove = (r) => {
  r.input.lastTouch = Date.now(), di(r, "pointer");
};
qt.contextmenu = (r) => Jp(r);
function B1(r, e) {
  return r.composing ? !0 : Pt && Math.abs(e.timeStamp - r.input.compositionEndedAt) < 500 ? (r.input.compositionEndedAt = -2e8, !0) : !1;
}
const iE = On ? 5e3 : -1;
$t.compositionstart = $t.compositionupdate = (r) => {
  if (!r.composing) {
    r.domObserver.flush();
    let { state: e } = r, t = e.selection.$to;
    if (e.selection instanceof Ce && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((n) => n.type.spec.inclusive === !1) || ht && p1 && oE(r)))
      r.markCursor = r.state.storedMarks || t.marks(), Ru(r, !0), r.markCursor = null;
    else if (Ru(r, !e.selection.empty), br && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
      let n = r.domSelectionRange();
      for (let i = n.focusNode, o = n.focusOffset; i && i.nodeType == 1 && o != 0; ) {
        let s = o < 0 ? i.lastChild : i.childNodes[o - 1];
        if (!s)
          break;
        if (s.nodeType == 3) {
          let u = r.domSelection();
          u && u.collapse(s, s.nodeValue.length);
          break;
        } else
          i = s, o = -1;
      }
    }
    r.input.composing = !0;
  }
  _1(r, iE);
};
function oE(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";
}
$t.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++, _1(r, 20));
};
function _1(r, e) {
  clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => Ru(r), e));
}
function H1(r) {
  for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = sE()); r.input.compositionNodes.length > 0; )
    r.input.compositionNodes.pop().markParentsDirty();
}
function aE(r) {
  let e = r.domSelectionRange();
  if (!e.focusNode)
    return null;
  let t = Yx(e.focusNode, e.focusOffset), n = Zx(e.focusNode, e.focusOffset);
  if (t && n && t != n) {
    let i = n.pmViewDesc, o = r.domObserver.lastChangedTextNode;
    if (t == o || n == o)
      return o;
    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 sE() {
  let r = document.createEvent("Event");
  return r.initEvent("event", !0, !0), r.timeStamp;
}
function Ru(r, e = !1) {
  if (!(On && r.domObserver.flushingSoon >= 0)) {
    if (r.domObserver.forceFlush(), H1(r), e || r.docView && r.docView.dirty) {
      let t = jp(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 lE(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 Is = tr && hi < 15 || la && nS < 604;
qt.copy = $t.cut = (r, e) => {
  let t = e, n = r.state.selection, i = t.type == "cut";
  if (n.empty)
    return;
  let o = Is ? null : t.clipboardData, s = n.content(), { dom: u, text: f } = Gp(r, s);
  o ? (t.preventDefault(), o.clearData(), o.setData("text/html", u.innerHTML), o.setData("text/plain", f)) : lE(r, u), i && r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
};
function uE(r) {
  return r.openStart == 0 && r.openEnd == 0 && r.content.childCount == 1 ? r.content.firstChild : null;
}
function cE(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 ? Rs(r, n.value, null, i, e) : Rs(r, n.textContent, n.innerHTML, i, e);
  }, 50);
}
function Rs(r, e, t, n, i) {
  let o = N1(r, e, t, n, r.state.selection.$from);
  if (r.someProp("handlePaste", (f) => f(r, i, o || Q.empty)))
    return !0;
  if (!o)
    return !1;
  let s = uE(o), u = s ? r.state.tr.replaceSelectionWith(s, n) : r.state.tr.replaceSelection(o);
  return r.dispatch(u.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
}
function F1(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, " ") : "";
}
$t.paste = (r, e) => {
  let t = e;
  if (r.composing && !On)
    return;
  let n = Is ? null : t.clipboardData, i = r.input.shiftKey && r.input.lastKeyCode != 45;
  n && Rs(r, F1(n), n.getData("text/html"), i, t) ? t.preventDefault() : cE(r, t);
};
class z1 {
  constructor(e, t, n) {
    this.slice = e, this.move = t, this.node = n;
  }
}
const fE = kr ? "altKey" : "ctrlKey";
function V1(r, e) {
  let t = r.someProp("dragCopies", (n) => !n(e));
  return t ?? !e[fE];
}
qt.dragstart = (r, e) => {
  let t = e, n = r.input.mouseDown;
  if (n && n.done(), !t.dataTransfer)
    return;
  let i = r.state.selection, o = i.empty ? null : r.posAtCoords(lc(t)), s;
  if (!(o && o.pos >= i.from && o.pos <= (i instanceof de ? i.to - 1 : i.to))) {
    if (n && n.mightDrag)
      s = de.create(r.state.doc, n.mightDrag.pos);
    else if (t.target && t.target.nodeType == 1) {
      let m = r.docView.nearestDesc(t.target, !0);
      m && m.node.type.spec.draggable && m != r.docView && (s = de.create(r.state.doc, m.posBefore));
    }
  }
  let u = (s || r.state.selection).content(), { dom: f, text: d, slice: h } = Gp(r, u);
  (!t.dataTransfer.files.length || !ht || d1 > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(Is ? "Text" : "text/html", f.innerHTML), t.dataTransfer.effectAllowed = "copyMove", Is || t.dataTransfer.setData("text/plain", d), r.dragging = new z1(h, V1(r, t), s);
};
qt.dragend = (r) => {
  let e = r.dragging;
  window.setTimeout(() => {
    r.dragging == e && (r.dragging = null);
  }, 50);
};
$t.dragover = $t.dragenter = (r, e) => e.preventDefault();
$t.drop = (r, e) => {
  try {
    dE(r, e, r.dragging);
  } finally {
    r.dragging = null;
  }
};
function dE(r, e, t) {
  if (!e.dataTransfer)
    return;
  let n = r.posAtCoords(lc(e));
  if (!n)
    return;
  let i = r.state.doc.resolve(n.pos), o = t && t.slice;
  o ? r.someProp("transformPasted", (w) => {
    o = w(o, r, !1);
  }) : o = N1(r, F1(e.dataTransfer), Is ? null : e.dataTransfer.getData("text/html"), !1, i);
  let s = !!(t && V1(r, e));
  if (r.someProp("handleDrop", (w) => w(r, e, o || Q.empty, s))) {
    e.preventDefault();
    return;
  }
  if (!o)
    return;
  e.preventDefault();
  let u = o ? Fx(r.state.doc, i.pos, o) : i.pos;
  u == null && (u = i.pos);
  let f = r.state.tr;
  if (s) {
    let { node: w } = t;
    w ? w.replace(f) : f.deleteSelection();
  }
  let d = f.mapping.map(u), h = o.openStart == 0 && o.openEnd == 0 && o.content.childCount == 1, m = f.doc;
  if (h ? f.replaceRangeWith(d, d, o.content.firstChild) : f.replaceRange(d, d, o), f.doc.eq(m))
    return;
  let y = f.doc.resolve(d);
  if (h && de.isSelectable(o.content.firstChild) && y.nodeAfter && y.nodeAfter.sameMarkup(o.content.firstChild))
    f.setSelection(new de(y));
  else {
    let w = f.mapping.map(u);
    f.mapping.maps[f.mapping.maps.length - 1].forEach((k, b, T, E) => w = E), f.setSelection(Wp(r, y, f.doc.resolve(w)));
  }
  r.focus(), r.dispatch(f.setMeta("uiEvent", "drop"));
}
qt.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()) && Ln(r);
  }, 20));
};
qt.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);
};
qt.beforeinput = (r, e) => {
  if (ht && On && 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", (o) => o(r, Ji(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 $t)
  qt[r] = $t[r];
function Ps(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 Pu {
  constructor(e, t) {
    this.toDOM = e, this.spec = t || ro, this.side = this.spec.side || 0;
  }
  map(e, t, n, i) {
    let { pos: o, deleted: s } = e.mapResult(t.from + i, this.side < 0 ? -1 : 1);
    return s ? null : new er(o - n, o - n, this);
  }
  valid() {
    return !0;
  }
  eq(e) {
    return this == e || e instanceof Pu && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && Ps(this.spec, e.spec));
  }
  destroy(e) {
    this.spec.destroy && this.spec.destroy(e);
  }
}
class mi {
  constructor(e, t) {
    this.attrs = e, this.spec = t || ro;
  }
  map(e, t, n, i) {
    let o = e.map(t.from + i, this.spec.inclusiveStart ? -1 : 1) - n, s = e.map(t.to + i, this.spec.inclusiveEnd ? 1 : -1) - n;
    return o >= s ? null : new er(o, s, this);
  }
  valid(e, t) {
    return t.from < t.to;
  }
  eq(e) {
    return this == e || e instanceof mi && Ps(this.attrs, e.attrs) && Ps(this.spec, e.spec);
  }
  static is(e) {
    return e.type instanceof mi;
  }
  destroy() {
  }
}
class Xp {
  constructor(e, t) {
    this.attrs = e, this.spec = t || ro;
  }
  map(e, t, n, i) {
    let o = e.mapResult(t.from + i, 1);
    if (o.deleted)
      return null;
    let s = e.mapResult(t.to + i, -1);
    return s.deleted || s.pos <= o.pos ? null : new er(o.pos - n, s.pos - n, this);
  }
  valid(e, t) {
    let { index: n, offset: i } = e.content.findIndex(t.from), o;
    return i == t.from && !(o = e.child(n)).isText && i + o.nodeSize == t.to;
  }
  eq(e) {
    return this == e || e instanceof Xp && Ps(this.attrs, e.attrs) && Ps(this.spec, e.spec);
  }
  destroy() {
  }
}
class er {
  /**
  @internal
  */
  constructor(e, t, n) {
    this.from = e, this.to = t, this.type = n;
  }
  /**
  @internal
  */
  copy(e, t) {
    return new er(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 er(e, e, new Pu(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 er(e, t, new mi(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 er(e, t, new Xp(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 mi;
  }
  /**
  @internal
  */
  get widget() {
    return this.type instanceof Pu;
  }
}
const Zo = [], ro = {};
class Je {
  /**
  @internal
  */
  constructor(e, t) {
    this.local = e.length ? e : Zo, this.children = t.length ? t : Zo;
  }
  /**
  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 ? Bu(t, e, 0, ro) : At;
  }
  /**
  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, o) {
    for (let s = 0; s < this.local.length; s++) {
      let u = this.local[s];
      u.from <= t && u.to >= e && (!o || o(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, o);
      }
  }
  /**
  Map the set of decorations in response to a change in the
  document.
  */
  map(e, t, n) {
    return this == At || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, n || ro);
  }
  /**
  @internal
  */
  mapInner(e, t, n, i, o) {
    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) : o.onRemove && o.onRemove(this.local[u].spec);
    }
    return this.children.length ? pE(this.children, s || [], e, t, n, i, o) : s ? new Je(s.sort(no), Zo) : At;
  }
  /**
  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 == At ? Je.create(e, t) : this.addInner(e, t, 0) : this;
  }
  addInner(e, t, n) {
    let i, o = 0;
    e.forEach((u, f) => {
      let d = f + n, h;
      if (h = $1(t, u, d)) {
        for (i || (i = this.children.slice()); o < i.length && i[o] < f; )
          o += 3;
        i[o] == f ? i[o + 2] = i[o + 2].addInner(u, h, d + 1) : i.splice(o, 0, f, f + u.nodeSize, Bu(h, u, d + 1, ro)), o += 3;
      }
    });
    let s = q1(o ? U1(t) : t, -n);
    for (let u = 0; u < s.length; u++)
      s[u].type.valid(e, s[u]) || s.splice(u--, 1);
    return new Je(s.length ? this.local.concat(s).sort(no) : 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 == At ? this : this.removeInner(e, 0);
  }
  removeInner(e, t) {
    let n = this.children, i = this.local;
    for (let o = 0; o < n.length; o += 3) {
      let s, u = n[o] + t, f = n[o + 1] + t;
      for (let h = 0, m; h < e.length; h++)
        (m = e[h]) && m.from > u && m.to < f && (e[h] = null, (s || (s = [])).push(m));
      if (!s)
        continue;
      n == this.children && (n = this.children.slice());
      let d = n[o + 2].removeInner(s, u + 1);
      d != At ? n[o + 2] = d : (n.splice(o, 3), o -= 3);
    }
    if (i.length) {
      for (let o = 0, s; o < e.length; o++)
        if (s = e[o])
          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 Je(i, n) : At;
  }
  forChild(e, t) {
    if (this == At)
      return this;
    if (t.isLeaf)
      return Je.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 o = e + 1, s = o + t.content.size;
    for (let u = 0; u < this.local.length; u++) {
      let f = this.local[u];
      if (f.from < s && f.to > o && f.type instanceof mi) {
        let d = Math.max(o, f.from) - o, h = Math.min(s, f.to) - o;
        d < h && (i || (i = [])).push(f.copy(d, h));
      }
    }
    if (i) {
      let u = new Je(i.sort(no), Zo);
      return n ? new li([u, n]) : u;
    }
    return n || At;
  }
  /**
  @internal
  */
  eq(e) {
    if (this == e)
      return !0;
    if (!(e instanceof Je) || 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 Yp(this.localsInner(e));
  }
  /**
  @internal
  */
  localsInner(e) {
    if (this == At)
      return Zo;
    if (e.inlineContent || !this.local.some(mi.is))
      return this.local;
    let t = [];
    for (let n = 0; n < this.local.length; n++)
      this.local[n].type instanceof mi || t.push(this.local[n]);
    return t;
  }
  forEachSet(e) {
    e(this);
  }
}
Je.empty = new Je([], []);
Je.removeOverlap = Yp;
const At = Je.empty;
class li {
  constructor(e) {
    this.members = e;
  }
  map(e, t) {
    const n = this.members.map((i) => i.map(e, t, ro));
    return li.from(n);
  }
  forChild(e, t) {
    if (t.isLeaf)
      return Je.empty;
    let n = [];
    for (let i = 0; i < this.members.length; i++) {
      let o = this.members[i].forChild(e, t);
      o != At && (o instanceof li ? n = n.concat(o.members) : n.push(o));
    }
    return li.from(n);
  }
  eq(e) {
    if (!(e instanceof li) || 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 o = this.members[i].localsInner(e);
      if (o.length)
        if (!t)
          t = o;
        else {
          n && (t = t.slice(), n = !1);
          for (let s = 0; s < o.length; s++)
            t.push(o[s]);
        }
    }
    return t ? Yp(n ? t : t.sort(no)) : Zo;
  }
  // 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 At;
      case 1:
        return e[0];
      default:
        return new li(e.every((t) => t instanceof Je) ? e : e.reduce((t, n) => t.concat(n instanceof Je ? n : n.members), []));
    }
  }
  forEachSet(e) {
    for (let t = 0; t < this.members.length; t++)
      this.members[t].forEachSet(e);
  }
}
function pE(r, e, t, n, i, o, s) {
  let u = r.slice();
  for (let d = 0, h = o; d < t.maps.length; d++) {
    let m = 0;
    t.maps[d].forEach((y, w, k, b) => {
      let T = b - k - (w - y);
      for (let E = 0; E < u.length; E += 3) {
        let I = u[E + 1];
        if (I < 0 || y > I + h - m)
          continue;
        let P = u[E] + h - m;
        w >= P ? u[E + 1] = y <= P ? -2 : -1 : y >= h && T && (u[E] += T, u[E + 1] += T);
      }
      m += T;
    }), h = t.maps[d].map(h, -1);
  }
  let f = !1;
  for (let d = 0; d < u.length; d += 3)
    if (u[d + 1] < 0) {
      if (u[d + 1] == -2) {
        f = !0, u[d + 1] = -1;
        continue;
      }
      let h = t.map(r[d] + o), m = h - i;
      if (m < 0 || m >= n.content.size) {
        f = !0;
        continue;
      }
      let y = t.map(r[d + 1] + o, -1), w = y - i, { index: k, offset: b } = n.content.findIndex(m), T = n.maybeChild(k);
      if (T && b == m && b + T.nodeSize == w) {
        let E = u[d + 2].mapInner(t, T, h + 1, r[d] + o + 1, s);
        E != At ? (u[d] = m, u[d + 1] = w, u[d + 2] = E) : (u[d + 1] = -2, f = !0);
      } else
        f = !0;
    }
  if (f) {
    let d = hE(u, r, e, t, i, o, s), h = Bu(d, n, 0, s);
    e = h.local;
    for (let m = 0; m < u.length; m += 3)
      u[m + 1] < 0 && (u.splice(m, 3), m -= 3);
    for (let m = 0, y = 0; m < h.children.length; m += 3) {
      let w = h.children[m];
      for (; y < u.length && u[y] < w; )
        y += 3;
      u.splice(y, 0, h.children[m], h.children[m + 1], h.children[m + 2]);
    }
  }
  return new Je(e.sort(no), u);
}
function q1(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 er(i.from + e, i.to + e, i.type));
  }
  return t;
}
function hE(r, e, t, n, i, o, s) {
  function u(f, d) {
    for (let h = 0; h < f.local.length; h++) {
      let m = f.local[h].map(n, i, d);
      m ? t.push(m) : s.onRemove && s.onRemove(f.local[h].spec);
    }
    for (let h = 0; h < f.children.length; h += 3)
      u(f.children[h + 2], f.children[h] + d + 1);
  }
  for (let f = 0; f < r.length; f += 3)
    r[f + 1] == -1 && u(r[f + 2], e[f] + o + 1);
  return t;
}
function $1(r, e, t) {
  if (e.isLeaf)
    return null;
  let n = t + e.nodeSize, i = null;
  for (let o = 0, s; o < r.length; o++)
    (s = r[o]) && s.from > t && s.to < n && ((i || (i = [])).push(s), r[o] = null);
  return i;
}
function U1(r) {
  let e = [];
  for (let t = 0; t < r.length; t++)
    r[t] != null && e.push(r[t]);
  return e;
}
function Bu(r, e, t, n) {
  let i = [], o = !1;
  e.forEach((u, f) => {
    let d = $1(r, u, f + t);
    if (d) {
      o = !0;
      let h = Bu(d, u, t + f + 1, n);
      h != At && i.push(f, f + u.nodeSize, h);
    }
  });
  let s = q1(o ? U1(r) : r, -t).sort(no);
  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 Je(s, i) : At;
}
function no(r, e) {
  return r.from - e.from || r.to - e.to;
}
function Yp(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 o = e[i];
        if (o.from == n.from) {
          o.to != n.to && (e == r && (e = r.slice()), e[i] = o.copy(o.from, n.to), ny(e, i + 1, o.copy(n.to, o.to)));
          continue;
        } else {
          o.from < n.to && (e == r && (e = r.slice()), e[t] = n.copy(n.from, o.from), ny(e, i, n.copy(o.from, n.to)));
          break;
        }
      }
  }
  return e;
}
function ny(r, e, t) {
  for (; e < r.length && no(t, r[e]) > 0; )
    e++;
  r.splice(e, 0, t);
}
function bd(r) {
  let e = [];
  return r.someProp("decorations", (t) => {
    let n = t(r.state);
    n && n != At && e.push(n);
  }), r.cursorWrapper && e.push(Je.create(r.state.doc, [r.cursorWrapper.deco])), li.from(e);
}
const vE = {
  childList: !0,
  characterData: !0,
  characterDataOldValue: !0,
  attributes: !0,
  attributeOldValue: !0,
  subtree: !0
}, mE = tr && hi <= 11;
class gE {
  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 yE {
  constructor(e, t) {
    this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new gE(), 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]);
      tr && hi <= 11 && n.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
    }), mE && (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, vE)), 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 (Qg(this.view)) {
      if (this.suppressingSelectionUpdates)
        return Ln(this.view);
      if (tr && hi <= 11 && !this.view.state.selection.empty) {
        let e = this.view.domSelectionRange();
        if (e.focusNode && lo(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 o = e.focusNode; o; o = sa(o))
      t.add(o);
    for (let o = e.anchorNode; o; o = sa(o))
      if (t.has(o)) {
        n = o;
        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) && Qg(e) && !this.ignoreSelectionChange(n), o = -1, s = -1, u = !1, f = [];
    if (e.editable)
      for (let h = 0; h < t.length; h++) {
        let m = this.registerMutation(t[h], f);
        m && (o = o < 0 ? m.from : Math.min(m.from, o), s = s < 0 ? m.to : Math.max(m.to, s), m.typeOver && (u = !0));
      }
    if (br && f.length) {
      let h = f.filter((m) => m.nodeName == "BR");
      if (h.length == 2) {
        let [m, y] = h;
        m.parentNode && m.parentNode.parentNode == y.parentNode ? y.remove() : m.remove();
      } else {
        let { focusNode: m } = this.currentSelection;
        for (let y of h) {
          let w = y.parentNode;
          w && w.nodeName == "LI" && (!m || CE(e, m) != w) && y.remove();
        }
      }
    } else if ((ht || Pt) && f.some((h) => h.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46)) {
      for (let h of f)
        if (h.nodeName == "BR" && h.parentNode) {
          let m = h.nextSibling;
          m && m.nodeType == 1 && m.contentEditable == "false" && h.parentNode.removeChild(h);
        }
    }
    let d = null;
    o < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && ac(n) && (d = jp(e)) && d.eq(ke.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Ln(e), this.currentSelection.set(n), e.scrollToSelection()) : (o > -1 || i) && (o > -1 && (e.docView.markDirty(o, s), wE(e)), this.handleDOMChange(o, s, u, f), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || Ln(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 h = 0; h < e.addedNodes.length; h++) {
        let m = e.addedNodes[h];
        t.push(m), m.nodeType == 3 && (this.lastChangedTextNode = m);
      }
      if (n.contentDOM && n.contentDOM != n.dom && !n.contentDOM.contains(e.target))
        return { from: n.posBefore, to: n.posAfter };
      let i = e.previousSibling, o = e.nextSibling;
      if (tr && hi <= 11 && e.addedNodes.length)
        for (let h = 0; h < e.addedNodes.length; h++) {
          let { previousSibling: m, nextSibling: y } = e.addedNodes[h];
          (!m || Array.prototype.indexOf.call(e.addedNodes, m) < 0) && (i = m), (!y || Array.prototype.indexOf.call(e.addedNodes, y) < 0) && (o = y);
        }
      let s = i && i.parentNode == e.target ? Tt(i) + 1 : 0, u = n.localPosFromDOM(e.target, s, -1), f = o && o.parentNode == e.target ? Tt(o) : e.target.childNodes.length, d = n.localPosFromDOM(e.target, f, 1);
      return { from: u, to: d };
    } 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 iy = /* @__PURE__ */ new WeakMap(), oy = !1;
function wE(r) {
  if (!iy.has(r) && (iy.set(r, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace) !== -1)) {
    if (r.requiresGeckoHackNode = br, oy)
      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."), oy = !0;
  }
}
function ay(r, e) {
  let t = e.startContainer, n = e.startOffset, i = e.endContainer, o = e.endOffset, s = r.domAtPos(r.state.selection.anchor);
  return lo(s.node, s.offset, i, o) && ([t, n, i, o] = [i, o, t, n]), { anchorNode: t, anchorOffset: n, focusNode: i, focusOffset: o };
}
function kE(r, e) {
  if (e.getComposedRanges) {
    let i = e.getComposedRanges(r.root)[0];
    if (i)
      return ay(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 ? ay(r, t) : null;
}
function CE(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 bE(r, e, t) {
  let { node: n, fromOffset: i, toOffset: o, from: s, to: u } = r.docView.parseRange(e, t), f = r.domSelectionRange(), d, h = f.anchorNode;
  if (h && r.dom.contains(h.nodeType == 1 ? h : h.parentNode) && (d = [{ node: h, offset: f.anchorOffset }], ac(f) || d.push({ node: f.focusNode, offset: f.focusOffset })), ht && r.input.lastKeyCode === 8)
    for (let T = o; T > i; T--) {
      let E = n.childNodes[T - 1], I = E.pmViewDesc;
      if (E.nodeName == "BR" && !I) {
        o = T;
        break;
      }
      if (!I || I.size)
        break;
    }
  let m = r.state.doc, y = r.someProp("domParser") || ao.fromSchema(r.state.schema), w = m.resolve(s), k = null, b = y.parse(n, {
    topNode: w.parent,
    topMatch: w.parent.contentMatchAt(w.index()),
    topOpen: !0,
    from: i,
    to: o,
    preserveWhitespace: w.parent.type.whitespace == "pre" ? "full" : !0,
    findPositions: d,
    ruleFromNode: TE,
    context: w
  });
  if (d && d[0].pos != null) {
    let T = d[0].pos, E = d[1] && d[1].pos;
    E == null && (E = T), k = { anchor: T + s, head: E + s };
  }
  return { doc: b, sel: k, from: s, to: u };
}
function TE(r) {
  let e = r.pmViewDesc;
  if (e)
    return e.parseRule();
  if (r.nodeName == "BR" && r.parentNode) {
    if (Pt && /^(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 || Pt && /^(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 xE = /^(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 SE(r, e, t, n, i) {
  let o = r.input.compositionPendingChanges || (r.composing ? r.input.compositionID : 0);
  if (r.input.compositionPendingChanges = 0, e < 0) {
    let q = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, K = jp(r, q);
    if (K && !r.state.selection.eq(K)) {
      if (ht && On && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (be) => be(r, Ji(13, "Enter"))))
        return;
      let ce = r.state.tr.setSelection(K);
      q == "pointer" ? ce.setMeta("pointer", !0) : q == "key" && ce.scrollIntoView(), o && ce.setMeta("composition", o), r.dispatch(ce);
    }
    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, d = bE(r, e, t), h = r.state.doc, m = h.slice(d.from, d.to), y, w;
  r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (y = r.state.selection.to, w = "end") : (y = r.state.selection.from, w = "start"), r.input.lastKeyCode = null;
  let k = OE(m.content, d.doc.content, d.from, y, w);
  if (k && r.input.domChangeCount++, (la && r.input.lastIOSEnter > Date.now() - 225 || On) && i.some((q) => q.nodeType == 1 && !xE.test(q.nodeName)) && (!k || k.endA >= k.endB) && r.someProp("handleKeyDown", (q) => q(r, Ji(13, "Enter")))) {
    r.input.lastIOSEnter = 0;
    return;
  }
  if (!k)
    if (n && f instanceof Ce && !f.empty && f.$head.sameParent(f.$anchor) && !r.composing && !(d.sel && d.sel.anchor != d.sel.head))
      k = { start: f.from, endA: f.to, endB: f.to };
    else {
      if (d.sel) {
        let q = sy(r, r.state.doc, d.sel);
        if (q && !q.eq(r.state.selection)) {
          let K = r.state.tr.setSelection(q);
          o && K.setMeta("composition", o), r.dispatch(K);
        }
      }
      return;
    }
  r.state.selection.from < r.state.selection.to && k.start == k.endB && r.state.selection instanceof Ce && (k.start > r.state.selection.from && k.start <= r.state.selection.from + 2 && r.state.selection.from >= d.from ? k.start = r.state.selection.from : k.endA < r.state.selection.to && k.endA >= r.state.selection.to - 2 && r.state.selection.to <= d.to && (k.endB += r.state.selection.to - k.endA, k.endA = r.state.selection.to)), tr && hi <= 11 && k.endB == k.start + 1 && k.endA == k.start && k.start > d.from && d.doc.textBetween(k.start - d.from - 1, k.start - d.from + 1) == "  " && (k.start--, k.endA--, k.endB--);
  let b = d.doc.resolveNoCache(k.start - d.from), T = d.doc.resolveNoCache(k.endB - d.from), E = h.resolve(k.start), I = b.sameParent(T) && b.parent.inlineContent && E.end() >= k.endA;
  if ((la && r.input.lastIOSEnter > Date.now() - 225 && (!I || i.some((q) => q.nodeName == "DIV" || q.nodeName == "P")) || !I && b.pos < d.doc.content.size && (!b.sameParent(T) || !b.parent.inlineContent) && b.pos < T.pos && !/\S/.test(d.doc.textBetween(b.pos, T.pos, "", ""))) && r.someProp("handleKeyDown", (q) => q(r, Ji(13, "Enter")))) {
    r.input.lastIOSEnter = 0;
    return;
  }
  if (r.state.selection.anchor > k.start && ME(h, k.start, k.endA, b, T) && r.someProp("handleKeyDown", (q) => q(r, Ji(8, "Backspace")))) {
    On && ht && r.domObserver.suppressSelectionUpdates();
    return;
  }
  ht && k.endB == k.start && (r.input.lastChromeDelete = Date.now()), On && !I && b.start() != T.start() && T.parentOffset == 0 && b.depth == T.depth && d.sel && d.sel.anchor == d.sel.head && d.sel.head == k.endA && (k.endB -= 2, T = d.doc.resolveNoCache(k.endB - d.from), setTimeout(() => {
    r.someProp("handleKeyDown", function(q) {
      return q(r, Ji(13, "Enter"));
    });
  }, 20));
  let P = k.start, _ = k.endA, V = (q) => {
    let K = q || r.state.tr.replace(P, _, d.doc.slice(k.start - d.from, k.endB - d.from));
    if (d.sel) {
      let ce = sy(r, K.doc, d.sel);
      ce && !(ht && r.composing && ce.empty && (k.start != k.endB || r.input.lastChromeDelete < Date.now() - 100) && (ce.head == P || ce.head == K.mapping.map(_) - 1) || tr && ce.empty && ce.head == P) && K.setSelection(ce);
    }
    return o && K.setMeta("composition", o), K.scrollIntoView();
  }, W;
  if (I)
    if (b.pos == T.pos) {
      tr && hi <= 11 && b.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => Ln(r), 20));
      let q = V(r.state.tr.delete(P, _)), K = h.resolve(k.start).marksAcross(h.resolve(k.endA));
      K && q.ensureMarks(K), r.dispatch(q);
    } else if (
      // Adding or removing a mark
      k.endA == k.endB && (W = EE(b.parent.content.cut(b.parentOffset, T.parentOffset), E.parent.content.cut(E.parentOffset, k.endA - E.start())))
    ) {
      let q = V(r.state.tr);
      W.type == "add" ? q.addMark(P, _, W.mark) : q.removeMark(P, _, W.mark), r.dispatch(q);
    } else if (b.parent.child(b.index()).isText && b.index() == T.index() - (T.textOffset ? 0 : 1)) {
      let q = b.parent.textBetween(b.parentOffset, T.parentOffset), K = () => V(r.state.tr.insertText(q, P, _));
      r.someProp("handleTextInput", (ce) => ce(r, P, _, q, K)) || r.dispatch(K());
    } else
      r.dispatch(V());
  else
    r.dispatch(V());
}
function sy(r, e, t) {
  return Math.max(t.anchor, t.head) > e.content.size ? null : Wp(r, e.resolve(t.anchor), e.resolve(t.head));
}
function EE(r, e) {
  let t = r.firstChild.marks, n = e.firstChild.marks, i = t, o = n, s, u, f;
  for (let h = 0; h < n.length; h++)
    i = n[h].removeFromSet(i);
  for (let h = 0; h < t.length; h++)
    o = t[h].removeFromSet(o);
  if (i.length == 1 && o.length == 0)
    u = i[0], s = "add", f = (h) => h.mark(u.addToSet(h.marks));
  else if (i.length == 0 && o.length == 1)
    u = o[0], s = "remove", f = (h) => h.mark(u.removeFromSet(h.marks));
  else
    return null;
  let d = [];
  for (let h = 0; h < e.childCount; h++)
    d.push(f(e.child(h)));
  if (F.from(d).eq(r))
    return { mark: u, type: s };
}
function ME(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
    Td(n, !0, !1) < i.pos
  )
    return !1;
  let o = r.resolve(e);
  if (!n.parent.isTextblock) {
    let u = o.nodeAfter;
    return u != null && t == e + u.nodeSize;
  }
  if (o.parentOffset < o.parent.content.size || !o.parent.isTextblock)
    return !1;
  let s = r.resolve(Td(o, !0, !0));
  return !s.parent.isTextblock || s.pos > t || Td(s, !0, !1) < t ? !1 : n.parent.content.cut(n.parentOffset).eq(s.parent.content);
}
function Td(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 o = r.node(n).maybeChild(r.indexAfter(n));
    for (; o && !o.isLeaf; )
      o = o.firstChild, i++;
  }
  return i;
}
function OE(r, e, t, n, i) {
  let o = r.findDiffStart(e, t);
  if (o == 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, o - Math.min(s, u));
    n -= s + f - o;
  }
  if (s < o && r.size < e.size) {
    let f = n <= o && n >= s ? o - n : 0;
    o -= f, o && o < e.size && ly(e.textBetween(o - 1, o + 1)) && (o += f ? 1 : -1), u = o + (u - s), s = o;
  } else if (u < o) {
    let f = n <= o && n >= u ? o - n : 0;
    o -= f, o && o < r.size && ly(r.textBetween(o - 1, o + 1)) && (o += f ? 1 : -1), s = o + (s - u), u = o;
  }
  return { start: o, endA: s, endB: u };
}
function ly(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 uc {
  /**
  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 jS(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(py), 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 = fy(this), cy(this), this.nodeViews = dy(this), this.docView = $g(this.state.doc, uy(this), bd(this), this.dom, this), this.domObserver = new yE(this, (n, i, o, s) => SE(this, n, i, o, s)), this.domObserver.start(), WS(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 && dp(this);
    let t = this._props;
    this._props = e, e.plugins && (e.plugins.forEach(py), 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, o = !1, s = !1;
    e.storedMarks && this.composing && (H1(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 w = dy(this);
      LE(w, this.nodeViews) && (this.nodeViews = w, o = !0);
    }
    (u || t.handleDOMEvents != this._props.handleDOMEvents) && dp(this), this.editable = fy(this), cy(this);
    let f = bd(this), d = uy(this), h = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", m = o || !this.docView.matchesNode(e.doc, d, f);
    (m || !e.selection.eq(i.selection)) && (s = !0);
    let y = h == "preserve" && s && this.dom.style.overflowAnchor == null && aS(this);
    if (s) {
      this.domObserver.stop();
      let w = m && (tr || ht) && !this.composing && !i.selection.empty && !e.selection.empty && NE(i.selection, e.selection);
      if (m) {
        let k = ht ? this.trackWrites = this.domSelectionRange().focusNode : null;
        this.composing && (this.input.compositionNode = aE(this)), (o || !this.docView.update(e.doc, d, f, this)) && (this.docView.updateOuterDeco(d), this.docView.destroy(), this.docView = $g(e.doc, d, f, this.dom, this)), k && !this.trackWrites && (w = !0);
      }
      w || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && LS(this)) ? Ln(this, w) : (E1(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), h == "reset" ? this.dom.scrollTop = 0 : h == "to selection" ? this.scrollToSelection() : y && sS(y);
  }
  /**
  @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 de) {
        let t = this.docView.domAfterPos(this.state.selection.from);
        t.nodeType == 1 && _g(this, t.getBoundingClientRect(), e);
      } else
        _g(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 o = n.from + (this.state.doc.content.size - t.doc.content.size);
      (o > 0 && this.state.doc.nodeAt(o)) == n.node && (i = o);
    }
    this.dragging = new z1(e.slice, e.move, i < 0 ? void 0 : de.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 o = this.state.plugins;
    if (o)
      for (let s = 0; s < o.length; s++) {
        let u = o[s].props[e];
        if (u != null && (i = t ? t(u) : u))
          return i;
      }
  }
  /**
  Query whether the view has focus.
  */
  hasFocus() {
    if (tr) {
      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 && lS(this.dom), Ln(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 pS(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 y1(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 yS(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 Rs(this, "", e, !1, t || new ClipboardEvent("paste"));
  }
  /**
  Run the editor's paste logic with the given plain-text input.
  */
  pasteText(e, t) {
    return Rs(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 Gp(this, e);
  }
  /**
  Removes the editor from the DOM and destroys all [node
  views](https://prosemirror.net/docs/ref/#view.NodeView).
  */
  destroy() {
    this.docView && (GS(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], bd(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Jx());
  }
  /**
  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 QS(this, e);
  }
  /**
  @internal
  */
  domSelectionRange() {
    let e = this.domSelection();
    return e ? Pt && this.root.nodeType === 11 && tS(this.dom.ownerDocument) == this.dom && kE(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
  }
  /**
  @internal
  */
  domSelection() {
    return this.root.getSelection();
  }
}
uc.prototype.dispatch = function(r) {
  let e = this._props.dispatchTransaction;
  e ? e.call(this, r) : this.updateState(this.state.apply(r));
};
function uy(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"), [er.node(0, r.state.doc.content.size, e)];
}
function cy(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: er.widget(r.state.selection.from, e, { raw: !0, marks: r.markCursor }) };
  } else
    r.cursorWrapper = null;
}
function fy(r) {
  return !r.someProp("editable", (e) => e(r.state) === !1);
}
function NE(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 dy(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 LE(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 py(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 ki = {
  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: "'"
}, _u = {
  48: ")",
  49: "!",
  50: "@",
  51: "#",
  52: "$",
  53: "%",
  54: "^",
  55: "&",
  56: "*",
  57: "(",
  59: ":",
  61: "+",
  173: "_",
  186: ":",
  187: "+",
  188: "<",
  189: "_",
  190: ">",
  191: "?",
  192: "~",
  219: "{",
  220: "|",
  221: "}",
  222: '"'
}, DE = typeof navigator < "u" && /Mac/.test(navigator.platform), AE = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
for (var xt = 0; xt < 10; xt++) ki[48 + xt] = ki[96 + xt] = String(xt);
for (var xt = 1; xt <= 24; xt++) ki[xt + 111] = "F" + xt;
for (var xt = 65; xt <= 90; xt++)
  ki[xt] = String.fromCharCode(xt + 32), _u[xt] = String.fromCharCode(xt);
for (var xd in ki) _u.hasOwnProperty(xd) || (_u[xd] = ki[xd]);
function IE(r) {
  var e = DE && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || AE && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? _u : ki)[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 RE = typeof navigator < "u" && /Mac|iP(hone|[oa]d)/.test(navigator.platform), PE = typeof navigator < "u" && /Win/.test(navigator.platform);
function BE(r) {
  let e = r.split(/-(?!$)/), t = e[e.length - 1];
  t == "Space" && (t = " ");
  let n, i, o, 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))
      o = !0;
    else if (/^mod$/i.test(f))
      RE ? 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), o && (t = "Shift-" + t), t;
}
function _E(r) {
  let e = /* @__PURE__ */ Object.create(null);
  for (let t in r)
    e[BE(t)] = r[t];
  return e;
}
function Sd(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 Bs(r) {
  return new nr({ props: { handleKeyDown: HE(r) } });
}
function HE(r) {
  let e = _E(r);
  return function(t, n) {
    let i = IE(n), o, s = e[Sd(i, n)];
    if (s && s(t.state, t.dispatch, t))
      return !0;
    if (i.length == 1 && i != " ") {
      if (n.shiftKey) {
        let u = e[Sd(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
      !(PE && n.ctrlKey && n.altKey) && (o = ki[n.keyCode]) && o != i) {
        let u = e[Sd(o, n)];
        if (u && u(t.state, t.dispatch, t))
          return !0;
      }
    }
    return !1;
  };
}
const Zp = (r, e) => r.selection.empty ? !1 : (e && e(r.tr.deleteSelection().scrollIntoView()), !0);
function FE(r, e) {
  let { $cursor: t } = r.selection;
  return !t || (e ? !e.endOfTextblock("backward", r) : t.parentOffset > 0) ? null : t;
}
const zE = (r, e, t) => {
  let n = FE(r, t);
  if (!n)
    return !1;
  let i = j1(n);
  if (!i) {
    let s = n.blockRange(), u = s && ic(s);
    return u == null ? !1 : (e && e(r.tr.lift(s, u).scrollIntoView()), !0);
  }
  let o = i.nodeBefore;
  if (J1(r, i, e, -1))
    return !0;
  if (n.parent.content.size == 0 && (ua(o, "end") || de.isSelectable(o)))
    for (let s = n.depth; ; s--) {
      let u = qp(r.doc, n.before(s), n.after(s), Q.empty);
      if (u && u.slice.size < u.to - u.from) {
        if (e) {
          let f = r.tr.step(u);
          f.setSelection(ua(o, "end") ? ke.findFrom(f.doc.resolve(f.mapping.map(i.pos, -1)), -1) : de.create(f.doc, i.pos - o.nodeSize)), e(f.scrollIntoView());
        }
        return !0;
      }
      if (s == 1 || n.node(s - 1).childCount > 1)
        break;
    }
  return o.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos - o.nodeSize, i.pos).scrollIntoView()), !0) : !1;
};
function ua(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 VE = (r, e, t) => {
  let { $head: n, empty: i } = r.selection, o = n;
  if (!i)
    return !1;
  if (n.parent.isTextblock) {
    if (t ? !t.endOfTextblock("backward", r) : n.parentOffset > 0)
      return !1;
    o = j1(n);
  }
  let s = o && o.nodeBefore;
  return !s || !de.isSelectable(s) ? !1 : (e && e(r.tr.setSelection(de.create(r.doc, o.pos - s.nodeSize)).scrollIntoView()), !0);
};
function j1(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 qE(r, e) {
  let { $cursor: t } = r.selection;
  return !t || (e ? !e.endOfTextblock("forward", r) : t.parentOffset < t.parent.content.size) ? null : t;
}
const W1 = (r, e, t) => {
  let n = qE(r, t);
  if (!n)
    return !1;
  let i = G1(n);
  if (!i)
    return !1;
  let o = i.nodeAfter;
  if (J1(r, i, e, 1))
    return !0;
  if (n.parent.content.size == 0 && (ua(o, "start") || de.isSelectable(o))) {
    let s = qp(r.doc, n.before(), n.after(), Q.empty);
    if (s && s.slice.size < s.to - s.from) {
      if (e) {
        let u = r.tr.step(s);
        u.setSelection(ua(o, "start") ? ke.findFrom(u.doc.resolve(u.mapping.map(i.pos)), 1) : de.create(u.doc, u.mapping.map(i.pos))), e(u.scrollIntoView());
      }
      return !0;
    }
  }
  return o.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos, i.pos + o.nodeSize).scrollIntoView()), !0) : !1;
}, $E = (r, e, t) => {
  let { $head: n, empty: i } = r.selection, o = n;
  if (!i)
    return !1;
  if (n.parent.isTextblock) {
    if (t ? !t.endOfTextblock("forward", r) : n.parentOffset < n.parent.content.size)
      return !1;
    o = G1(n);
  }
  let s = o && o.nodeAfter;
  return !s || !de.isSelectable(s) ? !1 : (e && e(r.tr.setSelection(de.create(r.doc, o.pos)).scrollIntoView()), !0);
};
function G1(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 K1 = (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 eh(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 th = (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), o = t.indexAfter(-1), s = eh(i.contentMatchAt(o));
  if (!s || !i.canReplaceWith(o, o, s))
    return !1;
  if (e) {
    let u = t.after(), f = r.tr.replaceWith(u, u, s.createAndFill());
    f.setSelection(ke.near(f.doc.resolve(u), 1)), e(f.scrollIntoView());
  }
  return !0;
}, UE = (r, e) => {
  let t = r.selection, { $from: n, $to: i } = t;
  if (t instanceof Vt || n.parent.inlineContent || i.parent.inlineContent)
    return !1;
  let o = eh(i.parent.contentMatchAt(i.indexAfter()));
  if (!o || !o.isTextblock)
    return !1;
  if (e) {
    let s = (!n.parentOffset && i.index() < i.parent.childCount ? n : i).pos, u = r.tr.insert(s, o.createAndFill());
    u.setSelection(Ce.create(u.doc, s + 1)), e(u.scrollIntoView());
  }
  return !0;
}, jE = (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 o = t.before();
    if (na(r.doc, o))
      return e && e(r.tr.split(o).scrollIntoView()), !0;
  }
  let n = t.blockRange(), i = n && ic(n);
  return i == null ? !1 : (e && e(r.tr.lift(n, i).scrollIntoView()), !0);
};
function WE(r) {
  return (e, t) => {
    let { $from: n, $to: i } = e.selection;
    if (e.selection instanceof de && e.selection.node.isBlock)
      return !n.parentOffset || !na(e.doc, n.pos) ? !1 : (t && t(e.tr.split(n.pos).scrollIntoView()), !0);
    if (!n.depth)
      return !1;
    let o = [], s, u, f = !1, d = !1;
    for (let w = n.depth; ; w--)
      if (n.node(w).isBlock) {
        f = n.end(w) == n.pos + (n.depth - w), d = n.start(w) == n.pos - (n.depth - w), u = eh(n.node(w - 1).contentMatchAt(n.indexAfter(w - 1))), o.unshift(f && u ? { type: u } : null), s = w;
        break;
      } else {
        if (w == 1)
          return !1;
        o.unshift(null);
      }
    let h = e.tr;
    (e.selection instanceof Ce || e.selection instanceof Vt) && h.deleteSelection();
    let m = h.mapping.map(n.pos), y = na(h.doc, m, o.length, o);
    if (y || (o[0] = u ? { type: u } : null, y = na(h.doc, m, o.length, o)), !y)
      return !1;
    if (h.split(m, o.length, o), !f && d && n.node(s).type != u) {
      let w = h.mapping.map(n.before(s)), k = h.doc.resolve(w);
      u && n.node(s - 1).canReplaceWith(k.index(), k.index() + 1, u) && h.setNodeMarkup(h.mapping.map(n.before(s)), u);
    }
    return t && t(h.scrollIntoView()), !0;
  };
}
const GE = WE(), Q1 = (r, e) => (e && e(r.tr.setSelection(new Vt(r.doc))), !0);
function KE(r, e, t) {
  let n = e.nodeBefore, i = e.nodeAfter, o = e.index();
  return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(o - 1, o) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(o, o + 1) || !(i.isTextblock || n1(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
}
function J1(r, e, t, n) {
  let i = e.nodeBefore, o = e.nodeAfter, s, u, f = i.type.spec.isolating || o.type.spec.isolating;
  if (!f && KE(r, e, t))
    return !0;
  let d = !f && e.parent.canReplace(e.index(), e.index() + 1);
  if (d && (s = (u = i.contentMatchAt(i.childCount)).findWrapping(o.type)) && u.matchType(s[0] || o.type).validEnd) {
    if (t) {
      let w = e.pos + o.nodeSize, k = F.empty;
      for (let E = s.length - 1; E >= 0; E--)
        k = F.from(s[E].create(null, k));
      k = F.from(i.copy(k));
      let b = r.tr.step(new vt(e.pos - 1, w, e.pos, w, new Q(k, 1, 0), s.length, !0)), T = b.doc.resolve(w + 2 * s.length);
      T.nodeAfter && T.nodeAfter.type == i.type && n1(b.doc, T.pos) && b.join(T.pos), t(b.scrollIntoView());
    }
    return !0;
  }
  let h = o.type.spec.isolating || n > 0 && f ? null : ke.findFrom(e, 1), m = h && h.$from.blockRange(h.$to), y = m && ic(m);
  if (y != null && y >= e.depth)
    return t && t(r.tr.lift(m, y).scrollIntoView()), !0;
  if (d && ua(o, "start", !0) && ua(i, "end")) {
    let w = i, k = [];
    for (; k.push(w), !w.isTextblock; )
      w = w.lastChild;
    let b = o, T = 1;
    for (; !b.isTextblock; b = b.firstChild)
      T++;
    if (w.canReplace(w.childCount, w.childCount, b.content)) {
      if (t) {
        let E = F.empty;
        for (let P = k.length - 1; P >= 0; P--)
          E = F.from(k[P].copy(E));
        let I = r.tr.step(new vt(e.pos - k.length, e.pos + o.nodeSize, e.pos + T, e.pos + o.nodeSize - T, new Q(E, k.length, 0), 0, !0));
        t(I.scrollIntoView());
      }
      return !0;
    }
  }
  return !1;
}
function X1(r) {
  return function(e, t) {
    let n = e.selection, i = r < 0 ? n.$from : n.$to, o = i.depth;
    for (; i.node(o).isInline; ) {
      if (!o)
        return !1;
      o--;
    }
    return i.node(o).isTextblock ? (t && t(e.tr.setSelection(Ce.create(e.doc, r < 0 ? i.start(o) : i.end(o)))), !0) : !1;
  };
}
const QE = X1(-1), JE = X1(1);
function XE(r, e = null) {
  return function(t, n) {
    let { $from: i, $to: o } = t.selection, s = i.blockRange(o), u = s && Mx(s, r, e);
    return u ? (n && n(t.tr.wrap(s, u).scrollIntoView()), !0) : !1;
  };
}
function rh(r, e = null) {
  return function(t, n) {
    let i = !1;
    for (let o = 0; o < t.selection.ranges.length && !i; o++) {
      let { $from: { pos: s }, $to: { pos: u } } = t.selection.ranges[o];
      t.doc.nodesBetween(s, u, (f, d) => {
        if (i)
          return !1;
        if (!(!f.isTextblock || f.hasMarkup(r, e)))
          if (f.type == r)
            i = !0;
          else {
            let h = t.doc.resolve(d), m = h.index();
            i = h.parent.canReplaceWith(m, m + 1, r);
          }
      });
    }
    if (!i)
      return !1;
    if (n) {
      let o = t.tr;
      for (let s = 0; s < t.selection.ranges.length; s++) {
        let { $from: { pos: u }, $to: { pos: f } } = t.selection.ranges[s];
        o.setBlockType(u, f, r, e);
      }
      n(o.scrollIntoView());
    }
    return !0;
  };
}
function YE(r, e, t, n) {
  for (let i = 0; i < e.length; i++) {
    let { $from: o, $to: s } = e[i], u = o.depth == 0 ? r.inlineContent && r.type.allowsMarkType(t) : !1;
    if (r.nodesBetween(o.pos, s.pos, (f, d) => {
      if (u)
        return !1;
      u = f.inlineContent && f.type.allowsMarkType(t);
    }), u)
      return !0;
  }
  return !1;
}
function $s(r, e = null, t) {
  return function(n, i) {
    let { empty: o, $cursor: s, ranges: u } = n.selection;
    if (o && !s || !YE(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, d = n.tr;
        f = !u.some((h) => n.doc.rangeHasMark(h.$from.pos, h.$to.pos, r));
        for (let h = 0; h < u.length; h++) {
          let { $from: m, $to: y } = u[h];
          if (!f)
            d.removeMark(m.pos, y.pos, r);
          else {
            let w = m.pos, k = y.pos, b = m.nodeAfter, T = y.nodeBefore, E = b && b.isText ? /^\s*/.exec(b.text)[0].length : 0, I = T && T.isText ? /\s*$/.exec(T.text)[0].length : 0;
            w + E < k && (w += E, k -= I), d.addMark(w, k, r.create(e));
          }
        }
        i(d.scrollIntoView());
      }
    return !0;
  };
}
function cc(...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 Ed = cc(Zp, zE, VE), hy = cc(Zp, W1, $E);
const En = {
  Enter: cc(K1, UE, jE, GE),
  "Mod-Enter": th,
  Backspace: Ed,
  "Mod-Backspace": Ed,
  "Shift-Backspace": Ed,
  Delete: hy,
  "Mod-Delete": hy,
  "Mod-a": Q1
}, Y1 = {
  "Ctrl-h": En.Backspace,
  "Alt-Backspace": En["Mod-Backspace"],
  "Ctrl-d": En.Delete,
  "Ctrl-Alt-Backspace": En["Mod-Delete"],
  "Alt-Delete": En["Mod-Delete"],
  "Alt-d": En["Mod-Delete"],
  "Ctrl-a": QE,
  "Ctrl-e": JE
};
for (let r in En)
  Y1[r] = En[r];
const ZE = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform ? os.platform() == "darwin" : !1, vy = ZE ? Y1 : En;
class Ti {
  /**
  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" ? eM(t) : t, this.undoable = n.undoable !== !1, this.inCode = n.inCode || !1, this.inCodeMark = n.inCodeMark !== !1;
  }
}
function eM(r) {
  return function(e, t, n, i) {
    let o = r;
    if (t[1]) {
      let s = t[0].lastIndexOf(t[1]);
      o += t[0].slice(s + t[1].length), n += s;
      let u = n - i;
      u > 0 && (o = t[0].slice(s - u, s) + o, n = i);
    }
    return e.tr.insertText(o, n, i);
  };
}
const tM = 500;
function Z1({ rules: r }) {
  let e = new nr({
    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, o) {
        return my(t, n, i, o, r, e);
      },
      handleDOMEvents: {
        compositionend: (t) => {
          setTimeout(() => {
            let { $cursor: n } = t.state.selection;
            n && my(t, n.pos, n.pos, "", r, e);
          });
        }
      }
    },
    isInputRules: !0
  });
  return e;
}
function my(r, e, t, n, i, o) {
  if (r.composing)
    return !1;
  let s = r.state, u = s.doc.resolve(e), f = u.parent.textBetween(Math.max(0, u.parentOffset - tM), u.parentOffset, null, "￼") + n;
  for (let d = 0; d < i.length; d++) {
    let h = i[d];
    if (!h.inCodeMark && u.marks().some((k) => k.type.spec.code))
      continue;
    if (u.parent.type.spec.code) {
      if (!h.inCode)
        continue;
    } else if (h.inCode === "only")
      continue;
    let m = h.match.exec(f);
    if (!m || m[0].length < n.length)
      continue;
    let y = e - (m[0].length - n.length);
    if (!h.inCodeMark) {
      let k = !1;
      if (s.doc.nodesBetween(y, u.pos, (b) => {
        b.isInline && b.marks.some((T) => T.type.spec.code) && (k = !0);
      }), k)
        continue;
    }
    let w = h.handler(s, m, y, t);
    if (w)
      return h.undoable && w.setMeta(o, { transform: w, from: e, to: t, text: n }), r.dispatch(w), !0;
  }
  return !1;
}
const rM = (r, e) => {
  let t = r.plugins;
  for (let n = 0; n < t.length; n++) {
    let i = t[n], o;
    if (i.spec.isInputRules && (o = i.getState(r))) {
      if (e) {
        let s = r.tr, u = o.transform;
        for (let f = u.steps.length - 1; f >= 0; f--)
          s.step(u.steps[f].invert(u.docs[f]));
        if (o.text) {
          let f = s.doc.resolve(o.from).marks();
          s.replaceWith(o.from, o.to, r.schema.text(o.text, f));
        } else
          s.delete(o.from, o.to);
        e(s);
      }
      return !0;
    }
  }
  return !1;
};
new Ti(/--$/, "—", { inCodeMark: !1 });
new Ti(/\.\.\.$/, "…", { inCodeMark: !1 });
new Ti(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "“", { inCodeMark: !1 });
new Ti(/"$/, "”", { inCodeMark: !1 });
new Ti(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "‘", { inCodeMark: !1 });
new Ti(/'$/, "’", { inCodeMark: !1 });
var Hu = 200, mt = function() {
};
mt.prototype.append = function(e) {
  return e.length ? (e = mt.from(e), !this.length && e || e.length < Hu && this.leafAppend(e) || this.length < Hu && e.leafPrepend(this) || this.appendInner(e)) : this;
};
mt.prototype.prepend = function(e) {
  return e.length ? mt.from(e).append(this) : this;
};
mt.prototype.appendInner = function(e) {
  return new nM(this, e);
};
mt.prototype.slice = function(e, t) {
  return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? mt.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
};
mt.prototype.get = function(e) {
  if (!(e < 0 || e >= this.length))
    return this.getInner(e);
};
mt.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);
};
mt.prototype.map = function(e, t, n) {
  t === void 0 && (t = 0), n === void 0 && (n = this.length);
  var i = [];
  return this.forEach(function(o, s) {
    return i.push(e(o, s));
  }, t, n), i;
};
mt.from = function(e) {
  return e instanceof mt ? e : e && e.length ? new ek(e) : mt.empty;
};
var ek = /* @__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, o) {
    return i == 0 && o == this.length ? this : new e(this.values.slice(i, o));
  }, e.prototype.getInner = function(i) {
    return this.values[i];
  }, e.prototype.forEachInner = function(i, o, s, u) {
    for (var f = o; f < s; f++)
      if (i(this.values[f], u + f) === !1)
        return !1;
  }, e.prototype.forEachInvertedInner = function(i, o, s, u) {
    for (var f = o - 1; f >= s; f--)
      if (i(this.values[f], u + f) === !1)
        return !1;
  }, e.prototype.leafAppend = function(i) {
    if (this.length + i.length <= Hu)
      return new e(this.values.concat(i.flatten()));
  }, e.prototype.leafPrepend = function(i) {
    if (this.length + i.length <= Hu)
      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;
})(mt);
mt.empty = new ek([]);
var nM = /* @__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, o, s) {
    var u = this.left.length;
    if (i < u && this.left.forEachInner(n, i, Math.min(o, u), s) === !1 || o > u && this.right.forEachInner(n, Math.max(i - u, 0), Math.min(this.length, o) - u, s + u) === !1)
      return !1;
  }, e.prototype.forEachInvertedInner = function(n, i, o, s) {
    var u = this.left.length;
    if (i > u && this.right.forEachInvertedInner(n, i - u, Math.max(o, u) - u, s + u) === !1 || o < u && this.left.forEachInvertedInner(n, Math.min(i, u), o, s) === !1)
      return !1;
  }, e.prototype.sliceInner = function(n, i) {
    if (n == 0 && i == this.length)
      return this;
    var o = this.left.length;
    return i <= o ? this.left.slice(n, i) : n >= o ? this.right.slice(n - o, i - o) : this.left.slice(n, o).append(this.right.slice(0, i - o));
  }, 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;
})(mt);
const iM = 500;
class Pr {
  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, o;
    t && (i = this.remapping(n, this.items.length), o = i.maps.length);
    let s = e.tr, u, f, d = [], h = [];
    return this.items.forEach((m, y) => {
      if (!m.step) {
        i || (i = this.remapping(n, y + 1), o = i.maps.length), o--, h.push(m);
        return;
      }
      if (i) {
        h.push(new Xr(m.map));
        let w = m.step.map(i.slice(o)), k;
        w && s.maybeStep(w).doc && (k = s.mapping.maps[s.mapping.maps.length - 1], d.push(new Xr(k, void 0, void 0, d.length + h.length))), o--, k && i.appendMap(k, o);
      } else
        s.maybeStep(m.step);
      if (m.selection)
        return u = i ? m.selection.map(i.slice(o)) : m.selection, f = new Pr(this.items.slice(0, n).append(h.reverse().concat(d)), 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 o = [], s = this.eventCount, u = this.items, f = !i && u.length ? u.get(u.length - 1) : null;
    for (let h = 0; h < e.steps.length; h++) {
      let m = e.steps[h].invert(e.docs[h]), y = new Xr(e.mapping.maps[h], m, t), w;
      (w = f && f.merge(y)) && (y = w, h ? o.pop() : u = u.slice(0, u.length - 1)), o.push(y), t && (s++, t = void 0), i || (f = y);
    }
    let d = s - n.depth;
    return d > aM && (u = oM(u, d), s -= d), new Pr(u.append(o), s);
  }
  remapping(e, t) {
    let n = new Ds();
    return this.items.forEach((i, o) => {
      let s = i.mirrorOffset != null && o - 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 Pr(this.items.append(e.map((t) => new Xr(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), o = e.mapping, s = e.steps.length, u = this.eventCount;
    this.items.forEach((y) => {
      y.selection && u--;
    }, i);
    let f = t;
    this.items.forEach((y) => {
      let w = o.getMirror(--f);
      if (w == null)
        return;
      s = Math.min(s, w);
      let k = o.maps[w];
      if (y.step) {
        let b = e.steps[w].invert(e.docs[w]), T = y.selection && y.selection.map(o.slice(f + 1, w));
        T && u++, n.push(new Xr(k, b, T));
      } else
        n.push(new Xr(k));
    }, i);
    let d = [];
    for (let y = t; y < s; y++)
      d.push(new Xr(o.maps[y]));
    let h = this.items.slice(0, i).append(d).append(n), m = new Pr(h, u);
    return m.emptyItemCount() > iM && (m = m.compress(this.items.length - n.length)), m;
  }
  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 = [], o = 0;
    return this.items.forEach((s, u) => {
      if (u >= e)
        i.push(s), s.selection && o++;
      else if (s.step) {
        let f = s.step.map(t.slice(n)), d = f && f.getMap();
        if (n--, d && t.appendMap(d, n), f) {
          let h = s.selection && s.selection.map(t.slice(n));
          h && o++;
          let m = new Xr(d.invert(), f, h), y, w = i.length - 1;
          (y = i.length && i[w].merge(m)) ? i[w] = y : i.push(m);
        }
      } else s.map && n--;
    }, this.items.length, 0), new Pr(mt.from(i.reverse()), o);
  }
}
Pr.empty = new Pr(mt.empty, 0);
function oM(r, e) {
  let t;
  return r.forEach((n, i) => {
    if (n.selection && e-- == 0)
      return t = i, !1;
  }), r.slice(t);
}
class Xr {
  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 Xr(t.getMap().invert(), t, this.selection);
    }
  }
}
class si {
  constructor(e, t, n, i, o) {
    this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = i, this.prevComposition = o;
  }
}
const aM = 20;
function sM(r, e, t, n) {
  let i = t.getMeta(gi), o;
  if (i)
    return i.historyState;
  t.getMeta(cM) && (r = new si(r.done, r.undone, null, 0, -1));
  let s = t.getMeta("appendedTransaction");
  if (t.steps.length == 0)
    return r;
  if (s && s.getMeta(gi))
    return s.getMeta(gi).redo ? new si(r.done.addTransform(t, void 0, n, yu(e)), r.undone, gy(t.mapping.maps), r.prevTime, r.prevComposition) : new si(r.done, r.undone.addTransform(t, void 0, n, yu(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 || !lM(t, r.prevRanges)), d = s ? Md(r.prevRanges, t.mapping) : gy(t.mapping.maps);
    return new si(r.done.addTransform(t, f ? e.selection.getBookmark() : void 0, n, yu(e)), Pr.empty, d, t.time, u ?? r.prevComposition);
  } else return (o = t.getMeta("rebased")) ? new si(r.done.rebased(t, o), r.undone.rebased(t, o), Md(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new si(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), Md(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
}
function lM(r, e) {
  if (!e)
    return !1;
  if (!r.docChanged)
    return !0;
  let t = !1;
  return r.mapping.maps[0].forEach((n, i) => {
    for (let o = 0; o < e.length; o += 2)
      n <= e[o + 1] && i >= e[o] && (t = !0);
  }), t;
}
function gy(r) {
  let e = [];
  for (let t = r.length - 1; t >= 0 && e.length == 0; t--)
    r[t].forEach((n, i, o, s) => e.push(o, s));
  return e;
}
function Md(r, e) {
  if (!r)
    return null;
  let t = [];
  for (let n = 0; n < r.length; n += 2) {
    let i = e.map(r[n], 1), o = e.map(r[n + 1], -1);
    i <= o && t.push(i, o);
  }
  return t;
}
function uM(r, e, t) {
  let n = yu(e), i = gi.get(e).spec.config, o = (t ? r.undone : r.done).popEvent(e, n);
  if (!o)
    return null;
  let s = o.selection.resolve(o.transform.doc), u = (t ? r.done : r.undone).addTransform(o.transform, e.selection.getBookmark(), i, n), f = new si(t ? u : o.remaining, t ? o.remaining : u, null, 0, -1);
  return o.transform.setSelection(s).setMeta(gi, { redo: t, historyState: f });
}
let Od = !1, yy = null;
function yu(r) {
  let e = r.plugins;
  if (yy != e) {
    Od = !1, yy = e;
    for (let t = 0; t < e.length; t++)
      if (e[t].spec.historyPreserveItems) {
        Od = !0;
        break;
      }
  }
  return Od;
}
const gi = new Fs("history"), cM = new Fs("closeHistory");
function tk(r = {}) {
  return r = {
    depth: r.depth || 100,
    newGroupDelay: r.newGroupDelay || 500
  }, new nr({
    key: gi,
    state: {
      init() {
        return new si(Pr.empty, Pr.empty, null, 0, -1);
      },
      apply(e, t, n) {
        return sM(t, n, e, r);
      }
    },
    config: r,
    props: {
      handleDOMEvents: {
        beforeinput(e, t) {
          let n = t.inputType, i = n == "historyUndo" ? Ms : n == "historyRedo" ? nh : null;
          return !i || !e.editable ? !1 : (t.preventDefault(), i(e.state, e.dispatch));
        }
      }
    }
  });
}
function rk(r, e) {
  return (t, n) => {
    let i = gi.getState(t);
    if (!i || (r ? i.undone : i.done).eventCount == 0)
      return !1;
    if (n) {
      let o = uM(i, t, r);
      o && n(e ? o.scrollIntoView() : o);
    }
    return !0;
  };
}
const Ms = rk(!1, !0), nh = rk(!0, !0);
function fM(r) {
  let e = gi.getState(r);
  return e ? e.done.eventCount : 0;
}
var pp = function(r, e) {
  return pp = 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]);
  }, pp(r, e);
};
function Y(r, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  pp(r, e);
  function t() {
    this.constructor = r;
  }
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
var R = function() {
  return R = Object.assign || function(e) {
    for (var t, n = 1, i = arguments.length; n < i; n++) {
      t = arguments[n];
      for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
    }
    return e;
  }, R.apply(this, arguments);
};
function rr(r, e, t) {
  if (arguments.length === 2) for (var n = 0, i = e.length, o; n < i; n++)
    (o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
  return r.concat(o || Array.prototype.slice.call(e));
}
function xe(r, e) {
  return Object.defineProperty ? Object.defineProperty(r, "raw", { value: e }) : r.raw = e, r;
}
function dM(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 ca = dM;
function pM(r, e) {
  var t = Object.prototype.hasOwnProperty, n, i, o, s;
  for (o = 1, s = arguments.length; o < s; o += 1) {
    n = arguments[o];
    for (i in n)
      t.call(n, i) && (r[i] = n[i]);
  }
  return r;
}
var ih = pM;
function hM(r) {
  return typeof r == "string" || r instanceof String;
}
var Rn = hM;
function vM(r) {
  return r instanceof Array;
}
var Ca = vM;
function mM(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 fa = mM, gM = Ca, yM = fa, wM = ca;
function kM(r, e, t) {
  gM(r) ? yM(r, e, t) : wM(r, e, t);
}
var fc = kM, CM = Rn, bM = fc;
function TM(r, e, t) {
  var n = r.style;
  if (CM(e)) {
    n[e] = t;
    return;
  }
  bM(e, function(i, o) {
    n[o] = i;
  });
}
var nn = TM, xM = Ca;
function SM(r, e, t) {
  var n, i;
  if (t = t || 0, !xM(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 co = SM;
function EM(r) {
  return r === void 0;
}
var Fr = EM, MM = Fr;
function OM(r) {
  return !r || !r.className ? "" : MM(r.className.baseVal) ? r.className : r.className.baseVal;
}
var oh = OM, NM = Ca, LM = Fr;
function DM(r, e) {
  if (e = NM(e) ? e.join(" ") : e, e = e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), LM(r.className.baseVal)) {
    r.className = e;
    return;
  }
  r.className.baseVal = e;
}
var nk = DM, wy = fc, AM = co, IM = oh, RM = nk;
function PM(r) {
  var e = Array.prototype.slice.call(arguments, 1), t = r.classList, n = [], i;
  if (t) {
    wy(e, function(o) {
      r.classList.add(o);
    });
    return;
  }
  i = IM(r), i && (e = [].concat(i.split(/\s+/), e)), wy(e, function(o) {
    AM(o, n) < 0 && n.push(o);
  }), RM(r, n);
}
var Zr = PM, ky = fa, BM = co, _M = oh, HM = nk;
function FM(r) {
  var e = Array.prototype.slice.call(arguments, 1), t = r.classList, n, i;
  if (t) {
    ky(e, function(o) {
      t.remove(o);
    });
    return;
  }
  n = _M(r).split(/\s+/), i = [], ky(n, function(o) {
    BM(o, e) < 0 && i.push(o);
  }), HM(r, i);
}
var Br = FM;
function zM(r) {
  return typeof r == "number" || r instanceof Number;
}
var Mn = zM;
function VM(r) {
  return r === null;
}
var Fu = VM, qM = ca;
function $M(r, e) {
  var t = document.createElement("img"), n = "";
  return qM(e, function(i, o) {
    n += "&" + o + "=" + i;
  }), n = n.substring(1), t.src = r + "?" + n, t.style.display = "none", document.body.appendChild(t), document.body.removeChild(t), t;
}
var UM = $M, jM = Fr, WM = UM, GM = 10080 * 60 * 1e3;
function KM(r) {
  var e = (/* @__PURE__ */ new Date()).getTime();
  return e - r > GM;
}
function QM(r, e) {
  var t = "https://www.google-analytics.com/collect", n = location.hostname, i = "event", o = "use", s = "TOAST UI " + r + " for " + n + ": Statistics", u = window.localStorage.getItem(s);
  !jM(window.tui) && window.tui.usageStatistics === !1 || u && !KM(u) || (window.localStorage.setItem(s, (/* @__PURE__ */ new Date()).getTime()), setTimeout(function() {
    (document.readyState === "interactive" || document.readyState === "complete") && WM(t, {
      v: 1,
      t: i,
      tid: e,
      cid: n,
      dp: n,
      dh: r,
      el: r,
      ec: o
    });
  }, 1e3));
}
var JM = QM, XM = /[\u0020]+/g, YM = /[>(){}[\]+-.!#|]/g, Cy = /<([a-zA-Z_][a-zA-Z0-9\-._]*)(\s|[^\\>])*\/?>|<(\/)([a-zA-Z_][a-zA-Z0-9\-._]*)\s*\/?>|<!--[^-]+-->|<([a-zA-Z_][a-zA-Z0-9\-.:/]*)>/g, by = /\\[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~\\]/g, ZM = /[*_~`]/g, Ty = /!\[.*\]\(.*\)/g, eO = /[[\]]/g, xy = /(?:^|[^\\])\\(?!\\)/g, tO = '[&<>"]', Sy = new RegExp(tO, "g");
function rO(r) {
  switch (r) {
    case "&":
      return "&amp;";
    case "<":
      return "&lt;";
    case ">":
      return "&gt;";
    case '"':
      return "&quot;";
    default:
      return r;
  }
}
function ta(r) {
  return Sy.test(r) ? r.replace(Sy, rO) : r;
}
function nO() {
  JM("editor", "UA-129966929-1");
}
function Et(r, e) {
  return r.indexOf(e) !== -1;
}
var iO = ["rel", "target", "hreflang", "type"], oO = {
  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 ik(r) {
  if (!r)
    return null;
  var e = {};
  return iO.forEach(function(t) {
    Fr(r[t]) || (e[t] = r[t]);
  }), e;
}
function zu(r, e) {
  for (var t = "", n = 0; n < e; n += 1)
    t += r;
  return t;
}
function aO(r) {
  var e = !1;
  return ca(oO, function(t) {
    return t.test(r) && (e = !0), !e;
  }), e;
}
function Vu(r) {
  for (var e = [], t = Ty.exec(r); t; )
    e.push([t.index, t.index + t[0].length]), t = Ty.exec(r);
  return r.replace(eO, function(n, i) {
    var o = e.some(function(s) {
      return i > s[0] && i < s[1];
    });
    return o ? n : "\\" + n;
  });
}
function sO(r) {
  var e = function(i) {
    return "\\" + i;
  }, t = function(i) {
    return i + "\\";
  }, n = r.replace(XM, " ");
  return by.test(n) && (n = n.replace(by, e)), xy.test(n) && (n = n.replace(xy, t)), n = n.replace(ZM, e), Cy.test(n) && (n = n.replace(Cy, e)), aO(n) && (n = n.replace(YM, e)), n;
}
function lO(r) {
  var e;
  return r.indexOf('"') === -1 ? e = '""' : e = r.indexOf("'") === -1 ? "''" : "()", e[0] + r + e[1];
}
function hp(r) {
  return Fu(r) || Fr(r);
}
function ah(r, e) {
  if (r === null && r === e)
    return !0;
  if (typeof r != "object" || typeof e != "object" || hp(r) || hp(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 Rt(r) {
  return r[r.length - 1];
}
function uO(r, e, t) {
  return r >= e && r <= t;
}
function sh(r) {
  return typeof r == "object" && r !== null;
}
function qu(r, e) {
  var t = R({}, r);
  return r && e && Object.keys(e).forEach(function(n) {
    sh(t[n]) ? Array.isArray(e[n]) ? t[n] = lh(e[n]) : t.hasOwnProperty(n) ? t[n] = qu(t[n], e[n]) : t[n] = uh(e[n]) : t[n] = e[n];
  }), t;
}
function lh(r) {
  return r.map(function(e) {
    return sh(e) ? Array.isArray(e) ? lh(e) : uh(e) : e;
  });
}
function uh(r) {
  var e = Object.keys(r);
  return e.length ? e.reduce(function(t, n) {
    return sh(r[n]) ? t[n] = Array.isArray(r[n]) ? lh(r[n]) : uh(r[n]) : t[n] = r[n], t;
  }, {}) : r;
}
function ch(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] : ch(r[t], e[t]) : r[t] = e[t];
  }), r;
}
function Ey(r, e) {
  return r > e ? [e, r] : [r, e];
}
var cO = fa;
function fO(r) {
  var e;
  try {
    e = Array.prototype.slice.call(r);
  } catch {
    e = [], cO(r, function(n) {
      e.push(n);
    });
  }
  return e;
}
var on = fO;
function $u(r, e) {
  var t = r.nodes.paragraph;
  return e ? t.create(null, Rn(e) ? r.text(e) : e) : t.createAndFill();
}
function St(r, e, t) {
  return r.text(e, t);
}
function $e(r, e, t) {
  t === void 0 && (t = e);
  var n = r.doc.content.size, i = n > 0 ? n - 1 : 1;
  return Ce.create(r.doc, Math.min(e, i), Math.min(t, i));
}
function fh(r, e, t) {
  var n = e.pos;
  return r.replaceWith(n, n, $u(t)), r.setSelection($e(r, n + 1));
}
function Uu(r) {
  for (var e = r.state, t = r.from, n = r.startIndex, i = r.endIndex, o = r.createText, s = e.tr, u = e.doc, f = e.schema, d = n; d <= i; d += 1) {
    var h = u.child(d), m = h.nodeSize, y = h.textContent, w = h.content, k = o(y), b = k ? St(f, k) : F.empty, T = s.mapping.map(t), E = T + w.size;
    s.replaceWith(T, E, b), t += m;
  }
  return s;
}
function dh(r, e, t, n) {
  var i = t.length;
  r.split(e).delete(e - i, e).insert(r.mapping.map(e), n).setSelection($e(r, r.mapping.map(e) - i));
}
function Us(r) {
  return r.sourcepos[0][0];
}
function dc(r) {
  return r.sourcepos[1][0];
}
function pc(r) {
  return r.sourcepos[0][1];
}
function yi(r) {
  return r.sourcepos[1][1];
}
function dO(r) {
  var e = r.type;
  return e === "htmlBlock" || e === "htmlInline";
}
function pO(r) {
  var e = r.type;
  return e === "strike" || e === "strong" || e === "emph" || e === "code" || e === "link" || e === "image";
}
function hO(r) {
  return r && r.type === "codeBlock";
}
function fo(r) {
  return r && (r.type === "item" || r.type === "list");
}
function ok(r) {
  return fo(r) && r.listData.type === "ordered";
}
function vO(r) {
  return fo(r) && r.listData.type !== "ordered";
}
function My(r) {
  return r && (r.type === "tableCell" || r.type === "tableDelimCell");
}
function mO(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 da(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 gO(r, e, t) {
  for (t === void 0 && (t = !0), r = t ? r : r.parent; r && r.type !== "document"; )
    e(r), r = r.parent;
}
function pt(r, e) {
  return [r[0], r[1] + e];
}
function wi(r, e) {
  return [r[0], e];
}
function yO(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, o = r.type === "link" ? "" : "!";
      return o + "[" + e + "](" + n + (i ? ' "' + i + '"' : "") + ")";
    default:
      return null;
  }
}
function wO(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 kO(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 _s = [], ak = {}, Oy = /\$\$widget\d+\s/;
function hc(r) {
  var e = r.search(Oy);
  if (e !== -1) {
    var t = r.substring(e), n = t.replace(Oy, "").replace("$$", "");
    r = r.substring(0, e), r += hc(n);
  }
  return r;
}
function sk(r, e) {
  return "$$" + r + " " + e + "$$";
}
function lk(r, e) {
  var t = ak[r], n = t.rule, i = t.toDOM, o = hc(e).match(n);
  return o && (e = o[0]), i(e);
}
function CO() {
  return _s;
}
function bO(r) {
  _s = r, _s.forEach(function(e, t) {
    ak["widget" + t] = e;
  });
}
function Nd(r, e, t, n) {
  return r.concat(io(e, t, n));
}
function io(r, e, t) {
  t === void 0 && (t = 0);
  var n = [], i = (_s[t] || {}).rule, o = t + 1;
  if (r = hc(r), i && i.test(r)) {
    for (var s = void 0; (s = r.search(i)) !== -1; ) {
      var u = r.substring(0, s);
      u && (n = Nd(n, u, e, o)), r = r.substring(s);
      var f = r.match(i)[0], d = "widget" + t;
      n.push(e.nodes.widget.create({ info: d }, e.text(sk(d, f)))), r = r.substring(f.length);
    }
    r && (n = Nd(n, r, e, o));
  } else r && (n = t < _s.length - 1 ? Nd(n, r, e, o) : [e.text(r)]);
  return n;
}
function uk(r) {
  for (var e, t = "", n = r.walker(); e = n.next(); ) {
    var i = e.node, o = e.entering;
    o && (i !== r && i.type !== "text" ? (t += yO(i), n.resumeAt(r, !1), n.next()) : i.type === "text" && (t += i.literal));
  }
  return t;
}
function ck() {
  return {
    deleteSelection: function() {
      return Zp;
    },
    selectAll: function() {
      return Q1;
    },
    undo: function() {
      return Ms;
    },
    redo: function() {
      return nh;
    }
  };
}
function TO(r) {
  return new nr({
    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 Zr(n, "placeholder"), r.className && Zr(n, r.className), n.textContent = r.text, Je.create(t, [er.widget(1, n)]);
        }
        return null;
      }
    }
  });
}
var xO = co, SO = oh;
function EO(r, e) {
  var t;
  return r.classList ? r.classList.contains(e) : (t = SO(r).split(/\s+/), xO(e, t) > -1);
}
var fk = EO, MO = co, OO = on, iu = Element.prototype, NO = iu.matches || iu.webkitMatchesSelector || iu.mozMatchesSelector || iu.msMatchesSelector || function(r) {
  var e = this.document || this.ownerDocument;
  return MO(this, OO(e.querySelectorAll(r))) > -1;
};
function LO(r, e) {
  return NO.call(r, e);
}
var DO = LO, dk = "[A-Za-z][A-Za-z0-9-]*", AO = "[a-zA-Z_:][a-zA-Z0-9:._-]*", IO = "[^\"'=<>`\\x00-\\x20]+", RO = "'[^']*'", PO = '"[^"]*"', BO = "(?:" + IO + "|" + RO + "|" + PO + ")", _O = "(?:\\s*=\\s*" + BO + ")", pk = "(?:\\s+" + AO + _O + "?)", hk = "<(" + dk + ")(" + pk + ")*\\s*/?>", HO = "</(" + dk + ")\\s*[>]", vk = "(?:" + hk + "|" + HO + ")", pa = new RegExp("^" + vk, "i"), vp = /<br\s*\/*>/i, FO = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/, mk = "</p><p>";
function ph(r, e, t) {
  var n = parseInt(r.left, 10), i = parseInt(r.top, 10), o = 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 + o && t >= i && t <= i + s;
}
var gk = "toastui-editor-";
function re() {
  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 o = i[n], s = void 0;
    Array.isArray(o) ? s = o[0] ? o[1] : null : s = o, s && t.push("" + gk + s);
  }
  return t.join(" ");
}
function at() {
  for (var r = [], e = 0; e < arguments.length; e++)
    r[e] = arguments[e];
  return r.map(function(t) {
    return gk + "md-" + t;
  }).join(" ");
}
function zO(r) {
  return r?.nodeType === Node.TEXT_NODE;
}
function vc(r) {
  return r && r.nodeType === Node.ELEMENT_NODE;
}
function VO(r, e) {
  var t = on(r.querySelectorAll(e));
  return t.length ? t : [];
}
function qO(r, e) {
  e = Ca(e) ? on(e) : [e], e.forEach(function(t) {
    r.appendChild(t);
  });
}
function $O(r, e) {
  e.parentNode && e.parentNode.insertBefore(r, e);
}
function po(r) {
  r.parentNode && r.parentNode.removeChild(r);
}
function UO(r) {
  for (var e = []; r.firstChild; )
    e.push(r.firstChild), r.parentNode && r.parentNode.insertBefore(r.firstChild, r);
  return po(r), e;
}
function hh(r, e, t) {
  Fr(t) && (t = !fk(r, e));
  var n = t ? Zr : Br;
  n(r, e);
}
function yk(r, e) {
  var t = document.createElement("div");
  Rn(r) ? t.innerHTML = r : t.appendChild(r);
  var n = t.firstChild;
  return e && e.appendChild(n), n;
}
function vh(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 en(r, e) {
  var t;
  for (Rn(e) ? t = function(n) {
    return DO(n, e);
  } : t = function(n) {
    return n === e;
  }; r && r !== document; ) {
    if (vc(r) && t(r))
      return r;
    r = r.parentNode;
  }
  return null;
}
function wk(r, e) {
  for (var t = 0, n = 0; r && r !== e; ) {
    var i = r.offsetTop, o = r.offsetLeft, s = r.offsetParent;
    if (t += i, n += o, s === e.offsetParent)
      break;
    r = r.offsetParent;
  }
  return { offsetTop: t, offsetLeft: n };
}
function mh(r, e) {
  Object.keys(r).forEach(function(t) {
    hp(r[t]) ? e.removeAttribute(t) : e.setAttribute(t, r[t]);
  });
}
function jO(r) {
  var e = r.replace(/<p><br\s*\/*><\/p>/gi, "<p></p>"), t = new RegExp(vk, "ig"), n = e.match(t);
  return n?.forEach(function(i, o) {
    if (vp.test(i)) {
      var s = mk;
      if (o) {
        var u = n[o - 1], f = u.match(hk);
        if (f && !/br/i.test(f[1])) {
          var d = f[1];
          s = "</" + d + "><" + d + ">";
        }
      }
      e = e.replace(vp, s);
    }
  }), e;
}
function gh(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 kk = new Fs("widget"), Ny = 5, WO = (
  /** @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 = en(e.dom.parentElement, "." + re("defaultUI"));
      }), this.eventEmitter.listen("removePopupWidget", this.removeWidget);
    }
    return r.prototype.update = function(e) {
      var t = kk.getState(e.state);
      if (this.removeWidget(), t) {
        var n = t.node, i = t.style, o = e.coordsAtPos(t.pos), s = o.top, u = o.left, f = o.bottom, d = f - s, h = this.rootEl.getBoundingClientRect(), m = s - h.top;
        nn(n, { opacity: "0" }), this.rootEl.appendChild(n), nn(n, {
          position: "absolute",
          left: u - h.left + Ny + "px",
          top: (i === "bottom" ? m + d - Ny : m - d) + "px",
          opacity: "1"
        }), this.popup = n, e.focus();
      }
    }, r.prototype.destroy = function() {
      this.eventEmitter.removeEventHandler("blur", this.removeWidget);
    }, r;
  })()
);
function GO(r) {
  return new nr({
    key: kk,
    state: {
      init: function() {
        return null;
      },
      apply: function(e) {
        return e.getMeta("widget");
      }
    },
    view: function(e) {
      return new WO(e, r);
    }
  });
}
function KO(r) {
  r.listen("addImageBlobHook", function(e, t) {
    var n = new FileReader();
    n.onload = function(i) {
      var o = i.target;
      return t(o.result);
    }, n.readAsDataURL(e);
  });
}
function yh(r, e, t) {
  var n = function(i, o) {
    r.emit("command", "addImage", {
      imageUrl: i,
      altText: o || e.name || "image"
    });
  };
  r.emit("addImageBlobHook", e, n, t);
}
function Ck(r) {
  var e = on(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 QO(r) {
  var e = r.eventEmitter;
  return new nr({
    props: {
      handleDOMEvents: {
        drop: function(t, n) {
          var i, o = (i = n.dataTransfer) === null || i === void 0 ? void 0 : i.files;
          return o && fa(o, function(s) {
            return s.type.indexOf("image") !== -1 ? (n.preventDefault(), n.stopPropagation(), yh(e, s, n.type), !1) : !0;
          }), !0;
        }
      }
    }
  });
}
var Fe = (
  /** @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 bk(r) {
  var e = document.createElement("span"), t = lk(r.attrs.info, r.textContent);
  return e.className = "tui-widget", e.appendChild(t), { dom: e };
}
function mp(r) {
  return r.type.name === "widget";
}
var Tk = (
  /** @class */
  (function(r) {
    Y(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+)/), o = i[1];
                return { info: o };
              }
            }
          ]
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), xk = (
  /** @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 Xi.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 = rr(rr([], this.keymaps), [
          Bs(R({ "Shift-Enter": vy.Enter }, vy)),
          tk(),
          TO(this.placeholder),
          GO(this.eventEmitter),
          QO(this.context)
        ]);
        return e ? t.concat(e) : t;
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.createInputRules = function() {
      var e = CO(), t = e.map(function(n) {
        var i = n.rule;
        return new Ti(i, function(o, s, u, f) {
          var d = o.schema, h = o.tr, m = o.doc, y = s.input.match(new RegExp(i, "g")), w = m.resolve(u), k = w.parent, b = 0;
          if (mp(k) && (k = w.node(w.depth - 1)), k.forEach(function(I) {
            return mp(I) && (b += 1);
          }), y.length > b) {
            var T = Rt(y), E = io(T, d);
            return h.replaceWith(f - T.length + 1, f, E);
          }
          return null;
        });
      });
      return t.length ? Z1({ rules: t }) : null;
    }, r.prototype.clearTimer = function() {
      this.timer && (clearTimeout(this.timer), this.timer = null);
    }, r.prototype.createSchema = function() {
      return new G0({
        nodes: this.specs.nodes,
        marks: this.specs.marks
      });
    }, r.prototype.createKeymaps = function(e) {
      var t = ck(), n = t.undo, i = t.redo, o = this.specs.keymaps(e), s = {
        "Mod-z": n(),
        "Shift-Mod-z": i()
      };
      return e ? o.concat(Bs(s)) : o;
    }, 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($e(t, 1)).scrollIntoView()), e && this.focus();
    }, r.prototype.moveCursorToEnd = function(e) {
      var t = this.view.state.tr;
      this.view.dispatch(t.setSelection($e(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) {
      nn(this.el, { height: e + "px" });
    }, r.prototype.setMinHeight = function(e) {
      nn(this.el, { minHeight: e + "px" });
    }, r.prototype.getElement = function() {
      return this.el;
    }, r;
  })()
);
function JO(r) {
  return r instanceof Function;
}
var xr = JO, XO = [
  "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 ou(r, e, t) {
  return r.focus(), e(t)(r.state, r.dispatch, r);
}
var Sk = (
  /** @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, o = t.schema;
          return R(R({}, e), (n = {}, n[i] = o, 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, o = t.schema;
          return R(R({}, e), (n = {}, n[i] = o, n));
        }, {});
      },
      enumerable: !1,
      configurable: !0
    }), r.prototype.commands = function(e, t) {
      var n = this.specs.filter(function(o) {
        var s = o.commands;
        return s;
      }).reduce(function(o, s) {
        var u = {}, f = s.commands();
        return xr(f) ? u[s.name] = function(d) {
          return ou(e, f, d);
        } : Object.keys(f).forEach(function(d) {
          u[d] = function(h) {
            return ou(e, f[d], h);
          };
        }), R(R({}, o), u);
      }, {}), i = ck();
      return Object.keys(i).forEach(function(o) {
        n[o] = function(s) {
          return ou(e, i[o], s);
        };
      }), t && Object.keys(t).forEach(function(o) {
        n[o] = function(s) {
          return ou(e, t[o], 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) {
          Et(XO, i) || delete n[i];
        }), Bs(n);
      });
    }, r.prototype.setContext = function(e) {
      this.specs.forEach(function(t) {
        t.setContext(e);
      });
    }, r;
  })()
);
function Ek(r) {
  var e = r.from, t = r.to;
  return r instanceof Vt ? [e + 1, t - 1] : [e, t];
}
function Ly(r) {
  return r.index(0) + 1;
}
function ha(r, e, t) {
  t === void 0 && (t = 1);
  var n = 0;
  return r.forEach(function(i, o) {
    mp(i) && o + 2 < e && (n += 2 * t);
  }), n;
}
function wu(r, e, t) {
  t === void 0 && (t = e);
  var n = e === t, i = r.resolve(e), o = Ly(i), s = o, u = i.start(1), f = u;
  if (!n) {
    var d = r.resolve(t === r.content.size ? t - 1 : t);
    f = d.start(1), s = Ly(d), d.pos === r.content.size && (t = r.content.size - 2);
  }
  var h = Math.max(e - u + 1, 1), m = Math.max(t - f + 1, 1);
  return [
    [o, h + ha(r.child(o - 1), h, -1)],
    [s, m + ha(r.child(s - 1), m, -1)]
  ];
}
function Mk(r, e) {
  for (var t = [], n = 0, i = 0; n < e; n += 1) {
    var o = r.child(n);
    t[n] = i, i += o.nodeSize;
  }
  return t;
}
function Qi(r, e, t) {
  var n = Mk(r, t[0]), i = e[0] - 1, o = t[0] - 1, s = r.child(i), u = r.child(o), f = n[i], d = n[o];
  return f += e[1] + ha(s, e[1] - 1), d += t[1] + ha(u, t[1] - 1), [f, Math.min(d, r.content.size)];
}
function ot(r) {
  var e = r.$from, t = r.$to, n = r.from, i = r.to, o = e.doc;
  return r instanceof Vt && (e = o.resolve(n + 1), t = o.resolve(i - 1)), e.depth === 0 && (e = o.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 ju(r, e) {
  for (var t = 1, n = 1, i = 0, o = 0; i < r.childCount; i += 1) {
    var s = r.child(i).nodeSize;
    if (t = o + 1, n = o + s - 1, i === e)
      break;
    o += s;
  }
  return { startOffset: t, endOffset: n };
}
var Dy = "heading", YO = "blockQuote", ZO = "listItem", eN = "table", tN = "tableCell", rN = "codeBlock", nN = "thematicBreak", ku = "link", au = "code", mc = "meta", ho = "delimiter", iN = "taskDelimiter", wh = "markedText", oN = "html", aN = "customBlock", Ay = {
  strong: 2,
  emph: 1,
  strike: 2
};
function Le(r, e, t, n) {
  return { start: r, end: e, spec: { type: t, attrs: n } };
}
function sN(r, e, t) {
  var n = r.level, i = r.headingType, o = [Le(e, t, Dy, { level: n })];
  return i === "atx" ? o.push(Le(e, pt(e, n), ho)) : o.push(Le(wi(t, 0), t, Dy, { seText: !0 })), o;
}
function Ld(r, e, t) {
  var n = r.type, i = pt(e, Ay[n]), o = pt(t, -Ay[n]);
  return [
    Le(i, o, n),
    Le(e, i, ho),
    Le(o, t, ho)
  ];
}
function Ok(r, e, t, n) {
  return [
    Le(r, e, ku),
    Le(wi(r, t[1] + 1), wi(e, n), ku, {
      desc: !0
    }),
    Le(wi(e, n + 2), pt(e, -1), ku, { url: !0 })
  ];
}
function lN(r, e, t) {
  var n = r.lastChild, i = n ? yi(n) + 1 : 3, o = pt(e, 1);
  return rr([Le(e, o, mc)], Ok(e, t, o, i));
}
function uN(r, e, t) {
  var n = r.lastChild, i = r.extendedAutolink, o = n ? yi(n) + 1 : 2;
  return i ? [Le(e, t, ku, { desc: !0 })] : Ok(e, t, e, o);
}
function cN(r, e, t) {
  var n = r.tickCount, i = pt(e, n), o = pt(t, -n);
  return [
    Le(e, t, au),
    Le(e, i, au, { start: !0 }),
    Le(i, o, au, { marked: !0 }),
    Le(o, t, au, { end: !0 })
  ];
}
function Nk(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" ? [
    R(R({}, i), { end: e, spec: { attrs: { className: n + "-line-background start" } } }),
    R(R({}, i), { start: [Math.min(e[0] + 1, t[0]), e[1]] })
  ] : null;
}
function fN(r, e, t, n) {
  var i = r.fenceOffset, o = r.fenceLength, s = r.fenceChar, u = r.info, f = r.infoPadding, d = r.parent, h = i + o, m = [Le(wi(e, 1), t, rN)];
  s && m.push(Le(e, pt(e, h), ho)), u && m.push(Le(pt(e, o), pt(e, o + f + u.length), mc));
  var y = "^(\\s{0,4})(" + s + "{" + o + ",})", w = new RegExp(y);
  w.test(n) && m.push(Le(wi(t, 1), t, ho));
  var k = Nk(d, e, t, "code-block");
  return k ? m.concat(k) : m;
}
function dN(r, e, t) {
  var n = r, i = n.offset, o = n.syntaxLength, s = n.info, u = n.parent, f = i + o, d = [Le(wi(e, 1), t, aN)];
  d.push(Le(e, pt(e, f), ho)), s && d.push(Le(pt(e, f), pt(e, o + s.length), mc)), d.push(Le(wi(t, 1), t, ho));
  var h = Nk(u, e, t, "custom-block");
  return h ? d.concat(h) : d;
}
function Lk(r, e) {
  for (var t = []; r; ) {
    var n = r.type;
    (n === "paragraph" || n === "codeBlock") && t.push(Le([Us(r), pc(r) - 1], [dc(r), yi(r) + 1], e)), r = r.next;
  }
  return t;
}
function pN(r) {
  for (var e = []; r; )
    e.push(Le([Us(r), pc(r)], [dc(r), yi(r) + 1], wh)), r = r.next;
  return e;
}
function hN(r, e, t) {
  var n = r.parent && r.parent.type !== "blockQuote" ? [Le(e, t, YO)] : [];
  if (r.firstChild) {
    var i = [];
    r.firstChild.type === "paragraph" ? i = pN(r.firstChild.firstChild) : r.firstChild.type === "list" && (i = Lk(r.firstChild, wh)), n = rr(rr([], n), i);
  }
  return n;
}
function vN(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 [ZO, R(R({}, t), { listStyle: !0 })];
}
function mN(r, e) {
  var t = r.listData, n = t.padding, i = t.task, o = vN(r), s = [Le.apply(void 0, rr([e, pt(e, n)], o))];
  return i && (s.push(Le(pt(e, n), pt(e, n + 3), iN)), s.push(Le(pt(e, n + 1), pt(e, n + 2), mc))), s.concat(Lk(r.firstChild, wh));
}
var Iy = {
  heading: sN,
  strong: Ld,
  emph: Ld,
  strike: Ld,
  link: uN,
  image: lN,
  code: cN,
  codeBlock: fN,
  blockQuote: hN,
  item: mN,
  customBlock: dN
}, Ry = {
  thematicBreak: nN,
  table: eN,
  tableCell: tN,
  htmlInline: oN
};
function gN(r, e, t, n) {
  var i = r.type;
  return xr(Iy[i]) ? Iy[i](r, e, t, n) : Ry[i] ? [Le(e, t, Ry[i])] : null;
}
var Hs = {};
function yN(r) {
  var e = r.schema, t = r.toastMark;
  return new nr({
    appendTransaction: function(n, i, o) {
      var s = n[0], u = o.tr;
      if (s.docChanged) {
        var f = [], d = s.getMeta("editResult");
        d.forEach(function(h) {
          var m = h.nodes, y = h.removedNodeRange;
          if (m.length) {
            f = f.concat(xN(u, m));
            for (var w = 0, k = m; w < k.length; w++)
              for (var b = k[w], T = b.walker(), E = T.next(); E; ) {
                var I = E.node, P = E.entering;
                P && (f = f.concat(SN(I, t))), E = T.next();
              }
          } else if (y)
            for (var _ = u.doc.childCount - 1, V = y.line, W = V[0], q = V[1], K = Math.min(W, _), ce = Math.min(q, _), be = K; be <= ce; be += 1)
              Hs[be] = !0;
        }), CN(u, e, f);
      }
      return u.setMeta("widget", s.getMeta("widget"));
    }
  });
}
function wN(r, e, t) {
  return Object.keys(t).some(function(n) {
    return t[n] !== r.child(e).attrs[n];
  });
}
function kN(r, e, t, n, i) {
  i === void 0 && (i = {});
  for (var o = n.startIndex, s = n.endIndex, u = n.from, f = n.to, d = !1, h = o; h <= s; h += 1)
    delete Hs[h], d = wN(e, h, i);
  d && r.setBlockType(u, f, t, i);
}
function CN(r, e, t) {
  var n = r.doc, i = e.nodes.paragraph, o = Mk(n, n.childCount);
  t.forEach(function(s) {
    var u = s.start, f = s.end, d = s.spec, h = s.lineBackground, m = Math.min(u[0], n.childCount) - 1, y = Math.min(f[0], n.childCount) - 1, w = n.child(m), k = n.child(y), b = o[m], T = o[y];
    if (b += u[1] + ha(w, u[1] - 1), T += f[1] + ha(k, f[1] - 1), d)
      if (h) {
        var E = { from: b, to: T, startIndex: m, endIndex: y };
        kN(r, n, i, E, d.attrs);
      } else
        r.addMark(b, T, e.mark(d.type, d.attrs));
    else
      r.removeMark(b, T);
  }), bN(r, o, i);
}
function bN(r, e, t) {
  Object.keys(Hs).forEach(function(n) {
    var i = Number(n), o = Math.min(Number(n) + 1, r.doc.childCount - 1), s = e[i], u = e[o] - 1;
    i === o && (u += 2), r.setBlockType(s, u, t);
  });
}
function TN(r, e, t) {
  var n = [];
  Hs = {};
  for (var i = e[0] - 1; i < t[0]; i += 1) {
    var o = r.child(i), s = o.attrs.codeEnd, u = o.attrs.codeStart;
    if (u && s && !Et(n, u)) {
      n.push(u), s = Math.min(s, r.childCount);
      for (var f = u - 1, d = t[0], h = f; h < d; h += 1)
        Hs[h] = !0;
    }
  }
}
function xN(r, e) {
  var t = r.doc, n = e[0].sourcepos[0], i = Rt(e).sourcepos, o = i[1], s = [n[0], n[1]], u = [o[0], o[1] + 1], f = [];
  return TN(t, n, o), f.push({ start: s, end: u }), f;
}
function SN(r, e) {
  var t = e.getLineTexts(), n = [Us(r), pc(r)], i = [dc(r), yi(r) + 1], o = gN(r, n, i, t[i[0] - 1]);
  return o ?? [];
}
var EN = [
  "taskList",
  "orderedList",
  "bulletList",
  "table",
  "strong",
  "emph",
  "strike",
  "heading",
  "thematicBreak",
  "blockQuote",
  "code",
  "codeBlock",
  "indent",
  "outdent"
];
function MN(r) {
  var e = r.type;
  return fo(r) ? r.listData.task ? "taskList" : r.listData.type === "ordered" ? "orderedList" : "bulletList" : e.indexOf("table") !== -1 ? "table" : Et(EN, e) ? e : null;
}
function ON(r) {
  var e = {
    indent: { active: !1, disabled: !0 },
    outdent: { active: !1, disabled: !0 }
  }, t = !0;
  return gO(r, function(n) {
    var i = MN(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 NN(r) {
  var e = r.toastMark, t = r.eventEmitter;
  return new nr({
    view: function() {
      return {
        update: function(n, i) {
          var o = n.state, s = o.doc, u = o.selection;
          if (!(i && i.doc.eq(s) && i.selection.eq(u))) {
            var f = u.from, d = o.doc.resolve(f).start(), h = o.doc.content.findIndex(f).index + 1, m = f - d;
            f === d && (m += 1);
            var y = [h, m], w = e.findNodeAtPosition(y), k = ON(w);
            t.emit("changeToolbarState", {
              cursorPos: y,
              mdNode: w,
              toolbarState: k
            }), t.emit("setFocusedNode", w);
          }
        }
      };
    }
  });
}
var LN = (
  /** @class */
  (function(r) {
    Y(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;
  })(Fe)
), Ue = (
  /** @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 lr(r, e) {
  return Ci(r, e - 1);
}
function Ci(r, e) {
  return r.child(e).textContent;
}
var Cs = /^\s*> ?/, DN = (
  /** @class */
  (function(r) {
    Y(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: at("block-quote") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.createBlockQuoteText = function(t, n) {
      return n ? t.replace(Cs, "").trim() : "> " + t.trim();
    }, e.prototype.extendBlockQuote = function() {
      var t = this;
      return function(n, i) {
        var o = n.selection, s = n.doc, u = n.tr, f = n.schema, d = ot(o), h = d.endFromOffset, m = d.endToOffset, y = d.endIndex, w = d.to, k = Ci(s, y), b = Cs.test(k);
        if (b && w > h && o.empty) {
          var T = !k.replace(Cs, "").trim();
          if (T)
            u.deleteRange(h, m).split(u.mapping.map(m));
          else {
            var E = k.slice(w - h).trim(), I = St(f, t.createBlockQuoteText(E));
            dh(u, m, E, I);
          }
          return i(u), !0;
        }
        return !1;
      };
    }, e.prototype.commands = function() {
      var t = this;
      return function() {
        return function(n, i) {
          var o = n.selection, s = n.doc, u = ot(o), f = u.startFromOffset, d = u.endToOffset, h = u.startIndex, m = u.endIndex, y = Cs.test(Ci(s, h)), w = Uu({
            state: n,
            startIndex: h,
            endIndex: m,
            from: f,
            createText: function(k) {
              return t.createBlockQuoteText(k, y);
            }
          });
          return i(w.setSelection($e(w, w.mapping.map(d)))), !0;
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "alt-q": t,
        "alt-Q": t,
        Enter: this.extendBlockQuote()
      };
    }, e;
  })(Ue)
), vo = /(^\s*)([-*+] |[\d]+\. )/, kh = /(^\s*)([\d])+\.( \[[ xX]])? /, Dn = /^(\s*)((\d+)([.)]\s(?:\[(?:x|\s)\]\s)?))(.*)/, Wu = /(^\s*)([-*+]|[\d]+\.)( \[[ xX]])? /, AN = /^(\s*)([-*+]+(\s(?:\[(?:x|\s)\]\s)?))(.*)/, IN = /(^\s*)([-*+] |[\d]+\. )(\[[ xX]] )/, RN = /(^\s*)([-*+])( \[[ xX]]) /;
function Ch(r) {
  return kh.test(r) ? "ordered" : "bullet";
}
function bh(r) {
  for (var e = 0; r && r.type !== "document"; )
    r.type === "list" && (e += 1), r = r.parent;
  return e;
}
function gp(r, e, t, n) {
  for (var i = r.getLineTexts(), o = i.length, s = [], u = e; n ? u < o : u > 1; ) {
    u = n ? u + 1 : u - 1;
    var f = r.findFirstNodeAtLine(u), d = bh(f);
    if (d === t)
      s.push({ line: u, depth: t, mdNode: f });
    else if (d < t)
      break;
  }
  return s;
}
function PN(r) {
  var e = r.toastMark, t = r.mdNode, n = r.line, i = bh(t), o = gp(e, n, i, !1).reverse(), s = gp(e, n, i, !0);
  return o.concat([{ line: n, depth: i, mdNode: t }]).concat(s);
}
function BN(r) {
  if (!vo.test(r))
    return "* " + r;
  var e = Ch(r);
  return e === "bullet" && Wu.test(r) ? r = r.replace(RN, "$1$2 ") : e === "ordered" && (r = r.replace(kh, "$1* ")), r;
}
function _N(r, e) {
  if (!vo.test(r))
    return e + ". " + r;
  var t = Ch(r);
  if (t === "bullet" || t === "ordered" && Wu.test(r))
    r = r.replace(Wu, "$1" + e + ". ");
  else if (t === "ordered") {
    var n = Dn.exec(r)[3];
    Number(n) !== e && (r = r.replace(kh, "$1" + e + ". "));
  }
  return r;
}
function Dk(r, e, t, n) {
  n === void 0 && (n = 0);
  var i = Number.MAX_VALUE, o = 0, s = e.map(function(u, f) {
    var d = u.line;
    i = Math.min(d - 1, i), o = Math.max(d - 1, o);
    var h = lr(r, d);
    return h = t === "bullet" ? BN(h) : _N(h, f + 1 + n), { text: h, line: d };
  });
  return { changedResults: s, firstIndex: i, lastIndex: o };
}
function Py(r, e) {
  var t = PN(e);
  return Dk(e.doc, t, r);
}
var HN = {
  bullet: function(r) {
    return Py("bullet", r);
  },
  ordered: function(r) {
    return Py("ordered", r);
  },
  task: function(r) {
    var e = r.mdNode, t = r.doc, n = r.line, i = lr(t, n);
    return e.listData.task ? i = i.replace(IN, "$1$2") : fo(e) && (i = i.replace(vo, "$1$2[ ] ")), { changedResults: [{ text: i, line: n }] };
  }
}, FN = {
  bullet: function(r) {
    var e = r.doc, t = r.line, n = lr(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, o = lr(t, n), s = 1, u = i, f = 0, d = i - 1; d > 0; d -= 1) {
      var h = e.findFirstNodeAtLine(d), m = lr(t, d), y = m && !!da(h, function(P) {
        return fo(P);
      }), w = Dn.exec(lr(t, d));
      if (!w && !y)
        break;
      if (!w && y) {
        f += 1;
        continue;
      }
      var k = w, b = k[1], T = k[3];
      if (!b) {
        s = Number(T), u = d;
        break;
      }
    }
    var E = s + n - u - f, I = [{ text: E + ". " + o, line: n }];
    return { changedResults: I };
  },
  task: function(r) {
    var e = r.doc, t = r.line, n = lr(e, t), i = [{ text: "* [ ] " + n, line: t }];
    return { changedResults: i };
  }
}, zN = {
  bullet: function(r) {
    var e = r.line, t = r.doc, n = lr(t, e), i = AN.exec(n), o = i[1], s = i[2];
    return { listSyntax: "" + o + s };
  },
  ordered: function(r) {
    var e = r.toastMark, t = r.line, n = r.mdNode, i = r.doc, o = bh(n), s = lr(i, t), u = Dn.exec(s), f = u[1], d = u[3], h = u[4], m = Number(d) + 1, y = "" + f + m + h, w = gp(e, t, o, !0), k = w.filter(function(b) {
      var T = Dn.exec(lr(i, b.line));
      return T && T[1].length === f.length && !!da(b.mdNode, function(E) {
        return ok(E);
      });
    });
    return R({ listSyntax: y }, Dk(i, k, "ordered", m));
  }
};
function Ak(r, e, t, n, i) {
  for (var o = [], s = lr(r, t), u = Dn.exec(s); u; ) {
    var f = u[1], d = u[4], h = u[5], m = f.length;
    if (m === i)
      o.push(St(e, "" + f + n + d + h)), n += 1, t += 1;
    else if (m > i) {
      var y = Ak(r, e, t, 1, m);
      t = y.line, o = o.concat(y.nodes);
    }
    if (m < i || t > r.childCount)
      break;
    s = lr(r, t), u = Dn.exec(s);
  }
  return { nodes: o, line: t };
}
var By = /(^\s{1,4})(.*)/;
function _y(r, e, t) {
  return r < e || vo.test(t) || Cs.test(t);
}
function Hy(r, e, t) {
  var n = t.$from;
  n.depth === 0 && (n = r.resolve(n.pos - 1));
  var i = n.node(1), o = n.start(1), s = i.content.size;
  return i.rangeHasMark(0, s, e.marks.table) && n.pos - o !== s && n.pos !== o;
}
function Fy(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 o = e.spaceLenList;
    t -= o[0];
    for (var s = 0; s < o.length; s += 1)
      n -= o[s];
  }
  return $e(r, t, n);
}
var VN = (
  /** @class */
  (function(r) {
    Y(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: at(n.className) }, 0] : ["div", 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.reorderList = function(t, n) {
      for (var i = this.context, o = i.view, s = i.toastMark, u = i.schema, f = o.state, d = f.tr, h = f.selection, m = f.doc, y = s.findFirstNodeAtLine(t), w = y; y && !vO(y) && y.parent.type !== "document"; )
        if (y = y.parent, ok(y)) {
          w = y;
          break;
        }
      w && (t = w.sourcepos[0][0]);
      var k = Dn.exec(lr(m, t)), b = k[1], T = k[3], E = b.length, I = Ak(m, u, t, Number(T), E), P = I.line, _ = I.nodes;
      n = Math.max(n, P - 1);
      for (var V = ju(m, t - 1).startOffset, W = t - 1; W <= n - 1; W += 1) {
        var q = m.child(W), K = q.nodeSize, ce = q.content, be = d.mapping.map(V), Re = be + ce.size;
        d.replaceWith(be, Re, _[W - t + 1]), V += K;
      }
      var ze = $e(d, h.from, h.to);
      o.dispatch(d.setSelection(ze));
    }, e.prototype.indent = function(t) {
      var n = this;
      return t === void 0 && (t = !1), function() {
        return function(i, o) {
          var s = i.schema, u = i.selection, f = i.doc, d = ot(u), h = d.from, m = d.to, y = d.startFromOffset, w = d.startIndex, k = d.endIndex;
          if (t && Hy(f, s, u))
            return !1;
          var b = Ci(f, w);
          if (t && _y(h, m, b) || !t && vo.test(b)) {
            var T = Uu({
              state: i,
              from: y,
              startIndex: w,
              endIndex: k,
              createText: function(I) {
                return "    " + I;
              }
            }), E = {
              type: "indent",
              from: h,
              to: m,
              lineLen: k - w
            };
            o(T.setSelection(Fy(T, E))), Dn.test(b) && n.reorderList(w + 1, k + 1);
          } else t && o(i.tr.insert(m, St(s, "    ")));
          return !0;
        };
      };
    }, e.prototype.outdent = function(t) {
      var n = this;
      return t === void 0 && (t = !1), function() {
        return function(i, o) {
          var s = i.selection, u = i.doc, f = i.schema, d = ot(s), h = d.from, m = d.to, y = d.startFromOffset, w = d.startIndex, k = d.endIndex;
          if (t && Hy(u, f, s))
            return !1;
          var b = Ci(u, w);
          if (t && _y(h, m, b) || !t && vo.test(b)) {
            var T = [], E = Uu({
              state: i,
              from: y,
              startIndex: w,
              endIndex: k,
              createText: function(W) {
                var q = By.exec(W);
                return T.push(q ? q[1].length : 0), W.replace(By, "$2");
              }
            }), I = { type: "outdent", from: h, to: m, spaceLenList: T };
            o(E.setSelection(Fy(E, I))), Dn.test(b) && n.reorderList(w + 1, k + 1);
          } else if (t) {
            var P = b.slice(0, m - y), _ = P.replace(/\s{1,4}$/, ""), V = m - (P.length - _.length);
            o(i.tr.delete(V, m));
          }
          return !0;
        };
      };
    }, e.prototype.deleteLines = function() {
      var t = this;
      return function(n, i) {
        var o = t.context.view, s = ot(n.selection), u = s.startFromOffset, f = s.endToOffset, d = function() {
          return i(n.tr.deleteRange(u, f)), !0;
        };
        return cc(d, W1)(n, i, o);
      };
    }, e.prototype.moveDown = function() {
      return function(t, n) {
        var i = t.doc, o = t.tr, s = t.selection, u = t.schema, f = ot(s), d = f.startFromOffset, h = f.endToOffset, m = f.endIndex;
        if (m < i.content.childCount - 1) {
          var y = i.child(m + 1), w = y.nodeSize, k = y.textContent;
          return o.delete(h, h + w).split(d).insert(o.mapping.map(d) - 2, St(u, k)), n(o), !0;
        }
        return !1;
      };
    }, e.prototype.moveUp = function() {
      return function(t, n) {
        var i = t.tr, o = t.doc, s = t.selection, u = t.schema, f = ot(s), d = f.startFromOffset, h = f.endToOffset, m = f.startIndex;
        if (m > 0) {
          var y = o.child(m - 1), w = y.nodeSize, k = y.textContent;
          return i.delete(d - w, d).split(i.mapping.map(h)).insert(i.mapping.map(h), St(u, k)), 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;
  })(Fe)
), qN = (
  /** @class */
  (function(r) {
    Y(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;
  })(Fe)
), $N = /^#{1,6}\s/, UN = (
  /** @class */
  (function(r) {
    Y(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, o = n.seText, s = "heading|heading" + i;
            return o && (s += "|delimiter|setext"), ["span", { class: at.apply(void 0, s.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.createHeadingText = function(t, n, i) {
      for (var o = n.replace(i, "").trim(), s = ""; t > 0; )
        s += "#", t -= 1;
      return s + " " + o;
    }, e.prototype.commands = function() {
      var t = this;
      return function(n) {
        return function(i, o) {
          var s = n.level, u = ot(i.selection), f = u.startFromOffset, d = u.endToOffset, h = u.startIndex, m = u.endIndex, y = Uu({
            state: i,
            from: f,
            startIndex: h,
            endIndex: m,
            createText: function(w) {
              var k = w.match($N), b = k ? k[0] : "";
              return t.createHeadingText(s, w, b);
            }
          });
          return o(y.setSelection($e(y, y.mapping.map(d)))), !0;
        };
      };
    }, e;
  })(Ue)
), Dd = "```", jN = (
  /** @class */
  (function(r) {
    Y(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: at("code-block") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, o = t.schema, s = t.tr, u = ot(i), f = u.startFromOffset, d = u.endToOffset, h = St(o, Dd);
          return s.insert(f, h).split(f + Dd.length), s.split(s.mapping.map(d)).insert(s.mapping.map(d), h), n(s.setSelection(
            // subtract fenced syntax length and open, close tag(2)
            $e(s, s.mapping.map(d) - (Dd.length + 2))
          )), !0;
        };
      };
    }, e.prototype.keepIndentation = function() {
      var t = this;
      return function(n, i) {
        var o = n.selection, s = n.tr, u = n.doc, f = n.schema, d = t.context.toastMark, h = ot(o), m = h.startFromOffset, y = h.endToOffset, w = h.endIndex, k = h.from, b = h.to, T = Ci(u, w);
        if (k === b && T.trim()) {
          var E = T.match(/^\s+/), I = d.findFirstNodeAtLine(w + 1);
          if (hO(I) && E) {
            var P = E[0], _ = T.slice(b - m), V = St(f, P + _);
            return dh(s, y, _, V), 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;
  })(Ue)
), WN = /\||\s/g;
function GN(r) {
  return [Gu(r), Gu(r, !0)];
}
function KN(r, e) {
  for (var t = [], n = 0; n < e; n += 1)
    t.push(Gu(r));
  return t;
}
function Gu(r, e) {
  for (var t = "|", n = 0; n < r; n += 1)
    t += e ? " --- |" : "  |";
  return t;
}
function QN(r) {
  return r ? { type: "next", parentType: "tableHead", childType: "firstChild" } : { type: "prev", parentType: "tableBody", childType: "lastChild" };
}
var JN = (
  /** @class */
  (function(r) {
    Y(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: at("table") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.extendTable = function() {
      var t = this;
      return function(n, i) {
        var o = n.selection, s = n.doc, u = n.tr, f = n.schema;
        if (!o.empty)
          return !1;
        var d = ot(o), h = d.endFromOffset, m = d.endToOffset, y = d.endIndex, w = d.to, k = Ci(s, y), b = [y + 1, w - h + 1], T = t.context.toastMark.findNodeAtPosition(b), E = da(T, function(W) {
          return My(W) && (W.parent.type === "tableDelimRow" || W.parent.parent.type === "tableBody");
        });
        if (E) {
          var I = !k.replace(WN, "").trim(), P = E.parent, _ = P.parent.parent.columns.length, V = Gu(_);
          return I ? u.deleteRange(h, m).split(u.mapping.map(m)) : u.split(m).insert(u.mapping.map(m), St(f, V)).setSelection($e(u, u.mapping.map(m) - 2)), i(u), !0;
        }
        return !1;
      };
    }, e.prototype.moveTableCell = function(t) {
      var n = this;
      return function(i, o) {
        var s = i.selection, u = i.tr, f = ot(s), d = f.endFromOffset, h = f.endIndex, m = f.to, y = [h + 1, m - d], w = n.context.toastMark.findNodeAtPosition(y), k = da(w, function(q) {
          return My(q);
        });
        if (k) {
          var b = k.parent, T = QN(t), E = T.type, I = T.parentType, P = T.childType, _ = yi(k);
          if (k[E])
            _ = yi(k[E]) - 1;
          else {
            var V = !b[E] && b.parent.type === I ? b.parent[E][P] : b[E];
            if (E === "next") {
              var W = V ? yi(V[P]) : 0;
              _ += W + 2;
            } else E === "prev" && (_ = V ? -4 : 0);
          }
          return o(u.setSelection($e(u, d + _))), !0;
        }
        return !1;
      };
    }, e.prototype.addTable = function() {
      return function(t) {
        return function(n, i) {
          var o = n.selection, s = n.tr, u = n.schema, f = t, d = f.columnCount, h = f.rowCount, m = ot(o).endToOffset, y = GN(d), w = KN(d, h - 1), k = rr(rr([], y), w);
          return k.forEach(function(b) {
            s.split(s.mapping.map(m)).insert(s.mapping.map(m), St(u, b));
          }), i(s.setSelection($e(s, m + 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;
  })(Ue)
), XN = "***", YN = (
  /** @class */
  (function(r) {
    Y(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: at("thematic-break") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.hr = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, o = t.schema, s = t.tr, u = ot(i), f = u.from, d = u.to, h = u.endToOffset, m = St(o, XN);
          return s.split(f).replaceWith(s.mapping.map(f), s.mapping.map(d), m).split(s.mapping.map(d)).setSelection($e(s, s.mapping.map(h))), 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;
  })(Ue)
);
function ZN(r, e) {
  var t = r.type, n = r.sourcepos, i = n[0][0];
  return e <= i && (t === "codeBlock" || t === "heading" || t.match("table"));
}
var eL = (
  /** @class */
  (function(r) {
    Y(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, o = n.even, s = n.listStyle, u = "list-item";
            return s && (u += "|list-item-style"), i && (u += "|list-item-odd"), o && (u += "|list-item-even"), ["span", { class: at.apply(void 0, u.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.extendList = function() {
      var t = this;
      return function(n, i) {
        var o = n.selection, s = n.doc, u = n.schema, f = n.tr, d = t.context.toastMark, h = ot(o), m = h.to, y = h.startFromOffset, w = h.endFromOffset, k = h.endIndex, b = h.endToOffset, T = Ci(s, k), E = vo.test(T);
        if (!E || o.from === y || !o.empty)
          return !1;
        var I = !T.replace(Wu, "").trim();
        if (I)
          f.deleteRange(w, b).split(f.mapping.map(b));
        else {
          var P = Ch(T), _ = d.findFirstNodeAtLine(k + 1), V = T.slice(m - w), W = { toastMark: d, mdNode: _, doc: s, line: k + 1 }, q = zN[P](W), K = q.listSyntax, ce = q.changedResults;
          if (ce?.length) {
            f.split(m), ce.unshift({ text: K + V, line: k + 1 }), t.changeToListPerLine(f, ce, {
              from: m,
              // don't subtract 1 because the line has increased through 'split' command.
              startLine: ce[0].line,
              endLine: Rt(ce).line
            });
            var be = f.mapping.map(b) - V.length;
            f.setSelection($e(f, be));
          } else {
            var Re = St(u, K + V);
            dh(f, b, V, Re);
          }
        }
        return i(f), !0;
      };
    }, e.prototype.toList = function(t) {
      var n = this;
      return function() {
        return function(i, o) {
          for (var s = i.doc, u = i.tr, f = i.selection, d = n.context.toastMark, h = ot(f), m = h.startIndex + 1, y = h.endIndex + 1, w = h.endToOffset, k = [], b = m; b <= y; b += 1) {
            var T = d.findFirstNodeAtLine(b);
            if (T && ZN(T, b))
              break;
            if (k.indexOf(b) === -1) {
              var E = { toastMark: d, mdNode: T, doc: s, line: b, startLine: m }, I = (fo(T) ? HN[t](E) : FN[t](E)).changedResults, P = n.changeToListPerLine(u, I, {
                from: ju(s, I[0].line - 1).startOffset,
                startLine: I[0].line,
                endLine: Rt(I).line,
                indexDiff: 1
              });
              w = Math.max(P, w), I && (k = k.concat(I.map(function(_) {
                return _.line;
              })));
            }
          }
          return o(u.setSelection($e(u, u.mapping.map(w)))), !0;
        };
      };
    }, e.prototype.changeToListPerLine = function(t, n, i) {
      for (var o = i.from, s = i.startLine, u = i.endLine, f = i.indexDiff, d = f === void 0 ? 0 : f, h = 0, m = function(k) {
        var b = t.doc.child(k), T = b.nodeSize, E = b.content, I = t.mapping.map(o), P = I + E.size, _ = n.filter(function(V) {
          return V.line - d === k;
        })[0];
        _ && (t.replaceWith(I, P, St(y.context.schema, _.text)), h = Math.max(h, o + E.size)), o += T;
      }, y = this, w = s - d; w <= u - d; w += 1)
        m(w);
      return h;
    }, e.prototype.toggleTask = function() {
      var t = this;
      return function(n, i) {
        for (var o = n.selection, s = n.tr, u = n.doc, f = n.schema, d = t.context.toastMark, h = ot(o), m = h.startIndex, y = h.endIndex, w = null, k = m; k <= y; k += 1) {
          var b = d.findFirstNodeAtLine(k + 1);
          if (fo(b) && b.listData.task) {
            var T = b.listData, E = T.checked, I = T.padding, P = E ? " " : "x", _ = b.sourcepos[0], V = ju(u, _[0] - 1).startOffset;
            V += _[1] + I, w = s.replaceWith(V, V + 1, f.text(P));
          }
        }
        return w ? (i(w), !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")(), o = this.toggleTask();
      return {
        "Mod-u": t,
        "Mod-U": t,
        "Mod-o": n,
        "Mod-O": n,
        "alt-t": i,
        "alt-T": i,
        "Shift-Ctrl-x": o,
        "Shift-Ctrl-X": o,
        Enter: this.extendList()
      };
    }, e;
  })(Ue)
);
function gc(r, e) {
  return function() {
    return function(t, n) {
      var i = t.tr, o = t.selection, s = xr(r) ? r : function(P) {
        return r.test(P);
      }, u = e.length, f = i.doc, d = Ek(o), h = d[0], m = d[1], y = Math.max(h - u, 1), w = Math.min(m + u, f.content.size - 1), k = o.content(), b = k.content.textBetween(0, k.content.size, `
`), T = f.textBetween(y, h, `
`), E = f.textBetween(m, w, `
`);
      if (b = "" + T + b + E, T && E && s(b))
        i.delete(w - u, w).delete(y, y + u);
      else {
        i.insertText(e, m).insertText(e, h);
        var I = o.empty ? $e(i, h + u) : $e(i, h + u, m + u);
        i.setSelection(I);
      }
      return n(i), !0;
    };
  };
}
var tL = /^(\*{2}|_{2}).*([\s\S]*)\1$/m, rL = "**", nL = (
  /** @class */
  (function(r) {
    Y(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: at("strong") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.bold = function() {
      return gc(tL, rL);
    }, e.prototype.commands = function() {
      return { bold: this.bold() };
    }, e.prototype.keymaps = function() {
      var t = this.bold()();
      return { "Mod-b": t, "Mod-B": t };
    }, e;
  })(Ue)
), iL = /^(~{2}).*([\s\S]*)\1$/m, oL = "~~", aL = (
  /** @class */
  (function(r) {
    Y(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: at("strike") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return gc(iL, oL);
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return { "Mod-s": t, "Mod-S": t };
    }, e;
  })(Ue)
), sL = /^(\*|_).*([\s\S]*)\1$/m, lL = "*", uL = (
  /** @class */
  (function(r) {
    Y(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: at("emph") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.italic = function() {
      return gc(sL, lL);
    }, e.prototype.commands = function() {
      return { italic: this.italic() };
    }, e.prototype.keymaps = function() {
      var t = this.italic()();
      return { "Mod-i": t, "Mod-I": t };
    }, e;
  })(Ue)
), cL = /^(`).*([\s\S]*)\1$/m, fL = "`", dL = (
  /** @class */
  (function(r) {
    Y(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, o = n.end, s = n.marked, u = "code";
            return i && (u += "|delimiter|start"), o && (u += "|delimiter|end"), s && (u += "|marked-text"), ["span", { class: at.apply(void 0, u.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return gc(cL, fL);
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return { "Shift-Mod-c": t, "Shift-Mod-C": t };
    }, e;
  })(Ue)
), pL = (
  /** @class */
  (function(r) {
    Y(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, o = n.desc, s = "link";
            return i && (s += "|link-url|marked-text"), o && (s += "|link-desc|marked-text"), ["span", { class: at.apply(void 0, s.split("|")) }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addLinkOrImage = function(t) {
      return function(n) {
        return function(i, o) {
          var s = i.selection, u = i.tr, f = i.schema, d = Ek(s), h = d[0], m = d[1], y = n, w = y.linkText, k = y.altText, b = y.linkUrl, T = y.imageUrl, E = w, I = b, P = "";
          return t === "image" && (E = k, I = T, P = "!"), E = Vu(E), P += "[" + E + "](" + I + ")", o(u.replaceWith(h, m, St(f, P))), !0;
        };
      };
    }, e.prototype.commands = function() {
      return {
        addImage: this.addLinkOrImage("image"),
        addLink: this.addLinkOrImage("link")
      };
    }, e;
  })(Ue)
), hL = (
  /** @class */
  (function(r) {
    Y(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: at("delimiter", "list-item") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Ue)
), vL = (
  /** @class */
  (function(r) {
    Y(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: at("delimiter") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Ue)
), mL = (
  /** @class */
  (function(r) {
    Y(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: at("meta") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Ue)
), gL = (
  /** @class */
  (function(r) {
    Y(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: at("marked-text") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Ue)
), yL = (
  /** @class */
  (function(r) {
    Y(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: at("table-cell") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Ue)
), wL = (
  /** @class */
  (function(r) {
    Y(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: at("html") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Ue)
), Ad = "$$", kL = (
  /** @class */
  (function(r) {
    Y(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: at("custom-block") }, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function(t) {
        return function(n, i) {
          var o = n.selection, s = n.schema, u = n.tr, f = ot(o), d = f.startFromOffset, h = f.endToOffset;
          if (!t?.info)
            return !1;
          var m = "" + Ad + t.info, y = St(s, m), w = St(s, Ad);
          return u.insert(d, y).split(d + m.length), u.split(u.mapping.map(h)).insert(u.mapping.map(h), w), i(u.setSelection($e(u, u.mapping.map(h) - (Ad.length + 2)))), !0;
        };
      };
    }, e;
  })(Ue)
), CL = /x|backspace/i, bL = /^\[(\s*)(x?)(\s*)\](?:\s+)/i;
function TL(r) {
  var e = r.schema, t = r.toastMark;
  return new nr({
    props: {
      handleDOMEvents: {
        keyup: function(n, i) {
          var o, s = n.state, u = s.doc, f = s.tr, d = s.selection;
          if (d.empty && CL.test(i.key)) {
            var h = ot(d), m = h.startIndex, y = h.startFromOffset, w = h.from, k = [m + 1, w - y + 1], b = t.findNodeAtPosition(k), T = da(b, function(Re) {
              var ze;
              return Re.type === "paragraph" && ((ze = Re.parent) === null || ze === void 0 ? void 0 : ze.type) === "item";
            });
            if (!((o = T?.firstChild) === null || o === void 0) && o.literal) {
              var E = T.firstChild, I = E.literal.match(bL);
              if (I) {
                var P = E.sourcepos[0], _ = I[1], V = I[2], W = I[3], q = _.length + W.length, K = ju(u, P[0] - 1).startOffset, ce = P[1] + K;
                if (V) {
                  var be = q ? q + 1 : 0;
                  f.replaceWith(ce, be + ce, e.text(V)), n.dispatch(f);
                } else q || (f.insertText(" ", ce), n.dispatch(f));
              }
            }
          }
          return !1;
        }
      }
    }
  });
}
var Id = "cut", zy = /\r\n|\n|\r/, xL = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t, n) {
      var i = r.call(this, t) || this, o = n.toastMark, s = n.useCommandShortcut, u = s === void 0 ? !0 : s, f = n.mdPlugins, d = f === void 0 ? [] : f;
      return i.editorType = "markdown", i.el.classList.add("md-mode"), i.toastMark = o, i.extraPlugins = d, 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(R(R({}, i.context), { view: i.view })), i.createClipboard(), i.eventEmitter.listen("changePreviewTabWrite", function(h) {
        return i.toggleActive(!0, h);
      }), i.eventEmitter.listen("changePreviewTabPreview", function() {
        return i.toggleActive(!1);
      }), i.initEvent(), i;
    }
    return e.prototype.toggleActive = function(t, n) {
      hh(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 = re("pseudo-clipboard"), this.clipboard.addEventListener("paste", function(n) {
        var i = n.clipboardData || window.clipboardData, o = i && i.items;
        if (o) {
          var s = on(o).some(function(f) {
            return f.kind === "string" && f.type === "text/rtf";
          });
          if (!s) {
            var u = Ck(o);
            u && (n.preventDefault(), yh(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 Sk([
        new LN(),
        new VN(),
        new Tk(),
        new qN(),
        new UN(),
        new DN(),
        new jN(),
        new kL(),
        new JN(),
        new yL(),
        new YN(),
        new eL(),
        new nL(),
        new aL(),
        new uL(),
        new dL(),
        new pL(),
        new vL(),
        new hL(),
        new gL(),
        new mL(),
        new wL()
      ]);
    }, e.prototype.createPlugins = function() {
      return rr([
        yN(this.context),
        NN(this.context),
        TL(this.context)
      ], this.createPluginProps()).concat(this.defaultPlugins);
    }, e.prototype.createView = function() {
      var t = this;
      return new uc(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, Id);
          },
          scroll: function() {
            return t.eventEmitter.emit("scroll", "editor"), !0;
          },
          keyup: function(n, i) {
            return t.eventEmitter.emit("keyup", t.editorType, i), !1;
          }
        },
        nodeViews: {
          widget: bk
        }
      });
    }, e.prototype.createCommands = function() {
      return this.specs.commands(this.view);
    }, e.prototype.captureCopy = function(t, n) {
      t.preventDefault();
      var i = this.view.state, o = i.selection, s = i.tr;
      if (o.empty)
        return !0;
      var u = this.getChanged(o.content());
      return t.clipboardData ? t.clipboardData.setData("text/plain", u) : window.clipboardData.setData("Text", u), n === Id && this.view.dispatch(s.deleteSelection().scrollIntoView().setMeta("uiEvent", Id)), !0;
    }, e.prototype.updateMarkdown = function(t) {
      var n = this;
      t.docChanged && t.steps.forEach(function(i, o) {
        if (i.slice && !(i instanceof vt)) {
          var s = t.docs[o], u = [i.from, i.to], f = u[0], d = u[1], h = wu(s, f, d), m = h[0], y = h[1], w = n.getChanged(i.slice);
          m[0] === y[0] && m[1] === y[1] && w === "" && (w = `
`);
          var k = n.toastMark.editMarkdown(m, y, w);
          n.eventEmitter.emit("updatePreview", k), t.setMeta("editResult", k).scrollIntoView();
        }
      });
    }, e.prototype.getChanged = function(t) {
      var n = "", i = 0, o = t.content.size;
      return t.content.nodesBetween(i, o, function(s, u) {
        s.isText ? n += s.text.slice(Math.max(i, u) - u, o - u) : s.isBlock && u > 0 && (n += `
`);
      }), n;
    }, e.prototype.setSelection = function(t, n) {
      n === void 0 && (n = t);
      var i = this.view.state.tr, o = Qi(i.doc, t, n), s = o[0], u = o[1];
      this.view.dispatch(i.setSelection($e(i, s, u)).scrollIntoView());
    }, e.prototype.replaceSelection = function(t, n, i) {
      var o, s = this.view.state, u = s.tr, f = s.schema, d = s.doc, h = t.split(zy), m = h.map(function(T) {
        return $u(f, io(T, f));
      }), y = new Q(F.from(m), 1, 1);
      if (this.focus(), n && i) {
        var w = Qi(d, n, i), k = w[0], b = w[1];
        o = u.replaceRange(k, b, y);
      } else
        o = u.replaceSelection(y);
      this.view.dispatch(o.scrollIntoView());
    }, e.prototype.deleteSelection = function(t, n) {
      var i, o = this.view.state, s = o.tr, u = o.doc;
      if (t && n) {
        var f = Qi(u, t, n), d = f[0], h = f[1];
        i = s.deleteRange(d, h);
      } else
        i = s.deleteSelection();
      this.view.dispatch(i.scrollIntoView());
    }, e.prototype.getSelectedText = function(t, n) {
      var i = this.view.state, o = i.doc, s = i.selection, u = s.from, f = s.to;
      if (t && n) {
        var d = Qi(o, t, n);
        u = d[0], f = d[1];
      }
      return o.textBetween(u, f, `
`);
    }, e.prototype.getSelection = function() {
      var t = this.view.state.selection, n = t.from, i = t.to;
      return wu(this.view.state.tr.doc, n, i);
    }, e.prototype.setMarkdown = function(t, n) {
      n === void 0 && (n = !0);
      var i = t.split(zy), o = this.view.state, s = o.tr, u = o.doc, f = o.schema, d = i.map(function(h) {
        return $u(f, io(h, f));
      });
      this.view.dispatch(s.replaceWith(0, u.content.size, d)), n && this.moveCursorToEnd(!0);
    }, e.prototype.addWidget = function(t, n, i) {
      var o = this.view.state, s = o.tr, u = o.doc, f = o.selection, d = i ? Qi(u, i, i)[0] : f.to;
      this.view.dispatch(s.setMeta("widget", { pos: d, node: t, style: n }));
    }, e.prototype.replaceWithWidget = function(t, n, i) {
      var o = this.view.state, s = o.tr, u = o.schema, f = o.doc, d = Qi(f, t, n), h = io(i, u);
      this.view.dispatch(s.replaceWith(d[0], d[1], h));
    }, e.prototype.getRangeInfoOfNode = function(t) {
      var n = this.view.state, i = n.doc, o = n.selection, s = t || wu(i, o.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 hc(t);
      }).join(`
`);
    }, e.prototype.getToastMark = function() {
      return this.toastMark;
    }, e;
  })(xk)
), Vy = "_feEventKey";
function SL(r, e) {
  var t = r[Vy], n;
  return t || (t = r[Vy] = {}), n = t[e], n || (n = t[e] = []), n;
}
var Ik = SL, EL = Rn, Ku = fc, ML = Ik;
function OL(r, e, t) {
  if (EL(e)) {
    Ku(e.split(/\s+/g), function(n) {
      qy(r, n, t);
    });
    return;
  }
  Ku(e, function(n, i) {
    qy(r, i, n);
  });
}
function qy(r, e, t) {
  var n = ML(r, e), i;
  t ? (Ku(n, function(o, s) {
    return t === o.handler ? ($y(r, e, o.wrappedHandler), i = s, !1) : !0;
  }), n.splice(i, 1)) : (Ku(n, function(o) {
    $y(r, e, o.wrappedHandler);
  }), n.splice(0, n.length));
}
function $y(r, e, t) {
  "removeEventListener" in r ? r.removeEventListener(e, t) : "detachEvent" in r && r.detachEvent("on" + e, t);
}
var Rk = OL, NL = Rn, yp = fc, LL = Ik;
function DL(r, e, t, n) {
  if (NL(e)) {
    yp(e.split(/\s+/g), function(i) {
      Uy(r, i, t, n);
    });
    return;
  }
  yp(e, function(i, o) {
    Uy(r, o, i, t);
  });
}
function Uy(r, e, t, n) {
  function i(o) {
    t.call(n || r, o || window.event);
  }
  "addEventListener" in r ? r.addEventListener(e, i) : "attachEvent" in r && r.attachEvent("on" + e, i), AL(r, e, t, i);
}
function AL(r, e, t, n) {
  var i = LL(r, e), o = !1;
  yp(i, function(s) {
    return s.handler === t ? (o = !0, !1) : !0;
  }), o || i.push({
    handler: t,
    wrappedHandler: n
  });
}
var Pk = DL;
var wp = function(r, e) {
  return wp = 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]);
  }, wp(r, e);
};
function Sr(r, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  wp(r, e);
  function t() {
    this.constructor = r;
  }
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
}
var bt = function() {
  return bt = Object.assign || function(e) {
    for (var t, n = 1, i = arguments.length; n < i; n++) {
      t = arguments[n];
      for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
    }
    return e;
  }, bt.apply(this, arguments);
};
function kp(r, e, t) {
  if (arguments.length === 2) for (var n = 0, i = e.length, o; n < i; n++)
    (o || !(n in e)) && (o || (o = Array.prototype.slice.call(e, 0, n)), o[n] = e[n]);
  return r.concat(o || Array.prototype.slice.call(e));
}
var va = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, jy = {};
function IL(r) {
  var e, t, n = jy[r];
  if (n)
    return n;
  for (n = jy[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 yc(r, e, t) {
  var n, i, o, s, u, f = "";
  for (typeof e != "string" && (t = e, e = yc.defaultChars), typeof t > "u" && (t = !0), u = IL(e), n = 0, i = r.length; n < i; n++) {
    if (o = r.charCodeAt(n), t && o === 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 (o < 128) {
      f += u[o];
      continue;
    }
    if (o >= 55296 && o <= 57343) {
      if (o >= 55296 && o <= 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;
}
yc.defaultChars = ";/?:@&=+$,-_.!~*'()#";
yc.componentChars = "-_.!~*'()";
var RL = yc, Th = {}, An = {}, PL = "Á", BL = "á", _L = "Ă", HL = "ă", FL = "∾", zL = "∿", VL = "∾̳", qL = "Â", $L = "â", UL = "´", jL = "А", WL = "а", GL = "Æ", KL = "æ", QL = "⁡", JL = "𝔄", XL = "𝔞", YL = "À", ZL = "à", eD = "ℵ", tD = "ℵ", rD = "Α", nD = "α", iD = "Ā", oD = "ā", aD = "⨿", sD = "&", lD = "&", uD = "⩕", cD = "⩓", fD = "∧", dD = "⩜", pD = "⩘", hD = "⩚", vD = "∠", mD = "⦤", gD = "∠", yD = "⦨", wD = "⦩", kD = "⦪", CD = "⦫", bD = "⦬", TD = "⦭", xD = "⦮", SD = "⦯", ED = "∡", MD = "∟", OD = "⊾", ND = "⦝", LD = "∢", DD = "Å", AD = "⍼", ID = "Ą", RD = "ą", PD = "𝔸", BD = "𝕒", _D = "⩯", HD = "≈", FD = "⩰", zD = "≊", VD = "≋", qD = "'", $D = "⁡", UD = "≈", jD = "≊", WD = "Å", GD = "å", KD = "𝒜", QD = "𝒶", JD = "≔", XD = "*", YD = "≈", ZD = "≍", eA = "Ã", tA = "ã", rA = "Ä", nA = "ä", iA = "∳", oA = "⨑", aA = "≌", sA = "϶", lA = "‵", uA = "∽", cA = "⋍", fA = "∖", dA = "⫧", pA = "⊽", hA = "⌅", vA = "⌆", mA = "⌅", gA = "⎵", yA = "⎶", wA = "≌", kA = "Б", CA = "б", bA = "„", TA = "∵", xA = "∵", SA = "∵", EA = "⦰", MA = "϶", OA = "ℬ", NA = "ℬ", LA = "Β", DA = "β", AA = "ℶ", IA = "≬", RA = "𝔅", PA = "𝔟", BA = "⋂", _A = "◯", HA = "⋃", FA = "⨀", zA = "⨁", VA = "⨂", qA = "⨆", $A = "★", UA = "▽", jA = "△", WA = "⨄", GA = "⋁", KA = "⋀", QA = "⤍", JA = "⧫", XA = "▪", YA = "▴", ZA = "▾", eI = "◂", tI = "▸", rI = "␣", nI = "▒", iI = "░", oI = "▓", aI = "█", sI = "=⃥", lI = "≡⃥", uI = "⫭", cI = "⌐", fI = "𝔹", dI = "𝕓", pI = "⊥", hI = "⊥", vI = "⋈", mI = "⧉", gI = "┐", yI = "╕", wI = "╖", kI = "╗", CI = "┌", bI = "╒", TI = "╓", xI = "╔", SI = "─", EI = "═", MI = "┬", OI = "╤", NI = "╥", LI = "╦", DI = "┴", AI = "╧", II = "╨", RI = "╩", PI = "⊟", BI = "⊞", _I = "⊠", HI = "┘", FI = "╛", zI = "╜", VI = "╝", qI = "└", $I = "╘", UI = "╙", jI = "╚", WI = "│", GI = "║", KI = "┼", QI = "╪", JI = "╫", XI = "╬", YI = "┤", ZI = "╡", eR = "╢", tR = "╣", rR = "├", nR = "╞", iR = "╟", oR = "╠", aR = "‵", sR = "˘", lR = "˘", uR = "¦", cR = "𝒷", fR = "ℬ", dR = "⁏", pR = "∽", hR = "⋍", vR = "⧅", mR = "\\", gR = "⟈", yR = "•", wR = "•", kR = "≎", CR = "⪮", bR = "≏", TR = "≎", xR = "≏", SR = "Ć", ER = "ć", MR = "⩄", OR = "⩉", NR = "⩋", LR = "∩", DR = "⋒", AR = "⩇", IR = "⩀", RR = "ⅅ", PR = "∩︀", BR = "⁁", _R = "ˇ", HR = "ℭ", FR = "⩍", zR = "Č", VR = "č", qR = "Ç", $R = "ç", UR = "Ĉ", jR = "ĉ", WR = "∰", GR = "⩌", KR = "⩐", QR = "Ċ", JR = "ċ", XR = "¸", YR = "¸", ZR = "⦲", eP = "¢", tP = "·", rP = "·", nP = "𝔠", iP = "ℭ", oP = "Ч", aP = "ч", sP = "✓", lP = "✓", uP = "Χ", cP = "χ", fP = "ˆ", dP = "≗", pP = "↺", hP = "↻", vP = "⊛", mP = "⊚", gP = "⊝", yP = "⊙", wP = "®", kP = "Ⓢ", CP = "⊖", bP = "⊕", TP = "⊗", xP = "○", SP = "⧃", EP = "≗", MP = "⨐", OP = "⫯", NP = "⧂", LP = "∲", DP = "”", AP = "’", IP = "♣", RP = "♣", PP = ":", BP = "∷", _P = "⩴", HP = "≔", FP = "≔", zP = ",", VP = "@", qP = "∁", $P = "∘", UP = "∁", jP = "ℂ", WP = "≅", GP = "⩭", KP = "≡", QP = "∮", JP = "∯", XP = "∮", YP = "𝕔", ZP = "ℂ", eB = "∐", tB = "∐", rB = "©", nB = "©", iB = "℗", oB = "∳", aB = "↵", sB = "✗", lB = "⨯", uB = "𝒞", cB = "𝒸", fB = "⫏", dB = "⫑", pB = "⫐", hB = "⫒", vB = "⋯", mB = "⤸", gB = "⤵", yB = "⋞", wB = "⋟", kB = "↶", CB = "⤽", bB = "⩈", TB = "⩆", xB = "≍", SB = "∪", EB = "⋓", MB = "⩊", OB = "⊍", NB = "⩅", LB = "∪︀", DB = "↷", AB = "⤼", IB = "⋞", RB = "⋟", PB = "⋎", BB = "⋏", _B = "¤", HB = "↶", FB = "↷", zB = "⋎", VB = "⋏", qB = "∲", $B = "∱", UB = "⌭", jB = "†", WB = "‡", GB = "ℸ", KB = "↓", QB = "↡", JB = "⇓", XB = "‐", YB = "⫤", ZB = "⊣", e2 = "⤏", t2 = "˝", r2 = "Ď", n2 = "ď", i2 = "Д", o2 = "д", a2 = "‡", s2 = "⇊", l2 = "ⅅ", u2 = "ⅆ", c2 = "⤑", f2 = "⩷", d2 = "°", p2 = "∇", h2 = "Δ", v2 = "δ", m2 = "⦱", g2 = "⥿", y2 = "𝔇", w2 = "𝔡", k2 = "⥥", C2 = "⇃", b2 = "⇂", T2 = "´", x2 = "˙", S2 = "˝", E2 = "`", M2 = "˜", O2 = "⋄", N2 = "⋄", L2 = "⋄", D2 = "♦", A2 = "♦", I2 = "¨", R2 = "ⅆ", P2 = "ϝ", B2 = "⋲", _2 = "÷", H2 = "÷", F2 = "⋇", z2 = "⋇", V2 = "Ђ", q2 = "ђ", $2 = "⌞", U2 = "⌍", j2 = "$", W2 = "𝔻", G2 = "𝕕", K2 = "¨", Q2 = "˙", J2 = "⃜", X2 = "≐", Y2 = "≑", Z2 = "≐", e_ = "∸", t_ = "∔", r_ = "⊡", n_ = "⌆", i_ = "∯", o_ = "¨", a_ = "⇓", s_ = "⇐", l_ = "⇔", u_ = "⫤", c_ = "⟸", f_ = "⟺", d_ = "⟹", p_ = "⇒", h_ = "⊨", v_ = "⇑", m_ = "⇕", g_ = "∥", y_ = "⤓", w_ = "↓", k_ = "↓", C_ = "⇓", b_ = "⇵", T_ = "̑", x_ = "⇊", S_ = "⇃", E_ = "⇂", M_ = "⥐", O_ = "⥞", N_ = "⥖", L_ = "↽", D_ = "⥟", A_ = "⥗", I_ = "⇁", R_ = "↧", P_ = "⊤", B_ = "⤐", __ = "⌟", H_ = "⌌", F_ = "𝒟", z_ = "𝒹", V_ = "Ѕ", q_ = "ѕ", $_ = "⧶", U_ = "Đ", j_ = "đ", W_ = "⋱", G_ = "▿", K_ = "▾", Q_ = "⇵", J_ = "⥯", X_ = "⦦", Y_ = "Џ", Z_ = "џ", eH = "⟿", tH = "É", rH = "é", nH = "⩮", iH = "Ě", oH = "ě", aH = "Ê", sH = "ê", lH = "≖", uH = "≕", cH = "Э", fH = "э", dH = "⩷", pH = "Ė", hH = "ė", vH = "≑", mH = "ⅇ", gH = "≒", yH = "𝔈", wH = "𝔢", kH = "⪚", CH = "È", bH = "è", TH = "⪖", xH = "⪘", SH = "⪙", EH = "∈", MH = "⏧", OH = "ℓ", NH = "⪕", LH = "⪗", DH = "Ē", AH = "ē", IH = "∅", RH = "∅", PH = "◻", BH = "∅", _H = "▫", HH = " ", FH = " ", zH = " ", VH = "Ŋ", qH = "ŋ", $H = " ", UH = "Ę", jH = "ę", WH = "𝔼", GH = "𝕖", KH = "⋕", QH = "⧣", JH = "⩱", XH = "ε", YH = "Ε", ZH = "ε", eF = "ϵ", tF = "≖", rF = "≕", nF = "≂", iF = "⪖", oF = "⪕", aF = "⩵", sF = "=", lF = "≂", uF = "≟", cF = "⇌", fF = "≡", dF = "⩸", pF = "⧥", hF = "⥱", vF = "≓", mF = "ℯ", gF = "ℰ", yF = "≐", wF = "⩳", kF = "≂", CF = "Η", bF = "η", TF = "Ð", xF = "ð", SF = "Ë", EF = "ë", MF = "€", OF = "!", NF = "∃", LF = "∃", DF = "ℰ", AF = "ⅇ", IF = "ⅇ", RF = "≒", PF = "Ф", BF = "ф", _F = "♀", HF = "ﬃ", FF = "ﬀ", zF = "ﬄ", VF = "𝔉", qF = "𝔣", $F = "ﬁ", UF = "◼", jF = "▪", WF = "fj", GF = "♭", KF = "ﬂ", QF = "▱", JF = "ƒ", XF = "𝔽", YF = "𝕗", ZF = "∀", ez = "∀", tz = "⋔", rz = "⫙", nz = "ℱ", iz = "⨍", oz = "½", az = "⅓", sz = "¼", lz = "⅕", uz = "⅙", cz = "⅛", fz = "⅔", dz = "⅖", pz = "¾", hz = "⅗", vz = "⅜", mz = "⅘", gz = "⅚", yz = "⅝", wz = "⅞", kz = "⁄", Cz = "⌢", bz = "𝒻", Tz = "ℱ", xz = "ǵ", Sz = "Γ", Ez = "γ", Mz = "Ϝ", Oz = "ϝ", Nz = "⪆", Lz = "Ğ", Dz = "ğ", Az = "Ģ", Iz = "Ĝ", Rz = "ĝ", Pz = "Г", Bz = "г", _z = "Ġ", Hz = "ġ", Fz = "≥", zz = "≧", Vz = "⪌", qz = "⋛", $z = "≥", Uz = "≧", jz = "⩾", Wz = "⪩", Gz = "⩾", Kz = "⪀", Qz = "⪂", Jz = "⪄", Xz = "⋛︀", Yz = "⪔", Zz = "𝔊", e3 = "𝔤", t3 = "≫", r3 = "⋙", n3 = "⋙", i3 = "ℷ", o3 = "Ѓ", a3 = "ѓ", s3 = "⪥", l3 = "≷", u3 = "⪒", c3 = "⪤", f3 = "⪊", d3 = "⪊", p3 = "⪈", h3 = "≩", v3 = "⪈", m3 = "≩", g3 = "⋧", y3 = "𝔾", w3 = "𝕘", k3 = "`", C3 = "≥", b3 = "⋛", T3 = "≧", x3 = "⪢", S3 = "≷", E3 = "⩾", M3 = "≳", O3 = "𝒢", N3 = "ℊ", L3 = "≳", D3 = "⪎", A3 = "⪐", I3 = "⪧", R3 = "⩺", P3 = ">", B3 = ">", _3 = "≫", H3 = "⋗", F3 = "⦕", z3 = "⩼", V3 = "⪆", q3 = "⥸", $3 = "⋗", U3 = "⋛", j3 = "⪌", W3 = "≷", G3 = "≳", K3 = "≩︀", Q3 = "≩︀", J3 = "ˇ", X3 = " ", Y3 = "½", Z3 = "ℋ", eV = "Ъ", tV = "ъ", rV = "⥈", nV = "↔", iV = "⇔", oV = "↭", aV = "^", sV = "ℏ", lV = "Ĥ", uV = "ĥ", cV = "♥", fV = "♥", dV = "…", pV = "⊹", hV = "𝔥", vV = "ℌ", mV = "ℋ", gV = "⤥", yV = "⤦", wV = "⇿", kV = "∻", CV = "↩", bV = "↪", TV = "𝕙", xV = "ℍ", SV = "―", EV = "─", MV = "𝒽", OV = "ℋ", NV = "ℏ", LV = "Ħ", DV = "ħ", AV = "≎", IV = "≏", RV = "⁃", PV = "‐", BV = "Í", _V = "í", HV = "⁣", FV = "Î", zV = "î", VV = "И", qV = "и", $V = "İ", UV = "Е", jV = "е", WV = "¡", GV = "⇔", KV = "𝔦", QV = "ℑ", JV = "Ì", XV = "ì", YV = "ⅈ", ZV = "⨌", eq = "∭", tq = "⧜", rq = "℩", nq = "Ĳ", iq = "ĳ", oq = "Ī", aq = "ī", sq = "ℑ", lq = "ⅈ", uq = "ℐ", cq = "ℑ", fq = "ı", dq = "ℑ", pq = "⊷", hq = "Ƶ", vq = "⇒", mq = "℅", gq = "∞", yq = "⧝", wq = "ı", kq = "⊺", Cq = "∫", bq = "∬", Tq = "ℤ", xq = "∫", Sq = "⊺", Eq = "⋂", Mq = "⨗", Oq = "⨼", Nq = "⁣", Lq = "⁢", Dq = "Ё", Aq = "ё", Iq = "Į", Rq = "į", Pq = "𝕀", Bq = "𝕚", _q = "Ι", Hq = "ι", Fq = "⨼", zq = "¿", Vq = "𝒾", qq = "ℐ", $q = "∈", Uq = "⋵", jq = "⋹", Wq = "⋴", Gq = "⋳", Kq = "∈", Qq = "⁢", Jq = "Ĩ", Xq = "ĩ", Yq = "І", Zq = "і", e$ = "Ï", t$ = "ï", r$ = "Ĵ", n$ = "ĵ", i$ = "Й", o$ = "й", a$ = "𝔍", s$ = "𝔧", l$ = "ȷ", u$ = "𝕁", c$ = "𝕛", f$ = "𝒥", d$ = "𝒿", p$ = "Ј", h$ = "ј", v$ = "Є", m$ = "є", g$ = "Κ", y$ = "κ", w$ = "ϰ", k$ = "Ķ", C$ = "ķ", b$ = "К", T$ = "к", x$ = "𝔎", S$ = "𝔨", E$ = "ĸ", M$ = "Х", O$ = "х", N$ = "Ќ", L$ = "ќ", D$ = "𝕂", A$ = "𝕜", I$ = "𝒦", R$ = "𝓀", P$ = "⇚", B$ = "Ĺ", _$ = "ĺ", H$ = "⦴", F$ = "ℒ", z$ = "Λ", V$ = "λ", q$ = "⟨", $$ = "⟪", U$ = "⦑", j$ = "⟨", W$ = "⪅", G$ = "ℒ", K$ = "«", Q$ = "⇤", J$ = "⤟", X$ = "←", Y$ = "↞", Z$ = "⇐", eU = "⤝", tU = "↩", rU = "↫", nU = "⤹", iU = "⥳", oU = "↢", aU = "⤙", sU = "⤛", lU = "⪫", uU = "⪭", cU = "⪭︀", fU = "⤌", dU = "⤎", pU = "❲", hU = "{", vU = "[", mU = "⦋", gU = "⦏", yU = "⦍", wU = "Ľ", kU = "ľ", CU = "Ļ", bU = "ļ", TU = "⌈", xU = "{", SU = "Л", EU = "л", MU = "⤶", OU = "“", NU = "„", LU = "⥧", DU = "⥋", AU = "↲", IU = "≤", RU = "≦", PU = "⟨", BU = "⇤", _U = "←", HU = "←", FU = "⇐", zU = "⇆", VU = "↢", qU = "⌈", $U = "⟦", UU = "⥡", jU = "⥙", WU = "⇃", GU = "⌊", KU = "↽", QU = "↼", JU = "⇇", XU = "↔", YU = "↔", ZU = "⇔", e4 = "⇆", t4 = "⇋", r4 = "↭", n4 = "⥎", i4 = "↤", o4 = "⊣", a4 = "⥚", s4 = "⋋", l4 = "⧏", u4 = "⊲", c4 = "⊴", f4 = "⥑", d4 = "⥠", p4 = "⥘", h4 = "↿", v4 = "⥒", m4 = "↼", g4 = "⪋", y4 = "⋚", w4 = "≤", k4 = "≦", C4 = "⩽", b4 = "⪨", T4 = "⩽", x4 = "⩿", S4 = "⪁", E4 = "⪃", M4 = "⋚︀", O4 = "⪓", N4 = "⪅", L4 = "⋖", D4 = "⋚", A4 = "⪋", I4 = "⋚", R4 = "≦", P4 = "≶", B4 = "≶", _4 = "⪡", H4 = "≲", F4 = "⩽", z4 = "≲", V4 = "⥼", q4 = "⌊", $4 = "𝔏", U4 = "𝔩", j4 = "≶", W4 = "⪑", G4 = "⥢", K4 = "↽", Q4 = "↼", J4 = "⥪", X4 = "▄", Y4 = "Љ", Z4 = "љ", ej = "⇇", tj = "≪", rj = "⋘", nj = "⌞", ij = "⇚", oj = "⥫", aj = "◺", sj = "Ŀ", lj = "ŀ", uj = "⎰", cj = "⎰", fj = "⪉", dj = "⪉", pj = "⪇", hj = "≨", vj = "⪇", mj = "≨", gj = "⋦", yj = "⟬", wj = "⇽", kj = "⟦", Cj = "⟵", bj = "⟵", Tj = "⟸", xj = "⟷", Sj = "⟷", Ej = "⟺", Mj = "⟼", Oj = "⟶", Nj = "⟶", Lj = "⟹", Dj = "↫", Aj = "↬", Ij = "⦅", Rj = "𝕃", Pj = "𝕝", Bj = "⨭", _j = "⨴", Hj = "∗", Fj = "_", zj = "↙", Vj = "↘", qj = "◊", $j = "◊", Uj = "⧫", jj = "(", Wj = "⦓", Gj = "⇆", Kj = "⌟", Qj = "⇋", Jj = "⥭", Xj = "‎", Yj = "⊿", Zj = "‹", eW = "𝓁", tW = "ℒ", rW = "↰", nW = "↰", iW = "≲", oW = "⪍", aW = "⪏", sW = "[", lW = "‘", uW = "‚", cW = "Ł", fW = "ł", dW = "⪦", pW = "⩹", hW = "<", vW = "<", mW = "≪", gW = "⋖", yW = "⋋", wW = "⋉", kW = "⥶", CW = "⩻", bW = "◃", TW = "⊴", xW = "◂", SW = "⦖", EW = "⥊", MW = "⥦", OW = "≨︀", NW = "≨︀", LW = "¯", DW = "♂", AW = "✠", IW = "✠", RW = "↦", PW = "↦", BW = "↧", _W = "↤", HW = "↥", FW = "▮", zW = "⨩", VW = "М", qW = "м", $W = "—", UW = "∺", jW = "∡", WW = " ", GW = "ℳ", KW = "𝔐", QW = "𝔪", JW = "℧", XW = "µ", YW = "*", ZW = "⫰", e5 = "∣", t5 = "·", r5 = "⊟", n5 = "−", i5 = "∸", o5 = "⨪", a5 = "∓", s5 = "⫛", l5 = "…", u5 = "∓", c5 = "⊧", f5 = "𝕄", d5 = "𝕞", p5 = "∓", h5 = "𝓂", v5 = "ℳ", m5 = "∾", g5 = "Μ", y5 = "μ", w5 = "⊸", k5 = "⊸", C5 = "∇", b5 = "Ń", T5 = "ń", x5 = "∠⃒", S5 = "≉", E5 = "⩰̸", M5 = "≋̸", O5 = "ŉ", N5 = "≉", L5 = "♮", D5 = "ℕ", A5 = "♮", I5 = " ", R5 = "≎̸", P5 = "≏̸", B5 = "⩃", _5 = "Ň", H5 = "ň", F5 = "Ņ", z5 = "ņ", V5 = "≇", q5 = "⩭̸", $5 = "⩂", U5 = "Н", j5 = "н", W5 = "–", G5 = "⤤", K5 = "↗", Q5 = "⇗", J5 = "↗", X5 = "≠", Y5 = "≐̸", Z5 = "​", e8 = "​", t8 = "​", r8 = "​", n8 = "≢", i8 = "⤨", o8 = "≂̸", a8 = "≫", s8 = "≪", l8 = `
`, u8 = "∄", c8 = "∄", f8 = "𝔑", d8 = "𝔫", p8 = "≧̸", h8 = "≱", v8 = "≱", m8 = "≧̸", g8 = "⩾̸", y8 = "⩾̸", w8 = "⋙̸", k8 = "≵", C8 = "≫⃒", b8 = "≯", T8 = "≯", x8 = "≫̸", S8 = "↮", E8 = "⇎", M8 = "⫲", O8 = "∋", N8 = "⋼", L8 = "⋺", D8 = "∋", A8 = "Њ", I8 = "њ", R8 = "↚", P8 = "⇍", B8 = "‥", _8 = "≦̸", H8 = "≰", F8 = "↚", z8 = "⇍", V8 = "↮", q8 = "⇎", $8 = "≰", U8 = "≦̸", j8 = "⩽̸", W8 = "⩽̸", G8 = "≮", K8 = "⋘̸", Q8 = "≴", J8 = "≪⃒", X8 = "≮", Y8 = "⋪", Z8 = "⋬", e6 = "≪̸", t6 = "∤", r6 = "⁠", n6 = " ", i6 = "𝕟", o6 = "ℕ", a6 = "⫬", s6 = "¬", l6 = "≢", u6 = "≭", c6 = "∦", f6 = "∉", d6 = "≠", p6 = "≂̸", h6 = "∄", v6 = "≯", m6 = "≱", g6 = "≧̸", y6 = "≫̸", w6 = "≹", k6 = "⩾̸", C6 = "≵", b6 = "≎̸", T6 = "≏̸", x6 = "∉", S6 = "⋵̸", E6 = "⋹̸", M6 = "∉", O6 = "⋷", N6 = "⋶", L6 = "⧏̸", D6 = "⋪", A6 = "⋬", I6 = "≮", R6 = "≰", P6 = "≸", B6 = "≪̸", _6 = "⩽̸", H6 = "≴", F6 = "⪢̸", z6 = "⪡̸", V6 = "∌", q6 = "∌", $6 = "⋾", U6 = "⋽", j6 = "⊀", W6 = "⪯̸", G6 = "⋠", K6 = "∌", Q6 = "⧐̸", J6 = "⋫", X6 = "⋭", Y6 = "⊏̸", Z6 = "⋢", e9 = "⊐̸", t9 = "⋣", r9 = "⊂⃒", n9 = "⊈", i9 = "⊁", o9 = "⪰̸", a9 = "⋡", s9 = "≿̸", l9 = "⊃⃒", u9 = "⊉", c9 = "≁", f9 = "≄", d9 = "≇", p9 = "≉", h9 = "∤", v9 = "∦", m9 = "∦", g9 = "⫽⃥", y9 = "∂̸", w9 = "⨔", k9 = "⊀", C9 = "⋠", b9 = "⊀", T9 = "⪯̸", x9 = "⪯̸", S9 = "⤳̸", E9 = "↛", M9 = "⇏", O9 = "↝̸", N9 = "↛", L9 = "⇏", D9 = "⋫", A9 = "⋭", I9 = "⊁", R9 = "⋡", P9 = "⪰̸", B9 = "𝒩", _9 = "𝓃", H9 = "∤", F9 = "∦", z9 = "≁", V9 = "≄", q9 = "≄", $9 = "∤", U9 = "∦", j9 = "⋢", W9 = "⋣", G9 = "⊄", K9 = "⫅̸", Q9 = "⊈", J9 = "⊂⃒", X9 = "⊈", Y9 = "⫅̸", Z9 = "⊁", e7 = "⪰̸", t7 = "⊅", r7 = "⫆̸", n7 = "⊉", i7 = "⊃⃒", o7 = "⊉", a7 = "⫆̸", s7 = "≹", l7 = "Ñ", u7 = "ñ", c7 = "≸", f7 = "⋪", d7 = "⋬", p7 = "⋫", h7 = "⋭", v7 = "Ν", m7 = "ν", g7 = "#", y7 = "№", w7 = " ", k7 = "≍⃒", C7 = "⊬", b7 = "⊭", T7 = "⊮", x7 = "⊯", S7 = "≥⃒", E7 = ">⃒", M7 = "⤄", O7 = "⧞", N7 = "⤂", L7 = "≤⃒", D7 = "<⃒", A7 = "⊴⃒", I7 = "⤃", R7 = "⊵⃒", P7 = "∼⃒", B7 = "⤣", _7 = "↖", H7 = "⇖", F7 = "↖", z7 = "⤧", V7 = "Ó", q7 = "ó", $7 = "⊛", U7 = "Ô", j7 = "ô", W7 = "⊚", G7 = "О", K7 = "о", Q7 = "⊝", J7 = "Ő", X7 = "ő", Y7 = "⨸", Z7 = "⊙", eG = "⦼", tG = "Œ", rG = "œ", nG = "⦿", iG = "𝔒", oG = "𝔬", aG = "˛", sG = "Ò", lG = "ò", uG = "⧁", cG = "⦵", fG = "Ω", dG = "∮", pG = "↺", hG = "⦾", vG = "⦻", mG = "‾", gG = "⧀", yG = "Ō", wG = "ō", kG = "Ω", CG = "ω", bG = "Ο", TG = "ο", xG = "⦶", SG = "⊖", EG = "𝕆", MG = "𝕠", OG = "⦷", NG = "“", LG = "‘", DG = "⦹", AG = "⊕", IG = "↻", RG = "⩔", PG = "∨", BG = "⩝", _G = "ℴ", HG = "ℴ", FG = "ª", zG = "º", VG = "⊶", qG = "⩖", $G = "⩗", UG = "⩛", jG = "Ⓢ", WG = "𝒪", GG = "ℴ", KG = "Ø", QG = "ø", JG = "⊘", XG = "Õ", YG = "õ", ZG = "⨶", eK = "⨷", tK = "⊗", rK = "Ö", nK = "ö", iK = "⌽", oK = "‾", aK = "⏞", sK = "⎴", lK = "⏜", uK = "¶", cK = "∥", fK = "∥", dK = "⫳", pK = "⫽", hK = "∂", vK = "∂", mK = "П", gK = "п", yK = "%", wK = ".", kK = "‰", CK = "⊥", bK = "‱", TK = "𝔓", xK = "𝔭", SK = "Φ", EK = "φ", MK = "ϕ", OK = "ℳ", NK = "☎", LK = "Π", DK = "π", AK = "⋔", IK = "ϖ", RK = "ℏ", PK = "ℎ", BK = "ℏ", _K = "⨣", HK = "⊞", FK = "⨢", zK = "+", VK = "∔", qK = "⨥", $K = "⩲", UK = "±", jK = "±", WK = "⨦", GK = "⨧", KK = "±", QK = "ℌ", JK = "⨕", XK = "𝕡", YK = "ℙ", ZK = "£", eQ = "⪷", tQ = "⪻", rQ = "≺", nQ = "≼", iQ = "⪷", oQ = "≺", aQ = "≼", sQ = "≺", lQ = "⪯", uQ = "≼", cQ = "≾", fQ = "⪯", dQ = "⪹", pQ = "⪵", hQ = "⋨", vQ = "⪯", mQ = "⪳", gQ = "≾", yQ = "′", wQ = "″", kQ = "ℙ", CQ = "⪹", bQ = "⪵", TQ = "⋨", xQ = "∏", SQ = "∏", EQ = "⌮", MQ = "⌒", OQ = "⌓", NQ = "∝", LQ = "∝", DQ = "∷", AQ = "∝", IQ = "≾", RQ = "⊰", PQ = "𝒫", BQ = "𝓅", _Q = "Ψ", HQ = "ψ", FQ = " ", zQ = "𝔔", VQ = "𝔮", qQ = "⨌", $Q = "𝕢", UQ = "ℚ", jQ = "⁗", WQ = "𝒬", GQ = "𝓆", KQ = "ℍ", QQ = "⨖", JQ = "?", XQ = "≟", YQ = '"', ZQ = '"', eJ = "⇛", tJ = "∽̱", rJ = "Ŕ", nJ = "ŕ", iJ = "√", oJ = "⦳", aJ = "⟩", sJ = "⟫", lJ = "⦒", uJ = "⦥", cJ = "⟩", fJ = "»", dJ = "⥵", pJ = "⇥", hJ = "⤠", vJ = "⤳", mJ = "→", gJ = "↠", yJ = "⇒", wJ = "⤞", kJ = "↪", CJ = "↬", bJ = "⥅", TJ = "⥴", xJ = "⤖", SJ = "↣", EJ = "↝", MJ = "⤚", OJ = "⤜", NJ = "∶", LJ = "ℚ", DJ = "⤍", AJ = "⤏", IJ = "⤐", RJ = "❳", PJ = "}", BJ = "]", _J = "⦌", HJ = "⦎", FJ = "⦐", zJ = "Ř", VJ = "ř", qJ = "Ŗ", $J = "ŗ", UJ = "⌉", jJ = "}", WJ = "Р", GJ = "р", KJ = "⤷", QJ = "⥩", JJ = "”", XJ = "”", YJ = "↳", ZJ = "ℜ", eX = "ℛ", tX = "ℜ", rX = "ℝ", nX = "ℜ", iX = "▭", oX = "®", aX = "®", sX = "∋", lX = "⇋", uX = "⥯", cX = "⥽", fX = "⌋", dX = "𝔯", pX = "ℜ", hX = "⥤", vX = "⇁", mX = "⇀", gX = "⥬", yX = "Ρ", wX = "ρ", kX = "ϱ", CX = "⟩", bX = "⇥", TX = "→", xX = "→", SX = "⇒", EX = "⇄", MX = "↣", OX = "⌉", NX = "⟧", LX = "⥝", DX = "⥕", AX = "⇂", IX = "⌋", RX = "⇁", PX = "⇀", BX = "⇄", _X = "⇌", HX = "⇉", FX = "↝", zX = "↦", VX = "⊢", qX = "⥛", $X = "⋌", UX = "⧐", jX = "⊳", WX = "⊵", GX = "⥏", KX = "⥜", QX = "⥔", JX = "↾", XX = "⥓", YX = "⇀", ZX = "˚", eY = "≓", tY = "⇄", rY = "⇌", nY = "‏", iY = "⎱", oY = "⎱", aY = "⫮", sY = "⟭", lY = "⇾", uY = "⟧", cY = "⦆", fY = "𝕣", dY = "ℝ", pY = "⨮", hY = "⨵", vY = "⥰", mY = ")", gY = "⦔", yY = "⨒", wY = "⇉", kY = "⇛", CY = "›", bY = "𝓇", TY = "ℛ", xY = "↱", SY = "↱", EY = "]", MY = "’", OY = "’", NY = "⋌", LY = "⋊", DY = "▹", AY = "⊵", IY = "▸", RY = "⧎", PY = "⧴", BY = "⥨", _Y = "℞", HY = "Ś", FY = "ś", zY = "‚", VY = "⪸", qY = "Š", $Y = "š", UY = "⪼", jY = "≻", WY = "≽", GY = "⪰", KY = "⪴", QY = "Ş", JY = "ş", XY = "Ŝ", YY = "ŝ", ZY = "⪺", eZ = "⪶", tZ = "⋩", rZ = "⨓", nZ = "≿", iZ = "С", oZ = "с", aZ = "⊡", sZ = "⋅", lZ = "⩦", uZ = "⤥", cZ = "↘", fZ = "⇘", dZ = "↘", pZ = "§", hZ = ";", vZ = "⤩", mZ = "∖", gZ = "∖", yZ = "✶", wZ = "𝔖", kZ = "𝔰", CZ = "⌢", bZ = "♯", TZ = "Щ", xZ = "щ", SZ = "Ш", EZ = "ш", MZ = "↓", OZ = "←", NZ = "∣", LZ = "∥", DZ = "→", AZ = "↑", IZ = "­", RZ = "Σ", PZ = "σ", BZ = "ς", _Z = "ς", HZ = "∼", FZ = "⩪", zZ = "≃", VZ = "≃", qZ = "⪞", $Z = "⪠", UZ = "⪝", jZ = "⪟", WZ = "≆", GZ = "⨤", KZ = "⥲", QZ = "←", JZ = "∘", XZ = "∖", YZ = "⨳", ZZ = "⧤", eee = "∣", tee = "⌣", ree = "⪪", nee = "⪬", iee = "⪬︀", oee = "Ь", aee = "ь", see = "⌿", lee = "⧄", uee = "/", cee = "𝕊", fee = "𝕤", dee = "♠", pee = "♠", hee = "∥", vee = "⊓", mee = "⊓︀", gee = "⊔", yee = "⊔︀", wee = "√", kee = "⊏", Cee = "⊑", bee = "⊏", Tee = "⊑", xee = "⊐", See = "⊒", Eee = "⊐", Mee = "⊒", Oee = "□", Nee = "□", Lee = "⊓", Dee = "⊏", Aee = "⊑", Iee = "⊐", Ree = "⊒", Pee = "⊔", Bee = "▪", _ee = "□", Hee = "▪", Fee = "→", zee = "𝒮", Vee = "𝓈", qee = "∖", $ee = "⌣", Uee = "⋆", jee = "⋆", Wee = "☆", Gee = "★", Kee = "ϵ", Qee = "ϕ", Jee = "¯", Xee = "⊂", Yee = "⋐", Zee = "⪽", ete = "⫅", tte = "⊆", rte = "⫃", nte = "⫁", ite = "⫋", ote = "⊊", ate = "⪿", ste = "⥹", lte = "⊂", ute = "⋐", cte = "⊆", fte = "⫅", dte = "⊆", pte = "⊊", hte = "⫋", vte = "⫇", mte = "⫕", gte = "⫓", yte = "⪸", wte = "≻", kte = "≽", Cte = "≻", bte = "⪰", Tte = "≽", xte = "≿", Ste = "⪰", Ete = "⪺", Mte = "⪶", Ote = "⋩", Nte = "≿", Lte = "∋", Dte = "∑", Ate = "∑", Ite = "♪", Rte = "¹", Pte = "²", Bte = "³", _te = "⊃", Hte = "⋑", Fte = "⪾", zte = "⫘", Vte = "⫆", qte = "⊇", $te = "⫄", Ute = "⊃", jte = "⊇", Wte = "⟉", Gte = "⫗", Kte = "⥻", Qte = "⫂", Jte = "⫌", Xte = "⊋", Yte = "⫀", Zte = "⊃", ere = "⋑", tre = "⊇", rre = "⫆", nre = "⊋", ire = "⫌", ore = "⫈", are = "⫔", sre = "⫖", lre = "⤦", ure = "↙", cre = "⇙", fre = "↙", dre = "⤪", pre = "ß", hre = "	", vre = "⌖", mre = "Τ", gre = "τ", yre = "⎴", wre = "Ť", kre = "ť", Cre = "Ţ", bre = "ţ", Tre = "Т", xre = "т", Sre = "⃛", Ere = "⌕", Mre = "𝔗", Ore = "𝔱", Nre = "∴", Lre = "∴", Dre = "∴", Are = "Θ", Ire = "θ", Rre = "ϑ", Pre = "ϑ", Bre = "≈", _re = "∼", Hre = "  ", Fre = " ", zre = " ", Vre = "≈", qre = "∼", $re = "Þ", Ure = "þ", jre = "˜", Wre = "∼", Gre = "≃", Kre = "≅", Qre = "≈", Jre = "⨱", Xre = "⊠", Yre = "×", Zre = "⨰", ene = "∭", tne = "⤨", rne = "⌶", nne = "⫱", ine = "⊤", one = "𝕋", ane = "𝕥", sne = "⫚", lne = "⤩", une = "‴", cne = "™", fne = "™", dne = "▵", pne = "▿", hne = "◃", vne = "⊴", mne = "≜", gne = "▹", yne = "⊵", wne = "◬", kne = "≜", Cne = "⨺", bne = "⃛", Tne = "⨹", xne = "⧍", Sne = "⨻", Ene = "⏢", Mne = "𝒯", One = "𝓉", Nne = "Ц", Lne = "ц", Dne = "Ћ", Ane = "ћ", Ine = "Ŧ", Rne = "ŧ", Pne = "≬", Bne = "↞", _ne = "↠", Hne = "Ú", Fne = "ú", zne = "↑", Vne = "↟", qne = "⇑", $ne = "⥉", Une = "Ў", jne = "ў", Wne = "Ŭ", Gne = "ŭ", Kne = "Û", Qne = "û", Jne = "У", Xne = "у", Yne = "⇅", Zne = "Ű", eie = "ű", tie = "⥮", rie = "⥾", nie = "𝔘", iie = "𝔲", oie = "Ù", aie = "ù", sie = "⥣", lie = "↿", uie = "↾", cie = "▀", fie = "⌜", die = "⌜", pie = "⌏", hie = "◸", vie = "Ū", mie = "ū", gie = "¨", yie = "_", wie = "⏟", kie = "⎵", Cie = "⏝", bie = "⋃", Tie = "⊎", xie = "Ų", Sie = "ų", Eie = "𝕌", Mie = "𝕦", Oie = "⤒", Nie = "↑", Lie = "↑", Die = "⇑", Aie = "⇅", Iie = "↕", Rie = "↕", Pie = "⇕", Bie = "⥮", _ie = "↿", Hie = "↾", Fie = "⊎", zie = "↖", Vie = "↗", qie = "υ", $ie = "ϒ", Uie = "ϒ", jie = "Υ", Wie = "υ", Gie = "↥", Kie = "⊥", Qie = "⇈", Jie = "⌝", Xie = "⌝", Yie = "⌎", Zie = "Ů", eoe = "ů", toe = "◹", roe = "𝒰", noe = "𝓊", ioe = "⋰", ooe = "Ũ", aoe = "ũ", soe = "▵", loe = "▴", uoe = "⇈", coe = "Ü", foe = "ü", doe = "⦧", poe = "⦜", hoe = "ϵ", voe = "ϰ", moe = "∅", goe = "ϕ", yoe = "ϖ", woe = "∝", koe = "↕", Coe = "⇕", boe = "ϱ", Toe = "ς", xoe = "⊊︀", Soe = "⫋︀", Eoe = "⊋︀", Moe = "⫌︀", Ooe = "ϑ", Noe = "⊲", Loe = "⊳", Doe = "⫨", Aoe = "⫫", Ioe = "⫩", Roe = "В", Poe = "в", Boe = "⊢", _oe = "⊨", Hoe = "⊩", Foe = "⊫", zoe = "⫦", Voe = "⊻", qoe = "∨", $oe = "⋁", Uoe = "≚", joe = "⋮", Woe = "|", Goe = "‖", Koe = "|", Qoe = "‖", Joe = "∣", Xoe = "|", Yoe = "❘", Zoe = "≀", eae = " ", tae = "𝔙", rae = "𝔳", nae = "⊲", iae = "⊂⃒", oae = "⊃⃒", aae = "𝕍", sae = "𝕧", lae = "∝", uae = "⊳", cae = "𝒱", fae = "𝓋", dae = "⫋︀", pae = "⊊︀", hae = "⫌︀", vae = "⊋︀", mae = "⊪", gae = "⦚", yae = "Ŵ", wae = "ŵ", kae = "⩟", Cae = "∧", bae = "⋀", Tae = "≙", xae = "℘", Sae = "𝔚", Eae = "𝔴", Mae = "𝕎", Oae = "𝕨", Nae = "℘", Lae = "≀", Dae = "≀", Aae = "𝒲", Iae = "𝓌", Rae = "⋂", Pae = "◯", Bae = "⋃", _ae = "▽", Hae = "𝔛", Fae = "𝔵", zae = "⟷", Vae = "⟺", qae = "Ξ", $ae = "ξ", Uae = "⟵", jae = "⟸", Wae = "⟼", Gae = "⋻", Kae = "⨀", Qae = "𝕏", Jae = "𝕩", Xae = "⨁", Yae = "⨂", Zae = "⟶", ese = "⟹", tse = "𝒳", rse = "𝓍", nse = "⨆", ise = "⨄", ose = "△", ase = "⋁", sse = "⋀", lse = "Ý", use = "ý", cse = "Я", fse = "я", dse = "Ŷ", pse = "ŷ", hse = "Ы", vse = "ы", mse = "¥", gse = "𝔜", yse = "𝔶", wse = "Ї", kse = "ї", Cse = "𝕐", bse = "𝕪", Tse = "𝒴", xse = "𝓎", Sse = "Ю", Ese = "ю", Mse = "ÿ", Ose = "Ÿ", Nse = "Ź", Lse = "ź", Dse = "Ž", Ase = "ž", Ise = "З", Rse = "з", Pse = "Ż", Bse = "ż", _se = "ℨ", Hse = "​", Fse = "Ζ", zse = "ζ", Vse = "𝔷", qse = "ℨ", $se = "Ж", Use = "ж", jse = "⇝", Wse = "𝕫", Gse = "ℤ", Kse = "𝒵", Qse = "𝓏", Jse = "‍", Xse = "‌", Bk = {
  Aacute: PL,
  aacute: BL,
  Abreve: _L,
  abreve: HL,
  ac: FL,
  acd: zL,
  acE: VL,
  Acirc: qL,
  acirc: $L,
  acute: UL,
  Acy: jL,
  acy: WL,
  AElig: GL,
  aelig: KL,
  af: QL,
  Afr: JL,
  afr: XL,
  Agrave: YL,
  agrave: ZL,
  alefsym: eD,
  aleph: tD,
  Alpha: rD,
  alpha: nD,
  Amacr: iD,
  amacr: oD,
  amalg: aD,
  amp: sD,
  AMP: lD,
  andand: uD,
  And: cD,
  and: fD,
  andd: dD,
  andslope: pD,
  andv: hD,
  ang: vD,
  ange: mD,
  angle: gD,
  angmsdaa: yD,
  angmsdab: wD,
  angmsdac: kD,
  angmsdad: CD,
  angmsdae: bD,
  angmsdaf: TD,
  angmsdag: xD,
  angmsdah: SD,
  angmsd: ED,
  angrt: MD,
  angrtvb: OD,
  angrtvbd: ND,
  angsph: LD,
  angst: DD,
  angzarr: AD,
  Aogon: ID,
  aogon: RD,
  Aopf: PD,
  aopf: BD,
  apacir: _D,
  ap: HD,
  apE: FD,
  ape: zD,
  apid: VD,
  apos: qD,
  ApplyFunction: $D,
  approx: UD,
  approxeq: jD,
  Aring: WD,
  aring: GD,
  Ascr: KD,
  ascr: QD,
  Assign: JD,
  ast: XD,
  asymp: YD,
  asympeq: ZD,
  Atilde: eA,
  atilde: tA,
  Auml: rA,
  auml: nA,
  awconint: iA,
  awint: oA,
  backcong: aA,
  backepsilon: sA,
  backprime: lA,
  backsim: uA,
  backsimeq: cA,
  Backslash: fA,
  Barv: dA,
  barvee: pA,
  barwed: hA,
  Barwed: vA,
  barwedge: mA,
  bbrk: gA,
  bbrktbrk: yA,
  bcong: wA,
  Bcy: kA,
  bcy: CA,
  bdquo: bA,
  becaus: TA,
  because: xA,
  Because: SA,
  bemptyv: EA,
  bepsi: MA,
  bernou: OA,
  Bernoullis: NA,
  Beta: LA,
  beta: DA,
  beth: AA,
  between: IA,
  Bfr: RA,
  bfr: PA,
  bigcap: BA,
  bigcirc: _A,
  bigcup: HA,
  bigodot: FA,
  bigoplus: zA,
  bigotimes: VA,
  bigsqcup: qA,
  bigstar: $A,
  bigtriangledown: UA,
  bigtriangleup: jA,
  biguplus: WA,
  bigvee: GA,
  bigwedge: KA,
  bkarow: QA,
  blacklozenge: JA,
  blacksquare: XA,
  blacktriangle: YA,
  blacktriangledown: ZA,
  blacktriangleleft: eI,
  blacktriangleright: tI,
  blank: rI,
  blk12: nI,
  blk14: iI,
  blk34: oI,
  block: aI,
  bne: sI,
  bnequiv: lI,
  bNot: uI,
  bnot: cI,
  Bopf: fI,
  bopf: dI,
  bot: pI,
  bottom: hI,
  bowtie: vI,
  boxbox: mI,
  boxdl: gI,
  boxdL: yI,
  boxDl: wI,
  boxDL: kI,
  boxdr: CI,
  boxdR: bI,
  boxDr: TI,
  boxDR: xI,
  boxh: SI,
  boxH: EI,
  boxhd: MI,
  boxHd: OI,
  boxhD: NI,
  boxHD: LI,
  boxhu: DI,
  boxHu: AI,
  boxhU: II,
  boxHU: RI,
  boxminus: PI,
  boxplus: BI,
  boxtimes: _I,
  boxul: HI,
  boxuL: FI,
  boxUl: zI,
  boxUL: VI,
  boxur: qI,
  boxuR: $I,
  boxUr: UI,
  boxUR: jI,
  boxv: WI,
  boxV: GI,
  boxvh: KI,
  boxvH: QI,
  boxVh: JI,
  boxVH: XI,
  boxvl: YI,
  boxvL: ZI,
  boxVl: eR,
  boxVL: tR,
  boxvr: rR,
  boxvR: nR,
  boxVr: iR,
  boxVR: oR,
  bprime: aR,
  breve: sR,
  Breve: lR,
  brvbar: uR,
  bscr: cR,
  Bscr: fR,
  bsemi: dR,
  bsim: pR,
  bsime: hR,
  bsolb: vR,
  bsol: mR,
  bsolhsub: gR,
  bull: yR,
  bullet: wR,
  bump: kR,
  bumpE: CR,
  bumpe: bR,
  Bumpeq: TR,
  bumpeq: xR,
  Cacute: SR,
  cacute: ER,
  capand: MR,
  capbrcup: OR,
  capcap: NR,
  cap: LR,
  Cap: DR,
  capcup: AR,
  capdot: IR,
  CapitalDifferentialD: RR,
  caps: PR,
  caret: BR,
  caron: _R,
  Cayleys: HR,
  ccaps: FR,
  Ccaron: zR,
  ccaron: VR,
  Ccedil: qR,
  ccedil: $R,
  Ccirc: UR,
  ccirc: jR,
  Cconint: WR,
  ccups: GR,
  ccupssm: KR,
  Cdot: QR,
  cdot: JR,
  cedil: XR,
  Cedilla: YR,
  cemptyv: ZR,
  cent: eP,
  centerdot: tP,
  CenterDot: rP,
  cfr: nP,
  Cfr: iP,
  CHcy: oP,
  chcy: aP,
  check: sP,
  checkmark: lP,
  Chi: uP,
  chi: cP,
  circ: fP,
  circeq: dP,
  circlearrowleft: pP,
  circlearrowright: hP,
  circledast: vP,
  circledcirc: mP,
  circleddash: gP,
  CircleDot: yP,
  circledR: wP,
  circledS: kP,
  CircleMinus: CP,
  CirclePlus: bP,
  CircleTimes: TP,
  cir: xP,
  cirE: SP,
  cire: EP,
  cirfnint: MP,
  cirmid: OP,
  cirscir: NP,
  ClockwiseContourIntegral: LP,
  CloseCurlyDoubleQuote: DP,
  CloseCurlyQuote: AP,
  clubs: IP,
  clubsuit: RP,
  colon: PP,
  Colon: BP,
  Colone: _P,
  colone: HP,
  coloneq: FP,
  comma: zP,
  commat: VP,
  comp: qP,
  compfn: $P,
  complement: UP,
  complexes: jP,
  cong: WP,
  congdot: GP,
  Congruent: KP,
  conint: QP,
  Conint: JP,
  ContourIntegral: XP,
  copf: YP,
  Copf: ZP,
  coprod: eB,
  Coproduct: tB,
  copy: rB,
  COPY: nB,
  copysr: iB,
  CounterClockwiseContourIntegral: oB,
  crarr: aB,
  cross: sB,
  Cross: lB,
  Cscr: uB,
  cscr: cB,
  csub: fB,
  csube: dB,
  csup: pB,
  csupe: hB,
  ctdot: vB,
  cudarrl: mB,
  cudarrr: gB,
  cuepr: yB,
  cuesc: wB,
  cularr: kB,
  cularrp: CB,
  cupbrcap: bB,
  cupcap: TB,
  CupCap: xB,
  cup: SB,
  Cup: EB,
  cupcup: MB,
  cupdot: OB,
  cupor: NB,
  cups: LB,
  curarr: DB,
  curarrm: AB,
  curlyeqprec: IB,
  curlyeqsucc: RB,
  curlyvee: PB,
  curlywedge: BB,
  curren: _B,
  curvearrowleft: HB,
  curvearrowright: FB,
  cuvee: zB,
  cuwed: VB,
  cwconint: qB,
  cwint: $B,
  cylcty: UB,
  dagger: jB,
  Dagger: WB,
  daleth: GB,
  darr: KB,
  Darr: QB,
  dArr: JB,
  dash: XB,
  Dashv: YB,
  dashv: ZB,
  dbkarow: e2,
  dblac: t2,
  Dcaron: r2,
  dcaron: n2,
  Dcy: i2,
  dcy: o2,
  ddagger: a2,
  ddarr: s2,
  DD: l2,
  dd: u2,
  DDotrahd: c2,
  ddotseq: f2,
  deg: d2,
  Del: p2,
  Delta: h2,
  delta: v2,
  demptyv: m2,
  dfisht: g2,
  Dfr: y2,
  dfr: w2,
  dHar: k2,
  dharl: C2,
  dharr: b2,
  DiacriticalAcute: T2,
  DiacriticalDot: x2,
  DiacriticalDoubleAcute: S2,
  DiacriticalGrave: E2,
  DiacriticalTilde: M2,
  diam: O2,
  diamond: N2,
  Diamond: L2,
  diamondsuit: D2,
  diams: A2,
  die: I2,
  DifferentialD: R2,
  digamma: P2,
  disin: B2,
  div: _2,
  divide: H2,
  divideontimes: F2,
  divonx: z2,
  DJcy: V2,
  djcy: q2,
  dlcorn: $2,
  dlcrop: U2,
  dollar: j2,
  Dopf: W2,
  dopf: G2,
  Dot: K2,
  dot: Q2,
  DotDot: J2,
  doteq: X2,
  doteqdot: Y2,
  DotEqual: Z2,
  dotminus: e_,
  dotplus: t_,
  dotsquare: r_,
  doublebarwedge: n_,
  DoubleContourIntegral: i_,
  DoubleDot: o_,
  DoubleDownArrow: a_,
  DoubleLeftArrow: s_,
  DoubleLeftRightArrow: l_,
  DoubleLeftTee: u_,
  DoubleLongLeftArrow: c_,
  DoubleLongLeftRightArrow: f_,
  DoubleLongRightArrow: d_,
  DoubleRightArrow: p_,
  DoubleRightTee: h_,
  DoubleUpArrow: v_,
  DoubleUpDownArrow: m_,
  DoubleVerticalBar: g_,
  DownArrowBar: y_,
  downarrow: w_,
  DownArrow: k_,
  Downarrow: C_,
  DownArrowUpArrow: b_,
  DownBreve: T_,
  downdownarrows: x_,
  downharpoonleft: S_,
  downharpoonright: E_,
  DownLeftRightVector: M_,
  DownLeftTeeVector: O_,
  DownLeftVectorBar: N_,
  DownLeftVector: L_,
  DownRightTeeVector: D_,
  DownRightVectorBar: A_,
  DownRightVector: I_,
  DownTeeArrow: R_,
  DownTee: P_,
  drbkarow: B_,
  drcorn: __,
  drcrop: H_,
  Dscr: F_,
  dscr: z_,
  DScy: V_,
  dscy: q_,
  dsol: $_,
  Dstrok: U_,
  dstrok: j_,
  dtdot: W_,
  dtri: G_,
  dtrif: K_,
  duarr: Q_,
  duhar: J_,
  dwangle: X_,
  DZcy: Y_,
  dzcy: Z_,
  dzigrarr: eH,
  Eacute: tH,
  eacute: rH,
  easter: nH,
  Ecaron: iH,
  ecaron: oH,
  Ecirc: aH,
  ecirc: sH,
  ecir: lH,
  ecolon: uH,
  Ecy: cH,
  ecy: fH,
  eDDot: dH,
  Edot: pH,
  edot: hH,
  eDot: vH,
  ee: mH,
  efDot: gH,
  Efr: yH,
  efr: wH,
  eg: kH,
  Egrave: CH,
  egrave: bH,
  egs: TH,
  egsdot: xH,
  el: SH,
  Element: EH,
  elinters: MH,
  ell: OH,
  els: NH,
  elsdot: LH,
  Emacr: DH,
  emacr: AH,
  empty: IH,
  emptyset: RH,
  EmptySmallSquare: PH,
  emptyv: BH,
  EmptyVerySmallSquare: _H,
  emsp13: HH,
  emsp14: FH,
  emsp: zH,
  ENG: VH,
  eng: qH,
  ensp: $H,
  Eogon: UH,
  eogon: jH,
  Eopf: WH,
  eopf: GH,
  epar: KH,
  eparsl: QH,
  eplus: JH,
  epsi: XH,
  Epsilon: YH,
  epsilon: ZH,
  epsiv: eF,
  eqcirc: tF,
  eqcolon: rF,
  eqsim: nF,
  eqslantgtr: iF,
  eqslantless: oF,
  Equal: aF,
  equals: sF,
  EqualTilde: lF,
  equest: uF,
  Equilibrium: cF,
  equiv: fF,
  equivDD: dF,
  eqvparsl: pF,
  erarr: hF,
  erDot: vF,
  escr: mF,
  Escr: gF,
  esdot: yF,
  Esim: wF,
  esim: kF,
  Eta: CF,
  eta: bF,
  ETH: TF,
  eth: xF,
  Euml: SF,
  euml: EF,
  euro: MF,
  excl: OF,
  exist: NF,
  Exists: LF,
  expectation: DF,
  exponentiale: AF,
  ExponentialE: IF,
  fallingdotseq: RF,
  Fcy: PF,
  fcy: BF,
  female: _F,
  ffilig: HF,
  fflig: FF,
  ffllig: zF,
  Ffr: VF,
  ffr: qF,
  filig: $F,
  FilledSmallSquare: UF,
  FilledVerySmallSquare: jF,
  fjlig: WF,
  flat: GF,
  fllig: KF,
  fltns: QF,
  fnof: JF,
  Fopf: XF,
  fopf: YF,
  forall: ZF,
  ForAll: ez,
  fork: tz,
  forkv: rz,
  Fouriertrf: nz,
  fpartint: iz,
  frac12: oz,
  frac13: az,
  frac14: sz,
  frac15: lz,
  frac16: uz,
  frac18: cz,
  frac23: fz,
  frac25: dz,
  frac34: pz,
  frac35: hz,
  frac38: vz,
  frac45: mz,
  frac56: gz,
  frac58: yz,
  frac78: wz,
  frasl: kz,
  frown: Cz,
  fscr: bz,
  Fscr: Tz,
  gacute: xz,
  Gamma: Sz,
  gamma: Ez,
  Gammad: Mz,
  gammad: Oz,
  gap: Nz,
  Gbreve: Lz,
  gbreve: Dz,
  Gcedil: Az,
  Gcirc: Iz,
  gcirc: Rz,
  Gcy: Pz,
  gcy: Bz,
  Gdot: _z,
  gdot: Hz,
  ge: Fz,
  gE: zz,
  gEl: Vz,
  gel: qz,
  geq: $z,
  geqq: Uz,
  geqslant: jz,
  gescc: Wz,
  ges: Gz,
  gesdot: Kz,
  gesdoto: Qz,
  gesdotol: Jz,
  gesl: Xz,
  gesles: Yz,
  Gfr: Zz,
  gfr: e3,
  gg: t3,
  Gg: r3,
  ggg: n3,
  gimel: i3,
  GJcy: o3,
  gjcy: a3,
  gla: s3,
  gl: l3,
  glE: u3,
  glj: c3,
  gnap: f3,
  gnapprox: d3,
  gne: p3,
  gnE: h3,
  gneq: v3,
  gneqq: m3,
  gnsim: g3,
  Gopf: y3,
  gopf: w3,
  grave: k3,
  GreaterEqual: C3,
  GreaterEqualLess: b3,
  GreaterFullEqual: T3,
  GreaterGreater: x3,
  GreaterLess: S3,
  GreaterSlantEqual: E3,
  GreaterTilde: M3,
  Gscr: O3,
  gscr: N3,
  gsim: L3,
  gsime: D3,
  gsiml: A3,
  gtcc: I3,
  gtcir: R3,
  gt: P3,
  GT: B3,
  Gt: _3,
  gtdot: H3,
  gtlPar: F3,
  gtquest: z3,
  gtrapprox: V3,
  gtrarr: q3,
  gtrdot: $3,
  gtreqless: U3,
  gtreqqless: j3,
  gtrless: W3,
  gtrsim: G3,
  gvertneqq: K3,
  gvnE: Q3,
  Hacek: J3,
  hairsp: X3,
  half: Y3,
  hamilt: Z3,
  HARDcy: eV,
  hardcy: tV,
  harrcir: rV,
  harr: nV,
  hArr: iV,
  harrw: oV,
  Hat: aV,
  hbar: sV,
  Hcirc: lV,
  hcirc: uV,
  hearts: cV,
  heartsuit: fV,
  hellip: dV,
  hercon: pV,
  hfr: hV,
  Hfr: vV,
  HilbertSpace: mV,
  hksearow: gV,
  hkswarow: yV,
  hoarr: wV,
  homtht: kV,
  hookleftarrow: CV,
  hookrightarrow: bV,
  hopf: TV,
  Hopf: xV,
  horbar: SV,
  HorizontalLine: EV,
  hscr: MV,
  Hscr: OV,
  hslash: NV,
  Hstrok: LV,
  hstrok: DV,
  HumpDownHump: AV,
  HumpEqual: IV,
  hybull: RV,
  hyphen: PV,
  Iacute: BV,
  iacute: _V,
  ic: HV,
  Icirc: FV,
  icirc: zV,
  Icy: VV,
  icy: qV,
  Idot: $V,
  IEcy: UV,
  iecy: jV,
  iexcl: WV,
  iff: GV,
  ifr: KV,
  Ifr: QV,
  Igrave: JV,
  igrave: XV,
  ii: YV,
  iiiint: ZV,
  iiint: eq,
  iinfin: tq,
  iiota: rq,
  IJlig: nq,
  ijlig: iq,
  Imacr: oq,
  imacr: aq,
  image: sq,
  ImaginaryI: lq,
  imagline: uq,
  imagpart: cq,
  imath: fq,
  Im: dq,
  imof: pq,
  imped: hq,
  Implies: vq,
  incare: mq,
  in: "∈",
  infin: gq,
  infintie: yq,
  inodot: wq,
  intcal: kq,
  int: Cq,
  Int: bq,
  integers: Tq,
  Integral: xq,
  intercal: Sq,
  Intersection: Eq,
  intlarhk: Mq,
  intprod: Oq,
  InvisibleComma: Nq,
  InvisibleTimes: Lq,
  IOcy: Dq,
  iocy: Aq,
  Iogon: Iq,
  iogon: Rq,
  Iopf: Pq,
  iopf: Bq,
  Iota: _q,
  iota: Hq,
  iprod: Fq,
  iquest: zq,
  iscr: Vq,
  Iscr: qq,
  isin: $q,
  isindot: Uq,
  isinE: jq,
  isins: Wq,
  isinsv: Gq,
  isinv: Kq,
  it: Qq,
  Itilde: Jq,
  itilde: Xq,
  Iukcy: Yq,
  iukcy: Zq,
  Iuml: e$,
  iuml: t$,
  Jcirc: r$,
  jcirc: n$,
  Jcy: i$,
  jcy: o$,
  Jfr: a$,
  jfr: s$,
  jmath: l$,
  Jopf: u$,
  jopf: c$,
  Jscr: f$,
  jscr: d$,
  Jsercy: p$,
  jsercy: h$,
  Jukcy: v$,
  jukcy: m$,
  Kappa: g$,
  kappa: y$,
  kappav: w$,
  Kcedil: k$,
  kcedil: C$,
  Kcy: b$,
  kcy: T$,
  Kfr: x$,
  kfr: S$,
  kgreen: E$,
  KHcy: M$,
  khcy: O$,
  KJcy: N$,
  kjcy: L$,
  Kopf: D$,
  kopf: A$,
  Kscr: I$,
  kscr: R$,
  lAarr: P$,
  Lacute: B$,
  lacute: _$,
  laemptyv: H$,
  lagran: F$,
  Lambda: z$,
  lambda: V$,
  lang: q$,
  Lang: $$,
  langd: U$,
  langle: j$,
  lap: W$,
  Laplacetrf: G$,
  laquo: K$,
  larrb: Q$,
  larrbfs: J$,
  larr: X$,
  Larr: Y$,
  lArr: Z$,
  larrfs: eU,
  larrhk: tU,
  larrlp: rU,
  larrpl: nU,
  larrsim: iU,
  larrtl: oU,
  latail: aU,
  lAtail: sU,
  lat: lU,
  late: uU,
  lates: cU,
  lbarr: fU,
  lBarr: dU,
  lbbrk: pU,
  lbrace: hU,
  lbrack: vU,
  lbrke: mU,
  lbrksld: gU,
  lbrkslu: yU,
  Lcaron: wU,
  lcaron: kU,
  Lcedil: CU,
  lcedil: bU,
  lceil: TU,
  lcub: xU,
  Lcy: SU,
  lcy: EU,
  ldca: MU,
  ldquo: OU,
  ldquor: NU,
  ldrdhar: LU,
  ldrushar: DU,
  ldsh: AU,
  le: IU,
  lE: RU,
  LeftAngleBracket: PU,
  LeftArrowBar: BU,
  leftarrow: _U,
  LeftArrow: HU,
  Leftarrow: FU,
  LeftArrowRightArrow: zU,
  leftarrowtail: VU,
  LeftCeiling: qU,
  LeftDoubleBracket: $U,
  LeftDownTeeVector: UU,
  LeftDownVectorBar: jU,
  LeftDownVector: WU,
  LeftFloor: GU,
  leftharpoondown: KU,
  leftharpoonup: QU,
  leftleftarrows: JU,
  leftrightarrow: XU,
  LeftRightArrow: YU,
  Leftrightarrow: ZU,
  leftrightarrows: e4,
  leftrightharpoons: t4,
  leftrightsquigarrow: r4,
  LeftRightVector: n4,
  LeftTeeArrow: i4,
  LeftTee: o4,
  LeftTeeVector: a4,
  leftthreetimes: s4,
  LeftTriangleBar: l4,
  LeftTriangle: u4,
  LeftTriangleEqual: c4,
  LeftUpDownVector: f4,
  LeftUpTeeVector: d4,
  LeftUpVectorBar: p4,
  LeftUpVector: h4,
  LeftVectorBar: v4,
  LeftVector: m4,
  lEg: g4,
  leg: y4,
  leq: w4,
  leqq: k4,
  leqslant: C4,
  lescc: b4,
  les: T4,
  lesdot: x4,
  lesdoto: S4,
  lesdotor: E4,
  lesg: M4,
  lesges: O4,
  lessapprox: N4,
  lessdot: L4,
  lesseqgtr: D4,
  lesseqqgtr: A4,
  LessEqualGreater: I4,
  LessFullEqual: R4,
  LessGreater: P4,
  lessgtr: B4,
  LessLess: _4,
  lesssim: H4,
  LessSlantEqual: F4,
  LessTilde: z4,
  lfisht: V4,
  lfloor: q4,
  Lfr: $4,
  lfr: U4,
  lg: j4,
  lgE: W4,
  lHar: G4,
  lhard: K4,
  lharu: Q4,
  lharul: J4,
  lhblk: X4,
  LJcy: Y4,
  ljcy: Z4,
  llarr: ej,
  ll: tj,
  Ll: rj,
  llcorner: nj,
  Lleftarrow: ij,
  llhard: oj,
  lltri: aj,
  Lmidot: sj,
  lmidot: lj,
  lmoustache: uj,
  lmoust: cj,
  lnap: fj,
  lnapprox: dj,
  lne: pj,
  lnE: hj,
  lneq: vj,
  lneqq: mj,
  lnsim: gj,
  loang: yj,
  loarr: wj,
  lobrk: kj,
  longleftarrow: Cj,
  LongLeftArrow: bj,
  Longleftarrow: Tj,
  longleftrightarrow: xj,
  LongLeftRightArrow: Sj,
  Longleftrightarrow: Ej,
  longmapsto: Mj,
  longrightarrow: Oj,
  LongRightArrow: Nj,
  Longrightarrow: Lj,
  looparrowleft: Dj,
  looparrowright: Aj,
  lopar: Ij,
  Lopf: Rj,
  lopf: Pj,
  loplus: Bj,
  lotimes: _j,
  lowast: Hj,
  lowbar: Fj,
  LowerLeftArrow: zj,
  LowerRightArrow: Vj,
  loz: qj,
  lozenge: $j,
  lozf: Uj,
  lpar: jj,
  lparlt: Wj,
  lrarr: Gj,
  lrcorner: Kj,
  lrhar: Qj,
  lrhard: Jj,
  lrm: Xj,
  lrtri: Yj,
  lsaquo: Zj,
  lscr: eW,
  Lscr: tW,
  lsh: rW,
  Lsh: nW,
  lsim: iW,
  lsime: oW,
  lsimg: aW,
  lsqb: sW,
  lsquo: lW,
  lsquor: uW,
  Lstrok: cW,
  lstrok: fW,
  ltcc: dW,
  ltcir: pW,
  lt: hW,
  LT: vW,
  Lt: mW,
  ltdot: gW,
  lthree: yW,
  ltimes: wW,
  ltlarr: kW,
  ltquest: CW,
  ltri: bW,
  ltrie: TW,
  ltrif: xW,
  ltrPar: SW,
  lurdshar: EW,
  luruhar: MW,
  lvertneqq: OW,
  lvnE: NW,
  macr: LW,
  male: DW,
  malt: AW,
  maltese: IW,
  Map: "⤅",
  map: RW,
  mapsto: PW,
  mapstodown: BW,
  mapstoleft: _W,
  mapstoup: HW,
  marker: FW,
  mcomma: zW,
  Mcy: VW,
  mcy: qW,
  mdash: $W,
  mDDot: UW,
  measuredangle: jW,
  MediumSpace: WW,
  Mellintrf: GW,
  Mfr: KW,
  mfr: QW,
  mho: JW,
  micro: XW,
  midast: YW,
  midcir: ZW,
  mid: e5,
  middot: t5,
  minusb: r5,
  minus: n5,
  minusd: i5,
  minusdu: o5,
  MinusPlus: a5,
  mlcp: s5,
  mldr: l5,
  mnplus: u5,
  models: c5,
  Mopf: f5,
  mopf: d5,
  mp: p5,
  mscr: h5,
  Mscr: v5,
  mstpos: m5,
  Mu: g5,
  mu: y5,
  multimap: w5,
  mumap: k5,
  nabla: C5,
  Nacute: b5,
  nacute: T5,
  nang: x5,
  nap: S5,
  napE: E5,
  napid: M5,
  napos: O5,
  napprox: N5,
  natural: L5,
  naturals: D5,
  natur: A5,
  nbsp: I5,
  nbump: R5,
  nbumpe: P5,
  ncap: B5,
  Ncaron: _5,
  ncaron: H5,
  Ncedil: F5,
  ncedil: z5,
  ncong: V5,
  ncongdot: q5,
  ncup: $5,
  Ncy: U5,
  ncy: j5,
  ndash: W5,
  nearhk: G5,
  nearr: K5,
  neArr: Q5,
  nearrow: J5,
  ne: X5,
  nedot: Y5,
  NegativeMediumSpace: Z5,
  NegativeThickSpace: e8,
  NegativeThinSpace: t8,
  NegativeVeryThinSpace: r8,
  nequiv: n8,
  nesear: i8,
  nesim: o8,
  NestedGreaterGreater: a8,
  NestedLessLess: s8,
  NewLine: l8,
  nexist: u8,
  nexists: c8,
  Nfr: f8,
  nfr: d8,
  ngE: p8,
  nge: h8,
  ngeq: v8,
  ngeqq: m8,
  ngeqslant: g8,
  nges: y8,
  nGg: w8,
  ngsim: k8,
  nGt: C8,
  ngt: b8,
  ngtr: T8,
  nGtv: x8,
  nharr: S8,
  nhArr: E8,
  nhpar: M8,
  ni: O8,
  nis: N8,
  nisd: L8,
  niv: D8,
  NJcy: A8,
  njcy: I8,
  nlarr: R8,
  nlArr: P8,
  nldr: B8,
  nlE: _8,
  nle: H8,
  nleftarrow: F8,
  nLeftarrow: z8,
  nleftrightarrow: V8,
  nLeftrightarrow: q8,
  nleq: $8,
  nleqq: U8,
  nleqslant: j8,
  nles: W8,
  nless: G8,
  nLl: K8,
  nlsim: Q8,
  nLt: J8,
  nlt: X8,
  nltri: Y8,
  nltrie: Z8,
  nLtv: e6,
  nmid: t6,
  NoBreak: r6,
  NonBreakingSpace: n6,
  nopf: i6,
  Nopf: o6,
  Not: a6,
  not: s6,
  NotCongruent: l6,
  NotCupCap: u6,
  NotDoubleVerticalBar: c6,
  NotElement: f6,
  NotEqual: d6,
  NotEqualTilde: p6,
  NotExists: h6,
  NotGreater: v6,
  NotGreaterEqual: m6,
  NotGreaterFullEqual: g6,
  NotGreaterGreater: y6,
  NotGreaterLess: w6,
  NotGreaterSlantEqual: k6,
  NotGreaterTilde: C6,
  NotHumpDownHump: b6,
  NotHumpEqual: T6,
  notin: x6,
  notindot: S6,
  notinE: E6,
  notinva: M6,
  notinvb: O6,
  notinvc: N6,
  NotLeftTriangleBar: L6,
  NotLeftTriangle: D6,
  NotLeftTriangleEqual: A6,
  NotLess: I6,
  NotLessEqual: R6,
  NotLessGreater: P6,
  NotLessLess: B6,
  NotLessSlantEqual: _6,
  NotLessTilde: H6,
  NotNestedGreaterGreater: F6,
  NotNestedLessLess: z6,
  notni: V6,
  notniva: q6,
  notnivb: $6,
  notnivc: U6,
  NotPrecedes: j6,
  NotPrecedesEqual: W6,
  NotPrecedesSlantEqual: G6,
  NotReverseElement: K6,
  NotRightTriangleBar: Q6,
  NotRightTriangle: J6,
  NotRightTriangleEqual: X6,
  NotSquareSubset: Y6,
  NotSquareSubsetEqual: Z6,
  NotSquareSuperset: e9,
  NotSquareSupersetEqual: t9,
  NotSubset: r9,
  NotSubsetEqual: n9,
  NotSucceeds: i9,
  NotSucceedsEqual: o9,
  NotSucceedsSlantEqual: a9,
  NotSucceedsTilde: s9,
  NotSuperset: l9,
  NotSupersetEqual: u9,
  NotTilde: c9,
  NotTildeEqual: f9,
  NotTildeFullEqual: d9,
  NotTildeTilde: p9,
  NotVerticalBar: h9,
  nparallel: v9,
  npar: m9,
  nparsl: g9,
  npart: y9,
  npolint: w9,
  npr: k9,
  nprcue: C9,
  nprec: b9,
  npreceq: T9,
  npre: x9,
  nrarrc: S9,
  nrarr: E9,
  nrArr: M9,
  nrarrw: O9,
  nrightarrow: N9,
  nRightarrow: L9,
  nrtri: D9,
  nrtrie: A9,
  nsc: I9,
  nsccue: R9,
  nsce: P9,
  Nscr: B9,
  nscr: _9,
  nshortmid: H9,
  nshortparallel: F9,
  nsim: z9,
  nsime: V9,
  nsimeq: q9,
  nsmid: $9,
  nspar: U9,
  nsqsube: j9,
  nsqsupe: W9,
  nsub: G9,
  nsubE: K9,
  nsube: Q9,
  nsubset: J9,
  nsubseteq: X9,
  nsubseteqq: Y9,
  nsucc: Z9,
  nsucceq: e7,
  nsup: t7,
  nsupE: r7,
  nsupe: n7,
  nsupset: i7,
  nsupseteq: o7,
  nsupseteqq: a7,
  ntgl: s7,
  Ntilde: l7,
  ntilde: u7,
  ntlg: c7,
  ntriangleleft: f7,
  ntrianglelefteq: d7,
  ntriangleright: p7,
  ntrianglerighteq: h7,
  Nu: v7,
  nu: m7,
  num: g7,
  numero: y7,
  numsp: w7,
  nvap: k7,
  nvdash: C7,
  nvDash: b7,
  nVdash: T7,
  nVDash: x7,
  nvge: S7,
  nvgt: E7,
  nvHarr: M7,
  nvinfin: O7,
  nvlArr: N7,
  nvle: L7,
  nvlt: D7,
  nvltrie: A7,
  nvrArr: I7,
  nvrtrie: R7,
  nvsim: P7,
  nwarhk: B7,
  nwarr: _7,
  nwArr: H7,
  nwarrow: F7,
  nwnear: z7,
  Oacute: V7,
  oacute: q7,
  oast: $7,
  Ocirc: U7,
  ocirc: j7,
  ocir: W7,
  Ocy: G7,
  ocy: K7,
  odash: Q7,
  Odblac: J7,
  odblac: X7,
  odiv: Y7,
  odot: Z7,
  odsold: eG,
  OElig: tG,
  oelig: rG,
  ofcir: nG,
  Ofr: iG,
  ofr: oG,
  ogon: aG,
  Ograve: sG,
  ograve: lG,
  ogt: uG,
  ohbar: cG,
  ohm: fG,
  oint: dG,
  olarr: pG,
  olcir: hG,
  olcross: vG,
  oline: mG,
  olt: gG,
  Omacr: yG,
  omacr: wG,
  Omega: kG,
  omega: CG,
  Omicron: bG,
  omicron: TG,
  omid: xG,
  ominus: SG,
  Oopf: EG,
  oopf: MG,
  opar: OG,
  OpenCurlyDoubleQuote: NG,
  OpenCurlyQuote: LG,
  operp: DG,
  oplus: AG,
  orarr: IG,
  Or: RG,
  or: PG,
  ord: BG,
  order: _G,
  orderof: HG,
  ordf: FG,
  ordm: zG,
  origof: VG,
  oror: qG,
  orslope: $G,
  orv: UG,
  oS: jG,
  Oscr: WG,
  oscr: GG,
  Oslash: KG,
  oslash: QG,
  osol: JG,
  Otilde: XG,
  otilde: YG,
  otimesas: ZG,
  Otimes: eK,
  otimes: tK,
  Ouml: rK,
  ouml: nK,
  ovbar: iK,
  OverBar: oK,
  OverBrace: aK,
  OverBracket: sK,
  OverParenthesis: lK,
  para: uK,
  parallel: cK,
  par: fK,
  parsim: dK,
  parsl: pK,
  part: hK,
  PartialD: vK,
  Pcy: mK,
  pcy: gK,
  percnt: yK,
  period: wK,
  permil: kK,
  perp: CK,
  pertenk: bK,
  Pfr: TK,
  pfr: xK,
  Phi: SK,
  phi: EK,
  phiv: MK,
  phmmat: OK,
  phone: NK,
  Pi: LK,
  pi: DK,
  pitchfork: AK,
  piv: IK,
  planck: RK,
  planckh: PK,
  plankv: BK,
  plusacir: _K,
  plusb: HK,
  pluscir: FK,
  plus: zK,
  plusdo: VK,
  plusdu: qK,
  pluse: $K,
  PlusMinus: UK,
  plusmn: jK,
  plussim: WK,
  plustwo: GK,
  pm: KK,
  Poincareplane: QK,
  pointint: JK,
  popf: XK,
  Popf: YK,
  pound: ZK,
  prap: eQ,
  Pr: tQ,
  pr: rQ,
  prcue: nQ,
  precapprox: iQ,
  prec: oQ,
  preccurlyeq: aQ,
  Precedes: sQ,
  PrecedesEqual: lQ,
  PrecedesSlantEqual: uQ,
  PrecedesTilde: cQ,
  preceq: fQ,
  precnapprox: dQ,
  precneqq: pQ,
  precnsim: hQ,
  pre: vQ,
  prE: mQ,
  precsim: gQ,
  prime: yQ,
  Prime: wQ,
  primes: kQ,
  prnap: CQ,
  prnE: bQ,
  prnsim: TQ,
  prod: xQ,
  Product: SQ,
  profalar: EQ,
  profline: MQ,
  profsurf: OQ,
  prop: NQ,
  Proportional: LQ,
  Proportion: DQ,
  propto: AQ,
  prsim: IQ,
  prurel: RQ,
  Pscr: PQ,
  pscr: BQ,
  Psi: _Q,
  psi: HQ,
  puncsp: FQ,
  Qfr: zQ,
  qfr: VQ,
  qint: qQ,
  qopf: $Q,
  Qopf: UQ,
  qprime: jQ,
  Qscr: WQ,
  qscr: GQ,
  quaternions: KQ,
  quatint: QQ,
  quest: JQ,
  questeq: XQ,
  quot: YQ,
  QUOT: ZQ,
  rAarr: eJ,
  race: tJ,
  Racute: rJ,
  racute: nJ,
  radic: iJ,
  raemptyv: oJ,
  rang: aJ,
  Rang: sJ,
  rangd: lJ,
  range: uJ,
  rangle: cJ,
  raquo: fJ,
  rarrap: dJ,
  rarrb: pJ,
  rarrbfs: hJ,
  rarrc: vJ,
  rarr: mJ,
  Rarr: gJ,
  rArr: yJ,
  rarrfs: wJ,
  rarrhk: kJ,
  rarrlp: CJ,
  rarrpl: bJ,
  rarrsim: TJ,
  Rarrtl: xJ,
  rarrtl: SJ,
  rarrw: EJ,
  ratail: MJ,
  rAtail: OJ,
  ratio: NJ,
  rationals: LJ,
  rbarr: DJ,
  rBarr: AJ,
  RBarr: IJ,
  rbbrk: RJ,
  rbrace: PJ,
  rbrack: BJ,
  rbrke: _J,
  rbrksld: HJ,
  rbrkslu: FJ,
  Rcaron: zJ,
  rcaron: VJ,
  Rcedil: qJ,
  rcedil: $J,
  rceil: UJ,
  rcub: jJ,
  Rcy: WJ,
  rcy: GJ,
  rdca: KJ,
  rdldhar: QJ,
  rdquo: JJ,
  rdquor: XJ,
  rdsh: YJ,
  real: ZJ,
  realine: eX,
  realpart: tX,
  reals: rX,
  Re: nX,
  rect: iX,
  reg: oX,
  REG: aX,
  ReverseElement: sX,
  ReverseEquilibrium: lX,
  ReverseUpEquilibrium: uX,
  rfisht: cX,
  rfloor: fX,
  rfr: dX,
  Rfr: pX,
  rHar: hX,
  rhard: vX,
  rharu: mX,
  rharul: gX,
  Rho: yX,
  rho: wX,
  rhov: kX,
  RightAngleBracket: CX,
  RightArrowBar: bX,
  rightarrow: TX,
  RightArrow: xX,
  Rightarrow: SX,
  RightArrowLeftArrow: EX,
  rightarrowtail: MX,
  RightCeiling: OX,
  RightDoubleBracket: NX,
  RightDownTeeVector: LX,
  RightDownVectorBar: DX,
  RightDownVector: AX,
  RightFloor: IX,
  rightharpoondown: RX,
  rightharpoonup: PX,
  rightleftarrows: BX,
  rightleftharpoons: _X,
  rightrightarrows: HX,
  rightsquigarrow: FX,
  RightTeeArrow: zX,
  RightTee: VX,
  RightTeeVector: qX,
  rightthreetimes: $X,
  RightTriangleBar: UX,
  RightTriangle: jX,
  RightTriangleEqual: WX,
  RightUpDownVector: GX,
  RightUpTeeVector: KX,
  RightUpVectorBar: QX,
  RightUpVector: JX,
  RightVectorBar: XX,
  RightVector: YX,
  ring: ZX,
  risingdotseq: eY,
  rlarr: tY,
  rlhar: rY,
  rlm: nY,
  rmoustache: iY,
  rmoust: oY,
  rnmid: aY,
  roang: sY,
  roarr: lY,
  robrk: uY,
  ropar: cY,
  ropf: fY,
  Ropf: dY,
  roplus: pY,
  rotimes: hY,
  RoundImplies: vY,
  rpar: mY,
  rpargt: gY,
  rppolint: yY,
  rrarr: wY,
  Rrightarrow: kY,
  rsaquo: CY,
  rscr: bY,
  Rscr: TY,
  rsh: xY,
  Rsh: SY,
  rsqb: EY,
  rsquo: MY,
  rsquor: OY,
  rthree: NY,
  rtimes: LY,
  rtri: DY,
  rtrie: AY,
  rtrif: IY,
  rtriltri: RY,
  RuleDelayed: PY,
  ruluhar: BY,
  rx: _Y,
  Sacute: HY,
  sacute: FY,
  sbquo: zY,
  scap: VY,
  Scaron: qY,
  scaron: $Y,
  Sc: UY,
  sc: jY,
  sccue: WY,
  sce: GY,
  scE: KY,
  Scedil: QY,
  scedil: JY,
  Scirc: XY,
  scirc: YY,
  scnap: ZY,
  scnE: eZ,
  scnsim: tZ,
  scpolint: rZ,
  scsim: nZ,
  Scy: iZ,
  scy: oZ,
  sdotb: aZ,
  sdot: sZ,
  sdote: lZ,
  searhk: uZ,
  searr: cZ,
  seArr: fZ,
  searrow: dZ,
  sect: pZ,
  semi: hZ,
  seswar: vZ,
  setminus: mZ,
  setmn: gZ,
  sext: yZ,
  Sfr: wZ,
  sfr: kZ,
  sfrown: CZ,
  sharp: bZ,
  SHCHcy: TZ,
  shchcy: xZ,
  SHcy: SZ,
  shcy: EZ,
  ShortDownArrow: MZ,
  ShortLeftArrow: OZ,
  shortmid: NZ,
  shortparallel: LZ,
  ShortRightArrow: DZ,
  ShortUpArrow: AZ,
  shy: IZ,
  Sigma: RZ,
  sigma: PZ,
  sigmaf: BZ,
  sigmav: _Z,
  sim: HZ,
  simdot: FZ,
  sime: zZ,
  simeq: VZ,
  simg: qZ,
  simgE: $Z,
  siml: UZ,
  simlE: jZ,
  simne: WZ,
  simplus: GZ,
  simrarr: KZ,
  slarr: QZ,
  SmallCircle: JZ,
  smallsetminus: XZ,
  smashp: YZ,
  smeparsl: ZZ,
  smid: eee,
  smile: tee,
  smt: ree,
  smte: nee,
  smtes: iee,
  SOFTcy: oee,
  softcy: aee,
  solbar: see,
  solb: lee,
  sol: uee,
  Sopf: cee,
  sopf: fee,
  spades: dee,
  spadesuit: pee,
  spar: hee,
  sqcap: vee,
  sqcaps: mee,
  sqcup: gee,
  sqcups: yee,
  Sqrt: wee,
  sqsub: kee,
  sqsube: Cee,
  sqsubset: bee,
  sqsubseteq: Tee,
  sqsup: xee,
  sqsupe: See,
  sqsupset: Eee,
  sqsupseteq: Mee,
  square: Oee,
  Square: Nee,
  SquareIntersection: Lee,
  SquareSubset: Dee,
  SquareSubsetEqual: Aee,
  SquareSuperset: Iee,
  SquareSupersetEqual: Ree,
  SquareUnion: Pee,
  squarf: Bee,
  squ: _ee,
  squf: Hee,
  srarr: Fee,
  Sscr: zee,
  sscr: Vee,
  ssetmn: qee,
  ssmile: $ee,
  sstarf: Uee,
  Star: jee,
  star: Wee,
  starf: Gee,
  straightepsilon: Kee,
  straightphi: Qee,
  strns: Jee,
  sub: Xee,
  Sub: Yee,
  subdot: Zee,
  subE: ete,
  sube: tte,
  subedot: rte,
  submult: nte,
  subnE: ite,
  subne: ote,
  subplus: ate,
  subrarr: ste,
  subset: lte,
  Subset: ute,
  subseteq: cte,
  subseteqq: fte,
  SubsetEqual: dte,
  subsetneq: pte,
  subsetneqq: hte,
  subsim: vte,
  subsub: mte,
  subsup: gte,
  succapprox: yte,
  succ: wte,
  succcurlyeq: kte,
  Succeeds: Cte,
  SucceedsEqual: bte,
  SucceedsSlantEqual: Tte,
  SucceedsTilde: xte,
  succeq: Ste,
  succnapprox: Ete,
  succneqq: Mte,
  succnsim: Ote,
  succsim: Nte,
  SuchThat: Lte,
  sum: Dte,
  Sum: Ate,
  sung: Ite,
  sup1: Rte,
  sup2: Pte,
  sup3: Bte,
  sup: _te,
  Sup: Hte,
  supdot: Fte,
  supdsub: zte,
  supE: Vte,
  supe: qte,
  supedot: $te,
  Superset: Ute,
  SupersetEqual: jte,
  suphsol: Wte,
  suphsub: Gte,
  suplarr: Kte,
  supmult: Qte,
  supnE: Jte,
  supne: Xte,
  supplus: Yte,
  supset: Zte,
  Supset: ere,
  supseteq: tre,
  supseteqq: rre,
  supsetneq: nre,
  supsetneqq: ire,
  supsim: ore,
  supsub: are,
  supsup: sre,
  swarhk: lre,
  swarr: ure,
  swArr: cre,
  swarrow: fre,
  swnwar: dre,
  szlig: pre,
  Tab: hre,
  target: vre,
  Tau: mre,
  tau: gre,
  tbrk: yre,
  Tcaron: wre,
  tcaron: kre,
  Tcedil: Cre,
  tcedil: bre,
  Tcy: Tre,
  tcy: xre,
  tdot: Sre,
  telrec: Ere,
  Tfr: Mre,
  tfr: Ore,
  there4: Nre,
  therefore: Lre,
  Therefore: Dre,
  Theta: Are,
  theta: Ire,
  thetasym: Rre,
  thetav: Pre,
  thickapprox: Bre,
  thicksim: _re,
  ThickSpace: Hre,
  ThinSpace: Fre,
  thinsp: zre,
  thkap: Vre,
  thksim: qre,
  THORN: $re,
  thorn: Ure,
  tilde: jre,
  Tilde: Wre,
  TildeEqual: Gre,
  TildeFullEqual: Kre,
  TildeTilde: Qre,
  timesbar: Jre,
  timesb: Xre,
  times: Yre,
  timesd: Zre,
  tint: ene,
  toea: tne,
  topbot: rne,
  topcir: nne,
  top: ine,
  Topf: one,
  topf: ane,
  topfork: sne,
  tosa: lne,
  tprime: une,
  trade: cne,
  TRADE: fne,
  triangle: dne,
  triangledown: pne,
  triangleleft: hne,
  trianglelefteq: vne,
  triangleq: mne,
  triangleright: gne,
  trianglerighteq: yne,
  tridot: wne,
  trie: kne,
  triminus: Cne,
  TripleDot: bne,
  triplus: Tne,
  trisb: xne,
  tritime: Sne,
  trpezium: Ene,
  Tscr: Mne,
  tscr: One,
  TScy: Nne,
  tscy: Lne,
  TSHcy: Dne,
  tshcy: Ane,
  Tstrok: Ine,
  tstrok: Rne,
  twixt: Pne,
  twoheadleftarrow: Bne,
  twoheadrightarrow: _ne,
  Uacute: Hne,
  uacute: Fne,
  uarr: zne,
  Uarr: Vne,
  uArr: qne,
  Uarrocir: $ne,
  Ubrcy: Une,
  ubrcy: jne,
  Ubreve: Wne,
  ubreve: Gne,
  Ucirc: Kne,
  ucirc: Qne,
  Ucy: Jne,
  ucy: Xne,
  udarr: Yne,
  Udblac: Zne,
  udblac: eie,
  udhar: tie,
  ufisht: rie,
  Ufr: nie,
  ufr: iie,
  Ugrave: oie,
  ugrave: aie,
  uHar: sie,
  uharl: lie,
  uharr: uie,
  uhblk: cie,
  ulcorn: fie,
  ulcorner: die,
  ulcrop: pie,
  ultri: hie,
  Umacr: vie,
  umacr: mie,
  uml: gie,
  UnderBar: yie,
  UnderBrace: wie,
  UnderBracket: kie,
  UnderParenthesis: Cie,
  Union: bie,
  UnionPlus: Tie,
  Uogon: xie,
  uogon: Sie,
  Uopf: Eie,
  uopf: Mie,
  UpArrowBar: Oie,
  uparrow: Nie,
  UpArrow: Lie,
  Uparrow: Die,
  UpArrowDownArrow: Aie,
  updownarrow: Iie,
  UpDownArrow: Rie,
  Updownarrow: Pie,
  UpEquilibrium: Bie,
  upharpoonleft: _ie,
  upharpoonright: Hie,
  uplus: Fie,
  UpperLeftArrow: zie,
  UpperRightArrow: Vie,
  upsi: qie,
  Upsi: $ie,
  upsih: Uie,
  Upsilon: jie,
  upsilon: Wie,
  UpTeeArrow: Gie,
  UpTee: Kie,
  upuparrows: Qie,
  urcorn: Jie,
  urcorner: Xie,
  urcrop: Yie,
  Uring: Zie,
  uring: eoe,
  urtri: toe,
  Uscr: roe,
  uscr: noe,
  utdot: ioe,
  Utilde: ooe,
  utilde: aoe,
  utri: soe,
  utrif: loe,
  uuarr: uoe,
  Uuml: coe,
  uuml: foe,
  uwangle: doe,
  vangrt: poe,
  varepsilon: hoe,
  varkappa: voe,
  varnothing: moe,
  varphi: goe,
  varpi: yoe,
  varpropto: woe,
  varr: koe,
  vArr: Coe,
  varrho: boe,
  varsigma: Toe,
  varsubsetneq: xoe,
  varsubsetneqq: Soe,
  varsupsetneq: Eoe,
  varsupsetneqq: Moe,
  vartheta: Ooe,
  vartriangleleft: Noe,
  vartriangleright: Loe,
  vBar: Doe,
  Vbar: Aoe,
  vBarv: Ioe,
  Vcy: Roe,
  vcy: Poe,
  vdash: Boe,
  vDash: _oe,
  Vdash: Hoe,
  VDash: Foe,
  Vdashl: zoe,
  veebar: Voe,
  vee: qoe,
  Vee: $oe,
  veeeq: Uoe,
  vellip: joe,
  verbar: Woe,
  Verbar: Goe,
  vert: Koe,
  Vert: Qoe,
  VerticalBar: Joe,
  VerticalLine: Xoe,
  VerticalSeparator: Yoe,
  VerticalTilde: Zoe,
  VeryThinSpace: eae,
  Vfr: tae,
  vfr: rae,
  vltri: nae,
  vnsub: iae,
  vnsup: oae,
  Vopf: aae,
  vopf: sae,
  vprop: lae,
  vrtri: uae,
  Vscr: cae,
  vscr: fae,
  vsubnE: dae,
  vsubne: pae,
  vsupnE: hae,
  vsupne: vae,
  Vvdash: mae,
  vzigzag: gae,
  Wcirc: yae,
  wcirc: wae,
  wedbar: kae,
  wedge: Cae,
  Wedge: bae,
  wedgeq: Tae,
  weierp: xae,
  Wfr: Sae,
  wfr: Eae,
  Wopf: Mae,
  wopf: Oae,
  wp: Nae,
  wr: Lae,
  wreath: Dae,
  Wscr: Aae,
  wscr: Iae,
  xcap: Rae,
  xcirc: Pae,
  xcup: Bae,
  xdtri: _ae,
  Xfr: Hae,
  xfr: Fae,
  xharr: zae,
  xhArr: Vae,
  Xi: qae,
  xi: $ae,
  xlarr: Uae,
  xlArr: jae,
  xmap: Wae,
  xnis: Gae,
  xodot: Kae,
  Xopf: Qae,
  xopf: Jae,
  xoplus: Xae,
  xotime: Yae,
  xrarr: Zae,
  xrArr: ese,
  Xscr: tse,
  xscr: rse,
  xsqcup: nse,
  xuplus: ise,
  xutri: ose,
  xvee: ase,
  xwedge: sse,
  Yacute: lse,
  yacute: use,
  YAcy: cse,
  yacy: fse,
  Ycirc: dse,
  ycirc: pse,
  Ycy: hse,
  ycy: vse,
  yen: mse,
  Yfr: gse,
  yfr: yse,
  YIcy: wse,
  yicy: kse,
  Yopf: Cse,
  yopf: bse,
  Yscr: Tse,
  yscr: xse,
  YUcy: Sse,
  yucy: Ese,
  yuml: Mse,
  Yuml: Ose,
  Zacute: Nse,
  zacute: Lse,
  Zcaron: Dse,
  zcaron: Ase,
  Zcy: Ise,
  zcy: Rse,
  Zdot: Pse,
  zdot: Bse,
  zeetrf: _se,
  ZeroWidthSpace: Hse,
  Zeta: Fse,
  zeta: zse,
  zfr: Vse,
  Zfr: qse,
  ZHcy: $se,
  zhcy: Use,
  zigrarr: jse,
  zopf: Wse,
  Zopf: Gse,
  Zscr: Kse,
  zscr: Qse,
  zwj: Jse,
  zwnj: Xse
}, Yse = "Á", Zse = "á", ele = "Â", tle = "â", rle = "´", nle = "Æ", ile = "æ", ole = "À", ale = "à", sle = "&", lle = "&", ule = "Å", cle = "å", fle = "Ã", dle = "ã", ple = "Ä", hle = "ä", vle = "¦", mle = "Ç", gle = "ç", yle = "¸", wle = "¢", kle = "©", Cle = "©", ble = "¤", Tle = "°", xle = "÷", Sle = "É", Ele = "é", Mle = "Ê", Ole = "ê", Nle = "È", Lle = "è", Dle = "Ð", Ale = "ð", Ile = "Ë", Rle = "ë", Ple = "½", Ble = "¼", _le = "¾", Hle = ">", Fle = ">", zle = "Í", Vle = "í", qle = "Î", $le = "î", Ule = "¡", jle = "Ì", Wle = "ì", Gle = "¿", Kle = "Ï", Qle = "ï", Jle = "«", Xle = "<", Yle = "<", Zle = "¯", eue = "µ", tue = "·", rue = " ", nue = "¬", iue = "Ñ", oue = "ñ", aue = "Ó", sue = "ó", lue = "Ô", uue = "ô", cue = "Ò", fue = "ò", due = "ª", pue = "º", hue = "Ø", vue = "ø", mue = "Õ", gue = "õ", yue = "Ö", wue = "ö", kue = "¶", Cue = "±", bue = "£", Tue = '"', xue = '"', Sue = "»", Eue = "®", Mue = "®", Oue = "§", Nue = "­", Lue = "¹", Due = "²", Aue = "³", Iue = "ß", Rue = "Þ", Pue = "þ", Bue = "×", _ue = "Ú", Hue = "ú", Fue = "Û", zue = "û", Vue = "Ù", que = "ù", $ue = "¨", Uue = "Ü", jue = "ü", Wue = "Ý", Gue = "ý", Kue = "¥", Que = "ÿ", Jue = {
  Aacute: Yse,
  aacute: Zse,
  Acirc: ele,
  acirc: tle,
  acute: rle,
  AElig: nle,
  aelig: ile,
  Agrave: ole,
  agrave: ale,
  amp: sle,
  AMP: lle,
  Aring: ule,
  aring: cle,
  Atilde: fle,
  atilde: dle,
  Auml: ple,
  auml: hle,
  brvbar: vle,
  Ccedil: mle,
  ccedil: gle,
  cedil: yle,
  cent: wle,
  copy: kle,
  COPY: Cle,
  curren: ble,
  deg: Tle,
  divide: xle,
  Eacute: Sle,
  eacute: Ele,
  Ecirc: Mle,
  ecirc: Ole,
  Egrave: Nle,
  egrave: Lle,
  ETH: Dle,
  eth: Ale,
  Euml: Ile,
  euml: Rle,
  frac12: Ple,
  frac14: Ble,
  frac34: _le,
  gt: Hle,
  GT: Fle,
  Iacute: zle,
  iacute: Vle,
  Icirc: qle,
  icirc: $le,
  iexcl: Ule,
  Igrave: jle,
  igrave: Wle,
  iquest: Gle,
  Iuml: Kle,
  iuml: Qle,
  laquo: Jle,
  lt: Xle,
  LT: Yle,
  macr: Zle,
  micro: eue,
  middot: tue,
  nbsp: rue,
  not: nue,
  Ntilde: iue,
  ntilde: oue,
  Oacute: aue,
  oacute: sue,
  Ocirc: lue,
  ocirc: uue,
  Ograve: cue,
  ograve: fue,
  ordf: due,
  ordm: pue,
  Oslash: hue,
  oslash: vue,
  Otilde: mue,
  otilde: gue,
  Ouml: yue,
  ouml: wue,
  para: kue,
  plusmn: Cue,
  pound: bue,
  quot: Tue,
  QUOT: xue,
  raquo: Sue,
  reg: Eue,
  REG: Mue,
  sect: Oue,
  shy: Nue,
  sup1: Lue,
  sup2: Due,
  sup3: Aue,
  szlig: Iue,
  THORN: Rue,
  thorn: Pue,
  times: Bue,
  Uacute: _ue,
  uacute: Hue,
  Ucirc: Fue,
  ucirc: zue,
  Ugrave: Vue,
  ugrave: que,
  uml: $ue,
  Uuml: Uue,
  uuml: jue,
  Yacute: Wue,
  yacute: Gue,
  yen: Kue,
  yuml: Que
}, Xue = "&", Yue = "'", Zue = ">", ece = "<", tce = '"', _k = {
  amp: Xue,
  apos: Yue,
  gt: Zue,
  lt: ece,
  quot: tce
}, xh = {}, rce = {
  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
}, nce = va && va.__importDefault || function(r) {
  return r && r.__esModule ? r : { default: r };
};
Object.defineProperty(xh, "__esModule", { value: !0 });
var Wy = nce(rce), ice = (
  // 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 oce(r) {
  return r >= 55296 && r <= 57343 || r > 1114111 ? "�" : (r in Wy.default && (r = Wy.default[r]), ice(r));
}
xh.default = oce;
var wc = va && va.__importDefault || function(r) {
  return r && r.__esModule ? r : { default: r };
};
Object.defineProperty(An, "__esModule", { value: !0 });
An.decodeHTML = An.decodeHTMLStrict = An.decodeXML = void 0;
var Cp = wc(Bk), ace = wc(Jue), sce = wc(_k), Gy = wc(xh), lce = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
An.decodeXML = Hk(sce.default);
An.decodeHTMLStrict = Hk(Cp.default);
function Hk(r) {
  var e = Fk(r);
  return function(t) {
    return String(t).replace(lce, e);
  };
}
var Ky = function(r, e) {
  return r < e ? 1 : -1;
};
An.decodeHTML = (function() {
  for (var r = Object.keys(ace.default).sort(Ky), e = Object.keys(Cp.default).sort(Ky), 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"), o = Fk(Cp.default);
  function s(u) {
    return u.substr(-1) !== ";" && (u += ";"), o(u);
  }
  return function(u) {
    return String(u).replace(i, s);
  };
})();
function Fk(r) {
  return function(t) {
    if (t.charAt(1) === "#") {
      var n = t.charAt(2);
      return n === "X" || n === "x" ? Gy.default(parseInt(t.substr(3), 16)) : Gy.default(parseInt(t.substr(2), 10));
    }
    return r[t.slice(1, -1)] || t;
  };
}
var ur = {}, zk = va && va.__importDefault || function(r) {
  return r && r.__esModule ? r : { default: r };
};
Object.defineProperty(ur, "__esModule", { value: !0 });
ur.escapeUTF8 = ur.escape = ur.encodeNonAsciiHTML = ur.encodeHTML = ur.encodeXML = void 0;
var uce = zk(_k), Vk = $k(uce.default), qk = Uk(Vk);
ur.encodeXML = Gk(Vk);
var cce = zk(Bk), Sh = $k(cce.default), fce = Uk(Sh);
ur.encodeHTML = pce(Sh, fce);
ur.encodeNonAsciiHTML = Gk(Sh);
function $k(r) {
  return Object.keys(r).sort().reduce(function(e, t) {
    return e[r[t]] = "&" + t + ";", e;
  }, {});
}
function Uk(r) {
  for (var e = [], t = [], n = 0, i = Object.keys(r); n < i.length; n++) {
    var o = i[n];
    o.length === 1 ? e.push("\\" + o) : t.push(o);
  }
  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 jk = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g, dce = (
  // 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 kc(r) {
  return "&#x" + (r.length > 1 ? dce(r) : r.charCodeAt(0)).toString(16).toUpperCase() + ";";
}
function pce(r, e) {
  return function(t) {
    return t.replace(e, function(n) {
      return r[n];
    }).replace(jk, kc);
  };
}
var Wk = new RegExp(qk.source + "|" + jk.source, "g");
function hce(r) {
  return r.replace(Wk, kc);
}
ur.escape = hce;
function vce(r) {
  return r.replace(qk, kc);
}
ur.escapeUTF8 = vce;
function Gk(r) {
  return function(e) {
    return e.replace(Wk, function(t) {
      return r[t] || kc(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 = An, t = ur;
  function n(f, d) {
    return (!d || d <= 0 ? e.decodeXML : e.decodeHTML)(f);
  }
  r.decode = n;
  function i(f, d) {
    return (!d || d <= 0 ? e.decodeXML : e.decodeHTMLStrict)(f);
  }
  r.decodeStrict = i;
  function o(f, d) {
    return (!d || d <= 0 ? t.encodeXML : t.encodeHTML)(f);
  }
  r.encode = o;
  var s = ur;
  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 = An;
  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;
  } });
})(Th);
var Kk = "&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});", mce = 92, gce = /[\\&]/, Eh = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]", yce = new RegExp("\\\\" + Eh + "|" + Kk, "gi"), wce = '[&<>"]', Qy = new RegExp(wce, "g"), kce = function(r) {
  return r.charCodeAt(0) === mce ? r.charAt(1) : Th.decodeHTML(r);
};
function Os(r) {
  return gce.test(r) ? r.replace(yce, kce) : r;
}
function su(r) {
  try {
    return RL(r);
  } catch {
    return r;
  }
}
function Cce(r) {
  switch (r) {
    case "&":
      return "&amp;";
    case "<":
      return "&lt;";
    case ">":
      return "&gt;";
    case '"':
      return "&quot;";
    default:
      return r;
  }
}
function ea(r) {
  return Qy.test(r) ? r.replace(Qy, Cce) : r;
}
function bp(r, e) {
  for (var t = [], n = 0; n < e; n++)
    t.push(r);
  return t.join("");
}
function Jy(r) {
  return r ? !/[^ \t]+/.test(r) : !0;
}
var bce = (
  /** @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 = Mh(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 Mh(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 Tce = 1, Cc = {};
function xce(r) {
  return Cc[r];
}
function Tp(r) {
  delete Cc[r];
}
function Sce() {
  Cc = {};
}
var js = (
  /** @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 = Tce++, this.type = e, this.sourcepos = t, Cc[this.id] = this;
    }
    return r.prototype.isContainer = function() {
      return Mh(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 bce(this);
    }, r;
  })()
), Pn = (
  /** @class */
  (function(r) {
    Sr(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;
  })(js)
), Ece = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.listData = null, t;
    }
    return e;
  })(Pn)
), Mce = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.level = 0, t.headingType = "atx", t;
    }
    return e;
  })(Pn)
), Oce = (
  /** @class */
  (function(r) {
    Sr(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;
  })(Pn)
), Nce = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.columns = [], t;
    }
    return e;
  })(Pn)
), Lce = (
  /** @class */
  (function(r) {
    Sr(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;
  })(Pn)
), Dce = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.title = "", t.dest = "", t.label = "", t;
    }
    return e;
  })(Pn)
), Ace = (
  /** @class */
  (function(r) {
    Sr(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;
  })(Pn)
), Ice = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.htmlBlockType = -1, t;
    }
    return e;
  })(Pn)
), Rce = (
  /** @class */
  (function(r) {
    Sr(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;
  })(js)
), Pce = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.tickCount = 0, t;
    }
    return e;
  })(js)
), Bce = (
  /** @class */
  (function(r) {
    Sr(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.info = "", t;
    }
    return e;
  })(js)
);
function Qe(r, e) {
  switch (r) {
    case "heading":
      return new Mce(r, e);
    case "list":
    case "item":
      return new Ece(r, e);
    case "link":
    case "image":
      return new Rce(r, e);
    case "codeBlock":
      return new Oce(r, e);
    case "htmlBlock":
      return new Ice(r, e);
    case "table":
      return new Nce(r, e);
    case "tableCell":
      return new Lce(r, e);
    case "document":
    case "paragraph":
    case "blockQuote":
    case "thematicBreak":
    case "tableRow":
    case "tableBody":
    case "tableHead":
    case "frontMatter":
      return new Pn(r, e);
    case "code":
      return new Pce(r, e);
    case "refDef":
      return new Dce(r, e);
    case "customBlock":
      return new Ace(r, e);
    case "customInline":
      return new Bce(r, e);
    default:
      return new js(r, e);
  }
}
function Qk(r) {
  return r.type === "codeBlock";
}
function _ce(r) {
  return r.type === "htmlBlock";
}
function Hce(r) {
  return r.type === "heading";
}
function Xy(r) {
  return r.type === "list";
}
function Fce(r) {
  return r.type === "table";
}
function Qo(r) {
  return r.type === "refDef";
}
function Jk(r) {
  return r.type === "customBlock";
}
function zce(r) {
  return r.type === "customInline";
}
function it(r, e) {
  var t = Qe("text", e);
  return t.literal = r, t;
}
var Xk = "[A-Za-z][A-Za-z0-9-]*", Vce = "[a-zA-Z_:][a-zA-Z0-9:._-]*", qce = "[^\"'=<>`\\x00-\\x20]+", $ce = "'[^']*'", Uce = '"[^"]*"', jce = "(?:" + qce + "|" + $ce + "|" + Uce + ")", Wce = "(?:\\s*=\\s*" + jce + ")", Gce = "(?:\\s+" + Vce + Wce + "?)", Yk = "<" + Xk + Gce + "*\\s*/?>", Zk = "</" + Xk + "\\s*[>]", Kce = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->", Qce = "[<][?].*?[?][>]", Jce = "<![A-Z]+\\s+[^>]*>", Xce = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>", Yce = "(?:" + Yk + "|" + Zk + "|" + Kce + "|" + Qce + "|" + Jce + "|" + Xce + ")", Zce = new RegExp("^" + Yce, "i");
var xp;
if (String.fromCodePoint)
  xp = function(r) {
    try {
      return String.fromCodePoint(r);
    } catch (e) {
      if (e instanceof RangeError)
        return "�";
      throw e;
    }
  };
else {
  var efe = String.fromCharCode, tfe = Math.floor;
  xp = function() {
    for (var r = [], e = 0; e < arguments.length; e++)
      r[e] = arguments[e];
    var t = 16384, n = [], i, o, s = -1, u = r.length;
    if (!u)
      return "";
    for (var f = ""; ++s < u; ) {
      var d = Number(r[s]);
      if (!isFinite(d) || // `NaN`, `+Infinity`, or `-Infinity`
      d < 0 || // not a valid Unicode code point
      d > 1114111 || // not a valid Unicode code point
      tfe(d) !== d)
        return "�";
      d <= 65535 ? n.push(d) : (d -= 65536, i = (d >> 10) + 55296, o = d % 1024 + 56320, n.push(i, o)), (s + 1 === u || n.length > t) && (f += efe.apply(void 0, n), n.length = 0);
    }
    return f;
  };
}
var Rd = xp, rfe = "(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+", nfe = "[^<\\s]*[^<?!.,:*_?~\\s]", ife = "[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+";
function ofe(r) {
  var e = /\)+$/.exec(r);
  if (e) {
    for (var t = 0, n = 0, i = r; n < i.length; n++) {
      var o = i[n];
      o === "(" ? t < 0 ? t = 1 : t += 1 : o === ")" && (t -= 1);
    }
    if (t < 0) {
      var s = Math.min(-t, e[0].length);
      return r.substring(0, r.length - s);
    }
  }
  return r;
}
function afe(r) {
  return r.replace(/&[A-Za-z0-9]+;$/, "");
}
function sfe(r) {
  for (var e = new RegExp(ife, "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 lfe(r) {
  for (var e = new RegExp("(www|https?://)." + rfe + nfe, "g"), t = [], n; n = e.exec(r); ) {
    var i = afe(ofe(n[0])), o = n[1] === "www" ? "http://" : "";
    t.push({
      text: i,
      range: [n.index, n.index + i.length - 1],
      url: "" + o + i
    });
  }
  return t;
}
function ufe(r) {
  return kp(kp([], lfe(r)), sfe(r)).sort(function(e, t) {
    return e.range[0] - t.range[0];
  });
}
function cfe(r, e) {
  typeof e == "boolean" && (e = ufe);
  for (var t, n = function() {
    var i = t.entering, o = t.node;
    if (i && o.type === "text" && o.parent.type !== "link") {
      var s = o.literal, u = e(s);
      if (!u || !u.length)
        return "continue";
      for (var f = 0, d = o.sourcepos[0], h = d[0], m = d[1], y = function(K, ce) {
        return [
          [h, m + K],
          [h, m + ce]
        ];
      }, w = [], k = 0, b = u; k < b.length; k++) {
        var T = b[k], E = T.range, I = T.url, P = T.text;
        E[0] > f && w.push(it(s.substring(f, E[0]), y(f, E[0] - 1)));
        var _ = Qe("link", y.apply(void 0, E));
        _.appendChild(it(P, y.apply(void 0, E))), _.destination = I, _.extendedAutolink = !0, w.push(_), f = E[1] + 1;
      }
      f < s.length && w.push(it(s.substring(f), y(f, s.length - 1)));
      for (var V = 0, W = w; V < W.length; V++) {
        var q = W[V];
        o.insertBefore(q);
      }
      o.unlink();
    }
  }; t = r.next(); )
    n();
}
function Qu(r) {
  return r[r.length - 1];
}
function Yy(r) {
  return r.slice(1, r.length - 1).trim().replace(/[ \t\r\n]+/, " ").toLowerCase().toUpperCase();
}
function lu(r, e) {
  Object.keys(r).forEach(function(t) {
    e(t, r[t]);
  });
}
function ffe(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  var n = bt({}, r);
  return e.forEach(function(i) {
    delete n[i];
  }), n;
}
function Jo(r) {
  return !Object.keys(r).length;
}
function dfe(r) {
  Object.keys(r).forEach(function(e) {
    delete r[e];
  });
}
var Sp = 10, Pd = 42, uu = 95, pfe = 96, Zy = 91, hfe = 93, cu = 126, ew = 60, vfe = 33, tw = 92, mfe = 38, rw = 40, Bd = 41, gfe = 58, ji = 39, Wi = 34, Gi = 36, _d = "\\\\" + Eh, nw = 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]/), yfe = new RegExp('^(?:"(' + _d + '|[^"\\x00])*"|' + ("'(" + _d + "|[^'\\x00])*'") + "|" + ("\\((" + _d + "|[^()\\x00])*\\))")), wfe = /^(?:<(?:[^<>\n\\\x00]|\\.)*>)/, iw = new RegExp("^" + Eh), kfe = new RegExp("^" + Kk, "i"), Cfe = /`+/, bfe = /^`+/, Tfe = /\.\.\./g, xfe = /--+/g, Sfe = /^<([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])?)*)>/, Efe = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i, Mfe = /^ *(?:\n *)?/, Hd = /^[ \t\n\x0b\x0c\x0d]/, ow = /^\s/, Ofe = / *$/, Nfe = /^ */, aw = /^ *(?:\n|$)/, Lfe = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/, Dfe = /^[^\n`\[\]\\!<&*_'"~$]+/m, Afe = (
  /** @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, o = [i, e + n];
      return typeof t == "number" ? [o, [i, t + n]] : o;
    }, 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(Mfe), !0;
    }, r.prototype.parseBackticks = function(e) {
      var t = this.pos + 1, n = this.match(bfe);
      if (n === null)
        return !1;
      for (var i = this.pos, o; (o = this.match(Cfe)) !== null; )
        if (o === 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 d = Qu(f);
            this.lineIdx += f.length - 1, this.linePosOffset = -(this.pos - d.length - n.length), u[1] = this.sourcepos(this.pos), s = f.join(" ");
          }
          var h = Qe("code", u);
          return s.length > 0 && s.match(/[^ ]/) !== null && s[0] == " " && s[s.length - 1] == " " ? h.literal = s.slice(1, s.length - 1) : h.literal = s, h.tickCount = n.length, e.appendChild(h), !0;
        }
      return this.pos = i, e.appendChild(it(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() === Sp ? (this.pos += 1, n = Qe("linebreak", this.sourcepos(this.pos - 1, this.pos)), e.appendChild(n), this.nextLine()) : iw.test(t.charAt(this.pos)) ? (e.appendChild(it(t.charAt(this.pos), this.sourcepos(i, this.pos))), this.pos += 1) : e.appendChild(it("\\", this.sourcepos(i, i))), !0;
    }, r.prototype.parseAutolink = function(e) {
      var t, n, i, o = this.pos + 1;
      return (t = this.match(Sfe)) ? (n = t.slice(1, t.length - 1), i = Qe("link", this.sourcepos(o, this.pos)), i.destination = su("mailto:" + n), i.title = "", i.appendChild(it(n, this.sourcepos(o + 1, this.pos - 1))), e.appendChild(i), !0) : (t = this.match(Efe)) ? (n = t.slice(1, t.length - 1), i = Qe("link", this.sourcepos(o, this.pos)), i.destination = su(n), i.title = "", i.appendChild(it(n, this.sourcepos(o + 1, this.pos - 1))), e.appendChild(i), !0) : !1;
    }, r.prototype.parseHtmlTag = function(e) {
      var t = this.pos + 1, n = this.match(Zce);
      if (n === null)
        return !1;
      var i = Qe("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 === ji || e === Wi)
        t++, this.pos++;
      else
        for (; this.peek() === e; )
          t++, this.pos++;
      if (t === 0 || t < 2 && (e === cu || e === Gi))
        return this.pos = n, null;
      var i = n === 0 ? `
` : this.subject.charAt(n - 1), o = this.peek(), s;
      o === -1 ? s = `
` : s = Rd(o);
      var u = ow.test(s), f = nw.test(s), d = ow.test(i), h = nw.test(i), m = !u && (!f || d || h), y = !d && (!h || u || f), w, k;
      return e === uu ? (w = m && (!y || h), k = y && (!m || f)) : e === ji || e === Wi ? (w = m && !y, k = y) : e === Gi ? (w = !u, k = !d) : (w = m, k = y), this.pos = n, { numdelims: t, canOpen: w, canClose: k };
    }, r.prototype.handleDelim = function(e, t) {
      var n = this.scanDelims(e);
      if (!n)
        return !1;
      var i = n.numdelims, o = this.pos + 1, s;
      this.pos += i, e === ji ? s = "’" : e === Wi ? s = "“" : s = this.subject.slice(o - 1, this.pos);
      var u = it(s, this.sourcepos(o, this.pos));
      return t.appendChild(u), (n.canOpen || n.canClose) && (this.options.smart || e !== ji && e !== Wi) && (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, o, s, u, f, d = !1, h = (t = {}, t[uu] = [e, e, e], t[Pd] = [e, e, e], t[ji] = [e], t[Wi] = [e], t[cu] = [e], t[Gi] = [e], t);
      for (i = this.delimiters; i !== null && i.previous !== e; )
        i = i.previous;
      for (; i !== null; ) {
        var m = i.cc, y = m === uu || m === Pd;
        if (!i.canClose)
          i = i.next;
        else {
          for (n = i.previous, f = !1; n !== null && n !== e && n !== h[m][y ? i.origdelims % 3 : 0]; ) {
            if (d = y && (i.canOpen || n.canClose) && i.origdelims % 3 !== 0 && (n.origdelims + i.origdelims) % 3 === 0, n.cc === i.cc && n.canOpen && !d) {
              f = !0;
              break;
            }
            n = n.previous;
          }
          if (o = i, y || m === cu || m === Gi) {
            if (!f)
              i = i.next;
            else if (n) {
              var w = i.numdelims >= 2 && n.numdelims >= 2 ? 2 : 1, k = y ? 0 : 1;
              s = n.node, u = i.node;
              var b = y ? w === 1 ? "emph" : "strong" : "strike";
              m === Gi && (b = "customInline");
              var T = Qe(b), E = s.sourcepos[1], I = u.sourcepos[0];
              T.sourcepos = [
                [E[0], E[1] - w + 1],
                [I[0], I[1] + w - 1]
              ], s.sourcepos[1][1] -= w, u.sourcepos[0][1] += w, s.literal = s.literal.slice(w), u.literal = u.literal.slice(w), n.numdelims -= w, i.numdelims -= w;
              for (var P = s.next, _ = void 0; P && P !== u; )
                _ = P.next, P.unlink(), T.appendChild(P), P = _;
              if (m === Gi) {
                var V = T.firstChild, W = V.literal || "", q = W.split(/\s/)[0];
                T.info = q, W.length <= q.length ? V.unlink() : (V.sourcepos[0][1] += q.length, V.literal = W.replace(q + " ", ""));
              }
              if (s.insertAfter(T), this.removeDelimitersBetween(n, i), n.numdelims <= k && (n.numdelims === 0 && s.unlink(), this.removeDelimiter(n)), i.numdelims <= k) {
                i.numdelims === 0 && u.unlink();
                var K = i.next;
                this.removeDelimiter(i), i = K;
              }
            }
          } else m === ji ? (i.node.literal = "’", f && (n.node.literal = "‘"), i = i.next) : m === Wi && (i.node.literal = "”", f && (n.node.literal = "“"), i = i.next);
          f || (h[m][y ? o.origdelims % 3 : 0] = o.previous, o.canOpen || this.removeDelimiter(o));
        }
      }
      for (; this.delimiters !== null && this.delimiters !== e; )
        this.removeDelimiter(this.delimiters);
    }, r.prototype.parseLinkTitle = function() {
      var e = this.match(yfe);
      return e === null ? null : Os(e.substr(1, e.length - 2));
    }, r.prototype.parseLinkDestination = function() {
      var e = this.match(wfe);
      if (e === null) {
        if (this.peek() === ew)
          return null;
        for (var t = this.pos, n = 0, i = void 0; (i = this.peek()) !== -1; )
          if (i === tw && iw.test(this.subject.charAt(this.pos + 1)))
            this.pos += 1, this.peek() !== -1 && (this.pos += 1);
          else if (i === rw)
            this.pos += 1, n += 1;
          else if (i === Bd) {
            if (n < 1)
              break;
            this.pos += 1, n -= 1;
          } else {
            if (Hd.exec(Rd(i)) !== null)
              break;
            this.pos += 1;
          }
        return this.pos === t && i !== Bd || n !== 0 ? null : (e = this.subject.substr(t, this.pos - t), su(Os(e)));
      }
      return su(Os(e.substr(1, e.length - 2)));
    }, r.prototype.parseLinkLabel = function() {
      var e = this.match(Lfe);
      return e === null || e.length > 1001 ? 0 : e.length;
    }, r.prototype.parseOpenBracket = function(e) {
      var t = this.pos;
      this.pos += 1;
      var n = it("[", 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() === Zy) {
        this.pos += 1;
        var n = it("![", this.sourcepos(this.pos - 1, this.pos));
        e.appendChild(n), this.addBracket(n, t + 1, !0);
      } else {
        var n = it("!", 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 o = this.pos, s = this.brackets;
      if (s === null)
        return e.appendChild(it("]", this.sourcepos(o, o))), !0;
      if (!s.active)
        return e.appendChild(it("]", this.sourcepos(o, o))), this.removeBracket(), !0;
      var u = s.image, f = this.pos;
      this.peek() === rw && (this.pos++, this.spnl() && (t = this.parseLinkDestination()) !== null && this.spnl() && // make sure there's a space before the title:
      (Hd.test(this.subject.charAt(this.pos - 1)) && (n = this.parseLinkTitle()) || !0) && this.spnl() && this.peek() === Bd ? (this.pos += 1, i = !0) : this.pos = f);
      var d = "";
      if (!i) {
        var h = this.pos, m = this.parseLinkLabel();
        if (m > 2 ? d = this.subject.slice(h, h + m) : s.bracketAfter || (d = this.subject.slice(s.index, o)), m === 0 && (this.pos = f), d) {
          d = Yy(d);
          var y = this.refMap[d];
          y && (t = y.destination, n = y.title, i = !0);
        }
      }
      if (i) {
        var w = Qe(u ? "image" : "link");
        w.destination = t, w.title = n || "", w.sourcepos = [s.startpos, this.sourcepos(this.pos)];
        for (var k = s.node.next, b = void 0; k; )
          b = k.next, k.unlink(), w.appendChild(k), k = b;
        if (e.appendChild(w), 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: d }), !0;
      }
      return this.removeBracket(), this.pos = o, e.appendChild(it("]", this.sourcepos(o, o))), this.options.referenceDefinition && (this.refLinkCandidateMap[e.id] = { node: e, refLabel: d }), !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(kfe)) ? (e.appendChild(it(Th.decodeHTML(t), this.sourcepos(n, this.pos))), !0) : !1;
    }, r.prototype.parseString = function(e) {
      var t, n = this.pos + 1;
      if (t = this.match(Dfe)) {
        if (this.options.smart) {
          var i = t.replace(Tfe, "…").replace(xfe, 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), bp("—", f) + bp("–", u);
          });
          e.appendChild(it(i, this.sourcepos(n, this.pos)));
        } else {
          var o = it(t, this.sourcepos(n, this.pos));
          e.appendChild(o);
        }
        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(Ofe, "");
        var o = i - t.literal.length;
        t.sourcepos[1][1] -= o, e.appendChild(Qe(n ? "linebreak" : "softbreak", this.sourcepos(this.pos - o, this.pos)));
      } else
        e.appendChild(Qe("softbreak", this.sourcepos(this.pos, this.pos)));
      return this.nextLine(), this.match(Nfe), !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, o = this.parseLinkLabel();
      if (o === 0)
        return 0;
      var s = this.subject.substr(0, o);
      if (this.peek() === gfe)
        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 d = !0;
      if (this.match(aw) === null && (n === "" ? d = !1 : (n = "", this.pos = f, d = this.match(aw) !== null)), !d)
        return this.pos = i, 0;
      var h = Yy(s);
      if (h === "")
        return this.pos = i, 0;
      var m = this.getReferenceDefSourcepos(e);
      e.sourcepos[0][0] = m[1][0] + 1;
      var y = Qe("refDef", m);
      return y.title = n, y.dest = u, y.label = h, e.insertBefore(y), t[h] ? this.refDefCandidateMap[y.id] = y : t[h] = Op(y), this.pos - i;
    }, r.prototype.mergeTextNodes = function(e) {
      for (var t, n = []; t = e.next(); ) {
        var i = t.entering, o = t.node;
        if (i && o.type === "text")
          n.push(o);
        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, o = { line: 0, ch: 0 }, s = 0; s < t.length; s += 1) {
        var u = t[s];
        if (Hd.test(u))
          break;
        if (/\:/.test(u) && i === 0) {
          if (n)
            break;
          var f = u.indexOf(":") === u.length - 1 ? s + 1 : s;
          o = { line: f, ch: t[f].length }, n = !0;
        }
        var d = u.match(/'|"/g);
        if (d && (i += d.length), i === 2) {
          o = { line: s, ch: u.length };
          break;
        }
      }
      return [
        [e.sourcepos[0][0], e.sourcepos[0][1]],
        [e.sourcepos[0][0] + o.line, o.ch]
      ];
    }, r.prototype.parseInline = function(e) {
      var t, n = !1, i = this.peek();
      if (i === -1)
        return !1;
      switch (i) {
        case Sp:
          n = this.parseNewline(e);
          break;
        case tw:
          n = this.parseBackslash(e);
          break;
        case pfe:
          n = this.parseBackticks(e);
          break;
        case Pd:
        case uu:
        case cu:
        case Gi:
          n = this.handleDelim(i, e);
          break;
        case ji:
        case Wi:
          n = !!(!((t = this.options) === null || t === void 0) && t.smart) && this.handleDelim(i, e);
          break;
        case Zy:
          n = this.parseOpenBracket(e);
          break;
        case vfe:
          n = this.parseBang(e);
          break;
        case hfe:
          n = this.parseCloseBracket(e);
          break;
        case ew:
          n = this.parseAutolink(e) || this.parseHtmlTag(e);
          break;
        case mfe:
          e.disabledEntityParse || (n = this.parseEntity(e));
          break;
        default:
          n = this.parseString(e);
          break;
      }
      return n || (this.pos += 1, e.appendChild(it(Rd(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], Hce(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 && cfe(e.walker(), n), i && e.firstChild)
        for (var o, s = e.firstChild.walker(); o = s.next(); ) {
          var u = o.node, f = o.entering;
          i[u.type] && i[u.type](u, { entering: f, options: this.options });
        }
    }, r;
  })()
), Ife = /^\[([ \txX])\][ \t]+/;
function Rfe(r, e) {
  if (e.firstChild && e.firstChild.type === "paragraph") {
    var t = e.firstChild, n = t.stringContent.match(Ife);
    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 Pfe = {
  continue: function() {
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableHead" || r === "tableBody";
  },
  acceptsLines: !1
}, Bfe = {
  continue: function() {
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableRow";
  },
  acceptsLines: !1
}, _fe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableRow" || r === "tableDelimRow";
  },
  acceptsLines: !1
}, Hfe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableDelimCell";
  },
  acceptsLines: !1
}, Ffe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, zfe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r === "tableCell";
  },
  acceptsLines: !1
}, Vfe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, Ju = 4, eC = 9, tC = 62, qfe = 60, rC = 32, nC = 91, iC = /[^ \t\f\v\r\n]/, $fe = /^(?:`{3,}|~{3,})(?= *$)/;
function sw(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 cr(r, e) {
  return e < r.length ? r.charCodeAt(e) : -1;
}
function oC(r) {
  return !iC.test(r);
}
function ma(r) {
  return r === rC || r === eC;
}
var Ufe = /^\$\$$/, jfe = {
  continue: function(r, e) {
    var t = r.currentLine, n = t.match(Ufe);
    if (n)
      return r.lastLineLength = n[0].length, r.finalize(e, r.lineNumber), 2;
    for (var i = e.offset; i > 0 && ma(cr(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), o = t.slice(n + 1), s = i.match(/^(\s*)(.*)/);
      e.info = Os(s[2].trim()), e.literal = o, e.stringContent = null;
    }
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, aC = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, Wfe = {
  continue: function() {
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r !== "item";
  },
  acceptsLines: !1
}, Gfe = {
  continue: function() {
    return 0;
  },
  finalize: function(r, e) {
    for (var t = e.firstChild; t; ) {
      if (sw(t) && t.next) {
        e.listData.tight = !1;
        break;
      }
      for (var n = t.firstChild; n; ) {
        if (sw(n) && (t.next || n.next)) {
          e.listData.tight = !1;
          break;
        }
        n = n.next;
      }
      t = t.next;
    }
  },
  canContain: function(r) {
    return r === "item";
  },
  acceptsLines: !1
}, Kfe = {
  continue: function(r) {
    var e = r.currentLine;
    if (!r.indented && cr(e, r.nextNonspace) === tC)
      r.advanceNextNonspace(), r.advanceOffset(1, !1), ma(cr(e, r.offset)) && r.advanceOffset(1, !0);
    else
      return 1;
    return 0;
  },
  finalize: function() {
  },
  canContain: function(r) {
    return r !== "item";
  },
  acceptsLines: !1
}, Qfe = {
  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: Rfe,
  canContain: function(r) {
    return r !== "item";
  },
  acceptsLines: !1
}, Jfe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, Xfe = {
  continue: function() {
    return 1;
  },
  finalize: function() {
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !1
}, Yfe = {
  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($fe);
      if (i && i[0].length >= e.fenceLength)
        return r.lastLineLength = r.offset + n + i[0].length, r.finalize(e, r.lineNumber), 2;
      for (var o = e.fenceOffset; o > 0 && ma(cr(t, r.offset)); )
        r.advanceOffset(1, !0), o--;
    } else if (n >= Ju)
      r.advanceOffset(Ju, !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(`
`), o = n.slice(0, i), s = n.slice(i + 1), u = o.match(/^(\s*)(.*)/);
        e.infoPadding = u[1].length, e.info = Os(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
}, Zfe = {
  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
}, ede = {
  continue: function(r) {
    return r.blank ? 1 : 0;
  },
  finalize: function(r, e) {
    if (e.stringContent !== null) {
      for (var t, n = !1; cr(e.stringContent, 0) === nC && (t = r.inlineParser.parseReference(e, r.refMap)); )
        e.stringContent = e.stringContent.slice(t), n = !0;
      n && oC(e.stringContent) && e.unlink();
    }
  },
  canContain: function() {
    return !1;
  },
  acceptsLines: !0
}, tde = aC, rde = aC, Xo = {
  document: Wfe,
  list: Gfe,
  blockQuote: Kfe,
  item: Qfe,
  heading: Jfe,
  thematicBreak: Xfe,
  codeBlock: Yfe,
  htmlBlock: Zfe,
  paragraph: ede,
  table: Pfe,
  tableBody: Bfe,
  tableHead: _fe,
  tableRow: zfe,
  tableCell: Vfe,
  tableDelimRow: Hfe,
  tableDelimCell: Ffe,
  refDef: tde,
  customBlock: jfe,
  frontMatter: rde
};
function Ep(r) {
  for (var e = 0, t = 0, n = [], i = 0; i < r.length; i += 1)
    if (r[i] === "|" && r[i - 1] !== "\\") {
      var o = r.substring(e, i);
      e === 0 && Jy(o) ? t = i + 1 : n.push(o), e = i + 1;
    }
  if (e < r.length) {
    var o = r.substring(e, r.length);
    Jy(o) || n.push(o);
  }
  return [t, n];
}
function Mp(r, e, t, n) {
  for (var i = [], o = 0, s = e; o < s.length; o++) {
    var u = s[o], f = u.match(/^[ \t]+/), d = f ? f[0].length : 0, h = void 0, m = void 0;
    if (d === u.length)
      d = 0, h = 0, m = "";
    else {
      var y = u.match(/[ \t]+$/);
      h = y ? y[0].length : 0, m = u.slice(d, u.length - h);
    }
    var w = n + d, k = Qe(r, [
      [t, n],
      [t, n + u.length - 1]
    ]);
    k.stringContent = m.replace(/\\\|/g, "|"), k.startIdx = i.length, k.endIdx = i.length, k.lineOffsets = [w - 1], k.paddingLeft = d, k.paddingRight = h, i.push(k), n += u.length + 1;
  }
  return i;
}
function nde(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 ide = 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, o = t.slice(i, n), s = r.currentLine.slice(r.nextNonspace), u = Ep(o), f = u[0], d = u[1], h = Ep(s), m = h[0], y = h[1], w = /^[ \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)
      !d.length || !y.length || y.some(function(K) {
        return !w.test(K);
      }) || // to prevent to regard setTextHeading as tabel delim cell with 'disallowDeepHeading' option
      y.length === 1 && s.indexOf("|") !== 0
    )
      return 0;
    var k = e.lineOffsets, b = r.lineNumber - 1, T = Qu(k) + 1, E = Qe("table", [
      [b, T],
      [r.lineNumber, r.offset]
    ]);
    if (E.columns = y.map(function() {
      return { align: null };
    }), e.insertAfter(E), k.length === 1)
      e.unlink();
    else {
      e.stringContent = t.slice(0, i);
      var I = t.lastIndexOf(`
`, i - 2) + 1, P = i - I - 1;
      r.lastLineLength = k[k.length - 2] + P, r.finalize(e, b - 1);
    }
    r.advanceOffset(r.currentLine.length - r.offset, !1);
    var _ = Qe("tableHead", [
      [b, T],
      [r.lineNumber, r.offset]
    ]);
    E.appendChild(_);
    var V = Qe("tableRow", [
      [b, T],
      [b, T + o.length - 1]
    ]), W = Qe("tableDelimRow", [
      [r.lineNumber, r.nextNonspace + 1],
      [r.lineNumber, r.offset]
    ]);
    _.appendChild(V), _.appendChild(W), Mp("tableCell", d, b, T + f).forEach(function(K) {
      V.appendChild(K);
    });
    var q = Mp("tableDelimCell", y, r.lineNumber, r.nextNonspace + 1 + m);
    return q.forEach(function(K) {
      W.appendChild(K);
    }), E.columns = q.map(nde), r.tip = E, 2;
  }
  return 0;
}, ode = 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 = Qe("tableRow", [
    [r.lineNumber, r.nextNonspace + 1],
    [r.lineNumber, r.currentLine.length]
  ]);
  n.appendChild(i);
  var o = n.parent, s = r.currentLine.slice(r.nextNonspace), u = Ep(s), f = u[0], d = u[1];
  return Mp("tableCell", d, r.lineNumber, r.nextNonspace + 1 + f).forEach(function(h, m) {
    m >= o.columns.length && (h.ignored = !0), i.appendChild(h);
  }), 2;
}, ade = /^(\$\$)(\s*[a-zA-Z])+/, sde = /^(\$\$)(\s*[a-zA-Z])+.*(\$\$)/, lde = function(r) {
  var e;
  if (!r.indented && !sde.test(r.currentLine) && (e = r.currentLine.match(ade))) {
    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;
}, ude = /^`{3,}(?!.*`)|^~{3,}/, cde = [
  /./,
  /^<(?: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("^(?:" + Yk + "|" + Zk + ")\\s*$", "i")
], fde = /^(?:=+|-+)[ \t]*$/, dde = /^#{1,6}(?:[ \t]+|$)/, pde = /^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/, sC = /^[*+-]/, lC = /^(\d{1,9})([.)])/;
function hde(r, e) {
  var t = r.currentLine.slice(r.nextNonspace), n, i, o = {
    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(sC))
    o.type = "bullet", o.bulletChar = n[0][0];
  else if ((n = t.match(lC)) && (e.type !== "paragraph" || n[1] === "1"))
    o.type = "ordered", o.start = parseInt(n[1], 10), o.delimiter = n[2];
  else
    return null;
  if (i = cr(r.currentLine, r.nextNonspace + n[0].length), !(i === -1 || i === eC || i === rC) || e.type === "paragraph" && !r.currentLine.slice(r.nextNonspace + n[0].length).match(iC))
    return null;
  r.advanceNextNonspace(), r.advanceOffset(n[0].length, !0);
  var s = r.column, u = r.offset;
  do
    r.advanceOffset(1, !0), i = cr(r.currentLine, r.offset);
  while (r.column - s < 5 && ma(i));
  var f = cr(r.currentLine, r.offset) === -1, d = r.column - s;
  return d >= 5 || d < 1 || f ? (o.padding = n[0].length + 1, r.column = s, r.offset = u, ma(cr(r.currentLine, r.offset)) && r.advanceOffset(1, !0)) : o.padding = n[0].length + d, o;
}
function vde(r, e) {
  return r.type === e.type && r.delimiter === e.delimiter && r.bulletChar === e.bulletChar;
}
function uC(r, e) {
  return r.options.disallowDeepHeading && (e.type === "blockQuote" || e.type === "item");
}
var mde = function(r) {
  return !r.indented && cr(r.currentLine, r.nextNonspace) === tC ? (r.advanceNextNonspace(), r.advanceOffset(1, !1), ma(cr(r.currentLine, r.offset)) && r.advanceOffset(1, !0), r.closeUnmatchedBlocks(), r.addChild("blockQuote", r.nextNonspace), 1) : 0;
}, gde = function(r, e) {
  var t;
  if (!r.indented && // The nested Heading is disallowed in list and blockquote with 'disallowDeepHeading' option
  !uC(r, e) && (t = r.currentLine.slice(r.nextNonspace).match(dde))) {
    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;
}, yde = function(r) {
  var e;
  if (!r.indented && (e = r.currentLine.slice(r.nextNonspace).match(ude))) {
    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;
}, wde = function(r, e) {
  if (!r.indented && cr(r.currentLine, r.nextNonspace) === qfe) {
    var t = r.currentLine.slice(r.nextNonspace), n = r.options.disallowedHtmlBlockTags, i = void 0;
    for (i = 1; i <= 7; i++) {
      var o = t.match(cde[i]);
      if (o) {
        if (i === 7) {
          if (e.type === "paragraph")
            return 0;
          if (n.length > 0) {
            var s = new RegExp("</?(?:" + n.join("|") + ")", "i");
            if (s.test(o[0]))
              return 0;
          }
        }
        r.closeUnmatchedBlocks();
        var u = r.addChild("htmlBlock", r.offset);
        return u.htmlBlockType = i, 2;
      }
    }
  }
  return 0;
}, kde = 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
  !uC(r, e.parent) && (t = r.currentLine.slice(r.nextNonspace).match(fde))) {
    r.closeUnmatchedBlocks();
    for (var n = void 0; cr(e.stringContent, 0) === nC && (n = r.inlineParser.parseReference(e, r.refMap)); )
      e.stringContent = e.stringContent.slice(n);
    if (e.stringContent.length > 0) {
      var i = Qe("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;
}, Cde = function(r) {
  return !r.indented && pde.test(r.currentLine.slice(r.nextNonspace)) ? (r.closeUnmatchedBlocks(), r.addChild("thematicBreak", r.nextNonspace), r.advanceOffset(r.currentLine.length - r.offset, !1), 2) : 0;
}, bde = function(r, e) {
  var t, n = e;
  return (!r.indented || e.type === "list") && (t = hde(r, n)) ? (r.closeUnmatchedBlocks(), (r.tip.type !== "list" || !vde(n.listData, t)) && (n = r.addChild("list", r.nextNonspace), n.listData = t), n = r.addChild("item", r.nextNonspace), n.listData = t, 1) : 0;
}, Tde = function(r) {
  return r.indented && r.tip.type !== "paragraph" && !r.blank ? (r.advanceOffset(Ju, !0), r.closeUnmatchedBlocks(), r.addChild("codeBlock", r.offset), 2) : 0;
}, Fd = [
  mde,
  gde,
  yde,
  wde,
  kde,
  Cde,
  bde,
  Tde,
  ide,
  ode,
  lde
], cC = /^(-{3}|\+{3}|;{3})$/, xde = function(r, e) {
  var t = r.currentLine, n = r.lineNumber, i = r.indented;
  if (n === 1 && !i && e.type === "document" && cC.test(t)) {
    r.closeUnmatchedBlocks();
    var o = r.addChild("frontMatter", r.nextNonspace);
    return o.stringContent = t, r.advanceNextNonspace(), r.advanceOffset(t.length, !1), 2;
  }
  return 0;
}, Sde = {
  continue: function(r, e) {
    var t = r.currentLine, n = t.match(cC);
    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
}, Ede = [
  /./,
  /<\/(?:script|pre|style)>/i,
  /-->/,
  /\?>/,
  />/,
  /\]\]>/
], Mde = /^[#`~*+_=<>0-9-;$]/, Ode = /\r\n|\n|\r/;
function zd() {
  return Qe("document", [
    [1, 1],
    [0, 0]
  ]);
}
var Nde = {
  smart: !1,
  tagFilter: !1,
  extendedAutolinks: !1,
  disallowedHtmlBlockTags: [],
  referenceDefinition: !1,
  disallowDeepHeading: !1,
  customParser: null,
  frontMatter: !1
}, Lde = (
  /** @class */
  (function() {
    function r(e) {
      this.options = bt(bt({}, Nde), e), this.doc = zd(), 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 && (Xo.frontMatter = Sde, Fd.unshift(xde)), this.inlineParser = new Afe(this.options);
    }
    return r.prototype.advanceOffset = function(e, t) {
      t === void 0 && (t = !1);
      for (var n = this.currentLine, i, o, s; e > 0 && (s = n[this.offset]); )
        s === "	" ? (i = 4 - this.column % 4, t ? (this.partiallyConsumedTab = i > e, o = i > e ? e : i, this.column += o, this.offset += this.partiallyConsumedTab ? 0 : 1, e -= o) : (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 >= Ju;
    }, r.prototype.addLine = function() {
      if (this.partiallyConsumedTab) {
        this.offset += 1;
        var e = 4 - this.column % 4;
        this.tip.stringContent += bp(" ", 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 (; !Xo[this.tip.type].canContain(e); )
        this.finalize(this.tip, this.lineNumber - 1);
      var n = t + 1, i = Qe(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], Xo[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 o = t.node, s = t.entering, u = o.type;
        n && n[u] && n[u](o, { entering: s, options: this.options }), !s && (u === "paragraph" || u === "heading" || u === "tableCell" && !o.ignored) && this.inlineParser.parse(o);
      }
    }, 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(), Xo[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 o = t.type !== "paragraph" && Xo[t.type].acceptsLines, s = Fd.length; !o; ) {
        if (this.findNextNonspace(), t.type !== "table" && t.type !== "tableBody" && t.type !== "paragraph" && !this.indented && !Mde.test(e.slice(this.nextNonspace))) {
          this.advanceNextNonspace();
          break;
        }
        for (var u = 0; u < s; ) {
          var f = Fd[u](this, t);
          if (f === 1) {
            t = this.tip;
            break;
          } else if (f === 2) {
            t = this.tip, o = !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 d = t.type, h = this.blank && !(d === "blockQuote" || Qk(t) && t.isFenced || d === "item" && !t.firstChild && t.sourcepos[0][0] === this.lineNumber), m = t; m; )
          m.lastLineBlank = h, m = m.parent;
        Xo[d].acceptsLines ? (this.addLine(), _ce(t) && t.htmlBlockType >= 1 && t.htmlBlockType <= 5 && Ede[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 = zd(), 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(Ode), i = n.length;
      this.lines = t || n, this.options.referenceDefinition && this.clearRefMaps(), e.charCodeAt(e.length - 1) === Sp && (i -= 1);
      for (var o = 0; o < i; o++)
        this.incorporateLine(n[o]);
      for (; this.tip; )
        this.finalize(this.tip, i);
      return this.processInlines(this.doc), this.doc;
    }, r.prototype.partialParseStart = function(e, t) {
      this.doc = zd(), 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) {
        dfe(e);
      });
    }, r;
  })()
);
function lw(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 Dde(r, e) {
  var t = r[0], n = r[1];
  return lw(n, e) === 1 ? 1 : lw(t, e) === -1 ? -1 : 0;
}
function Ade(r, e) {
  if (!(r.parent !== e.parent || r === e)) {
    for (var t = r.next; t && t !== e; ) {
      for (var n = t.next, i = 0, o = ["parent", "prev", "next"]; i < o.length; i++) {
        var s = o[i];
        t[s] && (Tp(t[s].id), t[s] = null);
      }
      t = n;
    }
    r.next = e.next, e.next ? e.next.prev = r : r.parent.lastChild = r;
  }
}
function Ide(r) {
  for (var e = [], t = r.firstChild; t; )
    e.push(t), t = t.next;
  return e;
}
function uw(r, e) {
  for (var t = 0, n = e; t < n.length; t++) {
    var i = n[t];
    r.insertBefore(i);
  }
}
function Rde(r, e) {
  for (var t = e.length - 1; t >= 0; t -= 1)
    r.prependChild(e[t]);
}
function Pde(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, o = n.entering;
      o && (i.sourcepos[0][0] += e, i.sourcepos[1][0] += e);
    }
  }
}
function fC(r, e) {
  var t = r[0], n = r[1];
  return n[0] < e ? 1 : t[0] > e ? -1 : 0;
}
function fu(r, e) {
  for (var t = r.firstChild; t; ) {
    var n = fC(t.sourcepos, e);
    if (n === 0)
      return t;
    if (n === -1)
      return t.prev || t;
    t = t.next;
  }
  return r.lastChild;
}
function Bde(r) {
  for (; r.lastChild; )
    r = r.lastChild;
  return r;
}
function _de(r) {
  for (; r.parent && r.parent.type !== "document" && r.parent.sourcepos[0][0] === r.sourcepos[0][0]; )
    r = r.parent;
  return r;
}
function Hde(r, e) {
  for (var t = r.firstChild, n = null; t; ) {
    var i = fC(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 ? _de(Bde(n)) : null;
}
function Fde(r, e) {
  for (var t = r, n = null; t; ) {
    var i = Dde(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 dC(r) {
  return xce(r) || null;
}
function Vd(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 zde(r) {
  var e = dC(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 cw = /\r\n|\n|\r/;
function Vde(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 sC.test(t) || lC.test(t);
}
function qde(r) {
  return !oC(r) && r.indexOf("|") !== -1;
}
function Op(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 pC = (
  /** @class */
  (function() {
    function r(e, t) {
      this.refMap = {}, this.refLinkCandidateMap = {}, this.refDefCandidateMap = {}, this.referenceDefinition = !!t?.referenceDefinition, this.parser = new Lde(t), this.parser.setRefMaps(this.refMap, this.refLinkCandidateMap, this.refDefCandidateMap), this.eventHandlerMap = { change: [] }, e = e || "", this.lineTexts = e.split(cw), this.root = this.parser.parse(e, this.lineTexts);
    }
    return r.prototype.updateLineTexts = function(e, t, n) {
      var i, o = e[0], s = e[1], u = t[0], f = t[1], d = n.split(cw), h = d.length, m = this.lineTexts[o - 1], y = this.lineTexts[u - 1];
      d[0] = m.slice(0, s - 1) + d[0], d[h - 1] = d[h - 1] + y.slice(f - 1);
      var w = u - o + 1;
      return (i = this.lineTexts).splice.apply(i, kp([o - 1, w], d)), h - w;
    }, 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 ? (uw(e, n), Ade(e, t), [e.id, t.id].forEach(function(i) {
        return Tp(i);
      }), e.unlink()) : t ? (uw(t, n), Tp(t.id), t.unlink()) : Rde(this.root, n);
    }, r.prototype.getNodeRange = function(e, t) {
      var n = fu(this.root, e[0]), i = fu(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 && (Xy(e.prev) && Vde(this.lineTexts[n - 1]) || Fce(e.prev) && qde(this.lineTexts[n - 1])) && (e = e.prev, n = e.sourcepos[0][0]);
      for (var o = this.lineTexts.slice(n - 1, i), s = this.parser.partialParseStart(n, o), u = t ? t.next : this.root.firstChild, f = s.lastChild, d = f && Qk(f) && f.open, h = f && Jk(f) && f.open, m = f && Xy(f); (d || h) && u || m && u && (u.type === "list" || u.sourcepos[0][1] >= 2); ) {
        var y = this.extendEndLine(u.sourcepos[1][0]);
        this.parser.partialParseExtends(this.lineTexts.slice(i, y)), e || (e = t), t = u, i = y, u = u.next;
      }
      this.parser.partialParseFinish();
      var w = Ide(s);
      return { newNodes: w, extStartNode: e, extEndNode: t };
    }, r.prototype.getRemovedNodeRange = function(e, t) {
      return !e || e && Qo(e) || t && Qo(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 (!Jo(this.refMap)) {
        var i = function(o) {
          if (Qo(o)) {
            var s = n.refMap[o.label];
            s && o.id === s.id && (s.unlinked = !0);
          }
        };
        e && Vd(i, e.parent, t), t && Vd(i, t);
      }
    }, r.prototype.replaceWithNewRefDefState = function(e) {
      var t = this;
      if (!Jo(this.refMap)) {
        var n = function(i) {
          if (Qo(i)) {
            var o = i.label, s = t.refMap[o];
            (!s || s.unlinked) && (t.refMap[o] = Op(i));
          }
        };
        e.forEach(function(i) {
          Vd(n, i);
        });
      }
    }, r.prototype.replaceWithRefDefCandidate = function() {
      var e = this;
      Jo(this.refDefCandidateMap) || lu(this.refDefCandidateMap, function(t, n) {
        var i = n.label, o = n.sourcepos, s = e.refMap[i];
        (!s || s.unlinked || s.sourcepos[0][0] > o[0][0]) && (e.refMap[i] = Op(n));
      });
    }, r.prototype.getRangeWithRefDef = function(e, t, n, i, o) {
      if (this.referenceDefinition && !Jo(this.refMap)) {
        var s = fu(this.root, e - 1), u = fu(this.root, t + 1);
        s && Qo(s) && s !== n && s !== i && (n = s, e = n.sourcepos[0][0]), u && Qo(u) && u !== n && u !== i && (i = u, t = this.extendEndLine(i.sourcepos[1][0] + o));
      }
      return [n, i, e, t];
    }, r.prototype.parse = function(e, t, n) {
      n === void 0 && (n = 0);
      var i = this.getNodeRange(e, t), o = i[0], s = i[1], u = o ? Math.min(o.sourcepos[0][0], e[0]) : e[0], f = this.extendEndLine((s ? Math.max(s.sourcepos[1][0], t[0]) : t[0]) + n), d = this.parseRange.apply(this, this.getRangeWithRefDef(u, f, o, s, n)), h = d.newNodes, m = d.extStartNode, y = d.extEndNode, w = this.getRemovedNodeRange(m, y), k = y ? y.next : this.root.firstChild;
      return this.referenceDefinition ? (this.markDeletedRefMap(m, y), this.replaceRangeNodes(m, y, h), this.replaceWithNewRefDefState(h)) : this.replaceRangeNodes(m, y, h), { nodes: h, removedNodeRange: w, nextNode: k };
    }, r.prototype.parseRefLink = function() {
      var e = this, t = [];
      return Jo(this.refMap) || lu(this.refMap, function(n, i) {
        i.unlinked && delete e.refMap[n], lu(e.refLinkCandidateMap, function(o, 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() {
      Jo(this.refDefCandidateMap) || [this.refLinkCandidateMap, this.refDefCandidateMap].forEach(function(e) {
        lu(e, function(t) {
          zde(t) && delete e[t];
        });
      });
    }, r.prototype.editMarkdown = function(e, t, n) {
      var i = this.updateLineTexts(e, t, n), o = this.parse(e, t, i), s = ffe(o, "nextNode");
      Pde(o.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 = Fde(this.root, e);
      return !t || t === this.root ? null : t;
    }, r.prototype.findFirstNodeAtLine = function(e) {
      return Hde(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 dC(e);
    }, r.prototype.removeAllNode = function() {
      Sce();
    }, r;
  })()
), $de = [
  "title",
  "textarea",
  "style",
  "xmp",
  "iframe",
  "noembed",
  "noframes",
  "script",
  "plaintext"
], fw = new RegExp("<(/?(?:" + $de.join("|") + ")[^>]*>)", "ig");
function dw(r) {
  return fw.test(r) ? r.replace(fw, function(e, t) {
    return "&lt;" + t;
  }) : r;
}
var pw = {
  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, o = n.start, s = i === "bullet" ? "ul" : "ol", u = {};
    return s === "ol" && o !== null && o !== 1 && (u.start = o.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 ? dw(r.literal) : r.literal;
    return { type: "html", content: n };
  },
  htmlBlock: function(r, e) {
    var t = e.options, n = t.tagFilter ? dw(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-" + ea(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, o = n.destination;
      return {
        type: "openTag",
        tagName: "a",
        attributes: bt({ href: ea(o) }, i && { title: ea(i) })
      };
    }
    return { type: "closeTag", tagName: "a" };
  },
  image: function(r, e) {
    var t = e.getChildrenText, n = e.skipChildren, i = r, o = i.title, s = i.destination;
    return n(), {
      type: "openTag",
      tagName: "img",
      selfClose: !0,
      attributes: bt({ src: ea(s), alt: t(r) }, o && { title: ea(o) })
    };
  },
  customBlock: function(r, e, t) {
    var n = r.info.trim().toLowerCase(), i = t[n];
    if (i)
      try {
        return i(r, e);
      } catch (o) {
        console.warn("[@toast-ui/editor] - The error occurred when " + n + " block node was parsed in markdown renderer: " + o);
      }
    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, o = n.firstChild, s = i.trim().toLowerCase(), u = t[s], f = e.entering;
    if (u)
      try {
        return u(r, e);
      } catch (d) {
        console.warn("[@toast-ui/editor] - The error occurred when " + s + " inline node was parsed in markdown renderer: " + d);
      }
    return f ? [
      { type: "openTag", tagName: "span" },
      { type: "text", content: "$$" + i + (o ? " " : "") }
    ] : [
      { type: "text", content: "$$" },
      { type: "closeTag", tagName: "span" }
    ];
  }
}, hw = {
  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, o = n.task;
    if (t) {
      var s = {
        type: "openTag",
        tagName: "li",
        outerNewLine: !0
      };
      return o ? [
        s,
        {
          type: "openTag",
          tagName: "input",
          selfClose: !0,
          attributes: bt(bt({}, 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, o = r.lastChild.endIdx, s = o + 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", o = n.parent, s = o.columns[r.startIdx], u = s?.align ? { align: s.align } : null;
    return t ? bt({ type: "openTag", tagName: i, outerNewLine: !0 }, u && { attributes: u }) : {
      type: "closeTag",
      tagName: i,
      outerNewLine: !0
    };
  }
}, Ude = {
  softbreak: `
`,
  gfm: !1,
  tagFilter: !1,
  nodeId: !1
};
function jde(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 Oh = (
  /** @class */
  (function() {
    function r(e) {
      this.buffer = [], this.options = bt(bt({}, Ude), e), this.convertors = this.createConvertors(), delete this.options.convertors;
    }
    return r.prototype.createConvertors = function() {
      var e = bt({}, pw);
      if (this.options.gfm && (e = bt(bt({}, e), hw)), this.options.convertors) {
        var t = this.options.convertors, n = Object.keys(t), i = bt(bt({}, pw), hw);
        n.forEach(function(o) {
          var s = e[o], u = t[o], f = Object.keys(i).indexOf(o) === -1 ? o.toLowerCase() : o;
          s ? e[f] = function(d, h, m) {
            return h.origin = function() {
              return s(d, h, m);
            }, u(d, h);
          } : 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, o = function() {
        var u = i.node, f = i.entering, d = s.convertors[u.type];
        if (!d)
          return "continue";
        var h = !1, m = {
          entering: f,
          leaf: !Mh(u),
          options: s.options,
          getChildrenText: jde,
          skipChildren: function() {
            h = !0;
          }
        }, y = Jk(u) || zce(u) ? d(u, m, s.convertors) : d(u, m);
        if (y) {
          var w = Array.isArray(y) ? y : [y];
          w.forEach(function(k, b) {
            k.type === "openTag" && t.options.nodeId && b === 0 && (k.attributes || (k.attributes = {}), k.attributes["data-nodeid"] = String(u.id)), t.renderHTMLNode(k);
          }), h && (n.resumeAt(u, !1), n.next());
        }
      }, s = this; i = n.next(); )
        o();
      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, o = e.attributes;
      this.buffer.push("<" + n), i && i.length > 0 && this.buffer.push(' class="' + i.join(" ") + '"'), o && Object.keys(o).forEach(function(s) {
        var u = o[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 && Qu(Qu(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(ea(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 Wde(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 Gde = Object.hasOwnProperty, vw = Object.setPrototypeOf, Kde = Object.isFrozen, Qde = Object.getPrototypeOf, Jde = Object.getOwnPropertyDescriptor, Ut = Object.freeze, In = Object.seal, Xde = Object.create, hC = typeof Reflect < "u" && Reflect, Xu = hC.apply, Np = hC.construct;
Xu || (Xu = function(e, t, n) {
  return e.apply(t, n);
});
Ut || (Ut = function(e) {
  return e;
});
In || (In = function(e) {
  return e;
});
Np || (Np = function(e, t) {
  return new (Function.prototype.bind.apply(e, [null].concat(Wde(t))))();
});
var Yde = zr(Array.prototype.forEach), mw = zr(Array.prototype.pop), ds = zr(Array.prototype.push), Cu = zr(String.prototype.toLowerCase), gw = zr(String.prototype.match), ii = zr(String.prototype.replace), Zde = zr(String.prototype.indexOf), epe = zr(String.prototype.trim), xn = zr(RegExp.prototype.test), yw = tpe(TypeError);
function zr(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 Xu(r, e, n);
  };
}
function tpe(r) {
  return function() {
    for (var e = arguments.length, t = Array(e), n = 0; n < e; n++)
      t[n] = arguments[n];
    return Np(r, t);
  };
}
function me(r, e) {
  vw && vw(r, null);
  for (var t = e.length; t--; ) {
    var n = e[t];
    if (typeof n == "string") {
      var i = Cu(n);
      i !== n && (Kde(e) || (e[t] = i), n = i);
    }
    r[n] = !0;
  }
  return r;
}
function Ki(r) {
  var e = Xde(null), t = void 0;
  for (t in r)
    Xu(Gde, r, [t]) && (e[t] = r[t]);
  return e;
}
function du(r, e) {
  for (; r !== null; ) {
    var t = Jde(r, e);
    if (t) {
      if (t.get)
        return zr(t.get);
      if (typeof t.value == "function")
        return zr(t.value);
    }
    r = Qde(r);
  }
  function n(i) {
    return console.warn("fallback value for", i), null;
  }
  return n;
}
var ww = Ut(["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"]), qd = Ut(["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"]), $d = Ut(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), rpe = Ut(["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"]), Ud = Ut(["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"]), npe = Ut(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), kw = Ut(["#text"]), Cw = Ut(["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"]), jd = Ut(["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"]), bw = Ut(["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"]), pu = Ut(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), ipe = In(/\{\{[\s\S]*|[\s\S]*\}\}/gm), ope = In(/<%[\s\S]*|[\s\S]*%>/gm), ape = In(/^data-[\-\w.\u00B7-\uFFFF]/), spe = In(/^aria-[\-\w]+$/), lpe = In(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), upe = In(/^(?:\w+script|data):/i), cpe = In(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), bs = 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 Qr(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 fpe = function() {
  return typeof window > "u" ? null : window;
}, dpe = function(e, t) {
  if ((typeof e > "u" ? "undefined" : bs(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 o = "dompurify" + (n ? "#" + n : "");
  try {
    return e.createPolicy(o, {
      createHTML: function(u) {
        return u;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + o + " could not be created."), null;
  }
};
function vC() {
  var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : fpe(), e = function(L) {
    return vC(L);
  };
  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, o = r.HTMLTemplateElement, s = r.Node, u = r.Element, f = r.NodeFilter, d = r.NamedNodeMap, h = d === void 0 ? r.NamedNodeMap || r.MozNamedAttrMap : d, m = r.Text, y = r.Comment, w = r.DOMParser, k = r.trustedTypes, b = u.prototype, T = du(b, "cloneNode"), E = du(b, "nextSibling"), I = du(b, "childNodes"), P = du(b, "parentNode");
  if (typeof o == "function") {
    var _ = n.createElement("template");
    _.content && _.content.ownerDocument && (n = _.content.ownerDocument);
  }
  var V = dpe(k, t), W = V && Ei ? V.createHTML("") : "", q = n, K = q.implementation, ce = q.createNodeIterator, be = q.createDocumentFragment, Re = q.getElementsByTagName, ze = t.importNode, st = {};
  try {
    st = Ki(n).documentMode ? n.documentMode : {};
  } catch {
  }
  var je = {};
  e.isSupported = typeof P == "function" && K && typeof K.createHTMLDocument < "u" && st !== 9;
  var jt = ipe, lt = ope, _e = ape, G = spe, ue = upe, X = cpe, O = lpe, B = null, pe = me({}, [].concat(Qr(ww), Qr(qd), Qr($d), Qr(Ud), Qr(kw))), ae = null, we = me({}, [].concat(Qr(Cw), Qr(jd), Qr(bw), Qr(pu))), ge = null, Oe = null, Ee = !0, Ae = !0, Mt = !1, Er = !1, an = !1, Bn = !1, xi = !1, sn = !1, Si = !1, go = !0, Ei = !1, yo = !0, ln = !0, fr = !1, Vr = {}, un = null, ba = me({}, ["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"]), Ta = null, xa = me({}, ["audio", "video", "img", "source", "image", "track"]), Mi = null, Oi = me({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), wo = "http://www.w3.org/1998/Math/MathML", cn = "http://www.w3.org/2000/svg", Wt = "http://www.w3.org/1999/xhtml", ko = Wt, Co = !1, fn = void 0, xc = ["application/xhtml+xml", "text/html"], Sa = "text/html", qr = void 0, $r = null, Ea = n.createElement("form"), Ni = function(L) {
    $r && $r === L || ((!L || (typeof L > "u" ? "undefined" : bs(L)) !== "object") && (L = {}), L = Ki(L), B = "ALLOWED_TAGS" in L ? me({}, L.ALLOWED_TAGS) : pe, ae = "ALLOWED_ATTR" in L ? me({}, L.ALLOWED_ATTR) : we, Mi = "ADD_URI_SAFE_ATTR" in L ? me(Ki(Oi), L.ADD_URI_SAFE_ATTR) : Oi, Ta = "ADD_DATA_URI_TAGS" in L ? me(Ki(xa), L.ADD_DATA_URI_TAGS) : xa, un = "FORBID_CONTENTS" in L ? me({}, L.FORBID_CONTENTS) : ba, ge = "FORBID_TAGS" in L ? me({}, L.FORBID_TAGS) : {}, Oe = "FORBID_ATTR" in L ? me({}, L.FORBID_ATTR) : {}, Vr = "USE_PROFILES" in L ? L.USE_PROFILES : !1, Ee = L.ALLOW_ARIA_ATTR !== !1, Ae = L.ALLOW_DATA_ATTR !== !1, Mt = L.ALLOW_UNKNOWN_PROTOCOLS || !1, Er = L.SAFE_FOR_TEMPLATES || !1, an = L.WHOLE_DOCUMENT || !1, sn = L.RETURN_DOM || !1, Si = L.RETURN_DOM_FRAGMENT || !1, go = L.RETURN_DOM_IMPORT !== !1, Ei = L.RETURN_TRUSTED_TYPE || !1, xi = L.FORCE_BODY || !1, yo = L.SANITIZE_DOM !== !1, ln = L.KEEP_CONTENT !== !1, fr = L.IN_PLACE || !1, O = L.ALLOWED_URI_REGEXP || O, ko = L.NAMESPACE || Wt, fn = // eslint-disable-next-line unicorn/prefer-includes
    xc.indexOf(L.PARSER_MEDIA_TYPE) === -1 ? fn = Sa : fn = L.PARSER_MEDIA_TYPE, qr = fn === "application/xhtml+xml" ? function(j) {
      return j;
    } : Cu, Er && (Ae = !1), Si && (sn = !0), Vr && (B = me({}, [].concat(Qr(kw))), ae = [], Vr.html === !0 && (me(B, ww), me(ae, Cw)), Vr.svg === !0 && (me(B, qd), me(ae, jd), me(ae, pu)), Vr.svgFilters === !0 && (me(B, $d), me(ae, jd), me(ae, pu)), Vr.mathMl === !0 && (me(B, Ud), me(ae, bw), me(ae, pu))), L.ADD_TAGS && (B === pe && (B = Ki(B)), me(B, L.ADD_TAGS)), L.ADD_ATTR && (ae === we && (ae = Ki(ae)), me(ae, L.ADD_ATTR)), L.ADD_URI_SAFE_ATTR && me(Mi, L.ADD_URI_SAFE_ATTR), L.FORBID_CONTENTS && (un === ba && (un = Ki(un)), me(un, L.FORBID_CONTENTS)), ln && (B["#text"] = !0), an && me(B, ["html", "head", "body"]), B.table && (me(B, ["tbody"]), delete ge.tbody), Ut && Ut(L), $r = L);
  }, dn = me({}, ["mi", "mo", "mn", "ms", "mtext"]), pn = me({}, ["foreignobject", "desc", "title", "annotation-xml"]), Li = me({}, qd);
  me(Li, $d), me(Li, rpe);
  var bo = me({}, Ud);
  me(bo, npe);
  var Ws = function(L) {
    var j = P(L);
    (!j || !j.tagName) && (j = {
      namespaceURI: Wt,
      tagName: "template"
    });
    var ne = Cu(L.tagName), ye = Cu(j.tagName);
    if (L.namespaceURI === cn)
      return j.namespaceURI === Wt ? ne === "svg" : j.namespaceURI === wo ? ne === "svg" && (ye === "annotation-xml" || dn[ye]) : !!Li[ne];
    if (L.namespaceURI === wo)
      return j.namespaceURI === Wt ? ne === "math" : j.namespaceURI === cn ? ne === "math" && pn[ye] : !!bo[ne];
    if (L.namespaceURI === Wt) {
      if (j.namespaceURI === cn && !pn[ye] || j.namespaceURI === wo && !dn[ye])
        return !1;
      var et = me({}, ["title", "style", "font", "a", "script"]);
      return !bo[ne] && (et[ne] || !Li[ne]);
    }
    return !1;
  }, dr = function(L) {
    ds(e.removed, { element: L });
    try {
      L.parentNode.removeChild(L);
    } catch {
      try {
        L.outerHTML = W;
      } catch {
        L.remove();
      }
    }
  }, Ma = function(L, j) {
    try {
      ds(e.removed, {
        attribute: j.getAttributeNode(L),
        from: j
      });
    } catch {
      ds(e.removed, {
        attribute: null,
        from: j
      });
    }
    if (j.removeAttribute(L), L === "is" && !ae[L])
      if (sn || Si)
        try {
          dr(j);
        } catch {
        }
      else
        try {
          j.setAttribute(L, "");
        } catch {
        }
  }, To = function(L) {
    var j = void 0, ne = void 0;
    if (xi)
      L = "<remove></remove>" + L;
    else {
      var ye = gw(L, /^[\r\n\t ]+/);
      ne = ye && ye[0];
    }
    fn === "application/xhtml+xml" && (L = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + L + "</body></html>");
    var et = V ? V.createHTML(L) : L;
    if (ko === Wt)
      try {
        j = new w().parseFromString(et, fn);
      } catch {
      }
    if (!j || !j.documentElement) {
      j = K.createDocument(ko, "template", null);
      try {
        j.documentElement.innerHTML = Co ? "" : et;
      } catch {
      }
    }
    var tt = j.body || j.documentElement;
    return L && ne && tt.insertBefore(n.createTextNode(ne), tt.childNodes[0] || null), ko === Wt ? Re.call(j, an ? "html" : "body")[0] : an ? j.documentElement : tt;
  }, Oa = function(L) {
    return ce.call(L.ownerDocument || L, L, f.SHOW_ELEMENT | f.SHOW_COMMENT | f.SHOW_TEXT, null, !1);
  }, Di = function(L) {
    return L instanceof m || L instanceof y ? !1 : typeof L.nodeName != "string" || typeof L.textContent != "string" || typeof L.removeChild != "function" || !(L.attributes instanceof h) || typeof L.removeAttribute != "function" || typeof L.setAttribute != "function" || typeof L.namespaceURI != "string" || typeof L.insertBefore != "function";
  }, hn = function(L) {
    return (typeof s > "u" ? "undefined" : bs(s)) === "object" ? L instanceof s : L && (typeof L > "u" ? "undefined" : bs(L)) === "object" && typeof L.nodeType == "number" && typeof L.nodeName == "string";
  }, Ht = function(L, j, ne) {
    je[L] && Yde(je[L], function(ye) {
      ye.call(e, j, ne, $r);
    });
  }, Gs = function(L) {
    var j = void 0;
    if (Ht("beforeSanitizeElements", L, null), Di(L) || gw(L.nodeName, /[\u0080-\uFFFF]/))
      return dr(L), !0;
    var ne = qr(L.nodeName);
    if (Ht("uponSanitizeElement", L, {
      tagName: ne,
      allowedTags: B
    }), !hn(L.firstElementChild) && (!hn(L.content) || !hn(L.content.firstElementChild)) && xn(/<[/\w]/g, L.innerHTML) && xn(/<[/\w]/g, L.textContent) || ne === "select" && xn(/<template/i, L.innerHTML))
      return dr(L), !0;
    if (!B[ne] || ge[ne]) {
      if (ln && !un[ne]) {
        var ye = P(L) || L.parentNode, et = I(L) || L.childNodes;
        if (et && ye)
          for (var tt = et.length, ut = tt - 1; ut >= 0; --ut)
            ye.insertBefore(T(et[ut], !0), E(L));
      }
      return dr(L), !0;
    }
    return L instanceof u && !Ws(L) || (ne === "noscript" || ne === "noembed") && xn(/<\/no(script|embed)/i, L.innerHTML) ? (dr(L), !0) : (Er && L.nodeType === 3 && (j = L.textContent, j = ii(j, jt, " "), j = ii(j, lt, " "), L.textContent !== j && (ds(e.removed, { element: L.cloneNode() }), L.textContent = j)), Ht("afterSanitizeElements", L, null), !1);
  }, _n = function(L, j, ne) {
    if (yo && (j === "id" || j === "name") && (ne in n || ne in Ea))
      return !1;
    if (!(Ae && !Oe[j] && xn(_e, j))) {
      if (!(Ee && xn(G, j))) {
        if (!ae[j] || Oe[j])
          return !1;
        if (!Mi[j]) {
          if (!xn(O, ii(ne, X, ""))) {
            if (!((j === "src" || j === "xlink:href" || j === "href") && L !== "script" && Zde(ne, "data:") === 0 && Ta[L])) {
              if (!(Mt && !xn(ue, ii(ne, X, "")))) {
                if (ne) return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, Ai = function(L) {
    var j = void 0, ne = void 0, ye = void 0, et = void 0;
    Ht("beforeSanitizeAttributes", L, null);
    var tt = L.attributes;
    if (tt) {
      var ut = {
        attrName: "",
        attrValue: "",
        keepAttr: !0,
        allowedAttributes: ae
      };
      for (et = tt.length; et--; ) {
        j = tt[et];
        var pr = j, Hn = pr.name, Na = pr.namespaceURI;
        if (ne = epe(j.value), ye = qr(Hn), ut.attrName = ye, ut.attrValue = ne, ut.keepAttr = !0, ut.forceKeepAttr = void 0, Ht("uponSanitizeAttribute", L, ut), ne = ut.attrValue, !ut.forceKeepAttr && (Ma(Hn, L), !!ut.keepAttr)) {
          if (xn(/\/>/i, ne)) {
            Ma(Hn, L);
            continue;
          }
          Er && (ne = ii(ne, jt, " "), ne = ii(ne, lt, " "));
          var Ks = qr(L.nodeName);
          if (_n(Ks, ye, ne))
            try {
              Na ? L.setAttributeNS(Na, Hn, ne) : L.setAttribute(Hn, ne), mw(e.removed);
            } catch {
            }
        }
      }
      Ht("afterSanitizeAttributes", L, null);
    }
  }, xo = function oe(L) {
    var j = void 0, ne = Oa(L);
    for (Ht("beforeSanitizeShadowDOM", L, null); j = ne.nextNode(); )
      Ht("uponSanitizeShadowNode", j, null), !Gs(j) && (j.content instanceof i && oe(j.content), Ai(j));
    Ht("afterSanitizeShadowDOM", L, null);
  };
  return e.sanitize = function(oe, L) {
    var j = void 0, ne = void 0, ye = void 0, et = void 0, tt = void 0;
    if (Co = !oe, Co && (oe = "<!-->"), typeof oe != "string" && !hn(oe)) {
      if (typeof oe.toString != "function")
        throw yw("toString is not a function");
      if (oe = oe.toString(), typeof oe != "string")
        throw yw("dirty is not a string, aborting");
    }
    if (!e.isSupported) {
      if (bs(r.toStaticHTML) === "object" || typeof r.toStaticHTML == "function") {
        if (typeof oe == "string")
          return r.toStaticHTML(oe);
        if (hn(oe))
          return r.toStaticHTML(oe.outerHTML);
      }
      return oe;
    }
    if (Bn || Ni(L), e.removed = [], typeof oe == "string" && (fr = !1), !fr) if (oe instanceof s)
      j = To("<!---->"), ne = j.ownerDocument.importNode(oe, !0), ne.nodeType === 1 && ne.nodeName === "BODY" || ne.nodeName === "HTML" ? j = ne : j.appendChild(ne);
    else {
      if (!sn && !Er && !an && // eslint-disable-next-line unicorn/prefer-includes
      oe.indexOf("<") === -1)
        return V && Ei ? V.createHTML(oe) : oe;
      if (j = To(oe), !j)
        return sn ? null : W;
    }
    j && xi && dr(j.firstChild);
    for (var ut = Oa(fr ? oe : j); ye = ut.nextNode(); )
      ye.nodeType === 3 && ye === et || Gs(ye) || (ye.content instanceof i && xo(ye.content), Ai(ye), et = ye);
    if (et = null, fr)
      return oe;
    if (sn) {
      if (Si)
        for (tt = be.call(j.ownerDocument); j.firstChild; )
          tt.appendChild(j.firstChild);
      else
        tt = j;
      return go && (tt = ze.call(t, tt, !0)), tt;
    }
    var pr = an ? j.outerHTML : j.innerHTML;
    return Er && (pr = ii(pr, jt, " "), pr = ii(pr, lt, " ")), V && Ei ? V.createHTML(pr) : pr;
  }, e.setConfig = function(oe) {
    Ni(oe), Bn = !0;
  }, e.clearConfig = function() {
    $r = null, Bn = !1;
  }, e.isValidAttribute = function(oe, L, j) {
    $r || Ni({});
    var ne = qr(oe), ye = qr(L);
    return _n(ne, ye, j);
  }, e.addHook = function(oe, L) {
    typeof L == "function" && (je[oe] = je[oe] || [], ds(je[oe], L));
  }, e.removeHook = function(oe) {
    je[oe] && mw(je[oe]);
  }, e.removeHooks = function(oe) {
    je[oe] && (je[oe] = []);
  }, e.removeAllHooks = function() {
    je = {};
  }, e;
}
var ppe = vC(), hpe = ["iframe", "embed"], mC = [];
function gC(r) {
  Et(hpe, r) && mC.push(r.toLowerCase());
}
function mo(r, e) {
  return ppe.sanitize(r, R({ ADD_TAGS: mC, ADD_ATTR: ["rel", "target", "hreflang", "type"], FORBID_TAGS: [
    "input",
    "script",
    "textarea",
    "form",
    "button",
    "select",
    "meta",
    "style",
    "link",
    "title",
    "object",
    "base"
  ] }, e));
}
function yC(r, e) {
  return r.literal.replace(new RegExp("(<\\s*" + e + "[^>]*>)|(</" + e + "\\s*[>])", "ig"), "").trim();
}
function Lp(r) {
  r = r.match(pa)[0];
  var e = r.match(new RegExp(pk, "g"));
  return e ? e.reduce(function(t, n) {
    var i = n.trim().split("="), o = i[0], s = i.slice(1);
    return s.length && (t[o] = s.join("=").replace(/'|"/g, "").trim()), t;
  }, {}) : {};
}
function Dp(r) {
  return on(r.attributes).reduce(function(e, t) {
    return e[t.nodeName] = t.nodeValue, e;
  }, {});
}
function Tw(r, e, t, n) {
  var i = n.getToDOMNode(e)(r), o = t(i.outerHTML), s = document.createElement("div");
  s.innerHTML = o, i = s.firstChild;
  var u = Dp(i);
  return { dom: i, htmlAttrs: u };
}
var vpe = {
  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: Dp(n),
              childrenHTML: n.innerHTML
            };
          }
        }
      ],
      toDOM: function(n) {
        var i = Tw(n, r, e, t), o = i.dom, s = i.htmlAttrs;
        return s.class = s.class ? s.class + " html-block" : "html-block", rr([r, s], on(o.childNodes));
      }
    };
  },
  htmlInline: function(r, e, t) {
    return {
      attrs: {
        htmlAttrs: { default: {} },
        htmlInline: { default: !0 }
      },
      parseDOM: [
        {
          tag: r,
          getAttrs: function(n) {
            return {
              htmlAttrs: Dp(n)
            };
          }
        }
      ],
      toDOM: function(n) {
        var i = Tw(n, r, e, t).htmlAttrs;
        return [r, i, 0];
      }
    };
  }
};
function mpe(r, e, t) {
  var n = { nodes: {}, marks: {} };
  return ["htmlBlock", "htmlInline"].forEach(function(i) {
    r[i] && Object.keys(r[i]).forEach(function(o) {
      var s = i === "htmlBlock" ? "nodes" : "marks";
      gC(o), n[s][o] = vpe[i](o, e, t);
    });
  }), n;
}
var gpe = /^\s*<\s*\//, ype = {
  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+/) : [], o = [], s = {};
    if (t > 3 && (s["data-backticks"] = t), i.length > 0 && i[0].length > 0) {
      var u = i[0];
      o.push("lang-" + u), s["data-language"] = u;
    }
    return [
      { type: "openTag", tagName: "pre", classNames: o },
      { 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, o = r.info;
    if (o.indexOf("widget") !== -1 && n) {
      i();
      var s = uk(r), u = lk(o, s).outerHTML;
      return [
        { type: "openTag", tagName: "span", classNames: ["tui-widget"] },
        { type: "html", content: u },
        { type: "closeTag", tagName: "span" }
      ];
    }
    return t();
  }
};
function Nh(r, e) {
  var t = R({}, ype);
  return r && (t.link = function(n, i) {
    var o = i.entering, s = i.origin, u = s();
    return o && (u.attributes = R(R({}, u.attributes), r)), u;
  }), e && Object.keys(e).forEach(function(n) {
    var i = t[n], o = e[n];
    i && xr(o) ? t[n] = function(s, u) {
      var f = R({}, u);
      return f.origin = function() {
        return i(s, u);
      }, o(s, f);
    } : Et(["htmlBlock", "htmlInline"], n) && !xr(o) ? t[n] = function(s, u) {
      var f = s.literal.match(pa);
      if (f) {
        var d = f[0], h = f[1], m = f[3], y = (h || m).toLowerCase(), w = o[y], k = yC(s, y);
        if (w) {
          var b = R({}, s);
          return b.attrs = Lp(d), b.childrenHTML = k, b.type = y, u.entering = !gpe.test(s.literal), w(b, u);
        }
      }
      return u.origin();
    } : t[n] = o;
  }), t;
}
var wpe = ["list", "item", "blockQuote"], kpe = ["UL", "OL", "BLOCKQUOTE"];
function Cpe(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 xw(r, e, t) {
  var n = Us(e) - 1, i = dc(e) - 1, o = t[n].getBoundingClientRect(), s = t[i].offsetTop - t[n].offsetTop + t[i].clientHeight;
  return {
    height: s <= 0 ? t[n].clientHeight : s + bpe(r, t, Math.min(i + 1, r.childCount - 1)),
    rect: o
  };
}
function bpe(r, e, t) {
  for (var n = r.childCount - 1, i = 0; t <= n && Cpe(r, t); )
    i += e[t].clientHeight, t += 1;
  return i;
}
function Tpe(r, e) {
  for (; !r.getAttribute("data-nodeid") && r.parentElement !== e; )
    r = r.parentElement;
  return r;
}
function Yu(r, e) {
  for (var t = 0; r && r !== e && (Et(kpe, r.tagName) || (t += r.offsetTop), r.offsetParent !== e.offsetParent); )
    r = r.parentElement;
  return t;
}
function xpe(r, e) {
  for (var t = e, n = null; t; ) {
    var i = t.firstElementChild;
    if (!i)
      break;
    var o = wC(i, r, Yu(t, e));
    n = t, t = o;
  }
  var s = t || n;
  return s === e ? null : s;
}
function wC(r, e, t) {
  return r && e > t + r.offsetTop ? wC(r.nextElementSibling, e, t) || r : null;
}
function Spe(r, e, t, n) {
  var i = Math.min((r - e) / t, 1);
  return i * n;
}
function Wd(r, e) {
  for (var t = r.querySelector('[data-nodeid="' + e.id + '"]'); !t || pO(e); )
    e = e.parent, t = r.querySelector('[data-nodeid="' + e.id + '"]');
  return Epe({ mdNode: e, el: t });
}
function Epe(r) {
  for (var e = r.mdNode, t = r.el; (Et(wpe, e.type) || e.type === "table") && e.firstChild; )
    e = e.firstChild, t = t.firstElementChild;
  return { mdNode: e, el: t };
}
var _r = {};
function Mpe(r, e) {
  _r[r] = _r[r] || {}, _r[r].height = e;
}
function Ope(r, e) {
  _r[r] = _r[r] || {}, _r[r].offsetTop = e;
}
function Npe(r) {
  return _r[r] && _r[r].height;
}
function Lpe(r) {
  return _r[r] && _r[r].offsetTop;
}
function Ap(r) {
  r && (delete _r[Number(r.getAttribute("data-nodeid"))], on(r.children).forEach(function(e) {
    Ap(e);
  }));
}
function Dpe(r, e, t) {
  var n = Npe(t), i = Lpe(t), o = n || r.clientHeight, s = i || Yu(r, e) || r.offsetTop;
  return n || Mpe(t, o), i || Ope(t, s), { nodeHeight: o, offsetTop: s };
}
var Gd = re("md-preview-highlight");
function Ape(r, e) {
  for (var t = r.firstChild; t && t.next && !(pc(t.next) > e + 1); )
    t = t.next;
  return t;
}
var kC = (
  /** @class */
  (function() {
    function r(e, t) {
      var n = document.createElement("div");
      this.el = n, this.eventEmitter = e, this.isViewer = !!t.isViewer, this.el.className = re("md-preview");
      var i = t.linkAttributes, o = t.customHTMLRenderer, s = t.sanitizer, u = t.highlight, f = u === void 0 ? !1 : u;
      this.renderer = new Oh({
        gfm: !0,
        nodeId: !0,
        convertors: Nh(i, o)
      }), 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 = yk('<div class="' + re("contents") + '"></div>'), this.isViewer || this.el.appendChild(this.previewContent);
    }, r.prototype.toggleActive = function(e) {
      hh(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, o = n.cursorPos;
        t.updateCursorNode(i, o);
      }), this.eventEmitter.listen("blur", function() {
        t.removeHighlight();
      })), Pk(this.el, "scroll", function(n) {
        t.eventEmitter.emit("scroll", "preview", xpe(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 && Br(e, Gd);
      }
    }, r.prototype.updateCursorNode = function(e, t) {
      e && (e = da(e, function(s) {
        return !mO(s);
      }), e.type === "tableRow" ? e = Ape(e, t[1]) : e.type === "tableBody" && (e = null));
      var n = e ? e.id : null;
      if (this.cursorNodeId !== n) {
        var i = this.getElementByNodeId(this.cursorNodeId), o = this.getElementByNodeId(n);
        i && Br(i, Gd), o && Zr(o, Gd), 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, o = this.previewContent, s = this.eventEmitter.emitReduce("beforePreviewRender", this.sanitizer(n.map(function(k) {
        return t.renderer.render(k);
      }).join("")));
      if (!i)
        o.insertAdjacentHTML("afterbegin", s);
      else {
        var u = i.id, f = u[0], d = u[1], h = this.getElementByNodeId(f), m = this.getElementByNodeId(d);
        if (h) {
          h.insertAdjacentHTML("beforebegin", s);
          for (var y = h; y && y !== m; ) {
            var w = y.nextElementSibling;
            po(y), Ap(y), y = w;
          }
          y?.parentNode && (po(y), Ap(y));
        }
      }
    }, r.prototype.getRenderer = function() {
      return this.renderer;
    }, r.prototype.destroy = function() {
      Rk(this.el, "scroll"), this.el = null;
    }, r.prototype.getElement = function() {
      return this.el;
    }, r.prototype.getHTML = function() {
      return gh(this.previewContent.innerHTML);
    }, r.prototype.setHTML = function(e) {
      this.previewContent.innerHTML = e;
    }, r.prototype.setHeight = function(e) {
      nn(this.el, { height: e + "px" });
    }, r.prototype.setMinHeight = function(e) {
      nn(this.el, { minHeight: e + "px" });
    }, r;
  })()
);
function Nn(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 ga(r) {
  return !!Nn(r, function(e) {
    var t = e.type;
    return t.name === "listItem" || t.name === "bulletList" || t.name === "orderedList";
  });
}
function Zu(r) {
  return !!Nn(r, function(e) {
    var t = e.type;
    return t.name === "tableHeadCell" || t.name === "tableBodyCell";
  });
}
function ya(r) {
  return Nn(r, function(e) {
    var t = e.type;
    return t.name === "listItem";
  });
}
function bc(r) {
  return {
    tag: r,
    getAttrs: function(e) {
      var t = e.getAttribute("data-raw-html");
      return R({}, t && { rawHTML: t });
    }
  };
}
function CC(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 bC(r) {
  return {
    tag: r,
    getAttrs: function(e) {
      return ["rawHTML", "colspan", "rowspan", "extended"].reduce(function(t, n) {
        var i = n === "rawHTML" ? "data-raw-html" : n, o = e.getAttribute(i);
        return o && (t[n] = Et(["rawHTML", "extended"], n) ? o : Number(o)), t;
      }, {});
    }
  };
}
function gt() {
  return {
    htmlAttrs: { default: null },
    classNames: { default: null }
  };
}
function Ze(r) {
  var e = r.htmlAttrs, t = r.classNames;
  return R(R({}, e), { class: t ? t.join(" ") : null });
}
function Ipe(r, e) {
  var t = r.parent, n = r.startIndex, i = r.endIndex, o = t.contentMatchAt(n).findWrapping(e);
  if (o) {
    var s = o.length ? o[0] : e;
    return t.canReplaceWith(n, i, s) ? o : null;
  }
  return null;
}
function Rpe(r, e) {
  var t = r.parent, n = r.startIndex, i = r.endIndex, o = t.child(n), s = e.contentMatch.findWrapping(o.type);
  if (s) {
    for (var u = s.length ? s[s.length - 1] : e, f = u.contentMatch, d = n; f && d < i; d += 1)
      f = f.matchType(t.child(d).type);
    if (f && f.validEnd)
      return s;
  }
  return null;
}
function Ppe(r, e, t, n) {
  var i = Ipe(r, t), o = Rpe(e, t);
  if (i && o) {
    var s = i.map(function(f) {
      return { type: f };
    }), u = o.map(function(f) {
      return { type: f, attrs: n };
    });
    return s.concat({ type: t }).concat(u);
  }
  return null;
}
function Bpe(r, e, t, n, i) {
  for (var o = e.start, s = e.end, u = e.startIndex, f = e.endIndex, d = e.parent, h = F.empty, m = t.length - 1; m >= 0; m -= 1)
    h = F.from(t[m].type.create(t[m].attrs, h));
  r.step(new vt(o - (n ? 2 : 0), s, o, s, new Q(h, 0, 0), t.length, !0));
  for (var y = 0, m = 0; m < t.length; m += 1)
    if (t[m].type === i) {
      y = m + 1;
      break;
    }
  for (var w = t.length - y, k = o + t.length - (n ? 2 : 0), m = u, b = f; m < b; m += 1) {
    var T = m === u;
    !T && na(r.doc, k, w) && (r.split(k, w), k += w * 2), k += d.child(m).nodeSize;
  }
  return r;
}
function TC(r, e, t, n) {
  var i = e.$from, o = 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 d = r.doc.resolve(e.start - 2);
    u = new Lu(d, d, s), e.endIndex < e.parent.childCount && (e = new Lu(i, r.doc.resolve(o.end(s)), s)), f = !0;
  }
  var h = Ppe(u, e, t, n);
  return h ? Bpe(r, e, h, f, t) : r;
}
function xC(r, e) {
  for (var t = r.resolve(e); t.node().type.name !== "paragraph"; )
    e -= 2, t = r.resolve(e);
  return ya(t);
}
function _pe(r, e) {
  var t = e.$from, n = e.$to, i = ya(t), o = ya(n);
  if (i && o)
    for (; o; ) {
      var s = o.offset, u = o.node, f = { task: !u.attrs.task, checked: !1 };
      if (r.setNodeMarkup(s, null, f), s === i.offset)
        break;
      o = xC(r.doc, s);
    }
  return r;
}
function Hpe(r, e, t) {
  var n = e.$from, i = e.$to, o = ya(n), s = ya(i);
  if (o && s)
    for (; s; ) {
      var u = s.offset, f = s.node, d = s.depth;
      f.attrs.task && r.setNodeMarkup(u, null, { task: !1, checked: !1 });
      var h = r.doc.resolve(u);
      if (h.parent.type !== t) {
        var m = h.before(d - 1);
        r.setNodeMarkup(m, t);
      }
      if (u === o.offset)
        break;
      s = xC(r.doc, u);
    }
  return r;
}
function SC(r) {
  return function(e, t) {
    var n = e.selection, i = e.tr, o = n.$from, s = n.$to, u = o.blockRange(s);
    if (u) {
      var f = ga(o) ? Hpe(i, u, r) : TC(i, u, r);
      return t(f), !0;
    }
    return !1;
  };
}
function Fpe() {
  return function(r, e) {
    var t = r.selection, n = r.tr, i = r.schema, o = t.$from, s = t.$to, u = o.blockRange(s);
    if (u) {
      var f = ga(o) ? _pe(n, u) : TC(n, u, i.nodes.bulletList, { task: !0 });
      return e(f), !0;
    }
    return !1;
  };
}
function zpe(r) {
  return function(e, t) {
    var n = e.tr, i = e.selection, o = i.$from, s = i.$to, u = o.blockRange(s, function(b) {
      var T = b.childCount, E = b.firstChild;
      return !!T && E.type === r;
    });
    if (u && u.startIndex > 0) {
      var f = u.parent, d = f.child(u.startIndex - 1);
      if (d.type !== r)
        return !1;
      var h = d.lastChild && d.lastChild.type === f.type, m = h ? F.from(r.create()) : null, y = new Q(F.from(r.create(null, F.from(f.type.create(null, m)))), h ? 3 : 1, 0), w = u.start, k = u.end;
      return n.step(new vt(w - (h ? 3 : 1), k, w, k, y, 1, !0)), t(n), !0;
    }
    return !1;
  };
}
function Vpe(r, e, t) {
  var n = e.$from, i = e.$to, o = e.end, s = e.depth, u = e.parent, f = i.end(s);
  return o < f && (r.step(new vt(o - 1, f, o, f, new Q(F.from(t.create(null, u.copy())), 1, 0), 1, !0)), e = new Lu(r.doc.resolve(n.pos), r.doc.resolve(f), s)), r.lift(e, ic(e)), r;
}
function qpe(r, e) {
  for (var t = e.parent, n = e.end, i = e.endIndex - 1, o = e.startIndex; i > o; 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, d = e.endIndex === t.childCount, h = s.node(-1), m = s.index(-1), y = h.canReplace(m + (f ? 0 : 1), m + 1, u?.content.append(d ? F.empty : F.from(t)));
  if (u && y) {
    var w = s.pos, k = w + u.nodeSize;
    r.step(new vt(w - (f ? 1 : 0), k + (d ? 1 : 0), w + 1, k - 1, new Q((f ? F.empty : F.from(t.copy(F.empty))).append(d ? F.empty : F.from(t.copy(F.empty))), f ? 0 : 1, d ? 0 : 1), f ? 0 : 1));
  }
  return r;
}
function $pe(r) {
  return function(e, t) {
    var n = e.tr, i = e.selection, o = i.$from, s = i.$to, u = o.blockRange(s, function(h) {
      var m = h.childCount, y = h.firstChild;
      return !!m && y.type === r;
    });
    if (u) {
      var f = o.node(u.depth - 1).type === r, d = f ? Vpe(n, u, r) : qpe(n, u);
      return t(d), !0;
    }
    return !1;
  };
}
function Upe(r) {
  return function(e, t) {
    var n = e.tr, i = e.selection, o = i.$from, s = i.$to;
    if (o.depth < 2 || !o.sameParent(s))
      return !1;
    var u = o.node(-1);
    if (u.type !== r)
      return !1;
    if (o.parent.content.size === 0 && o.node(-1).childCount === o.indexAfter(-1)) {
      if (o.depth === 2 || o.node(-3).type !== r || o.index(-2) !== o.node(-2).childCount - 1)
        return !1;
      for (var f = o.index(-1) > 0, d = F.empty, h = o.depth - (f ? 1 : 2); h >= o.depth - 3; h -= 1)
        d = F.from(o.node(h).copy(d));
      return d = d.append(F.from(r.createAndFill())), n.replace(f ? o.before() : o.before(-1), o.after(-3), new Q(d, f ? 3 : 2, 2)), n.setSelection(ke.near(n.doc.resolve(o.pos + (f ? 3 : 2)))), t(n), !0;
    }
    var m = s.pos === o.end() ? u.contentMatchAt(0).defaultType : null, y = m && [null, { type: m }];
    return n.delete(o.pos, s.pos), na(n.doc, o.pos, 2, y) ? (n.split(o.pos, 2, y), t(n), !0) : !1;
  };
}
function jpe() {
  return function() {
    return function(r, e) {
      var t = r.selection, n = r.schema, i = t.$from, o = t.$to, s = i.blockRange(o);
      return s && ga(i) ? zpe(n.nodes.listItem)(r, e) : !1;
    };
  };
}
function Wpe() {
  return function() {
    return function(r, e) {
      var t = r.selection, n = r.schema, i = t.$from, o = t.$to, s = i.blockRange(o);
      return s && ga(i) ? $pe(n.nodes.listItem)(r, e) : !1;
    };
  };
}
function Lh() {
  return {
    indent: jpe(),
    outdent: Wpe()
  };
}
var Sw = /* @__PURE__ */ new Map(), Ct = (
  /** @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 = Nn(e, function(k) {
        var b = k.type;
        return b.name === "table";
      });
      if (t) {
        var n = t.node, i = t.depth, o = t.offset, s = Sw.get(n);
        if (s?.tableStartPos === o + 1)
          return s;
        var u = [], f = e.start(i), d = n.child(0), h = n.child(1), m = Ip(d, f), y = Ip(h, f + d.nodeSize);
        d.forEach(function(k) {
          return u.push(k);
        }), h.forEach(function(k) {
          return u.push(k);
        });
        var w = new r(n, u, f, m.concat(y));
        return Sw.set(n, w), w;
      }
      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 o = 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 ? o : this.rowInfo[n][s].offset;
        }
        i = o;
      }
    }, 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, o = n.nodeSize;
      return this.extendedRowspan(e, t) ? this.posAt(e, t) : i + o;
    }, 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, o;
      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], d = this.getCellIndex(t), h = d[0], m = d[1];
      return i = Ey(u, h), u = i[0], h = i[1], o = Ey(f, m), f = o[0], m = o[1], this.getSpannedOffsets({ startRowIdx: u, startColIdx: f, endRowIdx: h, endColIdx: m });
    }, r.prototype.getSpannedOffsets = function(e) {
      return e;
    }, r;
  })()
), Ip = function(r, e) {
  var t = [];
  return r.forEach(function(n, i) {
    var o = { rowspanMap: {}, colspanMap: {}, length: 0 };
    n.forEach(function(s, u) {
      for (var f = s.nodeSize, d = 0; o[d]; )
        d += 1;
      o[d] = {
        // 2 is the sum of the front and back positions of the tag
        offset: e + i + u + 2,
        nodeSize: f
      }, o.length += 1;
    }), t.push(o);
  }), t;
};
function Gpe(r, e) {
  return ch(Ct.prototype, r), Ip = e, Ct;
}
function Kpe(r, e, t) {
  for (var n = t.startRowIdx, i = t.startColIdx, o = t.endRowIdx, s = t.endColIdx, u = [], f = n; f <= o; f += 1)
    for (var d = i; d <= s; d += 1) {
      var h = e.getCellInfo(f, d), m = h.offset, y = h.nodeSize;
      u.push(new l1(r.resolve(m + 1), r.resolve(m + y - 1)));
    }
  return u;
}
function Qpe(r, e) {
  var t = [];
  return r.childCount && t.push(r), e.childCount && t.push(e), F.from(t);
}
var Dh = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t, n) {
      n === void 0 && (n = t);
      var i = this, o = t.node(0), s = Ct.create(t), u = s.getRectOffsets(t, n), f = Kpe(o, 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, o = this.endCell.pos, s = t.resolve(n.map(i)), u = t.resolve(n.map(o)), f = Ct.create(s);
      if (this.offsetMap.totalColumnCount > f.totalColumnCount || this.offsetMap.totalRowCount > f.totalRowCount) {
        var d = { tableBody: 1, tableRow: 2, tableCell: 3, paragraph: 4 }, h = d[u.parent.type.name], m = u.end(u.depth - h), y = Math.min(m - 4, u.pos);
        return Ce.create(t, y);
      }
      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, o = t.child(0).type.create(), s = t.child(1).type.create(), u = Ct.create(this.startCell), f = u.getRectOffsets(this.startCell, this.endCell), d = f.startRowIdx, h = f.startColIdx, m = f.endRowIdx, y = f.endColIdx, w = !1, k = d; k <= m; k += 1) {
        for (var b = [], T = h; T <= y; T += 1) {
          var E = u.getCellInfo(k, T).offset, I = t.nodeAt(E - n);
          I && (w = I.type.name === "tableHeadCell", u.extendedRowspan(k, T) || u.extendedColspan(k, T) ? b.push(I.type.create({ extended: !0 })) : b.push(I.copy(I.content)));
        }
        var P = i.copy(F.from(b)), _ = w ? o : s;
        _.content = _.content.append(F.from(P));
      }
      return new Q(Qpe(o, s), 1, 1);
    }, e.prototype.toJSON = function() {
      return JSON.stringify(this);
    }, e;
  })(ke)
);
function Jpe(r, e, t) {
  for (var n = e.nodes, i = n.tableRow, o = n.tableHeadCell, s = n.paragraph, u = [], f = 0; f < r; f += 1) {
    var d = t && t[f], h = s.create(null, d ? e.text(d) : []);
    u.push(o.create(null, h));
  }
  return [i.create(null, u)];
}
function EC(r, e, t, n) {
  for (var i = t.nodes, o = i.tableRow, s = i.tableBodyCell, u = i.paragraph, f = [], d = 0; d < r; d += 1) {
    for (var h = [], m = 0; m < e; m += 1) {
      var y = n && n[d * e + m], w = u.create(null, y ? t.text(y) : []);
      h.push(s.create(null, w));
    }
    f.push(o.create(null, h));
  }
  return f;
}
function bu(r, e, t, n) {
  n === void 0 && (n = null);
  for (var i = t.nodes, o = i.tableHeadCell, s = i.tableBodyCell, u = i.paragraph, f = e === 0 ? o : s, d = [], h = 0; h < r; h += 1)
    d.push(f.create(n, u.create()));
  return d;
}
function MC(r, e) {
  for (; r && r !== e; ) {
    if (r.nodeName === "TD" || r.nodeName === "TH")
      return r;
    r = r.parentNode;
  }
  return null;
}
function OC(r) {
  return Nn(r, function(e) {
    var t = e.type;
    return t.name === "tableHeadCell" || t.name === "tableBodyCell";
  });
}
function Jr(r) {
  if (r instanceof Ce) {
    var e = r.$anchor, t = OC(e);
    if (t) {
      var n = e.node(0).resolve(e.before(t.depth));
      return { anchor: n, head: n };
    }
  }
  var i = r, o = i.startCell, s = i.endCell;
  return { anchor: o, head: s };
}
function NC(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 ra(r) {
  var e = r.startRowIdx, t = r.startColIdx, n = r.endRowIdx, i = r.endColIdx, o = n - e + 1, s = i - t + 1;
  return { rowCount: o, columnCount: s };
}
function Xpe(r, e) {
  return R(R({}, r.attrs), e);
}
var ui = new Fs("cellSelection"), Ype = 2, Zpe = (
  /** @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 = MC(e.target, this.view.dom);
      if (e.button === Ype) {
        e.preventDefault();
        return;
      }
      if (t) {
        var n = this.getCellPos(e);
        n && (this.startCellPos = n), this.bindEvent();
      }
    }, r.prototype.handleMousemove = function(e) {
      var t = ui.getState(this.view.state), n = this.getCellPos(e), i = this.startCellPos, o;
      t ? o = this.view.state.doc.resolve(t) : i !== n && (o = i), o && i && n && this.setCellSelection(i, n);
    }, r.prototype.handleMouseup = function() {
      this.startCellPos = null, this.unbindEvent(), ui.getState(this.view.state) !== null && this.view.dispatch(this.view.state.tr.setMeta(ui, -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 o = this.view.state.doc, s = o.resolve(i.pos), u = OC(s);
        if (u) {
          var f = s.before(u.depth);
          return o.resolve(f);
        }
      }
      return null;
    }, r.prototype.setCellSelection = function(e, t) {
      var n = this.view.state, i = n.selection, o = n.tr, s = ui.getState(this.view.state) === null, u = new Dh(e, t);
      if (s || !i.eq(u)) {
        var f = o.setSelection(u);
        s && f.setMeta(ui, t.pos), this.view.dispatch(f);
      }
    }, r.prototype.destroy = function() {
      this.view.dom.removeEventListener("mousedown", this.handlers.mousedown);
    }, r;
  })()
), ehe = re("cell-selected");
function the(r) {
  var e = r.selection, t = r.doc;
  if (e instanceof Dh) {
    var n = [], i = e.ranges;
    return i.forEach(function(o) {
      var s = o.$from, u = o.$to;
      n.push(er.node(s.pos - 1, u.pos + 1, { class: ehe }));
    }), Je.create(t, n);
  }
  return null;
}
function rhe() {
  return new nr({
    key: ui,
    state: {
      init: function() {
        return null;
      },
      apply: function(r, e) {
        var t = r.getMeta(ui);
        if (t)
          return t === -1 ? null : t;
        if (Fu(e) || !r.docChanged)
          return e;
        var n = r.mapping.mapResult(e), i = n.deleted, o = n.pos;
        return i ? null : o;
      }
    },
    props: {
      decorations: the,
      createSelectionBetween: function(r) {
        var e = r.state;
        return Fu(ui.getState(e)) ? null : e.selection;
      }
    },
    view: function(r) {
      return new Zpe(r);
    }
  });
}
var LC = (
  /** @class */
  (function() {
    function r() {
      this.keys = [], this.values = [];
    }
    return r.prototype.getKeyIndex = function(e) {
      return co(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, o) {
        i && n.keys[o] && e.call(t, i, n.keys[o], n);
      });
    }, r.prototype.clear = function() {
      this.keys = [], this.values = [];
    }, r;
  })()
), Kd = "en-US", nhe = (
  /** @class */
  (function() {
    function r() {
      this.code = Kd, this.langs = new LC();
    }
    return r.prototype.setCode = function(e) {
      this.code = e || Kd;
    }, 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 o = n.langs.get(i);
          n.langs.set(i, ih(o, t));
        }
      });
    }, r.prototype.get = function(e, t) {
      t || (t = this.code);
      var n = this.langs.get(t);
      n || (n = this.langs.get(Kd));
      var i = n[e];
      if (!i)
        throw new Error('There is no text key "' + e + '" in ' + t);
      return i;
    }, r;
  })()
), he = new nhe(), ihe = [
  [
    {
      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 ohe(r, e) {
  return ihe.map(function(t) {
    return t.map(function(n) {
      var i = n.action, o = n.command, s = n.payload, u = n.disableInThead, f = n.className;
      return {
        label: he.get(i),
        onClick: function() {
          r.emit("command", o, s);
        },
        disabled: e && !!u,
        className: f
      };
    });
  }).concat();
}
function ahe(r) {
  return new nr({
    props: {
      handleDOMEvents: {
        contextmenu: function(e, t) {
          var n = MC(t.target, e.dom);
          if (n) {
            t.preventDefault();
            var i = t, o = i.clientX, s = i.clientY, u = e.dom.parentNode.getBoundingClientRect(), f = u.left, d = u.top, h = n.nodeName === "TH";
            return r.emit("contextmenu", {
              pos: { left: o - f + 10 + "px", top: s - d + 30 + "px" },
              menuGroups: ohe(r, h),
              tableCell: n
            }), !0;
          }
          return !1;
        }
      }
    }
  });
}
function she() {
  return new nr({
    props: {
      handleDOMEvents: {
        mousedown: function(r, e) {
          var t = e, n = t.clientX, i = t.clientY, o = r.posAtCoords({ left: n, top: i });
          if (o) {
            var s = r.state, u = s.doc, f = s.tr, d = u.resolve(o.pos), h = ya(d), m = e.target, y = getComputedStyle(m, ":before"), w = e, k = w.offsetX, b = w.offsetY;
            if (!h || !ph(y, k, b))
              return !1;
            e.preventDefault();
            var T = d.before(h.depth), E = h.node.attrs;
            return f.setNodeMarkup(T, null, R(R({}, E), { checked: !E.checked })), r.dispatch(f), !0;
          }
          return !1;
        }
      }
    }
  });
}
var lhe = ["image", "link", "customBlock", "frontMatter"], uhe = ["strong", "strike", "emph", "code"], DC = ["bulletList", "orderedList", "taskList"];
function che(r, e) {
  var t = r.type.name;
  return t === "listItem" ? r.attrs.task ? "taskList" : e.type.name : t.indexOf("table") !== -1 ? "table" : t;
}
function fhe(r, e) {
  e[r] = { active: !0 }, DC.filter(function(t) {
    return t !== r;
  }).forEach(function(t) {
    e[t] && delete e[t];
  });
}
function dhe(r, e, t, n) {
  uhe.forEach(function(i) {
    var o = t.marks[i], s = r.marksAcross(e) || [], u = !!o.isInSet(s);
    u && (n[i] = { active: !0 });
  });
}
function phe(r, e, t) {
  var n = r.$from, i = r.$to, o = r.from, s = r.to, u = {
    indent: { active: !1, disabled: !0 },
    outdent: { active: !1, disabled: !0 }
  };
  return e.nodesBetween(o, s, function(f, d, h) {
    var m = che(f, h);
    Et(lhe, m) || (Et(DC, m) ? (fhe(m, u), u.indent.disabled = !1, u.outdent.disabled = !1) : m === "paragraph" || m === "text" ? dhe(n, i, t, u) : u[m] = { active: !0 });
  }), u;
}
function hhe(r) {
  return new nr({
    view: function() {
      return {
        update: function(e) {
          var t = e.state, n = t.selection, i = t.doc, o = t.schema;
          r.emit("changeToolbarState", {
            toolbarState: phe(n, i, o)
          });
        }
      };
    }
  });
}
var vhe = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var o = this;
      this.openEditor = function() {
        if (o.innerEditorView)
          throw new Error("The editor is already opened.");
        o.dom.draggable = !1, o.wrapper.style.display = "none", o.innerViewContainer.style.display = "block", o.innerEditorView = new uc(o.innerViewContainer, {
          state: Xi.create({
            doc: o.node,
            plugins: [
              Bs({
                "Mod-z": function() {
                  return Ms(o.innerEditorView.state, o.innerEditorView.dispatch);
                },
                "Shift-Mod-z": function() {
                  return nh(o.innerEditorView.state, o.innerEditorView.dispatch);
                },
                Tab: function(s, u) {
                  return u(s.tr.insertText("	")), !0;
                },
                Enter: K1,
                Escape: function() {
                  return o.cancelEditing(), !0;
                },
                "Ctrl-Enter": function() {
                  return o.saveAndFinishEditing(), !0;
                }
              }),
              tk()
            ]
          }),
          dispatchTransaction: function(s) {
            return o.dispatchInner(s);
          },
          handleDOMEvents: {
            mousedown: function() {
              return o.editorView.hasFocus() && o.innerEditorView.focus(), !0;
            },
            blur: function() {
              return o.saveAndFinishEditing(), !0;
            }
          }
        }), o.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 = re("custom-block"), this.wrapper = document.createElement("div"), this.wrapper.className = re("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 = re("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($e(t.tr, e))), this.editorView.focus(), this.renderCustomBlock(), this.closeEditor();
    }, r.prototype.cancelEditing = function() {
      var e = fM(this.innerEditorView.state);
      for (this.canceled = !0; e--; )
        Ms(this.innerEditorView.state, this.innerEditorView.dispatch), Ms(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(Ce.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 && xr(this.getPos)) {
        for (var o = this.editorView.state.tr, s = Zt.offset(this.getPos() + 1), u = 0; u < i.length; u += 1)
          for (var f = i[u].steps, d = 0; d < f.length; d += 1)
            o.step(f[d].map(s));
        o.docChanged && this.editorView.dispatch(o);
      }
    }, 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;
  })()
), Ew = "image-link", mhe = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var o = this, s;
      this.handleMousedown = function(u) {
        u.preventDefault();
        var f = u.target, d = u.offsetX, h = u.offsetY;
        if (o.imageLink && xr(o.getPos) && fk(f, Ew)) {
          var m = getComputedStyle(f, ":before");
          if (u.stopPropagation(), ph(m, d, h)) {
            var y = o.view.state.tr, w = o.getPos();
            y.setSelection($e(y, w, w + 1)), o.view.dispatch(y), o.eventEmitter.emit("openPopup", "link", o.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 = Ew, t.appendChild(e), t;
      }
      return e;
    }, r.prototype.createImageElement = function(e) {
      var t = document.createElement("img"), n = e.attrs, i = n.imageUrl, o = n.altText, s = Ze(e.attrs);
      return t.src = i, o && (t.alt = o), mh(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;
  })()
), ghe = "toastui-editor-ww-code-block", yhe = "toastui-editor-ww-code-block-language", whe = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var o = 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" && xr(o.getPos)) {
          var d = o.view.coordsAtPos(o.getPos()), h = d.top, m = d.right;
          o.createLanguageEditor({ top: h, right: m });
        }
      }, this.handleKeydown = function(s) {
        s.key === "Enter" && o.input && (s.preventDefault(), o.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 = ghe;
      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 = Ze(this.node.attrs);
      return n && t.setAttribute("data-language", n), mh(i, e), e.appendChild(t), e;
    }, r.prototype.createLanguageEditor = function(e) {
      var t = this, n = e.top, i = e.right, o = document.createElement("span");
      o.className = yhe;
      var s = document.createElement("input");
      s.type = "text", s.value = this.node.attrs.language, o.appendChild(s), this.view.dom.parentElement.appendChild(o);
      var u = o.clientWidth;
      nn(o, {
        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 && xr(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, po(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;
  })()
), khe = /MsoListParagraph/, AC = /style=(.|\n)*mso-/, IC = /mso-list:(.*)/, Che = /O:P/, bhe = /^(n|u|l)/, The = "p.MsoListParagraph";
function xhe(r) {
  return AC.test(r);
}
function She(r) {
  for (var e = [], t = document.createTreeWalker(r, 1, null, !1); t.nextNode(); ) {
    var n = t.currentNode;
    if (vc(n)) {
      var i = n, o = i.outerHTML, s = i.textContent, u = AC.test(o), f = IC.test(o);
      u && !f && s ? e.push([n, !0]) : (Che.test(n.nodeName) || u && !s || f) && e.push([n, !1]);
    }
  }
  return e.forEach(function(d) {
    var h = d[0], m = d[1];
    m ? UO(h) : po(h);
  }), r.innerHTML.trim();
}
function Ehe(r, e) {
  var t = r.getAttribute("style");
  if (t) {
    var n = t.match(IC), i = n[1], o = i.trim().split(" "), s = o[1], u = parseInt(s.replace("level", ""), 10), f = bhe.test(r.textContent || "");
    return {
      id: e,
      level: u,
      prev: null,
      parent: null,
      children: [],
      unordered: f,
      contents: She(r)
    };
  }
  return null;
}
function Mhe(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 Ohe(r) {
  var e = [];
  return r.forEach(function(t, n) {
    var i = e[n - 1], o = Ehe(t, n);
    o && (i && Mhe(o, i), e.push(o));
  }), e;
}
function RC(r) {
  var e = r[0].unordered ? "ul" : "ol", t = document.createElement(e);
  return r.forEach(function(n) {
    var i = n.children, o = n.contents, s = document.createElement("li");
    s.innerHTML = o, t.appendChild(s), i.length && t.appendChild(RC(i));
  }), t;
}
function Nhe(r) {
  var e = Ohe(r), t = e.filter(function(n) {
    var i = n.parent;
    return !i;
  });
  return RC(t);
}
function Lhe(r) {
  for (; r && !vc(r); )
    r = r.nextSibling;
  return r ? !khe.test(r.className) : !0;
}
function Dhe(r) {
  var e = document.createElement("div");
  e.innerHTML = r;
  var t = [], n = VO(e, The);
  n.forEach(function(o) {
    var s = Lhe(o.nextSibling);
    if (t.push(o), s) {
      var u = Nhe(t), f = o.nextSibling;
      f ? $O(u, f) : qO(e, u), t = [];
    }
    po(o);
  });
  var i = n.length ? "<p></p>" : "";
  return "" + i + e.innerHTML;
}
var Mw = "<!--StartFragment-->", Ahe = "<!--EndFragment-->";
function Ihe(r) {
  var e = r.indexOf(Mw), t = r.lastIndexOf(Ahe);
  return e > -1 && t > -1 && (r = r.slice(e + Mw.length, t)), r.replace(/<br[^>]*>/g, mk);
}
function Rhe(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 Phe(r) {
  return r = Ihe(r), r = Rhe(r), xhe(r) && (r = Dhe(r)), r;
}
function Bhe(r) {
  var e = r.reduce(function(t, n) {
    return t.childCount > n.childCount ? t : n;
  });
  return e.childCount;
}
function PC(r, e, t) {
  for (var n = [], i = r.childCount, o = 0; o < i; o += 1)
    if (!r.child(o).attrs.extended) {
      var s = o < i ? t.create(r.child(o).attrs, r.child(o).content) : t.createAndFill();
      n.push(s);
    }
  return n;
}
function BC(r, e, t) {
  var n = t.nodes, i = n.tableRow, o = n.tableHeadCell, s = PC(r, e, o);
  return i.create(null, s);
}
function _C(r, e, t) {
  var n = t.nodes, i = n.tableRow, o = n.tableBodyCell, s = PC(r, e, o);
  return i.create(null, s);
}
function _he(r, e) {
  for (var t = e.nodes, n = t.tableRow, i = t.tableBodyCell, o = [], s = 0; s < r; s += 1) {
    var u = i.createAndFill();
    o.push(u);
  }
  return n.create({ dummyRowForPasting: !0 }, o);
}
function HC(r) {
  var e = [], t = [];
  if (r.firstChild.type.name === "tableHead") {
    var n = r.firstChild;
    n.forEach(function(o) {
      return e.push(o);
    });
  }
  if (r.lastChild.type.name === "tableBody") {
    var i = r.lastChild;
    i.forEach(function(o) {
      return t.push(o);
    });
  }
  return rr(rr([], e), t);
}
function Hhe(r, e, t) {
  var n = BC(r, e, t);
  return t.nodes.tableHead.create(null, n);
}
function Ow(r, e, t) {
  var n = r.map(function(o) {
    return _C(o, e, t);
  });
  if (!r.length) {
    var i = _he(e, t);
    n.push(i);
  }
  return t.nodes.tableBody.create(null, n);
}
function Fhe(r, e, t, n) {
  var i = Bhe(r);
  if (t && n)
    return e.nodes.table.create(null, [Ow(r, i, e)]);
  var o = r[0], s = r.slice(1), u = [Hhe(o, i, e)];
  return s.length && u.push(Ow(s, i, e)), e.nodes.table.create(null, u);
}
function zhe(r, e, t) {
  var n = [], i = r.content, o = r.openStart, s = r.openEnd;
  return i.forEach(function(u) {
    if (u.type.name === "table") {
      var f = NC(new Q(F.from(u), 0, 0));
      if (f) {
        var d = HC(f), h = f.firstChild.type.name === "tableBody", m = Fhe(d, e, h, t);
        n.push(m);
      }
    } else
      n.push(u);
  }), new Q(F.from(n), o, s);
}
var Vhe = 4, qhe = 2;
function Tu(r) {
  return r * Vhe;
}
function $he(r, e, t) {
  var n = [], i = HC(r), o = i[0].childCount, s = i.length, u = e.startRowIdx === 0, f = i.slice(0, s);
  if (u) {
    var d = f.shift();
    if (d) {
      var h = BC(d, o, t).content;
      n.push(h);
    }
  }
  return f.forEach(function(m) {
    if (!m.attrs.dummyRowForPasting) {
      var y = _C(m, o, t).content;
      n.push(y);
    }
  }), n;
}
function Uhe(r, e, t) {
  for (var n = e.startRowIdx, i = e.startColIdx, o = t.length, s = 0, u = function(w) {
    var k = t[w].childCount;
    t[w].forEach(function(b) {
      var T = b.attrs, E = T.colspan;
      E > 1 && (k += E - 1);
    }), s = Math.max(s, k);
  }, f = 0; f < o; f += 1)
    u(f);
  var d = n + o - 1, h = i + s - 1, m = Math.max(d + 1 - r.totalRowCount, 0), y = Math.max(h + 1 - r.totalColumnCount, 0);
  return {
    startRowIdx: n,
    startColIdx: i,
    endRowIdx: d,
    endColIdx: h,
    addedRowCount: m,
    addedColumnCount: y
  };
}
function jhe(r, e) {
  for (var t = r.startRowIdx, n = r.startColIdx, i = r.endRowIdx, o = r.endColIdx, s = r.addedRowCount, u = r.addedColumnCount, f = t; f <= i - s; f += 1)
    e.push({
      rowIdx: f,
      startColIdx: n,
      endColIdx: o - u
    });
}
function Whe(r, e, t, n, i) {
  for (var o = n.startRowIdx, s = n.startColIdx, u = n.endRowIdx, f = n.endColIdx, d = n.addedRowCount, h = n.addedColumnCount, m = t.totalRowCount, y = 0, w = 0; w < m; w += 1) {
    var k = t.getCellInfo(w, f - h), b = k.offset, T = k.nodeSize, E = r.mapping.map(b + T), I = bu(h, w, e);
    if (r.insert(E, I), w >= o && w <= u - d) {
      var P = t.getCellInfo(w, f - h), _ = r.mapping.map(P.offset), V = E + Tu(h);
      i[y] = {
        rowIdx: w,
        startColIdx: s,
        endColIdx: f,
        dummyOffsets: [_, V]
      }, y += 1;
    }
  }
}
function Ghe(r, e, t, n, i) {
  var o = n.addedRowCount, s = n.addedColumnCount, u = n.startColIdx, f = n.endColIdx, d = r.mapping.maps.length, h = t.tableEndOffset - 2, m = EC(o, t.totalColumnCount + s, e), y = h;
  r.insert(r.mapping.slice(d).map(y), m);
  for (var w = 0; w < o; w += 1) {
    var k = y + Tu(u) + 1, b = y + Tu(f + 1) + 1, T = y + Tu(t.totalColumnCount + s) + qhe;
    i.push({
      rowIdx: w + t.totalRowCount,
      startColIdx: u,
      endColIdx: f,
      dummyOffsets: [k, b]
    }), y = T;
  }
}
function Khe(r, e, t, n) {
  var i = r.mapping.maps.length;
  t.forEach(function(o, s) {
    var u = o.rowIdx, f = o.startColIdx, d = o.endColIdx, h = o.dummyOffsets, m = r.mapping.slice(i), y = new Q(e[s], 0, 0), w = h ? h[0] : n.getCellStartOffset(u, f), k = h ? h[1] : n.getCellEndOffset(u, d);
    r.replace(m.map(w), m.map(k), y);
  });
}
function Qhe(r, e) {
  var t = r.state, n = t.selection, i = t.schema, o = t.tr, s = Jr(n), u = s.anchor, f = s.head;
  if (u && f) {
    var d = NC(e);
    if (!d)
      return !1;
    var h = Ct.create(u), m = h.getRectOffsets(u, f), y = $he(d, m, i), w = Uhe(h, m, y), k = [];
    return Xhe(h, w) && (jhe(w, k), w.addedColumnCount && Whe(o, i, h, w, k), w.addedRowCount && Ghe(o, i, h, w, k), Khe(o, y, k, h), r.dispatch(o), Jhe(r, k, h.getCellInfo(0, 0).offset)), !0;
  }
  return !1;
}
function Jhe(r, e, t) {
  var n = r.state, i = n.tr, o = n.doc, s = Ct.create(o.resolve(t)), u = e[0], f = u.rowIdx, d = u.startColIdx, h = Rt(e), m = h.rowIdx, y = h.endColIdx, w = s.getCellInfo(f, d).offset, k = s.getCellInfo(m, y).offset;
  r.dispatch(i.setSelection(new Dh(o.resolve(w), o.resolve(k))));
}
function Xhe(r, e) {
  var t = r.getSpannedOffsets(e), n = ra(t), i = n.rowCount, o = n.columnCount, s = ra(e), u = s.rowCount, f = s.columnCount;
  return i === u && o === f;
}
var Yhe = (
  /** @class */
  (function(r) {
    Y(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;
  })(Fe)
), Zhe = (
  /** @class */
  (function(r) {
    Y(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: R({}, gt()),
          parseDOM: [{ tag: "p" }],
          toDOM: function(t) {
            var n = t.attrs;
            return ["p", Ze(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), eve = /\s{1,4}$/, tve = (
  /** @class */
  (function(r) {
    Y(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, o = t.tr, s = i.$from, u = i.$to, f = s.blockRange(u);
        return f && !ga(s) && !Zu(s) ? (n(o.insertText("    ", s.pos, u.pos)), !0) : !1;
      };
    }, e.prototype.removeSpaces = function() {
      return function(t, n) {
        var i = t.selection, o = t.tr, s = i.$from, u = i.$to, f = i.from, d = s.blockRange(u);
        if (d && !ga(s) && !Zu(s)) {
          var h = s.nodeBefore;
          if (h && h.isText) {
            var m = h.text, y = m.replace(eve, ""), w = m.length - y.length;
            return n(o.delete(f - w, f)), !0;
          }
        }
        return !1;
      };
    }, e.prototype.keymaps = function() {
      return {
        Tab: this.addSpaces(),
        "Shift-Tab": this.removeSpaces()
      };
    }, e;
  })(Fe)
), rve = (
  /** @class */
  (function(r) {
    Y(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 o = i.getAttribute("data-raw-html");
              return R({ level: n }, o && { rawHTML: o });
            }
          };
        });
        return {
          attrs: R({ level: { default: 1 }, headingType: { default: "atx" }, rawHTML: { default: null } }, gt()),
          content: "inline*",
          group: "block",
          defining: !0,
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return ["h" + i.level, Ze(i), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function(t) {
        return function(n, i) {
          var o = n.schema.nodes[t.level ? "heading" : "paragraph"];
          return rh(o, t)(n, i);
        };
      };
    }, e;
  })(Fe)
), nve = (
  /** @class */
  (function(r) {
    Y(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: R({ language: { default: null }, rawHTML: { default: null } }, gt()),
          code: !0,
          defining: !0,
          marks: "",
          parseDOM: [
            {
              tag: "pre",
              preserveWhitespace: "full",
              getAttrs: function(t) {
                var n = t.getAttribute("data-raw-html"), i = t.firstElementChild;
                return R({ language: i?.getAttribute("data-language") || null }, n && { rawHTML: n });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [
              n.rawHTML || "pre",
              ["code", R({ "data-language": n.language }, Ze(n)), 0]
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return rh(t.schema.nodes.codeBlock)(t, n);
        };
      };
    }, e.prototype.moveCursor = function(t) {
      var n = this;
      return function(i, o) {
        var s = i.tr, u = i.doc, f = i.schema, d = i.selection.$from, h = n.context.view;
        if (h.endOfTextblock(t) && d.node().type.name === "codeBlock") {
          var m = d.parent.textContent.split(`
`), y = t === "up" ? d.start() : d.end(), w = t === "up" ? [y, m[0].length + y] : [y - Rt(m).length, y], k = u.resolve(t === "up" ? d.before() : d.after()), b = t === "up" ? k.nodeBefore : k.nodeAfter;
          if (uO(d.pos, w[0], w[1]) && !b) {
            var T = fh(s, k, f);
            if (T)
              return o(T), !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;
  })(Fe)
), ive = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          parseDOM: [bc("ul")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["ul", Ze(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.changeList = function() {
      return function(t, n) {
        return SC(t.schema.nodes.bulletList)(t, n);
      };
    }, e.prototype.commands = function() {
      return {
        bulletList: this.changeList,
        taskList: Fpe
      };
    }, e.prototype.keymaps = function() {
      var t = this.changeList(), n = Lh(), i = n.indent, o = n.outdent;
      return {
        "Mod-u": t,
        "Mod-U": t,
        Tab: i(),
        "Shift-Tab": o()
      };
    }, e;
  })(Fe)
), ove = (
  /** @class */
  (function(r) {
    Y(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: R({ order: { default: 1 }, rawHTML: { default: null } }, gt()),
          parseDOM: [
            {
              tag: "ol",
              getAttrs: function(t) {
                var n = t.getAttribute("start"), i = t.getAttribute("data-raw-html");
                return R({ order: t.hasAttribute("start") ? Number(n) : 1 }, i && { rawHTML: i });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [
              n.rawHTML || "ol",
              R({ start: n.order === 1 ? null : n.order }, Ze(n)),
              0
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return SC(t.schema.nodes.orderedList)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()(), n = Lh(), i = n.indent, o = n.outdent;
      return {
        "Mod-o": t,
        "Mod-O": t,
        Tab: i(),
        "Shift-Tab": o()
      };
    }, e;
  })(Fe)
), ave = (
  /** @class */
  (function(r) {
    Y(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 R({ task: t.hasAttribute("data-task"), checked: t.hasAttribute("data-task-checked") }, n && { rawHTML: n });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs, i = n.task, o = n.checked;
            if (!i)
              return [n.rawHTML || "li", 0];
            var s = ["task-list-item"];
            return o && s.push("checked"), [
              n.rawHTML || "li",
              R({ class: s.join(" "), "data-task": i }, o && { "data-task-checked": o }),
              0
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.liftToPrevListItem = function() {
      return function(t, n) {
        var i = t.selection, o = t.tr, s = t.schema, u = i.$from, f = i.empty, d = s.nodes.listItem, h = u.parent, m = u.node(-1);
        if (f && !h.childCount && m.type === d) {
          if (u.index(-2) >= 1)
            return o.delete(u.start(-1) - 1, u.end(-1)), n(o), !0;
          var y = u.node(-3);
          if (y.type === d)
            return o.delete(u.start(-2) - 1, u.end(-1)), n(o), !0;
        }
        return !1;
      };
    }, e.prototype.keymaps = function() {
      var t = function(n, i) {
        return Upe(n.schema.nodes.listItem)(n, i);
      };
      return {
        Backspace: this.liftToPrevListItem(),
        Enter: t
      };
    }, e;
  })(Fe)
), sve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          content: "block+",
          group: "block",
          parseDOM: [bc("blockquote")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["blockquote", Ze(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return XE(t.schema.nodes.blockQuote)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Alt-q": t,
        "Alt-Q": t
      };
    }, e;
  })(Fe)
), lve = {
  left: mve,
  right: vve,
  up: gve,
  down: yve
};
function uve(r, e, t) {
  var n = t[0], i = t[1], o = e.resolve(r.before(n - 1));
  return i === n && !o.nodeBefore;
}
function cve(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), o = i.lastChild === n, s = ((e = n.lastChild) === null || e === void 0 ? void 0 : e.type.name) !== "paragraph";
      return o ? !s : !1;
    }
    t -= 1;
  }
  return !1;
}
function fve(r, e, t, n, i) {
  var o = e[0], s = e[1], u = e[2];
  if (r === "left" || r === "up") {
    if (i && !uve(t, n, [o, s]))
      return !1;
    var f = t.before(u), d = n.resolve(f).nodeBefore;
    if (d)
      return !1;
  }
  return !0;
}
function dve(r, e, t, n, i) {
  if (r === "right" || r === "down") {
    if (i && !cve(t))
      return !1;
    var o = t.after(e), s = n.resolve(o).nodeAfter;
    if (s)
      return !1;
  }
  return !0;
}
function pve(r, e, t, n) {
  var i = e[0], o = e[1], s = i + 3, u = o >= s, f = u ? i + 1 : o, d = fve(r, [o, s, f], t, n, u), h = dve(r, f, t, n, u);
  return d && h;
}
function Nw(r, e, t) {
  var n = t[0], i = t[1], o = e.getRowspanStartInfo(n, i), s = r === "up" && n === 0, u = r === "down" && (o?.count > 1 ? n + o.count - 1 : n) === e.totalRowCount - 1;
  return s || u;
}
function hve(r, e, t) {
  var n = r.doc.resolve(e.tableStartOffset - 1);
  return n.nodeBefore ? r.setSelection(ke.near(n, -1)) : fh(r, n, t);
}
function Qd(r, e, t, n) {
  n === void 0 && (n = !1);
  var i = r.doc.resolve(e.tableEndOffset);
  return n || !i.nodeAfter ? fh(r, i, t) : r.setSelection(ke.near(i, 1));
}
function vve(r, e) {
  var t = r[0], n = r[1], i = e.totalRowCount, o = e.totalColumnCount, s = n === o - 1, u = t === i - 1 && s;
  if (!u) {
    var f = n + 1, d = e.getColspanStartInfo(t, n);
    d?.count > 1 && (f += d.count - 1), (s || f === o) && (t += 1, f = 0);
    var h = e.getCellInfo(t, f).offset;
    return h + 2;
  }
  return null;
}
function mve(r, e) {
  var t = r[0], n = r[1], i = e.totalColumnCount, o = n === 0, s = t === 0 && o;
  if (!s) {
    n -= 1, o && (t -= 1, n = i - 1);
    var u = e.getCellInfo(t, n), f = u.offset, d = u.nodeSize;
    return f + d - 2;
  }
  return null;
}
function gve(r, e) {
  var t = r[0], n = r[1];
  if (t > 0) {
    var i = e.getCellInfo(t - 1, n), o = i.offset, s = i.nodeSize;
    return o + s - 2;
  }
  return null;
}
function yve(r, e) {
  var t = r[0], n = r[1], i = e.totalRowCount;
  if (t < i - 1) {
    var o = t + 1, s = e.getRowspanStartInfo(t, n);
    s?.count > 1 && (o += s.count - 1);
    var u = e.getCellInfo(o, n).offset;
    return u + 2;
  }
  return null;
}
function Lw(r, e, t, n) {
  var i = lve[r], o = i(t, n);
  if (o) {
    var s = r === "right" || r === "down" ? 1 : -1;
    return e.setSelection(ke.near(e.doc.resolve(o), s));
  }
  return null;
}
function wve(r, e, t) {
  var n = t[0], i = t[1];
  if (r === "up" || r === "down")
    return !1;
  var o = e.tableStartOffset, s = e.tableEndOffset, u = e.getCellInfo(n, i), f = u.offset, d = u.nodeSize, h = r === "left" ? o : s, m = r === "left" ? f - 2 : f + d + 3;
  return h === m;
}
function kve(r, e, t) {
  var n = r.doc.resolve(e.before(t - 3));
  return r.setSelection(new de(n));
}
function Cve(r, e, t) {
  var n, i, o;
  return r === "up" ? (n = t.startRowIdx, i = 0, o = -1) : (n = t.endRowIdx, i = e.totalColumnCount - 1, o = e.getCellInfo(n, i).nodeSize + 1), { targetRowIdx: n, insertColIdx: i, nodeSize: o };
}
function bve(r, e, t) {
  var n = r.getCellInfo(e, 0).offset, i = r.getCellInfo(e, t - 1), o = i.offset, s = i.nodeSize;
  return { from: n, to: o + s };
}
var Tve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          parseDOM: [bc("table")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["table", Ze(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 o = t.rowCount, s = t.columnCount, u = t.data, f = n.schema, d = n.selection, h = n.tr, m = d.from, y = d.to, w = d.$from, k = m === y;
          if (k && !Zu(w)) {
            var b = f.nodes, T = b.tableHead, E = b.tableBody, I = u?.slice(0, s), P = u?.slice(s, u.length), _ = Jpe(s, f, I), V = EC(o - 1, s, f, P), W = f.nodes.table.create(null, [
              T.create(null, _),
              E.create(null, V)
            ]);
            return i(h.replaceSelectionWith(W)), !0;
          }
          return !1;
        };
      };
    }, e.prototype.removeTable = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, o = t.tr, s = Ct.create(i.$anchor);
          if (s) {
            var u = s.tableStartOffset, f = s.tableEndOffset, d = u - 1, h = $e(o.delete(d, f), d);
            return n(o.setSelection(h)), !0;
          }
          return !1;
        };
      };
    }, e.prototype.addColumn = function(t) {
      return function() {
        return function(n, i) {
          var o = n.selection, s = n.tr, u = n.schema, f = Jr(o), d = f.anchor, h = f.head;
          if (d && h) {
            for (var m = Ct.create(d), y = m.getRectOffsets(d, h), w = t === "left" ? y.startColIdx : y.endColIdx + 1, k = ra(y).columnCount, b = m.totalRowCount, T = 0; T < b; T += 1) {
              var E = bu(k, T, u);
              s.insert(s.mapping.map(m.posAt(T, w)), E);
            }
            return i(s), !0;
          }
          return !1;
        };
      };
    }, e.prototype.removeColumn = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, o = t.tr, s = Jr(i), u = s.anchor, f = s.head;
          if (u && f) {
            var d = Ct.create(u), h = d.getRectOffsets(u, f), m = d.totalColumnCount, y = d.totalRowCount, w = ra(h).columnCount, k = w === m;
            if (k)
              return !1;
            for (var b = h.startColIdx, T = h.endColIdx, E = o.mapping.maps.length, I = 0; I < y; I += 1)
              for (var P = T; P >= b; P -= 1) {
                var _ = d.getCellInfo(I, P), V = _.offset, W = _.nodeSize, q = o.mapping.slice(E).map(V), K = q + W;
                o.delete(q, K);
              }
            return n(o), !0;
          }
          return !1;
        };
      };
    }, e.prototype.addRow = function(t) {
      return function() {
        return function(n, i) {
          var o = n.selection, s = n.schema, u = n.tr, f = Jr(o), d = f.anchor, h = f.head;
          if (d && h) {
            var m = Ct.create(d), y = m.totalColumnCount, w = m.getRectOffsets(d, h), k = ra(w).rowCount, b = Cve(t, m, w), T = b.targetRowIdx, E = b.insertColIdx, I = b.nodeSize, P = T === 0;
            if (!P) {
              for (var _ = [], V = u.mapping.map(m.posAt(T, E)) + I, W = [], q = 0; q < y; q += 1)
                W = W.concat(bu(1, T, s));
              for (var K = 0; K < k; K += 1)
                _.push(s.nodes.tableRow.create(null, W));
              return i(u.insert(V, _)), !0;
            }
          }
          return !1;
        };
      };
    }, e.prototype.removeRow = function() {
      return function() {
        return function(t, n) {
          var i = t.selection, o = t.tr, s = Jr(i), u = s.anchor, f = s.head;
          if (u && f) {
            var d = Ct.create(u), h = d.totalRowCount, m = d.totalColumnCount, y = d.getRectOffsets(u, f), w = ra(y).rowCount, k = y.startRowIdx, b = y.endRowIdx, T = k === 0, E = w === h - 1;
            if (E || T)
              return !1;
            for (var I = b; I >= k; I -= 1) {
              var P = bve(d, I, m), _ = P.from, V = P.to;
              o.delete(_ - 1, V + 1);
            }
            return n(o), !0;
          }
          return !1;
        };
      };
    }, e.prototype.alignColumn = function() {
      return function(t) {
        return t === void 0 && (t = { align: "center" }), function(n, i) {
          var o = t.align, s = n.selection, u = n.tr, f = Jr(s), d = f.anchor, h = f.head;
          if (d && h) {
            for (var m = Ct.create(d), y = m.totalRowCount, w = m.getRectOffsets(d, h), k = w.startColIdx, b = w.endColIdx, T = 0; T < y; T += 1)
              for (var E = k; E <= b; E += 1)
                if (!m.extendedRowspan(T, E) && !m.extendedColspan(T, E)) {
                  var I = m.getNodeAndPos(T, E), P = I.node, _ = I.pos, V = Xpe(P, { align: o });
                  u.setNodeMarkup(_, null, V);
                }
            return i(u), !0;
          }
          return !1;
        };
      };
    }, e.prototype.moveToCell = function(t) {
      return function(n, i) {
        var o = n.selection, s = n.tr, u = n.schema, f = Jr(o), d = f.anchor, h = f.head;
        if (d && h) {
          var m = Ct.create(d), y = m.getCellIndex(d), w = void 0;
          if (Nw(t, m, y) ? w = Qd(s, m, u) : w = Lw(t, s, y, m), w)
            return i(w), !0;
        }
        return !1;
      };
    }, e.prototype.moveInCell = function(t) {
      var n = this;
      return function(i, o) {
        var s = i.selection, u = i.tr, f = i.doc, d = i.schema, h = s.$from, m = n.context.view;
        if (!m.endOfTextblock(t))
          return !1;
        var y = Nn(h, function(P) {
          var _ = P.type;
          return _.name === "tableHeadCell" || _.name === "tableBodyCell";
        });
        if (y) {
          var w = Nn(h, function(P) {
            var _ = P.type;
            return _.name === "paragraph";
          }), k = y.depth;
          if (w && pve(t, [k, w.depth], h, f)) {
            var b = Jr(s).anchor, T = Ct.create(b), E = T.getCellIndex(b), I = void 0;
            if (wve(t, T, E) ? I = kve(u, h, k) : Nw(t, T, E) ? t === "up" ? I = hve(u, T, d) : t === "down" && (I = Qd(u, T, d)) : I = Lw(t, u, E, T), I)
              return o(I), !0;
          }
        }
        return !1;
      };
    }, e.prototype.deleteCells = function() {
      return function(t, n) {
        var i = t.schema, o = t.selection, s = t.tr, u = Jr(o), f = u.anchor, d = u.head, h = o instanceof Ce;
        if (f && d && !h) {
          for (var m = Ct.create(f), y = m.getRectOffsets(f, d), w = y.startRowIdx, k = y.startColIdx, b = y.endRowIdx, T = y.endColIdx, E = w; E <= b; E += 1)
            for (var I = k; I <= T; I += 1)
              if (!m.extendedRowspan(E, I) && !m.extendedColspan(E, I)) {
                var P = m.getNodeAndPos(E, I), _ = P.node, V = P.pos, W = bu(1, E, i, _.attrs);
                s.replaceWith(s.mapping.map(V), s.mapping.map(V + _.nodeSize), W);
              }
          return n(s), !0;
        }
        return !1;
      };
    }, e.prototype.exitTable = function() {
      return function(t, n) {
        var i = t.selection, o = t.tr, s = t.schema, u = i.$from, f = Nn(u, function(y) {
          var w = y.type;
          return w.name === "tableHeadCell" || w.name === "tableBodyCell";
        });
        if (f) {
          var d = Nn(u, function(y) {
            var w = y.type;
            return w.name === "paragraph";
          });
          if (d) {
            var h = Jr(i).anchor, m = Ct.create(h);
            return n(Qd(o, m, 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;
  })(Fe)
), xve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          parseDOM: [bc("thead")],
          toDOM: function(t) {
            var n = t.attrs;
            return ["thead", Ze(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), Sve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          parseDOM: [
            {
              tag: "tbody",
              getAttrs: function(t) {
                var n = t.querySelectorAll("tr"), i = n[0].children.length, o = t.getAttribute("data-raw-html");
                return i ? R({}, o && { rawHTML: o }) : !1;
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return ["tbody", Ze(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), Eve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          parseDOM: [
            {
              tag: "tr",
              getAttrs: function(t) {
                var n = t.children.length, i = t.getAttribute("data-raw-html");
                return n ? R({}, i && { rawHTML: i }) : !1;
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return ["tr", Ze(n), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), Mve = (
  /** @class */
  (function(r) {
    Y(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: R({ align: { default: null }, className: { default: null }, rawHTML: { default: null }, colspan: { default: null }, extended: { default: null } }, gt()),
          isolating: !0,
          parseDOM: [bC("th")],
          toDOM: function(t) {
            var n = t.attrs, i = CC(n);
            return ["th", R(R({}, i), Ze(n)), 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), Ove = (
  /** @class */
  (function(r) {
    Y(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: [bC("td")],
          toDOM: function(t) {
            var n = t.attrs, i = CC(n);
            return ["td", i, 0];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e;
  })(Fe)
), Nve = (
  /** @class */
  (function(r) {
    Y(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: R({ imageUrl: { default: "" }, altText: { default: null }, rawHTML: { default: null } }, gt()),
          group: "inline",
          selectable: !1,
          parseDOM: [
            {
              tag: "img[src]",
              getAttrs: function(t) {
                var n = mo(t, { RETURN_DOM_FRAGMENT: !0 }).firstChild, i = n.getAttribute("src") || "", o = n.getAttribute("data-raw-html"), s = n.getAttribute("alt");
                return R({
                  imageUrl: i,
                  altText: s
                }, o && { rawHTML: o });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [
              n.rawHTML || "img",
              R(R({ src: ta(n.imageUrl) }, n.altText && { alt: n.altText }), Ze(n))
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addImage = function() {
      return function(t) {
        return function(n, i) {
          var o = n.schema, s = n.tr, u = t, f = u.imageUrl, d = u.altText;
          if (!f)
            return !1;
          var h = o.nodes.image.createAndFill(R({ imageUrl: f }, d && { altText: d }));
          return i(s.replaceSelectionWith(h).scrollIntoView()), !0;
        };
      };
    }, e.prototype.commands = function() {
      return {
        addImage: this.addImage()
      };
    }, e;
  })(Fe)
), Dw = 1, Lve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          group: "block",
          parseDOM: [{ tag: "hr" }],
          selectable: !1,
          toDOM: function(t) {
            var n = t.attrs;
            return ["div", Ze(n), [n.rawHTML || "hr"]];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.hr = function() {
      var t = this;
      return function() {
        return function(n, i) {
          var o, s = n.selection, u = s.$from, f = s.$to;
          if (u === f) {
            var d = n.doc, h = n.schema.nodes, m = h.thematicBreak, y = h.paragraph, w = [m.create()], k = u.node(Dw), b = d.child(d.childCount - 1) === k, T = d.resolve(u.after(Dw)), E = ((o = u.nodeAfter) === null || o === void 0 ? void 0 : o.type.name) === t.name;
            return (b || E) && w.push(y.create()), i(n.tr.insert(T.pos, w).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;
  })(Fe)
), Dve = (
  /** @class */
  (function(r) {
    Y(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 o = i.getAttribute("data-raw-html");
              return R({}, o && { rawHTML: o });
            }
          };
        });
        return {
          attrs: R({ rawHTML: { default: null } }, gt()),
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return [i.rawHTML || "strong", Ze(i)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.bold = function() {
      return function() {
        return function(t, n) {
          return $s(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;
  })(Ue)
), Ave = (
  /** @class */
  (function(r) {
    Y(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 o = i.getAttribute("data-raw-html");
              return R({}, o && { rawHTML: o });
            }
          };
        });
        return {
          attrs: R({ rawHTML: { default: null } }, gt()),
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return [i.rawHTML || "em", Ze(i)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.italic = function() {
      return function() {
        return function(t, n) {
          return $s(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;
  })(Ue)
), Ive = (
  /** @class */
  (function(r) {
    Y(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 o = i.getAttribute("data-raw-html");
              return R({}, o && { rawHTML: o });
            }
          };
        });
        return {
          attrs: R({ rawHTML: { default: null } }, gt()),
          parseDOM: t,
          toDOM: function(n) {
            var i = n.attrs;
            return [i.rawHTML || "del", Ze(i)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return $s(t.schema.marks.strike)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Mod-s": t,
        "Mod-S": t
      };
    }, e;
  })(Ue)
), Rve = (
  /** @class */
  (function(r) {
    Y(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: R({ linkUrl: { default: "" }, title: { default: null }, rawHTML: { default: null } }, gt()),
          inclusive: !1,
          parseDOM: [
            {
              tag: "a[href]",
              getAttrs: function(n) {
                var i = mo(n, { RETURN_DOM_FRAGMENT: !0 }).firstChild, o = i.getAttribute("href") || "", s = i.getAttribute("title") || "", u = i.getAttribute("data-raw-html");
                return R({ linkUrl: o, title: s }, u && { rawHTML: u });
              }
            }
          ],
          toDOM: function(n) {
            var i = n.attrs;
            return [
              i.rawHTML || "a",
              R(R({ href: ta(i.linkUrl) }, t.linkAttributes), Ze(i))
            ];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.addLink = function() {
      return function(t) {
        return function(n, i) {
          var o = t, s = o.linkUrl, u = o.linkText, f = u === void 0 ? "" : u, d = n.schema, h = n.tr, m = n.selection, y = m.empty, w = m.from, k = m.to;
          if (w && k && s) {
            var b = { linkUrl: s }, T = d.mark("link", b);
            if (y && f) {
              var E = St(d, f, T);
              h.replaceRangeWith(w, k, E);
            } else
              h.addMark(w, k, T);
            return i(h.scrollIntoView()), !0;
          }
          return !1;
        };
      };
    }, e.prototype.toggleLink = function() {
      return function(t) {
        return function(n, i) {
          return $s(n.schema.marks.link, t)(n, i);
        };
      };
    }, e.prototype.commands = function() {
      return {
        addLink: this.addLink(),
        toggleLink: this.toggleLink()
      };
    }, e;
  })(Ue)
), Pve = (
  /** @class */
  (function(r) {
    Y(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: R({ rawHTML: { default: null } }, gt()),
          parseDOM: [
            {
              tag: "code",
              getAttrs: function(t) {
                var n = t.getAttribute("data-raw-html");
                return R({}, n && { rawHTML: n });
              }
            }
          ],
          toDOM: function(t) {
            var n = t.attrs;
            return [n.rawHTML || "code", Ze(n)];
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.commands = function() {
      return function() {
        return function(t, n) {
          return $s(t.schema.marks.code)(t, n);
        };
      };
    }, e.prototype.keymaps = function() {
      var t = this.commands()();
      return {
        "Shift-Mod-c": t,
        "Shift-Mod-C": t
      };
    }, e;
  })(Ue)
), Bve = (
  /** @class */
  (function(r) {
    Y(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 ? rh(n.schema.nodes.customBlock, t)(n, i) : !1;
        };
      };
    }, e;
  })(Fe)
), _ve = (
  /** @class */
  (function(r) {
    Y(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 o = t.selection.$from;
          return i.endOfTextblock("down") && o.node().type.name === "frontMatter" ? th(t, n) : !1;
        };
      };
    }, e.prototype.keymaps = function() {
      return {
        Enter: this.commands()()
      };
    }, e;
  })(Fe)
), Hve = (
  /** @class */
  (function(r) {
    Y(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 o = t.selection.$from;
          return i.endOfTextblock("down") && o.node().type.name === "htmlComment" ? th(t, n) : !1;
        };
      };
    }, e.prototype.keymaps = function() {
      return {
        Enter: this.commands()()
      };
    }, e;
  })(Fe)
);
function Fve(r) {
  return new Sk([
    new Yhe(),
    new Zhe(),
    new tve(),
    new rve(),
    new nve(),
    new ive(),
    new ove(),
    new ave(),
    new sve(),
    new Tve(),
    new xve(),
    new Sve(),
    new Eve(),
    new Mve(),
    new Ove(),
    new Nve(),
    new Lve(),
    new Dve(),
    new Ave(),
    new Ive(),
    new Rve(r),
    new Pve(),
    new Bve(),
    new _ve(),
    new Tk(),
    new Hve()
  ]);
}
var zve = re("contents"), Vve = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t, n) {
      var i = r.call(this, t) || this, o = n.toDOMAdaptor, s = n.htmlSchemaMap, u = s === void 0 ? {} : s, f = n.linkAttributes, d = f === void 0 ? {} : f, h = n.useCommandShortcut, m = h === void 0 ? !0 : h, y = n.wwPlugins, w = y === void 0 ? [] : y, k = n.wwNodeViews, b = k === void 0 ? {} : k;
      return i.editorType = "wysiwyg", i.el.classList.add("ww-mode"), i.toDOMAdaptor = o, i.linkAttributes = d, i.extraPlugins = w, i.pluginNodeViews = b, i.specs = i.createSpecs(), i.schema = i.createSchema(u), i.context = i.createContext(), i.keymaps = i.createKeymaps(m), i.view = i.createView(), i.commands = i.createCommands(), i.specs.setContext(R(R({}, i.context), { view: i.view })), i.initEvent(), i;
    }
    return e.prototype.createSpecs = function() {
      return Fve(this.linkAttributes);
    }, e.prototype.createContext = function() {
      return {
        schema: this.schema,
        eventEmitter: this.eventEmitter
      };
    }, e.prototype.createSchema = function(t) {
      return new G0({
        nodes: R(R({}, this.specs.nodes), t.nodes),
        marks: R(R({}, this.specs.marks), t.marks)
      });
    }, e.prototype.createPlugins = function() {
      return rr([
        rhe(),
        ahe(this.eventEmitter),
        she(),
        hhe(this.eventEmitter)
      ], this.createPluginProps()).concat(this.defaultPlugins);
    }, e.prototype.createPluginNodeViews = function() {
      var t = this, n = t.eventEmitter, i = t.pluginNodeViews, o = {};
      return i && Object.keys(i).forEach(function(s) {
        o[s] = function(u, f, d) {
          return i[s](u, f, d, n);
        };
      }), o;
    }, e.prototype.createView = function() {
      var t = this, n = this, i = n.toDOMAdaptor, o = n.eventEmitter;
      return new uc(this.el, {
        state: this.createState(),
        attributes: {
          class: zve
        },
        nodeViews: R({
          customBlock: function(s, u, f) {
            return new vhe(s, u, f, i);
          },
          image: function(s, u, f) {
            return new mhe(s, u, f, o);
          },
          codeBlock: function(s, u, f) {
            return new whe(s, u, f, o);
          },
          widget: bk
        }, 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: Phe,
        transformPasted: function(s) {
          return zhe(s, t.schema, Zu(t.view.state.selection.$from));
        },
        handlePaste: function(s, u, f) {
          return Qhe(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, d = f?.items;
            if (d) {
              var h = on(d).some(function(y) {
                return y.kind === "string" && y.type === "text/rtf";
              });
              if (!h) {
                var m = Ck(d);
                m && (u.preventDefault(), yh(t.eventEmitter, m, 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, Lh());
    }, e.prototype.getHTML = function() {
      return gh(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 o = this.view.state, s = o.schema, u = o.tr, f = t.split(`
`), d = f.map(function(y) {
        return $u(s, io(y, s));
      }), h = new Q(F.from(d), 1, 1), m = Mn(n) && Mn(i) ? u.replaceRange(n, i, h) : u.replaceSelection(h);
      this.view.dispatch(m), this.focus();
    }, e.prototype.deleteSelection = function(t, n) {
      var i = this.view.state.tr, o = Mn(t) && Mn(n) ? i.deleteRange(t, n) : i.deleteSelection();
      this.view.dispatch(o.scrollIntoView());
    }, e.prototype.getSelectedText = function(t, n) {
      var i = this.view.state, o = i.doc, s = i.selection, u = s.from, f = s.to;
      return Mn(t) && Mn(n) && (u = t, f = n), o.textBetween(u, f, `
`);
    }, e.prototype.setModel = function(t, n) {
      n === void 0 && (n = !1);
      var i = this.view.state, o = i.tr, s = i.doc;
      this.view.dispatch(o.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, o = $e(i, t, n);
      this.view.dispatch(i.setSelection(o).scrollIntoView());
    }, e.prototype.addWidget = function(t, n, i) {
      var o = this.view, s = o.dispatch, u = o.state;
      s(u.tr.setMeta("widget", { pos: i ?? u.selection.to, node: t, style: n }));
    }, e.prototype.replaceWithWidget = function(t, n, i) {
      var o = this.view.state, s = o.tr, u = o.schema, f = io(i, u);
      this.view.dispatch(s.replaceWith(t, n, f));
    }, e.prototype.getRangeInfoOfNode = function(t) {
      var n = this.view.state, i = n.doc, o = n.selection, s = t ? i.resolve(t) : o.$from, u = s.marks(), f = s.node(), d = s.start(), h = s.end(), m = f.type.name;
      if (u.length || m === "paragraph") {
        var y = u[u.length - 1], w = function(k) {
          return k.length ? Et(k, y) : !0;
        };
        m = y ? y.type.name : "text", f.forEach(function(k, b) {
          var T = k.isText, E = k.nodeSize, I = k.marks, P = s.pos - d;
          T && b <= P && b + E >= P && w(I) && (d = d + b, h = d + E);
        });
      }
      return { range: [d, h], type: m };
    }, e;
  })(xk)
), qve = Fr, $ve = Fu;
function Uve(r) {
  return !qve(r) && !$ve(r);
}
var jve = Uve, Wve = jve;
function Gve(r) {
  return Wve(r) && r !== !1;
}
var Kve = Gve, Qve = Kve;
function Jve(r) {
  return !Qve(r);
}
var Xve = Jve, Aw = [
  "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"
], FC = (
  /** @class */
  (function() {
    function r() {
      var e = this;
      this.events = new LC(), this.eventTypes = Aw.reduce(function(t, n) {
        return R(R({}, t), { type: n });
      }, {}), this.hold = !1, Aw.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), o = this.events.get(i.type), s = [];
      return !this.hold && o && o.forEach(function(u) {
        var f = u.apply(void 0, t);
        Fr(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 o = this.events.get(e);
      return !this.hold && o && o.forEach(function(s) {
        var u = s.apply(void 0, rr([t], n));
        Xve(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 !Fr(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), o = i.type, s = i.namespace;
      o && t ? this.removeEventHandlerWithHandler(o, t) : o && !s ? this.events.delete(o) : !o && s ? this.events.forEach(function(u, f) {
        n.removeEventHandlerWithTypeInfo(f, s);
      }) : o && s && this.removeEventHandlerWithTypeInfo(o, 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(o) {
        return o.namespace !== t && n.push(o), 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;
  })()
), Yve = (
  /** @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 xu(r) {
  return r[r.length - 1] === `
` ? r.slice(0, r.length - 1) : r;
}
function Rp(r, e) {
  var t = r.schema, n = e.literal, i = n.match(pa);
  if (i) {
    var o = i[1], s = i[3], u = (o || s).toLowerCase();
    return e.type === "htmlInline" && !!(t.marks[u] || t.nodes[u]);
  }
  return !1;
}
function Pp(r) {
  var e = r.type;
  return Et(["text", "strong", "emph", "strike", "image", "link", "code"], e);
}
function Iw(r) {
  return r?.type === "softbreak";
}
function ps(r) {
  var e = r.type, t = r.literal, n = e === "htmlInline" && t.match(pa);
  if (n) {
    var i = n[1], o = n[3], s = i || o;
    if (s)
      return Et(["ul", "ol", "li"], s.toLowerCase());
  }
  return !1;
}
function Zve(r) {
  var e = r.literal, t = /data-task/.test(e), n = /data-task-checked/.test(e);
  return { task: t, checked: n };
}
function Rw(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  var n = document.createElement("div");
  n.innerHTML = mo(r);
  var i = n.firstChild;
  return e.map(function(o) {
    return i.getAttribute(o) || "";
  });
}
function eme(r) {
  var e = {};
  return Object.keys(r).forEach(function(t) {
    var n = t.split(", ");
    n.forEach(function(i) {
      var o = i.toLowerCase();
      e[o] = r[t];
    });
  }), e;
}
var tme = {
  "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 o = Rw(n, "href")[0];
      r.openMark(i.create({
        linkUrl: o,
        rawHTML: t
      }));
    } else
      r.closeMark(i);
  },
  img: function(r, e, t) {
    var n = e.literal;
    if (t) {
      var i = Rw(n, "src", "alt"), o = i[0], s = i[1], u = r.schema.nodes.image;
      r.addNode(u, R({ rawHTML: t, imageUrl: o }, 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, o = e.next;
    n?.type === "paragraph" ? (Iw(i) && r.openNode(t), Iw(o) ? r.closeNode() : o && (r.closeNode(), r.openNode(t))) : n?.type === "tableCell" && (i && (Pp(i) || Rp(r, i)) && r.closeNode(), o && (Pp(o) || Rp(r, o)) && r.openNode(t));
  },
  pre: function(r, e, t) {
    var n, i, o = document.createElement("div");
    o.innerHTML = e.literal;
    var s = (i = (n = o.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(xu(s)), r.closeNode();
  },
  "ul, ol": function(r, e, t) {
    if (e.parent.type === "tableCell") {
      var n = r.schema.nodes, i = n.bulletList, o = n.orderedList, s = n.paragraph, u = t === "ul" ? i : o;
      t ? (e.prev && !ps(e.prev) && r.closeNode(), r.openNode(u, { rawHTML: t })) : (r.closeNode(), e.next && !ps(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, o = i.listItem, s = i.paragraph;
      if (t) {
        var u = Zve(e);
        e.prev && !ps(e.prev) && r.closeNode(), r.openNode(o, R({ rawHTML: t }, u)), e.next && !ps(e.next) && r.openNode(s);
      } else
        e.prev && !ps(e.prev) && r.closeNode(), r.closeNode();
    }
  }
}, rme = eme(tme);
function Pw(r) {
  return r.type === "htmlInline" && vp.test(r.literal);
}
function zC(r) {
  on(r.childNodes).forEach(function(e) {
    if (vc(e)) {
      var t = e.nodeName.toLowerCase();
      e.setAttribute("data-raw-html", t), e.childNodes && zC(e);
    }
  });
}
var Bw = {
  text: function(r, e) {
    r.addText(e.literal || "");
  },
  paragraph: function(r, e, t, n) {
    var i, o = t.entering;
    if (o) {
      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 o = e, s = o.level, u = o.headingType;
      r.openNode(r.schema.nodes.heading, R({ level: s, headingType: u }, n));
    } else
      r.closeNode();
  },
  codeBlock: function(r, e, t) {
    var n = r.schema.nodes.codeBlock, i = e, o = i.info, s = i.literal;
    r.openNode(n, R({ language: o }, t)), r.addText(xu(s || "")), r.closeNode();
  },
  list: function(r, e, t, n) {
    var i = t.entering;
    if (i) {
      var o = r.schema.nodes, s = o.bulletList, u = o.orderedList, f = e.listData, d = f.type, h = f.start;
      d === "bullet" ? r.openNode(s, n) : r.openNode(u, R({ order: h }, n));
    } else
      r.closeNode();
  },
  item: function(r, e, t, n) {
    var i = t.entering, o = r.schema.nodes.listItem, s = e.listData, u = s.task, f = s.checked;
    if (i) {
      var d = R(R(R({}, u && { task: u }), f && { checked: f }), n);
      r.openNode(o, d);
    } 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, o = t.skipChildren, s = r.schema.nodes.image, u = e, f = u.destination, d = u.firstChild;
    i && o && o(), r.addNode(s, R(R({ imageUrl: f }, d && { altText: d.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, o = r.schema.marks.strong;
    i ? r.openMark(o.create(n)) : r.closeMark(o);
  },
  emph: function(r, e, t, n) {
    var i = t.entering, o = r.schema.marks.emph;
    i ? r.openMark(o.create(n)) : r.closeMark(o);
  },
  link: function(r, e, t, n) {
    var i = t.entering, o = r.schema.marks.link, s = e, u = s.destination, f = s.title;
    if (i) {
      var d = R({ linkUrl: u, title: f }, n);
      r.openMark(o.create(d));
    } else
      r.closeMark(o);
  },
  softbreak: function(r, e) {
    if (e.parent.type === "paragraph") {
      var t = e.prev, n = e.next;
      t && !Pw(t) && r.closeNode(), n && !Pw(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(k) {
        return k && (Pp(k) || Rp(r, k));
      };
      if (n) {
        var o = r.schema.nodes, s = o.tableHeadCell, u = o.tableBodyCell, f = o.paragraph, d = e.parent.parent, h = d.type === "tableHead" ? s : u, m = d.parent, y = (m.columns[e.startIdx] || {}).align, w = R({}, e.attrs);
        y && (w.align = y), r.openNode(h, w), i(e.firstChild) && r.openNode(f);
      } else
        i(e.lastChild) && r.closeNode(), r.closeNode();
    }
  },
  strike: function(r, e, t, n) {
    var i = t.entering, o = r.schema.marks.strike;
    i ? r.openMark(o.create(n)) : r.closeMark(o);
  },
  code: function(r, e, t, n) {
    var i = r.schema.marks.code;
    r.openMark(i.create(n)), r.addText(xu(e.literal || "")), r.closeMark(i);
  },
  customBlock: function(r, e) {
    var t = r.schema.nodes, n = t.customBlock, i = t.paragraph, o = e, s = o.info, u = o.literal;
    r.openNode(n, { info: s }), r.addText(xu(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(pa), i = n[1], o = n[3], s = (i || o).toLowerCase(), u = r.schema.marks[s], f = mo(t);
    if (u?.spec.attrs.htmlInline)
      if (i) {
        var d = Lp(f);
        r.openMark(u.create({ htmlAttrs: d }));
      } else
        r.closeMark(u);
    else {
      var h = rme[s];
      h && h(r, e, i);
    }
  },
  htmlBlock: function(r, e) {
    var t = e.literal, n = document.createElement("div"), i = FO.test(t);
    if (i)
      r.openNode(r.schema.nodes.htmlComment), r.addText(e.literal), r.closeNode();
    else {
      var o = t.match(pa), s = o[1], u = o[3], f = (s || u).toLowerCase(), d = r.schema.nodes[f], h = mo(t);
      if (d?.spec.attrs.htmlBlock) {
        var m = Lp(h), y = yC(e, f);
        r.addNode(d, { htmlAttrs: m, childrenHTML: y });
      } else
        n.innerHTML = h, zC(n), r.convertByDOMParser(n);
    }
  },
  customInline: function(r, e, t) {
    var n = t.entering, i = t.skipChildren, o = e, s = o.info, u = o.firstChild, f = r.schema;
    if (s.indexOf("widget") !== -1 && n) {
      var d = uk(e);
      i(), r.addNode(f.nodes.widget, { info: s }, [
        f.text(sk(s, d))
      ]);
    } else {
      var h = "$$";
      n && (h += u ? s + " " : s), r.addText(h);
    }
  }
};
function nme(r) {
  var e = Object.keys(r), t = R({}, Bw), n = new Oh({
    gfm: !0,
    nodeId: !0,
    convertors: r
  }), i = n.getConvertors();
  return e.forEach(function(o) {
    var s = Bw[o];
    s && !Et(["htmlBlock", "htmlInline"], o) && (t[o] = function(u, f, d) {
      d.origin = function() {
        return i[o](f, d, i);
      };
      var h = r[o](f, d), m;
      if (h) {
        var y = Array.isArray(h) ? h[0] : h, w = y.attributes, k = y.classNames;
        m = { htmlAttrs: w, classNames: k };
      }
      s(u, f, d, m);
    });
  }), t;
}
function ime(r, e) {
  return r.isText && e.isText && Ne.sameSet(r.marks, e.marks) ? r.withText(r.text + e.text) : !1;
}
var ome = (
  /** @class */
  (function() {
    function r(e, t) {
      this.schema = e, this.convertors = t, this.stack = [{ type: this.schema.topNodeType, attrs: null, content: [] }], this.marks = Ne.none;
    }
    return r.prototype.top = function() {
      return Rt(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 = Rt(t), i = this.schema.text(e, this.marks), o = n && ime(n, i);
        o ? t[t.length - 1] = o : 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 = Ne.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 = ao.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, o = i; o >= 0; o -= 1) {
          var s = this.stack[o];
          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(), o = function() {
        var u = i.node, f = i.entering, d = s.convertors[u.type], h = !1;
        if (d) {
          var m = {
            entering: f,
            leaf: !wO(u),
            getChildrenText: kO,
            options: { gfm: !0, nodeId: !1, tagFilter: !1, softbreak: `
` },
            skipChildren: function() {
              h = !0;
            }
          };
          if (s.closeUnmatchedHTMLInline(u, f), d(s, u, m), t?.node === u) {
            var y = s.stack.reduce(function(w, k) {
              return w + k.content.reduce(function(b, T) {
                return b + T.nodeSize;
              }, 0);
            }, 0) + 1;
            t.setMappedPos(y);
          }
        }
        h && (n.resumeAt(u, !1), n.next()), i = n.next();
      }, s = this; i; )
        o();
    }, r.prototype.convertNode = function(e, t) {
      return this.convert(e, t), this.stack.length ? this.closeNode() : null;
    }, r;
  })()
);
function ame(r, e, t) {
  var n = t[0], i = t[1];
  r.write(n), r.convertInline(e), r.write(i);
}
function sme(r, e, t) {
  var n = e.node, i = e.parent, o = t[0], s = t[1];
  r.stopNewline = !0, r.write(o), r.convertNode(n), r.write(s), i?.type.name === "doc" && (r.closeBlock(n), r.stopNewline = !1);
}
function lme(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 + zu("-", Math.max(t, 3)) + i;
}
var Bp = {
  text: function(r, e) {
    var t, n = e.node, i = (t = n.text) !== null && t !== void 0 ? t : "";
    (n.marks || []).some(function(o) {
      return o.type.name === "link";
    }) ? r.text(Vu(i), !1) : r.text(i);
  },
  paragraph: function(r, e) {
    var t = e.node, n = e.parent, i = e.index, o = i === void 0 ? 0 : i;
    if (r.stopNewline)
      r.convertInline(t);
    else {
      var s = o === 0, u = !s && n.child(o - 1), f = u && u.childCount === 0, d = o < n.childCount - 1 && n.child(o + 1), h = d && d.type.name === "paragraph", m = t.childCount === 0;
      if (m && f)
        r.write(`<br>
`);
      else if (m && !f && !s) {
        if (n?.type.name === "listItem") {
          var y = r.getDelim();
          r.setDelim(""), r.write("<br>"), r.setDelim(y);
        }
        r.write(`
`);
      } else
        r.convertInline(t), h ? r.write(`
`) : r.closeBlock(t);
    }
  },
  heading: function(r, e, t) {
    var n = e.node, i = t.delim, o = n.attrs.headingType;
    o === "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, o = t.text, s = i, u = s[0], f = s[1];
    r.write(u), r.ensureNewLine(), r.text(o, !1), r.ensureNewLine(), r.write(f), r.closeBlock(n);
  },
  blockQuote: function(r, e, t) {
    var n = e.node, i = e.parent, o = t.delim;
    i?.type.name === n.type.name && r.flushClose(1), r.wrapBlock(o, null, n, function() {
      return r.convertNode(n);
    });
  },
  bulletList: function(r, e, t) {
    var n = e.node, i = t.delim;
    r.convertList(n, zu(" ", 4), function() {
      return i + " ";
    });
  },
  orderedList: function(r, e) {
    var t = e.node, n = t.attrs.order || 1;
    r.convertList(t, zu(" ", 4), function(i) {
      var o = String(n + i);
      return o + ". ";
    });
  },
  listItem: function(r, e) {
    var t = e.node, n = t.attrs, i = n.task, o = n.checked;
    i && r.write("[" + (o ? "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, o = n.firstChild;
    r.convertNode(n);
    var s = i ?? "";
    !i && o && o.forEach(function(u) {
      var f = u.textContent, d = u.attrs, h = lme(f, d.align);
      s += "| " + h + " ";
    }), 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, o = i === void 0 ? "| " : i;
    r.write(o), r.convertTableCell(n), r.write(" ");
  },
  tableBodyCell: function(r, e, t) {
    var n = e.node, i = t.delim, o = i === void 0 ? "| " : i;
    r.write(o), r.convertTableCell(n), r.write(" ");
  },
  customBlock: function(r, e, t) {
    var n = e.node, i = t.delim, o = t.text, s = i, u = s[0], f = s[1];
    r.write(u), r.ensureNewLine(), r.text(o, !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 ume(r, e) {
  var t = e.state, n = e.nodeInfo, i = e.params, o = i.rawHTML;
  o ? co(r, ["heading", "codeBlock"]) > -1 ? ame(t, n.node, o) : co(r, ["image", "thematicBreak"]) > -1 ? t.write(o) : sme(t, n, o) : Bp[r](t, n, i);
}
function _w(r, e) {
  var t = r.text, n = /`+/g, i = 0;
  if (r.isText && t)
    for (var o = n.exec(t); o; )
      i = Math.max(i, o[0].length), o = 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 Rr(r) {
  return r ? ["<" + r + ">", "</" + r + ">"] : null;
}
function hs(r) {
  return r ? "<" + r + ">" : null;
}
function vs(r) {
  return r ? "</" + r + ">" : null;
}
var ms = {
  heading: function(r) {
    var e = r.node, t = e.attrs, n = t.level, i = zu("#", n);
    return t.headingType === "setext" && (i = n === 1 ? "===" : "---"), {
      delim: i,
      rawHTML: Rr(t.rawHTML)
    };
  },
  codeBlock: function(r) {
    var e = r.node, t = e, n = t.attrs, i = t.textContent;
    return {
      delim: ["```" + (n.language || ""), "```"],
      rawHTML: Rr(n.rawHTML),
      text: i
    };
  },
  blockQuote: function(r) {
    var e = r.node;
    return {
      delim: "> ",
      rawHTML: Rr(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: Rr(i)
    };
  },
  orderedList: function(r, e) {
    var t = r.node, n = e.inTable, i = t.attrs.rawHTML;
    return n && (i = i || "ol"), {
      rawHTML: Rr(i)
    };
  },
  listItem: function(r, e) {
    var t = r.node, n = e.inTable, i = t.attrs, o = i.task, s = i.checked, u = t.attrs.rawHTML;
    n && (u = u || "li");
    var f = o ? ' class="task-list-item' + (s ? " checked" : "") + '"' : "", d = o ? " data-task" + (s ? " data-task-checked" : "") : "";
    return {
      rawHTML: u ? ["<" + u + f + d + ">", "</" + u + ">"] : null
    };
  },
  table: function(r) {
    var e = r.node;
    return {
      rawHTML: Rr(e.attrs.rawHTML)
    };
  },
  tableHead: function(r) {
    var e = r.node;
    return {
      rawHTML: Rr(e.attrs.rawHTML)
    };
  },
  tableBody: function(r) {
    var e = r.node;
    return {
      rawHTML: Rr(e.attrs.rawHTML)
    };
  },
  tableRow: function(r) {
    var e = r.node;
    return {
      rawHTML: Rr(e.attrs.rawHTML)
    };
  },
  tableHeadCell: function(r) {
    var e = r.node;
    return {
      rawHTML: Rr(e.attrs.rawHTML)
    };
  },
  tableBodyCell: function(r) {
    var e = r.node;
    return {
      rawHTML: Rr(e.attrs.rawHTML)
    };
  },
  image: function(r) {
    var e = r.node, t = e.attrs, n = t.rawHTML, i = t.altText, o = t.imageUrl.replace(/&amp;/g, "&"), s = i ? ' alt="' + ta(i) + '"' : "";
    return {
      rawHTML: n ? "<" + n + ' src="' + ta(o) + '"' + s + ">" : null,
      attrs: {
        altText: Vu(i || ""),
        imageUrl: o
      }
    };
  },
  thematicBreak: function(r) {
    var e = r.node;
    return {
      delim: "***",
      rawHTML: hs(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 ? hs(i) : vs(i)
    };
  },
  emph: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs.rawHTML;
    return {
      delim: "*",
      rawHTML: n ? hs(i) : vs(i)
    };
  },
  strike: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs.rawHTML;
    return {
      delim: "~~",
      rawHTML: n ? hs(i) : vs(i)
    };
  },
  link: function(r, e) {
    var t = r.node, n = e.entering, i = t.attrs, o = i.title, s = i.rawHTML, u = i.linkUrl.replace(/&amp;/g, "&"), f = o ? ' title="' + ta(o) + '"' : "";
    return n ? {
      delim: "[",
      rawHTML: s ? "<" + s + ' href="' + ta(u) + '"' + f + ">" : null
    } : {
      delim: "](" + u + (o ? " " + lO(Vu(o)) : "") + ")",
      rawHTML: vs(s)
    };
  },
  code: function(r, e) {
    var t = r.node, n = r.parent, i = r.index, o = i === void 0 ? 0 : i, s = e.entering, u = s ? _w(n.child(o), -1) : _w(n.child(o - 1), 1), f = s ? hs(t.attrs.rawHTML) : vs(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, o = t.attrs.htmlAttrs, s = "<" + i, u = "</" + i + ">";
    return Object.keys(o).forEach(function(f) {
      s += " " + f + '="' + o[f].replace(/"/g, "'") + '"';
    }), s += ">", t.attrs.htmlInline ? {
      rawHTML: n ? s : u
    } : {
      text: "" + s + t.attrs.childrenHTML + u
    };
  }
}, Hw = {
  strong: {
    mixable: !0,
    removedEnclosingWhitespace: !0
  },
  emph: {
    mixable: !0,
    removedEnclosingWhitespace: !0
  },
  strike: {
    mixable: !0,
    removedEnclosingWhitespace: !0
  },
  code: {
    escape: !1
  },
  link: null,
  html: null
};
function cme(r) {
  var e = {}, t = Object.keys(Bp);
  return t.forEach(function(n) {
    e[n] = function(i, o) {
      var s = Bp[n];
      if (s) {
        var u = r[n], f = u ? u(o, {
          inTable: i.inTable
        }) : {};
        ume(n, { state: i, nodeInfo: o, params: f });
      }
    };
  }), e;
}
function fme(r) {
  var e = {}, t = Object.keys(Hw);
  return t.forEach(function(n) {
    e[n] = function(i, o) {
      var s = Hw[n], u = r[n], f = u && i && !Fr(o), d = f ? u(i, { entering: o }) : {};
      return R(R({}, d), s);
    };
  }), e;
}
function dme(r) {
  var e = Object.keys(r);
  e.forEach(function(i) {
    var o = ms[i], s = r[i];
    o ? ms[i] = function(u, f) {
      return f.origin = function() {
        return o(u, f);
      }, s(u, f);
    } : ms[i] = s, delete r[i];
  });
  var t = cme(ms), n = fme(ms);
  return {
    nodeTypeConvertors: t,
    markTypeConvertors: n
  };
}
var pme = (
  /** @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 o = this.getMarkConvertor(e);
      if (o) {
        var s = o({ 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 o = this.getDelim();
      this.write(t || e), this.setDelim(this.getDelim() + e), i(), this.setDelim(o), 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 ? sO(n[i]) : n[i], i !== n.length - 1 && (this.result += `
`);
    }, r.prototype.convertBlock = function(e, t, n) {
      var i = e.type.name, o = this.nodeTypeConvertors[i], s = { node: e, parent: t, index: n };
      e.attrs.htmlBlock ? this.nodeTypeConvertors.html(this, s) : o && o(this, s);
    }, r.prototype.convertInline = function(e) {
      var t = this, n = [], i = "", o = function(s, u, f) {
        var d = s ? s.marks : [], h = i;
        i = "";
        var m = s && s.isText && d.some(function(be) {
          var Re = t.getMarkConvertor(be), ze = Re && Re();
          return ze && ze.removedEnclosingWhitespace;
        });
        if (m && s && s.text) {
          var y = /^(\s*)(.*?)(\s*)$/m.exec(s.text), w = y[1], k = y[2], b = y[3];
          h += w, i = b, (w || b) && (s = k ? s.withText(k) : null, s || (d = n));
        }
        for (var T = d.length && Rt(d), E = T && t.getMarkConvertor(T), I = E && E(), P = I && I.escape === !1, _ = d.length - (P ? 1 : 0), V = 0; V < _; V += 1) {
          var k = d[V];
          if (I && !I.mixable)
            break;
          for (var W = 0; W < n.length; W += 1) {
            var q = n[W];
            if (I && !I.mixable)
              break;
            if (k.eq(q)) {
              V > W ? d = d.slice(0, W).concat(k).concat(d.slice(W, V)).concat(d.slice(V + 1, _)) : W > V && (d = d.slice(0, V).concat(d.slice(V + 1, W)).concat(k).concat(d.slice(W, _)));
              break;
            }
          }
        }
        for (var K = 0; K < Math.min(n.length, _) && d[K].eq(n[K]); )
          K += 1;
        for (; K < n.length; ) {
          var ce = n.pop();
          ce && t.text(t.markText(ce, !1, e, f), !1);
        }
        if (h && t.text(h), s) {
          for (; n.length < _; ) {
            var k = d[n.length];
            n.push(k), t.text(t.markText(k, !0, e, f), !1);
          }
          P && s.isText ? t.text(t.markText(T, !0, e, f) + s.text + t.markText(T, !1, e, f + 1), !1) : t.convertBlock(s, e, f);
        }
      };
      e.forEach(o), o(null, null, e.childCount);
    }, r.prototype.convertList = function(e, t, n) {
      var i = this, o;
      this.closed && this.closed.type === e.type ? this.flushClose(3) : this.tightList && this.flushClose(1);
      var s = (o = e.attrs.tight) !== null && o !== void 0 ? o : !0, u = this.tightList;
      this.tightList = s, e.forEach(function(f, d, h) {
        h && s && i.flushClose(1), i.wrapBlock(t, n(h), e, function() {
          return i.convertBlock(f, e, h);
        });
      }), this.tightList = u;
    }, r.prototype.convertTableCell = function(e) {
      var t = this;
      this.stopNewline = !0, this.inTable = !0, e.forEach(function(n, i, o) {
        if (Et(["bulletList", "orderedList"], n.type.name))
          t.convertBlock(n, e, o), t.closed = !1;
        else if (t.convertInline(n), o < e.childCount - 1) {
          var s = e.child(o + 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, o, s) {
        if (n.convertBlock(i, e, s), t?.node === i) {
          var u = n.result.split(`
`);
          t.setMappedPos([u.length, Rt(u).length + 1]);
        }
      }), this.result;
    }, r;
  })()
), hme = (
  /** @class */
  (function() {
    function r(e, t, n, i) {
      var o = this;
      this.setMappedPos = function(s) {
        o.mappedPosWhenConverting = s;
      }, this.schema = e, this.eventEmitter = i, this.focusedNode = null, this.mappedPosWhenConverting = null, this.toWwConvertors = nme(n), this.toMdConvertors = dme(t || {}), this.eventEmitter.listen("setFocusedNode", function(s) {
        return o.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 ome(this.schema, this.toWwConvertors);
      return t.convertNode(e, this.getInfoForPosSync());
    }, r.prototype.toMarkdownText = function(e) {
      var t = new pme(this.toMdConvertors), n = t.convertNode(e, this.getInfoForPosSync());
      return n = this.eventEmitter.emitReduce("beforeConvertWysiwygToMarkdown", n), n;
    }, r;
  })()
);
function vme(r) {
  var e = r.plugin, t = r.eventEmitter, n = r.usageStatistics, i = r.instance, o = { Plugin: nr, PluginKey: Fs, Selection: ke, TextSelection: Ce }, s = { Decoration: er, DecorationSet: Je }, u = { Fragment: F }, f = { InputRule: Ti, inputRules: Z1, undoInputRule: rM }, d = { keymap: Bs }, h = {
    eventEmitter: t,
    usageStatistics: n,
    instance: i,
    pmState: o,
    pmView: s,
    pmModel: u,
    pmRules: f,
    pmKeymap: d,
    i18n: he
  };
  if (Ca(e)) {
    var m = e[0], y = e[1], w = y === void 0 ? {} : y;
    return m(h, w);
  }
  return e(h);
}
function VC(r) {
  var e = r.plugins, t = r.eventEmitter, n = r.usageStatistics, i = r.instance;
  return t.listen("mixinTableOffsetMapPrototype", Gpe), (e ?? []).reduce(function(o, s) {
    var u = vme({
      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, d = u.toHTMLRenderers, h = u.toMarkdownRenderers, m = u.markdownPlugins, y = u.wysiwygPlugins, w = u.wysiwygNodeViews, k = u.markdownCommands, b = u.wysiwygCommands, T = u.toolbarItems;
    return d && (o.toHTMLRenderers = qu(o.toHTMLRenderers, d)), h && (o.toMarkdownRenderers = qu(o.toMarkdownRenderers, h)), m && (o.mdPlugins = o.mdPlugins.concat(m)), y && (o.wwPlugins = o.wwPlugins.concat(y)), w && (o.wwNodeViews = R(R({}, o.wwNodeViews), w)), k && (o.mdCommands = R(R({}, o.mdCommands), k)), b && (o.wwCommands = R(R({}, o.wwCommands), b)), T && (o.toolbarItems = o.toolbarItems.concat(T)), f && (o.markdownParsers = R(R({}, o.markdownParsers), f)), o;
  }, {
    toHTMLRenderers: {},
    toMarkdownRenderers: {},
    mdPlugins: [],
    wwPlugins: [],
    wwNodeViews: {},
    mdCommands: {},
    wwCommands: {},
    toolbarItems: [],
    markdownParsers: {}
  });
}
var mme = "data-task", gme = "data-task-disabled", yme = "checked";
function wme(r) {
  ["htmlBlock", "htmlInline"].forEach(function(e) {
    r[e] && Object.keys(r[e]).forEach(function(t) {
      return gC(t);
    });
  });
}
var qC = (
  /** @class */
  (function() {
    function r(e) {
      var t = this;
      this.options = ih({
        linkAttributes: null,
        extendedAutolinks: !1,
        customHTMLRenderer: null,
        referenceDefinition: !1,
        customHTMLSanitizer: null,
        frontMatter: !1,
        usageStatistics: !0,
        theme: "light"
      }, e), this.eventEmitter = new FC();
      var n = ik(this.options.linkAttributes), i = VC({
        plugins: this.options.plugins,
        eventEmitter: this.eventEmitter,
        usageStatistics: this.options.usageStatistics,
        instance: this
      }) || {}, o = i.toHTMLRenderers, s = i.markdownParsers, u = this.options, f = u.customHTMLRenderer, d = u.extendedAutolinks, h = u.referenceDefinition, m = u.frontMatter, y = u.customHTMLSanitizer, w = {
        linkAttributes: n,
        customHTMLRenderer: R(R({}, o), f),
        extendedAutolinks: d,
        referenceDefinition: h,
        frontMatter: m,
        sanitizer: y || mo
      };
      wme(w.customHTMLRenderer), this.options.events && ca(this.options.events, function(P, _) {
        t.on(_, P);
      });
      var k = this.options, b = k.el, T = k.initialValue, E = k.theme, I = b.innerHTML;
      E !== "light" && b.classList.add(re(E)), b.innerHTML = "", this.toastMark = new pC("", {
        disallowedHtmlBlockTags: ["br", "img"],
        extendedAutolinks: d,
        referenceDefinition: h,
        disallowDeepHeading: !0,
        frontMatter: m,
        customParser: s
      }), this.preview = new kC(this.eventEmitter, R(R({}, w), { isViewer: !0 })), Pk(this.preview.previewContent, "mousedown", this.toggleTask.bind(this)), T ? this.setMarkdown(T) : I && this.preview.setHTML(I), b.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(gme) && t.hasAttribute(mme) && ph(n, e.offsetX, e.offsetY) && (hh(t, yme), this.eventEmitter.emit("change", {
        source: "viewer",
        date: e
      }));
    }, r.prototype.setMarkdown = function(e) {
      var t = this.toastMark.getLineTexts(), n = t.length, i = Rt(t), o = [n, i.length + 1], s = this.toastMark.editMarkdown([1, 1], o, 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() {
      Rk(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 Su(r) {
  return r instanceof pi;
}
function $C(r) {
  var e = [
    "document",
    "blockQuote",
    "bulletList",
    "orderedList",
    "listItem",
    "paragraph",
    "heading",
    "emph",
    "strong",
    "strike",
    "link",
    "image",
    "table",
    "tableHead",
    "tableBody",
    "tableRow",
    "tableHeadCell",
    "tableBodyCell"
  ];
  return Et(e, r);
}
function kme(r) {
  var e = r.attrs, t = r.type, n = t.name, i = {
    type: n,
    wysiwygNode: !0,
    literal: !$C(n) && Su(r) ? r.textContent : null
  }, o = {
    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 = o[n], u = R(R({}, i), s), f = r.attrs, d = f.htmlAttrs, h = f.childrenHTML;
  return d ? R(R({}, u), { attrs: d, childrenHTML: h }) : u;
}
var Cme = {
  openTag: function(r, e) {
    var t = r, n = t.tagName, i = t.classNames, o = t.attributes, s = document.createElement(n), u = {};
    i && (s.className = i.join(" ")), o && (u = R(R({}, u), o)), mh(u, s), e.push(s);
  },
  closeTag: function(r, e) {
    if (e.length > 1) {
      var t = e.pop();
      Rt(e).appendChild(t);
    }
  },
  html: function(r, e) {
    Rt(e).insertAdjacentHTML("beforeend", r.content);
  },
  text: function(r, e) {
    var t = document.createTextNode(r.content);
    Rt(e).appendChild(t);
  }
}, bme = (
  /** @class */
  (function() {
    function r(e, t) {
      var n = Nh(e, t), i = R(R({}, t.htmlBlock), t.htmlInline);
      this.customConvertorKeys = Object.keys(t).concat(Object.keys(i)), this.renderer = new Oh({
        gfm: !0,
        convertors: R(R({}, n), i)
      }), this.convertors = this.renderer.getConvertors();
    }
    return r.prototype.generateTokens = function(e) {
      var t = kme(e), n = {
        entering: !0,
        leaf: Su(e) ? e.isLeaf : !1,
        options: this.renderer.getOptions(),
        getChildrenText: function() {
          return Su(e) ? e.textContent : "";
        },
        skipChildren: function() {
          return !1;
        }
      }, i = this.convertors[e.type.name], o = i(t, n, this.convertors), s = Ca(o) ? o : [o];
      return ($C(e.type.name) || e.attrs.htmlInline) && (n.entering = !1, s.push({ type: "text", content: Su(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 Cme[i.type](i, n);
      }), n[0];
    }, r.prototype.getToDOMNode = function(e) {
      return Et(this.customConvertorKeys, e) ? this.toDOMNode.bind(this) : null;
    }, r;
  })()
), Tme = 100, xme = 15, hu = null, Jd = null;
function Fw(r, e) {
  var t = e.syncScrollTop, n = e.releaseEventBlock;
  Jd && clearTimeout(Jd), t(r), Jd = setTimeout(function() {
    n();
  }, xme);
}
function Sme(r, e, t) {
  var n = e - r, i = Date.now(), o = function() {
    var s = Date.now(), u = (s - i) / Tme, f;
    hu && clearTimeout(hu), u < 1 ? (f = r + n * Math.cos((1 - u) * Math.PI / 2), Fw(Math.ceil(f), t), hu = setTimeout(o, 1)) : (Fw(e, t), hu = null);
  };
  o();
}
var Eme = 18, Mme = (
  /** @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, o = t.el;
      this.previewRoot = i, this.previewEl = o, 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 = Wd(this.previewRoot, t).el, o = Yu(i, this.previewRoot) || i.offsetTop, s = i.clientHeight, u = o + 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, o = t.previewRoot, s = n.dom.getBoundingClientRect(), u = s.left, f = s.top, d = n.posAtCoords({ left: u, top: f }), h = n.state.doc, m = this.getMdNodeAtPos(h, d);
      if (!(!m || dO(m))) {
        var y = i.scrollTop, w = n.dom, k = w.scrollTop, b = w.scrollHeight, T = w.clientHeight, E = w.children, I = b - k <= T + Eme, P = I ? i.scrollHeight : 0;
        if (k && !I) {
          if (e) {
            var _ = this.getScrollTopByCaretPos();
            if (!_)
              return;
            P = _;
          } else {
            var V = Wd(this.previewRoot, m), W = V.el, q = V.mdNode, K = xw(h, q, E), ce = K.height, be = K.rect, Re = Yu(W, o) || W.offsetTop, ze = W.clientHeight, st = f > be.top ? Math.min((f - be.top) / ce, 1) : 0;
            P = Re + ze * st;
          }
          P = this.getResolvedScrollTop("editor", k, P, y), this.latestEditorScrollTop = k;
        }
        P !== y && this.run("editor", P, y);
      }
    }, r.prototype.syncEditorScrollTop = function(e) {
      var t = this, n = t.toastMark, i = t.editorView, o = t.previewRoot, s = t.previewEl, u = i.dom, f = i.state, d = s.scrollTop, h = s.clientHeight, m = s.scrollHeight, y = m - d <= h, w = u.scrollTop, k = y ? u.scrollHeight : 0;
      if (d && e && !y) {
        if (e = Tpe(e, o), !e.getAttribute("data-nodeid"))
          return;
        var b = u.children, T = Number(e.getAttribute("data-nodeid")), E = Wd(this.previewRoot, n.findNodeById(T)), I = E.mdNode, P = E.el, _ = Us(I);
        k = b[_ - 1].offsetTop;
        var V = xw(f.doc, I, b).height, W = Dpe(P, o, T), q = W.nodeHeight, K = W.offsetTop;
        k += Spe(d, K, q, V), k = this.getResolvedScrollTop("preview", d, k, w), this.latestPreviewScrollTop = d;
      }
      k !== w && this.run("preview", k, w);
    }, r.prototype.getResolvedScrollTop = function(e, t, n, i) {
      var o = e === "editor" ? this.latestEditorScrollTop : this.latestPreviewScrollTop;
      return o === null ? n : o < t ? Math.max(n, i) : Math.min(n, i);
    }, r.prototype.run = function(e, t, n) {
      var i = this, o;
      e === "editor" ? (o = this.previewEl, this.blockedScroll = "preview") : (o = this.editorView.dom, this.blockedScroll = "editor");
      var s = {
        syncScrollTop: function(u) {
          return o.scrollTop = u;
        },
        releaseEventBlock: function() {
          return i.blockedScroll = null;
        }
      };
      Sme(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;
  })()
), Ome = {
  getPopupInitialValues: function(r, e) {
    var t = e.popupName;
    return t === "link" ? { linkText: r.getSelectedText() } : {};
  }
};
function Nme(r) {
  r.eventEmitter.listen("query", function(e, t) {
    return Ome[e](r, t);
  });
}
var UC = (
  /** @class */
  (function() {
    function r(e) {
      var t = this;
      this.initialHTML = e.el.innerHTML, e.el.innerHTML = "", this.options = ih({
        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, o = n.extendedAutolinks, s = n.referenceDefinition, u = n.frontMatter, f = n.customMarkdownRenderer, d = n.useCommandShortcut, h = n.initialEditType, m = n.widgetRules, y = n.customHTMLSanitizer;
      this.mode = h || "markdown", this.mdPreviewStyle = this.options.previewStyle, this.i18n = he, this.i18n.setCode(this.options.language), this.eventEmitter = new FC(), bO(m);
      var w = ik(this.options.linkAttributes);
      this.pluginInfo = VC({
        plugins: this.options.plugins,
        eventEmitter: this.eventEmitter,
        usageStatistics: this.options.usageStatistics,
        instance: this
      });
      var k = this.pluginInfo, b = k.toHTMLRenderers, T = k.toMarkdownRenderers, E = k.mdPlugins, I = k.wwPlugins, P = k.wwNodeViews, _ = k.mdCommands, V = k.wwCommands, W = k.markdownParsers, q = {
        linkAttributes: w,
        customHTMLRenderer: qu(b, i),
        extendedAutolinks: o,
        referenceDefinition: s,
        frontMatter: u,
        sanitizer: y || mo
      }, K = new bme(w, q.customHTMLRenderer), ce = mpe(q.customHTMLRenderer, q.sanitizer, K);
      this.toastMark = new pC("", {
        disallowedHtmlBlockTags: ["br", "img"],
        extendedAutolinks: o,
        referenceDefinition: s,
        disallowDeepHeading: !0,
        frontMatter: u,
        customParser: W
      }), this.mdEditor = new xL(this.eventEmitter, {
        toastMark: this.toastMark,
        useCommandShortcut: d,
        mdPlugins: E
      }), this.preview = new kC(this.eventEmitter, R(R({}, q), { isViewer: !1, highlight: this.options.previewHighlight })), this.wwEditor = new Vve(this.eventEmitter, {
        toDOMAdaptor: K,
        useCommandShortcut: d,
        htmlSchemaMap: ce,
        linkAttributes: w,
        wwPlugins: I,
        wwNodeViews: P
      }), this.convertor = new hme(this.wwEditor.getSchema(), R(R({}, T), f), Nh(w, q.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 Yve(this.eventEmitter, this.mdEditor.commands, this.wwEditor.commands, function() {
        return t.mode;
      }), this.options.usageStatistics && nO(), this.scrollSync = new Mme(this.mdEditor, this.preview, this.eventEmitter), this.addInitEvent(), this.addInitCommand(_, V), Nme(this), this.options.hooks && ca(this.options.hooks, function(be, Re) {
        return t.addHook(Re, be);
      }), this.options.events && ca(this.options.events, function(be, Re) {
        return t.on(Re, be);
      }), 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);
        }
      }), KO(this.eventEmitter);
    }, r.prototype.addInitCommand = function(e, t) {
      var n = this, i = function(o, s) {
        Object.keys(s).forEach(function(u) {
          n.addCommand(o, u, s[u]);
        });
      };
      this.addCommand("markdown", "toggleScrollSync", function(o) {
        return n.eventEmitter.emit("toggleScrollSync", o.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 qC(e) : new r(e);
    }, r.setLanguage = function(e, t) {
      he.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, o = 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, o);
    }, 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 = jO(e);
      var i = ao.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(), o = e.convertor.toWysiwygModel(i);
          e.wwEditor.setModel(o);
        }
      });
      var t = gh(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;
      Rn(e) && (e === "auto" ? Zr(t, "auto-height") : Br(t, "auto-height"), this.setMinHeight(this.getMinHeight())), nn(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("." + re("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 o = this.convertor.getMappedPos();
          this.focus(), this.isWysiwygMode() && Mn(o) ? this.wwEditor.setSelection(o) : Array.isArray(o) && this.mdEditor.setSelection(o);
        }
      }
    }, 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, o;
      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), d = e, h = t;
      if (u !== f)
        throw new Error("Types of arguments must be same");
      return n === "markdown" && !u && !f ? (i = wu(s, e, t), d = i[0], h = i[1]) : n === "wysiwyg" && u && f && (o = Qi(s, e, t), d = o[0], h = o[1]), [d, h];
    }, r;
  })()
);
function Lme(r) {
  for (var e, t, n = arguments, i = 1, o = "", s = "", u = [0], f = function(h) {
    i === 1 && (h || (o = o.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? u.push(h ? n[h] : o) : i === 3 && (h || o) ? (u[1] = h ? n[h] : o, i = 2) : i === 2 && o === "..." && h ? u[2] = ch(u[2] || {}, n[h]) : i === 2 && o && !h ? (u[2] = u[2] || {})[o] = !0 : i >= 5 && (i === 5 ? ((u[2] = u[2] || {})[t] = h ? o ? o + n[h] : n[h] : o, i = 6) : (h || o) && (u[2][t] += h ? o + n[h] : o)), o = "";
  }, d = 0; d < r.length; d++) {
    d && (i === 1 && f(), f(d));
    for (let h = 0; h < r[d].length; h++)
      e = r[d][h], i === 1 ? e === "<" ? (f(), u = [u, "", null], i = 3) : o += e : i === 4 ? o === "--" && e === ">" ? (i = 1, o = "") : o = e + o[0] : s ? e === s ? s = "" : o += e : e === '"' || e === "'" ? s = e : e === ">" ? (f(), i = 1) : i && (e === "=" ? (i = 5, t = o, o = "") : e === "/" && (i < 5 || r[d][h + 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) : o += e), i === 3 && o === "!--" && (i = 4, u = u[0]);
  }
  return f(), u.length > 2 ? u.slice(1) : u[1];
}
function Dme(r) {
  return typeof r == "boolean" || r instanceof Boolean;
}
var Ame = Dme, Ime = (
  /** @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;
  })()
), Hr = (
  /** @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 Ime(this);
    }, r.removalNodes = [], r;
  })()
);
function Rme(r) {
  return new Hr("TEXT_NODE", { nodeValue: r }, []);
}
function zw(r, e) {
  var t = r;
  Ame(r) || r == null ? t = null : (Rn(r) || Mn(r)) && (t = Rme(String(r))), t && e.push(t);
}
function Pme(r, e) {
  for (var t = [], n = 2; n < arguments.length; n++)
    t[n - 2] = arguments[n];
  var i = [];
  return t.forEach(function(o) {
    Array.isArray(o) ? o.forEach(function(s) {
      zw(s, i);
    }) : zw(o, i);
  }), new Hr(r, e || {}, i);
}
var Se = Lme.bind(Pme);
function Bme(r) {
  return r === Object(r);
}
var _me = Bme;
function Hme(r) {
  var e;
  return r.type === "TEXT_NODE" ? e = document.createTextNode(r.props.nodeValue) : (e = document.createElement(r.type), WC(e, {}, r.props)), e;
}
function jC(r, e) {
  r.node ? e.removeChild(r.node) : jC(r.firstChild, e);
}
function Fme(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] && !zO(r) && r.removeAttribute(n);
  }), WC(r, e, t, function(n) {
    return !ah(e[n], t[n]);
  });
}
var zme = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
function WC(r, e, t, n) {
  Object.keys(t).forEach(function(i) {
    if (!n || n(i))
      if (/^on/.test(i)) {
        var o = i.slice(2).toLowerCase();
        r.addEventListener(o, t[i]);
      } else i === "nodeValue" ? r[i] = t[i] : i === "style" && _me(t[i]) ? Vme(r, e[i], t[i]) : i !== "children" && (t[i] === !1 ? r.removeAttribute(i) : r.setAttribute(i, t[i]));
  });
}
function Vme(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] = Mn(i) && !zme.test(n) ? i + "px" : i;
  });
}
function Ah(r) {
  if (Hr.removalNodes.forEach(function(o) {
    return qw(o);
  }), r) {
    for (var e = void 0, t = r.walker(); e = t.walk(); )
      if (r = e.vnode, e.entering)
        qw(r);
      else if (xr(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 Vw(r) {
  for (var e = r.parent; !e.node; )
    e = e.parent;
  return e.node;
}
function qw(r) {
  if (!(!r || !r.parent)) {
    if (r.node) {
      var e = Vw(r);
      r.effect === "A" ? e.appendChild(r.node) : r.effect === "U" && Fme(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 (xr(r.type)) {
            var i = r.component;
            i.beforeDestroy && i.beforeDestroy();
          } else {
            var e = Vw(r);
            jC(r, e);
          }
    }
    r.ref && (r.component ? r.ref(r.component) : r.node && r.ref(r.node));
  }
}
function qme(r, e) {
  var t = e.props, n = e.component;
  return n ? (n.prevProps = n.props, n.props = e.props, n) : new r(t);
}
function GC(r) {
  for (var e = r; r && !r.skip; ) {
    if (xr(r.type)) {
      var t = qme(r.type, r);
      t.vnode = r, r.component = t, r.props.children = r.children = [t.render()], $w(r);
    } else
      r.node || (r.node = Hme(r)), $w(r);
    if (r.firstChild)
      r = r.firstChild;
    else {
      for (; r && r.parent && !r.next && (r = r.parent, r !== e); )
        ;
      r = r.next;
    }
  }
}
function $me(r, e) {
  return r && e && e.type === r.type && (!e.key || e.key === r.key);
}
function $w(r) {
  var e = r.children, t = r.old ? r.old.firstChild : null, n = null;
  e.forEach(function(o, s) {
    var u = $me(t, o);
    u && (o.old = t, o.parent = r, o.node = t.node, o.component = t.component, o.effect = "U"), o && !u && (o.old = null, o.parent = r, o.node = null, o.effect = "A"), t && !u && (Hr.removalNodes.push(t), t.effect = "D"), t && (t = t.next), s === 0 ? r.firstChild = o : o && (n.next = o), n = o;
  });
  var i = Rt(e);
  if (!e.length)
    for (; t; )
      Hr.removalNodes.push(t), t.effect = "D", t = t.next;
  for (; t && i; )
    t && i.old !== t && (Hr.removalNodes.push(t), t.effect = "D", t = t.next);
}
function Ume(r) {
  r.effect = "D", Hr.removalNodes = [r], Ah(), Hr.removalNodes = [];
}
function jme(r) {
  var e = r.vnode;
  e.effect = "U", e.old = e, e.next && (e.next.skip = !0), Hr.removalNodes = [], GC(e), Ah(e), e.next && (e.next.skip = !1);
}
function Wme(r, e) {
  var t = new Hr(r.tagName.toLowerCase(), {}, [e]);
  return t.node = r, Hr.removalNodes = [], GC(t), Ah(t), function() {
    return Ume(t.firstChild);
  };
}
var _t = (
  /** @class */
  (function() {
    function r(e) {
      this.props = e, this.state = {}, this.refs = {};
    }
    return r.prototype.setState = function(e) {
      var t = R(R({}, this.state), e);
      ah(this.state, t) || (this.state = t, jme(this));
    }, r;
  })()
), Gme = (
  /** @class */
  (function(r) {
    Y(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 Se(Uw || (Uw = xe([`
      <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>
    `
      ])), re("mode-switch"), this.state.hide ? "none" : "block", n === "markdown" ? " active" : "", function() {
        i.emit("needChangeMode", "markdown");
      }, he.get("Markdown"), n === "wysiwyg" ? " active" : "", function() {
        i.emit("needChangeMode", "wysiwyg");
      }, he.get("WYSIWYG"));
    }, e;
  })(_t)
), Uw;
function Kme(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 Qme = Kme, Jme = Qme;
function Xme(r, e) {
  var t, n = !0, i = function(h) {
    r.apply(null, h), t = null;
  }, o, s, u;
  e = e || 0, o = Jme(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, o(u), s - t >= e && i(u);
  }
  function d() {
    n = !0, t = null;
  }
  return f.reset = d, f;
}
var Yme = Xme, KC = (function() {
  if (typeof Map < "u")
    return Map;
  function r(e, t) {
    var n = -1;
    return e.some(function(i, o) {
      return i[0] === t ? (n = o, !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, o = this.__entries__; i < o.length; i++) {
          var s = o[i];
          t.call(n, s[1], s[0]);
        }
      }, e;
    })()
  );
})(), _p = typeof window < "u" && typeof document < "u" && window.document === document, ec = (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")();
})(), Zme = (function() {
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(ec) : function(r) {
    return setTimeout(function() {
      return r(Date.now());
    }, 1e3 / 60);
  };
})(), ege = 2;
function tge(r, e) {
  var t = !1, n = !1, i = 0;
  function o() {
    t && (t = !1, r()), n && u();
  }
  function s() {
    Zme(o);
  }
  function u() {
    var f = Date.now();
    if (t) {
      if (f - i < ege)
        return;
      n = !0;
    } else
      t = !0, n = !1, setTimeout(s, e);
    i = f;
  }
  return u;
}
var rge = 20, nge = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], ige = typeof MutationObserver < "u", oge = (
  /** @class */
  (function() {
    function r() {
      this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = tge(this.refresh.bind(this), rge);
    }
    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() {
      !_p || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), ige ? (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() {
      !_p || !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 = nge.some(function(o) {
        return !!~n.indexOf(o);
      });
      i && this.refresh();
    }, r.getInstance = function() {
      return this.instance_ || (this.instance_ = new r()), this.instance_;
    }, r.instance_ = null, r;
  })()
), QC = (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;
}), wa = (function(r) {
  var e = r && r.ownerDocument && r.ownerDocument.defaultView;
  return e || ec;
}), JC = Tc(0, 0, 0, 0);
function tc(r) {
  return parseFloat(r) || 0;
}
function jw(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  return e.reduce(function(n, i) {
    var o = r["border-" + i + "-width"];
    return n + tc(o);
  }, 0);
}
function age(r) {
  for (var e = ["top", "right", "bottom", "left"], t = {}, n = 0, i = e; n < i.length; n++) {
    var o = i[n], s = r["padding-" + o];
    t[o] = tc(s);
  }
  return t;
}
function sge(r) {
  var e = r.getBBox();
  return Tc(0, 0, e.width, e.height);
}
function lge(r) {
  var e = r.clientWidth, t = r.clientHeight;
  if (!e && !t)
    return JC;
  var n = wa(r).getComputedStyle(r), i = age(n), o = i.left + i.right, s = i.top + i.bottom, u = tc(n.width), f = tc(n.height);
  if (n.boxSizing === "border-box" && (Math.round(u + o) !== e && (u -= jw(n, "left", "right") + o), Math.round(f + s) !== t && (f -= jw(n, "top", "bottom") + s)), !cge(r)) {
    var d = Math.round(u + o) - e, h = Math.round(f + s) - t;
    Math.abs(d) !== 1 && (u -= d), Math.abs(h) !== 1 && (f -= h);
  }
  return Tc(i.left, i.top, u, f);
}
var uge = /* @__PURE__ */ (function() {
  return typeof SVGGraphicsElement < "u" ? function(r) {
    return r instanceof wa(r).SVGGraphicsElement;
  } : function(r) {
    return r instanceof wa(r).SVGElement && typeof r.getBBox == "function";
  };
})();
function cge(r) {
  return r === wa(r).document.documentElement;
}
function fge(r) {
  return _p ? uge(r) ? sge(r) : lge(r) : JC;
}
function dge(r) {
  var e = r.x, t = r.y, n = r.width, i = r.height, o = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, s = Object.create(o.prototype);
  return QC(s, {
    x: e,
    y: t,
    width: n,
    height: i,
    top: t,
    right: e + n,
    bottom: i + t,
    left: e
  }), s;
}
function Tc(r, e, t, n) {
  return { x: r, y: e, width: t, height: n };
}
var pge = (
  /** @class */
  (function() {
    function r(e) {
      this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Tc(0, 0, 0, 0), this.target = e;
    }
    return r.prototype.isActive = function() {
      var e = fge(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;
  })()
), hge = (
  /** @class */
  /* @__PURE__ */ (function() {
    function r(e, t) {
      var n = dge(t);
      QC(this, { target: e, contentRect: n });
    }
    return r;
  })()
), vge = (
  /** @class */
  (function() {
    function r(e, t, n) {
      if (this.activeObservations_ = [], this.observations_ = new KC(), 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 wa(e).Element))
          throw new TypeError('parameter 1 is not of type "Element".');
        var t = this.observations_;
        t.has(e) || (t.set(e, new pge(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 wa(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 hge(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;
  })()
), XC = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new KC(), YC = (
  /** @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 = oge.getInstance(), n = new vge(e, t, this);
      XC.set(this, n);
    }
    return r;
  })()
);
[
  "observe",
  "unobserve",
  "disconnect"
].forEach(function(r) {
  YC.prototype[r] = function() {
    var e;
    return (e = XC.get(this))[r].apply(e, arguments);
  };
});
var mge = (function() {
  return typeof ec.ResizeObserver < "u" ? ec.ResizeObserver : YC;
})(), gge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e() {
      return r !== null && r.apply(this, arguments) || this;
    }
    return e.prototype.execCommand = function(t) {
      var n = en(t.target, "li");
      this.props.execCommand("heading", {
        level: Number(n.getAttribute("data-level"))
      });
    }, e.prototype.render = function() {
      var t = this;
      return Se(Gw || (Gw = xe([`
      <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);
      }, he.get("Headings"), [1, 2, 3, 4, 5, 6].map(function(n) {
        return Se(Ww || (Ww = xe([`
              <li data-level="`, `" data-type="Heading" aria-role="menuitem">
                <`, ">", " ", `</$>
              </li>
            `], [`
              <li data-level="`, `" data-type="Heading" aria-role="menuitem">
                <`, ">", " ", `</$>
              </li>
            `])), n, "h" + n, he.get("Heading"), n);
      }), he.get("Paragraph"));
    }, e;
  })(_t)
), Ww, Gw, ZC = (
  /** @class */
  (function(r) {
    Y(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 Se(Qw || (Qw = xe([`
      <div class="`, `" aria-role="tabpanel">
        `, `
      </div>
    `], [
        `
      <div class="`,
        `" aria-role="tabpanel">
        `,
        `
      </div>
    `
      ])), re("tabs"), this.props.tabs.map(function(n) {
        var i = n.name, o = n.text, s = t.props.activeTab === i;
        return Se(Kw || (Kw = xe([`
            <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);
        }, he.get(o), s ? "true" : "false", s ? "0" : "-1", he.get(o));
      }));
    }, e;
  })(_t)
), Kw, Qw, yge = "ui", wge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.initialize = function(i) {
        i === void 0 && (i = "file");
        var o = n.refs.url;
        o.value = "", n.refs.altText.value = "", n.refs.file.value = "", Br(o, "wrong"), n.setState({ activeTab: i, file: null, fileNameElClassName: "" });
      }, n.execCommand = function() {
        n.state.activeTab === "file" ? n.emitAddImageBlob() : n.emitAddImage();
      }, n.toggleTab = function(i, o) {
        o !== n.state.activeTab && n.initialize(o);
      }, n.showFileSelectBox = function() {
        n.refs.file.click();
      }, n.changeFile = function(i) {
        var o = i.target.files;
        o?.length && n.setState({ file: o[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, o = " wrong";
      if (n?.length) {
        o = "";
        var s = n.item(0), u = function(f, d) {
          return t.props.execCommand("addImage", { imageUrl: f, altText: d || i.value });
        };
        this.props.eventEmitter.emit("addImageBlobHook", s, u, yge);
      }
      this.setState({ fileNameElClassName: o });
    }, e.prototype.emitAddImage = function() {
      var t = this.refs.url, n = this.refs.altText, i = t.value, o = n.value || "image";
      if (Br(t, "wrong"), !i.length) {
        Zr(t, "wrong");
        return;
      }
      i && this.props.execCommand("addImage", { imageUrl: i, altText: o });
    }, 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, o = n.file, s = n.fileNameElClassName;
      return Se(Jw || (Jw = xe([`
      <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>
    `])), he.get("Insert image"), ZC, this.tabs, i, this.toggleTab, i === "url" ? "block" : "none", he.get("Image URL"), function(u) {
        return t.refs.url = u;
      }, i === "file" ? "block" : "none", he.get("Select image file"), re("file-name"), o ? " has-file" : s, this.showFileSelectBox, this.preventSelectStart, o ? o.name : he.get("No file"), re("file-select-button"), this.showFileSelectBox, he.get("Choose a file"), this.changeFile, function(u) {
        return t.refs.file = u;
      }, he.get("Description"), function(u) {
        return t.refs.altText = u;
      }, re("button-container"), re("close-button"), this.props.hidePopup, he.get("Cancel"), re("ok-button"), this.execCommand, he.get("OK"));
    }, e;
  })(_t)
), Jw, kge = (
  /** @class */
  (function(r) {
    Y(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 (Br(n, "wrong"), Br(i, "wrong"), n.value.length < 1) {
          Zr(n, "wrong");
          return;
        }
        var o = Fr(t.props.initialValues.linkUrl);
        if (o && i.value.length < 1) {
          Zr(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, o = this.refs.url, s = this.refs.text;
      Br(o, "wrong"), Br(s, "wrong", "disabled"), s.removeAttribute("disabled"), n && (Zr(s, "disabled"), s.setAttribute("disabled", "disabled")), o.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 Se(Xw || (Xw = xe([`
      <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>
    `])), he.get("Insert link"), he.get("URL"), function(n) {
        return t.refs.url = n;
      }, he.get("Link text"), function(n) {
        return t.refs.text = n;
      }, re("button-container"), re("close-button"), this.props.hidePopup, he.get("Cancel"), re("ok-button"), this.execCommand, he.get("OK"));
    }, e;
  })(_t)
), Xw, Yw = 20, Zw = 20, e0 = 5, t0 = 14, r0 = 5, n0 = 9, Cge = 1, bge = 1, i0 = 1, Tge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.extendSelectionRange = function(i) {
        var o = i.pageX, s = i.pageY, u = o - n.offsetRect.left, f = s - n.offsetRect.top, d = n.getSelectionRangeByOffset(u, f);
        n.setState(R({}, d));
      }, 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) * Yw,
        height: (n + 1) * Zw
      };
    }, e.prototype.getRangeByOffset = function(t, n) {
      return {
        colIdx: Math.floor(t / Yw),
        rowIdx: Math.floor(n / Zw)
      };
    }, e.prototype.getTableRange = function() {
      var t = this.state, n = t.colIdx, i = t.rowIdx, o = Math.max(n, r0), s = Math.max(i, e0);
      return n >= r0 && o < n0 && (o += 1), i >= e0 && s < t0 && (s += 1), { colIdx: o + 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 - i0, height: i - i0, display: "block" };
    }, e.prototype.getSelectionRangeByOffset = function(t, n) {
      var i = this.getRangeByOffset(t, n);
      return i.rowIdx = Math.min(Math.max(i.rowIdx, Cge), t0), i.colIdx = Math.min(Math.max(i.colIdx, bge), n0), 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, o = [], s = 0; s < i; s += 1) {
        for (var u = [], f = 0; f < n; f += 1) {
          var d = "" + re("table-cell") + (s > 0 ? "" : " header");
          u.push(Se(o0 || (o0 = xe(['<div class="', '"></div>'], ['<div class="', '"></div>'])), d));
        }
        o.push(Se(a0 || (a0 = xe(['<div class="', '">', "</div>"], ['<div class="', '">', "</div>"])), re("table-row"), u));
      }
      return Se(s0 || (s0 = xe(['<div class="', '">', "</div>"], ['<div class="', '">', "</div>"])), re("table"), o);
    }, e.prototype.render = function() {
      var t = this, n = this.getTableRange(), i = this.getSelectionAreaBound();
      return Se(l0 || (l0 = xe([`
      <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>
    `])), he.get("Insert table"), re("table-selection"), function(o) {
        return t.refs.tableEl = o;
      }, this.extendSelectionRange, this.execCommand, this.createTableArea(n), re("table-selection-layer"), i, re("table-description"), this.getDescription());
    }, e;
  })(_t)
), o0, a0, s0, l0, xge = (
  /** @class */
  (function(r) {
    Y(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 Se(u0 || (u0 = xe(["<div ref=", "></div>"], ["<div ref=", "></div>"])), function(n) {
        return t.refs.el = n;
      });
    }, e;
  })(_t)
), u0;
function Hp(r) {
  return Rn(r) ? Ege(r) : r;
}
function Sge() {
  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(o) {
      var s = o.target.checked;
      s ? Zr(r, "active") : Br(r, "active"), i("toggleScrollSync", { active: s });
    });
  };
  return r.appendChild(e), r.appendChild(t), {
    name: "scrollSync",
    el: r,
    onMounted: n
  };
}
function Ege(r) {
  var e;
  switch (r) {
    case "heading":
      e = {
        name: "heading",
        className: "heading",
        tooltip: he.get("Headings"),
        state: "heading"
      };
      break;
    case "bold":
      e = {
        name: "bold",
        className: "bold",
        command: "bold",
        tooltip: he.get("Bold"),
        state: "strong"
      };
      break;
    case "italic":
      e = {
        name: "italic",
        className: "italic",
        command: "italic",
        tooltip: he.get("Italic"),
        state: "emph"
      };
      break;
    case "strike":
      e = {
        name: "strike",
        className: "strike",
        command: "strike",
        tooltip: he.get("Strike"),
        state: "strike"
      };
      break;
    case "hr":
      e = {
        name: "hr",
        className: "hrline",
        command: "hr",
        tooltip: he.get("Line"),
        state: "thematicBreak"
      };
      break;
    case "quote":
      e = {
        name: "quote",
        className: "quote",
        command: "blockQuote",
        tooltip: he.get("Blockquote"),
        state: "blockQuote"
      };
      break;
    case "ul":
      e = {
        name: "ul",
        className: "bullet-list",
        command: "bulletList",
        tooltip: he.get("Unordered list"),
        state: "bulletList"
      };
      break;
    case "ol":
      e = {
        name: "ol",
        className: "ordered-list",
        command: "orderedList",
        tooltip: he.get("Ordered list"),
        state: "orderedList"
      };
      break;
    case "task":
      e = {
        name: "task",
        className: "task-list",
        command: "taskList",
        tooltip: he.get("Task"),
        state: "taskList"
      };
      break;
    case "table":
      e = {
        name: "table",
        className: "table",
        tooltip: he.get("Insert table"),
        state: "table"
      };
      break;
    case "image":
      e = {
        name: "image",
        className: "image",
        tooltip: he.get("Insert image")
      };
      break;
    case "link":
      e = {
        name: "link",
        className: "link",
        tooltip: he.get("Insert link")
      };
      break;
    case "code":
      e = {
        name: "code",
        className: "code",
        command: "code",
        tooltip: he.get("Code"),
        state: "code"
      };
      break;
    case "codeblock":
      e = {
        name: "codeblock",
        className: "codeblock",
        command: "codeBlock",
        tooltip: he.get("Insert CodeBlock"),
        state: "codeBlock"
      };
      break;
    case "indent":
      e = {
        name: "indent",
        className: "indent",
        command: "indent",
        tooltip: he.get("Indent"),
        state: "indent"
      };
      break;
    case "outdent":
      e = {
        name: "outdent",
        className: "outdent",
        command: "outdent",
        tooltip: he.get("Outdent"),
        state: "outdent"
      };
      break;
    case "scrollSync":
      e = Sge();
      break;
    case "more":
      e = {
        name: "more",
        className: "more",
        tooltip: he.get("More")
      };
      break;
  }
  return e.name !== "scrollSync" && (e.className += " " + re("toolbar-icons")), e;
}
function Ih(r, e) {
  var t = e.el, n = e.pos, i = e.popup, o = e.initialValues;
  switch (r) {
    case "heading":
      return {
        render: function(s) {
          return Se(c0 || (c0 = xe(["<", " ...", " />"], ["<", " ...", " />"])), gge, s);
        },
        className: re("popup-add-heading"),
        fromEl: t,
        pos: n
      };
    case "link":
      return {
        render: function(s) {
          return Se(f0 || (f0 = xe(["<", " ...", " />"], ["<", " ...", " />"])), kge, s);
        },
        className: re("popup-add-link"),
        fromEl: t,
        pos: n,
        initialValues: o
      };
    case "image":
      return {
        render: function(s) {
          return Se(d0 || (d0 = xe(["<", " ...", " />"], ["<", " ...", " />"])), wge, s);
        },
        className: re("popup-add-image"),
        fromEl: t,
        pos: n
      };
    case "table":
      return {
        render: function(s) {
          return Se(p0 || (p0 = xe(["<", " ...", " />"], ["<", " ...", " />"])), Tge, s);
        },
        className: re("popup-add-table"),
        fromEl: t,
        pos: n
      };
    case "customPopupBody":
      return i ? R({ render: function(s) {
        return Se(h0 || (h0 = xe(["<", " ...", " body=", " />"], ["<", " ...", " body=", " />"])), xge, s, i.body);
      }, fromEl: t, pos: n }, i) : null;
    default:
      return null;
  }
}
function rc(r) {
  r.hidden = r.length === r.filter(function(e) {
    return e.hidden;
  }).length;
}
function Mge(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(Hp(s));
    }));
    var o = n[(n.length || 1) - 1];
    return o && rc(o), n;
  }, []);
}
function Oge(r, e) {
  r.forEach(function(t) {
    t.forEach(function(n) {
      return n.hidden = n.name === "scrollSync" && e;
    }), rc(t);
  });
}
var c0, f0, d0, p0, h0, Nge = 20, Lge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e() {
      var t = r !== null && r.apply(this, arguments) || this;
      return t.handleMousedown = function(n) {
        !en(n.target, "." + re("popup")) && !en(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, o = n.info;
      if (i && o.pos && t.show !== i) {
        var s = R({}, o.pos), u = this.refs.el.offsetWidth, f = en(this.refs.el, "." + re("toolbar")), d = f.offsetWidth;
        s.left + u >= d && (s.left = d - u - Nge), ah(this.state.popupPos, s) || this.setState({ popupPos: s });
      }
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.info, o = n.show, s = n.hidePopup, u = n.eventEmitter, f = n.execCommand, d = i || {}, h = d.className, m = h === void 0 ? "" : h, y = d.style, w = d.render, k = d.initialValues, b = k === void 0 ? {} : k, T = R(R({ display: o ? "block" : "none" }, y), this.state.popupPos);
      return Se(v0 || (v0 = xe([`
      <div
        class="`, " ", `"
        style=`, `
        ref=`, `
        aria-role="dialog"
      >
        <div class="`, `">
          `, `
        </div>
      </div>
    `], [`
      <div
        class="`, " ", `"
        style=`, `
        ref=`, `
        aria-role="dialog"
      >
        <div class="`, `">
          `, `
        </div>
      </div>
    `])), re("popup"), m, T, function(E) {
        return t.refs.el = E;
      }, re("popup-body"), w && w({ eventEmitter: u, show: o, hidePopup: s, execCommand: f, initialValues: b }));
    }, e;
  })(_t)
), v0, m0 = 6;
function Rh(r) {
  return (
    /** @class */
    (function(e) {
      Y(t, e);
      function t(n) {
        var i = e.call(this, n) || this;
        return i.showTooltip = function(o) {
          var s = i.props.item.tooltip;
          if (!i.props.disabled && s) {
            var u = i.getBound(o), f = u.left + m0 + "px", d = u.top + m0 + "px";
            nn(i.props.tooltipRef.current, { display: "block", left: f, top: d }), i.props.tooltipRef.current.querySelector(".text").textContent = s;
          }
        }, i.hideTooltip = function() {
          nn(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, o = i.item, s = i.eventEmitter;
        o.state && s.listen("changeToolbarState", function(u) {
          var f, d = u.toolbarState, h = (f = d[o.state]) !== null && f !== void 0 ? f : {}, m = h.active, y = h.disabled;
          n.setState({ active: !!m, disabled: y ?? n.props.disabled });
        });
      }, t.prototype.getBound = function(n) {
        var i = wk(n, en(n, "." + re("toolbar"))), o = i.offsetLeft, s = i.offsetTop;
        return { left: o, top: n.offsetHeight + s };
      }, t.prototype.render = function() {
        return Se(g0 || (g0 = xe([`
        <`, `
          ...`, `
          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;
    })(_t)
  );
}
var g0, Dge = 80, Age = (
  /** @class */
  (function(r) {
    Y(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, o = n.execCommand, s = n.setPopupInfo, u = n.getBound, f = n.eventEmitter, d = i.command, h = i.name, m = i.popup;
        if (d)
          o(d);
        else {
          var y = m ? "customPopupBody" : h, w = f.emit("query", "getPopupInitialValues", { popupName: y })[0], k = Ih(y, {
            el: t.refs.el,
            pos: u(t.refs.el),
            popup: m,
            initialValues: w
          });
          k && s(k);
        }
      }, 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, vh(this.refs.el) + (i.hidden ? Dge : 0));
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.hideTooltip, o = n.disabled, s = n.item, u = n.active, f = R({ display: s.hidden ? "none" : null }, s.style), d = "" + (s.className || "") + (u ? " active" : "");
      return Se(y0 || (y0 = xe([`
      <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(h) {
        return t.refs.el = h;
      }, f, d, this.execCommand, this.showTooltip, i, !!o, s.text || s.tooltip || "", s.text || "");
    }, e;
  })(_t)
), Ige = Rh(Age), y0, Rge = (
  /** @class */
  (function(r) {
    Y(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 = Ih("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, vh(this.refs.el)), i.onMounted && i.onMounted(this.props.execCommand);
    }, e.prototype.updated = function(t) {
      var n, i = this.props, o = i.item, s = i.active, u = i.disabled;
      (t.active !== s || t.disabled !== u) && ((n = o.onUpdated) === null || n === void 0 || n.call(o, { active: s, disabled: u }));
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.disabled, o = n.item, s = { display: o.hidden ? "none" : "inline-block" }, u = function(f) {
        return i ? null : f;
      };
      return Se(w0 || (w0 = xe([`
      <div
        ref=`, `
        style=`, `
        class=`, `
        onClick=`, `
        onMouseover=`, `
        onMouseout=`, `
      ></div>
    `], [`
      <div
        ref=`, `
        style=`, `
        class=`, `
        onClick=`, `
        onMouseover=`, `
        onMouseout=`, `
      ></div>
    `])), function(f) {
        return t.refs.el = f;
      }, s, re("toolbar-item-wrapper"), u(this.showPopup), u(this.showTooltip), u(this.props.hideTooltip));
    }, e;
  })(_t)
), Pge = Rh(Rge), w0, eb = (
  /** @class */
  (function(r) {
    Y(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, o = n.hiddenDivider, s = i.hidden ? { display: "none" } : null, u = o ? { display: "none" } : null;
      return Se(C0 || (C0 = xe([`
      <div class="`, '" style=', `>
        `, `
        <div class="`, '" style=', `></div>
      </div>
    `], [
        `
      <div class="`,
        '" style=',
        `>
        `,
        `
        <div class="`,
        '" style=',
        `></div>
      </div>
    `
      ])), re("toolbar-group"), s, i.map(function(f) {
        var d = f.el ? Pge : Ige;
        return Se(k0 || (k0 = xe(["<", " key=", " ...", " item=", " />"], ["<", " key=", " ...", " item=", " />"])), d, f.name, t.props, f);
      }), re("toolbar-divider"), u);
    }, e;
  })(_t)
), k0, C0, Bge = 4, _ge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.handleClickDocument = function(i) {
        var o = i.target;
        !en(o, "." + re("dropdown-toolbar")) && !en(o, ".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 += Bge, R(R({}, 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, o = n.dropdownPos, s = this.props, u = s.disabled, f = s.item, d = s.items, h = s.hideTooltip, m = d.filter(function(k) {
        return !k.hidden;
      }), y = m.length ? null : { display: "none" }, w = i ? null : { display: "none" };
      return Se(T0 || (T0 = xe([`
      <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>
    `
      ])), re("toolbar-group"), y, function(k) {
        return t.refs.el = k;
      }, f.className, function() {
        return t.setState({ showDropdown: !0 });
      }, this.showTooltip, h, u, re("dropdown-toolbar"), R(R({}, w), o), function(k) {
        return t.refs.dropdownEl = k;
      }, m.length ? m.map(function(k, b) {
        var T;
        return Se(b0 || (b0 = xe([`
                  <`, `
                    group=`, `
                    hiddenDivider=`, `
                    ...`, `
                  />
                `], [
          `
                  <`,
          `
                    group=`,
          `
                    hiddenDivider=`,
          `
                    ...`,
          `
                  />
                `
        ])), eb, k, b === m.length - 1 || ((T = m[b + 1]) === null || T === void 0 ? void 0 : T.hidden), t.props);
      }) : null);
    }, e;
  })(_t)
), Hge = Rh(_ge), b0, T0, Fge = 50, zge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.toggleTab = function(i, o) {
        var s = n.props.eventEmitter;
        if (n.state.activeTab !== o) {
          var u = o === "write" ? "changePreviewTabWrite" : "changePreviewTabPreview";
          s.emit(u), n.setState({ activeTab: o });
        }
      }, n.setItemWidth = function(i, o) {
        n.itemWidthMap[i] = o;
      }, n.setPopupInfo = function(i) {
        n.setState({ showPopup: !0, popupInfo: i });
      }, n.openPopup = function(i, o) {
        o === void 0 && (o = {});
        var s = n.refs.el.querySelector("." + re("toolbar-group") + " ." + i);
        if (s) {
          var u = wk(s, en(s, "." + re("toolbar"))), f = u.offsetLeft, d = u.offsetTop, h = Ih(i, {
            el: s,
            pos: { left: f, top: s.offsetHeight + d },
            initialValues: o
          });
          h && n.setPopupInfo(h);
        }
      }, n.hidePopup = function() {
        n.state.showPopup && n.setState({ showPopup: !1 });
      }, n.execCommand = function(i, o) {
        var s = n.props.eventEmitter;
        s.emit("command", i, o), n.hidePopup();
      }, n.tabs = [
        { name: "write", text: "Write" },
        { name: "preview", text: "Preview" }
      ], n.itemWidthMap = {}, n.initialItems = Mge(t.toolbarItems || [], n.hiddenScrollSync()), n.state = {
        items: n.initialItems,
        dropdownItems: [],
        showPopup: !1,
        popupInfo: {},
        activeTab: "write"
      }, n.tooltipRef = { current: null }, n.resizeObserver = new mge(function() {
        return n.handleResize();
      }), n.addEvent(), n;
    }
    return e.prototype.insertToolbarItem = function(t, n) {
      var i = t.groupIndex, o = t.itemIndex, s = this.initialItems[i];
      n = Hp(n), s ? s.splice(o, 0, n) : this.initialItems.push([n]), this.setState(this.classifyToolbarItems());
    }, e.prototype.removeToolbarItem = function(t) {
      var n = this;
      fa(this.initialItems, function(i) {
        var o = !1;
        return fa(i, function(s, u) {
          return s.name === t ? (o = !0, i.splice(u, 1), n.setState(n.classifyToolbarItems()), !1) : !0;
        }), !o;
      });
    }, e.prototype.addEvent = function() {
      var t = this, n = this.props.eventEmitter;
      this.handleResize = Yme(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="' + re("tooltip") + `" style="display:none">
        <div class="arrow"></div>
        <span class="text"></span>
      </div>`;
      this.tooltipRef.current = yk(t, this.refs.el);
    }, e.prototype.hiddenScrollSync = function() {
      return this.props.editorType === "wysiwyg" || this.props.previewStyle === "tab";
    }, e.prototype.movePrevItemToDropdownToolbar = function(t, n, i, o) {
      var s = function(f) {
        var d = f.pop();
        d && o.push(d);
      };
      if (t > 1)
        s(i);
      else {
        var u = Rt(n);
        u && s(u);
      }
    }, e.prototype.classifyToolbarItems = function() {
      var t = this, n = 0, i = this.refs.el.clientWidth, o = this.refs.el.querySelector("." + re("toolbar-divider")), s = o ? vh(o) : 0, u = [], f = [], d = !1;
      return this.initialItems.forEach(function(h, m) {
        var y = [], w = [];
        h.forEach(function(k, b) {
          k.hidden || (n += t.itemWidthMap[k.name], n > i - Fge ? (d || (t.movePrevItemToDropdownToolbar(b, u, y, w), d = !0), w.push(k)) : y.push(k));
        }), y.length && (rc(y), u.push(y)), w.length && (rc(w), f.push(w)), m < 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, o = n.previewStyle, s = n.eventEmitter, u = o !== t.previewStyle, f = i !== t.editorType;
      if (u || f) {
        Oge(this.initialItems, this.hiddenScrollSync());
        var d = this.classifyToolbarItems();
        (u || o === "tab" && i === "markdown") && (s.emit("changePreviewTabWrite"), d.activeTab = "write"), this.setState(d);
      }
    }, e.prototype.beforeDestroy = function() {
      window.removeEventListener("resize", this.handleResize), this.resizeObserver.disconnect(), po(this.tooltipRef.current);
    }, e.prototype.render = function() {
      var t = this, n = this.props, i = n.previewStyle, o = n.eventEmitter, s = n.editorType, u = this.state, f = u.popupInfo, d = u.showPopup, h = u.activeTab, m = u.items, y = u.dropdownItems, w = {
        eventEmitter: o,
        tooltipRef: this.tooltipRef,
        disabled: s === "markdown" && i === "tab" && h === "preview",
        execCommand: this.execCommand,
        setPopupInfo: this.setPopupInfo
      }, k = i === "tab" ? { borderTopLeftRadius: 0 } : null;
      return Se(S0 || (S0 = xe([`
      <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>
    `
      ])), re("toolbar"), re("md-tab-container"), s === "wysiwyg" || i === "vertical" ? "none" : "block", ZC, this.tabs, h, this.toggleTab, re("defaultUI-toolbar"), function(b) {
        return t.refs.el = b;
      }, k, m.map(function(b, T) {
        var E;
        return Se(x0 || (x0 = xe([`
              <`, `
                group=`, `
                hiddenDivider=`, `
                setItemWidth=`, `
                ...`, `
              />
            `], [`
              <`, `
                group=`, `
                hiddenDivider=`, `
                setItemWidth=`, `
                ...`, `
              />
            `])), eb, b, T === m.length - 1 || ((E = m[T + 1]) === null || E === void 0 ? void 0 : E.hidden), t.setItemWidth, w);
      }), Hge, Hp("more"), y, w, Lge, f, d, o, this.hidePopup, this.execCommand);
    }, e;
  })(_t)
), x0, S0, Vge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t) {
      var n = r.call(this, t) || this;
      return n.handleClickDocument = function(i) {
        en(i.target, "." + re("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, o = n.menuGroups;
        t.setState({ pos: i, menuGroups: o });
      });
    }, 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, o = n.menuGroups;
      return i ? o.reduce(function(s, u) {
        var f = [];
        return u.forEach(function(d) {
          var h = d.label, m = d.className, y = m === void 0 ? !1 : m, w = d.disabled, k = d.onClick, b = function() {
            w || (k(), t.setState({ pos: null }));
          };
          f.push(Se(E0 || (E0 = xe([`
                <li
                  onClick=`, `
                  class="menu-item`, `"
                  aria-role="menuitem"
                >
                  <span class="`, '">', `</span>
                </li>
              `], [`
                <li
                  onClick=`, `
                  class="menu-item`, `"
                  aria-role="menuitem"
                >
                  <span class="`, '">', `</span>
                </li>
              `])), b, w ? " disabled" : "", y, h));
        }), s.push(Se(M0 || (M0 = xe([`<ul class="menu-group">
              `, `
            </ul>`], [`<ul class="menu-group">
              `, `
            </ul>`])), f)), s;
      }, []) : [];
    }, e.prototype.render = function() {
      var t = R({ display: this.state.pos ? "block" : "none" }, this.state.pos);
      return Se(O0 || (O0 = xe(['<div class="', '" style=', ` aria-role="menu">
      `, `
    </div>`], ['<div class="', '" style=', ` aria-role="menu">
      `, `
    </div>`])), re("context-menu"), t, this.getMenuGroupElements());
    }, e;
  })(_t)
), E0, M0, O0, qge = (
  /** @class */
  (function(r) {
    Y(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, o = t.previewStyle;
      return n.state = {
        editorType: i,
        previewStyle: o,
        hide: !1
      }, n.addEvent(), n;
    }
    return e.prototype.mounted = function() {
      var t = this.props.slots, n = t.wwEditor, i = t.mdEditor, o = t.mdPreview;
      this.refs.wwContainer.appendChild(n), this.refs.mdContainer.insertAdjacentElement("afterbegin", i), this.refs.mdContainer.appendChild(o);
    }, 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, o = n.hideModeSwitch, s = n.toolbarItems, u = n.theme, f = this.state, d = f.hide, h = f.previewStyle, m = f.editorType, y = d ? " hidden" : "", w = re(m === "markdown" ? "md-mode" : "ww-mode"), k = re("md") + "-" + h + "-style", b = re([u !== "light", u + " "]);
      return Se(L0 || (L0 = xe([`
      <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>
    `
      ])), b, re("defaultUI"), y, function(T) {
        return t.refs.el = T;
      }, zge, function(T) {
        return t.toolbar = T;
      }, i, h, s, m, re("main"), w, function(T) {
        return t.refs.editorSection = T;
      }, re("main-container"), re("md-container"), k, function(T) {
        return t.refs.mdContainer = T;
      }, re("md-splitter"), re("ww-container"), function(T) {
        return t.refs.wwContainer = T;
      }, !o && Se(N0 || (N0 = xe(["<", " eventEmitter=", " editorType=", " />"], ["<", " eventEmitter=", " editorType=", " />"])), Gme, i, m), Vge, 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;
  })(_t)
), N0, L0, $ge = (
  /** @class */
  (function(r) {
    Y(e, r);
    function e(t) {
      var n, i = r.call(this, t) || this, o, s = Wme(i.options.el, Se(D0 || (D0 = xe([`
        <`, `
          ref=`, `
          eventEmitter=`, `
          slots=`, `
          hideModeSwitch=`, `
          toolbarItems=`, `
          previewStyle=`, `
          editorType=`, `
          theme=`, `
        />
      `], [`
        <`, `
          ref=`, `
          eventEmitter=`, `
          slots=`, `
          hideModeSwitch=`, `
          toolbarItems=`, `
          previewStyle=`, `
          editorType=`, `
          theme=`, `
        />
      `])), qge, function(u) {
        return o = 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: o.insertToolbarItem.bind(o),
        removeToolbarItem: o.removeToolbarItem.bind(o),
        destroy: s
      }, (n = i.pluginInfo.toolbarItems) === null || n === void 0 || n.forEach(function(u) {
        var f = u.groupIndex, d = u.itemIndex, h = u.item;
        i.defaultUI.insertToolbarItem({ groupIndex: f, itemIndex: d }, h);
      }), i.eventEmitter.emit("loadUI", i), i;
    }
    return e.factory = function(t) {
      return t.viewer ? new qC(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;
  })(UC)
), D0;
UC.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"
});
const Uge = ({
  initialValue: r,
  height: e,
  initialEditType: t,
  previewStyle: n,
  theme: i,
  usageStatistics: o,
  setStateValue: s
}) => {
  const u = gs.useRef(null), f = gs.useRef(null), d = gs.useCallback((h) => {
    const m = document.createElement("button");
    return m.className = "toastui-editor-toolbar-icons save", m.style.backgroundImage = "none", m.style.margin = "0", m.style.display = "flex", m.style.alignItems = "center", m.style.justifyContent = "center", m.style.color = h === "dark" ? "#d5d5d5" : "#333", m.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>
    `, m;
  }, []);
  return gs.useEffect(() => {
    if (u.current) {
      f.current && f.current.destroy(), f.current = new $ge({
        el: u.current,
        initialValue: r || "",
        height: e || "500px",
        initialEditType: t || "markdown",
        previewStyle: n || "vertical",
        theme: i || "light",
        usageStatistics: o !== void 0 ? o : !0
      });
      const h = d(i || "light");
      h.onclick = () => {
        if (f.current) {
          const m = f.current.getMarkdown();
          s("markdown", m);
        }
      }, f.current.insertToolbarItem(
        { groupIndex: 4, itemIndex: 2 },
        // Append to the code/codeblock group
        {
          name: "save",
          el: h,
          command: "save",
          tooltip: "Save Markdown"
        }
      );
    }
    return () => {
      f.current && (f.current.destroy(), f.current = null);
    };
  }, [e, t, n, i, o, d, s]), /* @__PURE__ */ Eu.jsx("div", { style: { marginBottom: "1rem" }, children: /* @__PURE__ */ Eu.jsx("div", { ref: u }) });
}, vu = /* @__PURE__ */ new WeakMap(), jge = (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 o = vu.get(t);
  return o || (o = XT.createRoot(i), vu.set(t, o)), o.render(
    /* @__PURE__ */ Eu.jsx(gs.StrictMode, { children: /* @__PURE__ */ Eu.jsx(
      Uge,
      {
        setStateValue: n,
        initialValue: e.initialValue,
        height: e.height,
        initialEditType: e.initialEditType,
        previewStyle: e.previewStyle,
        theme: e.theme,
        usageStatistics: e.usageStatistics
      }
    ) })
  ), () => {
    const s = vu.get(t);
    s && (s.unmount(), vu.delete(t));
  };
};
export {
  jge as default
};
