exports.id=4172,exports.ids=[4172],exports.modules={21241:t=>{function e(t,d,f,p,g){if(t===d)return t?[[0,t]]:[];if(null!=f){var b=function(t,e,r){var i="number"==typeof r?{index:r,length:0}:r.oldRange,n="number"==typeof r?null:r.newRange,s=t.length,l=e.length;if(0===i.length&&(null===n||0===n.length)){var o=i.index,a=t.slice(0,o),c=t.slice(o),h=n?n.index:null;t:{var u=o+l-s;if(null!==h&&h!==u||u<0||u>l)break t;var d=e.slice(0,u),f=e.slice(u);if(f!==c)break t;var p=Math.min(o,u),g=a.slice(0,p),b=d.slice(0,p);if(g!==b)break t;var y=a.slice(p),v=d.slice(p);return m(g,y,v,c)}e:if(null===h||h===o){var d=e.slice(0,o),f=e.slice(o);if(d!==a)break e;var x=Math.min(s-o,l-o),N=c.slice(c.length-x),E=f.slice(f.length-x);if(N!==E)break e;var y=c.slice(0,c.length-x),v=f.slice(0,f.length-x);return m(a,y,v,N)}}if(i.length>0&&n&&0===n.length)r:{var g=t.slice(0,i.index),N=t.slice(i.index+i.length),p=g.length,x=N.length;if(l
n.length?t:n,a=t.length>n.length?n:t,c=o.indexOf(a);if(-1!==c)return l=[[1,o.substring(0,c)],[0,a],[1,o.substring(c+a.length)]],t.length>n.length&&(l[0][0]=l[2][0]=-1),l;if(1===a.length)return[[-1,t],[1,n]];var h=function(t,e){var r,n,l,o,a,c=t.length>e.length?t:e,h=t.length>e.length?e:t;if(c.length<4||2*h.length=t.length?[n,l,o,a,u]:null}var d=u(c,h,Math.ceil(c.length/4)),f=u(c,h,Math.ceil(c.length/2));return d||f?(r=f?d&&d[4].length>f[4].length?d:f:d,t.length>e.length?(n=r[0],l=r[1],o=r[2],a=r[3]):(o=r[0],a=r[1],n=r[2],l=r[3]),[n,l,o,a,r[4]]):null}(t,n);if(h){var u=h[0],d=h[1],f=h[2],p=h[3],g=h[4],m=e(u,f),b=e(d,p);return m.concat([[0,g]],b)}return function(t,e){for(var i=t.length,n=e.length,s=Math.ceil((i+n)/2),l=2*s,o=Array(l),a=Array(l),c=0;ci)f+=2;else if(x>n)d+=2;else if(u){var N=s+h-b;if(N>=0&&N=E)return r(t,e,y,x)}}}for(var A=-m+p;A<=m-g;A+=2){for(var E,N=s+A,w=(E=A===-m||A!==m&&a[N-1]i)g+=2;else if(w>n)p+=2;else if(!u){var v=s+h-A;if(v>=0&&v=(E=i-E))return r(t,e,y,x)}}}}return[[-1,t],[1,e]]}(t,n)}(t=t.substring(0,t.length-y),d=d.substring(0,d.length-y));return v&&N.unshift([0,v]),x&&N.push([0,x]),u(N,g),p&&function(t){for(var e=!1,r=[],i=0,d=null,f=0,p=0,g=0,m=0,b=0;f0?r[i-1]:-1,p=0,g=0,m=0,b=0,d=null,e=!0)),f++;for(e&&u(t),function(t){function e(t,e){if(!t||!e)return 6;var r=t.charAt(t.length-1),i=e.charAt(0),n=r.match(l),s=i.match(l),u=n&&r.match(o),d=s&&i.match(o),f=u&&r.match(a),p=d&&i.match(a),g=f&&t.match(c),m=p&&e.match(h);if(g||m)return 5;if(f||p)return 4;if(n&&!u&&d)return 3;if(u||d)return 2;if(n||s)return 1;return 0}for(var r=1;r=b&&(b=y,p=i,g=n,m=u)}t[r-1][1]!=p&&(p?t[r-1][1]=p:(t.splice(r-1,1),r--),t[r][1]=g,m?t[r+1][1]=m:(t.splice(r+1,1),r--))}r++}}(t),f=1;f=N?(x>=y.length/2||x>=v.length/2)&&(t.splice(f,0,[0,v.substring(0,x)]),t[f-1][1]=y.substring(0,y.length-x),t[f+1][1]=v.substring(x),f++):(N>=y.length/2||N>=v.length/2)&&(t.splice(f,0,[0,y.substring(0,N)]),t[f-1][0]=1,t[f-1][1]=v.substring(0,v.length-N),t[f+1][0]=-1,t[f+1][1]=y.substring(N),f++),f++}f++}}(N),N}function r(t,r,i,n){var s=t.substring(0,i),l=r.substring(0,n),o=t.substring(i),a=r.substring(n),c=e(s,l),h=e(o,a);return c.concat(h)}function i(t,e){if(!t||!e||t.charAt(0)!==e.charAt(0))return 0;for(var r=0,i=Math.min(t.length,e.length),n=i,s=0;ri?t=t.substring(r-i):r=0&&g(t[h][1])){var d=t[h][1].slice(-1);if(t[h][1]=t[h][1].slice(0,-1),a=d+a,c=d+c,!t[h][1]){t.splice(h,1),n--;var f=h-1;t[f]&&1===t[f][0]&&(o++,c=t[f][1]+c,f--),t[f]&&-1===t[f][0]&&(l++,a=t[f][1]+a,f--),h=f}}if(p(t[n][1])){var d=t[n][1].charAt(0);t[n][1]=t[n][1].slice(1),a+=d,c+=d}}if(n0||c.length>0){a.length>0&&c.length>0&&(0!==(r=i(c,a))&&(h>=0?t[h][1]+=c.substring(0,r):(t.splice(0,0,[0,c.substring(0,r)]),n++),c=c.substring(r),a=a.substring(r)),0!==(r=s(c,a))&&(t[n][1]=c.substring(c.length-r)+t[n][1],c=c.substring(0,c.length-r),a=a.substring(0,a.length-r)));var m=o+l;0===a.length&&0===c.length?(t.splice(n-m,m),n-=m):0===a.length?(t.splice(n-m,m,[1,c]),n=n-m+1):0===c.length?(t.splice(n-m,m,[-1,a]),n=n-m+1):(t.splice(n-m,m,[-1,a],[1,c]),n=n-m+2)}0!==n&&0===t[n-1][0]?(t[n-1][1]+=t[n][1],t.splice(n,1)):n++,o=0,l=0,a="",c=""}}""===t[t.length-1][1]&&t.pop();var b=!1;for(n=1;n=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(t,e,r,i){if(g(t)||p(i))return null;for(var n=[[0,t],[-1,e],[1,r],[0,i]],s=[],l=0;l0&&s.push(n[l]);return s}function b(t,r,i,n){return e(t,r,i,n,!0)}b.INSERT=1,b.DELETE=-1,b.EQUAL=0,t.exports=b},24417:(t,e,r)=>{t=r.nmd(t);var i,n,s="__lodash_hash_undefined__",l="[object Arguments]",o="[object Array]",a="[object Boolean]",c="[object Date]",h="[object Error]",u="[object Function]",d="[object Map]",f="[object Number]",p="[object Object]",g="[object Promise]",m="[object RegExp]",b="[object Set]",y="[object String]",v="[object WeakMap]",x="[object ArrayBuffer]",N="[object DataView]",E=/^\[object .+?Constructor\]$/,A=/^(?: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[l]=w[o]=w[x]=w[a]=w[N]=w[c]=w[h]=w[u]=w[d]=w[f]=w[p]=w[m]=w[b]=w[y]=w[v]=!1;var q="object"==typeof global&&global&&global.Object===Object&&global,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,S=O&&O.exports===L,T=S&&q.process,j=function(){try{return T&&T.binding&&T.binding("util")}catch(t){}}(),C=j&&j.isTypedArray;function R(t){var e=-1,r=Array(t.size);return t.forEach(function(t,i){r[++e]=[i,t]}),r}function I(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}var M=Array.prototype,B=Function.prototype,D=Object.prototype,U=_["__core-js_shared__"],P=B.toString,z=D.hasOwnProperty,F=function(){var t=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),$=D.toString,H=RegExp("^"+P.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=S?_.Buffer:void 0,K=_.Symbol,W=_.Uint8Array,Z=D.propertyIsEnumerable,G=M.splice,X=K?K.toStringTag:void 0,Y=Object.getOwnPropertySymbols,Q=V?V.isBuffer:void 0,J=(i=Object.keys,n=Object,function(t){return i(n(t))}),tt=tw(_,"DataView"),te=tw(_,"Map"),tr=tw(_,"Promise"),ti=tw(_,"Set"),tn=tw(_,"WeakMap"),ts=tw(Object,"create"),tl=t_(tt),to=t_(te),ta=t_(tr),tc=t_(ti),th=t_(tn),tu=K?K.prototype:void 0,td=tu?tu.valueOf:void 0;function tf(t){var e=-1,r=null==t?0:t.length;for(this.clear();++eo))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var h=-1,u=!0,d=2&r?new tm:void 0;for(s.set(t,e),s.set(e,t);++h-1},tp.prototype.set=function(t,e){var r=this.__data__,i=ty(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},tg.prototype.clear=function(){this.size=0,this.__data__={hash:new tf,map:new(te||tp),string:new tf}},tg.prototype.delete=function(t){var e=tA(this,t).delete(t);return this.size-=!!e,e},tg.prototype.get=function(t){return tA(this,t).get(t)},tg.prototype.has=function(t){return tA(this,t).has(t)},tg.prototype.set=function(t,e){var r=tA(this,t),i=r.size;return r.set(t,e),this.size+=+(r.size!=i),this},tm.prototype.add=tm.prototype.push=function(t){return this.__data__.set(t,s),this},tm.prototype.has=function(t){return this.__data__.has(t)},tb.prototype.clear=function(){this.__data__=new tp,this.size=0},tb.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},tb.prototype.get=function(t){return this.__data__.get(t)},tb.prototype.has=function(t){return this.__data__.has(t)},tb.prototype.set=function(t,e){var r=this.__data__;if(r instanceof tp){var i=r.__data__;if(!te||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new tg(i)}return r.set(t,e),this.size=r.size,this};var tq=Y?function(t){return null==t?[]:function(t,e){for(var r=-1,i=null==t?0:t.length,n=0,s=[];++r-1&&t%1==0&&t<=0x1fffffffffffff}function tR(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function tI(t){return null!=t&&"object"==typeof t}var tM=C?function(t){return C(t)}:function(t){return tI(t)&&tC(t.length)&&!!w[tv(t)]};function tB(t){return null!=t&&tC(t.length)&&!tj(t)?function(t,e){var r,i,n=tS(t),s=!n&&tO(t),l=!n&&!s&&tT(t),o=!n&&!s&&!l&&tM(t),a=n||s||l||o,c=a?function(t,e){for(var r=-1,i=Array(t);++r-1&&r%1==0&&r{"use strict";var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,i,s,l){if("function"!=typeof i)throw TypeError("The listener must be a function");var o=new n(i,s||t,l),a=r?r+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),o.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,l=Array(s);n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.Op=void 0;let i=r(21241),n=r(35034),s=r(24417),l=r(44419);e.AttributeMap=l.default;let o=r(90994);e.Op=o.default;let a=r(64220);e.OpIterator=a.default;let c=(t,e)=>{if("object"!=typeof t||null===t)throw Error(`cannot retain a ${typeof t}`);if("object"!=typeof e||null===e)throw Error(`cannot retain a ${typeof e}`);let r=Object.keys(t)[0];if(!r||r!==Object.keys(e)[0])throw Error(`embed types not matched: ${r} != ${Object.keys(e)[0]}`);return[r,t[r],e[r]]};class h{constructor(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]}static registerEmbed(t,e){this.handlers[t]=e}static unregisterEmbed(t){delete this.handlers[t]}static getHandler(t){let e=this.handlers[t];if(!e)throw Error(`no handlers for embed type "${t}"`);return e}insert(t,e){let r={};return"string"==typeof t&&0===t.length?this:(r.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(r.attributes=e),this.push(r))}delete(t){return t<=0?this:this.push({delete:t})}retain(t,e){if("number"==typeof t&&t<=0)return this;let r={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(r.attributes=e),this.push(r)}push(t){let e=this.ops.length,r=this.ops[e-1];if(t=n(t),"object"==typeof r){if("number"==typeof t.delete&&"number"==typeof r.delete)return this.ops[e-1]={delete:r.delete+t.delete},this;if("number"==typeof r.delete&&null!=t.insert&&(e-=1,"object"!=typeof(r=this.ops[e-1])))return this.ops.unshift(t),this;if(s(t.attributes,r.attributes)){if("string"==typeof t.insert&&"string"==typeof r.insert)return this.ops[e-1]={insert:r.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;else if("number"==typeof t.retain&&"number"==typeof r.retain)return this.ops[e-1]={retain:r.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(){let 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){let e=[],r=[];return this.forEach(i=>{(t(i)?e:r).push(i)}),[e,r]}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){let r=[],i=new a.default(this.ops),n=0;for(;n0&&r.next(n.retain-t)}let o=new h(i);for(;e.hasNext()||r.hasNext();)if("insert"===r.peekType())o.push(r.next());else if("delete"===e.peekType())o.push(e.next());else{let t=Math.min(e.peekLength(),r.peekLength()),i=e.next(t),n=r.next(t);if(n.retain){let a={};if("number"==typeof i.retain)a.retain="number"==typeof n.retain?t:n.retain;else if("number"==typeof n.retain)null==i.retain?a.insert=i.insert:a.retain=i.retain;else{let t=null==i.retain?"insert":"retain",[e,r,s]=c(i[t],n.retain),l=h.getHandler(e);a[t]={[e]:l.compose(r,s,"retain"===t)}}let u=l.default.compose(i.attributes,n.attributes,"number"==typeof i.retain);if(u&&(a.attributes=u),o.push(a),!r.hasNext()&&s(o.ops[o.ops.length-1],a)){let t=new h(e.rest());return o.concat(t).chop()}}else"number"==typeof n.delete&&("number"==typeof i.retain||"object"==typeof i.retain&&null!==i.retain)&&o.push(n)}return o.chop()}concat(t){let e=new h(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 h;let r=[this,t].map(e=>e.map(r=>{if(null!=r.insert)return"string"==typeof r.insert?r.insert:"\0";throw Error("diff() called "+(e===t?"on":"with")+" non-document")}).join("")),n=new h,o=i(r[0],r[1],e,!0),c=new a.default(this.ops),u=new a.default(t.ops);return o.forEach(t=>{let e=t[1].length;for(;e>0;){let r=0;switch(t[0]){case i.INSERT:r=Math.min(u.peekLength(),e),n.push(u.next(r));break;case i.DELETE:r=Math.min(e,c.peekLength()),c.next(r),n.delete(r);break;case i.EQUAL:r=Math.min(c.peekLength(),u.peekLength(),e);let o=c.next(r),a=u.next(r);s(o.insert,a.insert)?n.retain(r,l.default.diff(o.attributes,a.attributes)):n.push(a).delete(r)}e-=r}}),n.chop()}eachLine(t,e="\n"){let r=new a.default(this.ops),i=new h,n=0;for(;r.hasNext();){if("insert"!==r.peekType())return;let s=r.peek(),l=o.default.length(s)-r.peekLength(),a="string"==typeof s.insert?s.insert.indexOf(e,l)-l:-1;if(a<0)i.push(r.next());else if(a>0)i.push(r.next(a));else{if(!1===t(i,r.next(1).attributes||{},n))return;n+=1,i=new h}}i.length()>0&&t(i,{},n)}invert(t){let e=new h;return this.reduce((r,i)=>{if(i.insert)e.delete(o.default.length(i));else if("number"==typeof i.retain&&null==i.attributes)return e.retain(i.retain),r+i.retain;else if(i.delete||"number"==typeof i.retain){let n=i.delete||i.retain;return t.slice(r,r+n).forEach(t=>{i.delete?e.push(t):i.retain&&i.attributes&&e.retain(o.default.length(t),l.default.invert(i.attributes,t.attributes))}),r+n}else if("object"==typeof i.retain&&null!==i.retain){let n=t.slice(r,r+1),s=new a.default(n.ops).next(),[o,u,d]=c(i.retain,s.insert),f=h.getHandler(o);return e.retain({[o]:f.invert(u,d)},l.default.invert(i.attributes,s.attributes)),r+1}return r},0),e.chop()}transform(t,e=!1){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);let r=new a.default(this.ops),i=new a.default(t.ops),n=new h;for(;r.hasNext()||i.hasNext();)if("insert"===r.peekType()&&(e||"insert"!==i.peekType()))n.retain(o.default.length(r.next()));else if("insert"===i.peekType())n.push(i.next());else{let t=Math.min(r.peekLength(),i.peekLength()),s=r.next(t),o=i.next(t);if(s.delete)continue;if(o.delete)n.push(o);else{let r=s.retain,i=o.retain,a="object"==typeof i&&null!==i?i:t;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){let t=Object.keys(r)[0];if(t===Object.keys(i)[0]){let n=h.getHandler(t);n&&(a={[t]:n.transform(r[t],i[t],e)})}}n.retain(a,l.default.transform(s.attributes,o.attributes,e))}}return n.chop()}transformPosition(t,e=!1){e=!!e;let r=new a.default(this.ops),i=0;for(;r.hasNext()&&i<=t;){let n=r.peekLength(),s=r.peekType();if(r.next(),"delete"===s){t-=Math.min(n,t-i);continue}"insert"===s&&(i{t=r.nmd(t);var i="__lodash_hash_undefined__",n="[object Arguments]",s="[object Boolean]",l="[object Date]",o="[object Function]",a="[object GeneratorFunction]",c="[object Map]",h="[object Number]",u="[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]",A="[object Int16Array]",w="[object Int32Array]",q="[object Uint8Array]",k="[object Uint8ClampedArray]",_="[object Uint16Array]",L="[object Uint32Array]",O=/\w*$/,S=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[y]=j[v]=j[s]=j[l]=j[x]=j[N]=j[E]=j[A]=j[w]=j[c]=j[h]=j[u]=j[f]=j[p]=j[g]=j[m]=j[q]=j[k]=j[_]=j[L]=!0,j["[object Error]"]=j[o]=j[b]=!1;var C="object"==typeof global&&global&&global.Object===Object&&global,R="object"==typeof self&&self&&self.Object===Object&&self,I=C||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,r,i){var n=-1,s=t?t.length:0;for(i&&s&&(r=t[++n]);++n-1},tq.prototype.set=function(t,e){var r=this.__data__,i=tO(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},tk.prototype.clear=function(){this.__data__={hash:new tw,map:new(td||tq),string:new tw}},tk.prototype.delete=function(t){return tj(this,t).delete(t)},tk.prototype.get=function(t){return tj(this,t).get(t)},tk.prototype.has=function(t){return tj(this,t).has(t)},tk.prototype.set=function(t,e){return tj(this,t).set(t,e),this},t_.prototype.clear=function(){this.__data__=new tq},t_.prototype.delete=function(t){return this.__data__.delete(t)},t_.prototype.get=function(t){return this.__data__.get(t)},t_.prototype.has=function(t){return this.__data__.has(t)},t_.prototype.set=function(t,e){var r=this.__data__;if(r instanceof tq){var i=r.__data__;if(!td||i.length<199)return i.push([t,e]),this;r=this.__data__=new tk(i)}return r.set(t,e),this};var tR=ta?H(ta,Object):function(){return[]},tI=function(t){return J.call(t)};function tM(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Z)}function tB(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function tD(t,e){return t===e||t!=t&&e!=e}(tu&&tI(new tu(new ArrayBuffer(1)))!=v||td&&tI(new td)!=c||tf&&tI(tf.resolve())!=d||tp&&tI(new tp)!=p||tg&&tI(new tg)!=b)&&(tI=function(t){var e=J.call(t),r=e==u?t.constructor:void 0,i=r?tB(r):void 0;if(i)switch(i){case tb:return v;case ty:return c;case tv:return d;case tx:return p;case tN:return b}return e});var tU=Array.isArray;function tP(t){var e;return null!=t&&"number"==typeof(e=t.length)&&e>-1&&e%1==0&&e<=0x1fffffffffffff&&!tF(t)}var tz=tc||function(){return!1};function tF(t){var e=t$(t)?J.call(t):"";return e==o||e==a}function t$(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function tH(t){return tP(t)?function(t,e){var r,i,s,l,o,a=tU(t)||(s=i=r=t)&&"object"==typeof s&&tP(i)&&Q.call(r,"callee")&&(!tl.call(r,"callee")||J.call(r)==n)?function(t,e){for(var r=-1,i=Array(t);++r-1&&l%1==0&&l{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0});let n=r(35034),s=r(24417);!function(t){t.compose=function(t={},e={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});let i=n(e);for(let n in r||(i=Object.keys(i).reduce((t,e)=>(null!=i[e]&&(t[e]=i[e]),t),{})),t)void 0!==t[n]&&void 0===e[n]&&(i[n]=t[n]);return Object.keys(i).length>0?i:void 0},t.diff=function(t={},e={}){"object"!=typeof t&&(t={}),"object"!=typeof e&&(e={});let r=Object.keys(t).concat(Object.keys(e)).reduce((r,i)=>(s(t[i],e[i])||(r[i]=void 0===e[i]?null:e[i]),r),{});return Object.keys(r).length>0?r:void 0},t.invert=function(t={},e={}){t=t||{};let r=Object.keys(e).reduce((r,i)=>(e[i]!==t[i]&&void 0!==t[i]&&(r[i]=e[i]),r),{});return Object.keys(t).reduce((r,i)=>(t[i]!==e[i]&&void 0===e[i]&&(r[i]=null),r),r)},t.transform=function(t,e,r=!1){if("object"!=typeof t)return e;if("object"!=typeof e)return;if(!r)return e;let i=Object.keys(e).reduce((r,i)=>(void 0===t[i]&&(r[i]=e[i]),r),{});return Object.keys(i).length>0?i:void 0}}(i||(i={})),e.default=i},64220:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});let i=r(90994);class n{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);let e=this.ops[this.index];if(!e)return{retain:1/0};{let r=this.offset,n=i.default.length(e);if(t>=n-r?(t=n-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof e.delete)return{delete:t};{let i={};return e.attributes&&(i.attributes=e.attributes),"number"==typeof e.retain?i.retain=t:"object"==typeof e.retain&&null!==e.retain?i.retain=e.retain:"string"==typeof e.insert?i.insert=e.insert.substr(r,t):i.insert=e.insert,i}}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?i.default.length(this.ops[this.index])-this.offset:1/0}peekType(){let t=this.ops[this.index];if(t){if("number"==typeof t.delete)return"delete";else if("number"!=typeof t.retain&&("object"!=typeof t.retain||null===t.retain))return"insert"}return"retain"}rest(){if(!this.hasNext())return[];{if(0===this.offset)return this.ops.slice(this.index);let t=this.offset,e=this.index,r=this.next(),i=this.ops.slice(this.index);return this.offset=t,this.index=e,[r].concat(i)}}}e.default=n},74172:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AttributeMap:()=>e_.AttributeMap,Delta:()=>e_,Module:()=>r3,Op:()=>e_.Op,OpIterator:()=>e_.OpIterator,Parchment:()=>i,Range:()=>rG,default:()=>sv});var i={};r.r(i),r.d(i,{Attributor:()=>t4,AttributorStore:()=>es,BlockBlot:()=>eb,ClassAttributor:()=>et,ContainerBlot:()=>ev,EmbedBlot:()=>eN,InlineBlot:()=>eg,LeafBlot:()=>ec,ParentBlot:()=>ef,Registry:()=>t8,Scope:()=>t5,ScrollBlot:()=>ew,StyleAttributor:()=>ei,TextBlot:()=>ek});let n=function(t,e){return t===e||t!=t&&e!=e},s=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return -1};var l=Array.prototype.splice;function o(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1},o.prototype.set=function(t,e){var r=this.__data__,i=s(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this};var a="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,h=a||c||Function("return this")(),u=h.Symbol,d=Object.prototype,f=d.hasOwnProperty,p=d.toString,g=u?u.toStringTag:void 0;let m=function(t){var e=f.call(t,g),r=t[g];try{t[g]=void 0;var i=!0}catch(t){}var n=p.call(t);return i&&(e?t[g]=r:delete t[g]),n};var b=Object.prototype.toString,y=u?u.toStringTag:void 0;let v=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":y&&y in Object(t)?m(t):b.call(t)},x=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},N=function(t){if(!x(t))return!1;var e=v(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};var E=h["__core-js_shared__"],A=function(){var t=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),w=Function.prototype.toString;let q=function(t){if(null!=t){try{return w.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var k=/^\[object .+?Constructor\]$/,_=Object.prototype,L=Function.prototype.toString,O=_.hasOwnProperty,S=RegExp("^"+L.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let T=function(t){return!!x(t)&&(!A||!(A in t))&&(N(t)?S:k).test(q(t))},j=function(t,e){var r=null==t?void 0:t[e];return T(r)?r:void 0};var C=j(h,"Map"),R=j(Object,"create"),I=Object.prototype.hasOwnProperty,M=Object.prototype.hasOwnProperty;function B(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=0x1fffffffffffff},tm=function(t){return null!=t&&tg(t.length)&&!N(t)};var tb="object"==typeof exports&&exports&&!exports.nodeType&&exports,ty=tb&&"object"==typeof module&&module&&!module.nodeType&&module,tv=ty&&ty.exports===tb?h.Buffer:void 0;let tx=(tv?tv.isBuffer:void 0)||function(){return!1};var tN=Object.prototype,tE=Function.prototype.toString,tA=tN.hasOwnProperty,tw=tE.call(Object);let tq=function(t){if(!ta(t)||"[object Object]"!=v(t))return!1;var e=tn(t);if(null===e)return!0;var r=tA.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&tE.call(r)==tw};var tk={};tk["[object Float32Array]"]=tk["[object Float64Array]"]=tk["[object Int8Array]"]=tk["[object Int16Array]"]=tk["[object Int32Array]"]=tk["[object Uint8Array]"]=tk["[object Uint8ClampedArray]"]=tk["[object Uint16Array]"]=tk["[object Uint32Array]"]=!0,tk["[object Arguments]"]=tk["[object Array]"]=tk["[object ArrayBuffer]"]=tk["[object Boolean]"]=tk["[object DataView]"]=tk["[object Date]"]=tk["[object Error]"]=tk["[object Function]"]=tk["[object Map]"]=tk["[object Number]"]=tk["[object Object]"]=tk["[object RegExp]"]=tk["[object Set]"]=tk["[object String]"]=tk["[object WeakMap]"]=!1;let t_=function(t){return function(e){return t(e)}};var tL="object"==typeof exports&&exports&&!exports.nodeType&&exports,tO=tL&&"object"==typeof module&&module&&!module.nodeType&&module,tS=tO&&tO.exports===tL&&a.process,tT=function(){try{var t=tO&&tO.require&&tO.require("util").types;if(t)return t;return tS&&tS.binding&&tS.binding("util")}catch(t){}}(),tj=tT&&tT.isTypedArray,tC=tj?t_(tj):function(t){return ta(t)&&tg(t.length)&&!!tk[v(t)]};let tR=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]};var tI=Object.prototype.hasOwnProperty;let tM=function(t,e,r){var i=t[e];tI.call(t,e)&&n(i,r)&&(void 0!==r||e in t)||$(t,e,r)},tB=function(t,e,r,i){var n=!r;r||(r={});for(var s=-1,l=e.length;++s-1&&t%1==0&&t0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(F?function(t,e){return F(t,"toString",{configurable:!0,enumerable:!1,value:function(){return e},writable:!0})}:tG);let t1=function(t,e){var r;return tJ((r=tY(void 0===(r=e)?t.length-1:r,0),function(){for(var e=arguments,i=-1,n=tY(e.length-r,0),s=Array(n);++i1?r[n-1]:void 0,l=n>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(n--,s):void 0,l&&t0(r[0],r[1],l)&&(s=n<3?void 0:s,n=1),e=Object(e);++i(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))(t5||{});class t4{constructor(t,e,r={}){this.attrName=t,this.keyName=e;let i=t5.TYPE&t5.ATTRIBUTE;this.scope=null!=r.scope?r.scope&t5.LEVEL|i:t5.ATTRIBUTE,null!=r.whitelist&&(this.whitelist=r.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){let e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""}}class t3 extends Error{constructor(t){super(t="[Parchment] "+t),this.message=t,this.name=this.constructor.name}}let t6=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 r=null;try{r=t.parentNode}catch{return null}return this.find(r,e)}return null}create(e,r,i){let n=this.query(r);if(null==n)throw new t3(`Unable to create ${r} blot`);let s=r instanceof Node||r.nodeType===Node.TEXT_NODE?r:n.create(i),l=new n(e,s,i);return t.blots.set(l.domNode,l),l}find(e,r=!1){return t.find(e,r)}query(t,e=t5.ANY){let r;return"string"==typeof t?r=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?r=this.types.text:"number"==typeof t?t&t5.LEVEL&t5.BLOCK?r=this.types.block:t&t5.LEVEL&t5.INLINE&&(r=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(t=>!!(r=this.classes[t])),r=r||this.tags[t.tagName]),null==r?null:"scope"in r&&e&t5.LEVEL&r.scope&&e&t5.TYPE&r.scope?r:null}register(...t){return t.map(t=>{let e="blotName"in t,r="attrName"in t;if(!e&&!r)throw new t3("Invalid definition");if(e&&"abstract"===t.blotName)throw new t3("Cannot register abstract class");let i=e?t.blotName:r?t.attrName:void 0;return this.types[i]=t,r?"string"==typeof t.keyName&&(this.attributes[t.keyName]=t):e&&(t.className&&(this.classes[t.className]=t),t.tagName&&(Array.isArray(t.tagName)?t.tagName=t.tagName.map(t=>t.toUpperCase()):t.tagName=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})}};t6.blots=new WeakMap;let t8=t6;function t9(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(t=>0===t.indexOf(`${e}-`))}class t7 extends t4{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){t9(t,this.keyName).forEach(e=>{t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")}value(t){let e=(t9(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}}let et=t7;function ee(t){let e=t.split("-"),r=e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("");return e[0]+r}class er extends t4{static keys(t){return(t.getAttribute("style")||"").split(";").map(t=>t.split(":")[0].trim())}add(t,e){return!!this.canAdd(t,e)&&(t.style[ee(this.keyName)]=e,!0)}remove(t){t.style[ee(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){let e=t.style[ee(this.keyName)];return this.canAdd(t,e)?e:""}}let ei=er;class en{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={};let t=t8.find(this.domNode);if(null==t)return;let e=t4.keys(this.domNode),r=et.keys(this.domNode),i=ei.keys(this.domNode);e.concat(r).concat(i).forEach(e=>{let r=t.scroll.query(e,t5.ATTRIBUTE);r instanceof t4&&(this.attributes[r.attrName]=r)})}copy(t){Object.keys(this.attributes).forEach(e=>{let r=this.attributes[e].value(this.domNode);t.format(e,r)})}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),{})}}let es=en,el=class{constructor(t,e){this.scroll=t,this.domNode=e,t8.blots.set(e,this),this.prev=null,this.next=null}static create(t){let e,r;if(null==this.tagName)throw new t3("Blot definition missing tagName");return Array.isArray(this.tagName)?("string"==typeof t?parseInt(r=t.toUpperCase(),10).toString()===r&&(r=parseInt(r,10)):"number"==typeof t&&(r=t),e="number"==typeof r?document.createElement(this.tagName[r-1]):r&&this.tagName.indexOf(r)>-1?document.createElement(r):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(){let t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){null!=this.parent&&this.parent.removeChild(this),t8.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,r,i){let n=this.isolate(t,e);if(null!=this.scroll.query(r,t5.BLOT)&&i)n.wrap(r,i);else if(null!=this.scroll.query(r,t5.ATTRIBUTE)){let t=this.scroll.create(this.statics.scope);n.wrap(t),t.format(r,i)}}insertAt(t,e,r){let i=null==r?this.scroll.create("text",e):this.scroll.create(e,r),n=this.split(t);this.parent.insertBefore(i,n||void 0)}isolate(t,e){let r=this.split(t);if(null==r)throw Error("Attempt to isolate at end");return r.split(e),r}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){let r="string"==typeof t?this.scroll.create(t,e):t;return null!=this.parent&&(this.parent.insertBefore(r,this.next||void 0),this.remove()),r}split(t,e){return 0===t?this:this.next}update(t,e){}wrap(t,e){let r="string"==typeof t?this.scroll.create(t,e):t;if(null!=this.parent&&this.parent.insertBefore(r,this.next||void 0),"function"!=typeof r.appendChild)throw new t3(`Cannot wrap ${t}`);return r.appendChild(this),r}};el.blotName="abstract";let eo=el,ea=class extends eo{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 r=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(r+=1),[this.parent.domNode,r]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};ea.scope=t5.INLINE_BLOT;let ec=ea;class eh{constructor(){this.head=null,this.tail=null,this.length=0}append(...t){if(this.insertBefore(t[0],null),t.length>1){let e=t.slice(1);this.append(...e)}}at(t){let e=this.iterator(),r=e();for(;r&&t>0;)t-=1,r=e();return r}contains(t){let e=this.iterator(),r=e();for(;r;){if(r===t)return!0;r=e()}return!1}indexOf(t){let e=this.iterator(),r=e(),i=0;for(;r;){if(r===t)return i;i+=1,r=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,r=this.head;for(;null!=r;){if(r===t)return e;e+=r.length(),r=r.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()=>{let e=t;return null!=t&&(t=t.next),e}}find(t,e=!1){let r=this.iterator(),i=r();for(;i;){let n=i.length();if(ts?r(o,t-s,Math.min(e,s+i-t)):r(o,0,Math.min(i,t+e-s)),s+=i,o=l()}}map(t){return this.reduce((e,r)=>(e.push(t(r)),e),[])}reduce(t,e){let r=this.iterator(),i=r();for(;i;)e=t(e,i),i=r();return e}}function eu(t,e){let r=e.find(t);if(r)return r;try{return e.create(t)}catch{let r=e.create(t5.INLINE);return Array.from(t.childNodes).forEach(t=>{r.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(r.domNode,t),r.attach(),r}}let ed=class t extends eo{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 eh,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{let e=eu(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(t){if(t instanceof t3)return;throw t}})}deleteAt(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,(t,e,r)=>{t.deleteAt(e,r)})}descendant(e,r=0){let[i,n]=this.children.find(r);return null==e.blotName&&e(i)||null!=e.blotName&&i instanceof e?[i,n]:i instanceof t?i.descendant(e,n):[null,-1]}descendants(e,r=0,i=Number.MAX_VALUE){let n=[],s=i;return this.children.forEachAt(r,i,(r,i,l)=>{(null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e)&&n.push(r),r instanceof t&&(n=n.concat(r.descendants(e,i,s))),s-=l}),n}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let e=!1;this.children.forEach(r=>{e||this.statics.allowedChildren.some(t=>r instanceof t)||(r.statics.scope===t5.BLOCK_BLOT?(null!=r.next&&this.splitAfter(r),null!=r.prev&&this.splitAfter(r.prev),r.parent.unwrap(),e=!0):r instanceof t?r.unwrap():r.remove())})}formatAt(t,e,r,i){this.children.forEachAt(t,e,(t,e,n)=>{t.formatAt(e,n,r,i)})}insertAt(t,e,r){let[i,n]=this.children.find(t);if(i)i.insertAt(n,e,r);else{let t=null==r?this.scroll.create("text",e):this.scroll.create(e,r);this.appendChild(t)}}insertBefore(t,e){null!=t.parent&&t.parent.children.remove(t);let r=null;this.children.insertBefore(t,e||null),t.parent=this,null!=e&&(r=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==r)&&this.domNode.insertBefore(t.domNode,r),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(r=>{t.insertBefore(r,e)})}optimize(t){if(super.optimize(t),this.enforceAllowedChildren(),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){let t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove()}path(e,r=!1){let[i,n]=this.children.find(e,r),s=[[this,e]];return i instanceof t?s.concat(i.path(n,r)):(null!=i&&s.push([i,n]),s)}removeChild(t){this.children.remove(t)}replaceWith(e,r){let i="string"==typeof e?this.scroll.create(e,r):e;return i instanceof t&&this.moveChildren(i),super.replaceWith(i)}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}let r=this.clone();return this.parent&&this.parent.insertBefore(r,this.next||void 0),this.children.forEachAt(t,this.length(),(t,i,n)=>{let s=t.split(i,e);null!=s&&r.appendChild(s)}),r}splitAfter(t){let 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){let r=[],i=[];t.forEach(t=>{t.target===this.domNode&&"childList"===t.type&&(r.push(...t.addedNodes),i.push(...t.removedNodes))}),i.forEach(t=>{if(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;let e=this.scroll.find(t);null!=e&&(null==e.domNode.parentNode||e.domNode.parentNode===this.domNode)&&e.detach()}),r.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));let r=eu(t,this.scroll);(r.next!==e||null==r.next)&&(null!=r.parent&&r.parent.removeChild(this),this.insertBefore(r,e||void 0))}),this.enforceAllowedChildren()}};ed.uiClass="";let ef=ed,ep=class t extends ef{static create(t){return super.create(t)}static formats(e,r){let i=r.query(t.blotName);if(null==i||e.tagName!==i.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 es(this.domNode)}format(e,r){if(e!==this.statics.blotName||r){let t=this.scroll.query(e,t5.INLINE);null!=t&&(t instanceof t4?this.attributes.attribute(t,r):r&&(e!==this.statics.blotName||this.formats()[e]!==r)&&this.replaceWith(e,r))}else this.children.forEach(e=>{e instanceof t||(e=e.wrap(t.blotName,!0)),this.attributes.copy(e)}),this.unwrap()}formats(){let t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,r,i){null!=this.formats()[r]||this.scroll.query(r,t5.ATTRIBUTE)?this.isolate(t,e).format(r,i):super.formatAt(t,e,r,i)}optimize(e){super.optimize(e);let r=this.formats();if(0===Object.keys(r).length)return this.unwrap();let i=this.next;i instanceof t&&i.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let r in t)if(t[r]!==e[r])return!1;return!0}(r,i.formats())&&(i.moveChildren(this),i.remove())}replaceWith(t,e){let r=super.replaceWith(t,e);return this.attributes.copy(r),r}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}wrap(e,r){let i=super.wrap(e,r);return i instanceof t&&this.attributes.move(i),i}};ep.allowedChildren=[ep,ec],ep.blotName="inline",ep.scope=t5.INLINE_BLOT,ep.tagName="SPAN";let eg=ep,em=class t extends ef{static create(t){return super.create(t)}static formats(e,r){let i=r.query(t.blotName);if(null==i||e.tagName!==i.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 es(this.domNode)}format(e,r){let i=this.scroll.query(e,t5.BLOCK);null!=i&&(i instanceof t4?this.attributes.attribute(i,r):e!==this.statics.blotName||r?r&&(e!==this.statics.blotName||this.formats()[e]!==r)&&this.replaceWith(e,r):this.replaceWith(t.blotName))}formats(){let t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,r,i){null!=this.scroll.query(r,t5.BLOCK)?this.format(r,i):super.formatAt(t,e,r,i)}insertAt(t,e,r){if(null==r||null!=this.scroll.query(e,t5.INLINE))super.insertAt(t,e,r);else{let i=this.split(t);if(null!=i){let t=this.scroll.create(e,r);i.parent.insertBefore(t,i)}else throw Error("Attempt to insertAt after block boundaries")}}replaceWith(t,e){let r=super.replaceWith(t,e);return this.attributes.copy(r),r}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}};em.blotName="block",em.scope=t5.BLOCK_BLOT,em.tagName="P",em.allowedChildren=[eg,em,ec];let eb=em,ey=class extends ef{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,r,i){super.formatAt(t,e,r,i),this.enforceAllowedChildren()}insertAt(t,e,r){super.insertAt(t,e,r),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};ey.blotName="container",ey.scope=t5.BLOCK_BLOT;let ev=ey;class ex extends ec{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,r,i){0===t&&e===this.length()?this.format(r,i):super.formatAt(t,e,r,i)}formats(){return this.statics.formats(this.domNode,this.scroll)}}let eN=ex,eE={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},eA=class extends ef{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,eE),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){let r=this.registry.find(t,e);return r?r.scroll===this?r:e?this.find(r.scroll.domNode.parentNode,!0):null:null}query(t,e=t5.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,r,i){this.update(),super.formatAt(t,e,r,i)}insertAt(t,e,r){this.update(),super.insertAt(t,e,r)}optimize(t=[],e={}){super.optimize(e);let r=e.mutationsMap||new WeakMap,i=Array.from(this.observer.takeRecords());for(;i.length>0;)t.push(i.pop());let n=(t,e=!0)=>{null==t||t===this||null!=t.domNode.parentNode&&(r.has(t.domNode)||r.set(t.domNode,[]),e&&n(t.parent))},s=t=>{r.has(t.domNode)&&(t instanceof ef&&t.children.forEach(s),r.delete(t.domNode),t.optimize(e))},l=t;for(let e=0;l.length>0;e+=1){if(e>=100)throw Error("[Parchment] Maximum optimize iterations reached");for(l.forEach(t=>{let e=this.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(n(this.find(t.previousSibling,!1)),Array.from(t.addedNodes).forEach(t=>{let e=this.find(t,!1);n(e,!1),e instanceof ef&&e.children.forEach(t=>{n(t,!1)})})):"attributes"===t.type&&n(e.prev)),n(e))}),this.children.forEach(s),i=(l=Array.from(this.observer.takeRecords())).slice();i.length>0;)t.push(i.pop())}}update(t,e={}){t=t||this.observer.takeRecords();let r=new WeakMap;t.map(t=>{let e=this.find(t.target,!0);return null==e?null:r.has(e.domNode)?(r.get(e.domNode).push(t),null):(r.set(e.domNode,[t]),e)}).forEach(t=>{null!=t&&t!==this&&r.has(t.domNode)&&t.update(r.get(t.domNode)||[],e)}),e.mutationsMap=r,r.has(this.domNode)&&super.update(r.get(this.domNode),e),this.optimize(t,e)}};eA.blotName="scroll",eA.defaultChild=eb,eA.allowedChildren=[eb,ev],eA.scope=t5.BLOCK_BLOT,eA.tagName="DIV";let ew=eA,eq=class t extends ec{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,r){null==r?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,r)}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}let r=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(r,this.next||void 0),this.text=this.statics.value(this.domNode),r}update(t,e){t.some(t=>"characterData"===t.type&&t.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};eq.blotName="text",eq.scope=t5.INLINE_BLOT;let ek=eq;var e_=r(34340);let eL=function(t,e){for(var r=-1,i=null==t?0:t.length;++ro))return!1;var c=s.get(t),h=s.get(e);if(c&&h)return c==e&&h==t;var u=-1,d=!0,f=2&r?new rf:void 0;for(s.set(t,e),s.set(e,t);++u":">",'"':""","'":"'"};function rj(t){return t.replace(/[&<>"']/g,t=>rT[t])}class rC extends eg{static allowedChildren=[rC,rO,eN,rS];static order=["cursor","inline","link","underline","strike","italic","bold","script","code"];static compare(t,e){let r=rC.order.indexOf(t),i=rC.order.indexOf(e);return r>=0||i>=0?r-i:t===e?0:trC.compare(this.statics.blotName,r)&&this.scroll.query(r,t5.BLOT)){let n=this.isolate(t,e);i&&n.wrap(r,i)}else super.formatAt(t,e,r,i)}optimize(t){if(super.optimize(t),this.parent instanceof rC&&rC.compare(this.statics.blotName,this.parent.statics.blotName)>0){let t=this.parent.isolate(this.offset(),this.length());this.moveChildren(t),t.wrap(this)}}}let rR=rC;class rI extends eb{cache={};delta(){return null==this.cache.delta&&(this.cache.delta=rB(this)),this.cache.delta}deleteAt(t,e){super.deleteAt(t,e),this.cache={}}formatAt(t,e,r,i){e<=0||(this.scroll.query(r,t5.BLOCK)?t+e===this.length()&&this.format(r,i):super.formatAt(t,Math.min(e,this.length()-t-1),r,i),this.cache={})}insertAt(t,e,r){if(null!=r){super.insertAt(t,e,r),this.cache={};return}if(0===e.length)return;let i=e.split("\n"),n=i.shift();n.length>0&&(t((s=s.split(t,!0)).insertAt(0,e),e.length),t+n.length)}insertBefore(t,e){let{head:r}=this.children;super.insertBefore(t,e),r instanceof rO&&r.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)){let e=this.clone();return 0===t?(this.parent.insertBefore(e,this),this):(this.parent.insertBefore(e,this.next),e)}let r=super.split(t,e);return this.cache={},r}}rI.blotName="block",rI.tagName="P",rI.defaultChild=rO,rI.allowedChildren=[rO,rR,eN,rS];class rM extends eN{attach(){super.attach(),this.attributes=new es(this.domNode)}delta(){return new e_().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){let r=this.scroll.query(t,t5.BLOCK_ATTRIBUTE);null!=r&&this.attributes.attribute(r,e)}formatAt(t,e,r,i){this.format(r,i)}insertAt(t,e,r){if(null!=r)return void super.insertAt(t,e,r);let i=e.split("\n"),n=i.pop(),s=i.map(t=>{let e=this.scroll.create(rI.blotName);return e.insertAt(0,t),e}),l=this.split(t);s.forEach(t=>{this.parent.insertBefore(t,l)}),n&&this.parent.insertBefore(this.scroll.create("text",n),l)}}function rB(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return t.descendants(ec).reduce((t,r)=>0===r.length()?t:t.insert(r.value(),rD(r,{},e)),new e_).insert("\n",rD(t))}function rD(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return null==t||("formats"in t&&"function"==typeof t.formats&&(e={...e,...t.formats()},r&&delete e["code-token"]),null==t.parent||"scroll"===t.parent.statics.blotName||t.parent.statics.scope!==t.statics.scope)?e:rD(t.parent,e,r)}rM.scope=t5.BLOCK_BLOT;class rU extends eN{static blotName="cursor";static className="ql-cursor";static tagName="span";static CONTENTS="\uFEFF";static value(){}constructor(t,e,r){super(t,e),this.selection=r,this.textNode=document.createTextNode(rU.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 r=this,i=0;for(;null!=r&&r.statics.scope!==t5.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=rU.CONTENTS.length,r.optimize(),r.formatAt(i,rU.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(){let t;if(this.selection.composing||null==this.parent)return null;let e=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);let r=this.prev instanceof rS?this.prev:null,i=r?r.length():0,n=this.next instanceof rS?this.next:null,s=n?n.text:"",{textNode:l}=this,o=l.data.split(rU.CONTENTS).join("");if(l.data=rU.CONTENTS,r)t=r,(o||n)&&(r.insertAt(r.length(),o+s),n&&n.remove());else if(n)t=n,n.insertAt(0,o);else{let e=document.createTextNode(o);t=this.scroll.create(e),this.parent.insertBefore(t,this)}if(this.remove(),e){let s=(t,e)=>r&&t===r.domNode?e:t===l?i+e-1:n&&t===n.domNode?i+o.length+e:null,a=s(e.start.node,e.start.offset),c=s(e.end.node,e.end.offset);if(null!==a&&null!==c)return{startNode:t.domNode,startOffset:a,endNode:t.domNode,endOffset:c}}return null}update(t,e){if(t.some(t=>"characterData"===t.type&&t.target===this.textNode)){let 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=rU.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}}var rP=r(26326);let rz=new WeakMap,rF=["error","warn","log","info"],r$="warn";function rH(t){if(r$&&rF.indexOf(t)<=rF.indexOf(r$)){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i(e[r]=rH.bind(console,r,t),e),{})}rV.level=t=>{r$=t},rH.level=rV.level;let rK=rV("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(t=>{document.addEventListener(t,function(){for(var t=arguments.length,e=Array(t),r=0;r{let r=rz.get(t);r&&r.emitter&&r.emitter.handleDOM(...e)})})});class rW extends rP{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",rK.error)}emit(){for(var t=arguments.length,e=Array(t),r=0;r1?e-1:0),i=1;i{let{node:i,handler:n}=e;(t.target===i||i.contains(t.target))&&n(t,...r)})}listenDOM(t,e,r){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:r})}}let rZ=rV("quill:selection");class rG{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=t,this.length=e}}class rX{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 rG(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,rW.sources.USER),1)}),this.emitter.on(rW.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;let t=this.getNativeRange();null!=t&&t.start.node!==this.cursor.textNode&&this.emitter.once(rW.events.SCROLL_UPDATE,(e,r)=>{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);let i=r.some(t=>"characterData"===t.type||"childList"===t.type||"attributes"===t.type&&t.target===this.root);this.update(i?rW.sources.SILENT:e)}catch(t){}})}),this.emitter.on(rW.events.SCROLL_OPTIMIZE,(t,e)=>{if(e.range){let{startNode:t,startOffset:r,endNode:i,endOffset:n}=e.range;this.setNativeRange(t,r,i,n),this.update(rW.sources.SILENT)}}),this.update(rW.sources.SILENT)}handleComposition(){this.emitter.on(rW.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(rW.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){let t=this.cursor.restore();t&&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(rW.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();let r=this.getNativeRange();if(!(null==r||!r.native.collapsed||this.scroll.query(t,t5.BLOCK))){if(r.start.node!==this.cursor.textNode){let t=this.scroll.find(r.start.node,!1);if(null==t)return;if(t instanceof ec){let e=t.split(r.start.offset);t.parent.insertBefore(this.cursor,e)}else t.insertBefore(this.cursor,r.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,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.scroll.length();i=Math.min((t=Math.min(t,n-1))+i,n-1)-t;let[s,l]=this.scroll.leaf(t);if(null==s)return null;if(i>0&&l===s.length()){let[e]=this.scroll.leaf(t+1);if(e){let[r]=this.scroll.line(t),[i]=this.scroll.line(t+1);r===i&&(s=e,l=0)}}[e,l]=s.position(l,!0);let o=document.createRange();if(i>0)return(o.setStart(e,l),[s,l]=this.scroll.leaf(t+i),null==s)?null:([e,l]=s.position(l,!0),o.setEnd(e,l),o.getBoundingClientRect());let a="left";if(e instanceof Text){if(!e.data.length)return null;l0&&(a="right")}return{bottom:r.top+r.height,height:r.height,left:r[a],right:r[a],top:r.top,width:0}}getNativeRange(){let t=document.getSelection();if(null==t||t.rangeCount<=0)return null;let e=t.getRangeAt(0);if(null==e)return null;let r=this.normalizeNative(e);return rZ.info("getNativeRange",r),r}getRange(){let t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];let e=this.getNativeRange();return null==e?[null,null]:[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&rY(this.root,document.activeElement)}normalizedToRange(t){let e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);let r=e.map(t=>{let[e,r]=t,i=this.scroll.find(e,!0),n=i.offset(this.scroll);return 0===r?n:i instanceof ec?n+i.index(e,r):n+i.length()}),i=Math.min(Math.max(...r),this.scroll.length()-1),n=Math.min(i,...r);return new rG(n,i-n)}normalizeNative(t){if(!rY(this.root,t.startContainer)||!t.collapsed&&!rY(this.root,t.endContainer))return null;let 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:r}=t;for(;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>r)e=e.childNodes[r],r=0;else if(e.childNodes.length===r)r=(e=e.lastChild)instanceof Text?e.data.length:e.childNodes.length>0?e.childNodes.length:e.childNodes.length+1;else break;t.node=e,t.offset=r}),e}rangeToNative(t){let e=this.scroll.length(),r=(t,r)=>{t=Math.min(e-1,t);let[i,n]=this.scroll.leaf(t);return i?i.position(n,r):[null,-1]};return[...r(t.index,!1),...r(t.index+t.length,!0)]}setNativeRange(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(rZ.info("setNativeRange",t,e,r,i),null!=t&&(null==this.root.parentNode||null==t.parentNode||null==r.parentNode))return;let s=document.getSelection();if(null!=s)if(null!=t){this.hasFocus()||this.root.focus({preventScroll:!0});let{native:l}=this.getNativeRange()||{};if(null==l||n||t!==l.startContainer||e!==l.startOffset||r!==l.endContainer||i!==l.endOffset){t instanceof Element&&"BR"===t.tagName&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),r instanceof Element&&"BR"===r.tagName&&(i=Array.from(r.parentNode.childNodes).indexOf(r),r=r.parentNode);let n=document.createRange();n.setStart(t,e),n.setEnd(r,i),s.removeAllRanges(),s.addRange(n)}}else s.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rW.sources.API;if("string"==typeof e&&(r=e,e=!1),rZ.info("setRange",t),null!=t){let r=this.rangeToNative(t);this.setNativeRange(...r,e)}else this.setNativeRange(null);this.update(r)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rW.sources.USER,e=this.lastRange,[r,i]=this.getRange();if(this.lastRange=r,this.lastNative=i,null!=this.lastRange&&(this.savedRange=this.lastRange),!rL(e,this.lastRange)){if(!this.composing&&null!=i&&i.native.collapsed&&i.start.node!==this.cursor.textNode){let t=this.cursor.restore();t&&this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}let r=[rW.events.SELECTION_CHANGE,rd(this.lastRange),rd(e),t];this.emitter.emit(rW.events.EDITOR_CHANGE,...r),t!==rW.sources.SILENT&&this.emitter.emit(...r)}}}function rY(t,e){try{e.parentNode}catch(t){return!1}return t.contains(e)}let rQ=/^[ -~]*$/;class rJ{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();let r=r2(t),i=new e_;return(function(t){let e=[];return t.forEach(t=>{"string"==typeof t.insert?t.insert.split("\n").forEach((r,i)=>{i&&e.push({insert:"\n",attributes:t.attributes}),r&&e.push({insert:r,attributes:t.attributes})}):e.push(t)}),e})(r.ops.slice()).reduce((t,r)=>{let n=e_.Op.length(r),s=r.attributes||{},l=!1,o=!1;if(null!=r.insert){if(i.retain(n),"string"==typeof r.insert){let i=r.insert;o=!i.endsWith("\n")&&(e<=t||!!this.scroll.descendant(rM,t)[0]),this.scroll.insertAt(t,i);let[n,l]=this.scroll.line(t),a=t2({},rD(n));if(n instanceof rI){let[t]=n.descendant(ec,l);t&&(a=t2(a,rD(t)))}s=e_.AttributeMap.diff(a,s)||{}}else if("object"==typeof r.insert){let i=Object.keys(r.insert)[0];if(null==i)return t;let n=null!=this.scroll.query(i,t5.INLINE);if(n)(e<=t||this.scroll.descendant(rM,t)[0])&&(o=!0);else if(t>0){let[e,r]=this.scroll.descendant(ec,t-1);e instanceof rS?"\n"!==e.value()[r]&&(l=!0):e instanceof eN&&e.statics.scope===t5.INLINE_BLOT&&(l=!0)}if(this.scroll.insertAt(t,i,r.insert[i]),n){let[e]=this.scroll.descendant(ec,t);if(e){let t=t2({},rD(e));s=e_.AttributeMap.diff(t,s)||{}}}}e+=n}else if(i.push(r),null!==r.retain&&"object"==typeof r.retain){let e=Object.keys(r.retain)[0];if(null==e)return t;this.scroll.updateEmbedAt(t,e,r.retain[e])}Object.keys(s).forEach(e=>{this.scroll.formatAt(t,n,e,s[e])});let a=+!!l,c=+!!o;return e+=a+c,i.retain(a),i.delete(c),t+n+a+c},0),i.reduce((t,e)=>"number"==typeof e.delete?(this.scroll.deleteAt(t,e.delete),t):t+e_.Op.length(e),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(r)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update(new e_().retain(t).delete(e))}formatLine(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(r).forEach(i=>{this.scroll.lines(t,Math.max(e,1)).forEach(t=>{t.format(i,r[i])})}),this.scroll.optimize();let i=new e_().retain(t).retain(e,rd(r));return this.update(i)}formatText(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(r).forEach(i=>{this.scroll.formatAt(t,e,i,r[i])});let i=new e_().retain(t).retain(e,rd(r));return this.update(i)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new e_)}getFormat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],i=[];0===e?this.scroll.path(t).forEach(t=>{let[e]=t;e instanceof rI?r.push(e):e instanceof ec&&i.push(e)}):(r=this.scroll.lines(t,e),i=this.scroll.descendants(ec,t,e));let[n,s]=[r,i].map(t=>{let e=t.shift();if(null==e)return{};let r=rD(e);for(;Object.keys(r).length>0;){let e=t.shift();if(null==e)break;r=function(t,e){return Object.keys(e).reduce((r,i)=>{if(null==t[i])return r;let n=e[i];return n===t[i]?r[i]=n:Array.isArray(n)?0>n.indexOf(t[i])?r[i]=n.concat([t[i]]):r[i]=n:r[i]=[n,t[i]],r},{})}(rD(e),r)}return r});return{...n,...s}}getHTML(t,e){let[r,i]=this.scroll.line(t);if(r){let n=r.length();return r.length()>=i+e&&(0!==i||e!==n)?r1(r,i,e,!0):r1(this.scroll,t,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){let r=r2(e),i=new e_().retain(t).concat(r);return this.scroll.insertContents(t,r),this.update(i)}insertEmbed(t,e,r){return this.scroll.insertAt(t,e,r),this.update(new e_().retain(t).insert({[e]:r}))}insertText(t,e){let r=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(r).forEach(i=>{this.scroll.formatAt(t,e.length,i,r[i])}),this.update(new e_().retain(t).insert(e,rd(r)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;let t=this.scroll.children.head;return t?.statics.blotName===rI.blotName&&!(t.children.length>1)&&t.children.head instanceof rO}removeFormat(t,e){let r=this.getText(t,e),[i,n]=this.scroll.line(t+e),s=0,l=new e_;null!=i&&(s=i.length()-n,l=i.delta().slice(n,n+s-1).insert("\n"));let o=this.getContents(t,e+s).diff(new e_().insert(r).concat(l)),a=new e_().retain(t).concat(o);return this.applyDelta(a)}update(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(rQ)&&this.scroll.find(e[0].target)){let n=this.scroll.find(e[0].target),s=rD(n),l=n.offset(this.scroll),o=e[0].oldValue.replace(rU.CONTENTS,""),a=new e_().insert(o),c=new e_().insert(n.value()),h=r&&{oldRange:r5(r.oldRange,-l),newRange:r5(r.newRange,-l)};t=new e_().retain(l).concat(a.diff(c,h)).reduce((t,e)=>e.insert?t.insert(e.insert,s):t.push(e),new e_),this.delta=i.compose(t)}else this.delta=this.getDelta(),t&&rL(i.compose(t),this.delta)||(t=i.diff(this.delta,r));return t}}function r1(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in t&&"function"==typeof t.html)return t.html(e,r);if(t instanceof rS)return rj(t.value().slice(e,e+r)).replaceAll(" "," ");if(t instanceof ef){if("list-container"===t.statics.blotName){let i=[];return t.children.forEachAt(e,r,(t,e,r)=>{let n="formats"in t&&"function"==typeof t.formats?t.formats():{};i.push({child:t,offset:e,length:r,indent:n.indent||0,type:n.list})}),function t(e,r,i){if(0===e.length){let[e]=r0(i.pop());return r<=0?`${e}>`:`${e}>${t([],r-1,i)}`}let[{child:n,offset:s,length:l,indent:o,type:a},...c]=e,[h,u]=r0(a);if(o>r)return(i.push(a),o===r+1)?`<${h}>${r1(n,s,l)}${t(c,o,i)}`:`<${h}>${t(e,r+1,i)}`;let d=i[i.length-1];if(o===r&&a===d)return`${r1(n,s,l)}${t(c,o,i)}`;let[f]=r0(i.pop());return`${f}>${t(e,r-1,i)}`}(i,-1,[])}let n=[];if(t.children.forEachAt(e,r,(t,e,r)=>{n.push(r1(t,e,r))}),i||"list"===t.statics.blotName)return n.join("");let{outerHTML:s,innerHTML:l}=t.domNode,[o,a]=s.split(`>${l}<`);return"${n.join("")}<${a}`:`${o}>${n.join("")}<${a}`}return t.domNode instanceof Element?t.domNode.outerHTML:""}function r0(t){let 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 r2(t){return t.reduce((t,e)=>{if("string"==typeof e.insert){let r=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(r,e.attributes)}return t.push(e)},new e_)}function r5(t,e){let{index:r,length:i}=t;return new rG(r+e,i)}class r4{static DEFAULTS={};constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=t,this.options=e}}let r3=r4;class r6 extends eN{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("\uFEFF"),this.rightGuard=document.createTextNode("\uFEFF"),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,r=null,i=t.data.split("\uFEFF").join("");if(t===this.leftGuard)if(this.prev instanceof rS){let t=this.prev.length();this.prev.insertAt(t,i),r={startNode:this.prev.domNode,startOffset:t+i.length}}else e=document.createTextNode(i),this.parent.insertBefore(this.scroll.create(e),this),r={startNode:e,startOffset:i.length};else t===this.rightGuard&&(this.next instanceof rS?(this.next.insertAt(0,i),r={startNode:this.next.domNode,startOffset:i.length}):(e=document.createTextNode(i),this.parent.insertBefore(this.scroll.create(e),this.next),r={startNode:e,startOffset:i.length}));return t.data="\uFEFF",r}update(t,e){t.forEach(t=>{if("characterData"===t.type&&(t.target===this.leftGuard||t.target===this.rightGuard)){let r=this.restore(t.target);r&&(e.range=r)}})}}let r8=r6;class r9{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){let e=t.target instanceof Node?this.scroll.find(t.target,!0):null;!e||e instanceof r8||(this.emitter.emit(rW.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(rW.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(rW.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(rW.events.COMPOSITION_END,t),this.isComposing=!1}}class r7{static DEFAULTS={modules:{}};static themes={default:r7};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){let e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}}let it=r7,ie=t=>t.parentElement||t.getRootNode().host||null,ir=t=>{let e=t.getBoundingClientRect(),r="offsetWidth"in t&&Math.abs(e.width)/t.offsetWidth||1,i="offsetHeight"in t&&Math.abs(e.height)/t.offsetHeight||1;return{top:e.top,right:e.left+t.clientWidth*r,bottom:e.top+t.clientHeight*i,left:e.left}},ii=t=>{let e=parseInt(t,10);return Number.isNaN(e)?0:e},is=(t,e,r,i,n,s)=>ti?0:ti?e-t>i-r?t+n-r:e-i+s:0,il=(t,e)=>{let r=t.ownerDocument,i=e,n=t;for(;n;){let t=n===r.body,e=t?{top:0,right:window.visualViewport?.width??r.documentElement.clientWidth,bottom:window.visualViewport?.height??r.documentElement.clientHeight,left:0}:ir(n),s=getComputedStyle(n),l=is(i.left,i.right,e.left,e.right,ii(s.scrollPaddingLeft),ii(s.scrollPaddingRight)),o=is(i.top,i.bottom,e.top,e.bottom,ii(s.scrollPaddingTop),ii(s.scrollPaddingBottom));if(l||o)if(t)r.defaultView?.scrollBy(l,o);else{let{scrollLeft:t,scrollTop:e}=n;o&&(n.scrollTop+=o),l&&(n.scrollLeft+=l);let r=n.scrollLeft-t,s=n.scrollTop-e;i={left:i.left-r,top:i.top-s,right:i.right-r,bottom:i.bottom-s}}n=t||"fixed"===s.position?null:ie(n)}},io=["block","break","cursor","inline","scroll","text"],ia=(t,e,r)=>{let i=new t8;return io.forEach(t=>{let r=e.query(t);r&&i.register(r)}),t.forEach(t=>{let n=e.query(t);n||r.error(`Cannot register "${t}" specified in "formats" config. Are you sure it was registered?`);let s=0;for(;n;)if(i.register(n),n="blotName"in n?n.requiredContainer??null:null,(s+=1)>100){r.error(`Cycle detected in registering blot requiredContainer: "${t}"`);break}}),i},ic=rV("quill"),ih=new t8;ef.uiClass="ql-ui";class iu{static DEFAULTS={bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:ih,theme:"default"};static events=rW.events;static sources=rW.sources;static version="2.0.3";static imports={delta:e_,parchment:i,"core/module":r3,"core/theme":it};static debug(t){!0===t&&(t="log"),rV.level(t)}static find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return rz.get(t)||ih.find(t,e)}static import(t){return null==this.imports[t]&&ic.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])){let t=arguments.length<=0?void 0:arguments[0],e=!!(arguments.length<=1?void 0:arguments[1]),r="attrName"in t?t.attrName:t.blotName;"string"==typeof r?this.register(`formats/${r}`,t,e):Object.keys(t).forEach(r=>{this.register(r,t[r],e)})}else{let t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],r=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[t]||r||ic.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&"boolean"!=typeof e&&"abstract"!==e.blotName&&ih.register(e),"function"==typeof e.register&&e.register(ih)}}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(t,e){let r=id(t);if(!r)throw Error("Invalid Quill container");let i=e.theme&&e.theme!==iu.DEFAULTS.theme?iu.import(`themes/${e.theme}`):it;if(!i)throw Error(`Invalid theme ${e.theme}. Did you register it?`);let{modules:n,...s}=iu.DEFAULTS,{modules:l,...o}=i.DEFAULTS,a=ip(e.modules);null!=a&&a.toolbar&&a.toolbar.constructor!==Object&&(a={...a,toolbar:{container:a.toolbar}});let c=t2({},ip(n),ip(l),a),h={...s,...ig(o),...ig(e)},u=e.registry;return u?e.formats&&ic.warn('Ignoring "formats" option because "registry" is specified'):u=e.formats?ia(e.formats,h.registry,ic):h.registry,{...h,registry:u,container:r,theme:i,modules:Object.entries(c).reduce((t,e)=>{let[r,i]=e;if(!i)return t;let n=iu.import(`modules/${r}`);return null==n?(ic.error(`Cannot load ${r} module. Are you sure you registered it?`),t):{...t,[r]:t2({},n.DEFAULTS||{},i)}},{}),bounds:id(h.bounds)}}(t,e),this.container=this.options.container,null==this.container)return void ic.error("Invalid Quill container",t);this.options.debug&&iu.debug(this.options.debug);let r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",rz.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new rW;let i=ew.blotName,n=this.options.registry.query(i);if(!n||!("blotName"in n))throw Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new n(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new rJ(this.scroll),this.selection=new rX(this.scroll,this.emitter),this.composition=new r9(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(rW.events.EDITOR_CHANGE,t=>{t===rW.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(rW.events.SCROLL_UPDATE,(t,e)=>{let r=this.selection.lastRange,[i]=this.selection.getRange(),n=r&&i?{oldRange:r,newRange:i}:void 0;im.call(this,()=>this.editor.update(null,e,n),t)}),this.emitter.on(rW.events.SCROLL_EMBED_UPDATE,(t,e)=>{let r=this.selection.lastRange,[i]=this.selection.getRange(),n=r&&i?{oldRange:r,newRange:i}:void 0;im.call(this,()=>{let r=new e_().retain(t.offset(this)).retain({[t.statics.blotName]:e});return this.editor.update(r,[],n)},iu.sources.USER)}),r){let t=this.clipboard.convert({html:`${r}
`,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){let e=t;(t=document.createElement("div")).classList.add(e)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,r){return[t,e,,r]=ib(t,e,r),im.call(this,()=>this.editor.deleteText(t,e),r,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;let 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){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rW.sources.API;return im.call(this,()=>{let r=this.getSelection(!0),i=new e_;if(null==r)return i;if(this.scroll.query(t,t5.BLOCK))i=this.editor.formatLine(r.index,r.length,{[t]:e});else{if(0===r.length)return this.selection.format(t,e),i;i=this.editor.formatText(r.index,r.length,{[t]:e})}return this.setSelection(r,rW.sources.SILENT),i},r)}formatLine(t,e,r,i,n){let s;return[t,e,s,n]=ib(t,e,r,i,n),im.call(this,()=>this.editor.formatLine(t,e,s),n,t,0)}formatText(t,e,r,i,n){let s;return[t,e,s,n]=ib(t,e,r,i,n),im.call(this,()=>this.editor.formatText(t,e,s),n,t,0)}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null;if(!(r="number"==typeof t?this.selection.getBounds(t,e):this.selection.getBounds(t.index,t.length)))return null;let i=this.container.getBoundingClientRect();return{bottom:r.bottom-i.top,height:r.height,left:r.left-i.left,right:r.right-i.left,top:r.top-i.top,width:r.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]=ib(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):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(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t&&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]=ib(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]=ib(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:iu.sources.API;return im.call(this,()=>this.editor.insertEmbed(t,e,r),i,t)}insertText(t,e,r,i,n){let s;return[t,,s,n]=ib(t,0,r,i,n),im.call(this,()=>this.editor.insertText(t,e,s),n,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,r){return[t,e,,r]=ib(t,e,r),im.call(this,()=>this.editor.removeFormat(t,e),r,t)}scrollRectIntoView(t){il(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(){let t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rW.sources.API;return im.call(this,()=>{t=new e_(t);let e=this.getLength(),r=this.editor.deleteText(0,e),i=this.editor.insertContents(0,t),n=this.editor.deleteText(this.getLength()-1,1);return r.compose(i).compose(n)},e)}setSelection(t,e,r){null==t?this.selection.setRange(null,e||iu.sources.API):([t,e,,r]=ib(t,e,r),this.selection.setRange(new rG(Math.max(0,t),e),r),r!==rW.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rW.sources.API,r=new e_().insert(t);return this.setContents(r,e)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rW.sources.USER,e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rW.sources.API;return im.call(this,()=>(t=new e_(t),this.editor.applyDelta(t)),e,!0)}}function id(t){return"string"==typeof t?document.querySelector(t):t}function ip(t){return Object.entries(t??{}).reduce((t,e)=>{let[r,i]=e;return{...t,[r]:!0===i?{}:i}},{})}function ig(t){return Object.fromEntries(Object.entries(t).filter(t=>void 0!==t[1]))}function im(t,e,r,i){if(!this.isEnabled()&&e===rW.sources.USER&&!this.allowReadOnlyEdits)return new e_;let n=null==r?null:this.getSelection(),s=this.editor.delta,l=t();if(null!=n&&(!0===r&&(r=n.index),null==i?n=iy(n,l,e):0!==i&&(n=iy(n,r,i,e)),this.setSelection(n,rW.sources.SILENT)),l.length()>0){let t=[rW.events.TEXT_CHANGE,l,s,e];this.emitter.emit(rW.events.EDITOR_CHANGE,...t),e!==rW.sources.SILENT&&this.emitter.emit(...t)}return l}function ib(t,e,r,i,n){let s={};return"number"==typeof t.index&&"number"==typeof t.length?("number"!=typeof e&&(n=i,i=r,r=e),e=t.length,t=t.index):"number"!=typeof e&&(n=i,i=r,r=e,e=0),"object"==typeof r?(s=r,n=i):"string"==typeof r&&(null!=i?s[r]=i:n=r),[t,e,s,n=n||rW.sources.API]}function iy(t,e,r,i){let n,s,l="number"==typeof r?r:0;return null==t?null:(e&&"function"==typeof e.transformPosition?[n,s]=[t.index,t.index+t.length].map(t=>e.transformPosition(t,i!==rW.sources.USER)):[n,s]=[t.index,t.index+t.length].map(t=>t=0?t+l:Math.max(e,t+l)),new rG(n,s-n))}class iv extends ev{}let ix=iv;function iN(t){return t instanceof rI||t instanceof rM}function iE(t){return"function"==typeof t.updateContent}class iA extends ew{static blotName="scroll";static className="ql-editor";static tagName="DIV";static defaultChild=rI;static allowedChildren=[rI,rM,ix];constructor(t,e,r){let{emitter:i}=r;super(t,e),this.emitter=i,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;let t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(rW.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(rW.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(rW.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){let[r,i]=this.line(t),[n]=this.line(t+e);if(super.deleteAt(t,e),null!=n&&r!==n&&i>0){if(r instanceof rM||n instanceof rM)return void this.optimize();let t=n.children.head instanceof rO?null:n.children.head;r.moveChildren(n,t),r.remove()}this.optimize()}enable(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.domNode.setAttribute("contenteditable",t?"true":"false")}formatAt(t,e,r,i){super.formatAt(t,e,r,i),this.optimize()}insertAt(t,e,r){if(t>=this.length())if(null==r||null==this.scroll.query(e,t5.BLOCK)){let t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t),null==r&&e.endsWith("\n")?t.insertAt(0,e.slice(0,-1),r):t.insertAt(0,e,r)}else{let t=this.scroll.create(e,r);this.appendChild(t)}else super.insertAt(t,e,r);this.optimize()}insertBefore(t,e){if(t.statics.scope===t5.INLINE_BLOT){let r=this.scroll.create(this.statics.defaultChild.blotName);r.appendChild(t),super.insertBefore(r,e)}else super.insertBefore(t,e)}insertContents(t,e){let r=this.deltaToRenderBlocks(e.concat(new e_().insert("\n"))),i=r.pop();if(null==i)return;this.batchStart();let n=r.shift();if(n){let e="block"===n.type&&(0===n.delta.length()||!this.descendant(rM,t)[0]&&t{this.formatAt(s-1,1,t,o[t])}),t=s}let[s,l]=this.children.find(t);r.length&&(s&&(s=s.split(l),l=0),r.forEach(t=>{if("block"===t.type)iw(this.createBlock(t.attributes,s||void 0),0,t.delta);else{let e=this.create(t.key,t.value);this.insertBefore(e,s||void 0),Object.keys(t.attributes).forEach(r=>{e.format(r,t.attributes[r])})}})),"block"===i.type&&i.delta.length()&&iw(this,s?s.offset(s.scroll)+l:this.length(),i.delta),this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(t){let e=this.path(t).pop();if(!e)return[null,-1];let[r,i]=e;return r instanceof ec?[r,i]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(iN,t)}lines(){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,r=(t,e,i)=>{let n=[],s=i;return t.children.forEachAt(e,i,(t,e,i)=>{iN(t)?n.push(t):t instanceof ev&&(n=n.concat(r(t,e,s))),s-=i}),n};return r(this,t,e)}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(rW.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch){Array.isArray(t)&&(this.batch=this.batch.concat(t));return}let e=rW.sources.USER;"string"==typeof t&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),(t=t.filter(t=>{let{target:e}=t,r=this.find(e,!0);return r&&!iE(r)})).length>0&&this.emitter.emit(rW.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(rW.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,r){let[i]=this.descendant(t=>t instanceof rM,t);i&&i.statics.blotName===e&&iE(i)&&i.updateContent(r)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){let e=[],r=new e_;return t.forEach(t=>{let i=t?.insert;if(i)if("string"==typeof i){let n=i.split("\n");n.slice(0,-1).forEach(i=>{r.insert(i,t.attributes),e.push({type:"block",delta:r,attributes:t.attributes??{}}),r=new e_});let s=n[n.length-1];s&&r.insert(s,t.attributes)}else{let n=Object.keys(i)[0];if(!n)return;this.query(n,t5.INLINE)?r.push(t):(r.length()&&e.push({type:"block",delta:r,attributes:{}}),r=new e_,e.push({type:"blockEmbed",key:n,value:i[n],attributes:t.attributes??{}}))}}),r.length()&&e.push({type:"block",delta:r,attributes:{}}),e}createBlock(t,e){let r,i={};Object.entries(t).forEach(t=>{let[e,n]=t;null!=this.query(e,t5.BLOCK&t5.BLOT)?r=e:i[e]=n});let n=this.create(r||this.statics.defaultChild.blotName,r?t[r]:void 0);this.insertBefore(n,e||void 0);let s=n.length();return Object.entries(i).forEach(t=>{let[e,r]=t;n.formatAt(0,s,e,r)}),n}}function iw(t,e,r){r.reduce((e,r)=>{let i=e_.Op.length(r),n=r.attributes||{};if(null!=r.insert){if("string"==typeof r.insert){let i=r.insert;t.insertAt(e,i);let[s]=t.descendant(ec,e),l=rD(s);n=e_.AttributeMap.diff(l,n)||{}}else if("object"==typeof r.insert){let i=Object.keys(r.insert)[0];if(null==i)return e;if(t.insertAt(e,i,r.insert[i]),null!=t.scroll.query(i,t5.INLINE)){let[r]=t.descendant(ec,e),i=rD(r);n=e_.AttributeMap.diff(i,n)||{}}}}return Object.keys(n).forEach(r=>{t.formatAt(e,i,r,n[r])}),e+i},e)}let iq={scope:t5.BLOCK,whitelist:["right","center","justify"]},ik=new t4("align","align",iq),i_=new et("align","ql-align",iq),iL=new ei("align","text-align",iq);class iO extends ei{value(t){let e=super.value(t);if(!e.startsWith("rgb("))return e;let r=(e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"")).split(",").map(t=>`00${parseInt(t,10).toString(16)}`.slice(-2)).join("");return`#${r}`}}let iS=new et("color","ql-color",{scope:t5.INLINE}),iT=new iO("color","color",{scope:t5.INLINE}),ij=new et("background","ql-bg",{scope:t5.INLINE}),iC=new iO("background","background-color",{scope:t5.INLINE});class iR extends ix{static create(t){let e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(t=>1>=t.length()?"":t.domNode.innerText).join("\n").slice(t,t+e)}html(t,e){return`
${rj(this.code(t,e))}
`}}class iI extends rI{static TAB=" ";static register(){iu.register(iR)}}class iM extends rR{}iM.blotName="code",iM.tagName="CODE",iI.blotName="code-block",iI.className="ql-code-block",iI.tagName="DIV",iR.blotName="code-block-container",iR.className="ql-code-block-container",iR.tagName="DIV",iR.allowedChildren=[iI],iI.allowedChildren=[rS,rO,rU],iI.requiredContainer=iR;let iB={scope:t5.BLOCK,whitelist:["rtl"]},iD=new t4("direction","dir",iB),iU=new et("direction","ql-direction",iB),iP=new ei("direction","direction",iB),iz={scope:t5.INLINE,whitelist:["serif","monospace"]},iF=new et("font","ql-font",iz);class i$ extends ei{value(t){return super.value(t).replace(/["']/g,"")}}let iH=new i$("font","font-family",iz),iV=new et("size","ql-size",{scope:t5.INLINE,whitelist:["small","large","huge"]}),iK=new ei("size","font-size",{scope:t5.INLINE,whitelist:["10px","18px","32px"]}),iW=rV("quill:keyboard"),iZ=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class iG extends r3{static match(t,e){return!["altKey","ctrlKey","metaKey","shiftKey"].some(r=>!!e[r]!==t[r]&&null!==e[r])&&(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]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=function(t){if("string"==typeof t||"number"==typeof t)t={key:t};else{if("object"!=typeof t)return null;t=rd(t)}return t.shortKey&&(t[iZ]=t.shortKey,delete t.shortKey),t}(t);if(null==i)return void iW.warn("Attempted to add invalid keyboard binding",i);"function"==typeof e&&(e={handler:e}),"function"==typeof r&&(r={handler:r}),(Array.isArray(i.key)?i.key:[i.key]).forEach(t=>{let n={...i,key:t,...e,...r};this.bindings[n.key]=this.bindings[n.key]||[],this.bindings[n.key].push(n)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing||229===t.keyCode&&("Enter"===t.key||"Backspace"===t.key))return;let e=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(e=>iG.match(t,e));if(0===e.length)return;let r=iu.find(t.target,!0);if(r&&r.scroll!==this.quill.scroll)return;let i=this.quill.getSelection();if(null==i||!this.quill.hasFocus())return;let[n,s]=this.quill.getLine(i.index),[l,o]=this.quill.getLeaf(i.index),[a,c]=0===i.length?[l,o]:this.quill.getLeaf(i.index+i.length),h=l instanceof ek?l.value().slice(0,o):"",u=a instanceof ek?a.value().slice(c):"",d={collapsed:0===i.length,empty:0===i.length&&1>=n.length(),format:this.quill.getFormat(i),line:n,offset:s,prefix:h,suffix:u,event:t};e.some(t=>{if(null!=t.collapsed&&t.collapsed!==d.collapsed||null!=t.empty&&t.empty!==d.empty||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]:rL(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,i,d,t)})&&t.preventDefault()})}handleBackspace(t,e){let r=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(0===t.index||1>=this.quill.getLength())return;let i={},[n]=this.quill.getLine(t.index),s=new e_().retain(t.index-r).delete(r);if(0===e.offset){let[e]=this.quill.getLine(t.index-1);if(e&&!("block"===e.statics.blotName&&1>=e.length())){let e=n.formats(),r=this.quill.getFormat(t.index-1,1);if(Object.keys(i=e_.AttributeMap.diff(e,r)||{}).length>0){let e=new e_().retain(t.index+n.length()-2).retain(1,i);s=s.compose(e)}}}this.quill.updateContents(s,iu.sources.USER),this.quill.focus()}handleDelete(t,e){let r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-r)return;let i={},[n]=this.quill.getLine(t.index),s=new e_().retain(t.index).delete(r);if(e.offset>=n.length()-1){let[e]=this.quill.getLine(t.index+1);if(e){let r=n.formats(),l=this.quill.getFormat(t.index,1);Object.keys(i=e_.AttributeMap.diff(r,l)||{}).length>0&&(s=s.retain(e.length()-1).retain(1,i))}}this.quill.updateContents(s,iu.sources.USER),this.quill.focus()}handleDeleteRange(t){i1({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){let r=Object.keys(e.format).reduce((t,r)=>(this.quill.scroll.query(r,t5.BLOCK)&&!Array.isArray(e.format[r])&&(t[r]=e.format[r]),t),{}),i=new e_().retain(t.index).delete(t.length).insert("\n",r);this.quill.updateContents(i,iu.sources.USER),this.quill.setSelection(t.index+1,iu.sources.SILENT),this.quill.focus()}}function iX(t){return{key:"Tab",shiftKey:!t,format:{"code-block":!0},handler(e,r){let{event:i}=r,{TAB:n}=this.quill.scroll.query("code-block");if(0===e.length&&!i.shiftKey){this.quill.insertText(e.index,n,iu.sources.USER),this.quill.setSelection(e.index+n.length,iu.sources.SILENT);return}let s=0===e.length?this.quill.getLines(e.index,1):this.quill.getLines(e),{index:l,length:o}=e;s.forEach((e,r)=>{t?(e.insertAt(0,n),0===r?l+=n.length:o+=n.length):e.domNode.textContent.startsWith(n)&&(e.deleteAt(0,n.length),0===r?l-=n.length:o-=n.length)}),this.quill.update(iu.sources.USER),this.quill.setSelection(l,o,iu.sources.SILENT)}}}function iY(t,e){return{key:t,shiftKey:e,altKey:null,["ArrowLeft"===t?"prefix":"suffix"]:/^$/,handler(r){let{index:i}=r;"ArrowRight"===t&&(i+=r.length+1);let[n]=this.quill.getLeaf(i);return!(n instanceof eN)||("ArrowLeft"===t?e?this.quill.setSelection(r.index-1,r.length+1,iu.sources.USER):this.quill.setSelection(r.index-1,iu.sources.USER):e?this.quill.setSelection(r.index,r.length+1,iu.sources.USER):this.quill.setSelection(r.index+r.length+1,iu.sources.USER),!1)}}}function iQ(t){return{key:t[0],shortKey:!0,handler(e,r){this.quill.format(t,!r.format[t],iu.sources.USER)}}}function iJ(t){return{key:t?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(e,r){let i=t?"prev":"next",n=r.line,s=n.parent[i];if(null!=s){if("table-row"===s.statics.blotName){let t=s.children.head,e=n;for(;null!=e.prev;)e=e.prev,t=t.next;let i=t.offset(this.quill.scroll)+Math.min(r.offset,t.length()-1);this.quill.setSelection(i,0,iu.sources.USER)}}else{let e=n.table()[i];null!=e&&(t?this.quill.setSelection(e.offset(this.quill.scroll)+e.length()-1,0,iu.sources.USER):this.quill.setSelection(e.offset(this.quill.scroll),0,iu.sources.USER))}return!1}}}function i1(t){let{quill:e,range:r}=t,i=e.getLines(r),n={};if(i.length>1){let t=i[0].formats(),e=i[i.length-1].formats();n=e_.AttributeMap.diff(e,t)||{}}e.deleteText(r,iu.sources.USER),Object.keys(n).length>0&&e.formatLine(r.index,1,n,iu.sources.USER),e.setSelection(r.index,iu.sources.SILENT)}iG.DEFAULTS={bindings:{bold:iQ("bold"),italic:iQ("italic"),underline:iQ("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(t,e){return!!e.collapsed&&0!==e.offset||(this.quill.format("indent","+1",iu.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",iu.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",iu.sources.USER):null!=e.format.list&&this.quill.format("list",!1,iu.sources.USER)}},"indent code-block":iX(!0),"outdent code-block":iX(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(t){this.quill.deleteText(t.index-1,1,iu.sources.USER)}},tab:{key:"Tab",handler(t,e){if(e.format.table)return!0;this.quill.history.cutoff();let r=new e_().retain(t.index).delete(t.length).insert(" ");return this.quill.updateContents(r,iu.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,iu.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,iu.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(t,e){let r={list:!1};e.format.indent&&(r.indent=!1),this.quill.formatLine(t.index,t.length,r,iu.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(t){let[e,r]=this.quill.getLine(t.index),i={...e.formats(),list:"checked"},n=new e_().retain(t.index).insert("\n",i).retain(e.length()-r-1).retain(1,{list:"unchecked"});this.quill.updateContents(n,iu.sources.USER),this.quill.setSelection(t.index+1,iu.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(t,e){let[r,i]=this.quill.getLine(t.index),n=new e_().retain(t.index).insert("\n",e.format).retain(r.length()-i-1).retain(1,{header:null});this.quill.updateContents(n,iu.sources.USER),this.quill.setSelection(t.index+1,iu.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){let e=this.quill.getModule("table");if(e){var r,i,n,s;let[l,o,a,c]=e.getTable(t),h=(r=0,i=o,n=a,s=c,null==i.prev&&null==i.next?null==n.prev&&null==n.next?0===s?-1:1:null==n.prev?-1:1:null==i.prev?-1:null==i.next?1:null);if(null==h)return;let u=l.offset();if(h<0){let e=new e_().retain(u).insert("\n");this.quill.updateContents(e,iu.sources.USER),this.quill.setSelection(t.index+1,t.length,iu.sources.SILENT)}else if(h>0){u+=l.length();let t=new e_().retain(u).insert("\n");this.quill.updateContents(t,iu.sources.USER),this.quill.setSelection(u,iu.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(t,e){let{event:r,line:i}=e,n=i.offset(this.quill.scroll);r.shiftKey?this.quill.setSelection(n-1,iu.sources.USER):this.quill.setSelection(n+i.length(),iu.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(t,e){let r;if(null==this.quill.scroll.query("list"))return!0;let{length:i}=e.prefix,[n,s]=this.quill.getLine(t.index);if(s>i)return!0;switch(e.prefix.trim()){case"[]":case"[ ]":r="unchecked";break;case"[x]":r="checked";break;case"-":case"*":r="bullet";break;default:r="ordered"}this.quill.insertText(t.index," ",iu.sources.USER),this.quill.history.cutoff();let l=new e_().retain(t.index-s).delete(i+1).retain(n.length()-2-s).retain(1,{list:r});return this.quill.updateContents(l,iu.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-i,iu.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(t){let[e,r]=this.quill.getLine(t.index),i=2,n=e;for(;null!=n&&1>=n.length()&&n.formats()["code-block"];)if(n=n.prev,(i-=1)<=0){let i=new e_().retain(t.index+e.length()-r-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(i,iu.sources.USER),this.quill.setSelection(t.index-1,iu.sources.SILENT),!1}return!0}},"embed left":iY("ArrowLeft",!1),"embed left shift":iY("ArrowLeft",!0),"embed right":iY("ArrowRight",!1),"embed right shift":iY("ArrowRight",!0),"table down":iJ(!1),"table up":iJ(!0)}};let i0=/font-weight:\s*normal/,i2=["P","OL","UL"],i5=t=>t&&i2.includes(t.tagName),i4=t=>{Array.from(t.querySelectorAll("br")).filter(t=>i5(t.previousElementSibling)&&i5(t.nextElementSibling)).forEach(t=>{t.parentNode?.removeChild(t)})},i3=t=>{Array.from(t.querySelectorAll('b[style*="font-weight"]')).filter(t=>t.getAttribute("style")?.match(i0)).forEach(e=>{let r=t.createDocumentFragment();r.append(...e.childNodes),e.parentNode?.replaceChild(r,e)})},i6=/\bmso-list:[^;]*ignore/i,i8=/\bmso-list:[^;]*\bl(\d+)/i,i9=/\bmso-list:[^;]*\blevel(\d+)/i,i7=(t,e)=>{let r=t.getAttribute("style"),i=r?.match(i8);if(!i)return null;let n=Number(i[1]),s=r?.match(i9),l=s?Number(s[1]):1,o=RegExp(`@list l${n}:level${l}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=e.match(o);return{id:n,indent:l,type:a&&"bullet"===a[1]?"bullet":"ordered",element:t}},nt=t=>{let e=Array.from(t.querySelectorAll("[style*=mso-list]")),r=[],i=[];e.forEach(t=>{(t.getAttribute("style")||"").match(i6)?r.push(t):i.push(t)}),r.forEach(t=>t.parentNode?.removeChild(t));let n=t.documentElement.innerHTML,s=i.map(t=>i7(t,n)).filter(t=>t);for(;s.length;){let t=[],e=s.shift();for(;e;)t.push(e),e=s.length&&s[0]?.element===e.element.nextElementSibling&&s[0].id===e.id?s.shift():null;let r=document.createElement("ul");t.forEach(t=>{let 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,r.appendChild(e)});let i=t[0]?.element,{parentNode:n}=i??{};i&&n?.replaceChild(r,i),t.slice(1).forEach(t=>{let{element:e}=t;n?.removeChild(e)})}},ne=[function(t){"urn:schemas-microsoft-com:office:word"===t.documentElement.getAttribute("xmlns:w")&&nt(t)},function(t){t.querySelector('[id^="docs-internal-guid-"]')&&(i3(t),i4(t))}],nr=t=>{t.documentElement&&ne.forEach(e=>{e(t)})},ni=rV("quill:clipboard"),nn=[[Node.TEXT_NODE,function(t,e,r){let i=t.data;if(t.parentElement?.tagName==="O:P")return e.insert(i.trim());if(!function t(e){return null!=e&&(nu.has(e)||("PRE"===e.tagName?nu.set(e,!0):nu.set(e,t(e.parentNode))),nu.get(e))}(t)){if(0===i.trim().length&&i.includes("\n")&&(!t.previousElementSibling||!t.nextElementSibling||nh(t.previousElementSibling,r)||nh(t.nextElementSibling,r)))return e;i=(i=i.replace(/[^\S\u00a0]/g," ")).replace(/ {2,}/g," "),(null==t.previousSibling&&null!=t.parentElement&&nh(t.parentElement,r)||t.previousSibling instanceof Element&&nh(t.previousSibling,r))&&(i=i.replace(/^ /,"")),(null==t.nextSibling&&null!=t.parentElement&&nh(t.parentElement,r)||t.nextSibling instanceof Element&&nh(t.nextSibling,r))&&(i=i.replace(/ $/,"")),i=i.replaceAll("\xa0"," ")}return e.insert(i)}],[Node.TEXT_NODE,np],["br",function(t,e){return nc(e,"\n")||e.insert("\n"),e}],[Node.ELEMENT_NODE,np],[Node.ELEMENT_NODE,function(t,e,r){let i=r.query(t);if(null==i)return e;if(i.prototype instanceof eN){let e={},n=i.value(t);if(null!=n)return e[i.blotName]=n,new e_().insert(e,i.formats(t,r))}else if(i.prototype instanceof eb&&!nc(e,"\n")&&e.insert("\n"),"blotName"in i&&"formats"in i&&"function"==typeof i.formats)return na(e,i.blotName,i.formats(t,r),r);return e}],[Node.ELEMENT_NODE,function(t,e,r){let i=t4.keys(t),n=et.keys(t),s=ei.keys(t),l={};return i.concat(n).concat(s).forEach(e=>{let i=r.query(e,t5.ATTRIBUTE);null!=i&&(l[i.attrName]=i.value(t),l[i.attrName])||(null!=(i=ns[e])&&(i.attrName===e||i.keyName===e)&&(l[i.attrName]=i.value(t)||void 0),null!=(i=nl[e])&&(i.attrName===e||i.keyName===e)&&(l[(i=nl[e]).attrName]=i.value(t)||void 0))}),Object.entries(l).reduce((t,e)=>{let[i,n]=e;return na(t,i,n,r)},e)}],[Node.ELEMENT_NODE,function(t,e,r){let i={},n=t.style||{};return("italic"===n.fontStyle&&(i.italic=!0),"underline"===n.textDecoration&&(i.underline=!0),"line-through"===n.textDecoration&&(i.strike=!0),(n.fontWeight?.startsWith("bold")||parseInt(n.fontWeight,10)>=700)&&(i.bold=!0),e=Object.entries(i).reduce((t,e)=>{let[i,n]=e;return na(t,i,n,r)},e),parseFloat(n.textIndent||0)>0)?new e_().insert(" ").concat(e):e}],["li",function(t,e,r){let i=r.query(t);if(null==i||"list"!==i.blotName||!nc(e,"\n"))return e;let n=-1,s=t.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(n+=1),s=s.parentNode;return n<=0?e:e.reduce((t,e)=>e.insert?e.attributes&&"number"==typeof e.attributes.indent?t.push(e):t.insert(e.insert,{indent:n,...e.attributes||{}}):t,new e_)}],["ol, ul",function(t,e,r){let i="OL"===t.tagName?"ordered":"bullet",n=t.getAttribute("data-checked");return n&&(i="true"===n?"checked":"unchecked"),na(e,"list",i,r)}],["pre",function(t,e,r){let i=r.query("code-block");return na(e,"code-block",!i||!("formats"in i)||"function"!=typeof i.formats||i.formats(t,r),r)}],["tr",function(t,e,r){let i=t.parentElement?.tagName==="TABLE"?t.parentElement:t.parentElement?.parentElement;return null!=i?na(e,"table",Array.from(i.querySelectorAll("tr")).indexOf(t)+1,r):e}],["b",nf("bold")],["i",nf("italic")],["strike",nf("strike")],["style",function(){return new e_}]],ns=[ik,iD].reduce((t,e)=>(t[e.keyName]=e,t),{}),nl=[iL,iC,iT,iP,iH,iK].reduce((t,e)=>(t[e.keyName]=e,t),{});class no extends r3{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=[],nn.concat(this.options.matchers??[]).forEach(t=>{let[e,r]=t;this.addMatcher(e,r)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:r}=t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i[iI.blotName])return new e_().insert(r||"",{[iI.blotName]:i[iI.blotName]});if(!e)return new e_().insert(r||"",i);let n=this.convertHTML(e);return nc(n,"\n")&&(null==n.ops[n.ops.length-1].attributes||i.table)?n.compose(new e_().retain(n.length()-1).delete(1)):n}normalizeHTML(t){nr(t)}convertHTML(t){let e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);let r=e.body,i=new WeakMap,[n,s]=this.prepareMatching(r,i);return nd(this.quill.scroll,r,n,s,i)}dangerouslyPasteHTML(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:iu.sources.API;if("string"==typeof t){let r=this.convert({html:t,text:""});this.quill.setContents(r,e),this.quill.setSelection(0,iu.sources.SILENT)}else{let i=this.convert({html:e,text:""});this.quill.updateContents(new e_().retain(t).concat(i),r),this.quill.setSelection(t+i.length(),iu.sources.SILENT)}}onCaptureCopy(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.defaultPrevented)return;t.preventDefault();let[r]=this.quill.selection.getRange();if(null==r)return;let{html:i,text:n}=this.onCopy(r,e);t.clipboardData?.setData("text/plain",n),t.clipboardData?.setData("text/html",i),e&&i1({range:r,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();let e=this.quill.getSelection(!0);if(null==e)return;let r=t.clipboardData?.getData("text/html"),i=t.clipboardData?.getData("text/plain");if(!r&&!i){let e=t.clipboardData?.getData("text/uri-list");e&&(i=this.normalizeURIList(e))}let n=Array.from(t.clipboardData?.files||[]);if(!r&&n.length>0)return void this.quill.uploader.upload(e,n);if(r&&n.length>0){let t=new DOMParser().parseFromString(r,"text/html");if(1===t.body.childElementCount&&t.body.firstElementChild?.tagName==="IMG")return void this.quill.uploader.upload(e,n)}this.onPaste(e,{html:r,text:i})}onCopy(t){let e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:r,html:i}=e,n=this.quill.getFormat(t.index),s=this.convert({text:r,html:i},n);ni.log("onPaste",s,{text:r,html:i});let l=new e_().retain(t.index).delete(t.length).concat(s);this.quill.updateContents(l,iu.sources.USER),this.quill.setSelection(l.length()-t.length,iu.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){let r=[],i=[];return this.matchers.forEach(n=>{let[s,l]=n;switch(s){case Node.TEXT_NODE:i.push(l);break;case Node.ELEMENT_NODE:r.push(l);break;default:Array.from(t.querySelectorAll(s)).forEach(t=>{if(e.has(t)){let r=e.get(t);r?.push(l)}else e.set(t,[l])})}}),[r,i]}}function na(t,e,r,i){return i.query(e)?t.reduce((t,i)=>i.insert?i.attributes&&i.attributes[e]?t.push(i):t.insert(i.insert,{...r?{[e]:r}:{},...i.attributes}):t,new e_):t}function nc(t,e){let r="";for(let i=t.ops.length-1;i>=0&&r.lengthi(e,r,t),new e_):e.nodeType===e.ELEMENT_NODE?Array.from(e.childNodes||[]).reduce((s,l)=>{let o=nd(t,l,r,i,n);return l.nodeType===e.ELEMENT_NODE&&(o=r.reduce((e,r)=>r(l,e,t),o),o=(n.get(l)||[]).reduce((e,r)=>r(l,e,t),o)),s.concat(o)},new e_):new e_}function nf(t){return(e,r,i)=>na(r,t,!0,i)}function np(t,e,r){if(!nc(e,"\n")){if(nh(t,r)&&(t.childNodes.length>0||t instanceof HTMLParagraphElement))return e.insert("\n");if(e.length()>0&&t.nextSibling){let i=t.nextSibling;for(;null!=i;){if(nh(i,r))return e.insert("\n");let t=r.query(i);if(t&&t.prototype instanceof rM)return e.insert("\n");i=i.firstChild}}}return e}class ng extends r3{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(iu.events.EDITOR_CHANGE,(t,e,r,i)=>{t===iu.events.SELECTION_CHANGE?e&&i!==iu.sources.SILENT&&(this.currentRange=e):t===iu.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&i!==iu.sources.USER?this.transform(e):this.record(e,r)),this.currentRange=nb(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;let r=this.stack[t].pop();if(!r)return;let i=this.quill.getContents(),n=r.delta.invert(i);this.stack[e].push({delta:n,range:nb(r.range,n)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(r.delta,iu.sources.USER),this.ignoreChange=!1,this.restoreSelection(r)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(t,e){if(0===t.ops.length)return;this.stack.redo=[];let r=t.invert(e),i=this.currentRange,n=Date.now();if(this.lastRecorded+this.options.delay>n&&this.stack.undo.length>0){let t=this.stack.undo.pop();t&&(r=r.compose(t.delta),i=t.range)}else this.lastRecorded=n;0!==r.length()&&(this.stack.undo.push({delta:r,range:i}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(t){nm(this.stack.undo,t),nm(this.stack.redo,t)}undo(){this.change("undo","redo")}restoreSelection(t){if(t.range)this.quill.setSelection(t.range,iu.sources.USER);else{let e=function(t,e){let r=e.reduce((t,e)=>t+(e.delete||0),0),i=e.length()-r;return function(t,e){let r=e.ops[e.ops.length-1];return null!=r&&(null!=r.insert?"string"==typeof r.insert&&r.insert.endsWith("\n"):null!=r.attributes&&Object.keys(r.attributes).some(e=>null!=t.query(e,t5.BLOCK)))}(t,e)&&(i-=1),i}(this.quill.scroll,t.delta);this.quill.setSelection(e,iu.sources.USER)}}}function nm(t,e){let r=e;for(let e=t.length-1;e>=0;e-=1){let i=t[e];t[e]={delta:r.transform(i.delta,!0),range:i.range&&nb(i.range,r)},r=i.delta.transform(r),0===t[e].delta.length()&&t.splice(e,1)}}function nb(t,e){if(!t)return t;let r=e.transformPosition(t.index);return{index:r,length:e.transformPosition(t.index+t.length)-r}}class ny extends r3{constructor(t,e){super(t,e),t.root.addEventListener("drop",e=>{e.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(e.clientX,e.clientY);else if(document.caretPositionFromPoint){let t=document.caretPositionFromPoint(e.clientX,e.clientY);(r=document.createRange()).setStart(t.offsetNode,t.offset),r.setEnd(t.offsetNode,t.offset)}let i=r&&t.selection.normalizeNative(r);if(i){let r=t.selection.normalizedToRange(i);e.dataTransfer?.files&&this.upload(r,e.dataTransfer.files)}})}upload(t,e){let r=[];Array.from(e).forEach(t=>{t&&this.options.mimetypes?.includes(t.type)&&r.push(t)}),r.length>0&&this.options.handler.call(this,t,r)}}ny.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(t,e){this.quill.scroll.query("image")&&Promise.all(e.map(t=>new Promise(e=>{let r=new FileReader;r.onload=()=>{e(r.result)},r.readAsDataURL(t)}))).then(e=>{let r=e.reduce((t,e)=>t.insert({image:e}),new e_().retain(t.index).delete(t.length));this.quill.updateContents(r,rW.sources.USER),this.quill.setSelection(t.index+e.length,rW.sources.SILENT)})}};let nv=["insertText","insertReplacementText"];class nx extends r3{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",t=>{this.handleBeforeInput(t)}),/Android/i.test(navigator.userAgent)||t.on(iu.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){i1({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){let r=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents(new e_().retain(t.index).insert(e,r),iu.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,iu.sources.SILENT),!0}handleBeforeInput(t){var e;if(this.quill.composition.isComposing||t.defaultPrevented||!nv.includes(t.inputType))return;let r=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!r||!0===r.collapsed)return;let i="string"==typeof(e=t).data?e.data:e.dataTransfer?.types.includes("text/plain")?e.dataTransfer.getData("text/plain"):null;if(null==i)return;let n=this.quill.selection.normalizeNative(r),s=n?this.quill.selection.normalizedToRange(n):null;s&&this.replaceText(s,i)&&t.preventDefault()}handleCompositionStart(){let t=this.quill.getSelection();t&&this.replaceText(t)}}let nN=/Mac/i.test(navigator.platform),nE=t=>"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowUp"===t.key||"ArrowDown"===t.key||"Home"===t.key||!!nN&&"a"===t.key&&!0===t.ctrlKey;class nA extends r3{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:r,event:i}=e;if(!(r instanceof ef)||!r.uiNode)return!0;let n="rtl"===getComputedStyle(r.domNode).direction;return!!n&&"ArrowRight"!==i.key||!n&&"ArrowLeft"!==i.key||(this.quill.setSelection(t.index-1,t.length+ +!!i.shiftKey,iu.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",t=>{!t.defaultPrevented&&nE(t)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){this.selectionChangeDeadline=Date.now()+100,this.isListening||(this.isListening=!0,document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0}))}handleSelectionChange(){let t=document.getSelection();if(!t)return;let e=t.getRangeAt(0);if(!0!==e.collapsed||0!==e.startOffset)return;let r=this.quill.scroll.find(e.startContainer);if(!(r instanceof ef)||!r.uiNode)return;let i=document.createRange();i.setStartAfter(r.uiNode),i.setEndAfter(r.uiNode),t.removeAllRanges(),t.addRange(i)}}iu.register({"blots/block":rI,"blots/block/embed":rM,"blots/break":rO,"blots/container":ix,"blots/cursor":rU,"blots/embed":r8,"blots/inline":rR,"blots/scroll":iA,"blots/text":rS,"modules/clipboard":no,"modules/history":ng,"modules/keyboard":iG,"modules/uploader":ny,"modules/input":nx,"modules/uiNode":nA});class nw extends et{add(t,e){let r=0;if("+1"===e||"-1"===e){let i=this.value(t)||0;r="+1"===e?i+1:i-1}else"number"==typeof e&&(r=e);return 0===r?(this.remove(t),!0):super.add(t,r.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}}let nq=new nw("indent","ql-indent",{scope:t5.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class nk extends rI{static blotName="blockquote";static tagName="blockquote"}class n_ extends rI{static blotName="header";static tagName=["H1","H2","H3","H4","H5","H6"];static formats(t){return this.tagName.indexOf(t.tagName)+1}}class nL extends ix{}nL.blotName="list-container",nL.tagName="OL";class nO extends rI{static create(t){let e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){iu.register(nL)}constructor(t,e){super(t,e);let r=e.ownerDocument.createElement("span"),i=r=>{if(!t.isEnabled())return;let i=this.statics.formats(e,t);"checked"===i?(this.format("list","unchecked"),r.preventDefault()):"unchecked"===i&&(this.format("list","checked"),r.preventDefault())};r.addEventListener("mousedown",i),r.addEventListener("touchstart",i),this.attachUI(r)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}nO.blotName="list",nO.tagName="LI",nL.allowedChildren=[nO],nO.requiredContainer=nL;class nS extends rR{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)}}let nT=nS;class nj extends nT{static blotName="italic";static tagName=["EM","I"]}class nC extends rR{static blotName="link";static tagName="A";static SANITIZED_URL="about:blank";static PROTOCOL_WHITELIST=["http","https","mailto","tel","sms"];static create(t){let 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 nR(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 nR(t,e){let r=document.createElement("a");r.href=t;let i=r.href.slice(0,r.href.indexOf(":"));return e.indexOf(i)>-1}class nI extends rR{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}}class nM extends nT{static blotName="strike";static tagName=["S","STRIKE"]}class nB extends rR{static blotName="underline";static tagName="U"}class nD extends r8{static blotName="formula";static className="ql-formula";static tagName="SPAN";static create(t){if(null==window.katex)throw Error("Formula module requires KaTeX.");let 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(){let{formula:t}=this.value();return`${t}`}}let nU=["alt","height","width"];class nP extends eN{static blotName="image";static tagName="IMG";static create(t){let e=super.create(t);return"string"==typeof t&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return nU.reduce((e,r)=>(t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return nR(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){nU.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}let nz=["height","width"];class nF extends rM{static blotName="video";static className="ql-video";static tagName="IFRAME";static create(t){let e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return nz.reduce((e,r)=>(t.hasAttribute(r)&&(e[r]=t.getAttribute(r)),e),{})}static sanitize(t){return nC.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){nz.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){let{video:t}=this.value();return`${t}`}}let n$=new et("code-token","hljs",{scope:t5.INLINE});class nH extends rR{static formats(t,e){for(;null!=t&&t!==e.domNode;){if(t.classList&&t.classList.contains(iI.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,r){super(t,e,r),n$.add(this.domNode,r)}format(t,e){t!==nH.blotName?super.format(t,e):e?n$.add(this.domNode,e):(n$.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),n$.value(this.domNode)||this.unwrap()}}nH.blotName="code-token",nH.className="ql-token";class nV extends iI{static create(t){let 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(),nH.blotName,!1),super.replaceWith(t,e)}}class nK extends iR{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===nV.blotName&&(this.forceNext=!0,this.children.forEach(r=>{r.format(t,e)}))}formatAt(t,e,r,i){r===nV.blotName&&(this.forceNext=!0),super.formatAt(t,e,r,i)}highlight(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;let r=Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode),i=`${r.map(t=>t.textContent).join("\n")}
`,n=nV.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==i){if(i.trim().length>0||null==this.cachedText){let e=this.children.reduce((t,e)=>t.concat(rB(e,!1)),new e_),r=t(i,n);e.diff(r).reduce((t,e)=>{let{retain:r,attributes:i}=e;return r?(i&&Object.keys(i).forEach(e=>{[nV.blotName,nH.blotName].includes(e)&&this.formatAt(t,r,e,i[e])}),t+r):t},0)}this.cachedText=i,this.forceNext=!1}}html(t,e){let[r]=this.children.find(t),i=r?nV.formats(r.domNode):"plain";return`
${rj(this.code(t,e))}
`}optimize(t){if(super.optimize(t),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){let t=nV.formats(this.children.head.domNode);t!==this.uiNode.value&&(this.uiNode.value=t)}}}nK.allowedChildren=[nV],nV.requiredContainer=nK,nV.allowedChildren=[nH,rU,rS,rO];let nW=(t,e,r)=>"string"==typeof t.versionString&&parseInt(t.versionString.split(".")[0],10)>=11?t.highlight(r,{language:e}).value:t.highlight(e,r).value;class nZ extends r3{static register(){iu.register(nH,!0),iu.register(nV,!0),iu.register(nK,!0)}constructor(t,e){if(super(t,e),null==this.options.hljs)throw 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:r}=e;return t[r]=!0,t},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(iu.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof nK))return;let e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(t=>{let{key:r,label:i}=t,n=e.ownerDocument.createElement("option");n.textContent=i,n.setAttribute("value",r),e.appendChild(n)}),e.addEventListener("change",()=>{t.format(nV.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),null==t.uiNode&&(t.attachUI(e),t.children.head&&(e.value=nV.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(iu.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(iu.sources.USER);let r=this.quill.getSelection();(null==t?this.quill.scroll.descendants(nK):[t]).forEach(t=>{t.highlight(this.highlightBlot,e)}),this.quill.update(iu.sources.SILENT),null!=r&&this.quill.setSelection(r,iu.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if("plain"===(e=this.languages[e]?e:"plain"))return rj(t).split("\n").reduce((t,r,i)=>(0!==i&&t.insert("\n",{[iI.blotName]:e}),t.insert(r)),new e_);let r=this.quill.root.ownerDocument.createElement("div");return r.classList.add(iI.className),r.innerHTML=nW(this.options.hljs,e,t),nd(this.quill.scroll,r,[(t,e)=>{let r=n$.value(t);return r?e.compose(new e_().retain(e.length(),{[nH.blotName]:r})):e}],[(t,r)=>t.data.split("\n").reduce((t,r,i)=>(0!==i&&t.insert("\n",{[iI.blotName]:e}),t.insert(r)),r)],new WeakMap)}}nZ.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 nG extends rI{static blotName="table";static tagName="TD";static create(t){let e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",nJ()),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===nG.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 nX extends ix{static blotName="table-row";static tagName="TR";checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){let t=this.children.head.formats(),e=this.children.tail.formats(),r=this.next.children.head.formats(),i=this.next.children.tail.formats();return t.table===e.table&&t.table===r.table&&t.table===i.table}return!1}optimize(t){super.optimize(t),this.children.forEach(t=>{if(null==t.next)return;let e=t.formats(),r=t.next.formats();if(e.table!==r.table){let 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 nY extends ix{static blotName="table-body";static tagName="TBODY"}class nQ extends ix{static blotName="table-container";static tagName="TABLE";balanceCells(){let t=this.descendants(nX),e=t.reduce((t,e)=>Math.max(e.children.length,t),0);t.forEach(t=>{Array(e-t.children.length).fill(0).forEach(()=>{let e;null!=t.children.head&&(e=nG.formats(t.children.head.domNode));let r=this.scroll.create(nG.blotName,e);t.appendChild(r),r.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){let[e]=this.descendant(nY);null!=e&&null!=e.children.head&&e.children.forEach(e=>{let r=e.children.at(t);null!=r&&r.remove()})}insertColumn(t){let[e]=this.descendant(nY);null!=e&&null!=e.children.head&&e.children.forEach(e=>{let r=e.children.at(t),i=nG.formats(e.children.head.domNode),n=this.scroll.create(nG.blotName,i);e.insertBefore(n,r)})}insertRow(t){let[e]=this.descendant(nY);if(null==e||null==e.children.head)return;let r=nJ(),i=this.scroll.create(nX.blotName);e.children.head.children.forEach(()=>{let t=this.scroll.create(nG.blotName,r);i.appendChild(t)});let n=e.children.at(t);e.insertBefore(i,n)}rows(){let t=this.children.head;return null==t?[]:t.children.map(t=>t)}}function nJ(){let t=Math.random().toString(36).slice(2,6);return`row-${t}`}nQ.allowedChildren=[nY],nY.requiredContainer=nQ,nY.allowedChildren=[nX],nX.requiredContainer=nY,nX.allowedChildren=[nG],nG.requiredContainer=nX;class n1 extends r3{static register(){iu.register(nG),iu.register(nX),iu.register(nY),iu.register(nQ)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(nQ).forEach(t=>{t.balanceCells()})}deleteColumn(){let[t,,e]=this.getTable();null!=e&&(t.deleteColumn(e.cellOffset()),this.quill.update(iu.sources.USER))}deleteRow(){let[,t]=this.getTable();null!=t&&(t.remove(),this.quill.update(iu.sources.USER))}deleteTable(){let[t]=this.getTable();if(null==t)return;let e=t.offset();t.remove(),this.quill.update(iu.sources.USER),this.quill.setSelection(e,iu.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];let[e,r]=this.quill.getLine(t.index);if(null==e||e.statics.blotName!==nG.blotName)return[null,null,null,-1];let i=e.parent;return[i.parent.parent,i,e,r]}insertColumn(t){let e=this.quill.getSelection();if(!e)return;let[r,i,n]=this.getTable(e);if(null==n)return;let s=n.cellOffset();r.insertColumn(s+t),this.quill.update(iu.sources.USER);let l=i.rowOffset();0===t&&(l+=1),this.quill.setSelection(e.index+l,e.length,iu.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){let e=this.quill.getSelection();if(!e)return;let[r,i,n]=this.getTable(e);if(null==n)return;let s=i.rowOffset();r.insertRow(s+t),this.quill.update(iu.sources.USER),t>0?this.quill.setSelection(e,iu.sources.SILENT):this.quill.setSelection(e.index+i.children.length,e.length,iu.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){let r=this.quill.getSelection();if(null==r)return;let i=Array(t).fill(0).reduce(t=>{let r=Array(e).fill("\n").join("");return t.insert(r,{table:nJ()})},new e_().retain(r.index));this.quill.updateContents(i,iu.sources.USER),this.quill.setSelection(r.index,iu.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(iu.events.SCROLL_OPTIMIZE,t=>{t.some(t=>!!["TD","TR","TBODY","TABLE"].includes(t.target.tagName)&&(this.quill.once(iu.events.TEXT_CHANGE,(t,e,r)=>{r===iu.sources.USER&&this.balanceTables()}),!0))})}}let n0=rV("quill:toolbar");class n2 extends r3{constructor(t,e){if(super(t,e),Array.isArray(this.options.container)){let e=document.createElement("div");e.setAttribute("role","toolbar"),function(t,e){Array.isArray(e[0])||(e=[e]),e.forEach(e=>{let r=document.createElement("span");r.classList.add("ql-formats"),e.forEach(t=>{if("string"==typeof t)n5(r,t);else{let e=Object.keys(t)[0],i=t[e];Array.isArray(i)?function(t,e,r){let i=document.createElement("select");i.classList.add(`ql-${e}`),r.forEach(t=>{let e=document.createElement("option");!1!==t?e.setAttribute("value",String(t)):e.setAttribute("selected","selected"),i.appendChild(e)}),t.appendChild(i)}(r,e,i):n5(r,e,i)}}),t.appendChild(r)})}(e,this.options.container),t.container?.parentNode?.insertBefore(e,t.container),this.container=e}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;if(!(this.container instanceof HTMLElement))return void n0.error("Container required for toolbar",this.options);this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(t=>{let 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(iu.events.EDITOR_CHANGE,()=>{let[t]=this.quill.selection.getRange();this.update(t)})}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 n0.warn("ignoring attaching to nonexistent format",e,t);let r="SELECT"===t.tagName?"change":"click";t.addEventListener(r,r=>{let i;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;let e=t.options[t.selectedIndex];i=!e.hasAttribute("selected")&&(e.value||!1)}else i=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),r.preventDefault();this.quill.focus();let[n]=this.quill.selection.getRange();if(null!=this.handlers[e])this.handlers[e].call(this,i);else if(this.quill.scroll.query(e).prototype instanceof eN){if(!(i=prompt(`Enter ${e}`)))return;this.quill.updateContents(new e_().retain(n.index).delete(n.length).insert({[e]:i}),iu.sources.USER)}else this.quill.format(e,i,iu.sources.USER);this.update(n)}),this.controls.push([e,t])}update(t){let e=null==t?{}:this.quill.getFormat(t);this.controls.forEach(r=>{let[i,n]=r;if("SELECT"===n.tagName){let r=null;if(null==t)r=null;else if(null==e[i])r=n.querySelector("option[selected]");else if(!Array.isArray(e[i])){let t=e[i];"string"==typeof t&&(t=t.replace(/"/g,'\\"')),r=n.querySelector(`option[value="${t}"]`)}null==r?(n.value="",n.selectedIndex=-1):r.selected=!0}else if(null==t)n.classList.remove("ql-active"),n.setAttribute("aria-pressed","false");else if(n.hasAttribute("value")){let t=e[i],r=t===n.getAttribute("value")||null!=t&&t.toString()===n.getAttribute("value")||null==t&&!n.getAttribute("value");n.classList.toggle("ql-active",r),n.setAttribute("aria-pressed",r.toString())}else{let t=null!=e[i];n.classList.toggle("ql-active",t),n.setAttribute("aria-pressed",t.toString())}})}}function n5(t,e,r){let i=document.createElement("button");i.setAttribute("type","button"),i.classList.add(`ql-${e}`),i.setAttribute("aria-pressed","false"),null!=r?(i.value=r,i.setAttribute("aria-label",`${e}: ${r}`)):i.setAttribute("aria-label",e),t.appendChild(i)}n2.DEFAULTS={},n2.DEFAULTS={container:null,handlers:{clean(){let t=this.quill.getSelection();null!=t&&(0===t.length?Object.keys(this.quill.getFormat()).forEach(t=>{null!=this.quill.scroll.query(t,t5.INLINE)&&this.quill.format(t,!1,iu.sources.USER)}):this.quill.removeFormat(t.index,t.length,iu.sources.USER))},direction(t){let{align:e}=this.quill.getFormat();"rtl"===t&&null==e?this.quill.format("align","right",iu.sources.USER):t||"right"!==e||this.quill.format("align",!1,iu.sources.USER),this.quill.format("direction",t,iu.sources.USER)},indent(t){let e=this.quill.getSelection(),r=this.quill.getFormat(e),i=parseInt(r.indent||0,10);if("+1"===t||"-1"===t){let e="+1"===t?1:-1;"rtl"===r.direction&&(e*=-1),this.quill.format("indent",i+e,iu.sources.USER)}},link(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,iu.sources.USER)},list(t){let e=this.quill.getSelection(),r=this.quill.getFormat(e);"check"===t?"checked"===r.list||"unchecked"===r.list?this.quill.format("list",!1,iu.sources.USER):this.quill.format("list","unchecked",iu.sources.USER):this.quill.format("list",t,iu.sources.USER)}}};let n4='',n3={align:{"":'',center:'',right:'',justify:''},background:'',blockquote:'',bold:'',clean:'',code:n4,"code-block":n4,color:'',direction:{"":'',rtl:''},formula:'',header:{1:'',2:'',3:'',4:'',5:'',6:''},italic:'',image:'',indent:{"+1":'',"-1":''},link:'',list:{bullet:'',check:'',ordered:''},script:{sub:'',super:''},strike:'',table:'',underline:'',video:''},n6=0;function n8(t,e){t.setAttribute(e,`${"true"!==t.getAttribute(e)}`)}class n9{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"),n8(this.label,"aria-expanded"),n8(this.options,"aria-hidden")}buildItem(t){let e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");let r=t.getAttribute("value");return r&&e.setAttribute("data-value",r),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(){let t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML='',t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){let t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${n6}`,n6+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{let r=this.buildItem(e);t.appendChild(r),!0===e.selected&&this.selectItem(r)}),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],r=this.container.querySelector(".ql-selected");t!==r&&(null!=r&&r.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){let 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);let e=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}let n7=n9;class st extends n7{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){let e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);let r=this.label.querySelector(".ql-color-label"),i=t&&t.getAttribute("data-value")||"";r&&("line"===r.tagName?r.style.stroke=i:r.style.fill=i)}}class se extends n7{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);let r=t||this.defaultItem;if(null!=r){if(this.label.innerHTML===r.innerHTML)return;this.label.innerHTML=r.innerHTML}}}let sr=t=>{let{overflowY:e}=getComputedStyle(t,null);return"visible"!==e&&"clip"!==e};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,sr(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){let e=t.left+t.width/2-this.root.offsetWidth/2,r=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${r}px`,this.root.classList.remove("ql-flip");let i=this.boundsContainer.getBoundingClientRect(),n=this.root.getBoundingClientRect(),s=0;if(n.right>i.right&&(s=i.right-n.right,this.root.style.left=`${e+s}px`),n.lefti.bottom){let e=n.bottom-n.top,i=t.bottom-t.top+e;this.root.style.top=`${r-i}px`,this.root.classList.add("ql-flip")}return s}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}let sn=si,ss=[!1,"center","right","justify"],sl=["#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"],so=[!1,"serif","monospace"],sa=["1","2","3",!1],sc=["small",!1,"large","huge"];class sh extends it{constructor(t,e){super(t,e);let r=e=>{if(!document.body.contains(t.root))return void document.body.removeEventListener("click",r);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()})};t.emitter.listenDOM("click",document.body,r)}addModule(t){let 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(r=>{if(r.startsWith("ql-")&&null!=e[r=r.slice(3)])if("direction"===r)t.innerHTML=e[r][""]+e[r].rtl;else if("string"==typeof e[r])t.innerHTML=e[r];else{let i=t.value||"";null!=i&&e[r][i]&&(t.innerHTML=e[r][i])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(t=>{if(t.classList.contains("ql-align")&&(null==t.querySelector("option")&&sd(t,ss),"object"==typeof e.align))return new se(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){let r=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&sd(t,sl,"background"===r?"#ffffff":"#000000"),new st(t,e[r])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?sd(t,so):t.classList.contains("ql-header")?sd(t,sa):t.classList.contains("ql-size")&&sd(t,sc)),new n7(t)}),this.quill.on(rW.events.EDITOR_CHANGE,()=>{this.pickers.forEach(t=>{t.update()})})}}sh.DEFAULTS=t2({},it.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")).setAttribute("type","file"),t.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),t.classList.add("ql-image"),t.addEventListener("change",()=>{let 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 su extends sn{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="");let r=this.quill.getBounds(this.quill.selection.savedRange);null!=r&&this.position(r),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":{let{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,rW.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,rW.sources.USER)),this.quill.root.scrollTop=e;break}case"video":var e;let r;t=(r=(e=t).match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/))?`${r[1]||"https"}://www.youtube.com/embed/${r[2]}?showinfo=0`:(r=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${r[1]||"https"}://player.vimeo.com/video/${r[2]}/`:e;case"formula":{if(!t)break;let e=this.quill.getSelection(!0);if(null!=e){let r=e.index+e.length;this.quill.insertEmbed(r,this.root.getAttribute("data-mode"),t,rW.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(r+1," ",rW.sources.USER),this.quill.setSelection(r+2,rW.sources.USER)}}}this.textbox.value="",this.hide()}}function sd(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(e=>{let i=document.createElement("option");e===r?i.setAttribute("selected","selected"):i.setAttribute("value",String(e)),t.appendChild(i)})}let sf=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class sp extends su{static TEMPLATE='';constructor(t,e){super(t,e),this.quill.on(rW.events.EDITOR_CHANGE,(t,e,r,i)=>{if(t===rW.events.SELECTION_CHANGE)if(null!=e&&e.length>0&&i===rW.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;let t=this.quill.getLines(e.index,e.length);if(1===t.length){let t=this.quill.getBounds(e);null!=t&&this.position(t)}else{let r=t[t.length-1],i=this.quill.getIndex(r),n=Math.min(r.length()-1,e.index+e.length-i),s=this.quill.getBounds(new rG(i,n));null!=s&&this.position(s)}}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(rW.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;let t=this.quill.getSelection();if(null!=t){let e=this.quill.getBounds(t);null!=e&&this.position(e)}},1)})}cancel(){this.show()}position(t){let e=super.position(t),r=this.root.querySelector(".ql-tooltip-arrow");return r.style.marginLeft="",0!==e&&(r.style.marginLeft=`${-1*e-r.offsetWidth/2}px`),e}}class sg extends sh{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=sf),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new sp(this.quill,this.options.bounds),null!=t.container&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),n3),this.buildPickers(t.container.querySelectorAll("select"),n3))}}sg.DEFAULTS=t2({},sh.DEFAULTS,{modules:{toolbar:{handlers:{link(t){t?this.quill.theme.tooltip.edit():this.quill.format("link",!1,iu.sources.USER)}}}}});let sm=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class sb extends su{static TEMPLATE='';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){let t=this.linkRange;this.restoreFocus(),this.quill.formatText(t,"link",!1,rW.sources.USER),delete this.linkRange}t.preventDefault(),this.hide()}),this.quill.on(rW.events.SELECTION_CHANGE,(t,e,r)=>{if(null!=t){if(0===t.length&&r===rW.sources.USER){let[e,r]=this.quill.scroll.descendant(nC,t.index);if(null!=e){this.linkRange=new rG(t.index-r,e.length());let i=nC.formats(e.domNode);this.preview.textContent=i,this.preview.setAttribute("href",i),this.show();let n=this.quill.getBounds(this.linkRange);null!=n&&this.position(n);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}class sy extends sh{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=sm),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"),n3),this.buildPickers(t.container.querySelectorAll("select"),n3),this.tooltip=new sb(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,r)=>{t.handlers.link.call(t,!r.format.link)}))}}sy.DEFAULTS=t2({},sh.DEFAULTS,{modules:{toolbar:{handlers:{link(t){if(t){let 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}`);let{tooltip:r}=this.quill.theme;r.edit("link",e)}else this.quill.format("link",!1,iu.sources.USER)}}}}}),iu.register({"attributors/attribute/direction":iD,"attributors/class/align":i_,"attributors/class/background":ij,"attributors/class/color":iS,"attributors/class/direction":iU,"attributors/class/font":iF,"attributors/class/size":iV,"attributors/style/align":iL,"attributors/style/background":iC,"attributors/style/color":iT,"attributors/style/direction":iP,"attributors/style/font":iH,"attributors/style/size":iK},!0),iu.register({"formats/align":i_,"formats/direction":iU,"formats/indent":nq,"formats/background":iC,"formats/color":iT,"formats/font":iF,"formats/size":iV,"formats/blockquote":nk,"formats/code-block":iI,"formats/header":n_,"formats/list":nO,"formats/bold":nT,"formats/code":iM,"formats/italic":nj,"formats/link":nC,"formats/script":nI,"formats/strike":nM,"formats/underline":nB,"formats/formula":nD,"formats/image":nP,"formats/video":nF,"modules/syntax":nZ,"modules/table":n1,"modules/toolbar":n2,"themes/bubble":sg,"themes/snow":sy,"ui/icons":n3,"ui/picker":n7,"ui/icon-picker":se,"ui/color-picker":st,"ui/tooltip":sn},!0);let sv=iu},90994:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),(r||(r={})).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},e.default=r}};