UNPKG

@chahindb7/vue3-editor

Version:

HTML editor using Vue.js 3, and Quill.js, an open source editor with advanced table functionality (quill-table-up)

1,624 lines (1,623 loc) 462 kB
var Jh = Object.defineProperty; var Qh = (n, t, e) => t in n ? Jh(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e; var v = (n, t, e) => (Qh(n, typeof t != "symbol" ? t + "" : t, e), e); import { openBlock as tu, createElementBlock as eu, createElementVNode as nu } from "vue"; var ru = typeof global == "object" && global && global.Object === Object && global; const ac = ru; var iu = typeof self == "object" && self && self.Object === Object && self, su = ac || iu || Function("return this")(); const he = su; var lu = he.Symbol; const Pe = lu; var cc = Object.prototype, ou = cc.hasOwnProperty, au = cc.toString, xr = Pe ? Pe.toStringTag : void 0; function cu(n) { var t = ou.call(n, xr), e = n[xr]; try { n[xr] = void 0; var r = !0; } catch { } var i = au.call(n); return r && (t ? n[xr] = e : delete n[xr]), i; } var hu = Object.prototype, uu = hu.toString; function du(n) { return uu.call(n); } var fu = "[object Null]", pu = "[object Undefined]", Po = Pe ? Pe.toStringTag : void 0; function Jn(n) { return n == null ? n === void 0 ? pu : fu : Po && Po in Object(n) ? cu(n) : du(n); } function ye(n) { return n != null && typeof n == "object"; } var gu = Array.isArray; const rn = gu; function ze(n) { var t = typeof n; return n != null && (t == "object" || t == "function"); } function hc(n) { return n; } var mu = "[object AsyncFunction]", bu = "[object Function]", yu = "[object GeneratorFunction]", vu = "[object Proxy]"; function lo(n) { if (!ze(n)) return !1; var t = Jn(n); return t == bu || t == yu || t == mu || t == vu; } var wu = he["__core-js_shared__"]; const sl = wu; var jo = function() { var n = /[^.]+$/.exec(sl && sl.keys && sl.keys.IE_PROTO || ""); return n ? "Symbol(src)_1." + n : ""; }(); function xu(n) { return !!jo && jo in n; } var Cu = Function.prototype, Eu = Cu.toString; function an(n) { if (n != null) { try { return Eu.call(n); } catch { } try { return n + ""; } catch { } } return ""; } var Tu = /[\\^$.*+?()[\]{}|]/g, Nu = /^\[object .+?Constructor\]$/, Au = Function.prototype, Lu = Object.prototype, Iu = Au.toString, Su = Lu.hasOwnProperty, Ou = RegExp( "^" + Iu.call(Su).replace(Tu, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function qu(n) { if (!ze(n) || xu(n)) return !1; var t = lo(n) ? Ou : Nu; return t.test(an(n)); } function Mu(n, t) { return n == null ? void 0 : n[t]; } function cn(n, t) { var e = Mu(n, t); return qu(e) ? e : void 0; } var Ru = cn(he, "WeakMap"); const Sl = Ru; var Ho = Object.create, _u = function() { function n() { } return function(t) { if (!ze(t)) return {}; if (Ho) return Ho(t); n.prototype = t; var e = new n(); return n.prototype = void 0, e; }; }(); const Bu = _u; function ku(n, t, e) { switch (e.length) { case 0: return n.call(t); case 1: return n.call(t, e[0]); case 2: return n.call(t, e[0], e[1]); case 3: return n.call(t, e[0], e[1], e[2]); } return n.apply(t, e); } function uc(n, t) { var e = -1, r = n.length; for (t || (t = Array(r)); ++e < r; ) t[e] = n[e]; return t; } var $u = 800, Du = 16, Pu = Date.now; function ju(n) { var t = 0, e = 0; return function() { var r = Pu(), i = Du - (r - e); if (e = r, i > 0) { if (++t >= $u) return arguments[0]; } else t = 0; return n.apply(void 0, arguments); }; } function Hu(n) { return function() { return n; }; } var zu = function() { try { var n = cn(Object, "defineProperty"); return n({}, "", {}), n; } catch { } }(); const Hi = zu; var Fu = Hi ? function(n, t) { return Hi(n, "toString", { configurable: !0, enumerable: !1, value: Hu(t), writable: !0 }); } : hc; const Uu = Fu; var Wu = ju(Uu); const Vu = Wu; function Gu(n, t) { for (var e = -1, r = n == null ? 0 : n.length; ++e < r && t(n[e], e, n) !== !1; ) ; return n; } var Ku = 9007199254740991, Xu = /^(?:0|[1-9]\d*)$/; function dc(n, t) { var e = typeof n; return t = t ?? Ku, !!t && (e == "number" || e != "symbol" && Xu.test(n)) && n > -1 && n % 1 == 0 && n < t; } function oo(n, t, e) { t == "__proto__" && Hi ? Hi(n, t, { configurable: !0, enumerable: !0, value: e, writable: !0 }) : n[t] = e; } function Fr(n, t) { return n === t || n !== n && t !== t; } var Zu = Object.prototype, Yu = Zu.hasOwnProperty; function fc(n, t, e) { var r = n[t]; (!(Yu.call(n, t) && Fr(r, e)) || e === void 0 && !(t in n)) && oo(n, t, e); } function Ur(n, t, e, r) { var i = !e; e || (e = {}); for (var s = -1, l = t.length; ++s < l; ) { var o = t[s], a = r ? r(e[o], n[o], o, e, n) : void 0; a === void 0 && (a = n[o]), i ? oo(e, o, a) : fc(e, o, a); } return e; } var zo = Math.max; function Ju(n, t, e) { return t = zo(t === void 0 ? n.length - 1 : t, 0), function() { for (var r = arguments, i = -1, s = zo(r.length - t, 0), l = Array(s); ++i < s; ) l[i] = r[t + i]; i = -1; for (var o = Array(t + 1); ++i < t; ) o[i] = r[i]; return o[t] = e(l), ku(n, this, o); }; } function Qu(n, t) { return Vu(Ju(n, t, hc), n + ""); } var td = 9007199254740991; function pc(n) { return typeof n == "number" && n > -1 && n % 1 == 0 && n <= td; } function ns(n) { return n != null && pc(n.length) && !lo(n); } function ed(n, t, e) { if (!ze(e)) return !1; var r = typeof t; return (r == "number" ? ns(e) && dc(t, e.length) : r == "string" && t in e) ? Fr(e[t], n) : !1; } function nd(n) { return Qu(function(t, e) { var r = -1, i = e.length, s = i > 1 ? e[i - 1] : void 0, l = i > 2 ? e[2] : void 0; for (s = n.length > 3 && typeof s == "function" ? (i--, s) : void 0, l && ed(e[0], e[1], l) && (s = i < 3 ? void 0 : s, i = 1), t = Object(t); ++r < i; ) { var o = e[r]; o && n(t, o, r, s); } return t; }); } var rd = Object.prototype; function ao(n) { var t = n && n.constructor, e = typeof t == "function" && t.prototype || rd; return n === e; } function id(n, t) { for (var e = -1, r = Array(n); ++e < n; ) r[e] = t(e); return r; } var sd = "[object Arguments]"; function Fo(n) { return ye(n) && Jn(n) == sd; } var gc = Object.prototype, ld = gc.hasOwnProperty, od = gc.propertyIsEnumerable, ad = Fo(function() { return arguments; }()) ? Fo : function(n) { return ye(n) && ld.call(n, "callee") && !od.call(n, "callee"); }; const Ol = ad; function cd() { return !1; } var mc = typeof exports == "object" && exports && !exports.nodeType && exports, Uo = mc && typeof module == "object" && module && !module.nodeType && module, hd = Uo && Uo.exports === mc, Wo = hd ? he.Buffer : void 0, ud = Wo ? Wo.isBuffer : void 0, dd = ud || cd; const Mr = dd; var fd = "[object Arguments]", pd = "[object Array]", gd = "[object Boolean]", md = "[object Date]", bd = "[object Error]", yd = "[object Function]", vd = "[object Map]", wd = "[object Number]", xd = "[object Object]", Cd = "[object RegExp]", Ed = "[object Set]", Td = "[object String]", Nd = "[object WeakMap]", Ad = "[object ArrayBuffer]", Ld = "[object DataView]", Id = "[object Float32Array]", Sd = "[object Float64Array]", Od = "[object Int8Array]", qd = "[object Int16Array]", Md = "[object Int32Array]", Rd = "[object Uint8Array]", _d = "[object Uint8ClampedArray]", Bd = "[object Uint16Array]", kd = "[object Uint32Array]", X = {}; X[Id] = X[Sd] = X[Od] = X[qd] = X[Md] = X[Rd] = X[_d] = X[Bd] = X[kd] = !0; X[fd] = X[pd] = X[Ad] = X[gd] = X[Ld] = X[md] = X[bd] = X[yd] = X[vd] = X[wd] = X[xd] = X[Cd] = X[Ed] = X[Td] = X[Nd] = !1; function $d(n) { return ye(n) && pc(n.length) && !!X[Jn(n)]; } function co(n) { return function(t) { return n(t); }; } var bc = typeof exports == "object" && exports && !exports.nodeType && exports, Lr = bc && typeof module == "object" && module && !module.nodeType && module, Dd = Lr && Lr.exports === bc, ll = Dd && ac.process, Pd = function() { try { var n = Lr && Lr.require && Lr.require("util").types; return n || ll && ll.binding && ll.binding("util"); } catch { } }(); const zn = Pd; var Vo = zn && zn.isTypedArray, jd = Vo ? co(Vo) : $d; const ho = jd; var Hd = Object.prototype, zd = Hd.hasOwnProperty; function yc(n, t) { var e = rn(n), r = !e && Ol(n), i = !e && !r && Mr(n), s = !e && !r && !i && ho(n), l = e || r || i || s, o = l ? id(n.length, String) : [], a = o.length; for (var c in n) (t || zd.call(n, c)) && !(l && // Safari 9 has enumerable `arguments.length` in strict mode. (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. i && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. s && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties. dc(c, a))) && o.push(c); return o; } function vc(n, t) { return function(e) { return n(t(e)); }; } var Fd = vc(Object.keys, Object); const Ud = Fd; var Wd = Object.prototype, Vd = Wd.hasOwnProperty; function Gd(n) { if (!ao(n)) return Ud(n); var t = []; for (var e in Object(n)) Vd.call(n, e) && e != "constructor" && t.push(e); return t; } function uo(n) { return ns(n) ? yc(n) : Gd(n); } function Kd(n) { var t = []; if (n != null) for (var e in Object(n)) t.push(e); return t; } var Xd = Object.prototype, Zd = Xd.hasOwnProperty; function Yd(n) { if (!ze(n)) return Kd(n); var t = ao(n), e = []; for (var r in n) r == "constructor" && (t || !Zd.call(n, r)) || e.push(r); return e; } function Wr(n) { return ns(n) ? yc(n, !0) : Yd(n); } var Jd = cn(Object, "create"); const Rr = Jd; function Qd() { this.__data__ = Rr ? Rr(null) : {}, this.size = 0; } function tf(n) { var t = this.has(n) && delete this.__data__[n]; return this.size -= t ? 1 : 0, t; } var ef = "__lodash_hash_undefined__", nf = Object.prototype, rf = nf.hasOwnProperty; function sf(n) { var t = this.__data__; if (Rr) { var e = t[n]; return e === ef ? void 0 : e; } return rf.call(t, n) ? t[n] : void 0; } var lf = Object.prototype, of = lf.hasOwnProperty; function af(n) { var t = this.__data__; return Rr ? t[n] !== void 0 : of.call(t, n); } var cf = "__lodash_hash_undefined__"; function hf(n, t) { var e = this.__data__; return this.size += this.has(n) ? 0 : 1, e[n] = Rr && t === void 0 ? cf : t, this; } function sn(n) { var t = -1, e = n == null ? 0 : n.length; for (this.clear(); ++t < e; ) { var r = n[t]; this.set(r[0], r[1]); } } sn.prototype.clear = Qd; sn.prototype.delete = tf; sn.prototype.get = sf; sn.prototype.has = af; sn.prototype.set = hf; function uf() { this.__data__ = [], this.size = 0; } function rs(n, t) { for (var e = n.length; e--; ) if (Fr(n[e][0], t)) return e; return -1; } var df = Array.prototype, ff = df.splice; function pf(n) { var t = this.__data__, e = rs(t, n); if (e < 0) return !1; var r = t.length - 1; return e == r ? t.pop() : ff.call(t, e, 1), --this.size, !0; } function gf(n) { var t = this.__data__, e = rs(t, n); return e < 0 ? void 0 : t[e][1]; } function mf(n) { return rs(this.__data__, n) > -1; } function bf(n, t) { var e = this.__data__, r = rs(e, n); return r < 0 ? (++this.size, e.push([n, t])) : e[r][1] = t, this; } function xe(n) { var t = -1, e = n == null ? 0 : n.length; for (this.clear(); ++t < e; ) { var r = n[t]; this.set(r[0], r[1]); } } xe.prototype.clear = uf; xe.prototype.delete = pf; xe.prototype.get = gf; xe.prototype.has = mf; xe.prototype.set = bf; var yf = cn(he, "Map"); const _r = yf; function vf() { this.size = 0, this.__data__ = { hash: new sn(), map: new (_r || xe)(), string: new sn() }; } function wf(n) { var t = typeof n; return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? n !== "__proto__" : n === null; } function is(n, t) { var e = n.__data__; return wf(t) ? e[typeof t == "string" ? "string" : "hash"] : e.map; } function xf(n) { var t = is(this, n).delete(n); return this.size -= t ? 1 : 0, t; } function Cf(n) { return is(this, n).get(n); } function Ef(n) { return is(this, n).has(n); } function Tf(n, t) { var e = is(this, n), r = e.size; return e.set(n, t), this.size += e.size == r ? 0 : 1, this; } function hn(n) { var t = -1, e = n == null ? 0 : n.length; for (this.clear(); ++t < e; ) { var r = n[t]; this.set(r[0], r[1]); } } hn.prototype.clear = vf; hn.prototype.delete = xf; hn.prototype.get = Cf; hn.prototype.has = Ef; hn.prototype.set = Tf; function wc(n, t) { for (var e = -1, r = t.length, i = n.length; ++e < r; ) n[i + e] = t[e]; return n; } var Nf = vc(Object.getPrototypeOf, Object); const fo = Nf; var Af = "[object Object]", Lf = Function.prototype, If = Object.prototype, xc = Lf.toString, Sf = If.hasOwnProperty, Of = xc.call(Object); function qf(n) { if (!ye(n) || Jn(n) != Af) return !1; var t = fo(n); if (t === null) return !0; var e = Sf.call(t, "constructor") && t.constructor; return typeof e == "function" && e instanceof e && xc.call(e) == Of; } function Mf() { this.__data__ = new xe(), this.size = 0; } function Rf(n) { var t = this.__data__, e = t.delete(n); return this.size = t.size, e; } function _f(n) { return this.__data__.get(n); } function Bf(n) { return this.__data__.has(n); } var kf = 200; function $f(n, t) { var e = this.__data__; if (e instanceof xe) { var r = e.__data__; if (!_r || r.length < kf - 1) return r.push([n, t]), this.size = ++e.size, this; e = this.__data__ = new hn(r); } return e.set(n, t), this.size = e.size, this; } function ie(n) { var t = this.__data__ = new xe(n); this.size = t.size; } ie.prototype.clear = Mf; ie.prototype.delete = Rf; ie.prototype.get = _f; ie.prototype.has = Bf; ie.prototype.set = $f; function Df(n, t) { return n && Ur(t, uo(t), n); } function Pf(n, t) { return n && Ur(t, Wr(t), n); } var Cc = typeof exports == "object" && exports && !exports.nodeType && exports, Go = Cc && typeof module == "object" && module && !module.nodeType && module, jf = Go && Go.exports === Cc, Ko = jf ? he.Buffer : void 0, Xo = Ko ? Ko.allocUnsafe : void 0; function Ec(n, t) { if (t) return n.slice(); var e = n.length, r = Xo ? Xo(e) : new n.constructor(e); return n.copy(r), r; } function Hf(n, t) { for (var e = -1, r = n == null ? 0 : n.length, i = 0, s = []; ++e < r; ) { var l = n[e]; t(l, e, n) && (s[i++] = l); } return s; } function Tc() { return []; } var zf = Object.prototype, Ff = zf.propertyIsEnumerable, Zo = Object.getOwnPropertySymbols, Uf = Zo ? function(n) { return n == null ? [] : (n = Object(n), Hf(Zo(n), function(t) { return Ff.call(n, t); })); } : Tc; const po = Uf; function Wf(n, t) { return Ur(n, po(n), t); } var Vf = Object.getOwnPropertySymbols, Gf = Vf ? function(n) { for (var t = []; n; ) wc(t, po(n)), n = fo(n); return t; } : Tc; const Nc = Gf; function Kf(n, t) { return Ur(n, Nc(n), t); } function Ac(n, t, e) { var r = t(n); return rn(n) ? r : wc(r, e(n)); } function ql(n) { return Ac(n, uo, po); } function Xf(n) { return Ac(n, Wr, Nc); } var Zf = cn(he, "DataView"); const Ml = Zf; var Yf = cn(he, "Promise"); const Rl = Yf; var Jf = cn(he, "Set"); const _l = Jf; var Yo = "[object Map]", Qf = "[object Object]", Jo = "[object Promise]", Qo = "[object Set]", ta = "[object WeakMap]", ea = "[object DataView]", tp = an(Ml), ep = an(_r), np = an(Rl), rp = an(_l), ip = an(Sl), tn = Jn; (Ml && tn(new Ml(new ArrayBuffer(1))) != ea || _r && tn(new _r()) != Yo || Rl && tn(Rl.resolve()) != Jo || _l && tn(new _l()) != Qo || Sl && tn(new Sl()) != ta) && (tn = function(n) { var t = Jn(n), e = t == Qf ? n.constructor : void 0, r = e ? an(e) : ""; if (r) switch (r) { case tp: return ea; case ep: return Yo; case np: return Jo; case rp: return Qo; case ip: return ta; } return t; }); const Br = tn; var sp = Object.prototype, lp = sp.hasOwnProperty; function op(n) { var t = n.length, e = new n.constructor(t); return t && typeof n[0] == "string" && lp.call(n, "index") && (e.index = n.index, e.input = n.input), e; } var ap = he.Uint8Array; const zi = ap; function go(n) { var t = new n.constructor(n.byteLength); return new zi(t).set(new zi(n)), t; } function cp(n, t) { var e = t ? go(n.buffer) : n.buffer; return new n.constructor(e, n.byteOffset, n.byteLength); } var hp = /\w*$/; function up(n) { var t = new n.constructor(n.source, hp.exec(n)); return t.lastIndex = n.lastIndex, t; } var na = Pe ? Pe.prototype : void 0, ra = na ? na.valueOf : void 0; function dp(n) { return ra ? Object(ra.call(n)) : {}; } function Lc(n, t) { var e = t ? go(n.buffer) : n.buffer; return new n.constructor(e, n.byteOffset, n.length); } var fp = "[object Boolean]", pp = "[object Date]", gp = "[object Map]", mp = "[object Number]", bp = "[object RegExp]", yp = "[object Set]", vp = "[object String]", wp = "[object Symbol]", xp = "[object ArrayBuffer]", Cp = "[object DataView]", Ep = "[object Float32Array]", Tp = "[object Float64Array]", Np = "[object Int8Array]", Ap = "[object Int16Array]", Lp = "[object Int32Array]", Ip = "[object Uint8Array]", Sp = "[object Uint8ClampedArray]", Op = "[object Uint16Array]", qp = "[object Uint32Array]"; function Mp(n, t, e) { var r = n.constructor; switch (t) { case xp: return go(n); case fp: case pp: return new r(+n); case Cp: return cp(n, e); case Ep: case Tp: case Np: case Ap: case Lp: case Ip: case Sp: case Op: case qp: return Lc(n, e); case gp: return new r(); case mp: case vp: return new r(n); case bp: return up(n); case yp: return new r(); case wp: return dp(n); } } function Ic(n) { return typeof n.constructor == "function" && !ao(n) ? Bu(fo(n)) : {}; } var Rp = "[object Map]"; function _p(n) { return ye(n) && Br(n) == Rp; } var ia = zn && zn.isMap, Bp = ia ? co(ia) : _p; const kp = Bp; var $p = "[object Set]"; function Dp(n) { return ye(n) && Br(n) == $p; } var sa = zn && zn.isSet, Pp = sa ? co(sa) : Dp; const jp = Pp; var Hp = 1, zp = 2, Fp = 4, Sc = "[object Arguments]", Up = "[object Array]", Wp = "[object Boolean]", Vp = "[object Date]", Gp = "[object Error]", Oc = "[object Function]", Kp = "[object GeneratorFunction]", Xp = "[object Map]", Zp = "[object Number]", qc = "[object Object]", Yp = "[object RegExp]", Jp = "[object Set]", Qp = "[object String]", tg = "[object Symbol]", eg = "[object WeakMap]", ng = "[object ArrayBuffer]", rg = "[object DataView]", ig = "[object Float32Array]", sg = "[object Float64Array]", lg = "[object Int8Array]", og = "[object Int16Array]", ag = "[object Int32Array]", cg = "[object Uint8Array]", hg = "[object Uint8ClampedArray]", ug = "[object Uint16Array]", dg = "[object Uint32Array]", V = {}; V[Sc] = V[Up] = V[ng] = V[rg] = V[Wp] = V[Vp] = V[ig] = V[sg] = V[lg] = V[og] = V[ag] = V[Xp] = V[Zp] = V[qc] = V[Yp] = V[Jp] = V[Qp] = V[tg] = V[cg] = V[hg] = V[ug] = V[dg] = !0; V[Gp] = V[Oc] = V[eg] = !1; function ki(n, t, e, r, i, s) { var l, o = t & Hp, a = t & zp, c = t & Fp; if (e && (l = i ? e(n, r, i, s) : e(n)), l !== void 0) return l; if (!ze(n)) return n; var u = rn(n); if (u) { if (l = op(n), !o) return uc(n, l); } else { var f = Br(n), d = f == Oc || f == Kp; if (Mr(n)) return Ec(n, o); if (f == qc || f == Sc || d && !i) { if (l = a || d ? {} : Ic(n), !o) return a ? Kf(n, Pf(l, n)) : Wf(n, Df(l, n)); } else { if (!V[f]) return i ? n : {}; l = Mp(n, f, o); } } s || (s = new ie()); var p = s.get(n); if (p) return p; s.set(n, l), jp(n) ? n.forEach(function(w) { l.add(ki(w, t, e, w, n, s)); }) : kp(n) && n.forEach(function(w, y) { l.set(y, ki(w, t, e, y, n, s)); }); var g = c ? a ? Xf : ql : a ? Wr : uo, b = u ? void 0 : g(n); return Gu(b || n, function(w, y) { b && (y = w, w = n[y]), fc(l, y, ki(w, t, e, y, n, s)); }), l; } var fg = 1, pg = 4; function $n(n) { return ki(n, fg | pg); } var gg = "__lodash_hash_undefined__"; function mg(n) { return this.__data__.set(n, gg), this; } function bg(n) { return this.__data__.has(n); } function Fi(n) { var t = -1, e = n == null ? 0 : n.length; for (this.__data__ = new hn(); ++t < e; ) this.add(n[t]); } Fi.prototype.add = Fi.prototype.push = mg; Fi.prototype.has = bg; function yg(n, t) { for (var e = -1, r = n == null ? 0 : n.length; ++e < r; ) if (t(n[e], e, n)) return !0; return !1; } function vg(n, t) { return n.has(t); } var wg = 1, xg = 2; function Mc(n, t, e, r, i, s) { var l = e & wg, o = n.length, a = t.length; if (o != a && !(l && a > o)) return !1; var c = s.get(n), u = s.get(t); if (c && u) return c == t && u == n; var f = -1, d = !0, p = e & xg ? new Fi() : void 0; for (s.set(n, t), s.set(t, n); ++f < o; ) { var g = n[f], b = t[f]; if (r) var w = l ? r(b, g, f, t, n, s) : r(g, b, f, n, t, s); if (w !== void 0) { if (w) continue; d = !1; break; } if (p) { if (!yg(t, function(y, T) { if (!vg(p, T) && (g === y || i(g, y, e, r, s))) return p.push(T); })) { d = !1; break; } } else if (!(g === b || i(g, b, e, r, s))) { d = !1; break; } } return s.delete(n), s.delete(t), d; } function Cg(n) { var t = -1, e = Array(n.size); return n.forEach(function(r, i) { e[++t] = [i, r]; }), e; } function Eg(n) { var t = -1, e = Array(n.size); return n.forEach(function(r) { e[++t] = r; }), e; } var Tg = 1, Ng = 2, Ag = "[object Boolean]", Lg = "[object Date]", Ig = "[object Error]", Sg = "[object Map]", Og = "[object Number]", qg = "[object RegExp]", Mg = "[object Set]", Rg = "[object String]", _g = "[object Symbol]", Bg = "[object ArrayBuffer]", kg = "[object DataView]", la = Pe ? Pe.prototype : void 0, ol = la ? la.valueOf : void 0; function $g(n, t, e, r, i, s, l) { switch (e) { case kg: if (n.byteLength != t.byteLength || n.byteOffset != t.byteOffset) return !1; n = n.buffer, t = t.buffer; case Bg: return !(n.byteLength != t.byteLength || !s(new zi(n), new zi(t))); case Ag: case Lg: case Og: return Fr(+n, +t); case Ig: return n.name == t.name && n.message == t.message; case qg: case Rg: return n == t + ""; case Sg: var o = Cg; case Mg: var a = r & Tg; if (o || (o = Eg), n.size != t.size && !a) return !1; var c = l.get(n); if (c) return c == t; r |= Ng, l.set(n, t); var u = Mc(o(n), o(t), r, i, s, l); return l.delete(n), u; case _g: if (ol) return ol.call(n) == ol.call(t); } return !1; } var Dg = 1, Pg = Object.prototype, jg = Pg.hasOwnProperty; function Hg(n, t, e, r, i, s) { var l = e & Dg, o = ql(n), a = o.length, c = ql(t), u = c.length; if (a != u && !l) return !1; for (var f = a; f--; ) { var d = o[f]; if (!(l ? d in t : jg.call(t, d))) return !1; } var p = s.get(n), g = s.get(t); if (p && g) return p == t && g == n; var b = !0; s.set(n, t), s.set(t, n); for (var w = l; ++f < a; ) { d = o[f]; var y = n[d], T = t[d]; if (r) var N = l ? r(T, y, d, t, n, s) : r(y, T, d, n, t, s); if (!(N === void 0 ? y === T || i(y, T, e, r, s) : N)) { b = !1; break; } w || (w = d == "constructor"); } if (b && !w) { var A = n.constructor, I = t.constructor; A != I && "constructor" in n && "constructor" in t && !(typeof A == "function" && A instanceof A && typeof I == "function" && I instanceof I) && (b = !1); } return s.delete(n), s.delete(t), b; } var zg = 1, oa = "[object Arguments]", aa = "[object Array]", wi = "[object Object]", Fg = Object.prototype, ca = Fg.hasOwnProperty; function Ug(n, t, e, r, i, s) { var l = rn(n), o = rn(t), a = l ? aa : Br(n), c = o ? aa : Br(t); a = a == oa ? wi : a, c = c == oa ? wi : c; var u = a == wi, f = c == wi, d = a == c; if (d && Mr(n)) { if (!Mr(t)) return !1; l = !0, u = !1; } if (d && !u) return s || (s = new ie()), l || ho(n) ? Mc(n, t, e, r, i, s) : $g(n, t, a, e, r, i, s); if (!(e & zg)) { var p = u && ca.call(n, "__wrapped__"), g = f && ca.call(t, "__wrapped__"); if (p || g) { var b = p ? n.value() : n, w = g ? t.value() : t; return s || (s = new ie()), i(b, w, e, r, s); } } return d ? (s || (s = new ie()), Hg(n, t, e, r, i, s)) : !1; } function Rc(n, t, e, r, i) { return n === t ? !0 : n == null || t == null || !ye(n) && !ye(t) ? n !== n && t !== t : Ug(n, t, e, r, Rc, i); } function Wg(n) { return function(t, e, r) { for (var i = -1, s = Object(t), l = r(t), o = l.length; o--; ) { var a = l[n ? o : ++i]; if (e(s[a], a, s) === !1) break; } return t; }; } var Vg = Wg(); const Gg = Vg; function Bl(n, t, e) { (e !== void 0 && !Fr(n[t], e) || e === void 0 && !(t in n)) && oo(n, t, e); } function Kg(n) { return ye(n) && ns(n); } function kl(n, t) { if (!(t === "constructor" && typeof n[t] == "function") && t != "__proto__") return n[t]; } function Xg(n) { return Ur(n, Wr(n)); } function Zg(n, t, e, r, i, s, l) { var o = kl(n, e), a = kl(t, e), c = l.get(a); if (c) { Bl(n, e, c); return; } var u = s ? s(o, a, e + "", n, t, l) : void 0, f = u === void 0; if (f) { var d = rn(a), p = !d && Mr(a), g = !d && !p && ho(a); u = a, d || p || g ? rn(o) ? u = o : Kg(o) ? u = uc(o) : p ? (f = !1, u = Ec(a, !0)) : g ? (f = !1, u = Lc(a, !0)) : u = [] : qf(a) || Ol(a) ? (u = o, Ol(o) ? u = Xg(o) : (!ze(o) || lo(o)) && (u = Ic(a))) : f = !1; } f && (l.set(a, u), i(u, a, r, s, l), l.delete(a)), Bl(n, e, u); } function _c(n, t, e, r, i) { n !== t && Gg(t, function(s, l) { if (i || (i = new ie()), ze(s)) Zg(n, t, l, e, _c, r, i); else { var o = r ? r(kl(n, l), s, l + "", n, t, i) : void 0; o === void 0 && (o = s), Bl(n, l, o); } }, Wr); } function mo(n, t) { return Rc(n, t); } var Yg = nd(function(n, t, e) { _c(n, t, e); }); const $e = Yg; var M = /* @__PURE__ */ ((n) => (n[n.TYPE = 3] = "TYPE", n[n.LEVEL = 12] = "LEVEL", n[n.ATTRIBUTE = 13] = "ATTRIBUTE", n[n.BLOT = 14] = "BLOT", n[n.INLINE = 7] = "INLINE", n[n.BLOCK = 11] = "BLOCK", n[n.BLOCK_BLOT = 10] = "BLOCK_BLOT", n[n.INLINE_BLOT = 6] = "INLINE_BLOT", n[n.BLOCK_ATTRIBUTE = 9] = "BLOCK_ATTRIBUTE", n[n.INLINE_ATTRIBUTE = 5] = "INLINE_ATTRIBUTE", n[n.ANY = 15] = "ANY", n))(M || {}); class oe { constructor(t, e, r = {}) { this.attrName = t, this.keyName = e; const i = M.TYPE & M.ATTRIBUTE; this.scope = r.scope != null ? ( // Ignore type bits, force attribute bit r.scope & M.LEVEL | i ) : M.ATTRIBUTE, r.whitelist != null && (this.whitelist = r.whitelist); } static keys(t) { return Array.from(t.attributes).map((e) => e.name); } add(t, e) { return this.canAdd(t, e) ? (t.setAttribute(this.keyName, e), !0) : !1; } canAdd(t, e) { return this.whitelist == null ? !0 : typeof e == "string" ? this.whitelist.indexOf(e.replace(/["']/g, "")) > -1 : this.whitelist.indexOf(e) > -1; } remove(t) { t.removeAttribute(this.keyName); } value(t) { const e = t.getAttribute(this.keyName); return this.canAdd(t, e) && e ? e : ""; } } class Dn extends Error { constructor(t) { t = "[Parchment] " + t, super(t), this.message = t, this.name = this.constructor.name; } } const Bc = class $l { constructor() { this.attributes = {}, this.classes = {}, this.tags = {}, this.types = {}; } static find(t, e = !1) { if (t == null) return null; if (this.blots.has(t)) return this.blots.get(t) || null; if (e) { let r = null; try { r = t.parentNode; } catch { return null; } return this.find(r, e); } return null; } create(t, e, r) { const i = this.query(e); if (i == null) throw new Dn(`Unable to create ${e} blot`); const s = i, l = ( // @ts-expect-error Fix me later e instanceof Node || e.nodeType === Node.TEXT_NODE ? e : s.create(r) ), o = new s(t, l, r); return $l.blots.set(o.domNode, o), o; } find(t, e = !1) { return $l.find(t, e); } query(t, e = M.ANY) { let r; return typeof t == "string" ? r = this.types[t] || this.attributes[t] : t instanceof Text || t.nodeType === Node.TEXT_NODE ? r = this.types.text : typeof t == "number" ? t & M.LEVEL & M.BLOCK ? r = this.types.block : t & M.LEVEL & M.INLINE && (r = this.types.inline) : t instanceof Element && ((t.getAttribute("class") || "").split(/\s+/).some((i) => (r = this.classes[i], !!r)), r = r || this.tags[t.tagName]), r == null ? null : "scope" in r && e & M.LEVEL & r.scope && e & M.TYPE & r.scope ? r : null; } register(...t) { return t.map((e) => { const r = "blotName" in e, i = "attrName" in e; if (!r && !i) throw new Dn("Invalid definition"); if (r && e.blotName === "abstract") throw new Dn("Cannot register abstract class"); const s = r ? e.blotName : i ? e.attrName : void 0; return this.types[s] = e, i ? typeof e.keyName == "string" && (this.attributes[e.keyName] = e) : r && (e.className && (this.classes[e.className] = e), e.tagName && (Array.isArray(e.tagName) ? e.tagName = e.tagName.map((l) => l.toUpperCase()) : e.tagName = e.tagName.toUpperCase(), (Array.isArray(e.tagName) ? e.tagName : [e.tagName]).forEach((l) => { (this.tags[l] == null || e.className == null) && (this.tags[l] = e); }))), e; }); } }; Bc.blots = /* @__PURE__ */ new WeakMap(); let Fn = Bc; function ha(n, t) { return (n.getAttribute("class") || "").split(/\s+/).filter((e) => e.indexOf(`${t}-`) === 0); } class Jg extends oe { static keys(t) { return (t.getAttribute("class") || "").split(/\s+/).map((e) => e.split("-").slice(0, -1).join("-")); } add(t, e) { return this.canAdd(t, e) ? (this.remove(t), t.classList.add(`${this.keyName}-${e}`), !0) : !1; } remove(t) { ha(t, this.keyName).forEach((e) => { t.classList.remove(e); }), t.classList.length === 0 && t.removeAttribute("class"); } value(t) { const e = (ha(t, this.keyName)[0] || "").slice(this.keyName.length + 1); return this.canAdd(t, e) ? e : ""; } } const Zt = Jg; function al(n) { const t = n.split("-"), e = t.slice(1).map((r) => r[0].toUpperCase() + r.slice(1)).join(""); return t[0] + e; } class Qg extends oe { static keys(t) { return (t.getAttribute("style") || "").split(";").map((e) => e.split(":")[0].trim()); } add(t, e) { return this.canAdd(t, e) ? (t.style[al(this.keyName)] = e, !0) : !1; } remove(t) { t.style[al(this.keyName)] = "", t.getAttribute("style") || t.removeAttribute("style"); } value(t) { const e = t.style[al(this.keyName)]; return this.canAdd(t, e) ? e : ""; } } const Fe = Qg; class tm { constructor(t) { this.attributes = {}, this.domNode = t, this.build(); } attribute(t, e) { e ? t.add(this.domNode, e) && (t.value(this.domNode) != null ? this.attributes[t.attrName] = t : delete this.attributes[t.attrName]) : (t.remove(this.domNode), delete this.attributes[t.attrName]); } build() { this.attributes = {}; const t = Fn.find(this.domNode); if (t == null) return; const e = oe.keys(this.domNode), r = Zt.keys(this.domNode), i = Fe.keys(this.domNode); e.concat(r).concat(i).forEach((s) => { const l = t.scroll.query(s, M.ATTRIBUTE); l instanceof oe && (this.attributes[l.attrName] = l); }); } copy(t) { Object.keys(this.attributes).forEach((e) => { const r = this.attributes[e].value(this.domNode); t.format(e, r); }); } move(t) { this.copy(t), Object.keys(this.attributes).forEach((e) => { this.attributes[e].remove(this.domNode); }), this.attributes = {}; } values() { return Object.keys(this.attributes).reduce( (t, e) => (t[e] = this.attributes[e].value(this.domNode), t), {} ); } } const ss = tm, kc = class { constructor(t, e) { this.scroll = t, this.domNode = e, Fn.blots.set(e, this), this.prev = null, this.next = null; } static create(t) { if (this.tagName == null) throw new Dn("Blot definition missing tagName"); let e, r; return Array.isArray(this.tagName) ? (typeof t == "string" ? (r = t.toUpperCase(), parseInt(r, 10).toString() === r && (r = parseInt(r, 10))) : typeof t == "number" && (r = t), typeof r == "number" ? e = document.createElement(this.tagName[r - 1]) : r && this.tagName.indexOf(r) > -1 ? e = document.createElement(r) : e = document.createElement(this.tagName[0])) : e = document.createElement(this.tagName), this.className && e.classList.add(this.className), e; } // Hack for accessing inherited static methods get statics() { return this.constructor; } attach() { } clone() { const t = this.domNode.cloneNode(!1); return this.scroll.create(t); } detach() { this.parent != null && this.parent.removeChild(this), Fn.blots.delete(this.domNode); } deleteAt(t, e) { this.isolate(t, e).remove(); } formatAt(t, e, r, i) { const s = this.isolate(t, e); if (this.scroll.query(r, M.BLOT) != null && i) s.wrap(r, i); else if (this.scroll.query(r, M.ATTRIBUTE) != null) { const l = this.scroll.create(this.statics.scope); s.wrap(l), l.format(r, i); } } insertAt(t, e, r) { const i = r == null ? this.scroll.create("text", e) : this.scroll.create(e, r), s = this.split(t); this.parent.insertBefore(i, s || void 0); } isolate(t, e) { const r = this.split(t); if (r == null) throw new Error("Attempt to isolate at end"); return r.split(e), r; } length() { return 1; } offset(t = this.parent) { return this.parent == null || this === t ? 0 : this.parent.children.offset(this) + this.parent.offset(t); } optimize(t) { this.statics.requiredContainer && !(this.parent instanceof this.statics.requiredContainer) && this.wrap(this.statics.requiredContainer.blotName); } remove() { this.domNode.parentNode != null && this.domNode.parentNode.removeChild(this.domNode), this.detach(); } replaceWith(t, e) { const r = typeof t == "string" ? this.scroll.create(t, e) : t; return this.parent != null && (this.parent.insertBefore(r, this.next || void 0), this.remove()), r; } split(t, e) { return t === 0 ? this : this.next; } update(t, e) { } wrap(t, e) { const r = typeof t == "string" ? this.scroll.create(t, e) : t; if (this.parent != null && this.parent.insertBefore(r, this.next || void 0), typeof r.appendChild != "function") throw new Dn(`Cannot wrap ${t}`); return r.appendChild(this), r; } }; kc.blotName = "abstract"; let $c = kc; const Dc = class extends $c { /** * Returns the value represented by domNode if it is this Blot's type * No checking that domNode can represent this Blot type is required so * applications needing it should check externally before calling. */ static value(t) { return !0; } /** * Given location represented by node and offset from DOM Selection Range, * return index to that location. */ index(t, e) { return this.domNode === t || this.domNode.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_CONTAINED_BY ? Math.min(e, 1) : -1; } /** * Given index to location within blot, return node and offset representing * that location, consumable by DOM Selection Range */ position(t, e) { let r = Array.from(this.parent.domNode.childNodes).indexOf(this.domNode); return t > 0 && (r += 1), [this.parent.domNode, r]; } /** * Return value represented by this blot * Should not change without interaction from API or * user change detectable by update() */ value() { return { [this.statics.blotName]: this.statics.value(this.domNode) || !0 }; } }; Dc.scope = M.INLINE_BLOT; let em = Dc; const ft = em; class nm { constructor() { this.head = null, this.tail = null, this.length = 0; } append(...t) { if (this.insertBefore(t[0], null), t.length > 1) { const e = t.slice(1); this.append(...e); } } at(t) { const e = this.iterator(); let r = e(); for (; r && t > 0; ) t -= 1, r = e(); return r; } contains(t) { const e = this.iterator(); let r = e(); for (; r; ) { if (r === t) return !0; r = e(); } return !1; } indexOf(t) { const e = this.iterator(); let r = e(), i = 0; for (; r; ) { if (r === t) return i; i += 1, r = e(); } return -1; } insertBefore(t, e) { t != null && (this.remove(t), t.next = e, e != null ? (t.prev = e.prev, e.prev != null && (e.prev.next = t), e.prev = t, e === this.head && (this.head = t)) : this.tail != null ? (this.tail.next = t, t.prev = this.tail, this.tail = t) : (t.prev = null, this.head = this.tail = t), this.length += 1); } offset(t) { let e = 0, r = this.head; for (; r != null; ) { if (r === t) return e; e += r.length(), r = r.next; } return -1; } remove(t) { this.contains(t) && (t.prev != null && (t.prev.next = t.next), t.next != null && (t.next.prev = t.prev), t === this.head && (this.head = t.next), t === this.tail && (this.tail = t.prev), this.length -= 1); } iterator(t = this.head) { return () => { const e = t; return t != null && (t = t.next), e; }; } find(t, e = !1) { const r = this.iterator(); let i = r(); for (; i; ) { const s = i.length(); if (t < s || e && t === s && (i.next == null || i.next.length() !== 0)) return [i, t]; t -= s, i = r(); } return [null, 0]; } forEach(t) { const e = this.iterator(); let r = e(); for (; r; ) t(r), r = e(); } forEachAt(t, e, r) { if (e <= 0) return; const [i, s] = this.find(t); let l = t - s; const o = this.iterator(i); let a = o(); for (; a && l < t + e; ) { const c = a.length(); t > l ? r( a, t - l, Math.min(e, l + c - t) ) : r(a, 0, Math.min(c, t + e - l)), l += c, a = o(); } } map(t) { return this.reduce((e, r) => (e.push(t(r)), e), []); } reduce(t, e) { const r = this.iterator(); let i = r(); for (; i; ) e = t(e, i), i = r(); return e; } } function ua(n, t) { const e = t.find(n); if (e) return e; try { return t.create(n); } catch { const r = t.create(M.INLINE); return Array.from(n.childNodes).forEach((i) => { r.domNode.appendChild(i); }), n.parentNode && n.parentNode.replaceChild(r.domNode, n), r.attach(), r; } } const Pc = class Oe extends $c { constructor(t, e) { super(t, e), this.uiNode = null, this.build(); } appendChild(t) { this.insertBefore(t); } attach() { super.attach(), this.children.forEach((t) => { t.attach(); }); } attachUI(t) { this.uiNode != null && this.uiNode.remove(), this.uiNode = t, Oe.uiClass && this.uiNode.classList.add(Oe.uiClass), this.uiNode.setAttribute("contenteditable", "false"), this.domNode.insertBefore(this.uiNode, this.domNode.firstChild); } /** * Called during construction, should fill its own children LinkedList. */ build() { this.children = new nm(), Array.from(this.domNode.childNodes).filter((t) => t !== this.uiNode).reverse().forEach((t) => { try { const e = ua(t, this.scroll); this.insertBefore(e, this.children.head || void 0); } catch (e) { if (e instanceof Dn) return; throw e; } }); } deleteAt(t, e) { if (t === 0 && e === this.length()) return this.remove(); this.children.forEachAt(t, e, (r, i, s) => { r.deleteAt(i, s); }); } descendant(t, e = 0) { const [r, i] = this.children.find(e); return t.blotName == null && t(r) || t.blotName != null && r instanceof t ? [r, i] : r instanceof Oe ? r.descendant(t, i) : [null, -1]; } descendants(t, e = 0, r = Number.MAX_VALUE) { let i = [], s = r; return this.children.forEachAt( e, r, (l, o, a) => { (t.blotName == null && t(l) || t.blotName != null && l instanceof t) && i.push(l), l instanceof Oe && (i = i.concat( l.descendants(t, o, s) )), s -= a; } ), i; } detach() { this.children.forEach((t) => { t.detach(); }), super.detach(); } enforceAllowedChildren() { let t = !1; this.children.forEach((e) => { t || this.statics.allowedChildren.some( (r) => e instanceof r ) || (e.statics.scope === M.BLOCK_BLOT ? (e.next != null && this.splitAfter(e), e.prev != null && this.splitAfter(e.prev), e.parent.unwrap(), t = !0) : e instanceof Oe ? e.unwrap() : e.remove()); }); } formatAt(t, e, r, i) { this.children.forEachAt(t, e, (s, l, o) => { s.formatAt(l, o, r, i); }); } insertAt(t, e, r) { const [i, s] = this.children.find(t); if (i) i.insertAt(s, e, r); else { const l = r == null ? this.scroll.create("text", e) : this.scroll.create(e, r); this.appendChild(l); } } insertBefore(t, e) { t.parent != null && t.parent.children.remove(t); let r = null; this.children.insertBefore(t, e || null), t.parent = this, e != null && (r = e.domNode), (this.domNode.parentNode !== t.domNode || this.domNode.nextSibling !== r) && this.domNode.insertBefore(t.domNode, r), t.attach(); } length() { return this.children.reduce((t, e) => t + e.length(), 0); } moveChildren(t, e) { this.children.forEach((r) => { t.insertBefore(r, e); }); } optimize(t) { if (super.optimize(t), this.enforceAllowedChildren(), this.uiNode != null && this.uiNode !== this.domNode.firstChild && this.domNode.insertBefore(this.uiNode, this.domNode.firstChild), this.children.length === 0) if (this.statics.defaultChild != null) { const e = this.scroll.create(this.statics.defaultChild.blotName); this.appendChild(e); } else this.remove(); } path(t, e = !1) { const [r, i] = this.children.find(t, e), s = [[this, t]]; return r instanceof Oe ? s.concat(r.path(i, e)) : (r != null && s.push([r, i]), s); } removeChild(t) { this.children.remove(t); } replaceWith(t, e) { const r = typeof t == "string" ? this.scroll.create(t, e) : t; return r instanceof Oe && this.moveChildren(r), super.replaceWith(r); } split(t, e = !1) { if (!e) { if (t === 0) return this; if (t === this.length()) return this.next; } const r = this.clone(); return this.parent && this.parent.insertBefore(r, this.next || void 0), this.children.forEachAt(t, this.length(), (i, s, l) => { const o = i.split(s, e); o != null && r.appendChild(o); }), r; } splitAfter(t) { const e = this.clone(); for (; t.next != null; ) e.appendChild(t.next); return this.parent && this.parent.insertBefore(e, this.next || void 0), e; } unwrap() { this.parent && this.moveChildren(this.parent, this.next || void 0), this.remove(); } update(t, e) { const r = [], i = []; t.forEach((s) => { s.target === this.domNode && s.type === "childList" && (r.push(...s.addedNodes), i.push(...s.removedNodes)); }), i.forEach((s) => { if (s.parentNode != null && // @ts-expect-error Fix me later s.tagName !== "IFRAME" && document.body.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_CONTAINED_BY) return; const l = this.scroll.find(s); l != null && (l.domNode.parentNode == null || l.domNode.parentNode === this.domNode) && l.detach(); }), r.filter((s) => s.parentNode === this.domNode && s !== this.uiNode).sort((s, l) => s === l ? 0 : s.compareDocumentPosition(l) & Node.DOCUMENT_POSITION_FOLLOWING ? 1 : -1).forEach((s) => { let l = null; s.nextSibling != null && (l = this.scroll.find(s.nextSibling)); const o = ua(s, this.scroll); (o.next !== l || o.next == null) && (o.parent != null && o.parent.removeChild(this), this.insertBefore(o, l || void 0)); }), this.enforceAllowedChildren(); } }; Pc.uiClass = ""; let rm = Pc; const Vt = rm; function im(n, t) { if (Object.keys(n).length !== Object.keys(t).length) return !1; for (const e in n) if (n[e] !== t[e]) return !1; return !0; } const On = class qn extends Vt { static create(t) { return super.create(t); } static formats(t, e) { const r = e.query(qn.blotName); if (!(r != null && t.tagName === r.tagName)) { if (typeof this.tagName == "string") return !0; if (Array.isArray(this.tagName)) return t.tagName.toLowerCase(); } } constructor(t, e) { super(t, e), this.attributes = new ss(this.domNode); } format(t, e) { if (t === this.statics.blotName && !e) this.children.forEach((r) => { r instanceof qn || (r = r.wrap(qn.blotName, !0)), this.attributes.copy(r); }), this.unwrap(); else { const r = this.scroll.query(t, M.INLINE); if (r == null) return; r instanceof oe ? this.attributes.attribute(r, e) : e && (t !== this.statics.blotName || this.formats()[t] !== e) && this.replaceWith(t, e); } } formats() { const t = this.attributes.values(), e = this.statics.formats(this.domNode, this.scroll); return e != null && (t[this.statics.blotName] = e), t; } formatAt(t, e, r, i) { this.formats()[r] != null || this.scroll.query(r, M.ATTRIBUTE) ? this.isolate(t, e).format(r, i) : super.formatAt(t, e, r, i); } optimize(t) { super.optimize(t); const e = this.formats(); if (Object.keys(e).length === 0) return this.unwrap(); const r = this.next; r instanceof qn && r.prev === this && im(e, r.formats()) && (r.moveChildren(this), r.remove()); } replaceWith(t, e) { const r = super.replaceWith(t, e); return this.attributes.copy(r), r; } update(t, e) { super.update(t, e), t.some( (r) => r.target === this.domNode && r.type === "attributes" ) && this.attributes.build(); } wrap(t, e) { const r = super.wrap(t, e); return r instanceof qn && this.attributes.move(r), r; } }; On.allowedChildren = [On, ft], On.blotName = "inline", On.scope = M.INLINE_BLOT, On.tagName = "SPAN"; let sm = On; const bo = sm, Mn = class Dl extends Vt { static create(t) { return super.create(t); } static formats(t, e) { const r = e.query(Dl.blotName); if (!(r != null && t.tagName === r.tagName)) { if (typeof this.tagName == "string") return !0; if (Array.isArray(this.tagName)) return t.tagName.toLowerCase(); } } constructor(t, e) { super(t, e), this.attributes = new ss(this.domNode); } format(t, e) { const r = this.scroll.query(t, M.BLOCK); r != null && (r instanceof oe ? this.attributes.attribute(r, e) : t === this.statics.blotName && !e ? this.replaceWith(Dl.blotName) : e && (t !== this.statics.blotName || this.formats()[t] !== e) && this.replaceWith(t, e)); } formats() { const t = this.attributes.values(), e = this.statics.formats(this.domNode, this.scroll); return e != null && (t[this.statics.blotName] = e), t; } formatAt(t, e, r, i) { this.scroll.query(r, M.BLOCK) != null ? this.format(r, i) : super.formatAt(t, e, r, i); } insertAt(t, e, r) { if (r == null || this.scroll.query(e, M.INLINE) != null) super.insertAt(t, e, r); else { const i = this.split(t); if (i != null) { const s = this.scroll.create(e, r); i.parent.insertBefore(s, i); } else throw new Error("Attempt to insertAt after block boundaries"); } } replaceWith(t, e) { const r = super.replaceWith(t, e); return this.attributes.copy(r), r; } update(t, e) { super.update(t, e), t.some( (r) => r.target === this.domNode && r.type === "attributes" ) && this.attributes.build(); } }; Mn.blotName = "block", Mn.scope = M.BLOCK_BLOT, Mn.tagName = "P", Mn.allowedChildren = [ bo, Mn, ft ]; let lm = Mn; const kr = lm, Pl = class extends Vt { checkMerge() { return this.next !== null && this.next.statics.blotName === this.statics.blotName; } deleteAt(t, e) { super.deleteAt(t, e), this.enforceAllowedChildren(); } formatAt(t, e, r, i) { super.formatAt(t, e, r, i), this.enforceAllowedChildren(); } insertAt(t, e, r) { super.insertAt(t, e, r), this.enforceAllowedChildren(); } optimize(t) { super.optimize(t), this.children.length > 0 && this.next != null && this.checkMerge() && (this.next.moveChildren(this), this.next.remove()); } }; Pl.blotName = "container", Pl.scope = M.BLOCK_BLOT; let om = Pl; const ls = om; class am extends ft { static formats(t, e) { } format(t, e) { super.formatAt(0, this.length(), t, e); } formatAt(t, e, r, i) { t === 0 && e === this.length() ? this.format(r, i) : super.formatAt(t, e, r, i); } formats() { return this.statics.formats(this.domNode, this.scroll); } } const Mt = am, cm = { attributes: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }, hm = 100, Rn = class extends Vt { constructor(t, e) { super(null, e), this.registry = t, this.scroll = this, this.build(), this.observer = new MutationObserver((r) => { this.update(r); }), this.observer.observe(this.domNode, cm), this.attach();