@vueup/vue-quill 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VueQuill @vueup/vue-quill v1.3.0
2
+ * VueQuill @vueup/vue-quill v1.4.0
3
3
  * https://vueup.github.io/vue-quill/
4
4
  *
5
5
  * Includes quill v2.0.2 || >=2.0.4 <3
@@ -7,6 +7,6 @@
7
7
  *
8
8
  * Copyright (c) 2026 Ahmad Luthfi Masruri
9
9
  * Released under the MIT license
10
- * Date: 2026-06-01T10:26:31.645Z
10
+ * Date: 2026-06-02T00:10:10.011Z
11
11
  */
12
- import{defineComponent as t,h as e,onMounted as n,onBeforeUnmount as r,ref as s,watch as i,nextTick as o}from"vue";var l="object"==typeof global&&global&&global.Object===Object&&global,a="object"==typeof self&&self&&self.Object===Object&&self,c=l||a||Function("return this")(),u=c.Symbol,h=Object.prototype,d=h.hasOwnProperty,f=h.toString,p=u?u.toStringTag:void 0;var g=Object.prototype.toString;var m=u?u.toStringTag:void 0;function b(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":m&&m in Object(t)?function(t){var e=d.call(t,p),n=t[p];try{t[p]=void 0;var r=!0}catch(i){}var s=f.call(t);return r&&(e?t[p]=n:delete t[p]),s}(t):function(t){return g.call(t)}(t)}function y(t){return null!=t&&"object"==typeof t}var v=Array.isArray;function x(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function N(t){return t}function E(t){if(!x(t))return!1;var e=b(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var w,A=c["__core-js_shared__"],q=(w=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";var k=Function.prototype.toString;function _(t){if(null!=t){try{return k.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var L=/^\[object .+?Constructor\]$/,O=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function T(t){return!(!x(t)||(e=t,q&&q in e))&&(E(t)?O:L).test(_(t));var e}function S(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return T(n)?n:void 0}var j=S(c,"WeakMap"),C=Object.create,R=function(){function t(){}return function(e){if(!x(e))return{};if(C)return C(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var I=Date.now;var M,B,D,U=function(){try{var t=S(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),P=U?function(t,e){return U(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:N,z=(M=P,B=0,D=0,function(){var t=I(),e=16-(t-D);if(D=t,e>0){if(++B>=800)return arguments[0]}else B=0;return M.apply(void 0,arguments)});var H=/^(?:0|[1-9]\d*)$/;function F(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&H.test(t))&&t>-1&&t%1==0&&t<e}function $(t,e,n){"__proto__"==e&&U?U(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function V(t,e){return t===e||t!=t&&e!=e}var K=Object.prototype.hasOwnProperty;function W(t,e,n){var r=t[e];K.call(t,e)&&V(r,n)&&(void 0!==n||e in t)||$(t,e,n)}var Z=Math.max;function G(t,e){return z(function(t,e,n){return e=Z(void 0===e?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=Z(r.length-e,0),o=Array(i);++s<i;)o[s]=r[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=r[s];return l[e]=n(o),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,l)}}(t,e,N),t+"")}function X(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Y(t){return null!=t&&X(t.length)&&!E(t)}var Q=Object.prototype;function J(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Q)}function tt(t){return y(t)&&"[object Arguments]"==b(t)}var et=Object.prototype,nt=et.hasOwnProperty,rt=et.propertyIsEnumerable,st=tt(function(){return arguments}())?tt:function(t){return y(t)&&nt.call(t,"callee")&&!rt.call(t,"callee")};var it="object"==typeof exports&&exports&&!exports.nodeType&&exports,ot=it&&"object"==typeof module&&module&&!module.nodeType&&module,lt=ot&&ot.exports===it?c.Buffer:void 0,at=(lt?lt.isBuffer:void 0)||function(){return!1},ct={};function ut(t){return function(e){return t(e)}}ct["[object Float32Array]"]=ct["[object Float64Array]"]=ct["[object Int8Array]"]=ct["[object Int16Array]"]=ct["[object Int32Array]"]=ct["[object Uint8Array]"]=ct["[object Uint8ClampedArray]"]=ct["[object Uint16Array]"]=ct["[object Uint32Array]"]=!0,ct["[object Arguments]"]=ct["[object Array]"]=ct["[object ArrayBuffer]"]=ct["[object Boolean]"]=ct["[object DataView]"]=ct["[object Date]"]=ct["[object Error]"]=ct["[object Function]"]=ct["[object Map]"]=ct["[object Number]"]=ct["[object Object]"]=ct["[object RegExp]"]=ct["[object Set]"]=ct["[object String]"]=ct["[object WeakMap]"]=!1;var ht="object"==typeof exports&&exports&&!exports.nodeType&&exports,dt=ht&&"object"==typeof module&&module&&!module.nodeType&&module,ft=dt&&dt.exports===ht&&l.process,pt=function(){try{var t=dt&&dt.require&&dt.require("util").types;return t||ft&&ft.binding&&ft.binding("util")}catch(e){}}(),gt=pt&&pt.isTypedArray,mt=gt?ut(gt):function(t){return y(t)&&X(t.length)&&!!ct[b(t)]},bt=Object.prototype.hasOwnProperty;function yt(t,e){var n=v(t),r=!n&&st(t),s=!n&&!r&&at(t),i=!n&&!r&&!s&&mt(t),o=n||r||s||i,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!e&&!bt.call(t,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||F(c,a))||l.push(c);return l}function vt(t,e){return function(n){return t(e(n))}}var xt=vt(Object.keys,Object),Nt=Object.prototype.hasOwnProperty;function Et(t){return Y(t)?yt(t):function(t){if(!J(t))return xt(t);var e=[];for(var n in Object(t))Nt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var wt=Object.prototype.hasOwnProperty;function At(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=J(t),n=[];for(var r in t)("constructor"!=r||!e&&wt.call(t,r))&&n.push(r);return n}function qt(t){return Y(t)?yt(t,!0):At(t)}var kt=S(Object,"create");var _t=Object.prototype.hasOwnProperty;var Lt=Object.prototype.hasOwnProperty;function Ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Tt(t,e){for(var n=t.length;n--;)if(V(t[n][0],e))return n;return-1}Ot.prototype.clear=function(){this.__data__=kt?kt(null):{},this.size=0},Ot.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Ot.prototype.get=function(t){var e=this.__data__;if(kt){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return _t.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return kt?void 0!==e[t]:Lt.call(e,t)},Ot.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=kt&&void 0===e?"__lodash_hash_undefined__":e,this};var St=Array.prototype.splice;function jt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}jt.prototype.clear=function(){this.__data__=[],this.size=0},jt.prototype.delete=function(t){var e=this.__data__,n=Tt(e,t);return!(n<0)&&(n==e.length-1?e.pop():St.call(e,n,1),--this.size,!0)},jt.prototype.get=function(t){var e=this.__data__,n=Tt(e,t);return n<0?void 0:e[n][1]},jt.prototype.has=function(t){return Tt(this.__data__,t)>-1},jt.prototype.set=function(t,e){var n=this.__data__,r=Tt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var Ct=S(c,"Map");function Rt(t,e){var n,r,s=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof e?"string":"hash"]:s.map}function It(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}It.prototype.clear=function(){this.size=0,this.__data__={hash:new Ot,map:new(Ct||jt),string:new Ot}},It.prototype.delete=function(t){var e=Rt(this,t).delete(t);return this.size-=e?1:0,e},It.prototype.get=function(t){return Rt(this,t).get(t)},It.prototype.has=function(t){return Rt(this,t).has(t)},It.prototype.set=function(t,e){var n=Rt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var Mt=vt(Object.getPrototypeOf,Object),Bt=Function.prototype.toString,Dt=Object.prototype.hasOwnProperty,Ut=Bt.call(Object);function Pt(t){var e=this.__data__=new jt(t);this.size=e.size}Pt.prototype.clear=function(){this.__data__=new jt,this.size=0},Pt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Pt.prototype.get=function(t){return this.__data__.get(t)},Pt.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof jt){var r=n.__data__;if(!Ct||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new It(r)}return n.set(t,e),this.size=n.size,this};var zt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ht=zt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ht&&Ht.exports===zt?c.Buffer:void 0,$t=Ft?Ft.allocUnsafe:void 0;function Vt(t,e){if(e)return t.slice();var n=t.length,r=$t?$t(n):new t.constructor(n);return t.copy(r),r}var Kt=Object.prototype.propertyIsEnumerable,Wt=Object.getOwnPropertySymbols,Zt=Wt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}(Wt(t),function(e){return Kt.call(t,e)}))}:function(){return[]};function Gt(t){return function(t,e,n){var r=e(t);return v(t)?r:function(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}(r,n(t))}(t,Et,Zt)}var Xt=S(c,"DataView"),Yt=S(c,"Promise"),Qt=S(c,"Set"),Jt="[object Map]",te="[object Promise]",ee="[object Set]",ne="[object WeakMap]",re="[object DataView]",se=_(Xt),ie=_(Ct),oe=_(Yt),le=_(Qt),ae=_(j),ce=b;(Xt&&ce(new Xt(new ArrayBuffer(1)))!=re||Ct&&ce(new Ct)!=Jt||Yt&&ce(Yt.resolve())!=te||Qt&&ce(new Qt)!=ee||j&&ce(new j)!=ne)&&(ce=function(t){var e=b(t),n="[object Object]"==e?t.constructor:void 0,r=n?_(n):"";if(r)switch(r){case se:return re;case ie:return Jt;case oe:return te;case le:return ee;case ae:return ne}return e});var ue=Object.prototype.hasOwnProperty;var he=c.Uint8Array;function de(t){var e=new t.constructor(t.byteLength);return new he(e).set(new he(t)),e}var fe=/\w*$/;var pe=u?u.prototype:void 0,ge=pe?pe.valueOf:void 0;function me(t,e){var n=e?de(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function be(t,e,n){var r,s,i,o,l,a=t.constructor;switch(e){case"[object ArrayBuffer]":return de(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return l=de((o=t).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return me(t,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(i=new(s=t).constructor(s.source,fe.exec(s))).lastIndex=s.lastIndex,i;case"[object Symbol]":return r=t,ge?Object(ge.call(r)):{}}}function ye(t){return"function"!=typeof t.constructor||J(t)?{}:R(Mt(t))}var ve=pt&&pt.isMap,xe=ve?ut(ve):function(t){return y(t)&&"[object Map]"==ce(t)};var Ne=pt&&pt.isSet,Ee=Ne?ut(Ne):function(t){return y(t)&&"[object Set]"==ce(t)},we="[object Arguments]",Ae="[object Function]",qe="[object Object]",ke={};function _e(t,e,n,r,s,i){var o,l=1&e;if(void 0!==o)return o;if(!x(t))return t;var a=v(t);if(a)o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&ue.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t);else{var c=ce(t),u=c==Ae||"[object GeneratorFunction]"==c;if(at(t))return Vt(t,l);if(c==qe||c==we||u&&!s)o=u?{}:ye(t);else{if(!ke[c])return s?t:{};o=be(t,c,l)}}i||(i=new Pt);var h=i.get(t);if(h)return h;i.set(t,o),Ee(t)?t.forEach(function(r){o.add(_e(r,e,n,r,t,i))}):xe(t)&&t.forEach(function(r,s){o.set(s,_e(r,e,n,s,t,i))});var d=a?void 0:Gt(t);return function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););}(d||t,function(r,s){d&&(r=t[s=r]),W(o,s,_e(r,e,n,s,t,i))}),o}ke[we]=ke["[object Array]"]=ke["[object ArrayBuffer]"]=ke["[object DataView]"]=ke["[object Boolean]"]=ke["[object Date]"]=ke["[object Float32Array]"]=ke["[object Float64Array]"]=ke["[object Int8Array]"]=ke["[object Int16Array]"]=ke["[object Int32Array]"]=ke["[object Map]"]=ke["[object Number]"]=ke[qe]=ke["[object RegExp]"]=ke["[object Set]"]=ke["[object String]"]=ke["[object Symbol]"]=ke["[object Uint8Array]"]=ke["[object Uint8ClampedArray]"]=ke["[object Uint16Array]"]=ke["[object Uint32Array]"]=!0,ke["[object Error]"]=ke[Ae]=ke["[object WeakMap]"]=!1;function Le(t){return _e(t,5)}function Oe(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new It;++e<n;)this.add(t[e])}function Te(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}Oe.prototype.add=Oe.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Oe.prototype.has=function(t){return this.__data__.has(t)};function Se(t,e,n,r,s,i){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var h=-1,d=!0,f=2&n?new Oe:void 0;for(i.set(t,e),i.set(e,t);++h<l;){var p=t[h],g=e[h];if(r)var m=o?r(g,p,h,e,t,i):r(p,g,h,t,e,i);if(void 0!==m){if(m)continue;d=!1;break}if(f){if(!Te(e,function(t,e){if(!f.has(e)&&(p===t||s(p,t,n,r,i)))return f.push(e)})){d=!1;break}}else if(p!==g&&!s(p,g,n,r,i)){d=!1;break}}return i.delete(t),i.delete(e),d}function je(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function Ce(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var Re=u?u.prototype:void 0,Ie=Re?Re.valueOf:void 0;var Me=Object.prototype.hasOwnProperty;var Be="[object Arguments]",De="[object Array]",Ue="[object Object]",Pe=Object.prototype.hasOwnProperty;function ze(t,e,n,r,s,i){var o=v(t),l=v(e),a=o?De:ce(t),c=l?De:ce(e),u=(a=a==Be?Ue:a)==Ue,h=(c=c==Be?Ue:c)==Ue,d=a==c;if(d&&at(t)){if(!at(e))return!1;o=!0,u=!1}if(d&&!u)return i||(i=new Pt),o||mt(t)?Se(t,e,n,r,s,i):function(t,e,n,r,s,i,o){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new he(t),new he(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return V(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=je;case"[object Set]":if(l||(l=Ce),t.size!=e.size&&!(1&r))return!1;var a=o.get(t);if(a)return a==e;r|=2,o.set(t,e);var c=Se(l(t),l(e),r,s,i,o);return o.delete(t),c;case"[object Symbol]":if(Ie)return Ie.call(t)==Ie.call(e)}return!1}(t,e,a,n,r,s,i);if(!(1&n)){var f=u&&Pe.call(t,"__wrapped__"),p=h&&Pe.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,m=p?e.value():e;return i||(i=new Pt),s(g,m,n,r,i)}}return!!d&&(i||(i=new Pt),function(t,e,n,r,s,i){var o=1&n,l=Gt(t),a=l.length;if(a!=Gt(e).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in e:Me.call(e,u)))return!1}var h=i.get(t),d=i.get(e);if(h&&d)return h==e&&d==t;var f=!0;i.set(t,e),i.set(e,t);for(var p=o;++c<a;){var g=t[u=l[c]],m=e[u];if(r)var b=o?r(m,g,u,e,t,i):r(g,m,u,t,e,i);if(!(void 0===b?g===m||s(g,m,n,r,i):b)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var y=t.constructor,v=e.constructor;y==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,n,r,s,i))}function He(t,e,n,r,s){return t===e||(null==t||null==e||!y(t)&&!y(e)?t!=t&&e!=e:ze(t,e,n,r,He,s))}var Fe=function(t,e,n){for(var r=-1,s=Object(t),i=n(t),o=i.length;o--;){var l=i[++r];if(!1===e(s[l],l,s))break}return t};function $e(t,e,n){(void 0!==n&&!V(t[e],n)||void 0===n&&!(e in t))&&$(t,e,n)}function Ve(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Ke(t){return function(t,e,n){var r=!n;n||(n={});for(var s=-1,i=e.length;++s<i;){var o=e[s],l=void 0;void 0===l&&(l=t[o]),r?$(n,o,l):W(n,o,l)}return n}(t,qt(t))}function We(t,e,n,r,s,i,o){var l=Ve(t,n),a=Ve(e,n),c=o.get(a);if(c)$e(t,n,c);else{var u,h=i?i(l,a,n+"",t,e,o):void 0,d=void 0===h;if(d){var f=v(a),p=!f&&at(a),g=!f&&!p&&mt(a);h=a,f||p||g?v(l)?h=l:y(u=l)&&Y(u)?h=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(l):p?(d=!1,h=Vt(a,!0)):g?(d=!1,h=me(a,!0)):h=[]:function(t){if(!y(t)||"[object Object]"!=b(t))return!1;var e=Mt(t);if(null===e)return!0;var n=Dt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Bt.call(n)==Ut}(a)||st(a)?(h=l,st(l)?h=Ke(l):x(l)&&!E(l)||(h=ye(a))):d=!1}d&&(o.set(a,h),s(h,a,r,i,o),o.delete(a)),$e(t,n,h)}}function Ze(t,e,n,r,s){t!==e&&Fe(e,function(i,o){if(s||(s=new Pt),x(i))We(t,e,o,n,Ze,r,s);else{var l=r?r(Ve(t,o),i,o+"",t,e,s):void 0;void 0===l&&(l=i),$e(t,o,l)}},qt)}function Ge(t,e){return He(t,e)}var Xe,Ye=(Xe=function(t,e,n){Ze(t,e,n)},G(function(t,e){var n=-1,r=e.length,s=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(s=Xe.length>3&&"function"==typeof s?(r--,s):void 0,i&&function(t,e,n){if(!x(n))return!1;var r=typeof e;return!!("number"==r?Y(n)&&F(e,n.length):"string"==r&&e in n)&&V(n[e],t)}(e[0],e[1],i)&&(s=r<3?void 0:s,r=1),t=Object(t);++n<r;){var o=e[n];o&&Xe(t,o,n,s)}return t})),Qe=(t=>(t[t.TYPE=3]="TYPE",t[t.LEVEL=12]="LEVEL",t[t.ATTRIBUTE=13]="ATTRIBUTE",t[t.BLOT=14]="BLOT",t[t.INLINE=7]="INLINE",t[t.BLOCK=11]="BLOCK",t[t.BLOCK_BLOT=10]="BLOCK_BLOT",t[t.INLINE_BLOT=6]="INLINE_BLOT",t[t.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",t[t.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",t[t.ANY=15]="ANY",t))(Qe||{});class Je{constructor(t,e,n={}){this.attrName=t,this.keyName=e;this.scope=null!=n.scope?n.scope&Qe.LEVEL|Qe.TYPE&Qe.ATTRIBUTE:Qe.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(t){return Array.from(t.attributes).map(t=>t.name)}add(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)}canAdd(t,e){return null==this.whitelist||("string"==typeof e?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 tn extends Error{constructor(t){super(t="[Parchment] "+t),this.message=t,this.name=this.constructor.name}}const en=class t{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(null==t)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let n=null;try{n=t.parentNode}catch{return null}return this.find(n,e)}return null}create(e,n,r){const s=this.query(n);if(null==s)throw new tn(`Unable to create ${n} blot`);const i=s,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:i.create(r),l=new i(e,o,r);return t.blots.set(l.domNode,l),l}find(e,n=!1){return t.find(e,n)}query(t,e=Qe.ANY){let n;return"string"==typeof t?n=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof t?t&Qe.LEVEL&Qe.BLOCK?n=this.types.block:t&Qe.LEVEL&Qe.INLINE&&(n=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(t=>(n=this.classes[t],!!n)),n=n||this.tags[t.tagName]),null==n?null:"scope"in n&&e&Qe.LEVEL&n.scope&&e&Qe.TYPE&n.scope?n:null}register(...t){return t.map(t=>{const e="blotName"in t,n="attrName"in t;if(!e&&!n)throw new tn("Invalid definition");if(e&&"abstract"===t.blotName)throw new tn("Cannot register abstract class");return this.types[e?t.blotName:n?t.attrName:void 0]=t,n?"string"==typeof t.keyName&&(this.attributes[t.keyName]=t):e&&(t.className&&(this.classes[t.className]=t),t.tagName&&(t.tagName=Array.isArray(t.tagName)?t.tagName.map(t=>t.toUpperCase()):t.tagName.toUpperCase(),(Array.isArray(t.tagName)?t.tagName:[t.tagName]).forEach(e=>{(null==this.tags[e]||null==t.className)&&(this.tags[e]=t)}))),t})}};en.blots=new WeakMap;let nn=en;function rn(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(t=>0===t.indexOf(`${e}-`))}const sn=class extends Je{static keys(t){return(t.getAttribute("class")||"").split(/\s+/).map(t=>t.split("-").slice(0,-1).join("-"))}add(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(`${this.keyName}-${e}`),!0)}remove(t){rn(t,this.keyName).forEach(e=>{t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")}value(t){const e=(rn(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}};function on(t){const e=t.split("-"),n=e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("");return e[0]+n}const ln=class extends Je{static keys(t){return(t.getAttribute("style")||"").split(";").map(t=>t.split(":")[0].trim())}add(t,e){return!!this.canAdd(t,e)&&(t.style[on(this.keyName)]=e,!0)}remove(t){t.style[on(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[on(this.keyName)];return this.canAdd(t,e)?e:""}};const an=class{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=nn.find(this.domNode);if(null==t)return;const e=Je.keys(this.domNode),n=sn.keys(this.domNode),r=ln.keys(this.domNode);e.concat(n).concat(r).forEach(e=>{const n=t.scroll.query(e,Qe.ATTRIBUTE);n instanceof Je&&(this.attributes[n.attrName]=n)})}copy(t){Object.keys(this.attributes).forEach(e=>{const n=this.attributes[e].value(this.domNode);t.format(e,n)})}move(t){this.copy(t),Object.keys(this.attributes).forEach(t=>{this.attributes[t].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t),{})}},cn=class{constructor(t,e){this.scroll=t,this.domNode=e,nn.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(null==this.tagName)throw new tn("Blot definition missing tagName");let e,n;return Array.isArray(this.tagName)?("string"==typeof t?(n=t.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof t&&(n=t),e="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){null!=this.parent&&this.parent.removeChild(this),nn.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,n,r){const s=this.isolate(t,e);if(null!=this.scroll.query(n,Qe.BLOT)&&r)s.wrap(n,r);else if(null!=this.scroll.query(n,Qe.ATTRIBUTE)){const t=this.scroll.create(this.statics.scope);s.wrap(t),t.format(n,r)}}insertAt(t,e,n){const r=null==n?this.scroll.create("text",e):this.scroll.create(e,n),s=this.split(t);this.parent.insertBefore(r,s||void 0)}isolate(t,e){const n=this.split(t);if(null==n)throw new Error("Attempt to isolate at end");return n.split(e),n}length(){return 1}offset(t=this.parent){return null==this.parent||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(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(t,e){return 0===t?this:this.next}update(t,e){}wrap(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new tn(`Cannot wrap ${t}`);return n.appendChild(this),n}};cn.blotName="abstract";let un=cn;const hn=class extends un{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};hn.scope=Qe.INLINE_BLOT;const dn=hn;class fn{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 n=e();for(;n&&t>0;)t-=1,n=e();return n}contains(t){const e=this.iterator();let n=e();for(;n;){if(n===t)return!0;n=e()}return!1}indexOf(t){const e=this.iterator();let n=e(),r=0;for(;n;){if(n===t)return r;r+=1,n=e()}return-1}insertBefore(t,e){null!=t&&(this.remove(t),t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(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,n=this.head;for(;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1}remove(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(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 null!=t&&(t=t.next),e}}find(t,e=!1){const n=this.iterator();let r=n();for(;r;){const s=r.length();if(t<s||e&&t===s&&(null==r.next||0!==r.next.length()))return[r,t];t-=s,r=n()}return[null,0]}forEach(t){const e=this.iterator();let n=e();for(;n;)t(n),n=e()}forEachAt(t,e,n){if(e<=0)return;const[r,s]=this.find(t);let i=t-s;const o=this.iterator(r);let l=o();for(;l&&i<t+e;){const r=l.length();t>i?n(l,t-i,Math.min(e,i+r-t)):n(l,0,Math.min(r,t+e-i)),i+=r,l=o()}}map(t){return this.reduce((e,n)=>(e.push(t(n)),e),[])}reduce(t,e){const n=this.iterator();let r=n();for(;r;)e=t(e,r),r=n();return e}}function pn(t,e){const n=e.find(t);if(n)return n;try{return e.create(t)}catch{const n=e.create(Qe.INLINE);return Array.from(t.childNodes).forEach(t=>{n.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(n.domNode,t),n.attach(),n}}const gn=class t extends un{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(e){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=e,t.uiClass&&this.uiNode.classList.add(t.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new fn,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=pn(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof tn)return;throw e}})}deleteAt(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,(t,e,n)=>{t.deleteAt(e,n)})}descendant(e,n=0){const[r,s]=this.children.find(n);return null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e?[r,s]:r instanceof t?r.descendant(e,s):[null,-1]}descendants(e,n=0,r=Number.MAX_VALUE){let s=[],i=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&s.push(n),n instanceof t&&(s=s.concat(n.descendants(e,r,i))),i-=o}),s}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let e=!1;this.children.forEach(n=>{e||this.statics.allowedChildren.some(t=>n instanceof t)||(n.statics.scope===Qe.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),e=!0):n instanceof t?n.unwrap():n.remove())})}formatAt(t,e,n,r){this.children.forEachAt(t,e,(t,e,s)=>{t.formatAt(e,s,n,r)})}insertAt(t,e,n){const[r,s]=this.children.find(t);if(r)r.insertAt(s,e,n);else{const t=null==n?this.scroll.create("text",e):this.scroll.create(e,n);this.appendChild(t)}}insertBefore(t,e){null!=t.parent&&t.parent.children.remove(t);let n=null;this.children.insertBefore(t,e||null),t.parent=this,null!=e&&(n=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(t.domNode,n),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(n=>{t.insertBefore(n,e)})}optimize(t){if(super.optimize(t),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove()}path(e,n=!1){const[r,s]=this.children.find(e,n),i=[[this,e]];return r instanceof t?i.concat(r.path(s,n)):(null!=r&&i.push([r,s]),i)}removeChild(t){this.children.remove(t)}replaceWith(e,n){const r="string"==typeof e?this.scroll.create(e,n):e;return r instanceof t&&this.moveChildren(r),super.replaceWith(r)}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(t,this.length(),(t,r,s)=>{const i=t.split(r,e);null!=i&&n.appendChild(i)}),n}splitAfter(t){const e=this.clone();for(;null!=t.next;)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 n=[],r=[];t.forEach(t=>{t.target===this.domNode&&"childList"===t.type&&(n.push(...t.addedNodes),r.push(...t.removedNodes))}),r.forEach(t=>{if(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const e=this.scroll.find(t);null!=e&&(null==e.domNode.parentNode||e.domNode.parentNode===this.domNode)&&e.detach()}),n.filter(t=>t.parentNode===this.domNode&&t!==this.uiNode).sort((t,e)=>t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(t=>{let e=null;null!=t.nextSibling&&(e=this.scroll.find(t.nextSibling));const n=pn(t,this.scroll);(n.next!==e||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,e||void 0))}),this.enforceAllowedChildren()}};gn.uiClass="";const mn=gn;const bn=class t extends mn{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new an(this.domNode)}format(e,n){if(e!==this.statics.blotName||n){const t=this.scroll.query(e,Qe.INLINE);if(null==t)return;t instanceof Je?this.attributes.attribute(t,n):n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n)}else this.children.forEach(e=>{e instanceof t||(e=e.wrap(t.blotName,!0)),this.attributes.copy(e)}),this.unwrap()}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.formats()[n]||this.scroll.query(n,Qe.ATTRIBUTE)?this.isolate(t,e).format(n,r):super.formatAt(t,e,n,r)}optimize(e){super.optimize(e);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof t&&r.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}wrap(e,n){const r=super.wrap(e,n);return r instanceof t&&this.attributes.move(r),r}};bn.allowedChildren=[bn,dn],bn.blotName="inline",bn.scope=Qe.INLINE_BLOT,bn.tagName="SPAN";const yn=bn,vn=class t extends mn{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new an(this.domNode)}format(e,n){const r=this.scroll.query(e,Qe.BLOCK);null!=r&&(r instanceof Je?this.attributes.attribute(r,n):e!==this.statics.blotName||n?n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n):this.replaceWith(t.blotName))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.scroll.query(n,Qe.BLOCK)?this.format(n,r):super.formatAt(t,e,n,r)}insertAt(t,e,n){if(null==n||null!=this.scroll.query(e,Qe.INLINE))super.insertAt(t,e,n);else{const r=this.split(t);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const t=this.scroll.create(e,n);r.parent.insertBefore(t,r)}}}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}};vn.blotName="block",vn.scope=Qe.BLOCK_BLOT,vn.tagName="P",vn.allowedChildren=[yn,vn,dn];const xn=vn,Nn=class extends mn{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.enforceAllowedChildren()}insertAt(t,e,n){super.insertAt(t,e,n),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};Nn.blotName="container",Nn.scope=Qe.BLOCK_BLOT;const En=Nn;const wn=class extends dn{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,n,r){0===t&&e===this.length()?this.format(n,r):super.formatAt(t,e,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},An={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},qn=class extends mn{constructor(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(t=>{this.update(t)}),this.observer.observe(this.domNode,An),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const n=this.registry.find(t,e);return n?n.scroll===this?n:e?this.find(n.scroll.domNode.parentNode,!0):null:null}query(t,e=Qe.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),0===t&&e===this.length()?this.children.forEach(t=>{t.remove()}):super.deleteAt(t,e)}formatAt(t,e,n,r){this.update(),super.formatAt(t,e,n,r)}insertAt(t,e,n){this.update(),super.insertAt(t,e,n)}optimize(t=[],e={}){super.optimize(e);const n=e.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)t.push(r.pop());const s=(t,e=!0)=>{null==t||t===this||null!=t.domNode.parentNode&&(n.has(t.domNode)||n.set(t.domNode,[]),e&&s(t.parent))},i=t=>{n.has(t.domNode)&&(t instanceof mn&&t.children.forEach(i),n.delete(t.domNode),t.optimize(e))};let o=t;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(t=>{const e=this.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(s(this.find(t.previousSibling,!1)),Array.from(t.addedNodes).forEach(t=>{const e=this.find(t,!1);s(e,!1),e instanceof mn&&e.children.forEach(t=>{s(t,!1)})})):"attributes"===t.type&&s(e.prev)),s(e))}),this.children.forEach(i),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)t.push(r.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const n=new WeakMap;t.map(t=>{const e=this.find(t.target,!0);return null==e?null:n.has(e.domNode)?(n.get(e.domNode).push(t),null):(n.set(e.domNode,[t]),e)}).forEach(t=>{null!=t&&t!==this&&n.has(t.domNode)&&t.update(n.get(t.domNode)||[],e)}),e.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),e),this.optimize(t,e)}};qn.blotName="scroll",qn.defaultChild=xn,qn.allowedChildren=[xn,En],qn.scope=Qe.BLOCK_BLOT,qn.tagName="DIV";const kn=qn,_n=class t extends dn{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,n){null==n?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,n)}length(){return this.text.length}optimize(e){super.optimize(e),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(t,e){t.some(t=>"characterData"===t.type&&t.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};_n.blotName="text",_n.scope=Qe.INLINE_BLOT;const Ln=_n;var On=Object.freeze({__proto__:null,Attributor:Je,AttributorStore:an,BlockBlot:xn,ClassAttributor:sn,ContainerBlot:En,EmbedBlot:wn,InlineBlot:yn,LeafBlot:dn,ParentBlot:mn,Registry:nn,Scope:Qe,ScrollBlot:kn,StyleAttributor:ln,TextBlot:Ln}),Tn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Sn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jn,Cn,Rn={exports:{}};function In(){if(Cn)return jn;Cn=1;var t=-1;function e(d,f,p,g,b){if(d===f)return d?[[0,d]]:[];if(null!=p){var y=function(t,e,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,s="number"==typeof n?null:n.newRange,i=t.length,o=e.length;if(0===r.length&&(null===s||0===s.length)){var l=r.index,a=t.slice(0,l),c=t.slice(l),u=s?s.index:null,h=l+o-i;if((null===u||u===h)&&!(h<0||h>o)){var d=e.slice(0,h);if((g=e.slice(h))===c){var f=Math.min(l,h);if((y=a.slice(0,f))===(x=d.slice(0,f)))return m(y,a.slice(f),d.slice(f),c)}}if(null===u||u===l){var p=l,g=(d=e.slice(0,p),e.slice(p));if(d===a){var b=Math.min(i-p,o-p);if((v=c.slice(c.length-b))===(N=g.slice(g.length-b)))return m(a,c.slice(0,c.length-b),g.slice(0,g.length-b),v)}}}if(r.length>0&&s&&0===s.length){var y=t.slice(0,r.index),v=t.slice(r.index+r.length);if(!(o<(f=y.length)+(b=v.length))){var x=e.slice(0,f),N=e.slice(o-b);if(y===x&&v===N)return m(y,t.slice(f,i-b),e.slice(f,o-b),v)}}return null}(d,f,p);if(y)return y}var v=r(d,f),x=d.substring(0,v);v=i(d=d.substring(v),f=f.substring(v));var N=d.substring(d.length-v),E=function(s,o){var l;if(!s)return[[1,o]];if(!o)return[[t,s]];var a=s.length>o.length?s:o,c=s.length>o.length?o:s,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],s.length>o.length&&(l[0][0]=l[2][0]=t),l;if(1===c.length)return[[t,s],[1,o]];var h=function(t,e){var n=t.length>e.length?t:e,s=t.length>e.length?e:t;if(n.length<4||2*s.length<n.length)return null;function o(t,e,n){for(var s,o,l,a,c=t.substring(n,n+Math.floor(t.length/4)),u=-1,h="";-1!==(u=e.indexOf(c,u+1));){var d=r(t.substring(n),e.substring(u)),f=i(t.substring(0,n),e.substring(0,u));h.length<f+d&&(h=e.substring(u-f,u)+e.substring(u,u+d),s=t.substring(0,n-f),o=t.substring(n+d),l=e.substring(0,u-f),a=e.substring(u+d))}return 2*h.length>=t.length?[s,o,l,a,h]:null}var l,a,c,u,h,d=o(n,s,Math.ceil(n.length/4)),f=o(n,s,Math.ceil(n.length/2));if(!d&&!f)return null;l=f?d&&d[4].length>f[4].length?d:f:d;t.length>e.length?(a=l[0],c=l[1],u=l[2],h=l[3]):(u=l[0],h=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,h,p]}(s,o);if(h){var d=h[1],f=h[3],p=h[4],g=e(h[0],h[2]),m=e(d,f);return g.concat([[0,p]],m)}return function(e,r){for(var s=e.length,i=r.length,o=Math.ceil((s+i)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),h=0;h<a;h++)c[h]=-1,u[h]=-1;c[l+1]=0,u[l+1]=0;for(var d=s-i,f=d%2!=0,p=0,g=0,m=0,b=0,y=0;y<o;y++){for(var v=-y+p;v<=y-g;v+=2){for(var x=l+v,N=(k=v===-y||v!==y&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-v;k<s&&N<i&&e.charAt(k)===r.charAt(N);)k++,N++;if(c[x]=k,k>s)g+=2;else if(N>i)p+=2;else if(f){if((A=l+d-v)>=0&&A<a&&-1!==u[A])if(k>=(w=s-u[A]))return n(e,r,k,N)}}for(var E=-y+m;E<=y-b;E+=2){for(var w,A=l+E,q=(w=E===-y||E!==y&&u[A-1]<u[A+1]?u[A+1]:u[A-1]+1)-E;w<s&&q<i&&e.charAt(s-w-1)===r.charAt(i-q-1);)w++,q++;if(u[A]=w,w>s)b+=2;else if(q>i)m+=2;else if(!f){if((x=l+d-E)>=0&&x<a&&-1!==c[x]){var k;N=l+(k=c[x])-x;if(k>=(w=s-w))return n(e,r,k,N)}}}}return[[t,e],[1,r]]}(s,o)}(d=d.substring(0,d.length-v),f=f.substring(0,f.length-v));return x&&E.unshift([0,x]),N&&E.push([0,N]),h(E,b),g&&function(e){var n=!1,r=[],d=0,f=null,p=0,g=0,m=0,b=0,y=0;for(;p<e.length;)0==e[p][0]?(r[d++]=p,g=b,m=y,b=0,y=0,f=e[p][1]):(1==e[p][0]?b+=e[p][1].length:y+=e[p][1].length,f&&f.length<=Math.max(g,m)&&f.length<=Math.max(b,y)&&(e.splice(r[d-1],0,[t,f]),e[r[d-1]+1][0]=1,d--,p=--d>0?r[d-1]:-1,g=0,m=0,b=0,y=0,f=null,n=!0)),p++;n&&h(e);(function(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.charAt(0),s=n.match(o),i=r.match(o),h=s&&n.match(l),d=i&&r.match(l),f=h&&n.match(a),p=d&&r.match(a),g=f&&t.match(c),m=p&&e.match(u);return g||m?5:f||p?4:s&&!h&&d?3:h||d?2:s||i?1:0}var n=1;for(;n<t.length-1;){if(0==t[n-1][0]&&0==t[n+1][0]){var r=t[n-1][1],s=t[n][1],h=t[n+1][1],d=i(r,s);if(d){var f=s.substring(s.length-d);r=r.substring(0,r.length-d),s=f+s.substring(0,s.length-d),h=f+h}for(var p=r,g=s,m=h,b=e(r,s)+e(s,h);s.charAt(0)===h.charAt(0);){r+=s.charAt(0),s=s.substring(1)+h.charAt(0),h=h.substring(1);var y=e(r,s)+e(s,h);y>=b&&(b=y,p=r,g=s,m=h)}t[n-1][1]!=p&&(p?t[n-1][1]=p:(t.splice(n-1,1),n--),t[n][1]=g,m?t[n+1][1]=m:(t.splice(n+1,1),n--))}n++}})(e),p=1;for(;p<e.length;){if(e[p-1][0]==t&&1==e[p][0]){var v=e[p-1][1],x=e[p][1],N=s(v,x),E=s(x,v);N>=E?(N>=v.length/2||N>=x.length/2)&&(e.splice(p,0,[0,x.substring(0,N)]),e[p-1][1]=v.substring(0,v.length-N),e[p+1][1]=x.substring(N),p++):(E>=v.length/2||E>=x.length/2)&&(e.splice(p,0,[0,v.substring(0,E)]),e[p-1][0]=1,e[p-1][1]=x.substring(0,x.length-E),e[p+1][0]=t,e[p+1][1]=v.substring(E),p++),p++}p++}}(E),E}function n(t,n,r,s){var i=t.substring(0,r),o=n.substring(0,s),l=t.substring(r),a=n.substring(s),c=e(i,o),u=e(l,a);return c.concat(u)}function r(t,e){if(!t||!e||t.charAt(0)!==e.charAt(0))return 0;for(var n=0,r=Math.min(t.length,e.length),s=r,i=0;n<s;)t.substring(i,s)==e.substring(i,s)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return d(t.charCodeAt(s-1))&&s--,s}function s(t,e){var n=t.length,r=e.length;if(0==n||0==r)return 0;n>r?t=t.substring(n-r):n<r&&(e=e.substring(0,n));var s=Math.min(n,r);if(t==e)return s;for(var i=0,o=1;;){var l=t.substring(s-o),a=e.indexOf(l);if(-1==a)return i;o+=a,0!=a&&t.substring(s-o)!=e.substring(0,o)||(i=o,o++)}}function i(t,e){if(!t||!e||t.slice(-1)!==e.slice(-1))return 0;for(var n=0,r=Math.min(t.length,e.length),s=r,i=0;n<s;)t.substring(t.length-s,t.length-i)==e.substring(e.length-s,e.length-i)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return f(t.charCodeAt(t.length-s))&&s--,s}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function h(e,n){e.push([0,""]);for(var s,o=0,l=0,a=0,c="",u="";o<e.length;)if(o<e.length-1&&!e[o][1])e.splice(o,1);else switch(e[o][0]){case 1:a++,u+=e[o][1],o++;break;case t:l++,c+=e[o][1],o++;break;case 0:var d=o-a-l-1;if(n){if(d>=0&&g(e[d][1])){var f=e[d][1].slice(-1);if(e[d][1]=e[d][1].slice(0,-1),c=f+c,u=f+u,!e[d][1]){e.splice(d,1),o--;var m=d-1;e[m]&&1===e[m][0]&&(a++,u=e[m][1]+u,m--),e[m]&&e[m][0]===t&&(l++,c=e[m][1]+c,m--),d=m}}if(p(e[o][1])){f=e[o][1].charAt(0);e[o][1]=e[o][1].slice(1),c+=f,u+=f}}if(o<e.length-1&&!e[o][1]){e.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(s=r(u,c))&&(d>=0?e[d][1]+=u.substring(0,s):(e.splice(0,0,[0,u.substring(0,s)]),o++),u=u.substring(s),c=c.substring(s)),0!==(s=i(u,c))&&(e[o][1]=u.substring(u.length-s)+e[o][1],u=u.substring(0,u.length-s),c=c.substring(0,c.length-s)));var b=a+l;0===c.length&&0===u.length?(e.splice(o-b,b),o-=b):0===c.length?(e.splice(o-b,b,[1,u]),o=o-b+1):0===u.length?(e.splice(o-b,b,[t,c]),o=o-b+1):(e.splice(o-b,b,[t,c],[1,u]),o=o-b+2)}0!==o&&0===e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,a=0,l=0,c="",u=""}""===e[e.length-1][1]&&e.pop();var y=!1;for(o=1;o<e.length-1;)0===e[o-1][0]&&0===e[o+1][0]&&(e[o][1].substring(e[o][1].length-e[o-1][1].length)===e[o-1][1]?(e[o][1]=e[o-1][1]+e[o][1].substring(0,e[o][1].length-e[o-1][1].length),e[o+1][1]=e[o-1][1]+e[o+1][1],e.splice(o-1,1),y=!0):e[o][1].substring(0,e[o+1][1].length)==e[o+1][1]&&(e[o-1][1]+=e[o+1][1],e[o][1]=e[o][1].substring(e[o+1][1].length)+e[o+1][1],e.splice(o+1,1),y=!0)),o++;y&&h(e,n)}function d(t){return t>=55296&&t<=56319}function f(t){return t>=56320&&t<=57343}function p(t){return f(t.charCodeAt(0))}function g(t){return d(t.charCodeAt(t.length-1))}function m(e,n,r,s){return g(e)||p(s)?null:function(t){for(var e=[],n=0;n<t.length;n++)t[n][1].length>0&&e.push(t[n]);return e}([[0,e],[t,n],[1,r],[0,s]])}function b(t,n,r,s){return e(t,n,r,s,!0)}return b.INSERT=1,b.DELETE=t,b.EQUAL=0,jn=b}var Mn,Bn={exports:{}};function Dn(){return Mn||(Mn=1,function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",h="[object Object]",d="[object Promise]",f="[object RegExp]",p="[object Set]",g="[object String]",m="[object Symbol]",b="[object WeakMap]",y="[object ArrayBuffer]",v="[object DataView]",x="[object Float32Array]",N="[object Float64Array]",E="[object Int8Array]",w="[object Int16Array]",A="[object Int32Array]",q="[object Uint8Array]",k="[object Uint8ClampedArray]",_="[object Uint16Array]",L="[object Uint32Array]",O=/\w*$/,T=/^\[object .+?Constructor\]$/,S=/^(?:0|[1-9]\d*)$/,j={};j[s]=j["[object Array]"]=j[y]=j[v]=j[i]=j[o]=j[x]=j[N]=j[E]=j[w]=j[A]=j[c]=j[u]=j[h]=j[f]=j[p]=j[g]=j[m]=j[q]=j[k]=j[_]=j[L]=!0,j["[object Error]"]=j[l]=j[b]=!1;var C="object"==typeof self&&self&&self.Object===Object&&self,R="object"==typeof Tn&&Tn&&Tn.Object===Object&&Tn||C||Function("return this")(),I=e&&!e.nodeType&&e,M=I&&t&&!t.nodeType&&t,B=M&&M.exports===I;function D(t,e){return t.set(e[0],e[1]),t}function U(t,e){return t.add(e),t}function P(t,e,n,r){for(var s=-1,i=t?t.length:0;++s<i;)n=e(n,t[s],s,t);return n}function z(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(n){}return e}function H(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function F(t,e){return function(n){return t(e(n))}}function $(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var V=Array.prototype,K=Function.prototype,W=Object.prototype,Z=R["__core-js_shared__"],G=function(){var t=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),X=K.toString,Y=W.hasOwnProperty,Q=W.toString,J=RegExp("^"+X.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tt=B?R.Buffer:void 0,et=R.Symbol,nt=R.Uint8Array,rt=F(Object.getPrototypeOf,Object),st=Object.create,it=W.propertyIsEnumerable,ot=V.splice,lt=Object.getOwnPropertySymbols,at=tt?tt.isBuffer:void 0,ct=F(Object.keys,Object),ut=It(R,"DataView"),ht=It(R,"Map"),dt=It(R,"Promise"),ft=It(R,"Set"),pt=It(R,"WeakMap"),gt=It(Object,"create"),mt=Pt(ut),bt=Pt(ht),yt=Pt(dt),vt=Pt(ft),xt=Pt(pt),Nt=et?et.prototype:void 0,Et=Nt?Nt.valueOf:void 0;function wt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function qt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function kt(t){this.__data__=new At(t)}function _t(t,e){var n=Ht(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ft(t)}(t)&&Y.call(t,"callee")&&(!it.call(t,"callee")||Q.call(t)==s)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var o in t)!Y.call(t,o)||i&&("length"==o||Dt(o,r))||n.push(o);return n}function Lt(t,e,n){var r=t[e];Y.call(t,e)&&zt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ot(t,e){for(var n=t.length;n--;)if(zt(t[n][0],e))return n;return-1}function Tt(t,e,n,r,d,b,T){var S;if(r&&(S=b?r(t,d,b,T):r(t)),void 0!==S)return S;if(!Kt(t))return t;var C=Ht(t);if(C){if(S=function(t){var e=t.length,n=t.constructor(e);e&&"string"==typeof t[0]&&Y.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!e)return function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(t,S)}else{var R=Bt(t),I=R==l||R==a;if($t(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(R==h||R==s||I&&!b){if(z(t))return b?t:{};if(S=function(t){return"function"!=typeof t.constructor||Ut(t)?{}:(e=rt(t),Kt(e)?st(e):{});var e}(I?{}:t),!e)return function(t,e){return Ct(t,Mt(t),e)}(t,function(t,e){return t&&Ct(e,Wt(e),t)}(S,t))}else{if(!j[R])return b?t:{};S=function(t,e,n,r){var s=t.constructor;switch(e){case y:return jt(t);case i:case o:return new s(+t);case v:return function(t,e){var n=e?jt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case x:case N:case E:case w:case A:case q:case k:case _:case L:return function(t,e){var n=e?jt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case c:return function(t,e,n){var r=e?n(H(t),!0):H(t);return P(r,D,new t.constructor)}(t,r,n);case u:case g:return new s(t);case f:return function(t){var e=new t.constructor(t.source,O.exec(t));return e.lastIndex=t.lastIndex,e}(t);case p:return function(t,e,n){var r=e?n($(t),!0):$(t);return P(r,U,new t.constructor)}(t,r,n);case m:return l=t,Et?Object(Et.call(l)):{}}var l}(t,R,Tt,e)}}T||(T=new kt);var M=T.get(t);if(M)return M;if(T.set(t,S),!C)var B=n?function(t){return function(t,e,n){var r=e(t);return Ht(t)?r:function(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}(r,n(t))}(t,Wt,Mt)}(t):Wt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n,t););}(B||t,function(s,i){B&&(s=t[i=s]),Lt(S,i,Tt(s,e,n,r,i,t,T))}),S}function St(t){return!(!Kt(t)||function(t){return!!G&&G in t}(t))&&(Vt(t)||z(t)?J:T).test(Pt(t))}function jt(t){var e=new t.constructor(t.byteLength);return new nt(e).set(new nt(t)),e}function Ct(t,e,n,r){n||(n={});for(var s=-1,i=e.length;++s<i;){var o=e[s];Lt(n,o,t[o])}return n}function Rt(t,e){var n,r,s=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof e?"string":"hash"]:s.map}function It(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return St(n)?n:void 0}wt.prototype.clear=function(){this.__data__=gt?gt(null):{}},wt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},wt.prototype.get=function(t){var e=this.__data__;if(gt){var r=e[t];return r===n?void 0:r}return Y.call(e,t)?e[t]:void 0},wt.prototype.has=function(t){var e=this.__data__;return gt?void 0!==e[t]:Y.call(e,t)},wt.prototype.set=function(t,e){return this.__data__[t]=gt&&void 0===e?n:e,this},At.prototype.clear=function(){this.__data__=[]},At.prototype.delete=function(t){var e=this.__data__,n=Ot(e,t);return!(n<0)&&(n==e.length-1?e.pop():ot.call(e,n,1),!0)},At.prototype.get=function(t){var e=this.__data__,n=Ot(e,t);return n<0?void 0:e[n][1]},At.prototype.has=function(t){return Ot(this.__data__,t)>-1},At.prototype.set=function(t,e){var n=this.__data__,r=Ot(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},qt.prototype.clear=function(){this.__data__={hash:new wt,map:new(ht||At),string:new wt}},qt.prototype.delete=function(t){return Rt(this,t).delete(t)},qt.prototype.get=function(t){return Rt(this,t).get(t)},qt.prototype.has=function(t){return Rt(this,t).has(t)},qt.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},kt.prototype.clear=function(){this.__data__=new At},kt.prototype.delete=function(t){return this.__data__.delete(t)},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof At){var r=n.__data__;if(!ht||r.length<199)return r.push([t,e]),this;n=this.__data__=new qt(r)}return n.set(t,e),this};var Mt=lt?F(lt,Object):function(){return[]},Bt=function(t){return Q.call(t)};function Dt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||S.test(t))&&t>-1&&t%1==0&&t<e}function Ut(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||W)}function Pt(t){if(null!=t){try{return X.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function zt(t,e){return t===e||t!=t&&e!=e}(ut&&Bt(new ut(new ArrayBuffer(1)))!=v||ht&&Bt(new ht)!=c||dt&&Bt(dt.resolve())!=d||ft&&Bt(new ft)!=p||pt&&Bt(new pt)!=b)&&(Bt=function(t){var e=Q.call(t),n=e==h?t.constructor:void 0,r=n?Pt(n):void 0;if(r)switch(r){case mt:return v;case bt:return c;case yt:return d;case vt:return p;case xt:return b}return e});var Ht=Array.isArray;function Ft(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Vt(t)}var $t=at||function(){return!1};function Vt(t){var e=Kt(t)?Q.call(t):"";return e==l||e==a}function Kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Wt(t){return Ft(t)?_t(t):function(t){if(!Ut(t))return ct(t);var e=[];for(var n in Object(t))Y.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Tt(t,!0,!0)}}(Bn,Bn.exports)),Bn.exports}var Un,Pn={exports:{}};function zn(){return Un||(Un=1,function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",h="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",g="[object Set]",m="[object String]",b="[object Symbol]",y="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",N=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,w={};w["[object Float32Array]"]=w["[object Float64Array]"]=w["[object Int8Array]"]=w["[object Int16Array]"]=w["[object Int32Array]"]=w["[object Uint8Array]"]=w["[object Uint8ClampedArray]"]=w["[object Uint16Array]"]=w["[object Uint32Array]"]=!0,w[s]=w[i]=w[v]=w[o]=w[x]=w[l]=w[a]=w[c]=w[u]=w[h]=w[d]=w[p]=w[g]=w[m]=w[y]=!1;var A="object"==typeof Tn&&Tn&&Tn.Object===Object&&Tn,q="object"==typeof self&&self&&self.Object===Object&&self,k=A||q||Function("return this")(),_=e&&!e.nodeType&&e,L=_&&t&&!t.nodeType&&t,O=L&&L.exports===_,T=O&&A.process,S=function(){try{return T&&T.binding&&T.binding("util")}catch(t){}}(),j=S&&S.isTypedArray;function C(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function R(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function I(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var M=Array.prototype,B=Object.prototype,D=k["__core-js_shared__"],U=Function.prototype.toString,P=B.hasOwnProperty,z=function(){var t=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),H=B.toString,F=RegExp("^"+U.call(P).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$=O?k.Buffer:void 0,V=k.Symbol,K=k.Uint8Array,W=B.propertyIsEnumerable,Z=M.splice,G=V?V.toStringTag:void 0,X=Object.getOwnPropertySymbols,Y=$?$.isBuffer:void 0,Q=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),J=_t(k,"DataView"),tt=_t(k,"Map"),et=_t(k,"Promise"),nt=_t(k,"Set"),rt=_t(k,"WeakMap"),st=_t(Object,"create"),it=St(J),ot=St(tt),lt=St(et),at=St(nt),ct=St(rt),ut=V?V.prototype:void 0,ht=ut?ut.valueOf:void 0;function dt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function ft(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function pt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function gt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new pt;++e<n;)this.add(t[e])}function mt(t){var e=this.__data__=new ft(t);this.size=e.size}function bt(t,e){var n=Rt(t),r=!n&&Ct(t),s=!n&&!r&&It(t),i=!n&&!r&&!s&&Pt(t),o=n||r||s||i,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!P.call(t,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Tt(c,a))||l.push(c);return l}function yt(t,e){for(var n=t.length;n--;)if(jt(t[n][0],e))return n;return-1}function vt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":G&&G in Object(t)?function(t){var e=P.call(t,G),n=t[G];try{t[G]=void 0;var r=!0}catch(i){}var s=H.call(t);r&&(e?t[G]=n:delete t[G]);return s}(t):function(t){return H.call(t)}(t)}function xt(t){return Ut(t)&&vt(t)==s}function Nt(t,e,n,r,c){return t===e||(null==t||null==e||!Ut(t)&&!Ut(e)?t!=t&&e!=e:function(t,e,n,r,c,f){var y=Rt(t),N=Rt(e),E=y?i:Ot(t),w=N?i:Ot(e),A=(E=E==s?d:E)==d,q=(w=w==s?d:w)==d,k=E==w;if(k&&It(t)){if(!It(e))return!1;y=!0,A=!1}if(k&&!A)return f||(f=new mt),y||Pt(t)?At(t,e,n,r,c,f):function(t,e,n,r,s,i,c){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case v:return!(t.byteLength!=e.byteLength||!i(new K(t),new K(e)));case o:case l:case h:return jt(+t,+e);case a:return t.name==e.name&&t.message==e.message;case p:case m:return t==e+"";case u:var d=R;case g:if(d||(d=I),t.size!=e.size&&!(1&r))return!1;var f=c.get(t);if(f)return f==e;r|=2,c.set(t,e);var y=At(d(t),d(e),r,s,i,c);return c.delete(t),y;case b:if(ht)return ht.call(t)==ht.call(e)}return!1}(t,e,E,n,r,c,f);if(!(1&n)){var _=A&&P.call(t,"__wrapped__"),L=q&&P.call(e,"__wrapped__");if(_||L){var O=_?t.value():t,T=L?e.value():e;return f||(f=new mt),c(O,T,n,r,f)}}if(!k)return!1;return f||(f=new mt),function(t,e,n,r,s,i){var o=1&n,l=qt(t),a=l.length,c=qt(e);if(a!=c.length&&!o)return!1;var u=a;for(;u--;){var h=l[u];if(!(o?h in e:P.call(e,h)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var f=!0;i.set(t,e),i.set(e,t);var p=o;for(;++u<a;){var g=t[h=l[u]],m=e[h];if(r)var b=o?r(m,g,h,e,t,i):r(g,m,h,t,e,i);if(!(void 0===b?g===m||s(g,m,n,r,i):b)){f=!1;break}p||(p="constructor"==h)}if(f&&!p){var y=t.constructor,v=e.constructor;y==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,n,r,c,f)}(t,e,n,r,Nt,c))}function Et(t){return!(!Dt(t)||function(t){return!!z&&z in t}(t))&&(Mt(t)?F:N).test(St(t))}function wt(t){if((e=t)!==("function"==typeof(n=e&&e.constructor)&&n.prototype||B))return Q(t);var e,n,r=[];for(var s in Object(t))P.call(t,s)&&"constructor"!=s&&r.push(s);return r}function At(t,e,n,r,s,i){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var u=-1,h=!0,d=2&n?new gt:void 0;for(i.set(t,e),i.set(e,t);++u<l;){var f=t[u],p=e[u];if(r)var g=o?r(p,f,u,e,t,i):r(f,p,u,t,e,i);if(void 0!==g){if(g)continue;h=!1;break}if(d){if(!C(e,function(t,e){if(!d.has(e)&&(f===t||s(f,t,n,r,i)))return d.push(e)})){h=!1;break}}else if(f!==p&&!s(f,p,n,r,i)){h=!1;break}}return i.delete(t),i.delete(e),h}function qt(t){return function(t,e,n){var r=e(t);return Rt(t)?r:function(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}(r,n(t))}(t,zt,Lt)}function kt(t,e){var n,r,s=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof e?"string":"hash"]:s.map}function _t(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Et(n)?n:void 0}dt.prototype.clear=function(){this.__data__=st?st(null):{},this.size=0},dt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},dt.prototype.get=function(t){var e=this.__data__;if(st){var r=e[t];return r===n?void 0:r}return P.call(e,t)?e[t]:void 0},dt.prototype.has=function(t){var e=this.__data__;return st?void 0!==e[t]:P.call(e,t)},dt.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=st&&void 0===e?n:e,this},ft.prototype.clear=function(){this.__data__=[],this.size=0},ft.prototype.delete=function(t){var e=this.__data__,n=yt(e,t);return!(n<0)&&(n==e.length-1?e.pop():Z.call(e,n,1),--this.size,!0)},ft.prototype.get=function(t){var e=this.__data__,n=yt(e,t);return n<0?void 0:e[n][1]},ft.prototype.has=function(t){return yt(this.__data__,t)>-1},ft.prototype.set=function(t,e){var n=this.__data__,r=yt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},pt.prototype.clear=function(){this.size=0,this.__data__={hash:new dt,map:new(tt||ft),string:new dt}},pt.prototype.delete=function(t){var e=kt(this,t).delete(t);return this.size-=e?1:0,e},pt.prototype.get=function(t){return kt(this,t).get(t)},pt.prototype.has=function(t){return kt(this,t).has(t)},pt.prototype.set=function(t,e){var n=kt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},gt.prototype.add=gt.prototype.push=function(t){return this.__data__.set(t,n),this},gt.prototype.has=function(t){return this.__data__.has(t)},mt.prototype.clear=function(){this.__data__=new ft,this.size=0},mt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},mt.prototype.get=function(t){return this.__data__.get(t)},mt.prototype.has=function(t){return this.__data__.has(t)},mt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof ft){var r=n.__data__;if(!tt||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new pt(r)}return n.set(t,e),this.size=n.size,this};var Lt=X?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}(X(t),function(e){return W.call(t,e)}))}:function(){return[]},Ot=vt;function Tt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||E.test(t))&&t>-1&&t%1==0&&t<e}function St(t){if(null!=t){try{return U.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function jt(t,e){return t===e||t!=t&&e!=e}(J&&Ot(new J(new ArrayBuffer(1)))!=x||tt&&Ot(new tt)!=u||et&&Ot(et.resolve())!=f||nt&&Ot(new nt)!=g||rt&&Ot(new rt)!=y)&&(Ot=function(t){var e=vt(t),n=e==d?t.constructor:void 0,r=n?St(n):"";if(r)switch(r){case it:return x;case ot:return u;case lt:return f;case at:return g;case ct:return y}return e});var Ct=xt(function(){return arguments}())?xt:function(t){return Ut(t)&&P.call(t,"callee")&&!W.call(t,"callee")},Rt=Array.isArray;var It=Y||function(){return!1};function Mt(t){if(!Dt(t))return!1;var e=vt(t);return e==c||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Bt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function Dt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ut(t){return null!=t&&"object"==typeof t}var Pt=j?function(t){return function(e){return t(e)}}(j):function(t){return Ut(t)&&Bt(t.length)&&!!w[vt(t)]};function zt(t){return null!=(e=t)&&Bt(e.length)&&!Mt(e)?bt(t):wt(t);var e}t.exports=function(t,e){return Nt(t,e)}}(Pn,Pn.exports)),Pn.exports}var Hn,Fn={};function $n(){if(Hn)return Fn;Hn=1,Object.defineProperty(Fn,"__esModule",{value:!0});const t=Dn(),e=zn();var n;return function(n){n.compose=function(e={},n={},r=!1){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});let s=t(n);r||(s=Object.keys(s).reduce((t,e)=>(null!=s[e]&&(t[e]=s[e]),t),{}));for(const t in e)void 0!==e[t]&&void 0===n[t]&&(s[t]=e[t]);return Object.keys(s).length>0?s:void 0},n.diff=function(t={},n={}){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});const r=Object.keys(t).concat(Object.keys(n)).reduce((r,s)=>(e(t[s],n[s])||(r[s]=void 0===n[s]?null:n[s]),r),{});return Object.keys(r).length>0?r:void 0},n.invert=function(t={},e={}){t=t||{};const n=Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0!==t[r]&&(n[r]=e[r]),n),{});return Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0===e[r]&&(n[r]=null),n),n)},n.transform=function(t,e,n=!1){if("object"!=typeof t)return e;if("object"!=typeof e)return;if(!n)return e;const r=Object.keys(e).reduce((n,r)=>(void 0===t[r]&&(n[r]=e[r]),n),{});return Object.keys(r).length>0?r:void 0}}(n||(n={})),Fn.default=n,Fn}var Vn,Kn={};function Wn(){return Vn||(Vn=1,Object.defineProperty(Kn,"__esModule",{value:!0}),function(t){t.length=function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"object"==typeof t.retain&&null!==t.retain?1:"string"==typeof t.insert?t.insert.length:1}}(t||(t={})),Kn.default=t),Kn;var t}var Zn,Gn,Xn={};function Yn(){if(Zn)return Xn;Zn=1,Object.defineProperty(Xn,"__esModule",{value:!0});const t=Wn();return Xn.default=class{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);const n=this.ops[this.index];if(n){const r=this.offset,s=t.default.length(n);if(e>=s-r?(e=s-r,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof n.delete)return{delete:e};{const t={};return n.attributes&&(t.attributes=n.attributes),"number"==typeof n.retain?t.retain=e:"object"==typeof n.retain&&null!==n.retain?t.retain=n.retain:t.insert="string"==typeof n.insert?n.insert.substr(r,e):n.insert,t}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?t.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?"number"==typeof t.delete?"delete":"number"==typeof t.retain||"object"==typeof t.retain&&null!==t.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const t=this.offset,e=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=t,this.index=e,[n].concat(r)}}return[]}},Xn}function Qn(){return Gn||(Gn=1,function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.Op=void 0;const n=In(),r=Dn(),s=zn(),i=$n();e.AttributeMap=i.default;const o=Wn();e.Op=o.default;const l=Yn();e.OpIterator=l.default;const a=String.fromCharCode(0),c=(t,e)=>{if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);const n=Object.keys(t)[0];if(!n||n!==Object.keys(e)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(e)[0]}`);return[n,t[n],e[n]]};class u{constructor(t){this.ops=Array.isArray(t)?t:null!=t&&Array.isArray(t.ops)?t.ops:[]}static registerEmbed(t,e){this.handlers[t]=e}static unregisterEmbed(t){delete this.handlers[t]}static getHandler(t){const e=this.handlers[t];if(!e)throw new Error(`no handlers for embed type "${t}"`);return e}insert(t,e){const n={};return"string"==typeof t&&0===t.length?this:(n.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))}delete(t){return t<=0?this:this.push({delete:t})}retain(t,e){if("number"==typeof t&&t<=0)return this;const n={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)}push(t){let e=this.ops.length,n=this.ops[e-1];if(t=r(t),"object"==typeof n){if("number"==typeof t.delete&&"number"==typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"==typeof n.delete&&null!=t.insert&&(e-=1,n=this.ops[e-1],"object"!=typeof n))return this.ops.unshift(t),this;if(s(t.attributes,n.attributes)){if("string"==typeof t.insert&&"string"==typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this}chop(){const t=this.ops[this.ops.length-1];return t&&"number"==typeof t.retain&&!t.attributes&&this.ops.pop(),this}filter(t){return this.ops.filter(t)}forEach(t){this.ops.forEach(t)}map(t){return this.ops.map(t)}partition(t){const e=[],n=[];return this.forEach(r=>{(t(r)?e:n).push(r)}),[e,n]}reduce(t,e){return this.ops.reduce(t,e)}changeLength(){return this.reduce((t,e)=>e.insert?t+o.default.length(e):e.delete?t-e.delete:t,0)}length(){return this.reduce((t,e)=>t+o.default.length(e),0)}slice(t=0,e=1/0){const n=[],r=new l.default(this.ops);let s=0;for(;s<e&&r.hasNext();){let i;s<t?i=r.next(t-s):(i=r.next(e-s),n.push(i)),s+=o.default.length(i)}return new u(n)}compose(t){const e=new l.default(this.ops),n=new l.default(t.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let t=o.retain;for(;"insert"===e.peekType()&&e.peekLength()<=t;)t-=e.peekLength(),r.push(e.next());o.retain-t>0&&n.next(o.retain-t)}const a=new u(r);for(;e.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===e.peekType())a.push(e.next());else{const t=Math.min(e.peekLength(),n.peekLength()),r=e.next(t),o=n.next(t);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?t:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const t=null==r.retain?"insert":"retain",[e,n,s]=c(r[t],o.retain),i=u.getHandler(e);l[t]={[e]:i.compose(n,s,"retain"===t)}}const h=i.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(h&&(l.attributes=h),a.push(l),!n.hasNext()&&s(a.ops[a.ops.length-1],l)){const t=new u(e.rest());return a.concat(t).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(t){const e=new u(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e}diff(t,e){if(this.ops===t.ops)return new u;const r=[this,t].map(e=>e.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],e,!0),h=new l.default(this.ops),d=new l.default(t.ops);return c.forEach(t=>{let e=t[1].length;for(;e>0;){let r=0;switch(t[0]){case n.INSERT:r=Math.min(d.peekLength(),e),o.push(d.next(r));break;case n.DELETE:r=Math.min(e,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),d.peekLength(),e);const t=h.next(r),l=d.next(r);s(t.insert,l.insert)?o.retain(r,i.default.diff(t.attributes,l.attributes)):o.push(l).delete(r)}e-=r}}),o.chop()}eachLine(t,e="\n"){const n=new l.default(this.ops);let r=new u,s=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const i=n.peek(),l=o.default.length(i)-n.peekLength(),a="string"==typeof i.insert?i.insert.indexOf(e,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===t(r,n.next(1).attributes||{},s))return;s+=1,r=new u}}r.length()>0&&t(r,{},s)}invert(t){const e=new u;return this.reduce((n,r)=>{if(r.insert)e.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return e.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const s=r.delete||r.retain;return t.slice(n,n+s).forEach(t=>{r.delete?e.push(t):r.retain&&r.attributes&&e.retain(o.default.length(t),i.default.invert(r.attributes,t.attributes))}),n+s}if("object"==typeof r.retain&&null!==r.retain){const s=t.slice(n,n+1),o=new l.default(s.ops).next(),[a,h,d]=c(r.retain,o.insert),f=u.getHandler(a);return e.retain({[a]:f.invert(h,d)},i.default.invert(r.attributes,o.attributes)),n+1}}return n},0),e.chop()}transform(t,e=!1){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);const n=t,r=new l.default(this.ops),s=new l.default(n.ops),a=new u;for(;r.hasNext()||s.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===s.peekType())if("insert"===s.peekType())a.push(s.next());else{const t=Math.min(r.peekLength(),s.peekLength()),n=r.next(t),o=s.next(t);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,s=o.retain;let l="object"==typeof s&&null!==s?s:t;if("object"==typeof r&&null!==r&&"object"==typeof s&&null!==s){const t=Object.keys(r)[0];if(t===Object.keys(s)[0]){const n=u.getHandler(t);n&&(l={[t]:n.transform(r[t],s[t],e)})}}a.retain(l,i.default.transform(n.attributes,o.attributes,e))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(t,e=!1){e=!!e;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=t;){const s=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r<t||!e)&&(t+=s),r+=s):t-=Math.min(s,t-r)}return t}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=i.default,u.handlers={},e.default=u,t.exports=u,t.exports.default=u}(Rn,Rn.exports)),Rn.exports}var Jn=Qn(),tr=Sn(Jn);class er extends wn{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}er.blotName="break",er.tagName="BR";let nr=class extends Ln{};function rr(t){return t.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[t]))}class sr extends yn{static allowedChildren=[sr,er,wn,nr];static order=["cursor","inline","link","underline","strike","italic","bold","script","code"];static compare(t,e){const n=sr.order.indexOf(t),r=sr.order.indexOf(e);return n>=0||r>=0?n-r:t===e?0:t<e?-1:1}formatAt(t,e,n,r){if(sr.compare(this.statics.blotName,n)<0&&this.scroll.query(n,Qe.BLOT)){const s=this.isolate(t,e);r&&s.wrap(n,r)}else super.formatAt(t,e,n,r)}optimize(t){if(super.optimize(t),this.parent instanceof sr&&sr.compare(this.statics.blotName,this.parent.statics.blotName)>0){const t=this.parent.isolate(this.offset(),this.length());this.moveChildren(t),t.wrap(this)}}}class ir extends xn{cache={};delta(){return null==this.cache.delta&&(this.cache.delta=lr(this)),this.cache.delta}deleteAt(t,e){super.deleteAt(t,e),this.cache={}}formatAt(t,e,n,r){e<=0||(this.scroll.query(n,Qe.BLOCK)?t+e===this.length()&&this.format(n,r):super.formatAt(t,Math.min(e,this.length()-t-1),n,r),this.cache={})}insertAt(t,e,n){if(null!=n)return super.insertAt(t,e,n),void(this.cache={});if(0===e.length)return;const r=e.split("\n"),s=r.shift();s.length>0&&(t<this.length()-1||null==this.children.tail?super.insertAt(Math.min(t,this.length()-1),s):this.children.tail.insertAt(this.children.tail.length(),s),this.cache={});let i=this;r.reduce((t,e)=>(i=i.split(t,!0),i.insertAt(0,e),e.length),t+s.length)}insertBefore(t,e){const{head:n}=this.children;super.insertBefore(t,e),n instanceof er&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(t,e){super.moveChildren(t,e),this.cache={}}optimize(t){super.optimize(t),this.cache={}}path(t){return super.path(t,!0)}removeChild(t){super.removeChild(t),this.cache={}}split(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&(0===t||t>=this.length()-1)){const e=this.clone();return 0===t?(this.parent.insertBefore(e,this),this):(this.parent.insertBefore(e,this.next),e)}const n=super.split(t,e);return this.cache={},n}}ir.blotName="block",ir.tagName="P",ir.defaultChild=er,ir.allowedChildren=[er,sr,wn,nr];class or extends wn{attach(){super.attach(),this.attributes=new an(this.domNode)}delta(){return(new tr).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const n=this.scroll.query(t,Qe.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,e)}formatAt(t,e,n,r){this.format(n,r)}insertAt(t,e,n){if(null!=n)return void super.insertAt(t,e,n);const r=e.split("\n"),s=r.pop(),i=r.map(t=>{const e=this.scroll.create(ir.blotName);return e.insertAt(0,t),e}),o=this.split(t);i.forEach(t=>{this.parent.insertBefore(t,o)}),s&&this.parent.insertBefore(this.scroll.create("text",s),o)}}function lr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.descendants(dn).reduce((t,n)=>0===n.length()?t:t.insert(n.value(),ar(n,{},e)),new tr).insert("\n",ar(t))}function ar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==t?e:("formats"in t&&"function"==typeof t.formats&&(e={...e,...t.formats()},n&&delete e["code-token"]),null==t.parent||"scroll"===t.parent.statics.blotName||t.parent.statics.scope!==t.statics.scope?e:ar(t.parent,e,n))}or.scope=Qe.BLOCK_BLOT;class cr extends wn{static blotName="cursor";static className="ql-cursor";static tagName="span";static CONTENTS="\ufeff";static value(){}constructor(t,e,n){super(t,e),this.selection=n,this.textNode=document.createTextNode(cr.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,e){if(0!==this.savedLength)return void super.format(t,e);let n=this,r=0;for(;null!=n&&n.statics.scope!==Qe.BLOCK_BLOT;)r+=n.offset(n.parent),n=n.parent;null!=n&&(this.savedLength=cr.CONTENTS.length,n.optimize(),n.formatAt(r,cr.CONTENTS.length,t,e),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const e=this.prev instanceof nr?this.prev:null,n=e?e.length():0,r=this.next instanceof nr?this.next:null,s=r?r.text:"",{textNode:i}=this,o=i.data.split(cr.CONTENTS).join("");let l;if(i.data=cr.CONTENTS,e)l=e,(o||r)&&(e.insertAt(e.length(),o+s),r&&r.remove());else if(r)l=r,r.insertAt(0,o);else{const t=document.createTextNode(o);l=this.scroll.create(t),this.parent.insertBefore(l,this)}if(this.remove(),t){const s=(t,s)=>e&&t===e.domNode?s:t===i?n+s-1:r&&t===r.domNode?n+o.length+s:null,a=s(t.start.node,t.start.offset),c=s(t.end.node,t.end.offset);if(null!==a&&null!==c)return{startNode:l.domNode,startOffset:a,endNode:l.domNode,endOffset:c}}return null}update(t,e){if(t.some(t=>"characterData"===t.type&&t.target===this.textNode)){const t=this.restore();t&&(e.range=t)}}optimize(t){super.optimize(t);let{parent:e}=this;for(;e;){if("A"===e.domNode.tagName){this.savedLength=cr.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}}var ur,hr={exports:{}};function dr(){return ur||(ur=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function s(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new s(r,i||t,o),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],l]:t._events[a].push(l):(t._events[a]=l,t._eventsCount++),t}function o(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var t,r,s=[];if(0===this._eventsCount)return s;for(r in t=this._events)e.call(t,r)&&s.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},l.prototype.listeners=function(t){var e=this._events[n?n+t:t];if(!e)return[];if(e.fn)return[e.fn];for(var r=0,s=e.length,i=new Array(s);r<s;r++)i[r]=e[r].fn;return i},l.prototype.listenerCount=function(t){var e=this._events[n?n+t:t];return e?e.fn?1:e.length:0},l.prototype.emit=function(t,e,r,s,i,o){var l=n?n+t:t;if(!this._events[l])return!1;var a,c,u=this._events[l],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,s),!0;case 5:return u.fn.call(u.context,e,r,s,i),!0;case 6:return u.fn.call(u.context,e,r,s,i,o),!0}for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,r);break;case 4:u[c].fn.call(u[c].context,e,r,s);break;default:if(!a)for(d=1,a=new Array(h-1);d<h;d++)a[d-1]=arguments[d];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},l.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},l.prototype.removeListener=function(t,e,r,s){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return o(this,i),this;var l=this._events[i];if(l.fn)l.fn!==e||s&&!l.once||r&&l.context!==r||o(this,i);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==e||s&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[i]=1===c.length?c[0]:c:o(this,i)}return this},l.prototype.removeAllListeners=function(t){var e;return t?this._events[e=n?n+t:t]&&o(this,e):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(hr)),hr.exports}var fr=Sn(dr()),pr=new WeakMap;const gr=["error","warn","log","info"];let mr="warn";function br(t){if(mr&&gr.indexOf(t)<=gr.indexOf(mr)){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console[t](...n)}}function yr(t){return gr.reduce((e,n)=>(e[n]=br.bind(console,n,t),e),{})}br.level=yr.level=t=>{mr=t};const vr=yr("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(t=>{document.addEventListener(t,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(t=>{const n=pr.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});class xr extends fr{static events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"};static sources={API:"api",SILENT:"silent",USER:"user"};constructor(){super(),this.domListeners={},this.on("error",vr.error)}emit(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return vr.log.call(vr,...e),super.emit(...e)}handleDOM(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];(this.domListeners[t.type]||[]).forEach(e=>{let{node:r,handler:s}=e;(t.target===r||r.contains(t.target))&&s(t,...n)})}listenDOM(t,e,n){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:n})}}const Nr=yr("quill:selection");class Er{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=t,this.length=e}}class wr{constructor(t,e){this.emitter=e,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new Er(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{this.mouseDown||this.composing||setTimeout(this.update.bind(this,xr.sources.USER),1)}),this.emitter.on(xr.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const t=this.getNativeRange();null!=t&&t.start.node!==this.cursor.textNode&&this.emitter.once(xr.events.SCROLL_UPDATE,(e,n)=>{try{this.root.contains(t.start.node)&&this.root.contains(t.end.node)&&this.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset);const r=n.some(t=>"characterData"===t.type||"childList"===t.type||"attributes"===t.type&&t.target===this.root);this.update(r?xr.sources.SILENT:e)}catch(r){}})}),this.emitter.on(xr.events.SCROLL_OPTIMIZE,(t,e)=>{if(e.range){const{startNode:t,startOffset:n,endNode:r,endOffset:s}=e.range;this.setNativeRange(t,n,r,s),this.update(xr.sources.SILENT)}}),this.update(xr.sources.SILENT)}handleComposition(){this.emitter.on(xr.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(xr.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const t=this.cursor.restore();if(!t)return;setTimeout(()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(xr.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(t,Qe.BLOCK)){if(n.start.node!==this.cursor.textNode){const t=this.scroll.find(n.start.node,!1);if(null==t)return;if(t instanceof dn){const e=t.split(n.start.offset);t.parent.insertBefore(this.cursor,e)}else t.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;let[s,i]=this.scroll.leaf(t);if(null==s)return null;if(e>0&&i===s.length()){const[e]=this.scroll.leaf(t+1);if(e){const[n]=this.scroll.line(t),[r]=this.scroll.line(t+1);n===r&&(s=e,i=0)}}[r,i]=s.position(i,!0);const o=document.createRange();if(e>0)return o.setStart(r,i),[s,i]=this.scroll.leaf(t+e),null==s?null:([r,i]=s.position(i,!0),o.setEnd(r,i),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;i<r.data.length?(o.setStart(r,i),o.setEnd(r,i+1)):(o.setStart(r,i-1),o.setEnd(r,i),a="right"),l=o.getBoundingClientRect()}else{if(!(s.domNode instanceof Element))return null;l=s.domNode.getBoundingClientRect(),i>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const t=document.getSelection();if(null==t||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(null==e)return null;const n=this.normalizeNative(e);return Nr.info("getNativeRange",n),n}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();if(null==e)return[null,null];return[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&Ar(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const n=e.map(t=>{const[e,n]=t,r=this.scroll.find(e,!0),s=r.offset(this.scroll);return 0===n?s:r instanceof dn?s+r.index(e,n):s+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),s=Math.min(r,...n);return new Er(s,r-s)}normalizeNative(t){if(!Ar(this.root,t.startContainer)||!t.collapsed&&!Ar(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(t=>{let{node:e,offset:n}=t;for(;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length>0?e.childNodes.length:e.childNodes.length+1}t.node=e,t.offset=n}),e}rangeToNative(t){const e=this.scroll.length(),n=(t,n)=>{t=Math.min(e-1,t);const[r,s]=this.scroll.leaf(t);return r?r.position(s,n):[null,-1]};return[...n(t.index,!1),...n(t.index+t.length,!0)]}setNativeRange(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Nr.info("setNativeRange",t,e,n,r),null!=t&&(null==this.root.parentNode||null==t.parentNode||null==n.parentNode))return;const i=document.getSelection();if(null!=i)if(null!=t){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||s||t!==o.startContainer||e!==o.startOffset||n!==o.endContainer||r!==o.endOffset){t instanceof Element&&"BR"===t.tagName&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const s=document.createRange();s.setStart(t,e),s.setEnd(n,r),i.removeAllRanges(),i.addRange(s)}}else i.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:xr.sources.API;if("string"==typeof e&&(n=e,e=!1),Nr.info("setRange",t),null!=t){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(n)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xr.sources.USER;const e=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Ge(e,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const t=this.cursor.restore();t&&this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}const n=[xr.events.SELECTION_CHANGE,Le(this.lastRange),Le(e),t];this.emitter.emit(xr.events.EDITOR_CHANGE,...n),t!==xr.sources.SILENT&&this.emitter.emit(...n)}}}function Ar(t,e){return t.contains(e)}const qr=/^[ -~]*$/;class kr{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const n=Sr(t),r=new tr;return function(t){const e=[];return t.forEach(t=>{if("string"==typeof t.insert){t.insert.split("\n").forEach((n,r)=>{r&&e.push({insert:"\n",attributes:t.attributes}),n&&e.push({insert:n,attributes:t.attributes})})}else e.push(t)}),e}(n.ops.slice()).reduce((t,n)=>{const s=Jn.Op.length(n);let i=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(s),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(e<=t||!!this.scroll.descendant(or,t)[0]),this.scroll.insertAt(t,r);const[s,o]=this.scroll.line(t);let a=Ye({},ar(s));if(s instanceof ir){const[t]=s.descendant(dn,o);t&&(a=Ye(a,ar(t)))}i=Jn.AttributeMap.diff(a,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;const s=null!=this.scroll.query(r,Qe.INLINE);if(s)(e<=t||this.scroll.descendant(or,t)[0])&&(l=!0);else if(t>0){const[e,n]=this.scroll.descendant(dn,t-1);if(e instanceof nr){"\n"!==e.value()[n]&&(o=!0)}else e instanceof wn&&e.statics.scope===Qe.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(t,r,n.insert[r]),s){const[e]=this.scroll.descendant(dn,t);if(e){const t=Ye({},ar(e));i=Jn.AttributeMap.diff(t,i)||{}}}}e+=s}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const e=Object.keys(n.retain)[0];if(null==e)return t;this.scroll.updateEmbedAt(t,e,n.retain[e])}Object.keys(i).forEach(e=>{this.scroll.formatAt(t,s,e,i[e])});const a=o?1:0,c=l?1:0;return e+=a+c,r.retain(a),r.delete(c),t+s+a+c},0),r.reduce((t,e)=>"number"==typeof e.delete?(this.scroll.deleteAt(t,e.delete),t):t+Jn.Op.length(e),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update((new tr).retain(t).delete(e))}formatLine(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(t,Math.max(e,1)).forEach(t=>{t.format(r,n[r])})}),this.scroll.optimize();const r=(new tr).retain(t).retain(e,Le(n));return this.update(r)}formatText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e,r,n[r])});const r=(new tr).retain(t).retain(e,Le(n));return this.update(r)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new tr)}getFormat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach(t=>{const[e]=t;e instanceof ir?n.push(e):e instanceof dn&&r.push(e)}):(n=this.scroll.lines(t,e),r=this.scroll.descendants(dn,t,e));const[s,i]=[n,r].map(t=>{const e=t.shift();if(null==e)return{};let n=ar(e);for(;Object.keys(n).length>0;){const e=t.shift();if(null==e)return n;n=Or(ar(e),n)}return n});return{...s,...i}}getHTML(t,e){const[n,r]=this.scroll.line(t);if(n){const s=n.length();return!(n.length()>=r+e)||0===r&&e===s?Lr(this.scroll,t,e,!0):Lr(n,r,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(t=>"string"==typeof t.insert).map(t=>t.insert).join("")}insertContents(t,e){const n=Sr(e),r=(new tr).retain(t).concat(n);return this.scroll.insertContents(t,n),this.update(r)}insertEmbed(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new tr).retain(t).insert({[e]:n}))}insertText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e.length,r,n[r])}),this.update((new tr).retain(t).insert(e,Le(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if(t?.statics.blotName!==ir.blotName)return!1;return!(t.children.length>1)&&t.children.head instanceof er}removeFormat(t,e){const n=this.getText(t,e),[r,s]=this.scroll.line(t+e);let i=0,o=new tr;null!=r&&(i=r.length()-s,o=r.delta().slice(s,s+i-1).insert("\n"));const l=this.getContents(t,e+i).diff((new tr).insert(n).concat(o)),a=(new tr).retain(t).concat(l);return this.applyDelta(a)}update(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(qr)&&this.scroll.find(e[0].target)){const s=this.scroll.find(e[0].target),i=ar(s),o=s.offset(this.scroll),l=e[0].oldValue.replace(cr.CONTENTS,""),a=(new tr).insert(l),c=(new tr).insert(s.value()),u=n&&{oldRange:jr(n.oldRange,-o),newRange:jr(n.newRange,-o)};t=(new tr).retain(o).concat(a.diff(c,u)).reduce((t,e)=>e.insert?t.insert(e.insert,i):t.push(e),new tr),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&Ge(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}function _r(t,e,n){if(0===t.length){const[t]=Tr(n.pop());return e<=0?`</li></${t}>`:`</li></${t}>${_r([],e-1,n)}`}const[{child:r,offset:s,length:i,indent:o,type:l},...a]=t,[c,u]=Tr(l);if(o>e)return n.push(l),o===e+1?`<${c}><li${u}>${Lr(r,s,i)}${_r(a,o,n)}`:`<${c}><li>${_r(t,e+1,n)}`;if(o===e&&l===n[n.length-1])return`</li><li${u}>${Lr(r,s,i)}${_r(a,o,n)}`;const[h]=Tr(n.pop());return`</li></${h}>${_r(t,e-1,n)}`}function Lr(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in t&&"function"==typeof t.html)return t.html(e,n);if(t instanceof nr)return rr(t.value().slice(e,e+n));if(t instanceof mn){if("list-container"===t.statics.blotName){const r=[];return t.children.forEachAt(e,n,(t,e,n)=>{const s="formats"in t&&"function"==typeof t.formats?t.formats():{};r.push({child:t,offset:e,length:n,indent:s.indent||0,type:s.list})}),_r(r,-1,[])}const s=[];if(t.children.forEachAt(e,n,(t,e,n)=>{s.push(Lr(t,e,n))}),r||"list"===t.statics.blotName)return s.join("");const{outerHTML:i,innerHTML:o}=t.domNode,[l,a]=i.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${s.join("")}<${a}`:`${l}>${s.join("")}<${a}`}return t.domNode instanceof Element?t.domNode.outerHTML:""}function Or(t,e){return Object.keys(e).reduce((n,r)=>{if(null==t[r])return n;const s=e[r];return n[r]=s===t[r]?s:Array.isArray(s)?s.indexOf(t[r])<0?s.concat([t[r]]):s:[s,t[r]],n},{})}function Tr(t){const e="ordered"===t?"ol":"ul";switch(t){case"checked":return[e,' data-list="checked"'];case"unchecked":return[e,' data-list="unchecked"'];default:return[e,""]}}function Sr(t){return t.reduce((t,e)=>{if("string"==typeof e.insert){const n=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(n,e.attributes)}return t.push(e)},new tr)}function jr(t,e){let{index:n,length:r}=t;return new Er(n+e,r)}class Cr{static DEFAULTS={};constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=t,this.options=e}}const Rr="\ufeff";class Ir extends wn{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(t=>{this.contentNode.appendChild(t)}),this.leftGuard=document.createTextNode(Rr),this.rightGuard=document.createTextNode(Rr),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e,n=null;const r=t.data.split(Rr).join("");if(t===this.leftGuard)if(this.prev instanceof nr){const t=this.prev.length();this.prev.insertAt(t,r),n={startNode:this.prev.domNode,startOffset:t+r.length}}else e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this),n={startNode:e,startOffset:r.length};else t===this.rightGuard&&(this.next instanceof nr?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this.next),n={startNode:e,startOffset:r.length}));return t.data=Rr,n}update(t,e){t.forEach(t=>{if("characterData"===t.type&&(t.target===this.leftGuard||t.target===this.rightGuard)){const n=this.restore(t.target);n&&(e.range=n)}})}}class Mr{isComposing=!1;constructor(t,e){this.scroll=t,this.emitter=e,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",t=>{this.isComposing||this.handleCompositionStart(t)}),this.scroll.domNode.addEventListener("compositionend",t=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(t)})})}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;!e||e instanceof Ir||(this.emitter.emit(xr.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(xr.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(xr.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(xr.events.COMPOSITION_END,t),this.isComposing=!1}}class Br{static DEFAULTS={modules:{}};static themes={default:Br};modules={};constructor(t,e){this.quill=t,this.options=e}init(){Object.keys(this.options.modules).forEach(t=>{null==this.modules[t]&&this.addModule(t)})}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}}const Dr=t=>t.parentElement||t.getRootNode().host||null,Ur=t=>{const e=t.getBoundingClientRect(),n="offsetWidth"in t&&Math.abs(e.width)/t.offsetWidth||1,r="offsetHeight"in t&&Math.abs(e.height)/t.offsetHeight||1;return{top:e.top,right:e.left+t.clientWidth*n,bottom:e.top+t.clientHeight*r,left:e.left}},Pr=t=>{const e=parseInt(t,10);return Number.isNaN(e)?0:e},zr=(t,e,n,r,s,i)=>t<n&&e>r?0:t<n?-(n-t+s):e>r?e-t>r-n?t+s-n:e-r+i:0,Hr=["block","break","cursor","inline","scroll","text"],Fr=yr("quill"),$r=new nn;mn.uiClass="ql-ui";class Vr{static DEFAULTS={bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:$r,theme:"default"};static events=xr.events;static sources=xr.sources;static version="2.0.2";static imports={delta:tr,parchment:On,"core/module":Cr,"core/theme":Br};static debug(t){!0===t&&(t="log"),yr.level(t)}static find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return pr.get(t)||$r.find(t,e)}static import(t){return null==this.imports[t]&&Fr.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const t=arguments.length<=0?void 0:arguments[0],e=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in t?t.attrName:t.blotName;"string"==typeof n?this.register(`formats/${n}`,t,e):Object.keys(t).forEach(n=>{this.register(n,t[n],e)})}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1];null==this.imports[t]||!!(arguments.length<=2?void 0:arguments[2])||Fr.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&"boolean"!=typeof e&&"abstract"!==e.blotName&&$r.register(e),"function"==typeof e.register&&e.register($r)}}constructor(t){if(this.options=function(t,e){const n=Kr(t);if(!n)throw new Error("Invalid Quill container");const r=!e.theme||e.theme===Vr.DEFAULTS.theme,s=r?Br:Vr.import(`themes/${e.theme}`);if(!s)throw new Error(`Invalid theme ${e.theme}. Did you register it?`);const{modules:i,...o}=Vr.DEFAULTS,{modules:l,...a}=s.DEFAULTS;let c=Wr(e.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Ye({},Wr(i),Wr(l),c),h={...o,...Zr(a),...Zr(e)};let d=e.registry;d?e.formats&&Fr.warn('Ignoring "formats" option because "registry" is specified'):d=e.formats?((t,e,n)=>{const r=new nn;return Hr.forEach(t=>{const n=e.query(t);n&&r.register(n)}),t.forEach(t=>{let s=e.query(t);s||n.error(`Cannot register "${t}" specified in "formats" config. Are you sure it was registered?`);let i=0;for(;s;)if(r.register(s),s="blotName"in s?s.requiredContainer??null:null,i+=1,i>100){n.error(`Cycle detected in registering blot requiredContainer: "${t}"`);break}}),r})(e.formats,h.registry,Fr):h.registry;return{...h,registry:d,container:n,theme:s,modules:Object.entries(u).reduce((t,e)=>{let[n,r]=e;if(!r)return t;const s=Vr.import(`modules/${n}`);return null==s?(Fr.error(`Cannot load ${n} module. Are you sure you registered it?`),t):{...t,[n]:Ye({},s.DEFAULTS||{},r)}},{}),bounds:Kr(h.bounds)}}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.container=this.options.container,null==this.container)return void Fr.error("Invalid Quill container",t);this.options.debug&&Vr.debug(this.options.debug);const e=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",pr.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new xr;const n=kn.blotName,r=this.options.registry.query(n);if(!r||!("blotName"in r))throw new Error(`Cannot initialize Quill without "${n}" blot`);if(this.scroll=new r(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new kr(this.scroll),this.selection=new wr(this.scroll,this.emitter),this.composition=new Mr(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(xr.events.EDITOR_CHANGE,t=>{t===xr.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(xr.events.SCROLL_UPDATE,(t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),s=n&&r?{oldRange:n,newRange:r}:void 0;Gr.call(this,()=>this.editor.update(null,e,s),t)}),this.emitter.on(xr.events.SCROLL_EMBED_UPDATE,(t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),s=n&&r?{oldRange:n,newRange:r}:void 0;Gr.call(this,()=>{const n=(new tr).retain(t.offset(this)).retain({[t.statics.blotName]:e});return this.editor.update(n,[],s)},Vr.sources.USER)}),e){const t=this.clipboard.convert({html:`${e}<p><br></p>`,text:"\n"});this.setContents(t)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){const e=t;(t=document.createElement("div")).classList.add(e)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,n){return[t,e,,n]=Xr(t,e,n),Gr.call(this,()=>this.editor.deleteText(t,e),n,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){return Gr.call(this,()=>{const n=this.getSelection(!0);let r=new tr;if(null==n)return r;if(this.scroll.query(t,Qe.BLOCK))r=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(0===n.length)return this.selection.format(t,e),r;r=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,xr.sources.SILENT),r},arguments.length>2&&void 0!==arguments[2]?arguments[2]:xr.sources.API)}formatLine(t,e,n,r,s){let i;return[t,e,i,s]=Xr(t,e,n,r,s),Gr.call(this,()=>this.editor.formatLine(t,e,i),s,t,0)}formatText(t,e,n,r,s){let i;return[t,e,i,s]=Xr(t,e,n,r,s),Gr.call(this,()=>this.editor.formatText(t,e,i),s,t,0)}getBounds(t){let e=null;if(e="number"==typeof t?this.selection.getBounds(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0):this.selection.getBounds(t.index,t.length),!e)return null;const n=this.container.getBoundingClientRect();return{bottom:e.bottom-n.top,height:e.height,left:e.left-n.left,right:e.right-n.left,top:e.top-n.top,width:e.width}}getContents(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t;return[t,e]=Xr(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0);return"number"==typeof t?this.editor.getFormat(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0):this.editor.getFormat(t.index,t.length)}getIndex(t){return t.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(t){return this.scroll.leaf(t)}getLine(t){return this.scroll.line(t)}getLines(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}getModule(t){return this.theme.modules[t]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=Xr(t,e),this.editor.getHTML(t,e)}getText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=Xr(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,n){return Gr.call(this,()=>this.editor.insertEmbed(t,e,n),arguments.length>3&&void 0!==arguments[3]?arguments[3]:Vr.sources.API,t)}insertText(t,e,n,r,s){let i;return[t,,i,s]=Xr(t,0,n,r,s),Gr.call(this,()=>this.editor.insertText(t,e,i),s,t,e.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(t,e,n){return[t,e,,n]=Xr(t,e,n),Gr.call(this,()=>this.editor.removeFormat(t,e),n,t)}scrollRectIntoView(t){((t,e)=>{const n=t.ownerDocument;let r=e,s=t;for(;s;){const t=s===n.body,e=t?{top:0,right:window.visualViewport?.width??n.documentElement.clientWidth,bottom:window.visualViewport?.height??n.documentElement.clientHeight,left:0}:Ur(s),i=getComputedStyle(s),o=zr(r.left,r.right,e.left,e.right,Pr(i.scrollPaddingLeft),Pr(i.scrollPaddingRight)),l=zr(r.top,r.bottom,e.top,e.bottom,Pr(i.scrollPaddingTop),Pr(i.scrollPaddingBottom));if(o||l)if(t)n.defaultView?.scrollBy(o,l);else{const{scrollLeft:t,scrollTop:e}=s;l&&(s.scrollTop+=l),o&&(s.scrollLeft+=o);const n=s.scrollLeft-t,i=s.scrollTop-e;r={left:r.left-n,top:r.top-i,right:r.right-n,bottom:r.bottom-i}}s=t||"fixed"===i.position?null:Dr(s)}})(this.root,t)}scrollIntoView(){console.warn("Quill#scrollIntoView() has been deprecated and will be removed in the near future. Please use Quill#scrollSelectionIntoView() instead."),this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){return Gr.call(this,()=>{t=new tr(t);const e=this.getLength(),n=this.editor.deleteText(0,e),r=this.editor.insertContents(0,t),s=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(s)},arguments.length>1&&void 0!==arguments[1]?arguments[1]:xr.sources.API)}setSelection(t,e,n){null==t?this.selection.setRange(null,e||Vr.sources.API):([t,e,,n]=Xr(t,e,n),this.selection.setRange(new Er(Math.max(0,t),e),n),n!==xr.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xr.sources.API;const n=(new tr).insert(t);return this.setContents(n,e)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xr.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){return Gr.call(this,()=>(t=new tr(t),this.editor.applyDelta(t)),arguments.length>1&&void 0!==arguments[1]?arguments[1]:xr.sources.API,!0)}}function Kr(t){return"string"==typeof t?document.querySelector(t):t}function Wr(t){return Object.entries(t??{}).reduce((t,e)=>{let[n,r]=e;return{...t,[n]:!0===r?{}:r}},{})}function Zr(t){return Object.fromEntries(Object.entries(t).filter(t=>void 0!==t[1]))}function Gr(t,e,n,r){if(!this.isEnabled()&&e===xr.sources.USER&&!this.allowReadOnlyEdits)return new tr;let s=null==n?null:this.getSelection();const i=this.editor.delta,o=t();if(null!=s&&(!0===n&&(n=s.index),null==r?s=Yr(s,o,e):0!==r&&(s=Yr(s,n,r,e)),this.setSelection(s,xr.sources.SILENT)),o.length()>0){const t=[xr.events.TEXT_CHANGE,o,i,e];this.emitter.emit(xr.events.EDITOR_CHANGE,...t),e!==xr.sources.SILENT&&this.emitter.emit(...t)}return o}function Xr(t,e,n,r,s){let i={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(s=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(s=r,r=n,n=e,e=0),"object"==typeof n?(i=n,s=r):"string"==typeof n&&(null!=r?i[n]=r:s=n),[t,e,i,s=s||xr.sources.API]}function Yr(t,e,n,r){const s="number"==typeof n?n:0;if(null==t)return null;let i,o;return[i,o]=[t.index,t.index+t.length].map(e&&"function"==typeof e.transformPosition?t=>e.transformPosition(t,r!==xr.sources.USER):t=>t<e||t===e&&r===xr.sources.USER?t:s>=0?t+s:Math.max(e,t+s)),new Er(i,o-i)}class Qr extends En{}function Jr(t){return t instanceof ir||t instanceof or}function ts(t){return"function"==typeof t.updateContent}function es(t,e,n){n.reduce((e,n)=>{const r=Jn.Op.length(n);let s=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){t.insertAt(e,n.insert);const[r]=t.descendant(dn,e),i=ar(r);s=Jn.AttributeMap.diff(i,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;t.insertAt(e,r,n.insert[r]);if(null!=t.scroll.query(r,Qe.INLINE)){const[n]=t.descendant(dn,e),r=ar(n);s=Jn.AttributeMap.diff(r,s)||{}}}return Object.keys(s).forEach(n=>{t.formatAt(e,r,n,s[n])}),e+r},e)}const ns={scope:Qe.BLOCK,whitelist:["right","center","justify"]},rs=new Je("align","align",ns),ss=new sn("align","ql-align",ns),is=new ln("align","text-align",ns);class os extends ln{value(t){let e=super.value(t);if(!e.startsWith("rgb("))return e;e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${e.split(",").map(t=>`00${parseInt(t,10).toString(16)}`.slice(-2)).join("")}`}}const ls=new sn("color","ql-color",{scope:Qe.INLINE}),as=new os("color","color",{scope:Qe.INLINE}),cs=new sn("background","ql-bg",{scope:Qe.INLINE}),us=new os("background","background-color",{scope:Qe.INLINE});class hs extends Qr{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(t=>t.length()<=1?"":t.domNode.innerText).join("\n").slice(t,t+e)}html(t,e){return`<pre>\n${rr(this.code(t,e))}\n</pre>`}}class ds extends ir{static TAB=" ";static register(){Vr.register(hs)}}class fs extends sr{}fs.blotName="code",fs.tagName="CODE",ds.blotName="code-block",ds.className="ql-code-block",ds.tagName="DIV",hs.blotName="code-block-container",hs.className="ql-code-block-container",hs.tagName="DIV",hs.allowedChildren=[ds],ds.allowedChildren=[nr,er,cr],ds.requiredContainer=hs;const ps={scope:Qe.BLOCK,whitelist:["rtl"]},gs=new Je("direction","dir",ps),ms=new sn("direction","ql-direction",ps),bs=new ln("direction","direction",ps),ys={scope:Qe.INLINE,whitelist:["serif","monospace"]},vs=new sn("font","ql-font",ys);const xs=new class extends ln{value(t){return super.value(t).replace(/["']/g,"")}}("font","font-family",ys),Ns=new sn("size","ql-size",{scope:Qe.INLINE,whitelist:["small","large","huge"]}),Es=new ln("size","font-size",{scope:Qe.INLINE,whitelist:["10px","18px","32px"]}),ws=yr("quill:keyboard"),As=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class qs extends Cr{static match(t,e){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!e[n]!==t[n]&&null!==e[n])&&(e.key===t.key||e.key===t.which)}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(t=>{this.options.bindings[t]&&this.addBinding(this.options.bindings[t])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(t){if("string"==typeof t||"number"==typeof t)t={key:t};else{if("object"!=typeof t)return null;t=Le(t)}t.shortKey&&(t[As]=t.shortKey,delete t.shortKey);return t}(t);if(null==r)return void ws.warn("Attempted to add invalid keyboard binding",r);"function"==typeof e&&(e={handler:e}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(t=>{const s={...r,key:t,...e,...n};this.bindings[s.key]=this.bindings[s.key]||[],this.bindings[s.key].push(s)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing)return;if(229===t.keyCode&&("Enter"===t.key||"Backspace"===t.key))return;const e=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(e=>qs.match(t,e));if(0===e.length)return;const n=Vr.find(t.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[s,i]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof Ln?o.value().slice(0,l):"",h=a instanceof Ln?a.value().slice(c):"",d={collapsed:0===r.length,empty:0===r.length&&s.length()<=1,format:this.quill.getFormat(r),line:s,offset:i,prefix:u,suffix:h,event:t};e.some(t=>{if(null!=t.collapsed&&t.collapsed!==d.collapsed)return!1;if(null!=t.empty&&t.empty!==d.empty)return!1;if(null!=t.offset&&t.offset!==d.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(t=>null==d.format[t]))return!1}else if("object"==typeof t.format&&!Object.keys(t.format).every(e=>!0===t.format[e]?null!=d.format[e]:!1===t.format[e]?null==d.format[e]:Ge(t.format[e],d.format[e])))return!1;return!(null!=t.prefix&&!t.prefix.test(d.prefix))&&(!(null!=t.suffix&&!t.suffix.test(d.suffix))&&!0!==t.handler.call(this,r,d,t))})&&t.preventDefault()})}handleBackspace(t,e){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(0===t.index||this.quill.getLength()<=1)return;let r={};const[s]=this.quill.getLine(t.index);let i=(new tr).retain(t.index-n).delete(n);if(0===e.offset){const[e]=this.quill.getLine(t.index-1);if(e){if(!("block"===e.statics.blotName&&e.length()<=1)){const e=s.formats(),n=this.quill.getFormat(t.index-1,1);if(r=Jn.AttributeMap.diff(e,n)||{},Object.keys(r).length>0){const e=(new tr).retain(t.index+s.length()-2).retain(1,r);i=i.compose(e)}}}}this.quill.updateContents(i,Vr.sources.USER),this.quill.focus()}handleDelete(t,e){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-n)return;let r={};const[s]=this.quill.getLine(t.index);let i=(new tr).retain(t.index).delete(n);if(e.offset>=s.length()-1){const[e]=this.quill.getLine(t.index+1);if(e){const n=s.formats(),o=this.quill.getFormat(t.index,1);r=Jn.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(i=i.retain(e.length()-1).retain(1,r))}}this.quill.updateContents(i,Vr.sources.USER),this.quill.focus()}handleDeleteRange(t){Ss({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const n=Object.keys(e.format).reduce((t,n)=>(this.quill.scroll.query(n,Qe.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t),{}),r=(new tr).retain(t.index).delete(t.length).insert("\n",n);this.quill.updateContents(r,Vr.sources.USER),this.quill.setSelection(t.index+1,Vr.sources.SILENT),this.quill.focus()}}const ks={bindings:{bold:Os("bold"),italic:Os("italic"),underline:Os("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","+1",Vr.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","-1",Vr.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(t,e){null!=e.format.indent?this.quill.format("indent","-1",Vr.sources.USER):null!=e.format.list&&this.quill.format("list",!1,Vr.sources.USER)}},"indent code-block":_s(!0),"outdent code-block":_s(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(t){this.quill.deleteText(t.index-1,1,Vr.sources.USER)}},tab:{key:"Tab",handler(t,e){if(e.format.table)return!0;this.quill.history.cutoff();const n=(new tr).retain(t.index).delete(t.length).insert("\t");return this.quill.updateContents(n,Vr.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,Vr.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,Vr.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(t,e){const n={list:!1};e.format.indent&&(n.indent=!1),this.quill.formatLine(t.index,t.length,n,Vr.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(t){const[e,n]=this.quill.getLine(t.index),r={...e.formats(),list:"checked"},s=(new tr).retain(t.index).insert("\n",r).retain(e.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(s,Vr.sources.USER),this.quill.setSelection(t.index+1,Vr.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(t,e){const[n,r]=this.quill.getLine(t.index),s=(new tr).retain(t.index).insert("\n",e.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(s,Vr.sources.USER),this.quill.setSelection(t.index+1,Vr.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(t){const e=this.quill.getModule("table");if(e){const[n,r,s,i]=e.getTable(t),o=function(t,e,n,r){if(null==e.prev&&null==e.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==e.prev)return-1;if(null==e.next)return 1;return null}(0,r,s,i);if(null==o)return;let l=n.offset();if(o<0){const e=(new tr).retain(l).insert("\n");this.quill.updateContents(e,Vr.sources.USER),this.quill.setSelection(t.index+1,t.length,Vr.sources.SILENT)}else if(o>0){l+=n.length();const t=(new tr).retain(l).insert("\n");this.quill.updateContents(t,Vr.sources.USER),this.quill.setSelection(l,Vr.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(t,e){const{event:n,line:r}=e,s=r.offset(this.quill.scroll);this.quill.setSelection(n.shiftKey?s-1:s+r.length(),Vr.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(t,e){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=e.prefix,[r,s]=this.quill.getLine(t.index);if(s>n)return!0;let i;switch(e.prefix.trim()){case"[]":case"[ ]":i="unchecked";break;case"[x]":i="checked";break;case"-":case"*":i="bullet";break;default:i="ordered"}this.quill.insertText(t.index," ",Vr.sources.USER),this.quill.history.cutoff();const o=(new tr).retain(t.index-s).delete(n+1).retain(r.length()-2-s).retain(1,{list:i});return this.quill.updateContents(o,Vr.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-n,Vr.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(t){const[e,n]=this.quill.getLine(t.index);let r=2,s=e;for(;null!=s&&s.length()<=1&&s.formats()["code-block"];)if(s=s.prev,r-=1,r<=0){const r=(new tr).retain(t.index+e.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Vr.sources.USER),this.quill.setSelection(t.index-1,Vr.sources.SILENT),!1}return!0}},"embed left":Ls("ArrowLeft",!1),"embed left shift":Ls("ArrowLeft",!0),"embed right":Ls("ArrowRight",!1),"embed right shift":Ls("ArrowRight",!0),"table down":Ts(!1),"table up":Ts(!0)}};function _s(t){return{key:"Tab",shiftKey:!t,format:{"code-block":!0},handler(e,n){let{event:r}=n;const s=this.quill.scroll.query("code-block"),{TAB:i}=s;if(0===e.length&&!r.shiftKey)return this.quill.insertText(e.index,i,Vr.sources.USER),void this.quill.setSelection(e.index+i.length,Vr.sources.SILENT);const o=0===e.length?this.quill.getLines(e.index,1):this.quill.getLines(e);let{index:l,length:a}=e;o.forEach((e,n)=>{t?(e.insertAt(0,i),0===n?l+=i.length:a+=i.length):e.domNode.textContent.startsWith(i)&&(e.deleteAt(0,i.length),0===n?l-=i.length:a-=i.length)}),this.quill.update(Vr.sources.USER),this.quill.setSelection(l,a,Vr.sources.SILENT)}}}function Ls(t,e){const n="ArrowLeft"===t?"prefix":"suffix";return{key:t,shiftKey:e,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===t&&(r+=n.length+1);const[s]=this.quill.getLeaf(r);return!(s instanceof wn)||("ArrowLeft"===t?e?this.quill.setSelection(n.index-1,n.length+1,Vr.sources.USER):this.quill.setSelection(n.index-1,Vr.sources.USER):e?this.quill.setSelection(n.index,n.length+1,Vr.sources.USER):this.quill.setSelection(n.index+n.length+1,Vr.sources.USER),!1)}}}function Os(t){return{key:t[0],shortKey:!0,handler(e,n){this.quill.format(t,!n.format[t],Vr.sources.USER)}}}function Ts(t){return{key:t?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(e,n){const r=t?"prev":"next",s=n.line,i=s.parent[r];if(null!=i){if("table-row"===i.statics.blotName){let t=i.children.head,e=s;for(;null!=e.prev;)e=e.prev,t=t.next;const r=t.offset(this.quill.scroll)+Math.min(n.offset,t.length()-1);this.quill.setSelection(r,0,Vr.sources.USER)}}else{const e=s.table()[r];null!=e&&this.quill.setSelection(t?e.offset(this.quill.scroll)+e.length()-1:e.offset(this.quill.scroll),0,Vr.sources.USER)}return!1}}}function Ss(t){let{quill:e,range:n}=t;const r=e.getLines(n);let s={};if(r.length>1){const t=r[0].formats(),e=r[r.length-1].formats();s=Jn.AttributeMap.diff(e,t)||{}}e.deleteText(n,Vr.sources.USER),Object.keys(s).length>0&&e.formatLine(n.index,1,s,Vr.sources.USER),e.setSelection(n.index,Vr.sources.SILENT)}qs.DEFAULTS=ks;const js=/font-weight:\s*normal/,Cs=["P","OL","UL"],Rs=t=>t&&Cs.includes(t.tagName);const Is=/\bmso-list:[^;]*ignore/i,Ms=/\bmso-list:[^;]*\bl(\d+)/i,Bs=/\bmso-list:[^;]*\blevel(\d+)/i,Ds=t=>{const e=Array.from(t.querySelectorAll("[style*=mso-list]")),n=[],r=[];e.forEach(t=>{(t.getAttribute("style")||"").match(Is)?n.push(t):r.push(t)}),n.forEach(t=>t.parentNode?.removeChild(t));const s=t.documentElement.innerHTML,i=r.map(t=>((t,e)=>{const n=t.getAttribute("style"),r=n?.match(Ms);if(!r)return null;const s=Number(r[1]),i=n?.match(Bs),o=i?Number(i[1]):1,l=new RegExp(`@list l${s}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=e.match(l);return{id:s,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:t}})(t,s)).filter(t=>t);for(;i.length;){const t=[];let e=i.shift();for(;e;)t.push(e),e=i.length&&i[0]?.element===e.element.nextElementSibling&&i[0].id===e.id?i.shift():null;const n=document.createElement("ul");t.forEach(t=>{const e=document.createElement("li");e.setAttribute("data-list",t.type),t.indent>1&&e.setAttribute("class","ql-indent-"+(t.indent-1)),e.innerHTML=t.element.innerHTML,n.appendChild(e)});const r=t[0]?.element,{parentNode:s}=r??{};r&&s?.replaceChild(n,r),t.slice(1).forEach(t=>{let{element:e}=t;s?.removeChild(e)})}};const Us=[function(t){"urn:schemas-microsoft-com:office:word"===t.documentElement.getAttribute("xmlns:w")&&Ds(t)},function(t){t.querySelector('[id^="docs-internal-guid-"]')&&((t=>{Array.from(t.querySelectorAll('b[style*="font-weight"]')).filter(t=>t.getAttribute("style")?.match(js)).forEach(e=>{const n=t.createDocumentFragment();n.append(...e.childNodes),e.parentNode?.replaceChild(n,e)})})(t),(t=>{Array.from(t.querySelectorAll("br")).filter(t=>Rs(t.previousElementSibling)&&Rs(t.nextElementSibling)).forEach(t=>{t.parentNode?.removeChild(t)})})(t))}],Ps=yr("quill:clipboard"),zs=[[Node.TEXT_NODE,function(t,e,n){let r=t.data;if("O:P"===t.parentElement?.tagName)return e.insert(r.trim());if(!Zs(t)){if(0===r.trim().length&&r.includes("\n")&&!function(t,e){return t.previousElementSibling&&t.nextElementSibling&&!Ks(t.previousElementSibling,e)&&!Ks(t.nextElementSibling,e)}(t,n))return e;const s=(t,e)=>{const n=e.replace(/[^\u00a0]/g,"");return n.length<1&&t?" ":n};r=r.replace(/\r\n/g," ").replace(/\n/g," "),r=r.replace(/\s\s+/g,s.bind(s,!0)),(null==t.previousSibling&&null!=t.parentElement&&Ks(t.parentElement,n)||t.previousSibling instanceof Element&&Ks(t.previousSibling,n))&&(r=r.replace(/^\s+/,s.bind(s,!1))),(null==t.nextSibling&&null!=t.parentElement&&Ks(t.parentElement,n)||t.nextSibling instanceof Element&&Ks(t.nextSibling,n))&&(r=r.replace(/\s+$/,s.bind(s,!1)))}return e.insert(r)}],[Node.TEXT_NODE,Ys],["br",function(t,e){Vs(e,"\n")||e.insert("\n");return e}],[Node.ELEMENT_NODE,Ys],[Node.ELEMENT_NODE,function(t,e,n){const r=n.query(t);if(null==r)return e;if(r.prototype instanceof wn){const e={},s=r.value(t);if(null!=s)return e[r.blotName]=s,(new tr).insert(e,r.formats(t,n))}else if(r.prototype instanceof xn&&!Vs(e,"\n")&&e.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return $s(e,r.blotName,r.formats(t,n),n);return e}],[Node.ELEMENT_NODE,function(t,e,n){const r=Je.keys(t),s=sn.keys(t),i=ln.keys(t),o={};return r.concat(s).concat(i).forEach(e=>{let r=n.query(e,Qe.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(r=Hs[e],null==r||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),r=Fs[e],null==r||r.attrName!==e&&r.keyName!==e||(r=Fs[e],o[r.attrName]=r.value(t)||void 0))}),Object.entries(o).reduce((t,e)=>{let[r,s]=e;return $s(t,r,s,n)},e)}],[Node.ELEMENT_NODE,function(t,e,n){const r={},s=t.style||{};"italic"===s.fontStyle&&(r.italic=!0);"underline"===s.textDecoration&&(r.underline=!0);"line-through"===s.textDecoration&&(r.strike=!0);(s.fontWeight?.startsWith("bold")||parseInt(s.fontWeight,10)>=700)&&(r.bold=!0);if(e=Object.entries(r).reduce((t,e)=>{let[r,s]=e;return $s(t,r,s,n)},e),parseFloat(s.textIndent||0)>0)return(new tr).insert("\t").concat(e);return e}],["li",function(t,e,n){const r=n.query(t);if(null==r||"list"!==r.blotName||!Vs(e,"\n"))return e;let s=-1,i=t.parentNode;for(;null!=i;)["OL","UL"].includes(i.tagName)&&(s+=1),i=i.parentNode;return s<=0?e:e.reduce((t,e)=>e.insert?e.attributes&&"number"==typeof e.attributes.indent?t.push(e):t.insert(e.insert,{indent:s,...e.attributes||{}}):t,new tr)}],["ol, ul",function(t,e,n){let r="OL"===t.tagName?"ordered":"bullet";const s=t.getAttribute("data-checked");s&&(r="true"===s?"checked":"unchecked");return $s(e,"list",r,n)}],["pre",function(t,e,n){const r=n.query("code-block"),s=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(t,n);return $s(e,"code-block",s,n)}],["tr",function(t,e,n){const r="TABLE"===t.parentElement?.tagName?t.parentElement:t.parentElement?.parentElement;if(null!=r){return $s(e,"table",Array.from(r.querySelectorAll("tr")).indexOf(t)+1,n)}return e}],["b",Xs("bold")],["i",Xs("italic")],["strike",Xs("strike")],["style",function(){return new tr}]],Hs=[rs,gs].reduce((t,e)=>(t[e.keyName]=e,t),{}),Fs=[is,us,as,bs,xs,Es].reduce((t,e)=>(t[e.keyName]=e,t),{});function $s(t,e,n,r){return r.query(e)?t.reduce((t,r)=>{if(!r.insert)return t;if(r.attributes&&r.attributes[e])return t.push(r);return t.insert(r.insert,{...n?{[e]:n}:{},...r.attributes})},new tr):t}function Vs(t,e){let n="";for(let r=t.ops.length-1;r>=0&&n.length<e.length;--r){const e=t.ops[r];if("string"!=typeof e.insert)break;n=e.insert+n}return n.slice(-1*e.length)===e}function Ks(t,e){if(!(t instanceof Element))return!1;const n=e.query(t);return!(n&&n.prototype instanceof wn)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(t.tagName.toLowerCase())}const Ws=new WeakMap;function Zs(t){return null!=t&&(Ws.has(t)||Ws.set(t,"PRE"===t.tagName||Zs(t.parentNode)),Ws.get(t))}function Gs(t,e,n,r,s){return e.nodeType===e.TEXT_NODE?r.reduce((n,r)=>r(e,n,t),new tr):e.nodeType===e.ELEMENT_NODE?Array.from(e.childNodes||[]).reduce((i,o)=>{let l=Gs(t,o,n,r,s);return o.nodeType===e.ELEMENT_NODE&&(l=n.reduce((e,n)=>n(o,e,t),l),l=(s.get(o)||[]).reduce((e,n)=>n(o,e,t),l)),i.concat(l)},new tr):new tr}function Xs(t){return(e,n,r)=>$s(n,t,!0,r)}function Ys(t,e,n){if(!Vs(e,"\n")){if(Ks(t,n)&&(t.childNodes.length>0||t instanceof HTMLParagraphElement))return e.insert("\n");if(e.length()>0&&t.nextSibling){let r=t.nextSibling;for(;null!=r;){if(Ks(r,n))return e.insert("\n");const t=n.query(r);if(t&&t.prototype instanceof or)return e.insert("\n");r=r.firstChild}}}return e}function Qs(t,e){let n=e;for(let r=t.length-1;r>=0;r-=1){const e=t[r];t[r]={delta:n.transform(e.delta,!0),range:e.range&&Js(e.range,n)},n=e.delta.transform(n),0===t[r].delta.length()&&t.splice(r,1)}}function Js(t,e){if(!t)return t;const n=e.transformPosition(t.index);return{index:n,length:e.transformPosition(t.index+t.length)-n}}class ti extends Cr{constructor(t,e){super(t,e),t.root.addEventListener("drop",e=>{e.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(e.clientX,e.clientY);else if(document.caretPositionFromPoint){const t=document.caretPositionFromPoint(e.clientX,e.clientY);n=document.createRange(),n.setStart(t.offsetNode,t.offset),n.setEnd(t.offsetNode,t.offset)}const r=n&&t.selection.normalizeNative(n);if(r){const n=t.selection.normalizedToRange(r);e.dataTransfer?.files&&this.upload(n,e.dataTransfer.files)}})}upload(t,e){const n=[];Array.from(e).forEach(t=>{t&&this.options.mimetypes?.includes(t.type)&&n.push(t)}),n.length>0&&this.options.handler.call(this,t,n)}}ti.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(t,e){if(!this.quill.scroll.query("image"))return;const n=e.map(t=>new Promise(e=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.readAsDataURL(t)}));Promise.all(n).then(e=>{const n=e.reduce((t,e)=>t.insert({image:e}),(new tr).retain(t.index).delete(t.length));this.quill.updateContents(n,xr.sources.USER),this.quill.setSelection(t.index+e.length,xr.sources.SILENT)})}};const ei=["insertText","insertReplacementText"];const ni=/Mac/i.test(navigator.platform);Vr.register({"blots/block":ir,"blots/block/embed":or,"blots/break":er,"blots/container":Qr,"blots/cursor":cr,"blots/embed":Ir,"blots/inline":sr,"blots/scroll":class extends kn{static blotName="scroll";static className="ql-editor";static tagName="DIV";static defaultChild=ir;static allowedChildren=[ir,or,Qr];constructor(t,e,n){let{emitter:r}=n;super(t,e),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",t=>this.handleDragStart(t))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(xr.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(xr.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(xr.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[n,r]=this.line(t),[s]=this.line(t+e);if(super.deleteAt(t,e),null!=s&&n!==s&&r>0){if(n instanceof or||s instanceof or)return void this.optimize();n.moveChildren(s,s.children.head instanceof er?null:s.children.head),n.remove()}this.optimize()}enable(){this.domNode.setAttribute("contenteditable",!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?"true":"false")}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.optimize()}insertAt(t,e,n){if(t>=this.length())if(null==n||null==this.scroll.query(e,Qe.BLOCK)){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t),null==n&&e.endsWith("\n")?t.insertAt(0,e.slice(0,-1),n):t.insertAt(0,e,n)}else{const t=this.scroll.create(e,n);this.appendChild(t)}else super.insertAt(t,e,n);this.optimize()}insertBefore(t,e){if(t.statics.scope===Qe.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(t),super.insertBefore(n,e)}else super.insertBefore(t,e)}insertContents(t,e){const n=this.deltaToRenderBlocks(e.concat((new tr).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const s=n.shift();if(s){const e="block"===s.type&&(0===s.delta.length()||!this.descendant(or,t)[0]&&t<this.length()),n="block"===s.type?s.delta:(new tr).insert({[s.key]:s.value});es(this,t,n);const r="block"===s.type?1:0,i=t+n.length()+r;e&&this.insertAt(i-1,"\n");const o=ar(this.line(t)[0]),l=Jn.AttributeMap.diff(o,s.attributes)||{};Object.keys(l).forEach(t=>{this.formatAt(i-1,1,t,l[t])}),t=i}let[i,o]=this.children.find(t);if(n.length&&(i&&(i=i.split(o),o=0),n.forEach(t=>{if("block"===t.type){es(this.createBlock(t.attributes,i||void 0),0,t.delta)}else{const e=this.create(t.key,t.value);this.insertBefore(e,i||void 0),Object.keys(t.attributes).forEach(n=>{e.format(n,t.attributes[n])})}})),"block"===r.type&&r.delta.length()){es(this,i?i.offset(i.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[n,r]=e;return n instanceof dn?[n,r]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(Jr,t)}lines(){const t=(e,n,r)=>{let s=[],i=r;return e.children.forEachAt(n,r,(e,n,r)=>{Jr(e)?s.push(e):e instanceof En&&(s=s.concat(t(e,n,i))),i-=r}),s};return t(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE)}optimize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(t,e),t.length>0&&this.emitter.emit(xr.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch)return void(Array.isArray(t)&&(this.batch=this.batch.concat(t)));let e=xr.sources.USER;"string"==typeof t&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),(t=t.filter(t=>{let{target:e}=t;const n=this.find(e,!0);return n&&!ts(n)})).length>0&&this.emitter.emit(xr.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(xr.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,n){const[r]=this.descendant(t=>t instanceof or,t);r&&r.statics.blotName===e&&ts(r)&&r.updateContent(n)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let n=new tr;return t.forEach(t=>{const r=t?.insert;if(r)if("string"==typeof r){const s=r.split("\n");s.slice(0,-1).forEach(r=>{n.insert(r,t.attributes),e.push({type:"block",delta:n,attributes:t.attributes??{}}),n=new tr});const i=s[s.length-1];i&&n.insert(i,t.attributes)}else{const s=Object.keys(r)[0];if(!s)return;this.query(s,Qe.INLINE)?n.push(t):(n.length()&&e.push({type:"block",delta:n,attributes:{}}),n=new tr,e.push({type:"blockEmbed",key:s,value:r[s],attributes:t.attributes??{}}))}}),n.length()&&e.push({type:"block",delta:n,attributes:{}}),e}createBlock(t,e){let n;const r={};Object.entries(t).forEach(t=>{let[e,s]=t;null!=this.query(e,Qe.BLOCK&Qe.BLOT)?n=e:r[e]=s});const s=this.create(n||this.statics.defaultChild.blotName,n?t[n]:void 0);this.insertBefore(s,e||void 0);const i=s.length();return Object.entries(r).forEach(t=>{let[e,n]=t;s.formatAt(0,i,e,n)}),s}},"blots/text":nr,"modules/clipboard":class extends Cr{static DEFAULTS={matchers:[]};constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",t=>this.onCaptureCopy(t,!1)),this.quill.root.addEventListener("cut",t=>this.onCaptureCopy(t,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],zs.concat(this.options.matchers??[]).forEach(t=>{let[e,n]=t;this.addMatcher(e,n)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:n}=t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[ds.blotName])return(new tr).insert(n||"",{[ds.blotName]:r[ds.blotName]});if(!e)return(new tr).insert(n||"",r);const s=this.convertHTML(e);return Vs(s,"\n")&&(null==s.ops[s.ops.length-1].attributes||r.table)?s.compose((new tr).retain(s.length()-1).delete(1)):s}normalizeHTML(t){(t=>{t.documentElement&&Us.forEach(e=>{e(t)})})(t)}convertHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");this.normalizeHTML(e);const n=e.body,r=new WeakMap,[s,i]=this.prepareMatching(n,r);return Gs(this.quill.scroll,n,s,i,r)}dangerouslyPasteHTML(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Vr.sources.API;if("string"==typeof t){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,Vr.sources.SILENT)}else{const r=this.convert({html:e,text:""});this.quill.updateContents((new tr).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),Vr.sources.SILENT)}}onCaptureCopy(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.defaultPrevented)return;t.preventDefault();const[n]=this.quill.selection.getRange();if(null==n)return;const{html:r,text:s}=this.onCopy(n,e);t.clipboardData?.setData("text/plain",s),t.clipboardData?.setData("text/html",r),e&&Ss({range:n,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(t=>"#"!==t[0]).join("\n")}onCapturePaste(t){if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(null==e)return;const n=t.clipboardData?.getData("text/html");let r=t.clipboardData?.getData("text/plain");if(!n&&!r){const e=t.clipboardData?.getData("text/uri-list");e&&(r=this.normalizeURIList(e))}const s=Array.from(t.clipboardData?.files||[]);if(!n&&s.length>0)this.quill.uploader.upload(e,s);else{if(n&&s.length>0){const t=(new DOMParser).parseFromString(n,"text/html");if(1===t.body.childElementCount&&"IMG"===t.body.firstElementChild?.tagName)return void this.quill.uploader.upload(e,s)}this.onPaste(e,{html:n,text:r})}}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:n,html:r}=e;const s=this.quill.getFormat(t.index),i=this.convert({text:n,html:r},s);Ps.log("onPaste",i,{text:n,html:r});const o=(new tr).retain(t.index).delete(t.length).concat(i);this.quill.updateContents(o,Vr.sources.USER),this.quill.setSelection(o.length()-t.length,Vr.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const n=[],r=[];return this.matchers.forEach(s=>{const[i,o]=s;switch(i){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(t.querySelectorAll(i)).forEach(t=>{if(e.has(t)){const n=e.get(t);n?.push(o)}else e.set(t,[o])})}}),[n,r]}},"modules/history":class extends Cr{static DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};lastRecorded=0;ignoreChange=!1;stack={undo:[],redo:[]};currentRange=null;constructor(t,e){super(t,e),this.quill.on(Vr.events.EDITOR_CHANGE,(t,e,n,r)=>{t===Vr.events.SELECTION_CHANGE?e&&r!==Vr.sources.SILENT&&(this.currentRange=e):t===Vr.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Vr.sources.USER?this.transform(e):this.record(e,n)),this.currentRange=Js(this.currentRange,e))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",t=>{"historyUndo"===t.inputType?(this.undo(),t.preventDefault()):"historyRedo"===t.inputType&&(this.redo(),t.preventDefault())})}change(t,e){if(0===this.stack[t].length)return;const n=this.stack[t].pop();if(!n)return;const r=this.quill.getContents(),s=n.delta.invert(r);this.stack[e].push({delta:s,range:Js(n.range,s)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,Vr.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(t,e){if(0===t.ops.length)return;this.stack.redo=[];let n=t.invert(e),r=this.currentRange;const s=Date.now();if(this.lastRecorded+this.options.delay>s&&this.stack.undo.length>0){const t=this.stack.undo.pop();t&&(n=n.compose(t.delta),r=t.range)}else this.lastRecorded=s;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(t){Qs(this.stack.undo,t),Qs(this.stack.redo,t)}undo(){this.change("undo","redo")}restoreSelection(t){if(t.range)this.quill.setSelection(t.range,Vr.sources.USER);else{const e=function(t,e){const n=e.reduce((t,e)=>t+(e.delete||0),0);let r=e.length()-n;(function(t,e){const n=e.ops[e.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(e=>null!=t.query(e,Qe.BLOCK));return!1})(t,e)&&(r-=1);return r}(this.quill.scroll,t.delta);this.quill.setSelection(e,Vr.sources.USER)}}},"modules/keyboard":qs,"modules/uploader":ti,"modules/input":class extends Cr{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",t=>{this.handleBeforeInput(t)}),/Android/i.test(navigator.userAgent)||t.on(Vr.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){Ss({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===t.length)return!1;if(e){const n=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents((new tr).retain(t.index).insert(e,n),Vr.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,Vr.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!ei.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||!0===e.collapsed)return;const n=function(t){if("string"==typeof t.data)return t.data;if(t.dataTransfer?.types.includes("text/plain"))return t.dataTransfer.getData("text/plain");return null}(t);if(null==n)return;const r=this.quill.selection.normalizeNative(e),s=r?this.quill.selection.normalizedToRange(r):null;s&&this.replaceText(s,n)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}},"modules/uiNode":class extends Cr{isListening=!1;selectionChangeDeadline=0;constructor(t,e){super(t,e),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(t,e){let{line:n,event:r}=e;if(!(n instanceof mn&&n.uiNode))return!0;const s="rtl"===getComputedStyle(n.domNode).direction;return!!(s&&"ArrowRight"!==r.key||!s&&"ArrowLeft"!==r.key)||(this.quill.setSelection(t.index-1,t.length+(r.shiftKey?1:0),Vr.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",t=>{!t.defaultPrevented&&(t=>"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowUp"===t.key||"ArrowDown"===t.key||"Home"===t.key||!(!ni||"a"!==t.key||!0!==t.ctrlKey))(t)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const t=document.getSelection();if(!t)return;const e=t.getRangeAt(0);if(!0!==e.collapsed||0!==e.startOffset)return;const n=this.quill.scroll.find(e.startContainer);if(!(n instanceof mn&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),t.removeAllRanges(),t.addRange(r)}}});const ri=new class extends sn{add(t,e){let n=0;if("+1"===e||"-1"===e){const r=this.value(t)||0;n="+1"===e?r+1:r-1}else"number"==typeof e&&(n=e);return 0===n?(this.remove(t),!0):super.add(t,n.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}("indent","ql-indent",{scope:Qe.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class si extends Qr{}si.blotName="list-container",si.tagName="OL";class ii extends ir{static create(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){Vr.register(si)}constructor(t,e){super(t,e);const n=e.ownerDocument.createElement("span"),r=n=>{if(!t.isEnabled())return;const r=this.statics.formats(e,t);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}ii.blotName="list",ii.tagName="LI",si.allowedChildren=[ii],ii.requiredContainer=si;class oi extends sr{static blotName="bold";static tagName=["STRONG","B"];static create(){return super.create()}static formats(){return!0}optimize(t){super.optimize(t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}class li extends sr{static blotName="link";static tagName="A";static SANITIZED_URL="about:blank";static PROTOCOL_WHITELIST=["http","https","mailto","tel","sms"];static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return ai(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("href",this.constructor.sanitize(e)):super.format(t,e)}}function ai(t,e){const n=document.createElement("a");n.href=t;const r=n.href.slice(0,n.href.indexOf(":"));return e.indexOf(r)>-1}const ci=["alt","height","width"];const ui=["height","width"];const hi=new sn("code-token","hljs",{scope:Qe.INLINE});class di extends sr{static formats(t,e){for(;null!=t&&t!==e.domNode;){if(t.classList&&t.classList.contains(ds.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,n){super(t,e,n),hi.add(this.domNode,n)}format(t,e){t!==di.blotName?super.format(t,e):e?hi.add(this.domNode,e):(hi.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),hi.value(this.domNode)||this.unwrap()}}di.blotName="code-token",di.className="ql-token";class fi extends ds{static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),di.blotName,!1),super.replaceWith(t,e)}}class pi extends hs{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===fi.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(t,e)}))}formatAt(t,e,n,r){n===fi.blotName&&(this.forceNext=!0),super.formatAt(t,e,n,r)}highlight(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).map(t=>t.textContent).join("\n")}\n`,r=fi.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const e=this.children.reduce((t,e)=>t.concat(lr(e,!1)),new tr),s=t(n,r);e.diff(s).reduce((t,e)=>{let{retain:n,attributes:r}=e;return n?(r&&Object.keys(r).forEach(e=>{[fi.blotName,di.blotName].includes(e)&&this.formatAt(t,n,e,r[e])}),t+n):t},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[n]=this.children.find(t);return`<pre data-language="${n?fi.formats(n.domNode):"plain"}">\n${rr(this.code(t,e))}\n</pre>`}optimize(t){if(super.optimize(t),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const t=fi.formats(this.children.head.domNode);t!==this.uiNode.value&&(this.uiNode.value=t)}}}pi.allowedChildren=[fi],fi.requiredContainer=pi,fi.allowedChildren=[di,cr,nr,er];class gi extends Cr{static register(){Vr.register(di,!0),Vr.register(fi,!0),Vr.register(pi,!0)}constructor(t,e){if(super(t,e),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((t,e)=>{let{key:n}=e;return t[n]=!0,t},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Vr.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof pi))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(t=>{let{key:n,label:r}=t;const s=e.ownerDocument.createElement("option");s.textContent=r,s.setAttribute("value",n),e.appendChild(s)}),e.addEventListener("change",()=>{t.format(fi.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),null==t.uiNode&&(t.attachUI(e),t.children.head&&(e.value=fi.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(Vr.events.SCROLL_OPTIMIZE,()=>{t&&clearTimeout(t),t=setTimeout(()=>{this.highlight(),t=null},this.options.interval)})}highlight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(Vr.sources.USER);const n=this.quill.getSelection();(null==t?this.quill.scroll.descendants(pi):[t]).forEach(t=>{t.highlight(this.highlightBlot,e)}),this.quill.update(Vr.sources.SILENT),null!=n&&this.quill.setSelection(n,Vr.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(e=this.languages[e]?e:"plain","plain"===e)return rr(t).split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[ds.blotName]:e}),t.insert(n)),new tr);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(ds.className),n.innerHTML=((t,e,n)=>{if("string"==typeof t.versionString){const r=t.versionString.split(".")[0];if(parseInt(r,10)>=11)return t.highlight(n,{language:e}).value}return t.highlight(e,n).value})(this.options.hljs,e,t),Gs(this.quill.scroll,n,[(t,e)=>{const n=hi.value(t);return n?e.compose((new tr).retain(e.length(),{[di.blotName]:n})):e}],[(t,n)=>t.data.split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[ds.blotName]:e}),t.insert(n)),n)],new WeakMap)}}gi.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};class mi extends ir{static blotName="table";static tagName="TD";static create(t){const e=super.create();return e.setAttribute("data-row",t||xi()),e}static formats(t){if(t.hasAttribute("data-row"))return t.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,e){t===mi.blotName&&e?this.domNode.setAttribute("data-row",e):super.format(t,e)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}}class bi extends Qr{static blotName="table-row";static tagName="TR";checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const t=this.children.head.formats(),e=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return t.table===e.table&&t.table===n.table&&t.table===r.table}return!1}optimize(t){super.optimize(t),this.children.forEach(t=>{if(null==t.next)return;const e=t.formats(),n=t.next.formats();if(e.table!==n.table){const e=this.splitAfter(t);e&&e.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}class yi extends Qr{static blotName="table-body";static tagName="TBODY"}class vi extends Qr{static blotName="table-container";static tagName="TABLE";balanceCells(){const t=this.descendants(bi),e=t.reduce((t,e)=>Math.max(e.children.length,t),0);t.forEach(t=>{new Array(e-t.children.length).fill(0).forEach(()=>{let e;null!=t.children.head&&(e=mi.formats(t.children.head.domNode));const n=this.scroll.create(mi.blotName,e);t.appendChild(n),n.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(yi);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t);null!=n&&n.remove()})}insertColumn(t){const[e]=this.descendant(yi);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t),r=mi.formats(e.children.head.domNode),s=this.scroll.create(mi.blotName,r);e.insertBefore(s,n)})}insertRow(t){const[e]=this.descendant(yi);if(null==e||null==e.children.head)return;const n=xi(),r=this.scroll.create(bi.blotName);e.children.head.children.forEach(()=>{const t=this.scroll.create(mi.blotName,n);r.appendChild(t)});const s=e.children.at(t);e.insertBefore(r,s)}rows(){const t=this.children.head;return null==t?[]:t.children.map(t=>t)}}function xi(){return`row-${Math.random().toString(36).slice(2,6)}`}vi.allowedChildren=[yi],yi.requiredContainer=vi,yi.allowedChildren=[bi],bi.requiredContainer=yi,bi.allowedChildren=[mi],mi.requiredContainer=bi;const Ni=yr("quill:toolbar");class Ei extends Cr{constructor(t,e){if(super(t,e),Array.isArray(this.options.container)){const e=document.createElement("div");e.setAttribute("role","toolbar"),function(t,e){Array.isArray(e[0])||(e=[e]);e.forEach(e=>{const n=document.createElement("span");n.classList.add("ql-formats"),e.forEach(t=>{if("string"==typeof t)wi(n,t);else{const e=Object.keys(t)[0],r=t[e];Array.isArray(r)?function(t,e,n){const r=document.createElement("select");r.classList.add(`ql-${e}`),n.forEach(t=>{const e=document.createElement("option");!1!==t?e.setAttribute("value",String(t)):e.setAttribute("selected","selected"),r.appendChild(e)}),t.appendChild(r)}(n,e,r):wi(n,e,r)}}),t.appendChild(n)})}(e,this.options.container),t.container?.parentNode?.insertBefore(e,t.container),this.container=e}else this.container="string"==typeof this.options.container?document.querySelector(this.options.container):this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(t=>{const e=this.options.handlers?.[t];e&&this.addHandler(t,e)}),Array.from(this.container.querySelectorAll("button, select")).forEach(t=>{this.attach(t)}),this.quill.on(Vr.events.EDITOR_CHANGE,()=>{const[t]=this.quill.selection.getRange();this.update(t)})):Ni.error("Container required for toolbar",this.options)}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(t=>0===t.indexOf("ql-"));if(!e)return;if(e=e.slice(3),"BUTTON"===t.tagName&&t.setAttribute("type","button"),null==this.handlers[e]&&null==this.quill.scroll.query(e))return void Ni.warn("ignoring attaching to nonexistent format",e,t);t.addEventListener("SELECT"===t.tagName?"change":"click",n=>{let r;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;const e=t.options[t.selectedIndex];r=!e.hasAttribute("selected")&&(e.value||!1)}else r=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),n.preventDefault();this.quill.focus();const[s]=this.quill.selection.getRange();if(null!=this.handlers[e])this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof wn){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents((new tr).retain(s.index).delete(s.length).insert({[e]:r}),Vr.sources.USER)}else this.quill.format(e,r,Vr.sources.USER);this.update(s)}),this.controls.push([e,t])}update(t){const e=null==t?{}:this.quill.getFormat(t);this.controls.forEach(n=>{const[r,s]=n;if("SELECT"===s.tagName){let n=null;if(null==t)n=null;else if(null==e[r])n=s.querySelector("option[selected]");else if(!Array.isArray(e[r])){let t=e[r];"string"==typeof t&&(t=t.replace(/"/g,'\\"')),n=s.querySelector(`option[value="${t}"]`)}null==n?(s.value="",s.selectedIndex=-1):n.selected=!0}else if(null==t)s.classList.remove("ql-active"),s.setAttribute("aria-pressed","false");else if(s.hasAttribute("value")){const t=e[r],n=t===s.getAttribute("value")||null!=t&&t.toString()===s.getAttribute("value")||null==t&&!s.getAttribute("value");s.classList.toggle("ql-active",n),s.setAttribute("aria-pressed",n.toString())}else{const t=null!=e[r];s.classList.toggle("ql-active",t),s.setAttribute("aria-pressed",t.toString())}})}}function wi(t,e,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${e}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${e}: ${n}`)):r.setAttribute("aria-label",e),t.appendChild(r)}Ei.DEFAULTS={},Ei.DEFAULTS={container:null,handlers:{clean(){const t=this.quill.getSelection();if(null!=t)if(0===t.length){const t=this.quill.getFormat();Object.keys(t).forEach(t=>{null!=this.quill.scroll.query(t,Qe.INLINE)&&this.quill.format(t,!1,Vr.sources.USER)})}else this.quill.removeFormat(t.index,t.length,Vr.sources.USER)},direction(t){const{align:e}=this.quill.getFormat();"rtl"===t&&null==e?this.quill.format("align","right",Vr.sources.USER):t||"right"!==e||this.quill.format("align",!1,Vr.sources.USER),this.quill.format("direction",t,Vr.sources.USER)},indent(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e),r=parseInt(n.indent||0,10);if("+1"===t||"-1"===t){let e="+1"===t?1:-1;"rtl"===n.direction&&(e*=-1),this.quill.format("indent",r+e,Vr.sources.USER)}},link(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,Vr.sources.USER)},list(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e);this.quill.format("list","check"===t?"checked"!==n.list&&"unchecked"!==n.list&&"unchecked":t,Vr.sources.USER)}}};const Ai='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>';var qi={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:Ai,"code-block":Ai,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let ki=0;function _i(t,e){t.setAttribute(e,`${!("true"===t.getAttribute(e))}`)}class Li{constructor(t){this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",t=>{switch(t.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),t.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),_i(this.label,"aria-expanded"),_i(this.options,"aria-hidden")}buildItem(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const n=t.getAttribute("value");return n&&e.setAttribute("data-value",n),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",()=>{this.selectItem(e,!0)}),e.addEventListener("keydown",t=>{switch(t.key){case"Enter":this.selectItem(e,!0),t.preventDefault();break;case"Escape":this.escape(),t.preventDefault()}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${ki}`,ki+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const n=this.buildItem(e);t.appendChild(n),!0===e.selected&&this.selectItem(n)}),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach(t=>{this.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);const e=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class Oi extends Li{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(t=>{t.classList.add("ql-primary")})}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const n=this.label.querySelector(".ql-color-label"),r=t&&t.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Ti extends Li{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(t=>{t.innerHTML=e[t.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const n=t||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Si{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(t=>{const{overflowY:e}=getComputedStyle(t,null);return"visible"!==e&&"clip"!==e})(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(t){const e=t.left+t.width/2-this.root.offsetWidth/2,n=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),s=this.root.getBoundingClientRect();let i=0;if(s.right>r.right&&(i=r.right-s.right,this.root.style.left=`${e+i}px`),s.left<r.left&&(i=r.left-s.left,this.root.style.left=`${e+i}px`),s.bottom>r.bottom){this.root.style.top=n-(t.bottom-t.top+(s.bottom-s.top))+"px",this.root.classList.add("ql-flip")}return i}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const ji=[!1,"center","right","justify"],Ci=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],Ri=[!1,"serif","monospace"],Ii=["1","2","3",!1],Mi=["small",!1,"large","huge"];class Bi extends Br{constructor(t,e){super(t,e);const n=e=>{document.body.contains(t.root)?(null==this.tooltip||this.tooltip.root.contains(e.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(t=>{t.container.contains(e.target)||t.close()})):document.body.removeEventListener("click",n)};t.emitter.listenDOM("click",document.body,n)}addModule(t){const e=super.addModule(t);return"toolbar"===t&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(t=>{(t.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=e[n]))if("direction"===n)t.innerHTML=e[n][""]+e[n].rtl;else if("string"==typeof e[n])t.innerHTML=e[n];else{const r=t.value||"";null!=r&&e[n][r]&&(t.innerHTML=e[n][r])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(t=>{if(t.classList.contains("ql-align")&&(null==t.querySelector("option")&&Ui(t,ji),"object"==typeof e.align))return new Ti(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){const n=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&Ui(t,Ci,"background"===n?"#ffffff":"#000000"),new Oi(t,e[n])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?Ui(t,Ri):t.classList.contains("ql-header")?Ui(t,Ii):t.classList.contains("ql-size")&&Ui(t,Mi)),new Li(t)});this.quill.on(xr.events.EDITOR_CHANGE,()=>{this.pickers.forEach(t=>{t.update()})})}}Bi.DEFAULTS=Ye({},Br.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let t=this.container.querySelector("input.ql-image[type=file]");null==t&&(t=document.createElement("input"),t.setAttribute("type","file"),t.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),t.classList.add("ql-image"),t.addEventListener("change",()=>{const e=this.quill.getSelection(!0);this.quill.uploader.upload(e,t.files),t.value=""}),this.container.appendChild(t)),t.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Di extends Si{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",t=>{"Enter"===t.key?(this.save(),t.preventDefault()):"Escape"===t.key&&(this.cancel(),t.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,xr.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,xr.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=function(t){let e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(e)return`${e[1]||"https"}://www.youtube.com/embed/${e[2]}?showinfo=0`;if(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${e[1]||"https"}://player.vimeo.com/video/${e[2]}/`;return t}(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(null!=e){const n=e.index+e.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),t,xr.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",xr.sources.USER),this.quill.setSelection(n+2,xr.sources.USER)}break}}this.textbox.value="",this.hide()}}function Ui(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(e=>{const r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(e)),t.appendChild(r)})}const Pi=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class zi extends Di{static TEMPLATE=['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join("");constructor(t,e){super(t,e),this.quill.on(xr.events.EDITOR_CHANGE,(t,e,n,r)=>{if(t===xr.events.SELECTION_CHANGE)if(null!=e&&e.length>0&&r===xr.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const t=this.quill.getLines(e.index,e.length);if(1===t.length){const t=this.quill.getBounds(e);null!=t&&this.position(t)}else{const n=t[t.length-1],r=this.quill.getIndex(n),s=Math.min(n.length()-1,e.index+e.length-r),i=this.quill.getBounds(new Er(r,s));null!=i&&this.position(i)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(xr.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const t=this.quill.getSelection();if(null!=t){const e=this.quill.getBounds(t);null!=e&&this.position(e)}},1)})}cancel(){this.show()}position(t){const e=super.position(t),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==e&&(n.style.marginLeft=-1*e-n.offsetWidth/2+"px"),e}}class Hi extends Bi{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Pi),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new zi(this.quill,this.options.bounds),null!=t.container&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),qi),this.buildPickers(t.container.querySelectorAll("select"),qi))}}Hi.DEFAULTS=Ye({},Bi.DEFAULTS,{modules:{toolbar:{handlers:{link(t){t?this.quill.theme.tooltip.edit():this.quill.format("link",!1,Vr.sources.USER)}}}}});const Fi=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class $i extends Di{static TEMPLATE=['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join("");preview=this.root.querySelector("a.ql-preview");listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",t=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",t=>{if(null!=this.linkRange){const t=this.linkRange;this.restoreFocus(),this.quill.formatText(t,"link",!1,xr.sources.USER),delete this.linkRange}t.preventDefault(),this.hide()}),this.quill.on(xr.events.SELECTION_CHANGE,(t,e,n)=>{if(null!=t){if(0===t.length&&n===xr.sources.USER){const[e,n]=this.quill.scroll.descendant(li,t.index);if(null!=e){this.linkRange=new Er(t.index-n,e.length());const r=li.formats(e.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const s=this.quill.getBounds(this.linkRange);return void(null!=s&&this.position(s))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}class Vi extends Bi{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Fi),super(t,e),this.quill.container.classList.add("ql-snow")}extendToolbar(t){null!=t.container&&(t.container.classList.add("ql-snow"),this.buildButtons(t.container.querySelectorAll("button"),qi),this.buildPickers(t.container.querySelectorAll("select"),qi),this.tooltip=new $i(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,n)=>{t.handlers.link.call(t,!n.format.link)}))}}Vi.DEFAULTS=Ye({},Bi.DEFAULTS,{modules:{toolbar:{handlers:{link(t){if(t){const t=this.quill.getSelection();if(null==t||0===t.length)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&0!==e.indexOf("mailto:")&&(e=`mailto:${e}`);const{tooltip:n}=this.quill.theme;n.edit("link",e)}else this.quill.format("link",!1,Vr.sources.USER)}}}}}),Vr.register({"attributors/attribute/direction":gs,"attributors/class/align":ss,"attributors/class/background":cs,"attributors/class/color":ls,"attributors/class/direction":ms,"attributors/class/font":vs,"attributors/class/size":Ns,"attributors/style/align":is,"attributors/style/background":us,"attributors/style/color":as,"attributors/style/direction":bs,"attributors/style/font":xs,"attributors/style/size":Es},!0),Vr.register({"formats/align":ss,"formats/direction":ms,"formats/indent":ri,"formats/background":us,"formats/color":as,"formats/font":vs,"formats/size":Ns,"formats/blockquote":class extends ir{static blotName="blockquote";static tagName="blockquote"},"formats/code-block":ds,"formats/header":class extends ir{static blotName="header";static tagName=["H1","H2","H3","H4","H5","H6"];static formats(t){return this.tagName.indexOf(t.tagName)+1}},"formats/list":ii,"formats/bold":oi,"formats/code":fs,"formats/italic":class extends oi{static blotName="italic";static tagName=["EM","I"]},"formats/link":li,"formats/script":class extends sr{static blotName="script";static tagName=["SUB","SUP"];static create(t){return"super"===t?document.createElement("sup"):"sub"===t?document.createElement("sub"):super.create(t)}static formats(t){return"SUB"===t.tagName?"sub":"SUP"===t.tagName?"super":void 0}},"formats/strike":class extends oi{static blotName="strike";static tagName=["S","STRIKE"]},"formats/underline":class extends sr{static blotName="underline";static tagName="U"},"formats/formula":class extends Ir{static blotName="formula";static className="ql-formula";static tagName="SPAN";static create(t){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return"string"==typeof t&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`<span>${t}</span>`}},"formats/image":class extends wn{static blotName="image";static tagName="IMG";static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return ci.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return ai(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){ci.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}},"formats/video":class extends or{static blotName="video";static className="ql-video";static tagName="IFRAME";static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return ui.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static sanitize(t){return li.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){ui.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`<a href="${t}">${t}</a>`}},"modules/syntax":gi,"modules/table":class extends Cr{static register(){Vr.register(mi),Vr.register(bi),Vr.register(yi),Vr.register(vi)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(vi).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();null!=e&&(t.deleteColumn(e.cellOffset()),this.quill.update(Vr.sources.USER))}deleteRow(){const[,t]=this.getTable();null!=t&&(t.remove(),this.quill.update(Vr.sources.USER))}deleteTable(){const[t]=this.getTable();if(null==t)return;const e=t.offset();t.remove(),this.quill.update(Vr.sources.USER),this.quill.setSelection(e,Vr.sources.SILENT)}getTable(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==t)return[null,null,null,-1];const[e,n]=this.quill.getLine(t.index);if(null==e||e.statics.blotName!==mi.blotName)return[null,null,null,-1];const r=e.parent;return[r.parent.parent,r,e,n]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[n,r,s]=this.getTable(e);if(null==s)return;const i=s.cellOffset();n.insertColumn(i+t),this.quill.update(Vr.sources.USER);let o=r.rowOffset();0===t&&(o+=1),this.quill.setSelection(e.index+o,e.length,Vr.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[n,r,s]=this.getTable(e);if(null==s)return;const i=r.rowOffset();n.insertRow(i+t),this.quill.update(Vr.sources.USER),t>0?this.quill.setSelection(e,Vr.sources.SILENT):this.quill.setSelection(e.index+r.children.length,e.length,Vr.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const n=this.quill.getSelection();if(null==n)return;const r=new Array(t).fill(0).reduce(t=>{const n=new Array(e).fill("\n").join("");return t.insert(n,{table:xi()})},(new tr).retain(n.index));this.quill.updateContents(r,Vr.sources.USER),this.quill.setSelection(n.index,Vr.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(Vr.events.SCROLL_OPTIMIZE,t=>{t.some(t=>!!["TD","TR","TBODY","TABLE"].includes(t.target.tagName)&&(this.quill.once(Vr.events.TEXT_CHANGE,(t,e,n)=>{n===Vr.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":Ei,"themes/bubble":Hi,"themes/snow":Vi,"ui/icons":qi,"ui/picker":Li,"ui/icon-picker":Ti,"ui/color-picker":Oi,"ui/tooltip":Si},!0);const Ki={essential:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}],["blockquote","code-block","link"],[{color:[]},"clean"]],minimal:[[{header:1},{header:2}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}]],full:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["link","video","image"],["clean"]]},Wi=t({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object]},contentType:{type:String,default:"delta",validator:t=>["delta","html","text"].includes(t)},enable:{type:Boolean,default:!0},readOnly:{type:Boolean,default:!1},placeholder:{type:String,required:!1},theme:{type:String,default:"snow",validator:t=>["snow","bubble",""].includes(t)},toolbar:{type:[String,Array,Object],required:!1,validator:t=>"string"!=typeof t||""===t||("#"===t.charAt(0)||-1!==Object.keys(Ki).indexOf(t))},modules:{type:Object,required:!1},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready"],setup:(t,e)=>{let l,a;n(()=>{h()}),r(()=>{l=null});const c=s(),u=(t,e)=>{const n=Vr.imports;n&&t in n||Vr.register(t,e)},h=()=>{var n,r;if(c.value){if(a=d(),t.modules)if(Array.isArray(t.modules))for(const e of t.modules)u(`modules/${e.name}`,e.module);else u(`modules/${t.modules.name}`,t.modules.module);l=new Vr(c.value,a),E(t.content),l.on("text-change",b),l.on("selection-change",v),l.on("editor-change",x),"bubble"!==t.theme&&c.value.classList.remove("ql-bubble"),"snow"!==t.theme&&c.value.classList.remove("ql-snow"),null===(r=null===(n=p())||void 0===n?void 0:n.container)||void 0===r||r.addEventListener("mousedown",t=>{t.preventDefault()}),e.emit("ready",l)}},d=()=>{const e={};if(""!==t.theme&&(e.theme=t.theme),t.readOnly&&(e.readOnly=t.readOnly),t.placeholder&&(e.placeholder=t.placeholder),t.toolbar&&""!==t.toolbar&&(e.modules={toolbar:(()=>{if("object"==typeof t.toolbar)return t.toolbar;if("string"==typeof t.toolbar){return"#"===t.toolbar.charAt(0)?t.toolbar:Ki[t.toolbar]}})()}),t.modules){const n=(()=>{var e,n;const r={};if(Array.isArray(t.modules))for(const s of t.modules)r[s.name]=null!==(e=s.options)&&void 0!==e?e:{};else r[t.modules.name]=null!==(n=t.modules.options)&&void 0!==n?n:{};return r})();e.modules=Object.assign({},e.modules,n)}return Object.assign({},t.globalOptions,t.options,e)},f=t=>"object"==typeof t&&t?t.slice():t,p=()=>null==l?void 0:l.getModule("toolbar");let g;const m=t=>{if(typeof g==typeof t){if(t===g)return!0;if("object"==typeof t&&t&&"object"==typeof g&&g)return e=g.diff(t),!Object.values(e.ops).some(t=>!t.retain||1!==Object.keys(t).length)}var e;return!1},b=(n,r,s)=>{g=f(N()),m(t.content)||e.emit("update:content",g),e.emit("textChange",{delta:n,oldContents:r,source:s})},y=s(),v=(t,n,r)=>{y.value=!!(null==l?void 0:l.hasFocus()),e.emit("selectionChange",{range:t,oldRange:n,source:r})};i(y,t=>{e.emit(t?"focus":"blur",c)});const x=(...t)=>{"text-change"===t[0]&&e.emit("editorChange",{name:t[0],delta:t[1],oldContents:t[2],source:t[3]}),"selection-change"===t[0]&&e.emit("editorChange",{name:t[0],range:t[1],oldRange:t[2],source:t[3]})},N=(e,n)=>"html"===t.contentType?q():"text"===t.contentType?w(e,n):null==l?void 0:l.getContents(e,n),E=(e,n="api")=>{const r=e||("delta"===t.contentType?new tr:"");"html"===t.contentType?k(r):"text"===t.contentType?A(r,n):null==l||l.setContents(r,n),g=f(r)},w=(t,e)=>{var n;return null!==(n=null==l?void 0:l.getText(t,e))&&void 0!==n?n:""},A=(t,e="api")=>{null==l||l.setText(t,e)},q=()=>{var t;return null!==(t=null==l?void 0:l.root.innerHTML)&&void 0!==t?t:""},k=t=>{l&&(l.root.innerHTML=t)};return i(()=>t.content,t=>{if(!l||!t||m(t))return;const e=l.getSelection();e&&o(()=>null==l?void 0:l.setSelection(e)),E(t)},{deep:!0}),i(()=>t.enable,t=>{l&&l.enable(t)}),{editor:c,getEditor:()=>c.value,getToolbar:()=>{var t;return null===(t=p())||void 0===t?void 0:t.container},getQuill:()=>{if(l)return l;throw'The quill editor hasn\'t been instantiated yet,\n make sure to call this method when the editor ready\n or use v-on:ready="onReady(quill)" event instead.'},getContents:N,setContents:E,getHTML:q,setHTML:k,pasteHTML:(t,e="api")=>{const n=null==l?void 0:l.clipboard.convert({html:t});n&&(null==l||l.setContents(n,e))},focus:()=>{null==l||l.focus()},getText:w,setText:A,reinit:()=>{o(()=>{var t,n;!e.slots.toolbar&&l&&(null===(n=null===(t=p())||void 0===t?void 0:t.container)||void 0===n||n.remove()),h()})}}},render(){var t,n;return[null===(n=(t=this.$slots).toolbar)||void 0===n?void 0:n.call(t),e("div",{ref:"editor",...this.$attrs})]}});export{tr as Delta,Vr as Quill,Wi as QuillEditor};
12
+ import{defineComponent as t,h as e,onMounted as n,onBeforeUnmount as r,ref as s,watch as i,nextTick as o}from"vue";var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c,u,h={exports:{}};function d(){if(u)return c;u=1;var t=-1;function e(c,u,p,g,m){if(c===u)return c?[[0,c]]:[];if(null!=p){var b=function(t,e,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,s="number"==typeof n?null:n.newRange,i=t.length,o=e.length;if(0===r.length&&(null===s||0===s.length)){var l=r.index,a=t.slice(0,l),c=t.slice(l),u=s?s.index:null,h=l+o-i;if((null===u||u===h)&&!(h<0||h>o)){var d=e.slice(0,h);if((g=e.slice(h))===c){var f=Math.min(l,h);if((b=a.slice(0,f))===(x=d.slice(0,f)))return y(b,a.slice(f),d.slice(f),c)}}if(null===u||u===l){var p=l,g=(d=e.slice(0,p),e.slice(p));if(d===a){var m=Math.min(i-p,o-p);if((v=c.slice(c.length-m))===(N=g.slice(g.length-m)))return y(a,c.slice(0,c.length-m),g.slice(0,g.length-m),v)}}}if(r.length>0&&s&&0===s.length){var b=t.slice(0,r.index),v=t.slice(r.index+r.length);if(!(o<(f=b.length)+(m=v.length))){var x=e.slice(0,f),N=e.slice(o-m);if(b===x&&v===N)return y(b,t.slice(f,i-m),e.slice(f,o-m),v)}}return null}(c,u,p);if(b)return b}var v=r(c,u),x=c.substring(0,v);v=i(c=c.substring(v),u=u.substring(v));var N=c.substring(c.length-v),E=function(s,o){var l;if(!s)return[[1,o]];if(!o)return[[t,s]];var a=s.length>o.length?s:o,c=s.length>o.length?o:s,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],s.length>o.length&&(l[0][0]=l[2][0]=t),l;if(1===c.length)return[[t,s],[1,o]];var h=function(t,e){var n=t.length>e.length?t:e,s=t.length>e.length?e:t;if(n.length<4||2*s.length<n.length)return null;function o(t,e,n){for(var s,o,l,a,c=t.substring(n,n+Math.floor(t.length/4)),u=-1,h="";-1!==(u=e.indexOf(c,u+1));){var d=r(t.substring(n),e.substring(u)),f=i(t.substring(0,n),e.substring(0,u));h.length<f+d&&(h=e.substring(u-f,u)+e.substring(u,u+d),s=t.substring(0,n-f),o=t.substring(n+d),l=e.substring(0,u-f),a=e.substring(u+d))}return 2*h.length>=t.length?[s,o,l,a,h]:null}var l,a,c,u,h,d=o(n,s,Math.ceil(n.length/4)),f=o(n,s,Math.ceil(n.length/2));if(!d&&!f)return null;l=f?d&&d[4].length>f[4].length?d:f:d;t.length>e.length?(a=l[0],c=l[1],u=l[2],h=l[3]):(u=l[0],h=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,h,p]}(s,o);if(h){var d=h[1],f=h[3],p=h[4],g=e(h[0],h[2]),m=e(d,f);return g.concat([[0,p]],m)}return function(e,r){for(var s=e.length,i=r.length,o=Math.ceil((s+i)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),h=0;h<a;h++)c[h]=-1,u[h]=-1;c[l+1]=0,u[l+1]=0;for(var d=s-i,f=d%2!=0,p=0,g=0,m=0,b=0,y=0;y<o;y++){for(var v=-y+p;v<=y-g;v+=2){for(var x=l+v,N=(k=v===-y||v!==y&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-v;k<s&&N<i&&e.charAt(k)===r.charAt(N);)k++,N++;if(c[x]=k,k>s)g+=2;else if(N>i)p+=2;else if(f){if((A=l+d-v)>=0&&A<a&&-1!==u[A])if(k>=(w=s-u[A]))return n(e,r,k,N)}}for(var E=-y+m;E<=y-b;E+=2){for(var w,A=l+E,q=(w=E===-y||E!==y&&u[A-1]<u[A+1]?u[A+1]:u[A-1]+1)-E;w<s&&q<i&&e.charAt(s-w-1)===r.charAt(i-q-1);)w++,q++;if(u[A]=w,w>s)b+=2;else if(q>i)m+=2;else if(!f){if((x=l+d-E)>=0&&x<a&&-1!==c[x]){var k;N=l+(k=c[x])-x;if(k>=(w=s-w))return n(e,r,k,N)}}}}return[[t,e],[1,r]]}(s,o)}(c=c.substring(0,c.length-v),u=u.substring(0,u.length-v));return x&&E.unshift([0,x]),N&&E.push([0,N]),f(E,m),g&&function(e){var n=!1,r=[],c=0,u=null,p=0,g=0,m=0,b=0,y=0;for(;p<e.length;)0==e[p][0]?(r[c++]=p,g=b,m=y,b=0,y=0,u=e[p][1]):(1==e[p][0]?b+=e[p][1].length:y+=e[p][1].length,u&&u.length<=Math.max(g,m)&&u.length<=Math.max(b,y)&&(e.splice(r[c-1],0,[t,u]),e[r[c-1]+1][0]=1,c--,p=--c>0?r[c-1]:-1,g=0,m=0,b=0,y=0,u=null,n=!0)),p++;n&&f(e);(function(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.charAt(0),s=n.match(o),i=r.match(o),c=s&&n.match(l),u=i&&r.match(l),f=c&&n.match(a),p=u&&r.match(a),g=f&&t.match(h),m=p&&e.match(d);return g||m?5:f||p?4:s&&!c&&u?3:c||u?2:s||i?1:0}var n=1;for(;n<t.length-1;){if(0==t[n-1][0]&&0==t[n+1][0]){var r=t[n-1][1],s=t[n][1],c=t[n+1][1],u=i(r,s);if(u){var f=s.substring(s.length-u);r=r.substring(0,r.length-u),s=f+s.substring(0,s.length-u),c=f+c}for(var p=r,g=s,m=c,b=e(r,s)+e(s,c);s.charAt(0)===c.charAt(0);){r+=s.charAt(0),s=s.substring(1)+c.charAt(0),c=c.substring(1);var y=e(r,s)+e(s,c);y>=b&&(b=y,p=r,g=s,m=c)}t[n-1][1]!=p&&(p?t[n-1][1]=p:(t.splice(n-1,1),n--),t[n][1]=g,m?t[n+1][1]=m:(t.splice(n+1,1),n--))}n++}})(e),p=1;for(;p<e.length;){if(e[p-1][0]==t&&1==e[p][0]){var v=e[p-1][1],x=e[p][1],N=s(v,x),E=s(x,v);N>=E?(N>=v.length/2||N>=x.length/2)&&(e.splice(p,0,[0,x.substring(0,N)]),e[p-1][1]=v.substring(0,v.length-N),e[p+1][1]=x.substring(N),p++):(E>=v.length/2||E>=x.length/2)&&(e.splice(p,0,[0,v.substring(0,E)]),e[p-1][0]=1,e[p-1][1]=x.substring(0,x.length-E),e[p+1][0]=t,e[p+1][1]=v.substring(E),p++),p++}p++}}(E),E}function n(t,n,r,s){var i=t.substring(0,r),o=n.substring(0,s),l=t.substring(r),a=n.substring(s),c=e(i,o),u=e(l,a);return c.concat(u)}function r(t,e){if(!t||!e||t.charAt(0)!==e.charAt(0))return 0;for(var n=0,r=Math.min(t.length,e.length),s=r,i=0;n<s;)t.substring(i,s)==e.substring(i,s)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return p(t.charCodeAt(s-1))&&s--,s}function s(t,e){var n=t.length,r=e.length;if(0==n||0==r)return 0;n>r?t=t.substring(n-r):n<r&&(e=e.substring(0,n));var s=Math.min(n,r);if(t==e)return s;for(var i=0,o=1;;){var l=t.substring(s-o),a=e.indexOf(l);if(-1==a)return i;o+=a,0!=a&&t.substring(s-o)!=e.substring(0,o)||(i=o,o++)}}function i(t,e){if(!t||!e||t.slice(-1)!==e.slice(-1))return 0;for(var n=0,r=Math.min(t.length,e.length),s=r,i=0;n<s;)t.substring(t.length-s,t.length-i)==e.substring(e.length-s,e.length-i)?i=n=s:r=s,s=Math.floor((r-n)/2+n);return g(t.charCodeAt(t.length-s))&&s--,s}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,h=/\n\r?\n$/,d=/^\r?\n\r?\n/;function f(e,n){e.push([0,""]);for(var s,o=0,l=0,a=0,c="",u="";o<e.length;)if(o<e.length-1&&!e[o][1])e.splice(o,1);else switch(e[o][0]){case 1:a++,u+=e[o][1],o++;break;case t:l++,c+=e[o][1],o++;break;case 0:var h=o-a-l-1;if(n){if(h>=0&&b(e[h][1])){var d=e[h][1].slice(-1);if(e[h][1]=e[h][1].slice(0,-1),c=d+c,u=d+u,!e[h][1]){e.splice(h,1),o--;var p=h-1;e[p]&&1===e[p][0]&&(a++,u=e[p][1]+u,p--),e[p]&&e[p][0]===t&&(l++,c=e[p][1]+c,p--),h=p}}if(m(e[o][1])){d=e[o][1].charAt(0);e[o][1]=e[o][1].slice(1),c+=d,u+=d}}if(o<e.length-1&&!e[o][1]){e.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(s=r(u,c))&&(h>=0?e[h][1]+=u.substring(0,s):(e.splice(0,0,[0,u.substring(0,s)]),o++),u=u.substring(s),c=c.substring(s)),0!==(s=i(u,c))&&(e[o][1]=u.substring(u.length-s)+e[o][1],u=u.substring(0,u.length-s),c=c.substring(0,c.length-s)));var g=a+l;0===c.length&&0===u.length?(e.splice(o-g,g),o-=g):0===c.length?(e.splice(o-g,g,[1,u]),o=o-g+1):0===u.length?(e.splice(o-g,g,[t,c]),o=o-g+1):(e.splice(o-g,g,[t,c],[1,u]),o=o-g+2)}0!==o&&0===e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,a=0,l=0,c="",u=""}""===e[e.length-1][1]&&e.pop();var y=!1;for(o=1;o<e.length-1;)0===e[o-1][0]&&0===e[o+1][0]&&(e[o][1].substring(e[o][1].length-e[o-1][1].length)===e[o-1][1]?(e[o][1]=e[o-1][1]+e[o][1].substring(0,e[o][1].length-e[o-1][1].length),e[o+1][1]=e[o-1][1]+e[o+1][1],e.splice(o-1,1),y=!0):e[o][1].substring(0,e[o+1][1].length)==e[o+1][1]&&(e[o-1][1]+=e[o+1][1],e[o][1]=e[o][1].substring(e[o+1][1].length)+e[o+1][1],e.splice(o+1,1),y=!0)),o++;y&&f(e,n)}function p(t){return t>=55296&&t<=56319}function g(t){return t>=56320&&t<=57343}function m(t){return g(t.charCodeAt(0))}function b(t){return p(t.charCodeAt(t.length-1))}function y(e,n,r,s){return b(e)||m(s)?null:function(t){for(var e=[],n=0;n<t.length;n++)t[n][1].length>0&&e.push(t[n]);return e}([[0,e],[t,n],[1,r],[0,s]])}function v(t,n,r,s){return e(t,n,r,s,!0)}return v.INSERT=1,v.DELETE=t,v.EQUAL=0,c=v}var f,p={exports:{}};function g(){return f||(f=1,function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Boolean]",o="[object Date]",a="[object Function]",c="[object GeneratorFunction]",u="[object Map]",h="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",g="[object Set]",m="[object String]",b="[object Symbol]",y="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",N="[object Float32Array]",E="[object Float64Array]",w="[object Int8Array]",A="[object Int16Array]",q="[object Int32Array]",k="[object Uint8Array]",_="[object Uint8ClampedArray]",L="[object Uint16Array]",O="[object Uint32Array]",T=/\w*$/,S=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,C={};C[s]=C["[object Array]"]=C[v]=C[x]=C[i]=C[o]=C[N]=C[E]=C[w]=C[A]=C[q]=C[u]=C[h]=C[d]=C[p]=C[g]=C[m]=C[b]=C[k]=C[_]=C[L]=C[O]=!0,C["[object Error]"]=C[a]=C[y]=!1;var R="object"==typeof self&&self&&self.Object===Object&&self,I="object"==typeof l&&l&&l.Object===Object&&l||R||Function("return this")(),M=e&&!e.nodeType&&e,B=M&&t&&!t.nodeType&&t,D=B&&B.exports===M;function U(t,e){return t.set(e[0],e[1]),t}function P(t,e){return t.add(e),t}function z(t,e,n,r){for(var s=-1,i=t?t.length:0;++s<i;)n=e(n,t[s],s,t);return n}function H(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(n){}return e}function F(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function $(t,e){return function(n){return t(e(n))}}function V(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var K,W=Array.prototype,Z=Function.prototype,G=Object.prototype,Q=I["__core-js_shared__"],X=(K=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",Y=Z.toString,J=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+Y.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=D?I.Buffer:void 0,rt=I.Symbol,st=I.Uint8Array,it=$(Object.getPrototypeOf,Object),ot=Object.create,lt=G.propertyIsEnumerable,at=W.splice,ct=Object.getOwnPropertySymbols,ut=nt?nt.isBuffer:void 0,ht=$(Object.keys,Object),dt=Bt(I,"DataView"),ft=Bt(I,"Map"),pt=Bt(I,"Promise"),gt=Bt(I,"Set"),mt=Bt(I,"WeakMap"),bt=Bt(Object,"create"),yt=Ht(dt),vt=Ht(ft),xt=Ht(pt),Nt=Ht(gt),Et=Ht(mt),wt=rt?rt.prototype:void 0,At=wt?wt.valueOf:void 0;function qt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function kt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function _t(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Lt(t){this.__data__=new kt(t)}function Ot(t,e){var n=$t(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Vt(t)}(t)&&J.call(t,"callee")&&(!lt.call(t,"callee")||tt.call(t)==s)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var o in t)!J.call(t,o)||i&&("length"==o||Pt(o,r))||n.push(o);return n}function Tt(t,e,n){var r=t[e];J.call(t,e)&&Ft(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function St(t,e){for(var n=t.length;n--;)if(Ft(t[n][0],e))return n;return-1}function jt(t,e,n,r,l,f,y){var S;if(r&&(S=f?r(t,l,f,y):r(t)),void 0!==S)return S;if(!Zt(t))return t;var j=$t(t);if(j){if(S=function(t){var e=t.length,n=t.constructor(e);e&&"string"==typeof t[0]&&J.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!e)return function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(t,S)}else{var R=Ut(t),I=R==a||R==c;if(Kt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(R==d||R==s||I&&!f){if(H(t))return f?t:{};if(S=function(t){return"function"!=typeof t.constructor||zt(t)?{}:(e=it(t),Zt(e)?ot(e):{});var e}(I?{}:t),!e)return function(t,e){return It(t,Dt(t),e)}(t,function(t,e){return t&&It(e,Gt(e),t)}(S,t))}else{if(!C[R])return f?t:{};S=function(t,e,n,r){var s=t.constructor;switch(e){case v:return Rt(t);case i:case o:return new s(+t);case x:return function(t,e){var n=e?Rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case N:case E:case w:case A:case q:case k:case _:case L:case O:return function(t,e){var n=e?Rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case u:return function(t,e,n){var r=e?n(F(t),!0):F(t);return z(r,U,new t.constructor)}(t,r,n);case h:case m:return new s(t);case p:return function(t){var e=new t.constructor(t.source,T.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,n){var r=e?n(V(t),!0):V(t);return z(r,P,new t.constructor)}(t,r,n);case b:return l=t,At?Object(At.call(l)):{}}var l}(t,R,jt,e)}}y||(y=new Lt);var M=y.get(t);if(M)return M;if(y.set(t,S),!j)var B=n?function(t){return function(t,e,n){var r=e(t);return $t(t)?r:function(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}(r,n(t))}(t,Gt,Dt)}(t):Gt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n,t););}(B||t,function(s,i){B&&(s=t[i=s]),Tt(S,i,jt(s,e,n,r,i,t,y))}),S}function Ct(t){return!(!Zt(t)||(e=t,X&&X in e))&&(Wt(t)||H(t)?et:S).test(Ht(t));var e}function Rt(t){var e=new t.constructor(t.byteLength);return new st(e).set(new st(t)),e}function It(t,e,n,r){n||(n={});for(var s=-1,i=e.length;++s<i;){var o=e[s];Tt(n,o,t[o])}return n}function Mt(t,e){var n,r,s=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof e?"string":"hash"]:s.map}function Bt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ct(n)?n:void 0}qt.prototype.clear=function(){this.__data__=bt?bt(null):{}},qt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},qt.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return J.call(e,t)?e[t]:void 0},qt.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:J.call(e,t)},qt.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},kt.prototype.clear=function(){this.__data__=[]},kt.prototype.delete=function(t){var e=this.__data__,n=St(e,t);return!(n<0)&&(n==e.length-1?e.pop():at.call(e,n,1),!0)},kt.prototype.get=function(t){var e=this.__data__,n=St(e,t);return n<0?void 0:e[n][1]},kt.prototype.has=function(t){return St(this.__data__,t)>-1},kt.prototype.set=function(t,e){var n=this.__data__,r=St(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},_t.prototype.clear=function(){this.__data__={hash:new qt,map:new(ft||kt),string:new qt}},_t.prototype.delete=function(t){return Mt(this,t).delete(t)},_t.prototype.get=function(t){return Mt(this,t).get(t)},_t.prototype.has=function(t){return Mt(this,t).has(t)},_t.prototype.set=function(t,e){return Mt(this,t).set(t,e),this},Lt.prototype.clear=function(){this.__data__=new kt},Lt.prototype.delete=function(t){return this.__data__.delete(t)},Lt.prototype.get=function(t){return this.__data__.get(t)},Lt.prototype.has=function(t){return this.__data__.has(t)},Lt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof kt){var r=n.__data__;if(!ft||r.length<199)return r.push([t,e]),this;n=this.__data__=new _t(r)}return n.set(t,e),this};var Dt=ct?$(ct,Object):function(){return[]},Ut=function(t){return tt.call(t)};function Pt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||j.test(t))&&t>-1&&t%1==0&&t<e}function zt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function Ht(t){if(null!=t){try{return Y.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Ft(t,e){return t===e||t!=t&&e!=e}(dt&&Ut(new dt(new ArrayBuffer(1)))!=x||ft&&Ut(new ft)!=u||pt&&Ut(pt.resolve())!=f||gt&&Ut(new gt)!=g||mt&&Ut(new mt)!=y)&&(Ut=function(t){var e=tt.call(t),n=e==d?t.constructor:void 0,r=n?Ht(n):void 0;if(r)switch(r){case yt:return x;case vt:return u;case xt:return f;case Nt:return g;case Et:return y}return e});var $t=Array.isArray;function Vt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Wt(t)}var Kt=ut||function(){return!1};function Wt(t){var e=Zt(t)?tt.call(t):"";return e==a||e==c}function Zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Vt(t)?Ot(t):function(t){if(!zt(t))return ht(t);var e=[];for(var n in Object(t))J.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return jt(t,!0,!0)}}(p,p.exports)),p.exports}var m,b={exports:{}};function y(){return m||(m=1,function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,s="[object Arguments]",i="[object Array]",o="[object Boolean]",a="[object Date]",c="[object Error]",u="[object Function]",h="[object Map]",d="[object Number]",f="[object Object]",p="[object Promise]",g="[object RegExp]",m="[object Set]",b="[object String]",y="[object Symbol]",v="[object WeakMap]",x="[object ArrayBuffer]",N="[object DataView]",E=/^\[object .+?Constructor\]$/,w=/^(?:0|[1-9]\d*)$/,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A[s]=A[i]=A[x]=A[o]=A[N]=A[a]=A[c]=A[u]=A[h]=A[d]=A[f]=A[g]=A[m]=A[b]=A[v]=!1;var q="object"==typeof l&&l&&l.Object===Object&&l,k="object"==typeof self&&self&&self.Object===Object&&self,_=q||k||Function("return this")(),L=e&&!e.nodeType&&e,O=L&&t&&!t.nodeType&&t,T=O&&O.exports===L,S=T&&q.process,j=function(){try{return S&&S.binding&&S.binding("util")}catch(t){}}(),C=j&&j.isTypedArray;function R(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function I(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function M(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var B,D,U,P=Array.prototype,z=Object.prototype,H=_["__core-js_shared__"],F=Function.prototype.toString,$=z.hasOwnProperty,V=(B=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"",K=z.toString,W=RegExp("^"+F.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Z=T?_.Buffer:void 0,G=_.Symbol,Q=_.Uint8Array,X=z.propertyIsEnumerable,Y=P.splice,J=G?G.toStringTag:void 0,tt=Object.getOwnPropertySymbols,et=Z?Z.isBuffer:void 0,nt=(D=Object.keys,U=Object,function(t){return D(U(t))}),rt=St(_,"DataView"),st=St(_,"Map"),it=St(_,"Promise"),ot=St(_,"Set"),lt=St(_,"WeakMap"),at=St(Object,"create"),ct=It(rt),ut=It(st),ht=It(it),dt=It(ot),ft=It(lt),pt=G?G.prototype:void 0,gt=pt?pt.valueOf:void 0;function mt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function bt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function yt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function vt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new yt;++e<n;)this.add(t[e])}function xt(t){var e=this.__data__=new bt(t);this.size=e.size}function Nt(t,e){var n=Dt(t),r=!n&&Bt(t),s=!n&&!r&&Ut(t),i=!n&&!r&&!s&&$t(t),o=n||r||s||i,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!$.call(t,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Rt(c,a))||l.push(c);return l}function Et(t,e){for(var n=t.length;n--;)if(Mt(t[n][0],e))return n;return-1}function wt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":J&&J in Object(t)?function(t){var e=$.call(t,J),n=t[J];try{t[J]=void 0;var r=!0}catch(i){}var s=K.call(t);r&&(e?t[J]=n:delete t[J]);return s}(t):function(t){return K.call(t)}(t)}function At(t){return Ft(t)&&wt(t)==s}function qt(t,e,n,r,l){return t===e||(null==t||null==e||!Ft(t)&&!Ft(e)?t!=t&&e!=e:function(t,e,n,r,l,u){var p=Dt(t),v=Dt(e),E=p?i:Ct(t),w=v?i:Ct(e),A=(E=E==s?f:E)==f,q=(w=w==s?f:w)==f,k=E==w;if(k&&Ut(t)){if(!Ut(e))return!1;p=!0,A=!1}if(k&&!A)return u||(u=new xt),p||$t(t)?Lt(t,e,n,r,l,u):function(t,e,n,r,s,i,l){switch(n){case N:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!i(new Q(t),new Q(e)));case o:case a:case d:return Mt(+t,+e);case c:return t.name==e.name&&t.message==e.message;case g:case b:return t==e+"";case h:var u=I;case m:if(u||(u=M),t.size!=e.size&&!(1&r))return!1;var f=l.get(t);if(f)return f==e;r|=2,l.set(t,e);var p=Lt(u(t),u(e),r,s,i,l);return l.delete(t),p;case y:if(gt)return gt.call(t)==gt.call(e)}return!1}(t,e,E,n,r,l,u);if(!(1&n)){var _=A&&$.call(t,"__wrapped__"),L=q&&$.call(e,"__wrapped__");if(_||L){var O=_?t.value():t,T=L?e.value():e;return u||(u=new xt),l(O,T,n,r,u)}}if(!k)return!1;return u||(u=new xt),function(t,e,n,r,s,i){var o=1&n,l=Ot(t),a=l.length,c=Ot(e);if(a!=c.length&&!o)return!1;var u=a;for(;u--;){var h=l[u];if(!(o?h in e:$.call(e,h)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var f=!0;i.set(t,e),i.set(e,t);var p=o;for(;++u<a;){var g=t[h=l[u]],m=e[h];if(r)var b=o?r(m,g,h,e,t,i):r(g,m,h,t,e,i);if(!(void 0===b?g===m||s(g,m,n,r,i):b)){f=!1;break}p||(p="constructor"==h)}if(f&&!p){var y=t.constructor,v=e.constructor;y==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,n,r,l,u)}(t,e,n,r,qt,l))}function kt(t){return!(!Ht(t)||function(t){return!!V&&V in t}(t))&&(Pt(t)?W:E).test(It(t))}function _t(t){if((e=t)!==("function"==typeof(n=e&&e.constructor)&&n.prototype||z))return nt(t);var e,n,r=[];for(var s in Object(t))$.call(t,s)&&"constructor"!=s&&r.push(s);return r}function Lt(t,e,n,r,s,i){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var u=-1,h=!0,d=2&n?new vt:void 0;for(i.set(t,e),i.set(e,t);++u<l;){var f=t[u],p=e[u];if(r)var g=o?r(p,f,u,e,t,i):r(f,p,u,t,e,i);if(void 0!==g){if(g)continue;h=!1;break}if(d){if(!R(e,function(t,e){if(!d.has(e)&&(f===t||s(f,t,n,r,i)))return d.push(e)})){h=!1;break}}else if(f!==p&&!s(f,p,n,r,i)){h=!1;break}}return i.delete(t),i.delete(e),h}function Ot(t){return function(t,e,n){var r=e(t);return Dt(t)?r:function(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}(r,n(t))}(t,Vt,jt)}function Tt(t,e){var n,r,s=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof e?"string":"hash"]:s.map}function St(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return kt(n)?n:void 0}mt.prototype.clear=function(){this.__data__=at?at(null):{},this.size=0},mt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},mt.prototype.get=function(t){var e=this.__data__;if(at){var r=e[t];return r===n?void 0:r}return $.call(e,t)?e[t]:void 0},mt.prototype.has=function(t){var e=this.__data__;return at?void 0!==e[t]:$.call(e,t)},mt.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=at&&void 0===e?n:e,this},bt.prototype.clear=function(){this.__data__=[],this.size=0},bt.prototype.delete=function(t){var e=this.__data__,n=Et(e,t);return!(n<0)&&(n==e.length-1?e.pop():Y.call(e,n,1),--this.size,!0)},bt.prototype.get=function(t){var e=this.__data__,n=Et(e,t);return n<0?void 0:e[n][1]},bt.prototype.has=function(t){return Et(this.__data__,t)>-1},bt.prototype.set=function(t,e){var n=this.__data__,r=Et(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},yt.prototype.clear=function(){this.size=0,this.__data__={hash:new mt,map:new(st||bt),string:new mt}},yt.prototype.delete=function(t){var e=Tt(this,t).delete(t);return this.size-=e?1:0,e},yt.prototype.get=function(t){return Tt(this,t).get(t)},yt.prototype.has=function(t){return Tt(this,t).has(t)},yt.prototype.set=function(t,e){var n=Tt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},vt.prototype.add=vt.prototype.push=function(t){return this.__data__.set(t,n),this},vt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.clear=function(){this.__data__=new bt,this.size=0},xt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},xt.prototype.get=function(t){return this.__data__.get(t)},xt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof bt){var r=n.__data__;if(!st||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new yt(r)}return n.set(t,e),this.size=n.size,this};var jt=tt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}(tt(t),function(e){return X.call(t,e)}))}:function(){return[]},Ct=wt;function Rt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||w.test(t))&&t>-1&&t%1==0&&t<e}function It(t){if(null!=t){try{return F.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Mt(t,e){return t===e||t!=t&&e!=e}(rt&&Ct(new rt(new ArrayBuffer(1)))!=N||st&&Ct(new st)!=h||it&&Ct(it.resolve())!=p||ot&&Ct(new ot)!=m||lt&&Ct(new lt)!=v)&&(Ct=function(t){var e=wt(t),n=e==f?t.constructor:void 0,r=n?It(n):"";if(r)switch(r){case ct:return N;case ut:return h;case ht:return p;case dt:return m;case ft:return v}return e});var Bt=At(function(){return arguments}())?At:function(t){return Ft(t)&&$.call(t,"callee")&&!X.call(t,"callee")},Dt=Array.isArray;var Ut=et||function(){return!1};function Pt(t){if(!Ht(t))return!1;var e=wt(t);return e==u||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function zt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function Ht(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ft(t){return null!=t&&"object"==typeof t}var $t=C?function(t){return function(e){return t(e)}}(C):function(t){return Ft(t)&&zt(t.length)&&!!A[wt(t)]};function Vt(t){return null!=(e=t)&&zt(e.length)&&!Pt(e)?Nt(t):_t(t);var e}t.exports=function(t,e){return qt(t,e)}}(b,b.exports)),b.exports}var v,x={};function N(){if(v)return x;v=1,Object.defineProperty(x,"__esModule",{value:!0});const t=g(),e=y();var n;return function(n){n.compose=function(e={},n={},r=!1){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});let s=t(n);r||(s=Object.keys(s).reduce((t,e)=>(null!=s[e]&&(t[e]=s[e]),t),{}));for(const t in e)void 0!==e[t]&&void 0===n[t]&&(s[t]=e[t]);return Object.keys(s).length>0?s:void 0},n.diff=function(t={},n={}){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});const r=Object.keys(t).concat(Object.keys(n)).reduce((r,s)=>(e(t[s],n[s])||(r[s]=void 0===n[s]?null:n[s]),r),{});return Object.keys(r).length>0?r:void 0},n.invert=function(t={},e={}){t=t||{};const n=Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0!==t[r]&&(n[r]=e[r]),n),{});return Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0===e[r]&&(n[r]=null),n),n)},n.transform=function(t,e,n=!1){if("object"!=typeof t)return e;if("object"!=typeof e)return;if(!n)return e;const r=Object.keys(e).reduce((n,r)=>(void 0===t[r]&&(n[r]=e[r]),n),{});return Object.keys(r).length>0?r:void 0}}(n||(n={})),x.default=n,x}var E,w={};function A(){return E||(E=1,Object.defineProperty(w,"__esModule",{value:!0}),function(t){t.length=function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"object"==typeof t.retain&&null!==t.retain?1:"string"==typeof t.insert?t.insert.length:1}}(t||(t={})),w.default=t),w;var t}var q,k,_={};function L(){if(q)return _;q=1,Object.defineProperty(_,"__esModule",{value:!0});const t=A();return _.default=class{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);const n=this.ops[this.index];if(n){const r=this.offset,s=t.default.length(n);if(e>=s-r?(e=s-r,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof n.delete)return{delete:e};{const t={};return n.attributes&&(t.attributes=n.attributes),"number"==typeof n.retain?t.retain=e:"object"==typeof n.retain&&null!==n.retain?t.retain=n.retain:t.insert="string"==typeof n.insert?n.insert.substr(r,e):n.insert,t}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?t.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?"number"==typeof t.delete?"delete":"number"==typeof t.retain||"object"==typeof t.retain&&null!==t.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const t=this.offset,e=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=t,this.index=e,[n].concat(r)}}return[]}},_}function O(){return k||(k=1,function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.Op=void 0;const n=d(),r=g(),s=y(),i=N();e.AttributeMap=i.default;const o=A();e.Op=o.default;const l=L();e.OpIterator=l.default;const a=String.fromCharCode(0),c=(t,e)=>{if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);const n=Object.keys(t)[0];if(!n||n!==Object.keys(e)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(e)[0]}`);return[n,t[n],e[n]]};class u{constructor(t){this.ops=Array.isArray(t)?t:null!=t&&Array.isArray(t.ops)?t.ops:[]}static registerEmbed(t,e){this.handlers[t]=e}static unregisterEmbed(t){delete this.handlers[t]}static getHandler(t){const e=this.handlers[t];if(!e)throw new Error(`no handlers for embed type "${t}"`);return e}insert(t,e){const n={};return"string"==typeof t&&0===t.length?this:(n.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))}delete(t){return t<=0?this:this.push({delete:t})}retain(t,e){if("number"==typeof t&&t<=0)return this;const n={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)}push(t){let e=this.ops.length,n=this.ops[e-1];if(t=r(t),"object"==typeof n){if("number"==typeof t.delete&&"number"==typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"==typeof n.delete&&null!=t.insert&&(e-=1,n=this.ops[e-1],"object"!=typeof n))return this.ops.unshift(t),this;if(s(t.attributes,n.attributes)){if("string"==typeof t.insert&&"string"==typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this}chop(){const t=this.ops[this.ops.length-1];return t&&"number"==typeof t.retain&&!t.attributes&&this.ops.pop(),this}filter(t){return this.ops.filter(t)}forEach(t){this.ops.forEach(t)}map(t){return this.ops.map(t)}partition(t){const e=[],n=[];return this.forEach(r=>{(t(r)?e:n).push(r)}),[e,n]}reduce(t,e){return this.ops.reduce(t,e)}changeLength(){return this.reduce((t,e)=>e.insert?t+o.default.length(e):e.delete?t-e.delete:t,0)}length(){return this.reduce((t,e)=>t+o.default.length(e),0)}slice(t=0,e=1/0){const n=[],r=new l.default(this.ops);let s=0;for(;s<e&&r.hasNext();){let i;s<t?i=r.next(t-s):(i=r.next(e-s),n.push(i)),s+=o.default.length(i)}return new u(n)}compose(t){const e=new l.default(this.ops),n=new l.default(t.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let t=o.retain;for(;"insert"===e.peekType()&&e.peekLength()<=t;)t-=e.peekLength(),r.push(e.next());o.retain-t>0&&n.next(o.retain-t)}const a=new u(r);for(;e.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===e.peekType())a.push(e.next());else{const t=Math.min(e.peekLength(),n.peekLength()),r=e.next(t),o=n.next(t);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?t:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const t=null==r.retain?"insert":"retain",[e,n,s]=c(r[t],o.retain),i=u.getHandler(e);l[t]={[e]:i.compose(n,s,"retain"===t)}}const h=i.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(h&&(l.attributes=h),a.push(l),!n.hasNext()&&s(a.ops[a.ops.length-1],l)){const t=new u(e.rest());return a.concat(t).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(t){const e=new u(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e}diff(t,e){if(this.ops===t.ops)return new u;const r=[this,t].map(e=>e.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],e,!0),h=new l.default(this.ops),d=new l.default(t.ops);return c.forEach(t=>{let e=t[1].length;for(;e>0;){let r=0;switch(t[0]){case n.INSERT:r=Math.min(d.peekLength(),e),o.push(d.next(r));break;case n.DELETE:r=Math.min(e,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),d.peekLength(),e);const t=h.next(r),l=d.next(r);s(t.insert,l.insert)?o.retain(r,i.default.diff(t.attributes,l.attributes)):o.push(l).delete(r)}e-=r}}),o.chop()}eachLine(t,e="\n"){const n=new l.default(this.ops);let r=new u,s=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const i=n.peek(),l=o.default.length(i)-n.peekLength(),a="string"==typeof i.insert?i.insert.indexOf(e,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===t(r,n.next(1).attributes||{},s))return;s+=1,r=new u}}r.length()>0&&t(r,{},s)}invert(t){const e=new u;return this.reduce((n,r)=>{if(r.insert)e.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return e.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const s=r.delete||r.retain;return t.slice(n,n+s).forEach(t=>{r.delete?e.push(t):r.retain&&r.attributes&&e.retain(o.default.length(t),i.default.invert(r.attributes,t.attributes))}),n+s}if("object"==typeof r.retain&&null!==r.retain){const s=t.slice(n,n+1),o=new l.default(s.ops).next(),[a,h,d]=c(r.retain,o.insert),f=u.getHandler(a);return e.retain({[a]:f.invert(h,d)},i.default.invert(r.attributes,o.attributes)),n+1}}return n},0),e.chop()}transform(t,e=!1){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);const n=t,r=new l.default(this.ops),s=new l.default(n.ops),a=new u;for(;r.hasNext()||s.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===s.peekType())if("insert"===s.peekType())a.push(s.next());else{const t=Math.min(r.peekLength(),s.peekLength()),n=r.next(t),o=s.next(t);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,s=o.retain;let l="object"==typeof s&&null!==s?s:t;if("object"==typeof r&&null!==r&&"object"==typeof s&&null!==s){const t=Object.keys(r)[0];if(t===Object.keys(s)[0]){const n=u.getHandler(t);n&&(l={[t]:n.transform(r[t],s[t],e)})}}a.retain(l,i.default.transform(n.attributes,o.attributes,e))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(t,e=!1){e=!!e;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=t;){const s=n.peekLength(),i=n.peekType();n.next(),"delete"!==i?("insert"===i&&(r<t||!e)&&(t+=s),r+=s):t-=Math.min(s,t-r)}return t}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=i.default,u.handlers={},e.default=u,t.exports=u,t.exports.default=u}(h,h.exports)),h.exports}var T=O(),S=a(T);const j={essential:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}],["blockquote","code-block","link"],[{color:[]},"clean"]],minimal:[[{header:1},{header:2}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}]],full:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["link","video","image"],["clean"]]};let C,R,I=[];const M=()=>"undefined"!=typeof document,B=async()=>{if(C)return C;if(!M())throw new Error("@vueup/vue-quill: Quill can only be loaded in a browser environment.");return null!=R||(R=Promise.resolve().then(function(){return no}).then(({default:t})=>(C=t,(t=>{const e=I;I=[];for(const n of e)t.register(...n)})(t),t))),R},D=()=>C,U=()=>{if(C)return C;throw new Error("@vueup/vue-quill: Quill is not loaded yet. Use loadQuill() in a browser-only lifecycle hook, or access the Quill instance from the ready event.")},P=new Proxy(function(){},{get(t,e){if("register"===e)return(...t)=>{if(C)return C.register(...t);I.push(t),M()&&B()};const n=U(),r=n[e];return"function"==typeof r?r.bind(n):r},construct:(t,e)=>new(U())(...e)}),z=t({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object]},contentType:{type:String,default:"delta",validator:t=>["delta","html","text"].includes(t)},enable:{type:Boolean,default:!0},readOnly:{type:Boolean,default:!1},placeholder:{type:String,required:!1},theme:{type:String,default:"snow",validator:t=>["snow","bubble",""].includes(t)},toolbar:{type:[String,Array,Object],required:!1,validator:t=>"string"!=typeof t||""===t||("#"===t.charAt(0)||-1!==Object.keys(j).indexOf(t))},modules:{type:Object,required:!1},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready"],setup:(t,e)=>{n(()=>{c=!1,d()}),r(()=>{l=null,c=!0});let l,a,c=!1;const u=s(),h=(t,e,n)=>{const r=t.imports;r&&e in r||t.register(e,n)},d=async()=>{var n,r;if(!u.value)return;const s=u.value,i=await B();if(!c&&u.value&&u.value===s){if(a=f(),t.modules)if(Array.isArray(t.modules))for(const e of t.modules)h(i,`modules/${e.name}`,e.module);else h(i,`modules/${t.modules.name}`,t.modules.module);l=new i(u.value,a),w(t.content),l.on("text-change",y),l.on("selection-change",x),l.on("editor-change",N),"bubble"!==t.theme&&u.value.classList.remove("ql-bubble"),"snow"!==t.theme&&u.value.classList.remove("ql-snow"),null===(r=null===(n=g())||void 0===n?void 0:n.container)||void 0===r||r.addEventListener("mousedown",t=>{t.preventDefault()}),e.emit("ready",l)}},f=()=>{const e={};if(""!==t.theme&&(e.theme=t.theme),t.readOnly&&(e.readOnly=t.readOnly),t.placeholder&&(e.placeholder=t.placeholder),t.toolbar&&""!==t.toolbar&&(e.modules={toolbar:(()=>{if("object"==typeof t.toolbar)return t.toolbar;if("string"==typeof t.toolbar){return"#"===t.toolbar.charAt(0)?t.toolbar:j[t.toolbar]}})()}),t.modules){const n=(()=>{var e,n;const r={};if(Array.isArray(t.modules))for(const s of t.modules)r[s.name]=null!==(e=s.options)&&void 0!==e?e:{};else r[t.modules.name]=null!==(n=t.modules.options)&&void 0!==n?n:{};return r})();e.modules=Object.assign({},e.modules,n)}return Object.assign({},t.globalOptions,t.options,e)},p=t=>"object"==typeof t&&t?t.slice():t,g=()=>null==l?void 0:l.getModule("toolbar");let m;const b=t=>{if(typeof m==typeof t){if(t===m)return!0;if("object"==typeof t&&t&&"object"==typeof m&&m)return e=m.diff(t),!Object.values(e.ops).some(t=>!t.retain||1!==Object.keys(t).length)}var e;return!1},y=(n,r,s)=>{m=p(E()),b(t.content)||e.emit("update:content",m),e.emit("textChange",{delta:n,oldContents:r,source:s})},v=s(),x=(t,n,r)=>{v.value=!!(null==l?void 0:l.hasFocus()),e.emit("selectionChange",{range:t,oldRange:n,source:r})};i(v,t=>{e.emit(t?"focus":"blur",u)});const N=(...t)=>{"text-change"===t[0]&&e.emit("editorChange",{name:t[0],delta:t[1],oldContents:t[2],source:t[3]}),"selection-change"===t[0]&&e.emit("editorChange",{name:t[0],range:t[1],oldRange:t[2],source:t[3]})},E=(e,n)=>"html"===t.contentType?k():"text"===t.contentType?A(e,n):null==l?void 0:l.getContents(e,n),w=(e,n="api")=>{const r=e||("delta"===t.contentType?new S:"");"html"===t.contentType?_(r):"text"===t.contentType?q(r,n):null==l||l.setContents(r,n),m=p(r)},A=(t,e)=>{var n;return null!==(n=null==l?void 0:l.getText(t,e))&&void 0!==n?n:""},q=(t,e="api")=>{null==l||l.setText(t,e)},k=()=>{var t;return null!==(t=null==l?void 0:l.root.innerHTML)&&void 0!==t?t:""},_=t=>{l&&(l.root.innerHTML=t)};return i(()=>t.content,t=>{if(!l||!t||b(t))return;const e=l.getSelection();e&&o(()=>null==l?void 0:l.setSelection(e)),w(t)},{deep:!0}),i(()=>t.enable,t=>{l&&l.enable(t)}),{editor:u,getEditor:()=>u.value,getToolbar:()=>{var t;return null===(t=g())||void 0===t?void 0:t.container},getQuill:()=>{if(l)return l;throw'The quill editor hasn\'t been instantiated yet,\n make sure to call this method when the editor ready\n or use v-on:ready="onReady(quill)" event instead.'},getContents:E,setContents:w,getHTML:k,setHTML:_,pasteHTML:(t,e="api")=>{const n=null==l?void 0:l.clipboard.convert({html:t});n&&(null==l||l.setContents(n,e))},focus:()=>{null==l||l.focus()},getText:A,setText:q,reinit:()=>{o(()=>{var t,n;!e.slots.toolbar&&l&&(null===(n=null===(t=g())||void 0===t?void 0:t.container)||void 0===n||n.remove()),d()})}}},render(){var t,n;return[null===(n=(t=this.$slots).toolbar)||void 0===n?void 0:n.call(t),e("div",{ref:"editor",...this.$attrs})]}});var H="object"==typeof global&&global&&global.Object===Object&&global,F="object"==typeof self&&self&&self.Object===Object&&self,$=H||F||Function("return this")(),V=$.Symbol,K=Object.prototype,W=K.hasOwnProperty,Z=K.toString,G=V?V.toStringTag:void 0;var Q=Object.prototype.toString;var X=V?V.toStringTag:void 0;function Y(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":X&&X in Object(t)?function(t){var e=W.call(t,G),n=t[G];try{t[G]=void 0;var r=!0}catch(i){}var s=Z.call(t);return r&&(e?t[G]=n:delete t[G]),s}(t):function(t){return Q.call(t)}(t)}function J(t){return null!=t&&"object"==typeof t}var tt=Array.isArray;function et(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function nt(t){return t}function rt(t){if(!et(t))return!1;var e=Y(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var st,it=$["__core-js_shared__"],ot=(st=/[^.]+$/.exec(it&&it.keys&&it.keys.IE_PROTO||""))?"Symbol(src)_1."+st:"";var lt=Function.prototype.toString;function at(t){if(null!=t){try{return lt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var ct=/^\[object .+?Constructor\]$/,ut=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ht(t){return!(!et(t)||(e=t,ot&&ot in e))&&(rt(t)?ut:ct).test(at(t));var e}function dt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return ht(n)?n:void 0}var ft=dt($,"WeakMap"),pt=Object.create,gt=function(){function t(){}return function(e){if(!et(e))return{};if(pt)return pt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var mt=Date.now;var bt,yt,vt,xt=function(){try{var t=dt(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),Nt=xt?function(t,e){return xt(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:nt,Et=(bt=Nt,yt=0,vt=0,function(){var t=mt(),e=16-(t-vt);if(vt=t,e>0){if(++yt>=800)return arguments[0]}else yt=0;return bt.apply(void 0,arguments)});var wt=/^(?:0|[1-9]\d*)$/;function At(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&wt.test(t))&&t>-1&&t%1==0&&t<e}function qt(t,e,n){"__proto__"==e&&xt?xt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function kt(t,e){return t===e||t!=t&&e!=e}var _t=Object.prototype.hasOwnProperty;function Lt(t,e,n){var r=t[e];_t.call(t,e)&&kt(r,n)&&(void 0!==n||e in t)||qt(t,e,n)}var Ot=Math.max;function Tt(t,e){return Et(function(t,e,n){return e=Ot(void 0===e?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=Ot(r.length-e,0),o=Array(i);++s<i;)o[s]=r[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=r[s];return l[e]=n(o),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,l)}}(t,e,nt),t+"")}function St(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function jt(t){return null!=t&&St(t.length)&&!rt(t)}var Ct=Object.prototype;function Rt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ct)}function It(t){return J(t)&&"[object Arguments]"==Y(t)}var Mt=Object.prototype,Bt=Mt.hasOwnProperty,Dt=Mt.propertyIsEnumerable,Ut=It(function(){return arguments}())?It:function(t){return J(t)&&Bt.call(t,"callee")&&!Dt.call(t,"callee")};var Pt="object"==typeof exports&&exports&&!exports.nodeType&&exports,zt=Pt&&"object"==typeof module&&module&&!module.nodeType&&module,Ht=zt&&zt.exports===Pt?$.Buffer:void 0,Ft=(Ht?Ht.isBuffer:void 0)||function(){return!1},$t={};function Vt(t){return function(e){return t(e)}}$t["[object Float32Array]"]=$t["[object Float64Array]"]=$t["[object Int8Array]"]=$t["[object Int16Array]"]=$t["[object Int32Array]"]=$t["[object Uint8Array]"]=$t["[object Uint8ClampedArray]"]=$t["[object Uint16Array]"]=$t["[object Uint32Array]"]=!0,$t["[object Arguments]"]=$t["[object Array]"]=$t["[object ArrayBuffer]"]=$t["[object Boolean]"]=$t["[object DataView]"]=$t["[object Date]"]=$t["[object Error]"]=$t["[object Function]"]=$t["[object Map]"]=$t["[object Number]"]=$t["[object Object]"]=$t["[object RegExp]"]=$t["[object Set]"]=$t["[object String]"]=$t["[object WeakMap]"]=!1;var Kt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Wt=Kt&&"object"==typeof module&&module&&!module.nodeType&&module,Zt=Wt&&Wt.exports===Kt&&H.process,Gt=function(){try{var t=Wt&&Wt.require&&Wt.require("util").types;return t||Zt&&Zt.binding&&Zt.binding("util")}catch(e){}}(),Qt=Gt&&Gt.isTypedArray,Xt=Qt?Vt(Qt):function(t){return J(t)&&St(t.length)&&!!$t[Y(t)]},Yt=Object.prototype.hasOwnProperty;function Jt(t,e){var n=tt(t),r=!n&&Ut(t),s=!n&&!r&&Ft(t),i=!n&&!r&&!s&&Xt(t),o=n||r||s||i,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!e&&!Yt.call(t,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||At(c,a))||l.push(c);return l}function te(t,e){return function(n){return t(e(n))}}var ee=te(Object.keys,Object),ne=Object.prototype.hasOwnProperty;function re(t){return jt(t)?Jt(t):function(t){if(!Rt(t))return ee(t);var e=[];for(var n in Object(t))ne.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var se=Object.prototype.hasOwnProperty;function ie(t){if(!et(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Rt(t),n=[];for(var r in t)("constructor"!=r||!e&&se.call(t,r))&&n.push(r);return n}function oe(t){return jt(t)?Jt(t,!0):ie(t)}var le=dt(Object,"create");var ae=Object.prototype.hasOwnProperty;var ce=Object.prototype.hasOwnProperty;function ue(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function he(t,e){for(var n=t.length;n--;)if(kt(t[n][0],e))return n;return-1}ue.prototype.clear=function(){this.__data__=le?le(null):{},this.size=0},ue.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ue.prototype.get=function(t){var e=this.__data__;if(le){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return ae.call(e,t)?e[t]:void 0},ue.prototype.has=function(t){var e=this.__data__;return le?void 0!==e[t]:ce.call(e,t)},ue.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=le&&void 0===e?"__lodash_hash_undefined__":e,this};var de=Array.prototype.splice;function fe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}fe.prototype.clear=function(){this.__data__=[],this.size=0},fe.prototype.delete=function(t){var e=this.__data__,n=he(e,t);return!(n<0)&&(n==e.length-1?e.pop():de.call(e,n,1),--this.size,!0)},fe.prototype.get=function(t){var e=this.__data__,n=he(e,t);return n<0?void 0:e[n][1]},fe.prototype.has=function(t){return he(this.__data__,t)>-1},fe.prototype.set=function(t,e){var n=this.__data__,r=he(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var pe=dt($,"Map");function ge(t,e){var n,r,s=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof e?"string":"hash"]:s.map}function me(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}me.prototype.clear=function(){this.size=0,this.__data__={hash:new ue,map:new(pe||fe),string:new ue}},me.prototype.delete=function(t){var e=ge(this,t).delete(t);return this.size-=e?1:0,e},me.prototype.get=function(t){return ge(this,t).get(t)},me.prototype.has=function(t){return ge(this,t).has(t)},me.prototype.set=function(t,e){var n=ge(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var be=te(Object.getPrototypeOf,Object),ye=Function.prototype.toString,ve=Object.prototype.hasOwnProperty,xe=ye.call(Object);function Ne(t){var e=this.__data__=new fe(t);this.size=e.size}Ne.prototype.clear=function(){this.__data__=new fe,this.size=0},Ne.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Ne.prototype.get=function(t){return this.__data__.get(t)},Ne.prototype.has=function(t){return this.__data__.has(t)},Ne.prototype.set=function(t,e){var n=this.__data__;if(n instanceof fe){var r=n.__data__;if(!pe||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new me(r)}return n.set(t,e),this.size=n.size,this};var Ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,we=Ee&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=we&&we.exports===Ee?$.Buffer:void 0,qe=Ae?Ae.allocUnsafe:void 0;function ke(t,e){if(e)return t.slice();var n=t.length,r=qe?qe(n):new t.constructor(n);return t.copy(r),r}var _e=Object.prototype.propertyIsEnumerable,Le=Object.getOwnPropertySymbols,Oe=Le?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}(Le(t),function(e){return _e.call(t,e)}))}:function(){return[]};function Te(t){return function(t,e,n){var r=e(t);return tt(t)?r:function(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}(r,n(t))}(t,re,Oe)}var Se=dt($,"DataView"),je=dt($,"Promise"),Ce=dt($,"Set"),Re="[object Map]",Ie="[object Promise]",Me="[object Set]",Be="[object WeakMap]",De="[object DataView]",Ue=at(Se),Pe=at(pe),ze=at(je),He=at(Ce),Fe=at(ft),$e=Y;(Se&&$e(new Se(new ArrayBuffer(1)))!=De||pe&&$e(new pe)!=Re||je&&$e(je.resolve())!=Ie||Ce&&$e(new Ce)!=Me||ft&&$e(new ft)!=Be)&&($e=function(t){var e=Y(t),n="[object Object]"==e?t.constructor:void 0,r=n?at(n):"";if(r)switch(r){case Ue:return De;case Pe:return Re;case ze:return Ie;case He:return Me;case Fe:return Be}return e});var Ve=Object.prototype.hasOwnProperty;var Ke=$.Uint8Array;function We(t){var e=new t.constructor(t.byteLength);return new Ke(e).set(new Ke(t)),e}var Ze=/\w*$/;var Ge=V?V.prototype:void 0,Qe=Ge?Ge.valueOf:void 0;function Xe(t,e){var n=e?We(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ye(t,e,n){var r,s,i,o,l,a=t.constructor;switch(e){case"[object ArrayBuffer]":return We(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return l=We((o=t).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Xe(t,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(i=new(s=t).constructor(s.source,Ze.exec(s))).lastIndex=s.lastIndex,i;case"[object Symbol]":return r=t,Qe?Object(Qe.call(r)):{}}}function Je(t){return"function"!=typeof t.constructor||Rt(t)?{}:gt(be(t))}var tn=Gt&&Gt.isMap,en=tn?Vt(tn):function(t){return J(t)&&"[object Map]"==$e(t)};var nn=Gt&&Gt.isSet,rn=nn?Vt(nn):function(t){return J(t)&&"[object Set]"==$e(t)},sn="[object Arguments]",on="[object Function]",ln="[object Object]",an={};function cn(t,e,n,r,s,i){var o,l=1&e;if(void 0!==o)return o;if(!et(t))return t;var a=tt(t);if(a)o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Ve.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t);else{var c=$e(t),u=c==on||"[object GeneratorFunction]"==c;if(Ft(t))return ke(t,l);if(c==ln||c==sn||u&&!s)o=u?{}:Je(t);else{if(!an[c])return s?t:{};o=Ye(t,c,l)}}i||(i=new Ne);var h=i.get(t);if(h)return h;i.set(t,o),rn(t)?t.forEach(function(r){o.add(cn(r,e,n,r,t,i))}):en(t)&&t.forEach(function(r,s){o.set(s,cn(r,e,n,s,t,i))});var d=a?void 0:Te(t);return function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););}(d||t,function(r,s){d&&(r=t[s=r]),Lt(o,s,cn(r,e,n,s,t,i))}),o}an[sn]=an["[object Array]"]=an["[object ArrayBuffer]"]=an["[object DataView]"]=an["[object Boolean]"]=an["[object Date]"]=an["[object Float32Array]"]=an["[object Float64Array]"]=an["[object Int8Array]"]=an["[object Int16Array]"]=an["[object Int32Array]"]=an["[object Map]"]=an["[object Number]"]=an[ln]=an["[object RegExp]"]=an["[object Set]"]=an["[object String]"]=an["[object Symbol]"]=an["[object Uint8Array]"]=an["[object Uint8ClampedArray]"]=an["[object Uint16Array]"]=an["[object Uint32Array]"]=!0,an["[object Error]"]=an[on]=an["[object WeakMap]"]=!1;function un(t){return cn(t,5)}function hn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new me;++e<n;)this.add(t[e])}function dn(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}hn.prototype.add=hn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},hn.prototype.has=function(t){return this.__data__.has(t)};function fn(t,e,n,r,s,i){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var h=-1,d=!0,f=2&n?new hn:void 0;for(i.set(t,e),i.set(e,t);++h<l;){var p=t[h],g=e[h];if(r)var m=o?r(g,p,h,e,t,i):r(p,g,h,t,e,i);if(void 0!==m){if(m)continue;d=!1;break}if(f){if(!dn(e,function(t,e){if(!f.has(e)&&(p===t||s(p,t,n,r,i)))return f.push(e)})){d=!1;break}}else if(p!==g&&!s(p,g,n,r,i)){d=!1;break}}return i.delete(t),i.delete(e),d}function pn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function gn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var mn=V?V.prototype:void 0,bn=mn?mn.valueOf:void 0;var yn=Object.prototype.hasOwnProperty;var vn="[object Arguments]",xn="[object Array]",Nn="[object Object]",En=Object.prototype.hasOwnProperty;function wn(t,e,n,r,s,i){var o=tt(t),l=tt(e),a=o?xn:$e(t),c=l?xn:$e(e),u=(a=a==vn?Nn:a)==Nn,h=(c=c==vn?Nn:c)==Nn,d=a==c;if(d&&Ft(t)){if(!Ft(e))return!1;o=!0,u=!1}if(d&&!u)return i||(i=new Ne),o||Xt(t)?fn(t,e,n,r,s,i):function(t,e,n,r,s,i,o){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Ke(t),new Ke(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return kt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=pn;case"[object Set]":if(l||(l=gn),t.size!=e.size&&!(1&r))return!1;var a=o.get(t);if(a)return a==e;r|=2,o.set(t,e);var c=fn(l(t),l(e),r,s,i,o);return o.delete(t),c;case"[object Symbol]":if(bn)return bn.call(t)==bn.call(e)}return!1}(t,e,a,n,r,s,i);if(!(1&n)){var f=u&&En.call(t,"__wrapped__"),p=h&&En.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,m=p?e.value():e;return i||(i=new Ne),s(g,m,n,r,i)}}return!!d&&(i||(i=new Ne),function(t,e,n,r,s,i){var o=1&n,l=Te(t),a=l.length;if(a!=Te(e).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in e:yn.call(e,u)))return!1}var h=i.get(t),d=i.get(e);if(h&&d)return h==e&&d==t;var f=!0;i.set(t,e),i.set(e,t);for(var p=o;++c<a;){var g=t[u=l[c]],m=e[u];if(r)var b=o?r(m,g,u,e,t,i):r(g,m,u,t,e,i);if(!(void 0===b?g===m||s(g,m,n,r,i):b)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var y=t.constructor,v=e.constructor;y==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,n,r,s,i))}function An(t,e,n,r,s){return t===e||(null==t||null==e||!J(t)&&!J(e)?t!=t&&e!=e:wn(t,e,n,r,An,s))}var qn=function(t,e,n){for(var r=-1,s=Object(t),i=n(t),o=i.length;o--;){var l=i[++r];if(!1===e(s[l],l,s))break}return t};function kn(t,e,n){(void 0!==n&&!kt(t[e],n)||void 0===n&&!(e in t))&&qt(t,e,n)}function _n(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Ln(t){return function(t,e,n){var r=!n;n||(n={});for(var s=-1,i=e.length;++s<i;){var o=e[s],l=void 0;void 0===l&&(l=t[o]),r?qt(n,o,l):Lt(n,o,l)}return n}(t,oe(t))}function On(t,e,n,r,s,i,o){var l=_n(t,n),a=_n(e,n),c=o.get(a);if(c)kn(t,n,c);else{var u,h=i?i(l,a,n+"",t,e,o):void 0,d=void 0===h;if(d){var f=tt(a),p=!f&&Ft(a),g=!f&&!p&&Xt(a);h=a,f||p||g?tt(l)?h=l:J(u=l)&&jt(u)?h=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(l):p?(d=!1,h=ke(a,!0)):g?(d=!1,h=Xe(a,!0)):h=[]:function(t){if(!J(t)||"[object Object]"!=Y(t))return!1;var e=be(t);if(null===e)return!0;var n=ve.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ye.call(n)==xe}(a)||Ut(a)?(h=l,Ut(l)?h=Ln(l):et(l)&&!rt(l)||(h=Je(a))):d=!1}d&&(o.set(a,h),s(h,a,r,i,o),o.delete(a)),kn(t,n,h)}}function Tn(t,e,n,r,s){t!==e&&qn(e,function(i,o){if(s||(s=new Ne),et(i))On(t,e,o,n,Tn,r,s);else{var l=r?r(_n(t,o),i,o+"",t,e,s):void 0;void 0===l&&(l=i),kn(t,o,l)}},oe)}function Sn(t,e){return An(t,e)}var jn,Cn=(jn=function(t,e,n){Tn(t,e,n)},Tt(function(t,e){var n=-1,r=e.length,s=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(s=jn.length>3&&"function"==typeof s?(r--,s):void 0,i&&function(t,e,n){if(!et(n))return!1;var r=typeof e;return!!("number"==r?jt(n)&&At(e,n.length):"string"==r&&e in n)&&kt(n[e],t)}(e[0],e[1],i)&&(s=r<3?void 0:s,r=1),t=Object(t);++n<r;){var o=e[n];o&&jn(t,o,n,s)}return t})),Rn=(t=>(t[t.TYPE=3]="TYPE",t[t.LEVEL=12]="LEVEL",t[t.ATTRIBUTE=13]="ATTRIBUTE",t[t.BLOT=14]="BLOT",t[t.INLINE=7]="INLINE",t[t.BLOCK=11]="BLOCK",t[t.BLOCK_BLOT=10]="BLOCK_BLOT",t[t.INLINE_BLOT=6]="INLINE_BLOT",t[t.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",t[t.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",t[t.ANY=15]="ANY",t))(Rn||{});class In{constructor(t,e,n={}){this.attrName=t,this.keyName=e;this.scope=null!=n.scope?n.scope&Rn.LEVEL|Rn.TYPE&Rn.ATTRIBUTE:Rn.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(t){return Array.from(t.attributes).map(t=>t.name)}add(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)}canAdd(t,e){return null==this.whitelist||("string"==typeof e?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 Mn extends Error{constructor(t){super(t="[Parchment] "+t),this.message=t,this.name=this.constructor.name}}const Bn=class t{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(null==t)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let n=null;try{n=t.parentNode}catch{return null}return this.find(n,e)}return null}create(e,n,r){const s=this.query(n);if(null==s)throw new Mn(`Unable to create ${n} blot`);const i=s,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:i.create(r),l=new i(e,o,r);return t.blots.set(l.domNode,l),l}find(e,n=!1){return t.find(e,n)}query(t,e=Rn.ANY){let n;return"string"==typeof t?n=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof t?t&Rn.LEVEL&Rn.BLOCK?n=this.types.block:t&Rn.LEVEL&Rn.INLINE&&(n=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(t=>(n=this.classes[t],!!n)),n=n||this.tags[t.tagName]),null==n?null:"scope"in n&&e&Rn.LEVEL&n.scope&&e&Rn.TYPE&n.scope?n:null}register(...t){return t.map(t=>{const e="blotName"in t,n="attrName"in t;if(!e&&!n)throw new Mn("Invalid definition");if(e&&"abstract"===t.blotName)throw new Mn("Cannot register abstract class");return this.types[e?t.blotName:n?t.attrName:void 0]=t,n?"string"==typeof t.keyName&&(this.attributes[t.keyName]=t):e&&(t.className&&(this.classes[t.className]=t),t.tagName&&(t.tagName=Array.isArray(t.tagName)?t.tagName.map(t=>t.toUpperCase()):t.tagName.toUpperCase(),(Array.isArray(t.tagName)?t.tagName:[t.tagName]).forEach(e=>{(null==this.tags[e]||null==t.className)&&(this.tags[e]=t)}))),t})}};Bn.blots=new WeakMap;let Dn=Bn;function Un(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(t=>0===t.indexOf(`${e}-`))}const Pn=class extends In{static keys(t){return(t.getAttribute("class")||"").split(/\s+/).map(t=>t.split("-").slice(0,-1).join("-"))}add(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(`${this.keyName}-${e}`),!0)}remove(t){Un(t,this.keyName).forEach(e=>{t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")}value(t){const e=(Un(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}};function zn(t){const e=t.split("-"),n=e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("");return e[0]+n}const Hn=class extends In{static keys(t){return(t.getAttribute("style")||"").split(";").map(t=>t.split(":")[0].trim())}add(t,e){return!!this.canAdd(t,e)&&(t.style[zn(this.keyName)]=e,!0)}remove(t){t.style[zn(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[zn(this.keyName)];return this.canAdd(t,e)?e:""}};const Fn=class{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=Dn.find(this.domNode);if(null==t)return;const e=In.keys(this.domNode),n=Pn.keys(this.domNode),r=Hn.keys(this.domNode);e.concat(n).concat(r).forEach(e=>{const n=t.scroll.query(e,Rn.ATTRIBUTE);n instanceof In&&(this.attributes[n.attrName]=n)})}copy(t){Object.keys(this.attributes).forEach(e=>{const n=this.attributes[e].value(this.domNode);t.format(e,n)})}move(t){this.copy(t),Object.keys(this.attributes).forEach(t=>{this.attributes[t].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t),{})}},$n=class{constructor(t,e){this.scroll=t,this.domNode=e,Dn.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(null==this.tagName)throw new Mn("Blot definition missing tagName");let e,n;return Array.isArray(this.tagName)?("string"==typeof t?(n=t.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof t&&(n=t),e="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){null!=this.parent&&this.parent.removeChild(this),Dn.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,n,r){const s=this.isolate(t,e);if(null!=this.scroll.query(n,Rn.BLOT)&&r)s.wrap(n,r);else if(null!=this.scroll.query(n,Rn.ATTRIBUTE)){const t=this.scroll.create(this.statics.scope);s.wrap(t),t.format(n,r)}}insertAt(t,e,n){const r=null==n?this.scroll.create("text",e):this.scroll.create(e,n),s=this.split(t);this.parent.insertBefore(r,s||void 0)}isolate(t,e){const n=this.split(t);if(null==n)throw new Error("Attempt to isolate at end");return n.split(e),n}length(){return 1}offset(t=this.parent){return null==this.parent||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(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(t,e){return 0===t?this:this.next}update(t,e){}wrap(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Mn(`Cannot wrap ${t}`);return n.appendChild(this),n}};$n.blotName="abstract";let Vn=$n;const Kn=class extends Vn{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};Kn.scope=Rn.INLINE_BLOT;const Wn=Kn;class Zn{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 n=e();for(;n&&t>0;)t-=1,n=e();return n}contains(t){const e=this.iterator();let n=e();for(;n;){if(n===t)return!0;n=e()}return!1}indexOf(t){const e=this.iterator();let n=e(),r=0;for(;n;){if(n===t)return r;r+=1,n=e()}return-1}insertBefore(t,e){null!=t&&(this.remove(t),t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(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,n=this.head;for(;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1}remove(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(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 null!=t&&(t=t.next),e}}find(t,e=!1){const n=this.iterator();let r=n();for(;r;){const s=r.length();if(t<s||e&&t===s&&(null==r.next||0!==r.next.length()))return[r,t];t-=s,r=n()}return[null,0]}forEach(t){const e=this.iterator();let n=e();for(;n;)t(n),n=e()}forEachAt(t,e,n){if(e<=0)return;const[r,s]=this.find(t);let i=t-s;const o=this.iterator(r);let l=o();for(;l&&i<t+e;){const r=l.length();t>i?n(l,t-i,Math.min(e,i+r-t)):n(l,0,Math.min(r,t+e-i)),i+=r,l=o()}}map(t){return this.reduce((e,n)=>(e.push(t(n)),e),[])}reduce(t,e){const n=this.iterator();let r=n();for(;r;)e=t(e,r),r=n();return e}}function Gn(t,e){const n=e.find(t);if(n)return n;try{return e.create(t)}catch{const n=e.create(Rn.INLINE);return Array.from(t.childNodes).forEach(t=>{n.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(n.domNode,t),n.attach(),n}}const Qn=class t extends Vn{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(e){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=e,t.uiClass&&this.uiNode.classList.add(t.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new Zn,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=Gn(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Mn)return;throw e}})}deleteAt(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,(t,e,n)=>{t.deleteAt(e,n)})}descendant(e,n=0){const[r,s]=this.children.find(n);return null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e?[r,s]:r instanceof t?r.descendant(e,s):[null,-1]}descendants(e,n=0,r=Number.MAX_VALUE){let s=[],i=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&s.push(n),n instanceof t&&(s=s.concat(n.descendants(e,r,i))),i-=o}),s}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let e=!1;this.children.forEach(n=>{e||this.statics.allowedChildren.some(t=>n instanceof t)||(n.statics.scope===Rn.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),e=!0):n instanceof t?n.unwrap():n.remove())})}formatAt(t,e,n,r){this.children.forEachAt(t,e,(t,e,s)=>{t.formatAt(e,s,n,r)})}insertAt(t,e,n){const[r,s]=this.children.find(t);if(r)r.insertAt(s,e,n);else{const t=null==n?this.scroll.create("text",e):this.scroll.create(e,n);this.appendChild(t)}}insertBefore(t,e){null!=t.parent&&t.parent.children.remove(t);let n=null;this.children.insertBefore(t,e||null),t.parent=this,null!=e&&(n=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(t.domNode,n),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(n=>{t.insertBefore(n,e)})}optimize(t){if(super.optimize(t),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove()}path(e,n=!1){const[r,s]=this.children.find(e,n),i=[[this,e]];return r instanceof t?i.concat(r.path(s,n)):(null!=r&&i.push([r,s]),i)}removeChild(t){this.children.remove(t)}replaceWith(e,n){const r="string"==typeof e?this.scroll.create(e,n):e;return r instanceof t&&this.moveChildren(r),super.replaceWith(r)}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(t,this.length(),(t,r,s)=>{const i=t.split(r,e);null!=i&&n.appendChild(i)}),n}splitAfter(t){const e=this.clone();for(;null!=t.next;)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 n=[],r=[];t.forEach(t=>{t.target===this.domNode&&"childList"===t.type&&(n.push(...t.addedNodes),r.push(...t.removedNodes))}),r.forEach(t=>{if(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const e=this.scroll.find(t);null!=e&&(null==e.domNode.parentNode||e.domNode.parentNode===this.domNode)&&e.detach()}),n.filter(t=>t.parentNode===this.domNode&&t!==this.uiNode).sort((t,e)=>t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(t=>{let e=null;null!=t.nextSibling&&(e=this.scroll.find(t.nextSibling));const n=Gn(t,this.scroll);(n.next!==e||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,e||void 0))}),this.enforceAllowedChildren()}};Qn.uiClass="";const Xn=Qn;const Yn=class t extends Xn{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new Fn(this.domNode)}format(e,n){if(e!==this.statics.blotName||n){const t=this.scroll.query(e,Rn.INLINE);if(null==t)return;t instanceof In?this.attributes.attribute(t,n):n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n)}else this.children.forEach(e=>{e instanceof t||(e=e.wrap(t.blotName,!0)),this.attributes.copy(e)}),this.unwrap()}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.formats()[n]||this.scroll.query(n,Rn.ATTRIBUTE)?this.isolate(t,e).format(n,r):super.formatAt(t,e,n,r)}optimize(e){super.optimize(e);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof t&&r.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}wrap(e,n){const r=super.wrap(e,n);return r instanceof t&&this.attributes.move(r),r}};Yn.allowedChildren=[Yn,Wn],Yn.blotName="inline",Yn.scope=Rn.INLINE_BLOT,Yn.tagName="SPAN";const Jn=Yn,tr=class t extends Xn{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new Fn(this.domNode)}format(e,n){const r=this.scroll.query(e,Rn.BLOCK);null!=r&&(r instanceof In?this.attributes.attribute(r,n):e!==this.statics.blotName||n?n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n):this.replaceWith(t.blotName))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.scroll.query(n,Rn.BLOCK)?this.format(n,r):super.formatAt(t,e,n,r)}insertAt(t,e,n){if(null==n||null!=this.scroll.query(e,Rn.INLINE))super.insertAt(t,e,n);else{const r=this.split(t);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const t=this.scroll.create(e,n);r.parent.insertBefore(t,r)}}}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}};tr.blotName="block",tr.scope=Rn.BLOCK_BLOT,tr.tagName="P",tr.allowedChildren=[Jn,tr,Wn];const er=tr,nr=class extends Xn{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.enforceAllowedChildren()}insertAt(t,e,n){super.insertAt(t,e,n),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};nr.blotName="container",nr.scope=Rn.BLOCK_BLOT;const rr=nr;const sr=class extends Wn{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,n,r){0===t&&e===this.length()?this.format(n,r):super.formatAt(t,e,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},ir={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},or=class extends Xn{constructor(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(t=>{this.update(t)}),this.observer.observe(this.domNode,ir),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const n=this.registry.find(t,e);return n?n.scroll===this?n:e?this.find(n.scroll.domNode.parentNode,!0):null:null}query(t,e=Rn.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),0===t&&e===this.length()?this.children.forEach(t=>{t.remove()}):super.deleteAt(t,e)}formatAt(t,e,n,r){this.update(),super.formatAt(t,e,n,r)}insertAt(t,e,n){this.update(),super.insertAt(t,e,n)}optimize(t=[],e={}){super.optimize(e);const n=e.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)t.push(r.pop());const s=(t,e=!0)=>{null==t||t===this||null!=t.domNode.parentNode&&(n.has(t.domNode)||n.set(t.domNode,[]),e&&s(t.parent))},i=t=>{n.has(t.domNode)&&(t instanceof Xn&&t.children.forEach(i),n.delete(t.domNode),t.optimize(e))};let o=t;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(t=>{const e=this.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(s(this.find(t.previousSibling,!1)),Array.from(t.addedNodes).forEach(t=>{const e=this.find(t,!1);s(e,!1),e instanceof Xn&&e.children.forEach(t=>{s(t,!1)})})):"attributes"===t.type&&s(e.prev)),s(e))}),this.children.forEach(i),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)t.push(r.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const n=new WeakMap;t.map(t=>{const e=this.find(t.target,!0);return null==e?null:n.has(e.domNode)?(n.get(e.domNode).push(t),null):(n.set(e.domNode,[t]),e)}).forEach(t=>{null!=t&&t!==this&&n.has(t.domNode)&&t.update(n.get(t.domNode)||[],e)}),e.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),e),this.optimize(t,e)}};or.blotName="scroll",or.defaultChild=er,or.allowedChildren=[er,rr],or.scope=Rn.BLOCK_BLOT,or.tagName="DIV";const lr=or,ar=class t extends Wn{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,n){null==n?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,n)}length(){return this.text.length}optimize(e){super.optimize(e),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(t,e){t.some(t=>"characterData"===t.type&&t.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};ar.blotName="text",ar.scope=Rn.INLINE_BLOT;const cr=ar;var ur=Object.freeze({__proto__:null,Attributor:In,AttributorStore:Fn,BlockBlot:er,ClassAttributor:Pn,ContainerBlot:rr,EmbedBlot:sr,InlineBlot:Jn,LeafBlot:Wn,ParentBlot:Xn,Registry:Dn,Scope:Rn,ScrollBlot:lr,StyleAttributor:Hn,TextBlot:cr});class hr extends sr{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}hr.blotName="break",hr.tagName="BR";let dr=class extends cr{};function fr(t){return t.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[t]))}class pr extends Jn{static allowedChildren=[pr,hr,sr,dr];static order=["cursor","inline","link","underline","strike","italic","bold","script","code"];static compare(t,e){const n=pr.order.indexOf(t),r=pr.order.indexOf(e);return n>=0||r>=0?n-r:t===e?0:t<e?-1:1}formatAt(t,e,n,r){if(pr.compare(this.statics.blotName,n)<0&&this.scroll.query(n,Rn.BLOT)){const s=this.isolate(t,e);r&&s.wrap(n,r)}else super.formatAt(t,e,n,r)}optimize(t){if(super.optimize(t),this.parent instanceof pr&&pr.compare(this.statics.blotName,this.parent.statics.blotName)>0){const t=this.parent.isolate(this.offset(),this.length());this.moveChildren(t),t.wrap(this)}}}class gr extends er{cache={};delta(){return null==this.cache.delta&&(this.cache.delta=br(this)),this.cache.delta}deleteAt(t,e){super.deleteAt(t,e),this.cache={}}formatAt(t,e,n,r){e<=0||(this.scroll.query(n,Rn.BLOCK)?t+e===this.length()&&this.format(n,r):super.formatAt(t,Math.min(e,this.length()-t-1),n,r),this.cache={})}insertAt(t,e,n){if(null!=n)return super.insertAt(t,e,n),void(this.cache={});if(0===e.length)return;const r=e.split("\n"),s=r.shift();s.length>0&&(t<this.length()-1||null==this.children.tail?super.insertAt(Math.min(t,this.length()-1),s):this.children.tail.insertAt(this.children.tail.length(),s),this.cache={});let i=this;r.reduce((t,e)=>(i=i.split(t,!0),i.insertAt(0,e),e.length),t+s.length)}insertBefore(t,e){const{head:n}=this.children;super.insertBefore(t,e),n instanceof hr&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(t,e){super.moveChildren(t,e),this.cache={}}optimize(t){super.optimize(t),this.cache={}}path(t){return super.path(t,!0)}removeChild(t){super.removeChild(t),this.cache={}}split(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&(0===t||t>=this.length()-1)){const e=this.clone();return 0===t?(this.parent.insertBefore(e,this),this):(this.parent.insertBefore(e,this.next),e)}const n=super.split(t,e);return this.cache={},n}}gr.blotName="block",gr.tagName="P",gr.defaultChild=hr,gr.allowedChildren=[hr,pr,sr,dr];class mr extends sr{attach(){super.attach(),this.attributes=new Fn(this.domNode)}delta(){return(new S).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const n=this.scroll.query(t,Rn.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,e)}formatAt(t,e,n,r){this.format(n,r)}insertAt(t,e,n){if(null!=n)return void super.insertAt(t,e,n);const r=e.split("\n"),s=r.pop(),i=r.map(t=>{const e=this.scroll.create(gr.blotName);return e.insertAt(0,t),e}),o=this.split(t);i.forEach(t=>{this.parent.insertBefore(t,o)}),s&&this.parent.insertBefore(this.scroll.create("text",s),o)}}function br(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.descendants(Wn).reduce((t,n)=>0===n.length()?t:t.insert(n.value(),yr(n,{},e)),new S).insert("\n",yr(t))}function yr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==t?e:("formats"in t&&"function"==typeof t.formats&&(e={...e,...t.formats()},n&&delete e["code-token"]),null==t.parent||"scroll"===t.parent.statics.blotName||t.parent.statics.scope!==t.statics.scope?e:yr(t.parent,e,n))}mr.scope=Rn.BLOCK_BLOT;class vr extends sr{static blotName="cursor";static className="ql-cursor";static tagName="span";static CONTENTS="\ufeff";static value(){}constructor(t,e,n){super(t,e),this.selection=n,this.textNode=document.createTextNode(vr.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,e){if(0!==this.savedLength)return void super.format(t,e);let n=this,r=0;for(;null!=n&&n.statics.scope!==Rn.BLOCK_BLOT;)r+=n.offset(n.parent),n=n.parent;null!=n&&(this.savedLength=vr.CONTENTS.length,n.optimize(),n.formatAt(r,vr.CONTENTS.length,t,e),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const e=this.prev instanceof dr?this.prev:null,n=e?e.length():0,r=this.next instanceof dr?this.next:null,s=r?r.text:"",{textNode:i}=this,o=i.data.split(vr.CONTENTS).join("");let l;if(i.data=vr.CONTENTS,e)l=e,(o||r)&&(e.insertAt(e.length(),o+s),r&&r.remove());else if(r)l=r,r.insertAt(0,o);else{const t=document.createTextNode(o);l=this.scroll.create(t),this.parent.insertBefore(l,this)}if(this.remove(),t){const s=(t,s)=>e&&t===e.domNode?s:t===i?n+s-1:r&&t===r.domNode?n+o.length+s:null,a=s(t.start.node,t.start.offset),c=s(t.end.node,t.end.offset);if(null!==a&&null!==c)return{startNode:l.domNode,startOffset:a,endNode:l.domNode,endOffset:c}}return null}update(t,e){if(t.some(t=>"characterData"===t.type&&t.target===this.textNode)){const t=this.restore();t&&(e.range=t)}}optimize(t){super.optimize(t);let{parent:e}=this;for(;e;){if("A"===e.domNode.tagName){this.savedLength=vr.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}}var xr,Nr={exports:{}};function Er(){return xr||(xr=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function s(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new s(r,i||t,o),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],l]:t._events[a].push(l):(t._events[a]=l,t._eventsCount++),t}function o(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var t,r,s=[];if(0===this._eventsCount)return s;for(r in t=this._events)e.call(t,r)&&s.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},l.prototype.listeners=function(t){var e=this._events[n?n+t:t];if(!e)return[];if(e.fn)return[e.fn];for(var r=0,s=e.length,i=new Array(s);r<s;r++)i[r]=e[r].fn;return i},l.prototype.listenerCount=function(t){var e=this._events[n?n+t:t];return e?e.fn?1:e.length:0},l.prototype.emit=function(t,e,r,s,i,o){var l=n?n+t:t;if(!this._events[l])return!1;var a,c,u=this._events[l],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,s),!0;case 5:return u.fn.call(u.context,e,r,s,i),!0;case 6:return u.fn.call(u.context,e,r,s,i,o),!0}for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,r);break;case 4:u[c].fn.call(u[c].context,e,r,s);break;default:if(!a)for(d=1,a=new Array(h-1);d<h;d++)a[d-1]=arguments[d];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},l.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},l.prototype.removeListener=function(t,e,r,s){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return o(this,i),this;var l=this._events[i];if(l.fn)l.fn!==e||s&&!l.once||r&&l.context!==r||o(this,i);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==e||s&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[i]=1===c.length?c[0]:c:o(this,i)}return this},l.prototype.removeAllListeners=function(t){var e;return t?this._events[e=n?n+t:t]&&o(this,e):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(Nr)),Nr.exports}var wr=a(Er()),Ar=new WeakMap;const qr=["error","warn","log","info"];let kr="warn";function _r(t){if(kr&&qr.indexOf(t)<=qr.indexOf(kr)){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console[t](...n)}}function Lr(t){return qr.reduce((e,n)=>(e[n]=_r.bind(console,n,t),e),{})}_r.level=Lr.level=t=>{kr=t};const Or=Lr("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(t=>{document.addEventListener(t,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(t=>{const n=Ar.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});class Tr extends wr{static events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"};static sources={API:"api",SILENT:"silent",USER:"user"};constructor(){super(),this.domListeners={},this.on("error",Or.error)}emit(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Or.log.call(Or,...e),super.emit(...e)}handleDOM(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];(this.domListeners[t.type]||[]).forEach(e=>{let{node:r,handler:s}=e;(t.target===r||r.contains(t.target))&&s(t,...n)})}listenDOM(t,e,n){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:n})}}const Sr=Lr("quill:selection");class jr{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=t,this.length=e}}class Cr{constructor(t,e){this.emitter=e,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new jr(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{this.mouseDown||this.composing||setTimeout(this.update.bind(this,Tr.sources.USER),1)}),this.emitter.on(Tr.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const t=this.getNativeRange();null!=t&&t.start.node!==this.cursor.textNode&&this.emitter.once(Tr.events.SCROLL_UPDATE,(e,n)=>{try{this.root.contains(t.start.node)&&this.root.contains(t.end.node)&&this.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset);const r=n.some(t=>"characterData"===t.type||"childList"===t.type||"attributes"===t.type&&t.target===this.root);this.update(r?Tr.sources.SILENT:e)}catch(r){}})}),this.emitter.on(Tr.events.SCROLL_OPTIMIZE,(t,e)=>{if(e.range){const{startNode:t,startOffset:n,endNode:r,endOffset:s}=e.range;this.setNativeRange(t,n,r,s),this.update(Tr.sources.SILENT)}}),this.update(Tr.sources.SILENT)}handleComposition(){this.emitter.on(Tr.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(Tr.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const t=this.cursor.restore();if(!t)return;setTimeout(()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(Tr.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(t,Rn.BLOCK)){if(n.start.node!==this.cursor.textNode){const t=this.scroll.find(n.start.node,!1);if(null==t)return;if(t instanceof Wn){const e=t.split(n.start.offset);t.parent.insertBefore(this.cursor,e)}else t.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;let[s,i]=this.scroll.leaf(t);if(null==s)return null;if(e>0&&i===s.length()){const[e]=this.scroll.leaf(t+1);if(e){const[n]=this.scroll.line(t),[r]=this.scroll.line(t+1);n===r&&(s=e,i=0)}}[r,i]=s.position(i,!0);const o=document.createRange();if(e>0)return o.setStart(r,i),[s,i]=this.scroll.leaf(t+e),null==s?null:([r,i]=s.position(i,!0),o.setEnd(r,i),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;i<r.data.length?(o.setStart(r,i),o.setEnd(r,i+1)):(o.setStart(r,i-1),o.setEnd(r,i),a="right"),l=o.getBoundingClientRect()}else{if(!(s.domNode instanceof Element))return null;l=s.domNode.getBoundingClientRect(),i>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const t=document.getSelection();if(null==t||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(null==e)return null;const n=this.normalizeNative(e);return Sr.info("getNativeRange",n),n}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();if(null==e)return[null,null];return[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&Rr(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const n=e.map(t=>{const[e,n]=t,r=this.scroll.find(e,!0),s=r.offset(this.scroll);return 0===n?s:r instanceof Wn?s+r.index(e,n):s+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),s=Math.min(r,...n);return new jr(s,r-s)}normalizeNative(t){if(!Rr(this.root,t.startContainer)||!t.collapsed&&!Rr(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(t=>{let{node:e,offset:n}=t;for(;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length>0?e.childNodes.length:e.childNodes.length+1}t.node=e,t.offset=n}),e}rangeToNative(t){const e=this.scroll.length(),n=(t,n)=>{t=Math.min(e-1,t);const[r,s]=this.scroll.leaf(t);return r?r.position(s,n):[null,-1]};return[...n(t.index,!1),...n(t.index+t.length,!0)]}setNativeRange(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Sr.info("setNativeRange",t,e,n,r),null!=t&&(null==this.root.parentNode||null==t.parentNode||null==n.parentNode))return;const i=document.getSelection();if(null!=i)if(null!=t){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||s||t!==o.startContainer||e!==o.startOffset||n!==o.endContainer||r!==o.endOffset){t instanceof Element&&"BR"===t.tagName&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const s=document.createRange();s.setStart(t,e),s.setEnd(n,r),i.removeAllRanges(),i.addRange(s)}}else i.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Tr.sources.API;if("string"==typeof e&&(n=e,e=!1),Sr.info("setRange",t),null!=t){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(n)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Tr.sources.USER;const e=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Sn(e,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const t=this.cursor.restore();t&&this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}const n=[Tr.events.SELECTION_CHANGE,un(this.lastRange),un(e),t];this.emitter.emit(Tr.events.EDITOR_CHANGE,...n),t!==Tr.sources.SILENT&&this.emitter.emit(...n)}}}function Rr(t,e){return t.contains(e)}const Ir=/^[ -~]*$/;class Mr{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const n=zr(t),r=new S;return function(t){const e=[];return t.forEach(t=>{if("string"==typeof t.insert){t.insert.split("\n").forEach((n,r)=>{r&&e.push({insert:"\n",attributes:t.attributes}),n&&e.push({insert:n,attributes:t.attributes})})}else e.push(t)}),e}(n.ops.slice()).reduce((t,n)=>{const s=T.Op.length(n);let i=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(s),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(e<=t||!!this.scroll.descendant(mr,t)[0]),this.scroll.insertAt(t,r);const[s,o]=this.scroll.line(t);let a=Cn({},yr(s));if(s instanceof gr){const[t]=s.descendant(Wn,o);t&&(a=Cn(a,yr(t)))}i=T.AttributeMap.diff(a,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;const s=null!=this.scroll.query(r,Rn.INLINE);if(s)(e<=t||this.scroll.descendant(mr,t)[0])&&(l=!0);else if(t>0){const[e,n]=this.scroll.descendant(Wn,t-1);if(e instanceof dr){"\n"!==e.value()[n]&&(o=!0)}else e instanceof sr&&e.statics.scope===Rn.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(t,r,n.insert[r]),s){const[e]=this.scroll.descendant(Wn,t);if(e){const t=Cn({},yr(e));i=T.AttributeMap.diff(t,i)||{}}}}e+=s}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const e=Object.keys(n.retain)[0];if(null==e)return t;this.scroll.updateEmbedAt(t,e,n.retain[e])}Object.keys(i).forEach(e=>{this.scroll.formatAt(t,s,e,i[e])});const a=o?1:0,c=l?1:0;return e+=a+c,r.retain(a),r.delete(c),t+s+a+c},0),r.reduce((t,e)=>"number"==typeof e.delete?(this.scroll.deleteAt(t,e.delete),t):t+T.Op.length(e),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update((new S).retain(t).delete(e))}formatLine(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(t,Math.max(e,1)).forEach(t=>{t.format(r,n[r])})}),this.scroll.optimize();const r=(new S).retain(t).retain(e,un(n));return this.update(r)}formatText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e,r,n[r])});const r=(new S).retain(t).retain(e,un(n));return this.update(r)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new S)}getFormat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach(t=>{const[e]=t;e instanceof gr?n.push(e):e instanceof Wn&&r.push(e)}):(n=this.scroll.lines(t,e),r=this.scroll.descendants(Wn,t,e));const[s,i]=[n,r].map(t=>{const e=t.shift();if(null==e)return{};let n=yr(e);for(;Object.keys(n).length>0;){const e=t.shift();if(null==e)return n;n=Ur(yr(e),n)}return n});return{...s,...i}}getHTML(t,e){const[n,r]=this.scroll.line(t);if(n){const s=n.length();return!(n.length()>=r+e)||0===r&&e===s?Dr(this.scroll,t,e,!0):Dr(n,r,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(t=>"string"==typeof t.insert).map(t=>t.insert).join("")}insertContents(t,e){const n=zr(e),r=(new S).retain(t).concat(n);return this.scroll.insertContents(t,n),this.update(r)}insertEmbed(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new S).retain(t).insert({[e]:n}))}insertText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e.length,r,n[r])}),this.update((new S).retain(t).insert(e,un(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if(t?.statics.blotName!==gr.blotName)return!1;return!(t.children.length>1)&&t.children.head instanceof hr}removeFormat(t,e){const n=this.getText(t,e),[r,s]=this.scroll.line(t+e);let i=0,o=new S;null!=r&&(i=r.length()-s,o=r.delta().slice(s,s+i-1).insert("\n"));const l=this.getContents(t,e+i).diff((new S).insert(n).concat(o)),a=(new S).retain(t).concat(l);return this.applyDelta(a)}update(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(Ir)&&this.scroll.find(e[0].target)){const s=this.scroll.find(e[0].target),i=yr(s),o=s.offset(this.scroll),l=e[0].oldValue.replace(vr.CONTENTS,""),a=(new S).insert(l),c=(new S).insert(s.value()),u=n&&{oldRange:Hr(n.oldRange,-o),newRange:Hr(n.newRange,-o)};t=(new S).retain(o).concat(a.diff(c,u)).reduce((t,e)=>e.insert?t.insert(e.insert,i):t.push(e),new S),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&Sn(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}function Br(t,e,n){if(0===t.length){const[t]=Pr(n.pop());return e<=0?`</li></${t}>`:`</li></${t}>${Br([],e-1,n)}`}const[{child:r,offset:s,length:i,indent:o,type:l},...a]=t,[c,u]=Pr(l);if(o>e)return n.push(l),o===e+1?`<${c}><li${u}>${Dr(r,s,i)}${Br(a,o,n)}`:`<${c}><li>${Br(t,e+1,n)}`;if(o===e&&l===n[n.length-1])return`</li><li${u}>${Dr(r,s,i)}${Br(a,o,n)}`;const[h]=Pr(n.pop());return`</li></${h}>${Br(t,e-1,n)}`}function Dr(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in t&&"function"==typeof t.html)return t.html(e,n);if(t instanceof dr)return fr(t.value().slice(e,e+n));if(t instanceof Xn){if("list-container"===t.statics.blotName){const r=[];return t.children.forEachAt(e,n,(t,e,n)=>{const s="formats"in t&&"function"==typeof t.formats?t.formats():{};r.push({child:t,offset:e,length:n,indent:s.indent||0,type:s.list})}),Br(r,-1,[])}const s=[];if(t.children.forEachAt(e,n,(t,e,n)=>{s.push(Dr(t,e,n))}),r||"list"===t.statics.blotName)return s.join("");const{outerHTML:i,innerHTML:o}=t.domNode,[l,a]=i.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${s.join("")}<${a}`:`${l}>${s.join("")}<${a}`}return t.domNode instanceof Element?t.domNode.outerHTML:""}function Ur(t,e){return Object.keys(e).reduce((n,r)=>{if(null==t[r])return n;const s=e[r];return n[r]=s===t[r]?s:Array.isArray(s)?s.indexOf(t[r])<0?s.concat([t[r]]):s:[s,t[r]],n},{})}function Pr(t){const e="ordered"===t?"ol":"ul";switch(t){case"checked":return[e,' data-list="checked"'];case"unchecked":return[e,' data-list="unchecked"'];default:return[e,""]}}function zr(t){return t.reduce((t,e)=>{if("string"==typeof e.insert){const n=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(n,e.attributes)}return t.push(e)},new S)}function Hr(t,e){let{index:n,length:r}=t;return new jr(n+e,r)}class Fr{static DEFAULTS={};constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=t,this.options=e}}const $r="\ufeff";class Vr extends sr{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(t=>{this.contentNode.appendChild(t)}),this.leftGuard=document.createTextNode($r),this.rightGuard=document.createTextNode($r),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e,n=null;const r=t.data.split($r).join("");if(t===this.leftGuard)if(this.prev instanceof dr){const t=this.prev.length();this.prev.insertAt(t,r),n={startNode:this.prev.domNode,startOffset:t+r.length}}else e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this),n={startNode:e,startOffset:r.length};else t===this.rightGuard&&(this.next instanceof dr?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this.next),n={startNode:e,startOffset:r.length}));return t.data=$r,n}update(t,e){t.forEach(t=>{if("characterData"===t.type&&(t.target===this.leftGuard||t.target===this.rightGuard)){const n=this.restore(t.target);n&&(e.range=n)}})}}class Kr{isComposing=!1;constructor(t,e){this.scroll=t,this.emitter=e,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",t=>{this.isComposing||this.handleCompositionStart(t)}),this.scroll.domNode.addEventListener("compositionend",t=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(t)})})}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;!e||e instanceof Vr||(this.emitter.emit(Tr.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(Tr.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(Tr.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(Tr.events.COMPOSITION_END,t),this.isComposing=!1}}class Wr{static DEFAULTS={modules:{}};static themes={default:Wr};modules={};constructor(t,e){this.quill=t,this.options=e}init(){Object.keys(this.options.modules).forEach(t=>{null==this.modules[t]&&this.addModule(t)})}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}}const Zr=t=>t.parentElement||t.getRootNode().host||null,Gr=t=>{const e=t.getBoundingClientRect(),n="offsetWidth"in t&&Math.abs(e.width)/t.offsetWidth||1,r="offsetHeight"in t&&Math.abs(e.height)/t.offsetHeight||1;return{top:e.top,right:e.left+t.clientWidth*n,bottom:e.top+t.clientHeight*r,left:e.left}},Qr=t=>{const e=parseInt(t,10);return Number.isNaN(e)?0:e},Xr=(t,e,n,r,s,i)=>t<n&&e>r?0:t<n?-(n-t+s):e>r?e-t>r-n?t+s-n:e-r+i:0,Yr=["block","break","cursor","inline","scroll","text"],Jr=Lr("quill"),ts=new Dn;Xn.uiClass="ql-ui";class es{static DEFAULTS={bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:ts,theme:"default"};static events=Tr.events;static sources=Tr.sources;static version="2.0.2";static imports={delta:S,parchment:ur,"core/module":Fr,"core/theme":Wr};static debug(t){!0===t&&(t="log"),Lr.level(t)}static find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Ar.get(t)||ts.find(t,e)}static import(t){return null==this.imports[t]&&Jr.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const t=arguments.length<=0?void 0:arguments[0],e=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in t?t.attrName:t.blotName;"string"==typeof n?this.register(`formats/${n}`,t,e):Object.keys(t).forEach(n=>{this.register(n,t[n],e)})}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1];null==this.imports[t]||!!(arguments.length<=2?void 0:arguments[2])||Jr.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&"boolean"!=typeof e&&"abstract"!==e.blotName&&ts.register(e),"function"==typeof e.register&&e.register(ts)}}constructor(t){if(this.options=function(t,e){const n=ns(t);if(!n)throw new Error("Invalid Quill container");const r=!e.theme||e.theme===es.DEFAULTS.theme,s=r?Wr:es.import(`themes/${e.theme}`);if(!s)throw new Error(`Invalid theme ${e.theme}. Did you register it?`);const{modules:i,...o}=es.DEFAULTS,{modules:l,...a}=s.DEFAULTS;let c=rs(e.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Cn({},rs(i),rs(l),c),h={...o,...ss(a),...ss(e)};let d=e.registry;d?e.formats&&Jr.warn('Ignoring "formats" option because "registry" is specified'):d=e.formats?((t,e,n)=>{const r=new Dn;return Yr.forEach(t=>{const n=e.query(t);n&&r.register(n)}),t.forEach(t=>{let s=e.query(t);s||n.error(`Cannot register "${t}" specified in "formats" config. Are you sure it was registered?`);let i=0;for(;s;)if(r.register(s),s="blotName"in s?s.requiredContainer??null:null,i+=1,i>100){n.error(`Cycle detected in registering blot requiredContainer: "${t}"`);break}}),r})(e.formats,h.registry,Jr):h.registry;return{...h,registry:d,container:n,theme:s,modules:Object.entries(u).reduce((t,e)=>{let[n,r]=e;if(!r)return t;const s=es.import(`modules/${n}`);return null==s?(Jr.error(`Cannot load ${n} module. Are you sure you registered it?`),t):{...t,[n]:Cn({},s.DEFAULTS||{},r)}},{}),bounds:ns(h.bounds)}}(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.container=this.options.container,null==this.container)return void Jr.error("Invalid Quill container",t);this.options.debug&&es.debug(this.options.debug);const e=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",Ar.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new Tr;const n=lr.blotName,r=this.options.registry.query(n);if(!r||!("blotName"in r))throw new Error(`Cannot initialize Quill without "${n}" blot`);if(this.scroll=new r(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new Mr(this.scroll),this.selection=new Cr(this.scroll,this.emitter),this.composition=new Kr(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(Tr.events.EDITOR_CHANGE,t=>{t===Tr.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(Tr.events.SCROLL_UPDATE,(t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),s=n&&r?{oldRange:n,newRange:r}:void 0;is.call(this,()=>this.editor.update(null,e,s),t)}),this.emitter.on(Tr.events.SCROLL_EMBED_UPDATE,(t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),s=n&&r?{oldRange:n,newRange:r}:void 0;is.call(this,()=>{const n=(new S).retain(t.offset(this)).retain({[t.statics.blotName]:e});return this.editor.update(n,[],s)},es.sources.USER)}),e){const t=this.clipboard.convert({html:`${e}<p><br></p>`,text:"\n"});this.setContents(t)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){const e=t;(t=document.createElement("div")).classList.add(e)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,n){return[t,e,,n]=os(t,e,n),is.call(this,()=>this.editor.deleteText(t,e),n,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){return is.call(this,()=>{const n=this.getSelection(!0);let r=new S;if(null==n)return r;if(this.scroll.query(t,Rn.BLOCK))r=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(0===n.length)return this.selection.format(t,e),r;r=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,Tr.sources.SILENT),r},arguments.length>2&&void 0!==arguments[2]?arguments[2]:Tr.sources.API)}formatLine(t,e,n,r,s){let i;return[t,e,i,s]=os(t,e,n,r,s),is.call(this,()=>this.editor.formatLine(t,e,i),s,t,0)}formatText(t,e,n,r,s){let i;return[t,e,i,s]=os(t,e,n,r,s),is.call(this,()=>this.editor.formatText(t,e,i),s,t,0)}getBounds(t){let e=null;if(e="number"==typeof t?this.selection.getBounds(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0):this.selection.getBounds(t.index,t.length),!e)return null;const n=this.container.getBoundingClientRect();return{bottom:e.bottom-n.top,height:e.height,left:e.left-n.left,right:e.right-n.left,top:e.top-n.top,width:e.width}}getContents(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t;return[t,e]=os(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0);return"number"==typeof t?this.editor.getFormat(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0):this.editor.getFormat(t.index,t.length)}getIndex(t){return t.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(t){return this.scroll.leaf(t)}getLine(t){return this.scroll.line(t)}getLines(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}getModule(t){return this.theme.modules[t]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=os(t,e),this.editor.getHTML(t,e)}getText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=os(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,n){return is.call(this,()=>this.editor.insertEmbed(t,e,n),arguments.length>3&&void 0!==arguments[3]?arguments[3]:es.sources.API,t)}insertText(t,e,n,r,s){let i;return[t,,i,s]=os(t,0,n,r,s),is.call(this,()=>this.editor.insertText(t,e,i),s,t,e.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(t,e,n){return[t,e,,n]=os(t,e,n),is.call(this,()=>this.editor.removeFormat(t,e),n,t)}scrollRectIntoView(t){((t,e)=>{const n=t.ownerDocument;let r=e,s=t;for(;s;){const t=s===n.body,e=t?{top:0,right:window.visualViewport?.width??n.documentElement.clientWidth,bottom:window.visualViewport?.height??n.documentElement.clientHeight,left:0}:Gr(s),i=getComputedStyle(s),o=Xr(r.left,r.right,e.left,e.right,Qr(i.scrollPaddingLeft),Qr(i.scrollPaddingRight)),l=Xr(r.top,r.bottom,e.top,e.bottom,Qr(i.scrollPaddingTop),Qr(i.scrollPaddingBottom));if(o||l)if(t)n.defaultView?.scrollBy(o,l);else{const{scrollLeft:t,scrollTop:e}=s;l&&(s.scrollTop+=l),o&&(s.scrollLeft+=o);const n=s.scrollLeft-t,i=s.scrollTop-e;r={left:r.left-n,top:r.top-i,right:r.right-n,bottom:r.bottom-i}}s=t||"fixed"===i.position?null:Zr(s)}})(this.root,t)}scrollIntoView(){console.warn("Quill#scrollIntoView() has been deprecated and will be removed in the near future. Please use Quill#scrollSelectionIntoView() instead."),this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){return is.call(this,()=>{t=new S(t);const e=this.getLength(),n=this.editor.deleteText(0,e),r=this.editor.insertContents(0,t),s=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(s)},arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tr.sources.API)}setSelection(t,e,n){null==t?this.selection.setRange(null,e||es.sources.API):([t,e,,n]=os(t,e,n),this.selection.setRange(new jr(Math.max(0,t),e),n),n!==Tr.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tr.sources.API;const n=(new S).insert(t);return this.setContents(n,e)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Tr.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){return is.call(this,()=>(t=new S(t),this.editor.applyDelta(t)),arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tr.sources.API,!0)}}function ns(t){return"string"==typeof t?document.querySelector(t):t}function rs(t){return Object.entries(t??{}).reduce((t,e)=>{let[n,r]=e;return{...t,[n]:!0===r?{}:r}},{})}function ss(t){return Object.fromEntries(Object.entries(t).filter(t=>void 0!==t[1]))}function is(t,e,n,r){if(!this.isEnabled()&&e===Tr.sources.USER&&!this.allowReadOnlyEdits)return new S;let s=null==n?null:this.getSelection();const i=this.editor.delta,o=t();if(null!=s&&(!0===n&&(n=s.index),null==r?s=ls(s,o,e):0!==r&&(s=ls(s,n,r,e)),this.setSelection(s,Tr.sources.SILENT)),o.length()>0){const t=[Tr.events.TEXT_CHANGE,o,i,e];this.emitter.emit(Tr.events.EDITOR_CHANGE,...t),e!==Tr.sources.SILENT&&this.emitter.emit(...t)}return o}function os(t,e,n,r,s){let i={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(s=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(s=r,r=n,n=e,e=0),"object"==typeof n?(i=n,s=r):"string"==typeof n&&(null!=r?i[n]=r:s=n),[t,e,i,s=s||Tr.sources.API]}function ls(t,e,n,r){const s="number"==typeof n?n:0;if(null==t)return null;let i,o;return[i,o]=[t.index,t.index+t.length].map(e&&"function"==typeof e.transformPosition?t=>e.transformPosition(t,r!==Tr.sources.USER):t=>t<e||t===e&&r===Tr.sources.USER?t:s>=0?t+s:Math.max(e,t+s)),new jr(i,o-i)}class as extends rr{}function cs(t){return t instanceof gr||t instanceof mr}function us(t){return"function"==typeof t.updateContent}function hs(t,e,n){n.reduce((e,n)=>{const r=T.Op.length(n);let s=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){t.insertAt(e,n.insert);const[r]=t.descendant(Wn,e),i=yr(r);s=T.AttributeMap.diff(i,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;t.insertAt(e,r,n.insert[r]);if(null!=t.scroll.query(r,Rn.INLINE)){const[n]=t.descendant(Wn,e),r=yr(n);s=T.AttributeMap.diff(r,s)||{}}}return Object.keys(s).forEach(n=>{t.formatAt(e,r,n,s[n])}),e+r},e)}const ds={scope:Rn.BLOCK,whitelist:["right","center","justify"]},fs=new In("align","align",ds),ps=new Pn("align","ql-align",ds),gs=new Hn("align","text-align",ds);class ms extends Hn{value(t){let e=super.value(t);if(!e.startsWith("rgb("))return e;e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${e.split(",").map(t=>`00${parseInt(t,10).toString(16)}`.slice(-2)).join("")}`}}const bs=new Pn("color","ql-color",{scope:Rn.INLINE}),ys=new ms("color","color",{scope:Rn.INLINE}),vs=new Pn("background","ql-bg",{scope:Rn.INLINE}),xs=new ms("background","background-color",{scope:Rn.INLINE});class Ns extends as{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(t=>t.length()<=1?"":t.domNode.innerText).join("\n").slice(t,t+e)}html(t,e){return`<pre>\n${fr(this.code(t,e))}\n</pre>`}}class Es extends gr{static TAB=" ";static register(){es.register(Ns)}}class ws extends pr{}ws.blotName="code",ws.tagName="CODE",Es.blotName="code-block",Es.className="ql-code-block",Es.tagName="DIV",Ns.blotName="code-block-container",Ns.className="ql-code-block-container",Ns.tagName="DIV",Ns.allowedChildren=[Es],Es.allowedChildren=[dr,hr,vr],Es.requiredContainer=Ns;const As={scope:Rn.BLOCK,whitelist:["rtl"]},qs=new In("direction","dir",As),ks=new Pn("direction","ql-direction",As),_s=new Hn("direction","direction",As),Ls={scope:Rn.INLINE,whitelist:["serif","monospace"]},Os=new Pn("font","ql-font",Ls);const Ts=new class extends Hn{value(t){return super.value(t).replace(/["']/g,"")}}("font","font-family",Ls),Ss=new Pn("size","ql-size",{scope:Rn.INLINE,whitelist:["small","large","huge"]}),js=new Hn("size","font-size",{scope:Rn.INLINE,whitelist:["10px","18px","32px"]}),Cs=Lr("quill:keyboard"),Rs=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Is extends Fr{static match(t,e){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!e[n]!==t[n]&&null!==e[n])&&(e.key===t.key||e.key===t.which)}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(t=>{this.options.bindings[t]&&this.addBinding(this.options.bindings[t])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(t){if("string"==typeof t||"number"==typeof t)t={key:t};else{if("object"!=typeof t)return null;t=un(t)}t.shortKey&&(t[Rs]=t.shortKey,delete t.shortKey);return t}(t);if(null==r)return void Cs.warn("Attempted to add invalid keyboard binding",r);"function"==typeof e&&(e={handler:e}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(t=>{const s={...r,key:t,...e,...n};this.bindings[s.key]=this.bindings[s.key]||[],this.bindings[s.key].push(s)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing)return;if(229===t.keyCode&&("Enter"===t.key||"Backspace"===t.key))return;const e=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(e=>Is.match(t,e));if(0===e.length)return;const n=es.find(t.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[s,i]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof cr?o.value().slice(0,l):"",h=a instanceof cr?a.value().slice(c):"",d={collapsed:0===r.length,empty:0===r.length&&s.length()<=1,format:this.quill.getFormat(r),line:s,offset:i,prefix:u,suffix:h,event:t};e.some(t=>{if(null!=t.collapsed&&t.collapsed!==d.collapsed)return!1;if(null!=t.empty&&t.empty!==d.empty)return!1;if(null!=t.offset&&t.offset!==d.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(t=>null==d.format[t]))return!1}else if("object"==typeof t.format&&!Object.keys(t.format).every(e=>!0===t.format[e]?null!=d.format[e]:!1===t.format[e]?null==d.format[e]:Sn(t.format[e],d.format[e])))return!1;return!(null!=t.prefix&&!t.prefix.test(d.prefix))&&(!(null!=t.suffix&&!t.suffix.test(d.suffix))&&!0!==t.handler.call(this,r,d,t))})&&t.preventDefault()})}handleBackspace(t,e){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(0===t.index||this.quill.getLength()<=1)return;let r={};const[s]=this.quill.getLine(t.index);let i=(new S).retain(t.index-n).delete(n);if(0===e.offset){const[e]=this.quill.getLine(t.index-1);if(e){if(!("block"===e.statics.blotName&&e.length()<=1)){const e=s.formats(),n=this.quill.getFormat(t.index-1,1);if(r=T.AttributeMap.diff(e,n)||{},Object.keys(r).length>0){const e=(new S).retain(t.index+s.length()-2).retain(1,r);i=i.compose(e)}}}}this.quill.updateContents(i,es.sources.USER),this.quill.focus()}handleDelete(t,e){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-n)return;let r={};const[s]=this.quill.getLine(t.index);let i=(new S).retain(t.index).delete(n);if(e.offset>=s.length()-1){const[e]=this.quill.getLine(t.index+1);if(e){const n=s.formats(),o=this.quill.getFormat(t.index,1);r=T.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(i=i.retain(e.length()-1).retain(1,r))}}this.quill.updateContents(i,es.sources.USER),this.quill.focus()}handleDeleteRange(t){zs({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const n=Object.keys(e.format).reduce((t,n)=>(this.quill.scroll.query(n,Rn.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t),{}),r=(new S).retain(t.index).delete(t.length).insert("\n",n);this.quill.updateContents(r,es.sources.USER),this.quill.setSelection(t.index+1,es.sources.SILENT),this.quill.focus()}}const Ms={bindings:{bold:Us("bold"),italic:Us("italic"),underline:Us("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","+1",es.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","-1",es.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(t,e){null!=e.format.indent?this.quill.format("indent","-1",es.sources.USER):null!=e.format.list&&this.quill.format("list",!1,es.sources.USER)}},"indent code-block":Bs(!0),"outdent code-block":Bs(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(t){this.quill.deleteText(t.index-1,1,es.sources.USER)}},tab:{key:"Tab",handler(t,e){if(e.format.table)return!0;this.quill.history.cutoff();const n=(new S).retain(t.index).delete(t.length).insert("\t");return this.quill.updateContents(n,es.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,es.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,es.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(t,e){const n={list:!1};e.format.indent&&(n.indent=!1),this.quill.formatLine(t.index,t.length,n,es.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(t){const[e,n]=this.quill.getLine(t.index),r={...e.formats(),list:"checked"},s=(new S).retain(t.index).insert("\n",r).retain(e.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(s,es.sources.USER),this.quill.setSelection(t.index+1,es.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(t,e){const[n,r]=this.quill.getLine(t.index),s=(new S).retain(t.index).insert("\n",e.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(s,es.sources.USER),this.quill.setSelection(t.index+1,es.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(t){const e=this.quill.getModule("table");if(e){const[n,r,s,i]=e.getTable(t),o=function(t,e,n,r){if(null==e.prev&&null==e.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==e.prev)return-1;if(null==e.next)return 1;return null}(0,r,s,i);if(null==o)return;let l=n.offset();if(o<0){const e=(new S).retain(l).insert("\n");this.quill.updateContents(e,es.sources.USER),this.quill.setSelection(t.index+1,t.length,es.sources.SILENT)}else if(o>0){l+=n.length();const t=(new S).retain(l).insert("\n");this.quill.updateContents(t,es.sources.USER),this.quill.setSelection(l,es.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(t,e){const{event:n,line:r}=e,s=r.offset(this.quill.scroll);this.quill.setSelection(n.shiftKey?s-1:s+r.length(),es.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(t,e){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=e.prefix,[r,s]=this.quill.getLine(t.index);if(s>n)return!0;let i;switch(e.prefix.trim()){case"[]":case"[ ]":i="unchecked";break;case"[x]":i="checked";break;case"-":case"*":i="bullet";break;default:i="ordered"}this.quill.insertText(t.index," ",es.sources.USER),this.quill.history.cutoff();const o=(new S).retain(t.index-s).delete(n+1).retain(r.length()-2-s).retain(1,{list:i});return this.quill.updateContents(o,es.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-n,es.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(t){const[e,n]=this.quill.getLine(t.index);let r=2,s=e;for(;null!=s&&s.length()<=1&&s.formats()["code-block"];)if(s=s.prev,r-=1,r<=0){const r=(new S).retain(t.index+e.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,es.sources.USER),this.quill.setSelection(t.index-1,es.sources.SILENT),!1}return!0}},"embed left":Ds("ArrowLeft",!1),"embed left shift":Ds("ArrowLeft",!0),"embed right":Ds("ArrowRight",!1),"embed right shift":Ds("ArrowRight",!0),"table down":Ps(!1),"table up":Ps(!0)}};function Bs(t){return{key:"Tab",shiftKey:!t,format:{"code-block":!0},handler(e,n){let{event:r}=n;const s=this.quill.scroll.query("code-block"),{TAB:i}=s;if(0===e.length&&!r.shiftKey)return this.quill.insertText(e.index,i,es.sources.USER),void this.quill.setSelection(e.index+i.length,es.sources.SILENT);const o=0===e.length?this.quill.getLines(e.index,1):this.quill.getLines(e);let{index:l,length:a}=e;o.forEach((e,n)=>{t?(e.insertAt(0,i),0===n?l+=i.length:a+=i.length):e.domNode.textContent.startsWith(i)&&(e.deleteAt(0,i.length),0===n?l-=i.length:a-=i.length)}),this.quill.update(es.sources.USER),this.quill.setSelection(l,a,es.sources.SILENT)}}}function Ds(t,e){const n="ArrowLeft"===t?"prefix":"suffix";return{key:t,shiftKey:e,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===t&&(r+=n.length+1);const[s]=this.quill.getLeaf(r);return!(s instanceof sr)||("ArrowLeft"===t?e?this.quill.setSelection(n.index-1,n.length+1,es.sources.USER):this.quill.setSelection(n.index-1,es.sources.USER):e?this.quill.setSelection(n.index,n.length+1,es.sources.USER):this.quill.setSelection(n.index+n.length+1,es.sources.USER),!1)}}}function Us(t){return{key:t[0],shortKey:!0,handler(e,n){this.quill.format(t,!n.format[t],es.sources.USER)}}}function Ps(t){return{key:t?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(e,n){const r=t?"prev":"next",s=n.line,i=s.parent[r];if(null!=i){if("table-row"===i.statics.blotName){let t=i.children.head,e=s;for(;null!=e.prev;)e=e.prev,t=t.next;const r=t.offset(this.quill.scroll)+Math.min(n.offset,t.length()-1);this.quill.setSelection(r,0,es.sources.USER)}}else{const e=s.table()[r];null!=e&&this.quill.setSelection(t?e.offset(this.quill.scroll)+e.length()-1:e.offset(this.quill.scroll),0,es.sources.USER)}return!1}}}function zs(t){let{quill:e,range:n}=t;const r=e.getLines(n);let s={};if(r.length>1){const t=r[0].formats(),e=r[r.length-1].formats();s=T.AttributeMap.diff(e,t)||{}}e.deleteText(n,es.sources.USER),Object.keys(s).length>0&&e.formatLine(n.index,1,s,es.sources.USER),e.setSelection(n.index,es.sources.SILENT)}Is.DEFAULTS=Ms;const Hs=/font-weight:\s*normal/,Fs=["P","OL","UL"],$s=t=>t&&Fs.includes(t.tagName);const Vs=/\bmso-list:[^;]*ignore/i,Ks=/\bmso-list:[^;]*\bl(\d+)/i,Ws=/\bmso-list:[^;]*\blevel(\d+)/i,Zs=t=>{const e=Array.from(t.querySelectorAll("[style*=mso-list]")),n=[],r=[];e.forEach(t=>{(t.getAttribute("style")||"").match(Vs)?n.push(t):r.push(t)}),n.forEach(t=>t.parentNode?.removeChild(t));const s=t.documentElement.innerHTML,i=r.map(t=>((t,e)=>{const n=t.getAttribute("style"),r=n?.match(Ks);if(!r)return null;const s=Number(r[1]),i=n?.match(Ws),o=i?Number(i[1]):1,l=new RegExp(`@list l${s}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=e.match(l);return{id:s,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:t}})(t,s)).filter(t=>t);for(;i.length;){const t=[];let e=i.shift();for(;e;)t.push(e),e=i.length&&i[0]?.element===e.element.nextElementSibling&&i[0].id===e.id?i.shift():null;const n=document.createElement("ul");t.forEach(t=>{const e=document.createElement("li");e.setAttribute("data-list",t.type),t.indent>1&&e.setAttribute("class","ql-indent-"+(t.indent-1)),e.innerHTML=t.element.innerHTML,n.appendChild(e)});const r=t[0]?.element,{parentNode:s}=r??{};r&&s?.replaceChild(n,r),t.slice(1).forEach(t=>{let{element:e}=t;s?.removeChild(e)})}};const Gs=[function(t){"urn:schemas-microsoft-com:office:word"===t.documentElement.getAttribute("xmlns:w")&&Zs(t)},function(t){t.querySelector('[id^="docs-internal-guid-"]')&&((t=>{Array.from(t.querySelectorAll('b[style*="font-weight"]')).filter(t=>t.getAttribute("style")?.match(Hs)).forEach(e=>{const n=t.createDocumentFragment();n.append(...e.childNodes),e.parentNode?.replaceChild(n,e)})})(t),(t=>{Array.from(t.querySelectorAll("br")).filter(t=>$s(t.previousElementSibling)&&$s(t.nextElementSibling)).forEach(t=>{t.parentNode?.removeChild(t)})})(t))}],Qs=Lr("quill:clipboard"),Xs=[[Node.TEXT_NODE,function(t,e,n){let r=t.data;if("O:P"===t.parentElement?.tagName)return e.insert(r.trim());if(!si(t)){if(0===r.trim().length&&r.includes("\n")&&!function(t,e){return t.previousElementSibling&&t.nextElementSibling&&!ni(t.previousElementSibling,e)&&!ni(t.nextElementSibling,e)}(t,n))return e;const s=(t,e)=>{const n=e.replace(/[^\u00a0]/g,"");return n.length<1&&t?" ":n};r=r.replace(/\r\n/g," ").replace(/\n/g," "),r=r.replace(/\s\s+/g,s.bind(s,!0)),(null==t.previousSibling&&null!=t.parentElement&&ni(t.parentElement,n)||t.previousSibling instanceof Element&&ni(t.previousSibling,n))&&(r=r.replace(/^\s+/,s.bind(s,!1))),(null==t.nextSibling&&null!=t.parentElement&&ni(t.parentElement,n)||t.nextSibling instanceof Element&&ni(t.nextSibling,n))&&(r=r.replace(/\s+$/,s.bind(s,!1)))}return e.insert(r)}],[Node.TEXT_NODE,li],["br",function(t,e){ei(e,"\n")||e.insert("\n");return e}],[Node.ELEMENT_NODE,li],[Node.ELEMENT_NODE,function(t,e,n){const r=n.query(t);if(null==r)return e;if(r.prototype instanceof sr){const e={},s=r.value(t);if(null!=s)return e[r.blotName]=s,(new S).insert(e,r.formats(t,n))}else if(r.prototype instanceof er&&!ei(e,"\n")&&e.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return ti(e,r.blotName,r.formats(t,n),n);return e}],[Node.ELEMENT_NODE,function(t,e,n){const r=In.keys(t),s=Pn.keys(t),i=Hn.keys(t),o={};return r.concat(s).concat(i).forEach(e=>{let r=n.query(e,Rn.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(r=Ys[e],null==r||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),r=Js[e],null==r||r.attrName!==e&&r.keyName!==e||(r=Js[e],o[r.attrName]=r.value(t)||void 0))}),Object.entries(o).reduce((t,e)=>{let[r,s]=e;return ti(t,r,s,n)},e)}],[Node.ELEMENT_NODE,function(t,e,n){const r={},s=t.style||{};"italic"===s.fontStyle&&(r.italic=!0);"underline"===s.textDecoration&&(r.underline=!0);"line-through"===s.textDecoration&&(r.strike=!0);(s.fontWeight?.startsWith("bold")||parseInt(s.fontWeight,10)>=700)&&(r.bold=!0);if(e=Object.entries(r).reduce((t,e)=>{let[r,s]=e;return ti(t,r,s,n)},e),parseFloat(s.textIndent||0)>0)return(new S).insert("\t").concat(e);return e}],["li",function(t,e,n){const r=n.query(t);if(null==r||"list"!==r.blotName||!ei(e,"\n"))return e;let s=-1,i=t.parentNode;for(;null!=i;)["OL","UL"].includes(i.tagName)&&(s+=1),i=i.parentNode;return s<=0?e:e.reduce((t,e)=>e.insert?e.attributes&&"number"==typeof e.attributes.indent?t.push(e):t.insert(e.insert,{indent:s,...e.attributes||{}}):t,new S)}],["ol, ul",function(t,e,n){let r="OL"===t.tagName?"ordered":"bullet";const s=t.getAttribute("data-checked");s&&(r="true"===s?"checked":"unchecked");return ti(e,"list",r,n)}],["pre",function(t,e,n){const r=n.query("code-block"),s=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(t,n);return ti(e,"code-block",s,n)}],["tr",function(t,e,n){const r="TABLE"===t.parentElement?.tagName?t.parentElement:t.parentElement?.parentElement;if(null!=r){return ti(e,"table",Array.from(r.querySelectorAll("tr")).indexOf(t)+1,n)}return e}],["b",oi("bold")],["i",oi("italic")],["strike",oi("strike")],["style",function(){return new S}]],Ys=[fs,qs].reduce((t,e)=>(t[e.keyName]=e,t),{}),Js=[gs,xs,ys,_s,Ts,js].reduce((t,e)=>(t[e.keyName]=e,t),{});function ti(t,e,n,r){return r.query(e)?t.reduce((t,r)=>{if(!r.insert)return t;if(r.attributes&&r.attributes[e])return t.push(r);return t.insert(r.insert,{...n?{[e]:n}:{},...r.attributes})},new S):t}function ei(t,e){let n="";for(let r=t.ops.length-1;r>=0&&n.length<e.length;--r){const e=t.ops[r];if("string"!=typeof e.insert)break;n=e.insert+n}return n.slice(-1*e.length)===e}function ni(t,e){if(!(t instanceof Element))return!1;const n=e.query(t);return!(n&&n.prototype instanceof sr)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(t.tagName.toLowerCase())}const ri=new WeakMap;function si(t){return null!=t&&(ri.has(t)||ri.set(t,"PRE"===t.tagName||si(t.parentNode)),ri.get(t))}function ii(t,e,n,r,s){return e.nodeType===e.TEXT_NODE?r.reduce((n,r)=>r(e,n,t),new S):e.nodeType===e.ELEMENT_NODE?Array.from(e.childNodes||[]).reduce((i,o)=>{let l=ii(t,o,n,r,s);return o.nodeType===e.ELEMENT_NODE&&(l=n.reduce((e,n)=>n(o,e,t),l),l=(s.get(o)||[]).reduce((e,n)=>n(o,e,t),l)),i.concat(l)},new S):new S}function oi(t){return(e,n,r)=>ti(n,t,!0,r)}function li(t,e,n){if(!ei(e,"\n")){if(ni(t,n)&&(t.childNodes.length>0||t instanceof HTMLParagraphElement))return e.insert("\n");if(e.length()>0&&t.nextSibling){let r=t.nextSibling;for(;null!=r;){if(ni(r,n))return e.insert("\n");const t=n.query(r);if(t&&t.prototype instanceof mr)return e.insert("\n");r=r.firstChild}}}return e}function ai(t,e){let n=e;for(let r=t.length-1;r>=0;r-=1){const e=t[r];t[r]={delta:n.transform(e.delta,!0),range:e.range&&ci(e.range,n)},n=e.delta.transform(n),0===t[r].delta.length()&&t.splice(r,1)}}function ci(t,e){if(!t)return t;const n=e.transformPosition(t.index);return{index:n,length:e.transformPosition(t.index+t.length)-n}}class ui extends Fr{constructor(t,e){super(t,e),t.root.addEventListener("drop",e=>{e.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(e.clientX,e.clientY);else if(document.caretPositionFromPoint){const t=document.caretPositionFromPoint(e.clientX,e.clientY);n=document.createRange(),n.setStart(t.offsetNode,t.offset),n.setEnd(t.offsetNode,t.offset)}const r=n&&t.selection.normalizeNative(n);if(r){const n=t.selection.normalizedToRange(r);e.dataTransfer?.files&&this.upload(n,e.dataTransfer.files)}})}upload(t,e){const n=[];Array.from(e).forEach(t=>{t&&this.options.mimetypes?.includes(t.type)&&n.push(t)}),n.length>0&&this.options.handler.call(this,t,n)}}ui.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(t,e){if(!this.quill.scroll.query("image"))return;const n=e.map(t=>new Promise(e=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.readAsDataURL(t)}));Promise.all(n).then(e=>{const n=e.reduce((t,e)=>t.insert({image:e}),(new S).retain(t.index).delete(t.length));this.quill.updateContents(n,Tr.sources.USER),this.quill.setSelection(t.index+e.length,Tr.sources.SILENT)})}};const hi=["insertText","insertReplacementText"];const di=/Mac/i.test(navigator.platform);es.register({"blots/block":gr,"blots/block/embed":mr,"blots/break":hr,"blots/container":as,"blots/cursor":vr,"blots/embed":Vr,"blots/inline":pr,"blots/scroll":class extends lr{static blotName="scroll";static className="ql-editor";static tagName="DIV";static defaultChild=gr;static allowedChildren=[gr,mr,as];constructor(t,e,n){let{emitter:r}=n;super(t,e),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",t=>this.handleDragStart(t))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(Tr.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(Tr.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(Tr.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[n,r]=this.line(t),[s]=this.line(t+e);if(super.deleteAt(t,e),null!=s&&n!==s&&r>0){if(n instanceof mr||s instanceof mr)return void this.optimize();n.moveChildren(s,s.children.head instanceof hr?null:s.children.head),n.remove()}this.optimize()}enable(){this.domNode.setAttribute("contenteditable",!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?"true":"false")}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.optimize()}insertAt(t,e,n){if(t>=this.length())if(null==n||null==this.scroll.query(e,Rn.BLOCK)){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t),null==n&&e.endsWith("\n")?t.insertAt(0,e.slice(0,-1),n):t.insertAt(0,e,n)}else{const t=this.scroll.create(e,n);this.appendChild(t)}else super.insertAt(t,e,n);this.optimize()}insertBefore(t,e){if(t.statics.scope===Rn.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(t),super.insertBefore(n,e)}else super.insertBefore(t,e)}insertContents(t,e){const n=this.deltaToRenderBlocks(e.concat((new S).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const s=n.shift();if(s){const e="block"===s.type&&(0===s.delta.length()||!this.descendant(mr,t)[0]&&t<this.length()),n="block"===s.type?s.delta:(new S).insert({[s.key]:s.value});hs(this,t,n);const r="block"===s.type?1:0,i=t+n.length()+r;e&&this.insertAt(i-1,"\n");const o=yr(this.line(t)[0]),l=T.AttributeMap.diff(o,s.attributes)||{};Object.keys(l).forEach(t=>{this.formatAt(i-1,1,t,l[t])}),t=i}let[i,o]=this.children.find(t);if(n.length&&(i&&(i=i.split(o),o=0),n.forEach(t=>{if("block"===t.type){hs(this.createBlock(t.attributes,i||void 0),0,t.delta)}else{const e=this.create(t.key,t.value);this.insertBefore(e,i||void 0),Object.keys(t.attributes).forEach(n=>{e.format(n,t.attributes[n])})}})),"block"===r.type&&r.delta.length()){hs(this,i?i.offset(i.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[n,r]=e;return n instanceof Wn?[n,r]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(cs,t)}lines(){const t=(e,n,r)=>{let s=[],i=r;return e.children.forEachAt(n,r,(e,n,r)=>{cs(e)?s.push(e):e instanceof rr&&(s=s.concat(t(e,n,i))),i-=r}),s};return t(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE)}optimize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(t,e),t.length>0&&this.emitter.emit(Tr.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch)return void(Array.isArray(t)&&(this.batch=this.batch.concat(t)));let e=Tr.sources.USER;"string"==typeof t&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),(t=t.filter(t=>{let{target:e}=t;const n=this.find(e,!0);return n&&!us(n)})).length>0&&this.emitter.emit(Tr.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(Tr.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,n){const[r]=this.descendant(t=>t instanceof mr,t);r&&r.statics.blotName===e&&us(r)&&r.updateContent(n)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let n=new S;return t.forEach(t=>{const r=t?.insert;if(r)if("string"==typeof r){const s=r.split("\n");s.slice(0,-1).forEach(r=>{n.insert(r,t.attributes),e.push({type:"block",delta:n,attributes:t.attributes??{}}),n=new S});const i=s[s.length-1];i&&n.insert(i,t.attributes)}else{const s=Object.keys(r)[0];if(!s)return;this.query(s,Rn.INLINE)?n.push(t):(n.length()&&e.push({type:"block",delta:n,attributes:{}}),n=new S,e.push({type:"blockEmbed",key:s,value:r[s],attributes:t.attributes??{}}))}}),n.length()&&e.push({type:"block",delta:n,attributes:{}}),e}createBlock(t,e){let n;const r={};Object.entries(t).forEach(t=>{let[e,s]=t;null!=this.query(e,Rn.BLOCK&Rn.BLOT)?n=e:r[e]=s});const s=this.create(n||this.statics.defaultChild.blotName,n?t[n]:void 0);this.insertBefore(s,e||void 0);const i=s.length();return Object.entries(r).forEach(t=>{let[e,n]=t;s.formatAt(0,i,e,n)}),s}},"blots/text":dr,"modules/clipboard":class extends Fr{static DEFAULTS={matchers:[]};constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",t=>this.onCaptureCopy(t,!1)),this.quill.root.addEventListener("cut",t=>this.onCaptureCopy(t,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Xs.concat(this.options.matchers??[]).forEach(t=>{let[e,n]=t;this.addMatcher(e,n)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:n}=t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[Es.blotName])return(new S).insert(n||"",{[Es.blotName]:r[Es.blotName]});if(!e)return(new S).insert(n||"",r);const s=this.convertHTML(e);return ei(s,"\n")&&(null==s.ops[s.ops.length-1].attributes||r.table)?s.compose((new S).retain(s.length()-1).delete(1)):s}normalizeHTML(t){(t=>{t.documentElement&&Gs.forEach(e=>{e(t)})})(t)}convertHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");this.normalizeHTML(e);const n=e.body,r=new WeakMap,[s,i]=this.prepareMatching(n,r);return ii(this.quill.scroll,n,s,i,r)}dangerouslyPasteHTML(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:es.sources.API;if("string"==typeof t){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,es.sources.SILENT)}else{const r=this.convert({html:e,text:""});this.quill.updateContents((new S).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),es.sources.SILENT)}}onCaptureCopy(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.defaultPrevented)return;t.preventDefault();const[n]=this.quill.selection.getRange();if(null==n)return;const{html:r,text:s}=this.onCopy(n,e);t.clipboardData?.setData("text/plain",s),t.clipboardData?.setData("text/html",r),e&&zs({range:n,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(t=>"#"!==t[0]).join("\n")}onCapturePaste(t){if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(null==e)return;const n=t.clipboardData?.getData("text/html");let r=t.clipboardData?.getData("text/plain");if(!n&&!r){const e=t.clipboardData?.getData("text/uri-list");e&&(r=this.normalizeURIList(e))}const s=Array.from(t.clipboardData?.files||[]);if(!n&&s.length>0)this.quill.uploader.upload(e,s);else{if(n&&s.length>0){const t=(new DOMParser).parseFromString(n,"text/html");if(1===t.body.childElementCount&&"IMG"===t.body.firstElementChild?.tagName)return void this.quill.uploader.upload(e,s)}this.onPaste(e,{html:n,text:r})}}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:n,html:r}=e;const s=this.quill.getFormat(t.index),i=this.convert({text:n,html:r},s);Qs.log("onPaste",i,{text:n,html:r});const o=(new S).retain(t.index).delete(t.length).concat(i);this.quill.updateContents(o,es.sources.USER),this.quill.setSelection(o.length()-t.length,es.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const n=[],r=[];return this.matchers.forEach(s=>{const[i,o]=s;switch(i){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(t.querySelectorAll(i)).forEach(t=>{if(e.has(t)){const n=e.get(t);n?.push(o)}else e.set(t,[o])})}}),[n,r]}},"modules/history":class extends Fr{static DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};lastRecorded=0;ignoreChange=!1;stack={undo:[],redo:[]};currentRange=null;constructor(t,e){super(t,e),this.quill.on(es.events.EDITOR_CHANGE,(t,e,n,r)=>{t===es.events.SELECTION_CHANGE?e&&r!==es.sources.SILENT&&(this.currentRange=e):t===es.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==es.sources.USER?this.transform(e):this.record(e,n)),this.currentRange=ci(this.currentRange,e))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",t=>{"historyUndo"===t.inputType?(this.undo(),t.preventDefault()):"historyRedo"===t.inputType&&(this.redo(),t.preventDefault())})}change(t,e){if(0===this.stack[t].length)return;const n=this.stack[t].pop();if(!n)return;const r=this.quill.getContents(),s=n.delta.invert(r);this.stack[e].push({delta:s,range:ci(n.range,s)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,es.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(t,e){if(0===t.ops.length)return;this.stack.redo=[];let n=t.invert(e),r=this.currentRange;const s=Date.now();if(this.lastRecorded+this.options.delay>s&&this.stack.undo.length>0){const t=this.stack.undo.pop();t&&(n=n.compose(t.delta),r=t.range)}else this.lastRecorded=s;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(t){ai(this.stack.undo,t),ai(this.stack.redo,t)}undo(){this.change("undo","redo")}restoreSelection(t){if(t.range)this.quill.setSelection(t.range,es.sources.USER);else{const e=function(t,e){const n=e.reduce((t,e)=>t+(e.delete||0),0);let r=e.length()-n;(function(t,e){const n=e.ops[e.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(e=>null!=t.query(e,Rn.BLOCK));return!1})(t,e)&&(r-=1);return r}(this.quill.scroll,t.delta);this.quill.setSelection(e,es.sources.USER)}}},"modules/keyboard":Is,"modules/uploader":ui,"modules/input":class extends Fr{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",t=>{this.handleBeforeInput(t)}),/Android/i.test(navigator.userAgent)||t.on(es.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){zs({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===t.length)return!1;if(e){const n=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents((new S).retain(t.index).insert(e,n),es.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,es.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!hi.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||!0===e.collapsed)return;const n=function(t){if("string"==typeof t.data)return t.data;if(t.dataTransfer?.types.includes("text/plain"))return t.dataTransfer.getData("text/plain");return null}(t);if(null==n)return;const r=this.quill.selection.normalizeNative(e),s=r?this.quill.selection.normalizedToRange(r):null;s&&this.replaceText(s,n)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}},"modules/uiNode":class extends Fr{isListening=!1;selectionChangeDeadline=0;constructor(t,e){super(t,e),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(t,e){let{line:n,event:r}=e;if(!(n instanceof Xn&&n.uiNode))return!0;const s="rtl"===getComputedStyle(n.domNode).direction;return!!(s&&"ArrowRight"!==r.key||!s&&"ArrowLeft"!==r.key)||(this.quill.setSelection(t.index-1,t.length+(r.shiftKey?1:0),es.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",t=>{!t.defaultPrevented&&(t=>"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowUp"===t.key||"ArrowDown"===t.key||"Home"===t.key||!(!di||"a"!==t.key||!0!==t.ctrlKey))(t)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const t=document.getSelection();if(!t)return;const e=t.getRangeAt(0);if(!0!==e.collapsed||0!==e.startOffset)return;const n=this.quill.scroll.find(e.startContainer);if(!(n instanceof Xn&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),t.removeAllRanges(),t.addRange(r)}}});const fi=new class extends Pn{add(t,e){let n=0;if("+1"===e||"-1"===e){const r=this.value(t)||0;n="+1"===e?r+1:r-1}else"number"==typeof e&&(n=e);return 0===n?(this.remove(t),!0):super.add(t,n.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}("indent","ql-indent",{scope:Rn.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class pi extends as{}pi.blotName="list-container",pi.tagName="OL";class gi extends gr{static create(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){es.register(pi)}constructor(t,e){super(t,e);const n=e.ownerDocument.createElement("span"),r=n=>{if(!t.isEnabled())return;const r=this.statics.formats(e,t);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}gi.blotName="list",gi.tagName="LI",pi.allowedChildren=[gi],gi.requiredContainer=pi;class mi extends pr{static blotName="bold";static tagName=["STRONG","B"];static create(){return super.create()}static formats(){return!0}optimize(t){super.optimize(t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}class bi extends pr{static blotName="link";static tagName="A";static SANITIZED_URL="about:blank";static PROTOCOL_WHITELIST=["http","https","mailto","tel","sms"];static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return yi(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("href",this.constructor.sanitize(e)):super.format(t,e)}}function yi(t,e){const n=document.createElement("a");n.href=t;const r=n.href.slice(0,n.href.indexOf(":"));return e.indexOf(r)>-1}const vi=["alt","height","width"];const xi=["height","width"];const Ni=new Pn("code-token","hljs",{scope:Rn.INLINE});class Ei extends pr{static formats(t,e){for(;null!=t&&t!==e.domNode;){if(t.classList&&t.classList.contains(Es.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,n){super(t,e,n),Ni.add(this.domNode,n)}format(t,e){t!==Ei.blotName?super.format(t,e):e?Ni.add(this.domNode,e):(Ni.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),Ni.value(this.domNode)||this.unwrap()}}Ei.blotName="code-token",Ei.className="ql-token";class wi extends Es{static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),Ei.blotName,!1),super.replaceWith(t,e)}}class Ai extends Ns{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===wi.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(t,e)}))}formatAt(t,e,n,r){n===wi.blotName&&(this.forceNext=!0),super.formatAt(t,e,n,r)}highlight(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).map(t=>t.textContent).join("\n")}\n`,r=wi.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const e=this.children.reduce((t,e)=>t.concat(br(e,!1)),new S),s=t(n,r);e.diff(s).reduce((t,e)=>{let{retain:n,attributes:r}=e;return n?(r&&Object.keys(r).forEach(e=>{[wi.blotName,Ei.blotName].includes(e)&&this.formatAt(t,n,e,r[e])}),t+n):t},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[n]=this.children.find(t);return`<pre data-language="${n?wi.formats(n.domNode):"plain"}">\n${fr(this.code(t,e))}\n</pre>`}optimize(t){if(super.optimize(t),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const t=wi.formats(this.children.head.domNode);t!==this.uiNode.value&&(this.uiNode.value=t)}}}Ai.allowedChildren=[wi],wi.requiredContainer=Ai,wi.allowedChildren=[Ei,vr,dr,hr];class qi extends Fr{static register(){es.register(Ei,!0),es.register(wi,!0),es.register(Ai,!0)}constructor(t,e){if(super(t,e),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((t,e)=>{let{key:n}=e;return t[n]=!0,t},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(es.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof Ai))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(t=>{let{key:n,label:r}=t;const s=e.ownerDocument.createElement("option");s.textContent=r,s.setAttribute("value",n),e.appendChild(s)}),e.addEventListener("change",()=>{t.format(wi.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),null==t.uiNode&&(t.attachUI(e),t.children.head&&(e.value=wi.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(es.events.SCROLL_OPTIMIZE,()=>{t&&clearTimeout(t),t=setTimeout(()=>{this.highlight(),t=null},this.options.interval)})}highlight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(es.sources.USER);const n=this.quill.getSelection();(null==t?this.quill.scroll.descendants(Ai):[t]).forEach(t=>{t.highlight(this.highlightBlot,e)}),this.quill.update(es.sources.SILENT),null!=n&&this.quill.setSelection(n,es.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(e=this.languages[e]?e:"plain","plain"===e)return fr(t).split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[Es.blotName]:e}),t.insert(n)),new S);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(Es.className),n.innerHTML=((t,e,n)=>{if("string"==typeof t.versionString){const r=t.versionString.split(".")[0];if(parseInt(r,10)>=11)return t.highlight(n,{language:e}).value}return t.highlight(e,n).value})(this.options.hljs,e,t),ii(this.quill.scroll,n,[(t,e)=>{const n=Ni.value(t);return n?e.compose((new S).retain(e.length(),{[Ei.blotName]:n})):e}],[(t,n)=>t.data.split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[Es.blotName]:e}),t.insert(n)),n)],new WeakMap)}}qi.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};class ki extends gr{static blotName="table";static tagName="TD";static create(t){const e=super.create();return e.setAttribute("data-row",t||Ti()),e}static formats(t){if(t.hasAttribute("data-row"))return t.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,e){t===ki.blotName&&e?this.domNode.setAttribute("data-row",e):super.format(t,e)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}}class _i extends as{static blotName="table-row";static tagName="TR";checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const t=this.children.head.formats(),e=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return t.table===e.table&&t.table===n.table&&t.table===r.table}return!1}optimize(t){super.optimize(t),this.children.forEach(t=>{if(null==t.next)return;const e=t.formats(),n=t.next.formats();if(e.table!==n.table){const e=this.splitAfter(t);e&&e.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}class Li extends as{static blotName="table-body";static tagName="TBODY"}class Oi extends as{static blotName="table-container";static tagName="TABLE";balanceCells(){const t=this.descendants(_i),e=t.reduce((t,e)=>Math.max(e.children.length,t),0);t.forEach(t=>{new Array(e-t.children.length).fill(0).forEach(()=>{let e;null!=t.children.head&&(e=ki.formats(t.children.head.domNode));const n=this.scroll.create(ki.blotName,e);t.appendChild(n),n.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(Li);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t);null!=n&&n.remove()})}insertColumn(t){const[e]=this.descendant(Li);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t),r=ki.formats(e.children.head.domNode),s=this.scroll.create(ki.blotName,r);e.insertBefore(s,n)})}insertRow(t){const[e]=this.descendant(Li);if(null==e||null==e.children.head)return;const n=Ti(),r=this.scroll.create(_i.blotName);e.children.head.children.forEach(()=>{const t=this.scroll.create(ki.blotName,n);r.appendChild(t)});const s=e.children.at(t);e.insertBefore(r,s)}rows(){const t=this.children.head;return null==t?[]:t.children.map(t=>t)}}function Ti(){return`row-${Math.random().toString(36).slice(2,6)}`}Oi.allowedChildren=[Li],Li.requiredContainer=Oi,Li.allowedChildren=[_i],_i.requiredContainer=Li,_i.allowedChildren=[ki],ki.requiredContainer=_i;const Si=Lr("quill:toolbar");class ji extends Fr{constructor(t,e){if(super(t,e),Array.isArray(this.options.container)){const e=document.createElement("div");e.setAttribute("role","toolbar"),function(t,e){Array.isArray(e[0])||(e=[e]);e.forEach(e=>{const n=document.createElement("span");n.classList.add("ql-formats"),e.forEach(t=>{if("string"==typeof t)Ci(n,t);else{const e=Object.keys(t)[0],r=t[e];Array.isArray(r)?function(t,e,n){const r=document.createElement("select");r.classList.add(`ql-${e}`),n.forEach(t=>{const e=document.createElement("option");!1!==t?e.setAttribute("value",String(t)):e.setAttribute("selected","selected"),r.appendChild(e)}),t.appendChild(r)}(n,e,r):Ci(n,e,r)}}),t.appendChild(n)})}(e,this.options.container),t.container?.parentNode?.insertBefore(e,t.container),this.container=e}else this.container="string"==typeof this.options.container?document.querySelector(this.options.container):this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(t=>{const e=this.options.handlers?.[t];e&&this.addHandler(t,e)}),Array.from(this.container.querySelectorAll("button, select")).forEach(t=>{this.attach(t)}),this.quill.on(es.events.EDITOR_CHANGE,()=>{const[t]=this.quill.selection.getRange();this.update(t)})):Si.error("Container required for toolbar",this.options)}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(t=>0===t.indexOf("ql-"));if(!e)return;if(e=e.slice(3),"BUTTON"===t.tagName&&t.setAttribute("type","button"),null==this.handlers[e]&&null==this.quill.scroll.query(e))return void Si.warn("ignoring attaching to nonexistent format",e,t);t.addEventListener("SELECT"===t.tagName?"change":"click",n=>{let r;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;const e=t.options[t.selectedIndex];r=!e.hasAttribute("selected")&&(e.value||!1)}else r=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),n.preventDefault();this.quill.focus();const[s]=this.quill.selection.getRange();if(null!=this.handlers[e])this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof sr){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents((new S).retain(s.index).delete(s.length).insert({[e]:r}),es.sources.USER)}else this.quill.format(e,r,es.sources.USER);this.update(s)}),this.controls.push([e,t])}update(t){const e=null==t?{}:this.quill.getFormat(t);this.controls.forEach(n=>{const[r,s]=n;if("SELECT"===s.tagName){let n=null;if(null==t)n=null;else if(null==e[r])n=s.querySelector("option[selected]");else if(!Array.isArray(e[r])){let t=e[r];"string"==typeof t&&(t=t.replace(/"/g,'\\"')),n=s.querySelector(`option[value="${t}"]`)}null==n?(s.value="",s.selectedIndex=-1):n.selected=!0}else if(null==t)s.classList.remove("ql-active"),s.setAttribute("aria-pressed","false");else if(s.hasAttribute("value")){const t=e[r],n=t===s.getAttribute("value")||null!=t&&t.toString()===s.getAttribute("value")||null==t&&!s.getAttribute("value");s.classList.toggle("ql-active",n),s.setAttribute("aria-pressed",n.toString())}else{const t=null!=e[r];s.classList.toggle("ql-active",t),s.setAttribute("aria-pressed",t.toString())}})}}function Ci(t,e,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${e}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${e}: ${n}`)):r.setAttribute("aria-label",e),t.appendChild(r)}ji.DEFAULTS={},ji.DEFAULTS={container:null,handlers:{clean(){const t=this.quill.getSelection();if(null!=t)if(0===t.length){const t=this.quill.getFormat();Object.keys(t).forEach(t=>{null!=this.quill.scroll.query(t,Rn.INLINE)&&this.quill.format(t,!1,es.sources.USER)})}else this.quill.removeFormat(t.index,t.length,es.sources.USER)},direction(t){const{align:e}=this.quill.getFormat();"rtl"===t&&null==e?this.quill.format("align","right",es.sources.USER):t||"right"!==e||this.quill.format("align",!1,es.sources.USER),this.quill.format("direction",t,es.sources.USER)},indent(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e),r=parseInt(n.indent||0,10);if("+1"===t||"-1"===t){let e="+1"===t?1:-1;"rtl"===n.direction&&(e*=-1),this.quill.format("indent",r+e,es.sources.USER)}},link(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,es.sources.USER)},list(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e);this.quill.format("list","check"===t?"checked"!==n.list&&"unchecked"!==n.list&&"unchecked":t,es.sources.USER)}}};const Ri='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>';var Ii={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:Ri,"code-block":Ri,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let Mi=0;function Bi(t,e){t.setAttribute(e,`${!("true"===t.getAttribute(e))}`)}class Di{constructor(t){this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",t=>{switch(t.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),t.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),Bi(this.label,"aria-expanded"),Bi(this.options,"aria-hidden")}buildItem(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const n=t.getAttribute("value");return n&&e.setAttribute("data-value",n),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",()=>{this.selectItem(e,!0)}),e.addEventListener("keydown",t=>{switch(t.key){case"Enter":this.selectItem(e,!0),t.preventDefault();break;case"Escape":this.escape(),t.preventDefault()}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${Mi}`,Mi+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const n=this.buildItem(e);t.appendChild(n),!0===e.selected&&this.selectItem(n)}),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach(t=>{this.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);const e=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class Ui extends Di{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(t=>{t.classList.add("ql-primary")})}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const n=this.label.querySelector(".ql-color-label"),r=t&&t.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Pi extends Di{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(t=>{t.innerHTML=e[t.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const n=t||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class zi{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(t=>{const{overflowY:e}=getComputedStyle(t,null);return"visible"!==e&&"clip"!==e})(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(t){const e=t.left+t.width/2-this.root.offsetWidth/2,n=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),s=this.root.getBoundingClientRect();let i=0;if(s.right>r.right&&(i=r.right-s.right,this.root.style.left=`${e+i}px`),s.left<r.left&&(i=r.left-s.left,this.root.style.left=`${e+i}px`),s.bottom>r.bottom){this.root.style.top=n-(t.bottom-t.top+(s.bottom-s.top))+"px",this.root.classList.add("ql-flip")}return i}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Hi=[!1,"center","right","justify"],Fi=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],$i=[!1,"serif","monospace"],Vi=["1","2","3",!1],Ki=["small",!1,"large","huge"];class Wi extends Wr{constructor(t,e){super(t,e);const n=e=>{document.body.contains(t.root)?(null==this.tooltip||this.tooltip.root.contains(e.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(t=>{t.container.contains(e.target)||t.close()})):document.body.removeEventListener("click",n)};t.emitter.listenDOM("click",document.body,n)}addModule(t){const e=super.addModule(t);return"toolbar"===t&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(t=>{(t.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=e[n]))if("direction"===n)t.innerHTML=e[n][""]+e[n].rtl;else if("string"==typeof e[n])t.innerHTML=e[n];else{const r=t.value||"";null!=r&&e[n][r]&&(t.innerHTML=e[n][r])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(t=>{if(t.classList.contains("ql-align")&&(null==t.querySelector("option")&&Gi(t,Hi),"object"==typeof e.align))return new Pi(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){const n=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&Gi(t,Fi,"background"===n?"#ffffff":"#000000"),new Ui(t,e[n])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?Gi(t,$i):t.classList.contains("ql-header")?Gi(t,Vi):t.classList.contains("ql-size")&&Gi(t,Ki)),new Di(t)});this.quill.on(Tr.events.EDITOR_CHANGE,()=>{this.pickers.forEach(t=>{t.update()})})}}Wi.DEFAULTS=Cn({},Wr.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let t=this.container.querySelector("input.ql-image[type=file]");null==t&&(t=document.createElement("input"),t.setAttribute("type","file"),t.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),t.classList.add("ql-image"),t.addEventListener("change",()=>{const e=this.quill.getSelection(!0);this.quill.uploader.upload(e,t.files),t.value=""}),this.container.appendChild(t)),t.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Zi extends zi{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",t=>{"Enter"===t.key?(this.save(),t.preventDefault()):"Escape"===t.key&&(this.cancel(),t.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,Tr.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,Tr.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=function(t){let e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(e)return`${e[1]||"https"}://www.youtube.com/embed/${e[2]}?showinfo=0`;if(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${e[1]||"https"}://player.vimeo.com/video/${e[2]}/`;return t}(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(null!=e){const n=e.index+e.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),t,Tr.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",Tr.sources.USER),this.quill.setSelection(n+2,Tr.sources.USER)}break}}this.textbox.value="",this.hide()}}function Gi(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(e=>{const r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(e)),t.appendChild(r)})}const Qi=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Xi extends Zi{static TEMPLATE=['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join("");constructor(t,e){super(t,e),this.quill.on(Tr.events.EDITOR_CHANGE,(t,e,n,r)=>{if(t===Tr.events.SELECTION_CHANGE)if(null!=e&&e.length>0&&r===Tr.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const t=this.quill.getLines(e.index,e.length);if(1===t.length){const t=this.quill.getBounds(e);null!=t&&this.position(t)}else{const n=t[t.length-1],r=this.quill.getIndex(n),s=Math.min(n.length()-1,e.index+e.length-r),i=this.quill.getBounds(new jr(r,s));null!=i&&this.position(i)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(Tr.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const t=this.quill.getSelection();if(null!=t){const e=this.quill.getBounds(t);null!=e&&this.position(e)}},1)})}cancel(){this.show()}position(t){const e=super.position(t),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==e&&(n.style.marginLeft=-1*e-n.offsetWidth/2+"px"),e}}class Yi extends Wi{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Qi),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new Xi(this.quill,this.options.bounds),null!=t.container&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),Ii),this.buildPickers(t.container.querySelectorAll("select"),Ii))}}Yi.DEFAULTS=Cn({},Wi.DEFAULTS,{modules:{toolbar:{handlers:{link(t){t?this.quill.theme.tooltip.edit():this.quill.format("link",!1,es.sources.USER)}}}}});const Ji=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class to extends Zi{static TEMPLATE=['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join("");preview=this.root.querySelector("a.ql-preview");listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",t=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",t=>{if(null!=this.linkRange){const t=this.linkRange;this.restoreFocus(),this.quill.formatText(t,"link",!1,Tr.sources.USER),delete this.linkRange}t.preventDefault(),this.hide()}),this.quill.on(Tr.events.SELECTION_CHANGE,(t,e,n)=>{if(null!=t){if(0===t.length&&n===Tr.sources.USER){const[e,n]=this.quill.scroll.descendant(bi,t.index);if(null!=e){this.linkRange=new jr(t.index-n,e.length());const r=bi.formats(e.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const s=this.quill.getBounds(this.linkRange);return void(null!=s&&this.position(s))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}class eo extends Wi{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Ji),super(t,e),this.quill.container.classList.add("ql-snow")}extendToolbar(t){null!=t.container&&(t.container.classList.add("ql-snow"),this.buildButtons(t.container.querySelectorAll("button"),Ii),this.buildPickers(t.container.querySelectorAll("select"),Ii),this.tooltip=new to(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,n)=>{t.handlers.link.call(t,!n.format.link)}))}}eo.DEFAULTS=Cn({},Wi.DEFAULTS,{modules:{toolbar:{handlers:{link(t){if(t){const t=this.quill.getSelection();if(null==t||0===t.length)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&0!==e.indexOf("mailto:")&&(e=`mailto:${e}`);const{tooltip:n}=this.quill.theme;n.edit("link",e)}else this.quill.format("link",!1,es.sources.USER)}}}}}),es.register({"attributors/attribute/direction":qs,"attributors/class/align":ps,"attributors/class/background":vs,"attributors/class/color":bs,"attributors/class/direction":ks,"attributors/class/font":Os,"attributors/class/size":Ss,"attributors/style/align":gs,"attributors/style/background":xs,"attributors/style/color":ys,"attributors/style/direction":_s,"attributors/style/font":Ts,"attributors/style/size":js},!0),es.register({"formats/align":ps,"formats/direction":ks,"formats/indent":fi,"formats/background":xs,"formats/color":ys,"formats/font":Os,"formats/size":Ss,"formats/blockquote":class extends gr{static blotName="blockquote";static tagName="blockquote"},"formats/code-block":Es,"formats/header":class extends gr{static blotName="header";static tagName=["H1","H2","H3","H4","H5","H6"];static formats(t){return this.tagName.indexOf(t.tagName)+1}},"formats/list":gi,"formats/bold":mi,"formats/code":ws,"formats/italic":class extends mi{static blotName="italic";static tagName=["EM","I"]},"formats/link":bi,"formats/script":class extends pr{static blotName="script";static tagName=["SUB","SUP"];static create(t){return"super"===t?document.createElement("sup"):"sub"===t?document.createElement("sub"):super.create(t)}static formats(t){return"SUB"===t.tagName?"sub":"SUP"===t.tagName?"super":void 0}},"formats/strike":class extends mi{static blotName="strike";static tagName=["S","STRIKE"]},"formats/underline":class extends pr{static blotName="underline";static tagName="U"},"formats/formula":class extends Vr{static blotName="formula";static className="ql-formula";static tagName="SPAN";static create(t){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return"string"==typeof t&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`<span>${t}</span>`}},"formats/image":class extends sr{static blotName="image";static tagName="IMG";static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return vi.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return yi(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){vi.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}},"formats/video":class extends mr{static blotName="video";static className="ql-video";static tagName="IFRAME";static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return xi.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static sanitize(t){return bi.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){xi.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`<a href="${t}">${t}</a>`}},"modules/syntax":qi,"modules/table":class extends Fr{static register(){es.register(ki),es.register(_i),es.register(Li),es.register(Oi)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Oi).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();null!=e&&(t.deleteColumn(e.cellOffset()),this.quill.update(es.sources.USER))}deleteRow(){const[,t]=this.getTable();null!=t&&(t.remove(),this.quill.update(es.sources.USER))}deleteTable(){const[t]=this.getTable();if(null==t)return;const e=t.offset();t.remove(),this.quill.update(es.sources.USER),this.quill.setSelection(e,es.sources.SILENT)}getTable(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==t)return[null,null,null,-1];const[e,n]=this.quill.getLine(t.index);if(null==e||e.statics.blotName!==ki.blotName)return[null,null,null,-1];const r=e.parent;return[r.parent.parent,r,e,n]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[n,r,s]=this.getTable(e);if(null==s)return;const i=s.cellOffset();n.insertColumn(i+t),this.quill.update(es.sources.USER);let o=r.rowOffset();0===t&&(o+=1),this.quill.setSelection(e.index+o,e.length,es.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[n,r,s]=this.getTable(e);if(null==s)return;const i=r.rowOffset();n.insertRow(i+t),this.quill.update(es.sources.USER),t>0?this.quill.setSelection(e,es.sources.SILENT):this.quill.setSelection(e.index+r.children.length,e.length,es.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const n=this.quill.getSelection();if(null==n)return;const r=new Array(t).fill(0).reduce(t=>{const n=new Array(e).fill("\n").join("");return t.insert(n,{table:Ti()})},(new S).retain(n.index));this.quill.updateContents(r,es.sources.USER),this.quill.setSelection(n.index,es.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(es.events.SCROLL_OPTIMIZE,t=>{t.some(t=>!!["TD","TR","TBODY","TABLE"].includes(t.target.tagName)&&(this.quill.once(es.events.TEXT_CHANGE,(t,e,n)=>{n===es.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":ji,"themes/bubble":Yi,"themes/snow":eo,"ui/icons":Ii,"ui/picker":Di,"ui/icon-picker":Pi,"ui/color-picker":Ui,"ui/tooltip":zi},!0);var no=Object.freeze({__proto__:null,Module:Fr,Parchment:ur,Range:jr,default:es});export{S as Delta,P as Quill,z as QuillEditor,D as getLoadedQuill,B as loadQuill};