(self["webpackChunkcomplexes"]=self["webpackChunkcomplexes"]||[]).push([[243],{33529:function(t,e,n){"use strict";n(44114);var r=Object.prototype.hasOwnProperty,i="~";function s(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function l(t,e,n,r,s){if("function"!==typeof n)throw new TypeError("The listener must be a function");var l=new o(n,r||t,s),a=i?i+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],l]:t._events[a].push(l):(t._events[a]=l,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new s:delete t._events[e]}function c(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),c.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)r.call(t,e)&&n.push(i?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},c.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);re.length?t:e,c=t.length>e.length?e:t,u=l.indexOf(c);if(-1!==u)return n=[[i,l.substring(0,u)],[s,c],[i,l.substring(u+c.length)]],t.length>e.length&&(n[0][0]=n[2][0]=r),n;if(1===c.length)return[[r,t],[i,e]];var h=f(t,e);if(h){var d=h[0],p=h[1],g=h[2],m=h[3],b=h[4],v=o(d,g),y=o(p,m);return v.concat([[s,b]],y)}return a(t,e)}function a(t,e){for(var n=t.length,s=e.length,o=Math.ceil((n+s)/2),l=o,a=2*o,u=new Array(a),h=new Array(a),d=0;dn)m+=2;else if(w>s)g+=2;else if(p){var A=l+f-x;if(A>=0&&A=E)return c(t,e,_,w)}}}for(var q=-y+b;q<=y-v;q+=2){A=l+q;E=q===-y||q!==y&&h[A-1]n)v+=2;else if(k>s)b+=2;else if(!p){N=l+f-q;if(N>=0&&N=E)return c(t,e,_,w)}}}}return[[r,t],[i,e]]}function c(t,e,n,r){var i=t.substring(0,n),s=e.substring(0,r),l=t.substring(n),a=e.substring(r),c=o(i,s),u=o(l,a);return c.concat(u)}function u(t,e){if(!t||!e||t.charAt(0)!==e.charAt(0))return 0;var n=0,r=Math.min(t.length,e.length),i=r,s=0;while(nr?t=t.substring(n-r):ne.length?t:e,r=t.length>e.length?e:t;if(n.length<4||2*r.length=t.length?[r,i,s,o,c]:null}var s,o,l,a,c,h=i(n,r,Math.ceil(n.length/4)),f=i(n,r,Math.ceil(n.length/2));if(!h&&!f)return null;s=f?h&&h[4].length>f[4].length?h:f:h,t.length>e.length?(o=s[0],l=s[1],a=s[2],c=s[3]):(a=s[0],c=s[1],o=s[2],l=s[3]);var p=s[4];return[o,l,a,c,p]}function p(t){var e=!1,n=[],o=0,l=null,a=0,c=0,u=0,d=0,f=0;while(a0?n[o-1]:-1,c=0,u=0,d=0,f=0,l=null,e=!0)),a++;e&&N(t),x(t),a=1;while(a=b?(m>=p.length/2||m>=g.length/2)&&(t.splice(a,0,[s,g.substring(0,m)]),t[a-1][1]=p.substring(0,p.length-m),t[a+1][1]=g.substring(m),a++):(b>=p.length/2||b>=g.length/2)&&(t.splice(a,0,[s,p.substring(0,b)]),t[a-1][0]=i,t[a-1][1]=g.substring(0,g.length-b),t[a+1][0]=r,t[a+1][1]=p.substring(b),a++),a++}a++}}var g=/[^a-zA-Z0-9]/,m=/\s/,b=/[\r\n]/,v=/\n\r?\n$/,y=/^\r?\n\r?\n/;function x(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.charAt(0),i=n.match(g),s=r.match(g),o=i&&n.match(m),l=s&&r.match(m),a=o&&n.match(b),c=l&&r.match(b),u=a&&t.match(v),h=c&&e.match(y);return u||h?5:a||c?4:i&&!o&&l?3:o||l?2:i||s?1:0}var n=1;while(n=f&&(f=p,c=r,u=i,h=o)}t[n-1][1]!=c&&(c?t[n-1][1]=c:(t.splice(n-1,1),n--),t[n][1]=u,h?t[n+1][1]=h:(t.splice(n+1,1),n--))}n++}}function N(t,e){t.push([s,""]);var n,o=0,l=0,a=0,c="",h="";while(o=0&&q(t[f][1])){var p=t[f][1].slice(-1);if(t[f][1]=t[f][1].slice(0,-1),c=p+c,h=p+h,!t[f][1]){t.splice(f,1),o--;var g=f-1;t[g]&&t[g][0]===i&&(a++,h=t[g][1]+h,g--),t[g]&&t[g][0]===r&&(l++,c=t[g][1]+c,g--),f=g}}if(E(t[o][1])){p=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=p,h+=p}}if(o0||h.length>0){c.length>0&&h.length>0&&(n=u(h,c),0!==n&&(f>=0?t[f][1]+=h.substring(0,n):(t.splice(0,0,[s,h.substring(0,n)]),o++),h=h.substring(n),c=c.substring(n)),n=d(h,c),0!==n&&(t[o][1]=h.substring(h.length-n)+t[o][1],h=h.substring(0,h.length-n),c=c.substring(0,c.length-n)));var m=a+l;0===c.length&&0===h.length?(t.splice(o-m,m),o-=m):0===c.length?(t.splice(o-m,m,[i,h]),o=o-m+1):0===h.length?(t.splice(o-m,m,[r,c]),o=o-m+1):(t.splice(o-m,m,[r,c],[i,h]),o=o-m+2)}0!==o&&t[o-1][0]===s?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",h="";break}""===t[t.length-1][1]&&t.pop();var b=!1;o=1;while(o=55296&&t<=56319}function A(t){return t>=56320&&t<=57343}function E(t){return A(t.charCodeAt(0))}function q(t){return w(t.charCodeAt(t.length-1))}function k(t){for(var e=[],n=0;n0&&e.push(t[n]);return e}function _(t,e,n,o){return q(t)||E(o)?null:k([[s,t],[r,e],[i,n],[s,o]])}function L(t,e,n){var r="number"===typeof n?{index:n,length:0}:n.oldRange,i="number"===typeof n?null:n.newRange,s=t.length,o=e.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=t.slice(0,l),c=t.slice(l),u=i?i.index:null,h=l+o-s;if((null===u||u===h)&&!(h<0||h>o)){var d=e.slice(0,h),f=e.slice(h);if(f===c){var p=Math.min(l,h),g=a.slice(0,p),m=d.slice(0,p);if(g===m){var b=a.slice(p),v=d.slice(p);return _(g,b,v,c)}}}if(null===u||u===l){var y=l;d=e.slice(0,y),f=e.slice(y);if(d===a){var x=Math.min(s-y,o-y),N=c.slice(c.length-x),w=f.slice(f.length-x);if(N===w){b=c.slice(0,c.length-x),v=f.slice(0,f.length-x);return _(a,b,v,N)}}}}if(r.length>0&&i&&0===i.length){g=t.slice(0,r.index),N=t.slice(r.index+r.length),p=g.length,x=N.length;if(!(o-1}function $t(t,e){var n=this.__data__,r=se(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}function Vt(t){var e=-1,n=t?t.length:0;this.clear();while(++e-1&&t%1==0&&t-1&&t%1==0&&t<=s}function Ke(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function We(t){return!!t&&"object"==typeof t}function Ze(t){return ze(t)?re(t):de(t)}function Ge(){return[]}function Xe(){return!1}t.exports=Be},31029:function(t,e,n){t=n.nmd(t),n(44114),n(16573),n(78100),n(77936);var r=200,i="__lodash_hash_undefined__",s=1,o=2,l=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",h="[object Boolean]",d="[object Date]",f="[object Error]",p="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",v="[object Null]",y="[object Object]",x="[object Promise]",N="[object Proxy]",w="[object RegExp]",A="[object Set]",E="[object String]",q="[object Symbol]",k="[object Undefined]",_="[object WeakMap]",L="[object ArrayBuffer]",O="[object DataView]",S="[object Float32Array]",T="[object Float64Array]",j="[object Int8Array]",C="[object Int16Array]",R="[object Int32Array]",I="[object Uint8Array]",M="[object Uint8ClampedArray]",B="[object Uint16Array]",D="[object Uint32Array]",U=/[\\^$.*+?()[\]{}|]/g,P=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,F={};F[S]=F[T]=F[j]=F[C]=F[R]=F[I]=F[M]=F[B]=F[D]=!0,F[a]=F[c]=F[L]=F[h]=F[O]=F[d]=F[f]=F[p]=F[m]=F[b]=F[y]=F[w]=F[A]=F[E]=F[_]=!1;var H="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,$="object"==typeof self&&self&&self.Object===Object&&self,V=H||$||Function("return this")(),K=e&&!e.nodeType&&e,W=K&&t&&!t.nodeType&&t,Z=W&&W.exports===K,G=Z&&H.process,X=function(){try{return G&&G.binding&&G.binding("util")}catch(t){}}(),Y=X&&X.isTypedArray;function Q(t,e){var n=-1,r=null==t?0:t.length,i=0,s=[];while(++n-1}function Xt(t,e){var n=this.__data__,r=fe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Yt(t){var e=-1,n=null==t?0:t.length;this.clear();while(++ec))return!1;var h=l.get(t);if(h&&l.get(e))return h==e;var d=-1,f=!0,p=n&o?new re:void 0;l.set(t,e),l.set(e,t);while(++d-1&&t%1==0&&t-1&&t%1==0&&t<=l}function Ve(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ke(t){return null!=t&&"object"==typeof t}var We=Y?nt(Y):xe;function Ze(t){return Pe(t)?de(t):Ne(t)}function Ge(){return[]}function Xe(){return!1}t.exports=Fe},52259:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(41314),i=n(31029);var s;(function(t){function e(t={},e={},n=!1){"object"!==typeof t&&(t={}),"object"!==typeof e&&(e={});let i=r(e);n||(i=Object.keys(i).reduce(((t,e)=>(null!=i[e]&&(t[e]=i[e]),t)),{}));for(const r in t)void 0!==t[r]&&void 0===e[r]&&(i[r]=t[r]);return Object.keys(i).length>0?i:void 0}function n(t={},e={}){"object"!==typeof t&&(t={}),"object"!==typeof e&&(e={});const n=Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(i(t[r],e[r])||(n[r]=void 0===e[r]?null:e[r]),n)),{});return Object.keys(n).length>0?n:void 0}function s(t={},e={}){t=t||{};const n=Object.keys(e).reduce(((n,r)=>(e[r]!==t[r]&&void 0!==t[r]&&(n[r]=e[r]),n)),{});return Object.keys(t).reduce(((n,r)=>(t[r]!==e[r]&&void 0===e[r]&&(n[r]=null),n)),n)}function o(t,e,n=!1){if("object"!==typeof t)return e;if("object"!==typeof e)return;if(!n)return e;const r=Object.keys(e).reduce(((n,r)=>(void 0===t[r]&&(n[r]=e[r]),n)),{});return Object.keys(r).length>0?r:void 0}t.compose=e,t.diff=n,t.invert=s,t.transform=o})(s||(s={})),e["default"]=s},86055:function(t,e,n){"use strict";n(44114),Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.Op=void 0;const r=n(32213),i=n(41314),s=n(31029),o=n(52259);e.AttributeMap=o.default;const l=n(54738);e.Op=l.default;const a=n(40312);e.OpIterator=a.default;const c=String.fromCharCode(0),u=(t,e)=>{if("object"!==typeof t||null===t)throw new Error("cannot retain a "+typeof t);if("object"!==typeof e||null===e)throw new Error("cannot retain a "+typeof e);const n=Object.keys(t)[0];if(!n||n!==Object.keys(e)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(e)[0]}`);return[n,t[n],e[n]]};class 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){const e=this.handlers[t];if(!e)throw new Error(`no handlers for embed type "${t}"`);return e}insert(t,e){const n={};return"string"===typeof t&&0===t.length?this:(n.insert=t,null!=e&&"object"===typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))}delete(t){return t<=0?this:this.push({delete:t})}retain(t,e){if("number"===typeof t&&t<=0)return this;const n={retain:t};return null!=e&&"object"===typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)}push(t){let e=this.ops.length,n=this.ops[e-1];if(t=i(t),"object"===typeof n){if("number"===typeof t.delete&&"number"===typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"===typeof n.delete&&null!=t.insert&&(e-=1,n=this.ops[e-1],"object"!==typeof n))return this.ops.unshift(t),this;if(s(t.attributes,n.attributes)){if("string"===typeof t.insert&&"string"===typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"===typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"===typeof t.retain&&"number"===typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"===typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this}chop(){const t=this.ops[this.ops.length-1];return t&&"number"===typeof t.retain&&!t.attributes&&this.ops.pop(),this}filter(t){return this.ops.filter(t)}forEach(t){this.ops.forEach(t)}map(t){return this.ops.map(t)}partition(t){const e=[],n=[];return this.forEach((r=>{const i=t(r)?e:n;i.push(r)})),[e,n]}reduce(t,e){return this.ops.reduce(t,e)}changeLength(){return this.reduce(((t,e)=>e.insert?t+l.default.length(e):e.delete?t-e.delete:t),0)}length(){return this.reduce(((t,e)=>t+l.default.length(e)),0)}slice(t=0,e=1/0){const n=[],r=new a.default(this.ops);let i=0;while(i0&&n.next(i.retain-t)}const l=new h(r);while(e.hasNext()||n.hasNext())if("insert"===n.peekType())l.push(n.next());else if("delete"===e.peekType())l.push(e.next());else{const t=Math.min(e.peekLength(),n.peekLength()),r=e.next(t),i=n.next(t);if(i.retain){const a={};if("number"===typeof r.retain)a.retain="number"===typeof i.retain?t:i.retain;else if("number"===typeof i.retain)null==r.retain?a.insert=r.insert:a.retain=r.retain;else{const t=null==r.retain?"insert":"retain",[e,n,s]=u(r[t],i.retain),o=h.getHandler(e);a[t]={[e]:o.compose(n,s,"retain"===t)}}const c=o.default.compose(r.attributes,i.attributes,"number"===typeof r.retain);if(c&&(a.attributes=c),l.push(a),!n.hasNext()&&s(l.ops[l.ops.length-1],a)){const t=new h(e.rest());return l.concat(t).chop()}}else"number"===typeof i.delete&&("number"===typeof r.retain||"object"===typeof r.retain&&null!==r.retain)&&l.push(i)}return l.chop()}concat(t){const 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;const n=[this,t].map((e=>e.map((n=>{if(null!=n.insert)return"string"===typeof n.insert?n.insert:c;const r=e===t?"on":"with";throw new Error("diff() called "+r+" non-document")})).join(""))),i=new h,l=r(n[0],n[1],e,!0),u=new a.default(this.ops),d=new a.default(t.ops);return l.forEach((t=>{let e=t[1].length;while(e>0){let n=0;switch(t[0]){case r.INSERT:n=Math.min(d.peekLength(),e),i.push(d.next(n));break;case r.DELETE:n=Math.min(e,u.peekLength()),u.next(n),i.delete(n);break;case r.EQUAL:n=Math.min(u.peekLength(),d.peekLength(),e);const t=u.next(n),l=d.next(n);s(t.insert,l.insert)?i.retain(n,o.default.diff(t.attributes,l.attributes)):i.push(l).delete(n);break}e-=n}})),i.chop()}eachLine(t,e="\n"){const n=new a.default(this.ops);let r=new h,i=0;while(n.hasNext()){if("insert"!==n.peekType())return;const s=n.peek(),o=l.default.length(s)-n.peekLength(),a="string"===typeof s.insert?s.insert.indexOf(e,o)-o:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===t(r,n.next(1).attributes||{},i))return;i+=1,r=new h}}r.length()>0&&t(r,{},i)}invert(t){const e=new h;return this.reduce(((n,r)=>{if(r.insert)e.delete(l.default.length(r));else{if("number"===typeof r.retain&&null==r.attributes)return e.retain(r.retain),n+r.retain;if(r.delete||"number"===typeof r.retain){const i=r.delete||r.retain,s=t.slice(n,n+i);return s.forEach((t=>{r.delete?e.push(t):r.retain&&r.attributes&&e.retain(l.default.length(t),o.default.invert(r.attributes,t.attributes))})),n+i}if("object"===typeof r.retain&&null!==r.retain){const i=t.slice(n,n+1),s=new a.default(i.ops).next(),[l,c,d]=u(r.retain,s.insert),f=h.getHandler(l);return e.retain({[l]:f.invert(c,d)},o.default.invert(r.attributes,s.attributes)),n+1}}return n}),0),e.chop()}transform(t,e=!1){if(e=!!e,"number"===typeof t)return this.transformPosition(t,e);const n=t,r=new a.default(this.ops),i=new a.default(n.ops),s=new h;while(r.hasNext()||i.hasNext())if("insert"!==r.peekType()||!e&&"insert"===i.peekType())if("insert"===i.peekType())s.push(i.next());else{const t=Math.min(r.peekLength(),i.peekLength()),n=r.next(t),l=i.next(t);if(n.delete)continue;if(l.delete)s.push(l);else{const r=n.retain,i=l.retain;let a="object"===typeof i&&null!==i?i:t;if("object"===typeof r&&null!==r&&"object"===typeof i&&null!==i){const t=Object.keys(r)[0];if(t===Object.keys(i)[0]){const n=h.getHandler(t);n&&(a={[t]:n.transform(r[t],i[t],e)})}}s.retain(a,o.default.transform(n.attributes,l.attributes,e))}}else s.retain(l.default.length(r.next()));return s.chop()}transformPosition(t,e=!1){e=!!e;const n=new a.default(this.ops);let r=0;while(n.hasNext()&&r<=t){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r=i-n?(t=i-n,this.index+=1,this.offset=0):this.offset+=t,"number"===typeof e.delete)return{delete:t};{const r={};return e.attributes&&(r.attributes=e.attributes),"number"===typeof e.retain?r.retain=t:"object"===typeof e.retain&&null!==e.retain?r.retain=e.retain:"string"===typeof e.insert?r.insert=e.insert.substr(n,t):r.insert=e.insert,r}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?r.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?"number"===typeof t.delete?"delete":"number"===typeof t.retain||"object"===typeof t.retain&&null!==t.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const t=this.offset,e=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=t,this.index=e,[n].concat(r)}}return[]}}e["default"]=i},91114:function(t,e,n){"use strict";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function s(t){var e=i(t,"string");return"symbol"==r(e)?e:e+""}function o(t,e,n){return(e=s(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,{A:function(){return o}})},41243:function(t,e,n){"use strict";n.r(e),n.d(e,{Module:function(){return Mc},Parchment:function(){return r},Range:function(){return Nc},default:function(){return ep}});var r={};n.r(r),n.d(r,{Attributor:function(){return _i},AttributorStore:function(){return Di},BlockBlot:function(){return es},ClassAttributor:function(){return Ci},ContainerBlot:function(){return is},EmbedBlot:function(){return os},InlineBlot:function(){return Qi},LeafBlot:function(){return Hi},ParentBlot:function(){return Zi},Registry:function(){return Si},Scope:function(){return ki},ScrollBlot:function(){return hs},StyleAttributor:function(){return Mi},TextBlot:function(){return ps}});var i=n(91114);function s(){this.__data__=[],this.size=0}var o=s;function l(t,e){return t===e||t!==t&&e!==e}var a=l;function c(t,e){var n=t.length;while(n--)if(a(t[n][0],e))return n;return-1}var u=c,h=Array.prototype,d=h.splice;function f(t){var e=this.__data__,n=u(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():d.call(e,n,1),--this.size,!0}var p=f;function g(t){var e=this.__data__,n=u(e,t);return n<0?void 0:e[n][1]}var m=g;function b(t){return u(this.__data__,t)>-1}var v=b;n(44114);function y(t,e){var n=this.__data__,r=u(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var x=y;function N(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e-1&&t%1==0&&t<=pn}var mn=gn;function bn(t){return null!=t&&mn(t.length)&&!ot(t)}var vn=bn;function yn(t){return nn(t)&&vn(t)}var xn=yn;function Nn(){return!1}var wn=Nn,An="object"==typeof exports&&exports&&!exports.nodeType&&exports,En=An&&"object"==typeof module&&module&&!module.nodeType&&module,qn=En&&En.exports===An,kn=qn?I.Buffer:void 0,_n=kn?kn.isBuffer:void 0,Ln=_n||wn,On=Ln,Sn="[object Object]",Tn=Function.prototype,jn=Object.prototype,Cn=Tn.toString,Rn=jn.hasOwnProperty,In=Cn.call(Object);function Mn(t){if(!nn(t)||Q(t)!=Sn)return!1;var e=Ge(t);if(null===e)return!0;var n=Rn.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Cn.call(n)==In}var Bn=Mn,Dn="[object Arguments]",Un="[object Array]",Pn="[object Boolean]",zn="[object Date]",Fn="[object Error]",Hn="[object Function]",$n="[object Map]",Vn="[object Number]",Kn="[object Object]",Wn="[object RegExp]",Zn="[object Set]",Gn="[object String]",Xn="[object WeakMap]",Yn="[object ArrayBuffer]",Qn="[object DataView]",Jn="[object Float32Array]",tr="[object Float64Array]",er="[object Int8Array]",nr="[object Int16Array]",rr="[object Int32Array]",ir="[object Uint8Array]",sr="[object Uint8ClampedArray]",or="[object Uint16Array]",lr="[object Uint32Array]",ar={};function cr(t){return nn(t)&&mn(t.length)&&!!ar[Q(t)]}ar[Jn]=ar[tr]=ar[er]=ar[nr]=ar[rr]=ar[ir]=ar[sr]=ar[or]=ar[lr]=!0,ar[Dn]=ar[Un]=ar[Yn]=ar[Pn]=ar[Qn]=ar[zn]=ar[Fn]=ar[Hn]=ar[$n]=ar[Vn]=ar[Kn]=ar[Wn]=ar[Zn]=ar[Gn]=ar[Xn]=!1;var ur=cr;function hr(t){return function(e){return t(e)}}var dr=hr,fr="object"==typeof exports&&exports&&!exports.nodeType&&exports,pr=fr&&"object"==typeof module&&module&&!module.nodeType&&module,gr=pr&&pr.exports===fr,mr=gr&&j.process,br=function(){try{var t=pr&&pr.require&&pr.require("util").types;return t||mr&&mr.binding&&mr.binding("util")}catch(e){}}(),vr=br,yr=vr&&vr.isTypedArray,xr=yr?dr(yr):ur,Nr=xr;function wr(t,e){if(("constructor"!==e||"function"!==typeof t[e])&&"__proto__"!=e)return t[e]}var Ar=wr,Er=Object.prototype,qr=Er.hasOwnProperty;function kr(t,e,n){var r=t[e];qr.call(t,e)&&a(r,n)&&(void 0!==n||e in t)||Ne(t,e,n)}var _r=kr;function Lr(t,e,n,r){var i=!n;n||(n={});var s=-1,o=e.length;while(++s-1&&t%1==0&&t0){if(++e>=hi)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var gi=pi,mi=gi(ui),bi=mi;function vi(t,e){return bi(oi(t,e,ei),t+"")}var yi=vi;function xi(t,e,n){if(!tt(n))return!1;var r=typeof e;return!!("number"==r?vn(n)&&Ir(e,n.length):"string"==r&&e in n)&&a(n[e],t)}var Ni=xi;function wi(t){return yi((function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;s=t.length>3&&"function"==typeof s?(i--,s):void 0,o&&Ni(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);while(++r(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))(ki||{});class _i{constructor(t,e,n={}){this.attrName=t,this.keyName=e;const r=ki.TYPE&ki.ATTRIBUTE;this.scope=null!=n.scope?n.scope&ki.LEVEL|r:ki.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(t){return Array.from(t.attributes).map((t=>t.name))}add(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)}canAdd(t,e){return null==this.whitelist||("string"==typeof e?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1)}remove(t){t.removeAttribute(this.keyName)}value(t){const e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""}}class Li extends Error{constructor(t){t="[Parchment] "+t,super(t),this.message=t,this.name=this.constructor.name}}const Oi=class t{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(null==t)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let n=null;try{n=t.parentNode}catch{return null}return this.find(n,e)}return null}create(e,n,r){const i=this.query(n);if(null==i)throw new Li(`Unable to create ${n} blot`);const s=i,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:s.create(r),l=new s(e,o,r);return t.blots.set(l.domNode,l),l}find(e,n=!1){return t.find(e,n)}query(t,e=ki.ANY){let n;return"string"==typeof t?n=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof t?t&ki.LEVEL&ki.BLOCK?n=this.types.block:t&ki.LEVEL&ki.INLINE&&(n=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some((t=>(n=this.classes[t],!!n))),n=n||this.tags[t.tagName]),null==n?null:"scope"in n&&e&ki.LEVEL&n.scope&&e&ki.TYPE&n.scope?n:null}register(...t){return t.map((t=>{const e="blotName"in t,n="attrName"in t;if(!e&&!n)throw new Li("Invalid definition");if(e&&"abstract"===t.blotName)throw new Li("Cannot register abstract class");const r=e?t.blotName:n?t.attrName:void 0;return this.types[r]=t,n?"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}))}};Oi.blots=new WeakMap;let Si=Oi;function Ti(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter((t=>0===t.indexOf(`${e}-`)))}class ji extends _i{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){Ti(t,this.keyName).forEach((e=>{t.classList.remove(e)})),0===t.classList.length&&t.removeAttribute("class")}value(t){const e=(Ti(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}}const Ci=ji;function Ri(t){const e=t.split("-"),n=e.slice(1).map((t=>t[0].toUpperCase()+t.slice(1))).join("");return e[0]+n}class Ii extends _i{static keys(t){return(t.getAttribute("style")||"").split(";").map((t=>t.split(":")[0].trim()))}add(t,e){return!!this.canAdd(t,e)&&(t.style[Ri(this.keyName)]=e,!0)}remove(t){t.style[Ri(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[Ri(this.keyName)];return this.canAdd(t,e)?e:""}}const Mi=Ii;class Bi{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=Si.find(this.domNode);if(null==t)return;const e=_i.keys(this.domNode),n=Ci.keys(this.domNode),r=Mi.keys(this.domNode);e.concat(n).concat(r).forEach((e=>{const n=t.scroll.query(e,ki.ATTRIBUTE);n instanceof _i&&(this.attributes[n.attrName]=n)}))}copy(t){Object.keys(this.attributes).forEach((e=>{const n=this.attributes[e].value(this.domNode);t.format(e,n)}))}move(t){this.copy(t),Object.keys(this.attributes).forEach((t=>{this.attributes[t].remove(this.domNode)})),this.attributes={}}values(){return Object.keys(this.attributes).reduce(((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t)),{})}}const Di=Bi,Ui=class{constructor(t,e){this.scroll=t,this.domNode=e,Si.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(null==this.tagName)throw new Li("Blot definition missing tagName");let e,n;return Array.isArray(this.tagName)?("string"==typeof t?(n=t.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof t&&(n=t),e="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){null!=this.parent&&this.parent.removeChild(this),Si.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,n,r){const i=this.isolate(t,e);if(null!=this.scroll.query(n,ki.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,ki.ATTRIBUTE)){const t=this.scroll.create(this.statics.scope);i.wrap(t),t.format(n,r)}}insertAt(t,e,n){const r=null==n?this.scroll.create("text",e):this.scroll.create(e,n),i=this.split(t);this.parent.insertBefore(r,i||void 0)}isolate(t,e){const n=this.split(t);if(null==n)throw new Error("Attempt to isolate at end");return n.split(e),n}length(){return 1}offset(t=this.parent){return null==this.parent||this===t?0:this.parent.children.offset(this)+this.parent.offset(t)}optimize(t){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(t,e){return 0===t?this:this.next}update(t,e){}wrap(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Li(`Cannot wrap ${t}`);return n.appendChild(this),n}};Ui.blotName="abstract";let Pi=Ui;const zi=class extends Pi{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};zi.scope=ki.INLINE_BLOT;let Fi=zi;const Hi=Fi;class $i{constructor(){this.head=null,this.tail=null,this.length=0}append(...t){if(this.insertBefore(t[0],null),t.length>1){const e=t.slice(1);this.append(...e)}}at(t){const e=this.iterator();let n=e();for(;n&&t>0;)t-=1,n=e();return n}contains(t){const e=this.iterator();let n=e();for(;n;){if(n===t)return!0;n=e()}return!1}indexOf(t){const e=this.iterator();let n=e(),r=0;for(;n;){if(n===t)return r;r+=1,n=e()}return-1}insertBefore(t,e){null!=t&&(this.remove(t),t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)}offset(t){let e=0,n=this.head;for(;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1}remove(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)}iterator(t=this.head){return()=>{const e=t;return null!=t&&(t=t.next),e}}find(t,e=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(ts?n(l,t-s,Math.min(e,s+r-t)):n(l,0,Math.min(r,t+e-s)),s+=r,l=o()}}map(t){return this.reduce(((e,n)=>(e.push(t(n)),e)),[])}reduce(t,e){const n=this.iterator();let r=n();for(;r;)e=t(e,r),r=n();return e}}function Vi(t,e){const n=e.find(t);if(n)return n;try{return e.create(t)}catch{const n=e.create(ki.INLINE);return Array.from(t.childNodes).forEach((t=>{n.domNode.appendChild(t)})),t.parentNode&&t.parentNode.replaceChild(n.domNode,t),n.attach(),n}}const Ki=class t extends Pi{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 $i,Array.from(this.domNode.childNodes).filter((t=>t!==this.uiNode)).reverse().forEach((t=>{try{const e=Vi(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Li)return;throw e}}))}deleteAt(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,((t,e,n)=>{t.deleteAt(e,n)}))}descendant(e,n=0){const[r,i]=this.children.find(n);return null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e?[r,i]:r instanceof t?r.descendant(e,i):[null,-1]}descendants(e,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,((n,r,o)=>{(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&i.push(n),n instanceof t&&(i=i.concat(n.descendants(e,r,s))),s-=o})),i}detach(){this.children.forEach((t=>{t.detach()})),super.detach()}enforceAllowedChildren(){let e=!1;this.children.forEach((n=>{e||this.statics.allowedChildren.some((t=>n instanceof t))||(n.statics.scope===ki.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),e=!0):n instanceof t?n.unwrap():n.remove())}))}formatAt(t,e,n,r){this.children.forEachAt(t,e,((t,e,i)=>{t.formatAt(e,i,n,r)}))}insertAt(t,e,n){const[r,i]=this.children.find(t);if(r)r.insertAt(i,e,n);else{const t=null==n?this.scroll.create("text",e):this.scroll.create(e,n);this.appendChild(t)}}insertBefore(t,e){null!=t.parent&&t.parent.children.remove(t);let n=null;this.children.insertBefore(t,e||null),t.parent=this,null!=e&&(n=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(t.domNode,n),t.attach()}length(){return this.children.reduce(((t,e)=>t+e.length()),0)}moveChildren(t,e){this.children.forEach((n=>{t.insertBefore(n,e)}))}optimize(t){if(super.optimize(t),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove()}path(e,n=!1){const[r,i]=this.children.find(e,n),s=[[this,e]];return r instanceof t?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(t){this.children.remove(t)}replaceWith(e,n){const r="string"==typeof e?this.scroll.create(e,n):e;return r instanceof t&&this.moveChildren(r),super.replaceWith(r)}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(t,this.length(),((t,r,i)=>{const s=t.split(r,e);null!=s&&n.appendChild(s)})),n}splitAfter(t){const e=this.clone();for(;null!=t.next;)e.appendChild(t.next);return this.parent&&this.parent.insertBefore(e,this.next||void 0),e}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(t,e){const n=[],r=[];t.forEach((t=>{t.target===this.domNode&&"childList"===t.type&&(n.push(...t.addedNodes),r.push(...t.removedNodes))})),r.forEach((t=>{if(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const e=this.scroll.find(t);null!=e&&(null==e.domNode.parentNode||e.domNode.parentNode===this.domNode)&&e.detach()})),n.filter((t=>t.parentNode===this.domNode&&t!==this.uiNode)).sort(((t,e)=>t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1)).forEach((t=>{let e=null;null!=t.nextSibling&&(e=this.scroll.find(t.nextSibling));const n=Vi(t,this.scroll);(n.next!==e||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,e||void 0))})),this.enforceAllowedChildren()}};Ki.uiClass="";let Wi=Ki;const Zi=Wi;function Gi(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}const Xi=class t extends Zi{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new Di(this.domNode)}format(e,n){if(e!==this.statics.blotName||n){const t=this.scroll.query(e,ki.INLINE);if(null==t)return;t instanceof _i?this.attributes.attribute(t,n):n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n)}else this.children.forEach((e=>{e instanceof t||(e=e.wrap(t.blotName,!0)),this.attributes.copy(e)})),this.unwrap()}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.formats()[n]||this.scroll.query(n,ki.ATTRIBUTE)?this.isolate(t,e).format(n,r):super.formatAt(t,e,n,r)}optimize(e){super.optimize(e);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof t&&r.prev===this&&Gi(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some((t=>t.target===this.domNode&&"attributes"===t.type))&&this.attributes.build()}wrap(e,n){const r=super.wrap(e,n);return r instanceof t&&this.attributes.move(r),r}};Xi.allowedChildren=[Xi,Hi],Xi.blotName="inline",Xi.scope=ki.INLINE_BLOT,Xi.tagName="SPAN";let Yi=Xi;const Qi=Yi,Ji=class t extends Zi{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new Di(this.domNode)}format(e,n){const r=this.scroll.query(e,ki.BLOCK);null!=r&&(r instanceof _i?this.attributes.attribute(r,n):e!==this.statics.blotName||n?n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n):this.replaceWith(t.blotName))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.scroll.query(n,ki.BLOCK)?this.format(n,r):super.formatAt(t,e,n,r)}insertAt(t,e,n){if(null==n||null!=this.scroll.query(e,ki.INLINE))super.insertAt(t,e,n);else{const r=this.split(t);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const t=this.scroll.create(e,n);r.parent.insertBefore(t,r)}}}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some((t=>t.target===this.domNode&&"attributes"===t.type))&&this.attributes.build()}};Ji.blotName="block",Ji.scope=ki.BLOCK_BLOT,Ji.tagName="P",Ji.allowedChildren=[Qi,Ji,Hi];let ts=Ji;const es=ts,ns=class extends Zi{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.enforceAllowedChildren()}insertAt(t,e,n){super.insertAt(t,e,n),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};ns.blotName="container",ns.scope=ki.BLOCK_BLOT;let rs=ns;const is=rs;class ss extends Hi{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,n,r){0===t&&e===this.length()?this.format(n,r):super.formatAt(t,e,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}}const os=ss,ls={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},as=100,cs=class extends Zi{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,ls),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const n=this.registry.find(t,e);return n?n.scroll===this?n:e?this.find(n.scroll.domNode.parentNode,!0):null:null}query(t,e=ki.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),0===t&&e===this.length()?this.children.forEach((t=>{t.remove()})):super.deleteAt(t,e)}formatAt(t,e,n,r){this.update(),super.formatAt(t,e,n,r)}insertAt(t,e,n){this.update(),super.insertAt(t,e,n)}optimize(t=[],e={}){super.optimize(e);const n=e.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)t.push(r.pop());const i=(t,e=!0)=>{null==t||t===this||null!=t.domNode.parentNode&&(n.has(t.domNode)||n.set(t.domNode,[]),e&&i(t.parent))},s=t=>{n.has(t.domNode)&&(t instanceof Zi&&t.children.forEach(s),n.delete(t.domNode),t.optimize(e))};let o=t;for(let l=0;o.length>0;l+=1){if(l>=as)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach((t=>{const e=this.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(i(this.find(t.previousSibling,!1)),Array.from(t.addedNodes).forEach((t=>{const e=this.find(t,!1);i(e,!1),e instanceof Zi&&e.children.forEach((t=>{i(t,!1)}))}))):"attributes"===t.type&&i(e.prev)),i(e))})),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)t.push(r.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const n=new WeakMap;t.map((t=>{const e=this.find(t.target,!0);return null==e?null:n.has(e.domNode)?(n.get(e.domNode).push(t),null):(n.set(e.domNode,[t]),e)})).forEach((t=>{null!=t&&t!==this&&n.has(t.domNode)&&t.update(n.get(t.domNode)||[],e)})),e.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),e),this.optimize(t,e)}};cs.blotName="scroll",cs.defaultChild=es,cs.allowedChildren=[es,is],cs.scope=ki.BLOCK_BLOT,cs.tagName="DIV";let us=cs;const hs=us,ds=class t extends Hi{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,n){null==n?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,n)}length(){return this.text.length}optimize(e){super.optimize(e),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(t,e){t.some((t=>"characterData"===t.type&&t.target===this.domNode))&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};ds.blotName="text",ds.scope=ki.INLINE_BLOT;let fs=ds;const ps=fs;var gs=n(86055);function ms(t,e){var n=-1,r=null==t?0:t.length;while(++nl))return!1;var c=s.get(t),u=s.get(e);if(c&&u)return c==e&&u==t;var h=-1,d=!0,f=n&aa?new na:void 0;s.set(t,e),s.set(e,t);while(++h"']/g,(t=>{const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return e[t]}))}class tc extends Qi{static compare(t,e){const n=tc.order.indexOf(t),r=tc.order.indexOf(e);return n>=0||r>=0?n-r:t===e?0:t0){const t=this.parent.isolate(this.offset(),this.length());this.moveChildren(t),t.wrap(this)}}}Xa=tc,(0,i.A)(tc,"allowedChildren",[Xa,Ya,os,Qa]),(0,i.A)(tc,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);var ec=tc;const nc=1;class rc extends es{constructor(...t){super(...t),(0,i.A)(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=sc(this)),this.cache.delta}deleteAt(t,e){super.deleteAt(t,e),this.cache={}}formatAt(t,e,n,r){e<=0||(this.scroll.query(n,ki.BLOCK)?t+e===this.length()&&this.format(n,r):super.formatAt(t,Math.min(e,this.length()-t-1),n,r),this.cache={})}insertAt(t,e,n){if(null!=n)return super.insertAt(t,e,n),void(this.cache={});if(0===e.length)return;const r=e.split("\n"),i=r.shift();i.length>0&&(t(s=s.split(t,!0),s.insertAt(0,e),e.length)),t+i.length)}insertBefore(t,e){const{head:n}=this.children;super.insertBefore(t,e),n instanceof Ya&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+nc),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()-nc)){const e=this.clone();return 0===t?(this.parent.insertBefore(e,this),this):(this.parent.insertBefore(e,this.next),e)}const n=super.split(t,e);return this.cache={},n}}rc.blotName="block",rc.tagName="P",rc.defaultChild=Ya,rc.allowedChildren=[Ya,ec,os,Qa];class ic extends os{attach(){super.attach(),this.attributes=new Di(this.domNode)}delta(){return(new gs).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const n=this.scroll.query(t,ki.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,e)}formatAt(t,e,n,r){this.format(n,r)}insertAt(t,e,n){if(null!=n)return void super.insertAt(t,e,n);const r=e.split("\n"),i=r.pop(),s=r.map((t=>{const e=this.scroll.create(rc.blotName);return e.insertAt(0,t),e})),o=this.split(t);s.forEach((t=>{this.parent.insertBefore(t,o)})),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function sc(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.descendants(Hi).reduce(((t,n)=>0===n.length()?t:t.insert(n.value(),oc(n,{},e))),new gs).insert("\n",oc(t))}function oc(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==t?e:("formats"in t&&"function"===typeof t.formats&&(e={...e,...t.formats()},n&&delete e["code-token"]),null==t.parent||"scroll"===t.parent.statics.blotName||t.parent.statics.scope!==t.statics.scope?e:oc(t.parent,e,n))}ic.scope=ki.BLOCK_BLOT;class lc extends os{static value(){}constructor(t,e,n){super(t,e),this.selection=n,this.textNode=document.createTextNode(lc.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,e){if(0!==this.savedLength)return void super.format(t,e);let n=this,r=0;while(null!=n&&n.statics.scope!==ki.BLOCK_BLOT)r+=n.offset(n.parent),n=n.parent;null!=n&&(this.savedLength=lc.CONTENTS.length,n.optimize(),n.formatAt(r,lc.CONTENTS.length,t,e),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();while(null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const e=this.prev instanceof Qa?this.prev:null,n=e?e.length():0,r=this.next instanceof Qa?this.next:null,i=r?r.text:"",{textNode:s}=this,o=s.data.split(lc.CONTENTS).join("");let l;if(s.data=lc.CONTENTS,e)l=e,(o||r)&&(e.insertAt(e.length(),o+i),r&&r.remove());else if(r)l=r,r.insertAt(0,o);else{const t=document.createTextNode(o);l=this.scroll.create(t),this.parent.insertBefore(l,this)}if(this.remove(),t){const i=(t,i)=>e&&t===e.domNode?i:t===s?n+i-1:r&&t===r.domNode?n+o.length+i:null,a=i(t.start.node,t.start.offset),c=i(t.end.node,t.end.offset);if(null!==a&&null!==c)return{startNode:l.domNode,startOffset:a,endNode:l.domNode,endOffset:c}}return null}update(t,e){if(t.some((t=>"characterData"===t.type&&t.target===this.textNode))){const t=this.restore();t&&(e.range=t)}}optimize(t){super.optimize(t);let{parent:e}=this;while(e){if("A"===e.domNode.tagName){this.savedLength=lc.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}}(0,i.A)(lc,"blotName","cursor"),(0,i.A)(lc,"className","ql-cursor"),(0,i.A)(lc,"tagName","span"),(0,i.A)(lc,"CONTENTS","\ufeff");var ac=lc,cc=n(33529),uc=new WeakMap;const hc=["error","warn","log","info"];let dc="warn";function fc(t){if(dc&&hc.indexOf(t)<=hc.indexOf(dc)){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r(e[n]=fc.bind(console,n,t),e)),{})}pc.level=t=>{dc=t},fc.level=pc.level;var gc=pc;const mc=gc("quill:events"),bc=["selectionchange","mousedown","mouseup","click"];bc.forEach((t=>{document.addEventListener(t,(function(){for(var t=arguments.length,e=new Array(t),n=0;n{const n=uc.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)}))}))}));class vc extends cc{constructor(){super(),this.domListeners={},this.on("error",mc.error)}emit(){for(var t=arguments.length,e=new Array(t),n=0;n1?e-1:0),r=1;r{let{node:r,handler:i}=e;(t.target===r||r.contains(t.target))&&i(t,...n)}))}listenDOM(t,e,n){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:n})}}(0,i.A)(vc,"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"}),(0,i.A)(vc,"sources",{API:"api",SILENT:"silent",USER:"user"});var yc=vc;const xc=gc("quill:selection");class Nc{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=t,this.length=e}}class wc{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 Nc(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,yc.sources.USER),1)})),this.emitter.on(yc.events.SCROLL_BEFORE_UPDATE,(()=>{if(!this.hasFocus())return;const t=this.getNativeRange();null!=t&&t.start.node!==this.cursor.textNode&&this.emitter.once(yc.events.SCROLL_UPDATE,((e,n)=>{try{this.root.contains(t.start.node)&&this.root.contains(t.end.node)&&this.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset);const r=n.some((t=>"characterData"===t.type||"childList"===t.type||"attributes"===t.type&&t.target===this.root));this.update(r?yc.sources.SILENT:e)}catch(r){}}))})),this.emitter.on(yc.events.SCROLL_OPTIMIZE,((t,e)=>{if(e.range){const{startNode:t,startOffset:n,endNode:r,endOffset:i}=e.range;this.setNativeRange(t,n,r,i),this.update(yc.sources.SILENT)}})),this.update(yc.sources.SILENT)}handleComposition(){this.emitter.on(yc.events.COMPOSITION_BEFORE_START,(()=>{this.composing=!0})),this.emitter.on(yc.events.COMPOSITION_END,(()=>{if(this.composing=!1,this.cursor.parent){const t=this.cursor.restore();if(!t)return;setTimeout((()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}),1)}}))}handleDragging(){this.emitter.listenDOM("mousedown",document.body,(()=>{this.mouseDown=!0})),this.emitter.listenDOM("mouseup",document.body,(()=>{this.mouseDown=!1,this.update(yc.sources.USER)}))}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(t,ki.BLOCK)){if(n.start.node!==this.cursor.textNode){const t=this.scroll.find(n.start.node,!1);if(null==t)return;if(t instanceof Hi){const e=t.split(n.start.offset);t.parent.insertBefore(this.cursor,e)}else t.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;let[i,s]=this.scroll.leaf(t);if(null==i)return null;if(e>0&&s===i.length()){const[e]=this.scroll.leaf(t+1);if(e){const[n]=this.scroll.line(t),[r]=this.scroll.line(t+1);n===r&&(i=e,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(e>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(t+e),null==i?null:([r,s]=i.position(s,!0),o.setEnd(r,s),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;s0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const t=document.getSelection();if(null==t||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(null==e)return null;const n=this.normalizeNative(e);return xc.info("getNativeRange",n),n}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();if(null==e)return[null,null];const n=this.normalizedToRange(e);return[n,e]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&Ac(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const n=e.map((t=>{const[e,n]=t,r=this.scroll.find(e,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof Hi?i+r.index(e,n):i+r.length()})),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new Nc(i,r-i)}normalizeNative(t){if(!Ac(this.root,t.startContainer)||!t.collapsed&&!Ac(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach((t=>{let{node:e,offset:n}=t;while(!(e instanceof Text)&&e.childNodes.length>0)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length>0?e.childNodes.length:e.childNodes.length+1}t.node=e,t.offset=n})),e}rangeToNative(t){const e=this.scroll.length(),n=(t,n)=>{t=Math.min(e-1,t);const[r,i]=this.scroll.leaf(t);return r?r.position(i,n):[null,-1]};return[...n(t.index,!1),...n(t.index+t.length,!0)]}setNativeRange(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(xc.info("setNativeRange",t,e,n,r),null!=t&&(null==this.root.parentNode||null==t.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=t){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||t!==o.startContainer||e!==o.startOffset||n!==o.endContainer||r!==o.endOffset){t instanceof Element&&"BR"===t.tagName&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(t,e),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yc.sources.API;if("string"===typeof e&&(n=e,e=!1),xc.info("setRange",t),null!=t){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(n)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yc.sources.USER;const e=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Za(e,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const t=this.cursor.restore();t&&this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}const n=[yc.events.SELECTION_CHANGE,Gl(this.lastRange),Gl(e),t];this.emitter.emit(yc.events.EDITOR_CHANGE,...n),t!==yc.sources.SILENT&&this.emitter.emit(...n)}}}function Ac(t,e){try{e.parentNode}catch(n){return!1}return t.contains(e)}var Ec=wc;const qc=/^[ -~]*$/;class kc{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const n=Tc(t),r=new gs,i=Cc(n.ops.slice());return i.reduce(((t,n)=>{const i=gs.Op.length(n);let s=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(i),"string"===typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(e<=t||!!this.scroll.descendant(ic,t)[0]),this.scroll.insertAt(t,r);const[i,o]=this.scroll.line(t);let a=qi({},oc(i));if(i instanceof rc){const[t]=i.descendant(Hi,o);t&&(a=qi(a,oc(t)))}s=gs.AttributeMap.diff(a,s)||{}}else if("object"===typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;const i=null!=this.scroll.query(r,ki.INLINE);if(i)(e<=t||this.scroll.descendant(ic,t)[0])&&(l=!0);else if(t>0){const[e,n]=this.scroll.descendant(Hi,t-1);if(e instanceof Qa){const t=e.value();"\n"!==t[n]&&(o=!0)}else e instanceof os&&e.statics.scope===ki.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(t,r,n.insert[r]),i){const[e]=this.scroll.descendant(Hi,t);if(e){const t=qi({},oc(e));s=gs.AttributeMap.diff(t,s)||{}}}}e+=i}else if(r.push(n),null!==n.retain&&"object"===typeof n.retain){const e=Object.keys(n.retain)[0];if(null==e)return t;this.scroll.updateEmbedAt(t,e,n.retain[e])}Object.keys(s).forEach((e=>{this.scroll.formatAt(t,i,e,s[e])}));const a=o?1:0,c=l?1:0;return e+=a+c,r.retain(a),r.delete(c),t+i+a+c}),0),r.reduce(((t,e)=>"number"===typeof e.delete?(this.scroll.deleteAt(t,e.delete),t):t+gs.Op.length(e)),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update((new gs).retain(t).delete(e))}formatLine(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach((r=>{this.scroll.lines(t,Math.max(e,1)).forEach((t=>{t.format(r,n[r])}))})),this.scroll.optimize();const r=(new gs).retain(t).retain(e,Gl(n));return this.update(r)}formatText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach((r=>{this.scroll.formatAt(t,e,r,n[r])}));const r=(new gs).retain(t).retain(e,Gl(n));return this.update(r)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce(((t,e)=>t.concat(e.delta())),new gs)}getFormat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach((t=>{const[e]=t;e instanceof rc?n.push(e):e instanceof Hi&&r.push(e)})):(n=this.scroll.lines(t,e),r=this.scroll.descendants(Hi,t,e));const[i,s]=[n,r].map((t=>{const e=t.shift();if(null==e)return{};let n=oc(e);while(Object.keys(n).length>0){const e=t.shift();if(null==e)return n;n=Oc(oc(e),n)}return n}));return{...i,...s}}getHTML(t,e){const[n,r]=this.scroll.line(t);if(n){const i=n.length(),s=n.length()>=r+e;return!s||0===r&&e===i?Lc(this.scroll,t,e,!0):Lc(n,r,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter((t=>"string"===typeof t.insert)).map((t=>t.insert)).join("")}insertContents(t,e){const n=Tc(e),r=(new gs).retain(t).concat(n);return this.scroll.insertContents(t,n),this.update(r)}insertEmbed(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new gs).retain(t).insert({[e]:n}))}insertText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach((r=>{this.scroll.formatAt(t,e.length,r,n[r])})),this.update((new gs).retain(t).insert(e,Gl(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if(t?.statics.blotName!==rc.blotName)return!1;const e=t;return!(e.children.length>1)&&e.children.head instanceof Ya}removeFormat(t,e){const n=this.getText(t,e),[r,i]=this.scroll.line(t+e);let s=0,o=new gs;null!=r&&(s=r.length()-i,o=r.delta().slice(i,i+s-1).insert("\n"));const l=this.getContents(t,e+s),a=l.diff((new gs).insert(n).concat(o)),c=(new gs).retain(t).concat(a);return this.applyDelta(c)}update(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===e.length&&"characterData"===e[0].type&&e[0].target.data.match(qc)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),s=oc(i),o=i.offset(this.scroll),l=e[0].oldValue.replace(ac.CONTENTS,""),a=(new gs).insert(l),c=(new gs).insert(i.value()),u=n&&{oldRange:jc(n.oldRange,-o),newRange:jc(n.newRange,-o)},h=(new gs).retain(o).concat(a.diff(c,u));t=h.reduce(((t,e)=>e.insert?t.insert(e.insert,s):t.push(e)),new gs),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&Za(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}function _c(t,e,n){if(0===t.length){const[t]=Sc(n.pop());return e<=0?``:`${_c([],e-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=t,[c,u]=Sc(l);if(o>e)return n.push(l),o===e+1?`<${c}>${Lc(r,i,s)}${_c(a,o,n)}`:`<${c}>
  • ${_c(t,e+1,n)}`;const h=n[n.length-1];if(o===e&&l===h)return`
  • ${Lc(r,i,s)}${_c(a,o,n)}`;const[d]=Sc(n.pop());return`${_c(t,e-1,n)}`}function Lc(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in t&&"function"===typeof t.html)return t.html(e,n);if(t instanceof Qa)return Ja(t.value().slice(e,e+n));if(t instanceof Zi){if("list-container"===t.statics.blotName){const r=[];return t.children.forEachAt(e,n,((t,e,n)=>{const i="formats"in t&&"function"===typeof t.formats?t.formats():{};r.push({child:t,offset:e,length:n,indent:i.indent||0,type:i.list})})),_c(r,-1,[])}const i=[];if(t.children.forEachAt(e,n,((t,e,n)=>{i.push(Lc(t,e,n))})),r||"list"===t.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=t.domNode,[l,a]=s.split(`>${o}<`);return"${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return t.domNode instanceof Element?t.domNode.outerHTML:""}function Oc(t,e){return Object.keys(e).reduce(((n,r)=>{if(null==t[r])return n;const i=e[r];return i===t[r]?n[r]=i:Array.isArray(i)?i.indexOf(t[r])<0?n[r]=i.concat([t[r]]):n[r]=i:n[r]=[i,t[r]],n}),{})}function Sc(t){const e="ordered"===t?"ol":"ul";switch(t){case"checked":return[e,' data-list="checked"'];case"unchecked":return[e,' data-list="unchecked"'];default:return[e,""]}}function Tc(t){return t.reduce(((t,e)=>{if("string"===typeof e.insert){const n=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(n,e.attributes)}return t.push(e)}),new gs)}function jc(t,e){let{index:n,length:r}=t;return new Nc(n+e,r)}function Cc(t){const e=[];return t.forEach((t=>{if("string"===typeof t.insert){const n=t.insert.split("\n");n.forEach(((n,r)=>{r&&e.push({insert:"\n",attributes:t.attributes}),n&&e.push({insert:n,attributes:t.attributes})}))}else e.push(t)})),e}var Rc=kc;class Ic{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=t,this.options=e}}(0,i.A)(Ic,"DEFAULTS",{});var Mc=Ic;const Bc="\ufeff";class Dc extends os{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(Bc),this.rightGuard=document.createTextNode(Bc),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e,n=null;const r=t.data.split(Bc).join("");if(t===this.leftGuard)if(this.prev instanceof Qa){const t=this.prev.length();this.prev.insertAt(t,r),n={startNode:this.prev.domNode,startOffset:t+r.length}}else e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this),n={startNode:e,startOffset:r.length};else t===this.rightGuard&&(this.next instanceof Qa?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this.next),n={startNode:e,startOffset:r.length}));return t.data=Bc,n}update(t,e){t.forEach((t=>{if("characterData"===t.type&&(t.target===this.leftGuard||t.target===this.rightGuard)){const n=this.restore(t.target);n&&(e.range=n)}}))}}var Uc=Dc;class Pc{constructor(t,e){(0,i.A)(this,"isComposing",!1),this.scroll=t,this.emitter=e,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",(t=>{this.isComposing||this.handleCompositionStart(t)})),this.scroll.domNode.addEventListener("compositionend",(t=>{this.isComposing&&queueMicrotask((()=>{this.handleCompositionEnd(t)}))}))}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;!e||e instanceof Uc||(this.emitter.emit(yc.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(yc.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(yc.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(yc.events.COMPOSITION_END,t),this.isComposing=!1}}var zc,Fc=Pc;class Hc{constructor(t,e){(0,i.A)(this,"modules",{}),this.quill=t,this.options=e}init(){Object.keys(this.options.modules).forEach((t=>{null==this.modules[t]&&this.addModule(t)}))}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}}zc=Hc,(0,i.A)(Hc,"DEFAULTS",{modules:{}}),(0,i.A)(Hc,"themes",{default:zc});var $c=Hc;const Vc=t=>t.parentElement||t.getRootNode().host||null,Kc=t=>{const e=t.getBoundingClientRect(),n="offsetWidth"in t&&Math.abs(e.width)/t.offsetWidth||1,r="offsetHeight"in t&&Math.abs(e.height)/t.offsetHeight||1;return{top:e.top,right:e.left+t.clientWidth*n,bottom:e.top+t.clientHeight*r,left:e.left}},Wc=t=>{const e=parseInt(t,10);return Number.isNaN(e)?0:e},Zc=(t,e,n,r,i,s)=>tr?0:tr?e-t>r-n?t+i-n:e-r+s:0,Gc=(t,e)=>{const n=t.ownerDocument;let r=e,i=t;while(i){const t=i===n.body,e=t?{top:0,right:window.visualViewport?.width??n.documentElement.clientWidth,bottom:window.visualViewport?.height??n.documentElement.clientHeight,left:0}:Kc(i),s=getComputedStyle(i),o=Zc(r.left,r.right,e.left,e.right,Wc(s.scrollPaddingLeft),Wc(s.scrollPaddingRight)),l=Zc(r.top,r.bottom,e.top,e.bottom,Wc(s.scrollPaddingTop),Wc(s.scrollPaddingBottom));if(o||l)if(t)n.defaultView?.scrollBy(o,l);else{const{scrollLeft:t,scrollTop:e}=i;l&&(i.scrollTop+=l),o&&(i.scrollLeft+=o);const n=i.scrollLeft-t,s=i.scrollTop-e;r={left:r.left-n,top:r.top-s,right:r.right-n,bottom:r.bottom-s}}i=t||"fixed"===s.position?null:Vc(i)}};var Xc=Gc;const Yc=100,Qc=["block","break","cursor","inline","scroll","text"],Jc=(t,e,n)=>{const r=new Si;return Qc.forEach((t=>{const n=e.query(t);n&&r.register(n)})),t.forEach((t=>{let i=e.query(t);i||n.error(`Cannot register "${t}" specified in "formats" config. Are you sure it was registered?`);let s=0;while(i)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,s+=1,s>Yc){n.error(`Cycle detected in registering blot requiredContainer: "${t}"`);break}})),r};var tu=Jc;const eu=gc("quill"),nu=new Si;Zi.uiClass="ql-ui";class ru{static debug(t){!0===t&&(t="log"),gc.level(t)}static find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return uc.get(t)||nu.find(t,e)}static import(t){return null==this.imports[t]&&eu.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if("string"!==typeof(arguments.length<=0?void 0:arguments[0])){const t=arguments.length<=0?void 0:arguments[0],e=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in t?t.attrName:t.blotName;"string"===typeof n?this.register(`formats/${n}`,t,e):Object.keys(t).forEach((n=>{this.register(n,t[n],e)}))}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[t]||n||eu.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&"boolean"!==typeof e&&"abstract"!==e.blotName&&nu.register(e),"function"===typeof e.register&&e.register(nu)}}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=lu(t,e),this.container=this.options.container,null==this.container)return void eu.error("Invalid Quill container",t);this.options.debug&&ru.debug(this.options.debug);const n=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",uc.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new yc;const r=hs.blotName,i=this.options.registry.query(r);if(!i||!("blotName"in i))throw new Error(`Cannot initialize Quill without "${r}" blot`);if(this.scroll=new i(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new Rc(this.scroll),this.selection=new Ec(this.scroll,this.emitter),this.composition=new Fc(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(yc.events.EDITOR_CHANGE,(t=>{t===yc.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())})),this.emitter.on(yc.events.SCROLL_UPDATE,((t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;au.call(this,(()=>this.editor.update(null,e,i)),t)})),this.emitter.on(yc.events.SCROLL_EMBED_UPDATE,((t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;au.call(this,(()=>{const n=(new gs).retain(t.offset(this)).retain({[t.statics.blotName]:e});return this.editor.update(n,[],i)}),ru.sources.USER)})),n){const t=this.clipboard.convert({html:`${n}


    `,text:"\n"});this.setContents(t)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"===typeof t){const e=t;t=document.createElement("div"),t.classList.add(e)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,n){return[t,e,,n]=cu(t,e,n),au.call(this,(()=>this.editor.deleteText(t,e)),n,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:yc.sources.API;return au.call(this,(()=>{const n=this.getSelection(!0);let r=new gs;if(null==n)return r;if(this.scroll.query(t,ki.BLOCK))r=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(0===n.length)return this.selection.format(t,e),r;r=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,yc.sources.SILENT),r}),n)}formatLine(t,e,n,r,i){let s;return[t,e,s,i]=cu(t,e,n,r,i),au.call(this,(()=>this.editor.formatLine(t,e,s)),i,t,0)}formatText(t,e,n,r,i){let s;return[t,e,s,i]=cu(t,e,n,r,i),au.call(this,(()=>this.editor.formatText(t,e,s)),i,t,0)}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"===typeof t?this.selection.getBounds(t,e):this.selection.getBounds(t.index,t.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.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]=cu(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]=cu(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]=cu(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ru.sources.API;return au.call(this,(()=>this.editor.insertEmbed(t,e,n)),r,t)}insertText(t,e,n,r,i){let s;return[t,,s,i]=cu(t,0,n,r,i),au.call(this,(()=>this.editor.insertText(t,e,s)),i,t,e.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(t,e,n){return[t,e,,n]=cu(t,e,n),au.call(this,(()=>this.editor.removeFormat(t,e)),n,t)}scrollRectIntoView(t){Xc(this.root,t)}scrollIntoView(){console.warn("Quill#scrollIntoView() has been deprecated and will be removed in the near future. Please use Quill#scrollSelectionIntoView() instead."),this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yc.sources.API;return au.call(this,(()=>{t=new gs(t);const e=this.getLength(),n=this.editor.deleteText(0,e),r=this.editor.insertContents(0,t),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)}),e)}setSelection(t,e,n){null==t?this.selection.setRange(null,e||ru.sources.API):([t,e,,n]=cu(t,e,n),this.selection.setRange(new Nc(Math.max(0,t),e),n),n!==yc.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yc.sources.API;const n=(new gs).insert(t);return this.setContents(n,e)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yc.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yc.sources.API;return au.call(this,(()=>(t=new gs(t),this.editor.applyDelta(t))),e,!0)}}function iu(t){return"string"===typeof t?document.querySelector(t):t}function su(t){return Object.entries(t??{}).reduce(((t,e)=>{let[n,r]=e;return{...t,[n]:!0===r?{}:r}}),{})}function ou(t){return Object.fromEntries(Object.entries(t).filter((t=>void 0!==t[1])))}function lu(t,e){const n=iu(t);if(!n)throw new Error("Invalid Quill container");const r=!e.theme||e.theme===ru.DEFAULTS.theme,i=r?$c:ru.import(`themes/${e.theme}`);if(!i)throw new Error(`Invalid theme ${e.theme}. Did you register it?`);const{modules:s,...o}=ru.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=su(e.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=qi({},su(s),su(l),c),h={...o,...ou(a),...ou(e)};let d=e.registry;return d?e.formats&&eu.warn('Ignoring "formats" option because "registry" is specified'):d=e.formats?tu(e.formats,h.registry,eu):h.registry,{...h,registry:d,container:n,theme:i,modules:Object.entries(u).reduce(((t,e)=>{let[n,r]=e;if(!r)return t;const i=ru.import(`modules/${n}`);return null==i?(eu.error(`Cannot load ${n} module. Are you sure you registered it?`),t):{...t,[n]:qi({},i.DEFAULTS||{},r)}}),{}),bounds:iu(h.bounds)}}function au(t,e,n,r){if(!this.isEnabled()&&e===yc.sources.USER&&!this.allowReadOnlyEdits)return new gs;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=t();if(null!=i&&(!0===n&&(n=i.index),null==r?i=uu(i,o,e):0!==r&&(i=uu(i,n,r,e)),this.setSelection(i,yc.sources.SILENT)),o.length()>0){const t=[yc.events.TEXT_CHANGE,o,s,e];this.emitter.emit(yc.events.EDITOR_CHANGE,...t),e!==yc.sources.SILENT&&this.emitter.emit(...t)}return o}function cu(t,e,n,r,i){let s={};return"number"===typeof t.index&&"number"===typeof t.length?"number"!==typeof e?(i=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!==typeof e&&(i=r,r=n,n=e,e=0),"object"===typeof n?(s=n,i=r):"string"===typeof n&&(null!=r?s[n]=r:i=n),i=i||yc.sources.API,[t,e,s,i]}function uu(t,e,n,r){const i="number"===typeof n?n:0;if(null==t)return null;let s,o;return e&&"function"===typeof e.transformPosition?[s,o]=[t.index,t.index+t.length].map((t=>e.transformPosition(t,r!==yc.sources.USER))):[s,o]=[t.index,t.index+t.length].map((t=>t=0?t+i:Math.max(e,t+i))),new Nc(s,o-s)}(0,i.A)(ru,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:nu,theme:"default"}),(0,i.A)(ru,"events",yc.events),(0,i.A)(ru,"sources",yc.sources),(0,i.A)(ru,"version","2.0.2"),(0,i.A)(ru,"imports",{delta:gs,parchment:r,"core/module":Mc,"core/theme":$c});class hu extends is{}var du=hu;function fu(t){return t instanceof rc||t instanceof ic}function pu(t){return"function"===typeof t.updateContent}class gu extends hs{constructor(t,e,n){let{emitter:r}=n;super(t,e),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",(t=>this.handleDragStart(t)))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(yc.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(yc.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(yc.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[n,r]=this.line(t),[i]=this.line(t+e);if(super.deleteAt(t,e),null!=i&&n!==i&&r>0){if(n instanceof ic||i instanceof ic)return void this.optimize();const t=i.children.head instanceof Ya?null:i.children.head;n.moveChildren(i,t),n.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,n,r){super.formatAt(t,e,n,r),this.optimize()}insertAt(t,e,n){if(t>=this.length())if(null==n||null==this.scroll.query(e,ki.BLOCK)){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t),null==n&&e.endsWith("\n")?t.insertAt(0,e.slice(0,-1),n):t.insertAt(0,e,n)}else{const t=this.scroll.create(e,n);this.appendChild(t)}else super.insertAt(t,e,n);this.optimize()}insertBefore(t,e){if(t.statics.scope===ki.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(t),super.insertBefore(n,e)}else super.insertBefore(t,e)}insertContents(t,e){const n=this.deltaToRenderBlocks(e.concat((new gs).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const e="block"===i.type&&(0===i.delta.length()||!this.descendant(ic,t)[0]&&t{this.formatAt(s-1,1,t,l[t])})),t=s}let[s,o]=this.children.find(t);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach((t=>{if("block"===t.type){const e=this.createBlock(t.attributes,s||void 0);mu(e,0,t.delta)}else{const e=this.create(t.key,t.value);this.insertBefore(e,s||void 0),Object.keys(t.attributes).forEach((n=>{e.format(n,t.attributes[n])}))}}))),"block"===r.type&&r.delta.length()){const t=s?s.offset(s.scroll)+o:this.length();mu(this,t,r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[n,r]=e;return n instanceof Hi?[n,r]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(fu,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;const n=(t,e,r)=>{let i=[],s=r;return t.children.forEachAt(e,r,((t,e,r)=>{fu(t)?i.push(t):t instanceof is&&(i=i.concat(n(t,e,s))),s-=r})),i};return n(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(yc.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch)return void(Array.isArray(t)&&(this.batch=this.batch.concat(t)));let e=yc.sources.USER;"string"===typeof t&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter((t=>{let{target:e}=t;const n=this.find(e,!0);return n&&!pu(n)})),t.length>0&&this.emitter.emit(yc.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(yc.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,n){const[r]=this.descendant((t=>t instanceof ic),t);r&&r.statics.blotName===e&&pu(r)&&r.updateContent(n)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let n=new gs;return t.forEach((t=>{const r=t?.insert;if(r)if("string"===typeof r){const i=r.split("\n");i.slice(0,-1).forEach((r=>{n.insert(r,t.attributes),e.push({type:"block",delta:n,attributes:t.attributes??{}}),n=new gs}));const s=i[i.length-1];s&&n.insert(s,t.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,ki.INLINE)?n.push(t):(n.length()&&e.push({type:"block",delta:n,attributes:{}}),n=new gs,e.push({type:"blockEmbed",key:i,value:r[i],attributes:t.attributes??{}}))}})),n.length()&&e.push({type:"block",delta:n,attributes:{}}),e}createBlock(t,e){let n;const r={};Object.entries(t).forEach((t=>{let[e,i]=t;const s=null!=this.query(e,ki.BLOCK&ki.BLOT);s?n=e:r[e]=i}));const i=this.create(n||this.statics.defaultChild.blotName,n?t[n]:void 0);this.insertBefore(i,e||void 0);const s=i.length();return Object.entries(r).forEach((t=>{let[e,n]=t;i.formatAt(0,s,e,n)})),i}}function mu(t,e,n){n.reduce(((e,n)=>{const r=gs.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"===typeof n.insert){const r=n.insert;t.insertAt(e,r);const[s]=t.descendant(Hi,e),o=oc(s);i=gs.AttributeMap.diff(o,i)||{}}else if("object"===typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;t.insertAt(e,r,n.insert[r]);const s=null!=t.scroll.query(r,ki.INLINE);if(s){const[n]=t.descendant(Hi,e),r=oc(n);i=gs.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach((n=>{t.formatAt(e,r,n,i[n])})),e+r}),e)}(0,i.A)(gu,"blotName","scroll"),(0,i.A)(gu,"className","ql-editor"),(0,i.A)(gu,"tagName","DIV"),(0,i.A)(gu,"defaultChild",rc),(0,i.A)(gu,"allowedChildren",[rc,ic,du]);var bu=gu;const vu={scope:ki.BLOCK,whitelist:["right","center","justify"]},yu=new _i("align","align",vu),xu=new Ci("align","ql-align",vu),Nu=new Mi("align","text-align",vu);class wu extends Mi{value(t){let e=super.value(t);if(!e.startsWith("rgb("))return e;e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");const n=e.split(",").map((t=>`00${parseInt(t,10).toString(16)}`.slice(-2))).join("");return`#${n}`}}const Au=new Ci("color","ql-color",{scope:ki.INLINE}),Eu=new wu("color","color",{scope:ki.INLINE}),qu=new Ci("background","ql-bg",{scope:ki.INLINE}),ku=new wu("background","background-color",{scope:ki.INLINE});class _u extends du{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map((t=>t.length()<=1?"":t.domNode.innerText)).join("\n").slice(t,t+e)}html(t,e){return`
    \n${Ja(this.code(t,e))}\n
    `}}class Lu extends rc{static register(){ru.register(_u)}}(0,i.A)(Lu,"TAB"," ");class Ou extends ec{}Ou.blotName="code",Ou.tagName="CODE",Lu.blotName="code-block",Lu.className="ql-code-block",Lu.tagName="DIV",_u.blotName="code-block-container",_u.className="ql-code-block-container",_u.tagName="DIV",_u.allowedChildren=[Lu],Lu.allowedChildren=[Qa,Ya,ac],Lu.requiredContainer=_u;const Su={scope:ki.BLOCK,whitelist:["rtl"]},Tu=new _i("direction","dir",Su),ju=new Ci("direction","ql-direction",Su),Cu=new Mi("direction","direction",Su),Ru={scope:ki.INLINE,whitelist:["serif","monospace"]},Iu=new Ci("font","ql-font",Ru);class Mu extends Mi{value(t){return super.value(t).replace(/["']/g,"")}}const Bu=new Mu("font","font-family",Ru),Du=new Ci("size","ql-size",{scope:ki.INLINE,whitelist:["small","large","huge"]}),Uu=new Mi("size","font-size",{scope:ki.INLINE,whitelist:["10px","18px","32px"]}),Pu=gc("quill:keyboard"),zu=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Fu extends Mc{static match(t,e){return!["altKey","ctrlKey","metaKey","shiftKey"].some((n=>!!e[n]!==t[n]&&null!==e[n]))&&(e.key===t.key||e.key===t.which)}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach((t=>{this.options.bindings[t]&&this.addBinding(this.options.bindings[t])})),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},(()=>{})),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Zu(t);if(null==r)return void Pu.warn("Attempted to add invalid keyboard binding",r);"function"===typeof e&&(e={handler:e}),"function"===typeof n&&(n={handler:n});const i=Array.isArray(r.key)?r.key:[r.key];i.forEach((t=>{const i={...r,key:t,...e,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)}))}listen(){this.quill.root.addEventListener("keydown",(t=>{if(t.defaultPrevented||t.isComposing)return;const e=229===t.keyCode&&("Enter"===t.key||"Backspace"===t.key);if(e)return;const n=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]),r=n.filter((e=>Fu.match(t,e)));if(0===r.length)return;const i=ru.find(t.target,!0);if(i&&i.scroll!==this.quill.scroll)return;const s=this.quill.getSelection();if(null==s||!this.quill.hasFocus())return;const[o,l]=this.quill.getLine(s.index),[a,c]=this.quill.getLeaf(s.index),[u,h]=0===s.length?[a,c]:this.quill.getLeaf(s.index+s.length),d=a instanceof ps?a.value().slice(0,c):"",f=u instanceof ps?u.value().slice(h):"",p={collapsed:0===s.length,empty:0===s.length&&o.length()<=1,format:this.quill.getFormat(s),line:o,offset:l,prefix:d,suffix:f,event:t},g=r.some((t=>{if(null!=t.collapsed&&t.collapsed!==p.collapsed)return!1;if(null!=t.empty&&t.empty!==p.empty)return!1;if(null!=t.offset&&t.offset!==p.offset)return!1;if(Array.isArray(t.format)){if(t.format.every((t=>null==p.format[t])))return!1}else if("object"===typeof t.format&&!Object.keys(t.format).every((e=>!0===t.format[e]?null!=p.format[e]:!1===t.format[e]?null==p.format[e]:Za(t.format[e],p.format[e]))))return!1;return!(null!=t.prefix&&!t.prefix.test(p.prefix))&&(!(null!=t.suffix&&!t.suffix.test(p.suffix))&&!0!==t.handler.call(this,s,p,t))}));g&&t.preventDefault()}))}handleBackspace(t,e){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(0===t.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(t.index);let s=(new gs).retain(t.index-n).delete(n);if(0===e.offset){const[e]=this.quill.getLine(t.index-1);if(e){const n="block"===e.statics.blotName&&e.length()<=1;if(!n){const e=i.formats(),n=this.quill.getFormat(t.index-1,1);if(r=gs.AttributeMap.diff(e,n)||{},Object.keys(r).length>0){const e=(new gs).retain(t.index+i.length()-2).retain(1,r);s=s.compose(e)}}}}this.quill.updateContents(s,ru.sources.USER),this.quill.focus()}handleDelete(t,e){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(t.index);let s=(new gs).retain(t.index).delete(n);if(e.offset>=i.length()-1){const[e]=this.quill.getLine(t.index+1);if(e){const n=i.formats(),o=this.quill.getFormat(t.index,1);r=gs.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(e.length()-1).retain(1,r))}}this.quill.updateContents(s,ru.sources.USER),this.quill.focus()}handleDeleteRange(t){Gu({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const n=Object.keys(e.format).reduce(((t,n)=>(this.quill.scroll.query(n,ki.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t)),{}),r=(new gs).retain(t.index).delete(t.length).insert("\n",n);this.quill.updateContents(r,ru.sources.USER),this.quill.setSelection(t.index+1,ru.sources.SILENT),this.quill.focus()}}const Hu={bindings:{bold:Ku("bold"),italic:Ku("italic"),underline:Ku("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","+1",ru.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",ru.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",ru.sources.USER):null!=e.format.list&&this.quill.format("list",!1,ru.sources.USER)}},"indent code-block":$u(!0),"outdent code-block":$u(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(t){this.quill.deleteText(t.index-1,1,ru.sources.USER)}},tab:{key:"Tab",handler(t,e){if(e.format.table)return!0;this.quill.history.cutoff();const n=(new gs).retain(t.index).delete(t.length).insert("\t");return this.quill.updateContents(n,ru.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,ru.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,ru.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(t,e){const n={list:!1};e.format.indent&&(n.indent=!1),this.quill.formatLine(t.index,t.length,n,ru.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(t){const[e,n]=this.quill.getLine(t.index),r={...e.formats(),list:"checked"},i=(new gs).retain(t.index).insert("\n",r).retain(e.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,ru.sources.USER),this.quill.setSelection(t.index+1,ru.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(t,e){const[n,r]=this.quill.getLine(t.index),i=(new gs).retain(t.index).insert("\n",e.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,ru.sources.USER),this.quill.setSelection(t.index+1,ru.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(t){const e=this.quill.getModule("table");if(e){const[n,r,i,s]=e.getTable(t),o=Xu(n,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const e=(new gs).retain(l).insert("\n");this.quill.updateContents(e,ru.sources.USER),this.quill.setSelection(t.index+1,t.length,ru.sources.SILENT)}else if(o>0){l+=n.length();const t=(new gs).retain(l).insert("\n");this.quill.updateContents(t,ru.sources.USER),this.quill.setSelection(l,ru.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(t,e){const{event:n,line:r}=e,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,ru.sources.USER):this.quill.setSelection(i+r.length(),ru.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(t,e){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=e.prefix,[r,i]=this.quill.getLine(t.index);if(i>n)return!0;let s;switch(e.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(t.index," ",ru.sources.USER),this.quill.history.cutoff();const o=(new gs).retain(t.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:s});return this.quill.updateContents(o,ru.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-n,ru.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(t){const[e,n]=this.quill.getLine(t.index);let r=2,i=e;while(null!=i&&i.length()<=1&&i.formats()["code-block"])if(i=i.prev,r-=1,r<=0){const r=(new gs).retain(t.index+e.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,ru.sources.USER),this.quill.setSelection(t.index-1,ru.sources.SILENT),!1}return!0}},"embed left":Vu("ArrowLeft",!1),"embed left shift":Vu("ArrowLeft",!0),"embed right":Vu("ArrowRight",!1),"embed right shift":Vu("ArrowRight",!0),"table down":Wu(!1),"table up":Wu(!0)}};function $u(t){return{key:"Tab",shiftKey:!t,format:{"code-block":!0},handler(e,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===e.length&&!r.shiftKey)return this.quill.insertText(e.index,s,ru.sources.USER),void this.quill.setSelection(e.index+s.length,ru.sources.SILENT);const o=0===e.length?this.quill.getLines(e.index,1):this.quill.getLines(e);let{index:l,length:a}=e;o.forEach(((e,n)=>{t?(e.insertAt(0,s),0===n?l+=s.length:a+=s.length):e.domNode.textContent.startsWith(s)&&(e.deleteAt(0,s.length),0===n?l-=s.length:a-=s.length)})),this.quill.update(ru.sources.USER),this.quill.setSelection(l,a,ru.sources.SILENT)}}}function Vu(t,e){const n="ArrowLeft"===t?"prefix":"suffix";return{key:t,shiftKey:e,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===t&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof os)||("ArrowLeft"===t?e?this.quill.setSelection(n.index-1,n.length+1,ru.sources.USER):this.quill.setSelection(n.index-1,ru.sources.USER):e?this.quill.setSelection(n.index,n.length+1,ru.sources.USER):this.quill.setSelection(n.index+n.length+1,ru.sources.USER),!1)}}}function Ku(t){return{key:t[0],shortKey:!0,handler(e,n){this.quill.format(t,!n.format[t],ru.sources.USER)}}}function Wu(t){return{key:t?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(e,n){const r=t?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let t=s.children.head,e=i;while(null!=e.prev)e=e.prev,t=t.next;const r=t.offset(this.quill.scroll)+Math.min(n.offset,t.length()-1);this.quill.setSelection(r,0,ru.sources.USER)}}else{const e=i.table()[r];null!=e&&(t?this.quill.setSelection(e.offset(this.quill.scroll)+e.length()-1,0,ru.sources.USER):this.quill.setSelection(e.offset(this.quill.scroll),0,ru.sources.USER))}return!1}}}function Zu(t){if("string"===typeof t||"number"===typeof t)t={key:t};else{if("object"!==typeof t)return null;t=Gl(t)}return t.shortKey&&(t[zu]=t.shortKey,delete t.shortKey),t}function Gu(t){let{quill:e,range:n}=t;const r=e.getLines(n);let i={};if(r.length>1){const t=r[0].formats(),e=r[r.length-1].formats();i=gs.AttributeMap.diff(e,t)||{}}e.deleteText(n,ru.sources.USER),Object.keys(i).length>0&&e.formatLine(n.index,1,i,ru.sources.USER),e.setSelection(n.index,ru.sources.SILENT)}function Xu(t,e,n,r){return null==e.prev&&null==e.next?null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1:null==e.prev?-1:null==e.next?1:null}Fu.DEFAULTS=Hu;const Yu=/font-weight:\s*normal/,Qu=["P","OL","UL"],Ju=t=>t&&Qu.includes(t.tagName),th=t=>{Array.from(t.querySelectorAll("br")).filter((t=>Ju(t.previousElementSibling)&&Ju(t.nextElementSibling))).forEach((t=>{t.parentNode?.removeChild(t)}))},eh=t=>{Array.from(t.querySelectorAll('b[style*="font-weight"]')).filter((t=>t.getAttribute("style")?.match(Yu))).forEach((e=>{const n=t.createDocumentFragment();n.append(...e.childNodes),e.parentNode?.replaceChild(n,e)}))};function nh(t){t.querySelector('[id^="docs-internal-guid-"]')&&(eh(t),th(t))}const rh=/\bmso-list:[^;]*ignore/i,ih=/\bmso-list:[^;]*\bl(\d+)/i,sh=/\bmso-list:[^;]*\blevel(\d+)/i,oh=(t,e)=>{const n=t.getAttribute("style"),r=n?.match(ih);if(!r)return null;const i=Number(r[1]),s=n?.match(sh),o=s?Number(s[1]):1,l=new RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=e.match(l),c=a&&"bullet"===a[1]?"bullet":"ordered";return{id:i,indent:o,type:c,element:t}},lh=t=>{const e=Array.from(t.querySelectorAll("[style*=mso-list]")),n=[],r=[];e.forEach((t=>{const e=(t.getAttribute("style")||"").match(rh);e?n.push(t):r.push(t)})),n.forEach((t=>t.parentNode?.removeChild(t)));const i=t.documentElement.innerHTML,s=r.map((t=>oh(t,i))).filter((t=>t));while(s.length){const t=[];let e=s.shift();while(e)t.push(e),e=s.length&&s[0]?.element===e.element.nextElementSibling&&s[0].id===e.id?s.shift():null;const n=document.createElement("ul");t.forEach((t=>{const e=document.createElement("li");e.setAttribute("data-list",t.type),t.indent>1&&e.setAttribute("class","ql-indent-"+(t.indent-1)),e.innerHTML=t.element.innerHTML,n.appendChild(e)}));const r=t[0]?.element,{parentNode:i}=r??{};r&&i?.replaceChild(n,r),t.slice(1).forEach((t=>{let{element:e}=t;i?.removeChild(e)}))}};function ah(t){"urn:schemas-microsoft-com:office:word"===t.documentElement.getAttribute("xmlns:w")&&lh(t)}const ch=[ah,nh],uh=t=>{t.documentElement&&ch.forEach((e=>{e(t)}))};var hh=uh;const dh=gc("quill:clipboard"),fh=[[Node.TEXT_NODE,Ih],[Node.TEXT_NODE,jh],["br",_h],[Node.ELEMENT_NODE,jh],[Node.ELEMENT_NODE,kh],[Node.ELEMENT_NODE,qh],[Node.ELEMENT_NODE,Ch],["li",Sh],["ol, ul",Th],["pre",Lh],["tr",Rh],["b",Eh("bold")],["i",Eh("italic")],["strike",Eh("strike")],["style",Oh]],ph=[yu,Tu].reduce(((t,e)=>(t[e.keyName]=e,t)),{}),gh=[Nu,ku,Eu,Cu,Bu,Uu].reduce(((t,e)=>(t[e.keyName]=e,t)),{});class mh extends Mc{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=[],fh.concat(this.options.matchers??[]).forEach((t=>{let[e,n]=t;this.addMatcher(e,n)}))}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:n}=t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[Lu.blotName])return(new gs).insert(n||"",{[Lu.blotName]:r[Lu.blotName]});if(!e)return(new gs).insert(n||"",r);const i=this.convertHTML(e);return vh(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new gs).retain(i.length()-1).delete(1)):i}normalizeHTML(t){hh(t)}convertHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");this.normalizeHTML(e);const n=e.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return Ah(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ru.sources.API;if("string"===typeof t){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,ru.sources.SILENT)}else{const r=this.convert({html:e,text:""});this.quill.updateContents((new gs).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),ru.sources.SILENT)}}onCaptureCopy(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.defaultPrevented)return;t.preventDefault();const[n]=this.quill.selection.getRange();if(null==n)return;const{html:r,text:i}=this.onCopy(n,e);t.clipboardData?.setData("text/plain",i),t.clipboardData?.setData("text/html",r),e&&Gu({range:n,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter((t=>"#"!==t[0])).join("\n")}onCapturePaste(t){if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(null==e)return;const n=t.clipboardData?.getData("text/html");let r=t.clipboardData?.getData("text/plain");if(!n&&!r){const e=t.clipboardData?.getData("text/uri-list");e&&(r=this.normalizeURIList(e))}const i=Array.from(t.clipboardData?.files||[]);if(!n&&i.length>0)this.quill.uploader.upload(e,i);else{if(n&&i.length>0){const t=(new DOMParser).parseFromString(n,"text/html");if(1===t.body.childElementCount&&"IMG"===t.body.firstElementChild?.tagName)return void this.quill.uploader.upload(e,i)}this.onPaste(e,{html:n,text:r})}}onCopy(t){const e=this.quill.getText(t),n=this.quill.getSemanticHTML(t);return{html:n,text:e}}onPaste(t,e){let{text:n,html:r}=e;const i=this.quill.getFormat(t.index),s=this.convert({text:n,html:r},i);dh.log("onPaste",s,{text:n,html:r});const o=(new gs).retain(t.index).delete(t.length).concat(s);this.quill.updateContents(o,ru.sources.USER),this.quill.setSelection(o.length()-t.length,ru.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const n=[],r=[];return this.matchers.forEach((i=>{const[s,o]=i;switch(s){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(t.querySelectorAll(s)).forEach((t=>{if(e.has(t)){const n=e.get(t);n?.push(o)}else e.set(t,[o])}));break}})),[n,r]}}function bh(t,e,n,r){return r.query(e)?t.reduce(((t,r)=>{if(!r.insert)return t;if(r.attributes&&r.attributes[e])return t.push(r);const i=n?{[e]:n}:{};return t.insert(r.insert,{...i,...r.attributes})}),new gs):t}function vh(t,e){let n="";for(let r=t.ops.length-1;r>=0&&n.lengthr(e,n,t)),new gs):e.nodeType===e.ELEMENT_NODE?Array.from(e.childNodes||[]).reduce(((s,o)=>{let l=Ah(t,o,n,r,i);return o.nodeType===e.ELEMENT_NODE&&(l=n.reduce(((e,n)=>n(o,e,t)),l),l=(i.get(o)||[]).reduce(((e,n)=>n(o,e,t)),l)),s.concat(l)}),new gs):new gs}function Eh(t){return(e,n,r)=>bh(n,t,!0,r)}function qh(t,e,n){const r=_i.keys(t),i=Ci.keys(t),s=Mi.keys(t),o={};return r.concat(i).concat(s).forEach((e=>{let r=n.query(e,ki.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(r=ph[e],null==r||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),r=gh[e],null==r||r.attrName!==e&&r.keyName!==e||(r=gh[e],o[r.attrName]=r.value(t)||void 0))})),Object.entries(o).reduce(((t,e)=>{let[r,i]=e;return bh(t,r,i,n)}),e)}function kh(t,e,n){const r=n.query(t);if(null==r)return e;if(r.prototype instanceof os){const e={},i=r.value(t);if(null!=i)return e[r.blotName]=i,(new gs).insert(e,r.formats(t,n))}else if(r.prototype instanceof es&&!vh(e,"\n")&&e.insert("\n"),"blotName"in r&&"formats"in r&&"function"===typeof r.formats)return bh(e,r.blotName,r.formats(t,n),n);return e}function _h(t,e){return vh(e,"\n")||e.insert("\n"),e}function Lh(t,e,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!==typeof r.formats||r.formats(t,n);return bh(e,"code-block",i,n)}function Oh(){return new gs}function Sh(t,e,n){const r=n.query(t);if(null==r||"list"!==r.blotName||!vh(e,"\n"))return e;let i=-1,s=t.parentNode;while(null!=s)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?e:e.reduce(((t,e)=>e.insert?e.attributes&&"number"===typeof e.attributes.indent?t.push(e):t.insert(e.insert,{indent:i,...e.attributes||{}}):t),new gs)}function Th(t,e,n){const r=t;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");return s&&(i="true"===s?"checked":"unchecked"),bh(e,"list",i,n)}function jh(t,e,n){if(!vh(e,"\n")){if(yh(t,n)&&(t.childNodes.length>0||t instanceof HTMLParagraphElement))return e.insert("\n");if(e.length()>0&&t.nextSibling){let r=t.nextSibling;while(null!=r){if(yh(r,n))return e.insert("\n");const t=n.query(r);if(t&&t.prototype instanceof ic)return e.insert("\n");r=r.firstChild}}}return e}function Ch(t,e,n){const r={},i=t.style||{};return"italic"===i.fontStyle&&(r.italic=!0),"underline"===i.textDecoration&&(r.underline=!0),"line-through"===i.textDecoration&&(r.strike=!0),(i.fontWeight?.startsWith("bold")||parseInt(i.fontWeight,10)>=700)&&(r.bold=!0),e=Object.entries(r).reduce(((t,e)=>{let[r,i]=e;return bh(t,r,i,n)}),e),parseFloat(i.textIndent||0)>0?(new gs).insert("\t").concat(e):e}function Rh(t,e,n){const r="TABLE"===t.parentElement?.tagName?t.parentElement:t.parentElement?.parentElement;if(null!=r){const i=Array.from(r.querySelectorAll("tr")),s=i.indexOf(t)+1;return bh(e,"table",s,n)}return e}function Ih(t,e,n){let r=t.data;if("O:P"===t.parentElement?.tagName)return e.insert(r.trim());if(!wh(t)){if(0===r.trim().length&&r.includes("\n")&&!xh(t,n))return e;const i=(t,e)=>{const n=e.replace(/[^\u00a0]/g,"");return n.length<1&&t?" ":n};r=r.replace(/\r\n/g," ").replace(/\n/g," "),r=r.replace(/\s\s+/g,i.bind(i,!0)),(null==t.previousSibling&&null!=t.parentElement&&yh(t.parentElement,n)||t.previousSibling instanceof Element&&yh(t.previousSibling,n))&&(r=r.replace(/^\s+/,i.bind(i,!1))),(null==t.nextSibling&&null!=t.parentElement&&yh(t.parentElement,n)||t.nextSibling instanceof Element&&yh(t.nextSibling,n))&&(r=r.replace(/\s+$/,i.bind(i,!1)))}return e.insert(r)}class Mh extends Mc{constructor(t,e){super(t,e),(0,i.A)(this,"lastRecorded",0),(0,i.A)(this,"ignoreChange",!1),(0,i.A)(this,"stack",{undo:[],redo:[]}),(0,i.A)(this,"currentRange",null),this.quill.on(ru.events.EDITOR_CHANGE,((t,e,n,r)=>{t===ru.events.SELECTION_CHANGE?e&&r!==ru.sources.SILENT&&(this.currentRange=e):t===ru.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==ru.sources.USER?this.transform(e):this.record(e,n)),this.currentRange=Ph(this.currentRange,e))})),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",(t=>{"historyUndo"===t.inputType?(this.undo(),t.preventDefault()):"historyRedo"===t.inputType&&(this.redo(),t.preventDefault())}))}change(t,e){if(0===this.stack[t].length)return;const n=this.stack[t].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[e].push({delta:i,range:Ph(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,ru.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(t,e){if(0===t.ops.length)return;this.stack.redo=[];let n=t.invert(e),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const t=this.stack.undo.pop();t&&(n=n.compose(t.delta),r=t.range)}else this.lastRecorded=i;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(t){Bh(this.stack.undo,t),Bh(this.stack.redo,t)}undo(){this.change("undo","redo")}restoreSelection(t){if(t.range)this.quill.setSelection(t.range,ru.sources.USER);else{const e=Uh(this.quill.scroll,t.delta);this.quill.setSelection(e,ru.sources.USER)}}}function Bh(t,e){let n=e;for(let r=t.length-1;r>=0;r-=1){const e=t[r];t[r]={delta:n.transform(e.delta,!0),range:e.range&&Ph(e.range,n)},n=e.delta.transform(n),0===t[r].delta.length()&&t.splice(r,1)}}function Dh(t,e){const n=e.ops[e.ops.length-1];return null!=n&&(null!=n.insert?"string"===typeof n.insert&&n.insert.endsWith("\n"):null!=n.attributes&&Object.keys(n.attributes).some((e=>null!=t.query(e,ki.BLOCK))))}function Uh(t,e){const n=e.reduce(((t,e)=>t+(e.delete||0)),0);let r=e.length()-n;return Dh(t,e)&&(r-=1),r}function Ph(t,e){if(!t)return t;const n=e.transformPosition(t.index),r=e.transformPosition(t.index+t.length);return{index:n,length:r-n}}(0,i.A)(Mh,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class zh extends Mc{constructor(t,e){super(t,e),t.root.addEventListener("drop",(e=>{e.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(e.clientX,e.clientY);else if(document.caretPositionFromPoint){const t=document.caretPositionFromPoint(e.clientX,e.clientY);n=document.createRange(),n.setStart(t.offsetNode,t.offset),n.setEnd(t.offsetNode,t.offset)}const r=n&&t.selection.normalizeNative(n);if(r){const n=t.selection.normalizedToRange(r);e.dataTransfer?.files&&this.upload(n,e.dataTransfer.files)}}))}upload(t,e){const n=[];Array.from(e).forEach((t=>{t&&this.options.mimetypes?.includes(t.type)&&n.push(t)})),n.length>0&&this.options.handler.call(this,t,n)}}zh.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(t,e){if(!this.quill.scroll.query("image"))return;const n=e.map((t=>new Promise((e=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.readAsDataURL(t)}))));Promise.all(n).then((e=>{const n=e.reduce(((t,e)=>t.insert({image:e})),(new gs).retain(t.index).delete(t.length));this.quill.updateContents(n,yc.sources.USER),this.quill.setSelection(t.index+e.length,yc.sources.SILENT)}))}};var Fh=zh;const Hh=["insertText","insertReplacementText"];class $h extends Mc{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",(t=>{this.handleBeforeInput(t)})),/Android/i.test(navigator.userAgent)||t.on(ru.events.COMPOSITION_BEFORE_START,(()=>{this.handleCompositionStart()}))}deleteRange(t){Gu({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===t.length)return!1;if(e){const n=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents((new gs).retain(t.index).insert(e,n),ru.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,ru.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!Hh.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||!0===e.collapsed)return;const n=Vh(t);if(null==n)return;const r=this.quill.selection.normalizeNative(e),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function Vh(t){return"string"===typeof t.data?t.data:t.dataTransfer?.types.includes("text/plain")?t.dataTransfer.getData("text/plain"):null}var Kh=$h;const Wh=/Mac/i.test(navigator.platform),Zh=100,Gh=t=>"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowUp"===t.key||"ArrowDown"===t.key||"Home"===t.key||!(!Wh||"a"!==t.key||!0!==t.ctrlKey);class Xh extends Mc{constructor(t,e){super(t,e),(0,i.A)(this,"isListening",!1),(0,i.A)(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(t,e){let{line:n,event:r}=e;if(!(n instanceof Zi)||!n.uiNode)return!0;const i="rtl"===getComputedStyle(n.domNode)["direction"];return!!(i&&"ArrowRight"!==r.key||!i&&"ArrowLeft"!==r.key)||(this.quill.setSelection(t.index-1,t.length+(r.shiftKey?1:0),ru.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",(t=>{!t.defaultPrevented&&Gh(t)&&this.ensureListeningToSelectionChange()}))}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+Zh,this.isListening)return;this.isListening=!0;const t=()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()};document.addEventListener("selectionchange",t,{once:!0})}handleSelectionChange(){const t=document.getSelection();if(!t)return;const e=t.getRangeAt(0);if(!0!==e.collapsed||0!==e.startOffset)return;const n=this.quill.scroll.find(e.startContainer);if(!(n instanceof Zi)||!n.uiNode)return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),t.removeAllRanges(),t.addRange(r)}}var Yh=Xh;ru.register({"blots/block":rc,"blots/block/embed":ic,"blots/break":Ya,"blots/container":du,"blots/cursor":ac,"blots/embed":Uc,"blots/inline":ec,"blots/scroll":bu,"blots/text":Qa,"modules/clipboard":mh,"modules/history":Mh,"modules/keyboard":Fu,"modules/uploader":Fh,"modules/input":Kh,"modules/uiNode":Yh});var Qh=ru;class Jh extends Ci{add(t,e){let n=0;if("+1"===e||"-1"===e){const r=this.value(t)||0;n="+1"===e?r+1:r-1}else"number"===typeof e&&(n=e);return 0===n?(this.remove(t),!0):super.add(t,n.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}const td=new Jh("indent","ql-indent",{scope:ki.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});var ed=td;class nd extends rc{}(0,i.A)(nd,"blotName","blockquote"),(0,i.A)(nd,"tagName","blockquote");var rd=nd;class id extends rc{static formats(t){return this.tagName.indexOf(t.tagName)+1}}(0,i.A)(id,"blotName","header"),(0,i.A)(id,"tagName",["H1","H2","H3","H4","H5","H6"]);var sd=id;class od extends du{}od.blotName="list-container",od.tagName="OL";class ld extends rc{static create(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){ru.register(od)}constructor(t,e){super(t,e);const n=e.ownerDocument.createElement("span"),r=n=>{if(!t.isEnabled())return;const r=this.statics.formats(e,t);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}ld.blotName="list",ld.tagName="LI",od.allowedChildren=[ld],ld.requiredContainer=od;class ad extends ec{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)}}(0,i.A)(ad,"blotName","bold"),(0,i.A)(ad,"tagName",["STRONG","B"]);var cd=ad;class ud extends cd{}(0,i.A)(ud,"blotName","italic"),(0,i.A)(ud,"tagName",["EM","I"]);var hd=ud;class dd extends ec{static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return fd(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 fd(t,e){const n=document.createElement("a");n.href=t;const r=n.href.slice(0,n.href.indexOf(":"));return e.indexOf(r)>-1}(0,i.A)(dd,"blotName","link"),(0,i.A)(dd,"tagName","A"),(0,i.A)(dd,"SANITIZED_URL","about:blank"),(0,i.A)(dd,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class pd extends ec{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}}(0,i.A)(pd,"blotName","script"),(0,i.A)(pd,"tagName",["SUB","SUP"]);var gd=pd;class md extends cd{}(0,i.A)(md,"blotName","strike"),(0,i.A)(md,"tagName",["S","STRIKE"]);var bd=md;class vd extends ec{}(0,i.A)(vd,"blotName","underline"),(0,i.A)(vd,"tagName","U");var yd=vd;class xd extends Uc{static create(t){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return"string"===typeof t&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`${t}`}}(0,i.A)(xd,"blotName","formula"),(0,i.A)(xd,"className","ql-formula"),(0,i.A)(xd,"tagName","SPAN");var Nd=xd;const wd=["alt","height","width"];class Ad extends os{static create(t){const e=super.create(t);return"string"===typeof t&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return wd.reduce(((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e)),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return fd(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){wd.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}(0,i.A)(Ad,"blotName","image"),(0,i.A)(Ad,"tagName","IMG");var Ed=Ad;const qd=["height","width"];class kd extends ic{static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return qd.reduce(((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e)),{})}static sanitize(t){return dd.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){qd.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`${t}`}}(0,i.A)(kd,"blotName","video"),(0,i.A)(kd,"className","ql-video"),(0,i.A)(kd,"tagName","IFRAME");var _d=kd;const Ld=new Ci("code-token","hljs",{scope:ki.INLINE});class Od extends ec{static formats(t,e){while(null!=t&&t!==e.domNode){if(t.classList&&t.classList.contains(Lu.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,n){super(t,e,n),Ld.add(this.domNode,n)}format(t,e){t!==Od.blotName?super.format(t,e):e?Ld.add(this.domNode,e):(Ld.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),Ld.value(this.domNode)||this.unwrap()}}Od.blotName="code-token",Od.className="ql-token";class Sd extends Lu{static create(t){const e=super.create(t);return"string"===typeof t&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),Od.blotName,!1),super.replaceWith(t,e)}}class Td extends _u{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===Sd.blotName&&(this.forceNext=!0,this.children.forEach((n=>{n.format(t,e)})))}formatAt(t,e,n,r){n===Sd.blotName&&(this.forceNext=!0),super.formatAt(t,e,n,r)}highlight(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=Array.from(this.domNode.childNodes).filter((t=>t!==this.uiNode)),r=`${n.map((t=>t.textContent)).join("\n")}\n`,i=Sd.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==r){if(r.trim().length>0||null==this.cachedText){const e=this.children.reduce(((t,e)=>t.concat(sc(e,!1))),new gs),n=t(r,i);e.diff(n).reduce(((t,e)=>{let{retain:n,attributes:r}=e;return n?(r&&Object.keys(r).forEach((e=>{[Sd.blotName,Od.blotName].includes(e)&&this.formatAt(t,n,e,r[e])})),t+n):t}),0)}this.cachedText=r,this.forceNext=!1}}html(t,e){const[n]=this.children.find(t),r=n?Sd.formats(n.domNode):"plain";return`
    \n${Ja(this.code(t,e))}\n
    `}optimize(t){if(super.optimize(t),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const t=Sd.formats(this.children.head.domNode);t!==this.uiNode.value&&(this.uiNode.value=t)}}}Td.allowedChildren=[Sd],Sd.requiredContainer=Td,Sd.allowedChildren=[Od,ac,Qa,Ya];const jd=(t,e,n)=>{if("string"===typeof t.versionString){const r=t.versionString.split(".")[0];if(parseInt(r,10)>=11)return t.highlight(n,{language:e}).value}return t.highlight(e,n).value};class Cd extends Mc{static register(){ru.register(Od,!0),ru.register(Sd,!0),ru.register(Td,!0)}constructor(t,e){if(super(t,e),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce(((t,e)=>{let{key:n}=e;return t[n]=!0,t}),{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(ru.events.SCROLL_BLOT_MOUNT,(t=>{if(!(t instanceof Td))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach((t=>{let{key:n,label:r}=t;const i=e.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),e.appendChild(i)})),e.addEventListener("change",(()=>{t.format(Sd.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)})),null==t.uiNode&&(t.attachUI(e),t.children.head&&(e.value=Sd.formats(t.children.head.domNode)))}))}initTimer(){let t=null;this.quill.on(ru.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(ru.sources.USER);const n=this.quill.getSelection(),r=null==t?this.quill.scroll.descendants(Td):[t];r.forEach((t=>{t.highlight(this.highlightBlot,e)})),this.quill.update(ru.sources.SILENT),null!=n&&this.quill.setSelection(n,ru.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(e=this.languages[e]?e:"plain","plain"===e)return Ja(t).split("\n").reduce(((t,n,r)=>(0!==r&&t.insert("\n",{[Lu.blotName]:e}),t.insert(n))),new gs);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(Lu.className),n.innerHTML=jd(this.options.hljs,e,t),Ah(this.quill.scroll,n,[(t,e)=>{const n=Ld.value(t);return n?e.compose((new gs).retain(e.length(),{[Od.blotName]:n})):e}],[(t,n)=>t.data.split("\n").reduce(((t,n,r)=>(0!==r&&t.insert("\n",{[Lu.blotName]:e}),t.insert(n))),n)],new WeakMap)}}Cd.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 Rd extends rc{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",Dd()),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===Rd.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()}}(0,i.A)(Rd,"blotName","table"),(0,i.A)(Rd,"tagName","TD");class Id extends du{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const t=this.children.head.formats(),e=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return t.table===e.table&&t.table===n.table&&t.table===r.table}return!1}optimize(t){super.optimize(t),this.children.forEach((t=>{if(null==t.next)return;const e=t.formats(),n=t.next.formats();if(e.table!==n.table){const e=this.splitAfter(t);e&&e.optimize(),this.prev&&this.prev.optimize()}}))}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}(0,i.A)(Id,"blotName","table-row"),(0,i.A)(Id,"tagName","TR");class Md extends du{}(0,i.A)(Md,"blotName","table-body"),(0,i.A)(Md,"tagName","TBODY");class Bd extends du{balanceCells(){const t=this.descendants(Id),e=t.reduce(((t,e)=>Math.max(e.children.length,t)),0);t.forEach((t=>{new Array(e-t.children.length).fill(0).forEach((()=>{let e;null!=t.children.head&&(e=Rd.formats(t.children.head.domNode));const n=this.scroll.create(Rd.blotName,e);t.appendChild(n),n.optimize()}))}))}cells(t){return this.rows().map((e=>e.children.at(t)))}deleteColumn(t){const[e]=this.descendant(Md);null!=e&&null!=e.children.head&&e.children.forEach((e=>{const n=e.children.at(t);null!=n&&n.remove()}))}insertColumn(t){const[e]=this.descendant(Md);null!=e&&null!=e.children.head&&e.children.forEach((e=>{const n=e.children.at(t),r=Rd.formats(e.children.head.domNode),i=this.scroll.create(Rd.blotName,r);e.insertBefore(i,n)}))}insertRow(t){const[e]=this.descendant(Md);if(null==e||null==e.children.head)return;const n=Dd(),r=this.scroll.create(Id.blotName);e.children.head.children.forEach((()=>{const t=this.scroll.create(Rd.blotName,n);r.appendChild(t)}));const i=e.children.at(t);e.insertBefore(r,i)}rows(){const t=this.children.head;return null==t?[]:t.children.map((t=>t))}}function Dd(){const t=Math.random().toString(36).slice(2,6);return`row-${t}`}(0,i.A)(Bd,"blotName","table-container"),(0,i.A)(Bd,"tagName","TABLE"),Bd.allowedChildren=[Md],Md.requiredContainer=Bd,Md.allowedChildren=[Id],Id.requiredContainer=Md,Id.allowedChildren=[Rd],Rd.requiredContainer=Id;class Ud extends Mc{static register(){ru.register(Rd),ru.register(Id),ru.register(Md),ru.register(Bd)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Bd).forEach((t=>{t.balanceCells()}))}deleteColumn(){const[t,,e]=this.getTable();null!=e&&(t.deleteColumn(e.cellOffset()),this.quill.update(ru.sources.USER))}deleteRow(){const[,t]=this.getTable();null!=t&&(t.remove(),this.quill.update(ru.sources.USER))}deleteTable(){const[t]=this.getTable();if(null==t)return;const e=t.offset();t.remove(),this.quill.update(ru.sources.USER),this.quill.setSelection(e,ru.sources.SILENT)}getTable(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==t)return[null,null,null,-1];const[e,n]=this.quill.getLine(t.index);if(null==e||e.statics.blotName!==Rd.blotName)return[null,null,null,-1];const r=e.parent,i=r.parent.parent;return[i,r,e,n]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[n,r,i]=this.getTable(e);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+t),this.quill.update(ru.sources.USER);let o=r.rowOffset();0===t&&(o+=1),this.quill.setSelection(e.index+o,e.length,ru.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[n,r,i]=this.getTable(e);if(null==i)return;const s=r.rowOffset();n.insertRow(s+t),this.quill.update(ru.sources.USER),t>0?this.quill.setSelection(e,ru.sources.SILENT):this.quill.setSelection(e.index+r.children.length,e.length,ru.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const n=this.quill.getSelection();if(null==n)return;const r=new Array(t).fill(0).reduce((t=>{const n=new Array(e).fill("\n").join("");return t.insert(n,{table:Dd()})}),(new gs).retain(n.index));this.quill.updateContents(r,ru.sources.USER),this.quill.setSelection(n.index,ru.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(ru.events.SCROLL_OPTIMIZE,(t=>{t.some((t=>!!["TD","TR","TBODY","TABLE"].includes(t.target.tagName)&&(this.quill.once(ru.events.TEXT_CHANGE,((t,e,n)=>{n===ru.sources.USER&&this.balanceTables()})),!0)))}))}}var Pd=Ud;const zd=gc("quill:toolbar");class Fd extends Mc{constructor(t,e){if(super(t,e),Array.isArray(this.options.container)){const e=document.createElement("div");e.setAttribute("role","toolbar"),$d(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;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach((t=>{const e=this.options.handlers?.[t];e&&this.addHandler(t,e)})),Array.from(this.container.querySelectorAll("button, select")).forEach((t=>{this.attach(t)})),this.quill.on(ru.events.EDITOR_CHANGE,(()=>{const[t]=this.quill.selection.getRange();this.update(t)}))):zd.error("Container required for toolbar",this.options)}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find((t=>0===t.indexOf("ql-")));if(!e)return;if(e=e.slice(3),"BUTTON"===t.tagName&&t.setAttribute("type","button"),null==this.handlers[e]&&null==this.quill.scroll.query(e))return void zd.warn("ignoring attaching to nonexistent format",e,t);const n="SELECT"===t.tagName?"change":"click";t.addEventListener(n,(n=>{let r;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;const e=t.options[t.selectedIndex];r=!e.hasAttribute("selected")&&(e.value||!1)}else r=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[e])this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof os){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents((new gs).retain(i.index).delete(i.length).insert({[e]:r}),ru.sources.USER)}else this.quill.format(e,r,ru.sources.USER);this.update(i)})),this.controls.push([e,t])}update(t){const e=null==t?{}:this.quill.getFormat(t);this.controls.forEach((n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==t)n=null;else if(null==e[r])n=i.querySelector("option[selected]");else if(!Array.isArray(e[r])){let t=e[r];"string"===typeof t&&(t=t.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${t}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==t)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const t=e[r],n=t===i.getAttribute("value")||null!=t&&t.toString()===i.getAttribute("value")||null==t&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const t=null!=e[r];i.classList.toggle("ql-active",t),i.setAttribute("aria-pressed",t.toString())}}))}}function Hd(t,e,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${e}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${e}: ${n}`)):r.setAttribute("aria-label",e),t.appendChild(r)}function $d(t,e){Array.isArray(e[0])||(e=[e]),e.forEach((e=>{const n=document.createElement("span");n.classList.add("ql-formats"),e.forEach((t=>{if("string"===typeof t)Hd(n,t);else{const e=Object.keys(t)[0],r=t[e];Array.isArray(r)?Vd(n,e,r):Hd(n,e,r)}})),t.appendChild(n)}))}function Vd(t,e,n){const r=document.createElement("select");r.classList.add(`ql-${e}`),n.forEach((t=>{const e=document.createElement("option");!1!==t?e.setAttribute("value",String(t)):e.setAttribute("selected","selected"),r.appendChild(e)})),t.appendChild(r)}Fd.DEFAULTS={},Fd.DEFAULTS={container:null,handlers:{clean(){const t=this.quill.getSelection();if(null!=t)if(0===t.length){const t=this.quill.getFormat();Object.keys(t).forEach((t=>{null!=this.quill.scroll.query(t,ki.INLINE)&&this.quill.format(t,!1,ru.sources.USER)}))}else this.quill.removeFormat(t.index,t.length,ru.sources.USER)},direction(t){const{align:e}=this.quill.getFormat();"rtl"===t&&null==e?this.quill.format("align","right",ru.sources.USER):t||"right"!==e||this.quill.format("align",!1,ru.sources.USER),this.quill.format("direction",t,ru.sources.USER)},indent(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e),r=parseInt(n.indent||0,10);if("+1"===t||"-1"===t){let e="+1"===t?1:-1;"rtl"===n.direction&&(e*=-1),this.quill.format("indent",r+e,ru.sources.USER)}},link(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,ru.sources.USER)},list(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e);"check"===t?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,ru.sources.USER):this.quill.format("list","unchecked",ru.sources.USER):this.quill.format("list",t,ru.sources.USER)}}};const Kd='',Wd='',Zd='',Gd='',Xd='',Yd='',Qd='',Jd='',tf='',ef='',nf='',rf='',sf='',of='',lf='',af='',cf='',uf='',hf='',df='',ff='',pf='',gf='',mf='',bf='',vf='',yf='',xf='',Nf='',wf='',Af='',Ef='',qf='';var kf={align:{"":Kd,center:Wd,right:Zd,justify:Gd},background:Xd,blockquote:Yd,bold:Qd,clean:Jd,code:tf,"code-block":tf,color:ef,direction:{"":nf,rtl:rf},formula:sf,header:{1:of,2:lf,3:af,4:cf,5:uf,6:hf},italic:df,image:ff,indent:{"+1":pf,"-1":gf},link:mf,list:{bullet:bf,check:vf,ordered:yf},script:{sub:xf,super:Nf},strike:wf,table:Af,underline:Ef,video:qf};const _f='';let Lf=0;function Of(t,e){t.setAttribute(e,`${!("true"===t.getAttribute(e))}`)}class Sf{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();break;default:}})),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),Of(this.label,"aria-expanded"),Of(this.options,"aria-hidden")}buildItem(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const n=t.getAttribute("value");return n&&e.setAttribute("data-value",n),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",(()=>{this.selectItem(e,!0)})),e.addEventListener("keydown",(t=>{switch(t.key){case"Enter":this.selectItem(e,!0),t.preventDefault();break;case"Escape":this.escape(),t.preventDefault();break;default:}})),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML=_f,t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${Lf}`,Lf+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach((e=>{const n=this.buildItem(e);t.appendChild(n),!0===e.selected&&this.selectItem(n)})),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach((t=>{this.container.setAttribute(t.name,t.value)})),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout((()=>this.label.focus()),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);const e=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}var Tf=Sf;class jf extends Tf{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach((t=>{t.classList.add("ql-primary")}))}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const n=this.label.querySelector(".ql-color-label"),r=t&&t.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}var Cf=jf;class Rf extends Tf{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach((t=>{t.innerHTML=e[t.getAttribute("data-value")||""]})),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const n=t||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}var If=Rf;const Mf=t=>{const{overflowY:e}=getComputedStyle(t,null);return"visible"!==e&&"clip"!==e};class Bf{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,Mf(this.quill.root)&&this.quill.root.addEventListener("scroll",(()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"})),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(t){const e=t.left+t.width/2-this.root.offsetWidth/2,n=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let s=0;if(i.right>r.right&&(s=r.right-i.right,this.root.style.left=`${e+s}px`),i.leftr.bottom){const e=i.bottom-i.top,r=t.bottom-t.top+e;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return s}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}var Df=Bf;const Uf=[!1,"center","right","justify"],Pf=["#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"],zf=[!1,"serif","monospace"],Ff=["1","2","3",!1],Hf=["small",!1,"large","huge"];class $f extends $c{constructor(t,e){super(t,e);const n=e=>{document.body.contains(t.root)?(null==this.tooltip||this.tooltip.root.contains(e.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach((t=>{t.container.contains(e.target)||t.close()}))):document.body.removeEventListener("click",n)};t.emitter.listenDOM("click",document.body,n)}addModule(t){const e=super.addModule(t);return"toolbar"===t&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach((t=>{const n=t.getAttribute("class")||"";n.split(/\s+/).forEach((n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=e[n]))if("direction"===n)t.innerHTML=e[n][""]+e[n].rtl;else if("string"===typeof e[n])t.innerHTML=e[n];else{const r=t.value||"";null!=r&&e[n][r]&&(t.innerHTML=e[n][r])}}))}))}buildPickers(t,e){this.pickers=Array.from(t).map((t=>{if(t.classList.contains("ql-align")&&(null==t.querySelector("option")&&Wf(t,Uf),"object"===typeof e.align))return new If(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){const n=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&Wf(t,Pf,"background"===n?"#ffffff":"#000000"),new Cf(t,e[n])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?Wf(t,zf):t.classList.contains("ql-header")?Wf(t,Ff):t.classList.contains("ql-size")&&Wf(t,Hf)),new Tf(t)}));const n=()=>{this.pickers.forEach((t=>{t.update()}))};this.quill.on(yc.events.EDITOR_CHANGE,n)}}$f.DEFAULTS=qi({},$c.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let t=this.container.querySelector("input.ql-image[type=file]");null==t&&(t=document.createElement("input"),t.setAttribute("type","file"),t.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),t.classList.add("ql-image"),t.addEventListener("change",(()=>{const e=this.quill.getSelection(!0);this.quill.uploader.upload(e,t.files),t.value=""})),this.container.appendChild(t)),t.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Vf extends Df{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",(t=>{"Enter"===t.key?(this.save(),t.preventDefault()):"Escape"===t.key&&(this.cancel(),t.preventDefault())}))}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=e?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,yc.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,yc.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=Kf(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(null!=e){const n=e.index+e.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),t,yc.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",yc.sources.USER),this.quill.setSelection(n+2,yc.sources.USER)}break}default:}this.textbox.value="",this.hide()}}function Kf(t){let e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return e?`${e[1]||"https"}://www.youtube.com/embed/${e[2]}?showinfo=0`:(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${e[1]||"https"}://player.vimeo.com/video/${e[2]}/`:t}function Wf(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach((e=>{const r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(e)),t.appendChild(r)}))}const Zf=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Gf extends Vf{constructor(t,e){super(t,e),this.quill.on(yc.events.EDITOR_CHANGE,((t,e,n,r)=>{if(t===yc.events.SELECTION_CHANGE)if(null!=e&&e.length>0&&r===yc.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const t=this.quill.getLines(e.index,e.length);if(1===t.length){const t=this.quill.getBounds(e);null!=t&&this.position(t)}else{const n=t[t.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,e.index+e.length-r),s=this.quill.getBounds(new Nc(r,i));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(yc.events.SCROLL_OPTIMIZE,(()=>{setTimeout((()=>{if(this.root.classList.contains("ql-hidden"))return;const t=this.quill.getSelection();if(null!=t){const e=this.quill.getBounds(t);null!=e&&this.position(e)}}),1)}))}cancel(){this.show()}position(t){const e=super.position(t),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==e&&(n.style.marginLeft=-1*e-n.offsetWidth/2+"px"),e}}(0,i.A)(Gf,"TEMPLATE",['','
    ','','',"
    "].join(""));class Xf extends $f{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Zf),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new Gf(this.quill,this.options.bounds),null!=t.container&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),kf),this.buildPickers(t.container.querySelectorAll("select"),kf))}}Xf.DEFAULTS=qi({},$f.DEFAULTS,{modules:{toolbar:{handlers:{link(t){t?this.quill.theme.tooltip.edit():this.quill.format("link",!1,ru.sources.USER)}}}}});const Yf=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class Qf extends Vf{constructor(...t){super(...t),(0,i.A)(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",(t=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),t.preventDefault()})),this.root.querySelector("a.ql-remove").addEventListener("click",(t=>{if(null!=this.linkRange){const t=this.linkRange;this.restoreFocus(),this.quill.formatText(t,"link",!1,yc.sources.USER),delete this.linkRange}t.preventDefault(),this.hide()})),this.quill.on(yc.events.SELECTION_CHANGE,((t,e,n)=>{if(null!=t){if(0===t.length&&n===yc.sources.USER){const[e,n]=this.quill.scroll.descendant(dd,t.index);if(null!=e){this.linkRange=new Nc(t.index-n,e.length());const r=dd.formats(e.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const i=this.quill.getBounds(this.linkRange);return void(null!=i&&this.position(i))}}else delete this.linkRange;this.hide()}}))}show(){super.show(),this.root.removeAttribute("data-mode")}}(0,i.A)(Qf,"TEMPLATE",['','','',''].join(""));class Jf extends $f{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Yf),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"),kf),this.buildPickers(t.container.querySelectorAll("select"),kf),this.tooltip=new Qf(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},((e,n)=>{t.handlers.link.call(t,!n.format.link)})))}}Jf.DEFAULTS=qi({},$f.DEFAULTS,{modules:{toolbar:{handlers:{link(t){if(t){const t=this.quill.getSelection();if(null==t||0===t.length)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&0!==e.indexOf("mailto:")&&(e=`mailto:${e}`);const{tooltip:n}=this.quill.theme;n.edit("link",e)}else this.quill.format("link",!1,ru.sources.USER)}}}}});var tp=Jf;Qh.register({"attributors/attribute/direction":Tu,"attributors/class/align":xu,"attributors/class/background":qu,"attributors/class/color":Au,"attributors/class/direction":ju,"attributors/class/font":Iu,"attributors/class/size":Du,"attributors/style/align":Nu,"attributors/style/background":ku,"attributors/style/color":Eu,"attributors/style/direction":Cu,"attributors/style/font":Bu,"attributors/style/size":Uu},!0),Qh.register({"formats/align":xu,"formats/direction":ju,"formats/indent":ed,"formats/background":ku,"formats/color":Eu,"formats/font":Iu,"formats/size":Du,"formats/blockquote":rd,"formats/code-block":Lu,"formats/header":sd,"formats/list":ld,"formats/bold":cd,"formats/code":Ou,"formats/italic":hd,"formats/link":dd,"formats/script":gd,"formats/strike":bd,"formats/underline":yd,"formats/formula":Nd,"formats/image":Ed,"formats/video":_d,"modules/syntax":Cd,"modules/table":Pd,"modules/toolbar":Fd,"themes/bubble":Xf,"themes/snow":tp,"ui/icons":kf,"ui/picker":Tf,"ui/icon-picker":If,"ui/color-picker":Cf,"ui/tooltip":Df},!0);var ep=Qh}}]); //# sourceMappingURL=7733a4dfbbbed079.js.map